Skip to content

experiment: attribute the losing case's cost to a plan decision, not to a layout - #98

Merged
shinaoka merged 1 commit into
mainfrom
exp/traversal-attribution
Oct 10, 2026
Merged

shinaoka merged 1 commit into
mainfrom
exp/traversal-attribution

Conversation

@shinaoka

Copy link
Copy Markdown
Member

experiments/openblas-kernel gained src/bin/traversal.rs: one contraction — the campaign's worst losing TCCG case, abjc-cbka-kj f64 16 MiB, effective GEMM 92160×40×48 — under four operand layouts. The case's own plan-recorded "corpus" strides versus compact column-major matrices, for A and for the output independently. Same family, same blocking, same thread budget; only the layout changes.

Result (1T, best of 5, 1500 ms per variant — results/2026-10-10-traversal/)

variant ms GFLOP/s
corpus-a-corpus-d 11.62 30.5
corpus-a-compact-d 11.41 31.0
compact-a-corpus-d 34.29 10.3
compact-a-compact-d 33.92 10.4

It inverted the question the binary was written to answer. The two variants carrying the campaign's own layouts run in 11.6 ms, while the campaign's plan takes 38.1 ms on that case with the identical family (avx512.f64.real.24x8) and blocking (264/1536/256). The plans differ: this binary's plan folds the m group into two axes (PlanStats.m_axes), the campaign's keeps three. So on this problem a plan-level traversal decision is worth 3.3×, and the operand-layout swap the binary was built to measure moves nothing (11.62 vs 11.41 ms).

Two caveats, both in the README

  • The residual column compares differently permuted buffers, so it is not a correctness check — ignore it.
  • The layouts and dimensions are faithful to the plan's record, but the plan built from them is not the campaign's. This attributes a decision, not a measurement of a published cell. Which decision (the fold count, the axis order, or something else the two plans do differently) is the next thing to pin down by diffing the two reports; until then the 3.3× is not attributable to a specific knob.

Why this matters for the design question

Everything else a reader would blame has been measured and excluded: the micro-kernel (a production kernel in our driver is 1.4–2.0× slower on every shape), the blocking model, the blocking values, the orientation, the partition, the write-back mode, the output alignment (forcing align_c_lines=true leaves 38.17 vs 38.24 ms), and the row-block shape (mr=8 gains 5%). What is left is the packed route's traversal, and this binary shows a 3.3× spread that comes from the plan rather than from the data layout.

…to a layout

`experiments/openblas-kernel` gained `src/bin/traversal.rs`: one contraction - the
campaign's worst losing TCCG case, `abjc-cbka-kj` f64 16 MiB, effective GEMM 92160x40x48 -
under four operand layouts, the case's own plan-recorded "corpus" strides against compact
column-major matrices, for `A` and the output independently. Same family, same blocking,
same thread budget.

The result inverted the question the binary was written to answer. All four variants run
in 11.4-34.3 ms, and the two that carry the *campaign's own layouts* run in 11.6 ms - while
the campaign's plan takes 38.1 ms on that case with the identical family
(`avx512.f64.real.24x8`) and blocking (264/1536/256). Comparing the plans explains it: this
binary's plan folds the `m` group into two axes, the campaign's keeps three. So on this
problem a plan-level traversal decision is worth 3.3x, and the layout swap the binary was
built to measure moves nothing (11.62 against 11.41 ms).

Two caveats, both in the README: the `residual` column compares permuted buffers, so it is
not a correctness check; and the layouts and dimensions are faithful to the plan's record
while the *plan* built from them is not the campaign's, so this attributes a decision, not
a measurement of a published cell.

Results and manifest in `results/2026-10-10-traversal/`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant