Skip to content

The item to tile map is row-major, and the GEMM already lives in L2 #89

Closed

Description

@feitreim

pipeline::run maps work items to tiles linearly — item i becomes tile i,
walked in row-major order across the output. For a GEMM that is close to the
worst case for L2 locality, and L2 is where this kernel already lives.

The traffic argument

At 8192³ the GEMM pulls A+B at roughly 12.7 TB/s: a [256, 128] pair tile
is M·N/(M+N) = 85.3 FLOP per byte, against 1081 TFLOP/s measured. B200 HBM is
about 8 TB/s. The unique input is 268 MB and the total read is ~12.9 GB, so
the kernel is running at roughly 48x reuse and the majority of its traffic is
already L2 hits
— not by design, just by whatever locality row-major
traversal happens to give.

To reach the 1.7–1.9 PFLOP/s bf16 target that becomes ~20–22 TB/s at today's
intensity, or ~13–15 TB/s at the [256, 256] tile of #87. Every path to the
target runs through L2 hit rate
, which makes traversal order a first-class
lever rather than a micro-optimization.

The standard fix, and why it is cheap here

Grouped or swizzled traversal — CUTLASS calls it a threadblock swizzle. Walk the
output in blocks of a few tile-columns at a time so the A panel stays resident
across a group, instead of streaming the whole B panel between reuses of A.

#83 is what makes this a one-place change. It moved the item → tile mapping
into pipeline::run, so this is a change to the scaffold rather than surgery on
the kernel's grid math. That is a payoff from #83 that its own dead-heat
benchmark could not show, and it is worth noting in the PR: the parity result
bought optionality.

Scope

Sequencing

Behind #86, which is measuring whether the kernel is bandwidth- or
latency-bound and what the L2 hit rate actually is. If it turns out the kernel
is latency-bound, this issue is worth much less than the traffic argument above
suggests, and #87 or #15's lcsf should go first. Do not start this on the
strength of the arithmetic alone — the arithmetic says L2 matters, not that
its hit rate is currently bad.

Acceptance

Exact at every size before timing, a swept group width with the losing values
kept, and before/after at 8192³ and 16384³. Report the L2 hit rate either side,
not only the throughput — a throughput win with an unchanged hit rate means the
cause was something else and the change is not what it claims.

Related: #86 (the bound and the hit rate — the prerequisite), #87 (the tile,
which moves the optimum), #88 (CLC, which composes), #83 (which put the mapping
in one place).

Activity

  1. added
    area:scaffolding
    on Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:scaffolding

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions