Skip to main content

Static local loads per causal attention loop (S1): result

Post-hoc, compiler output only. This is step 1 of the local load count plan. It reads compiled SASS, no label and no GPU. It fits nothing and changes no core, frontend or profile.

  • Tool. scripts/static_local_loads.py, run at commit 0b2ad76 (the same script as 7c6f0a0 on this branch after the rebase), with Triton 3.9.0 and its bundled ptxas (sm_89) and ptxas-blackwell (sm_121).
  • Scope. All 108 configs of the four causal development cases of validation/attention-suite.json, on both targets. No holdout case is compiled.
  • Data. sm_89 and sm_121.

Method​

Each config is compiled through the frontend's AOT path. Its PTX is assembled with the frontend's ptxas flags plus -lineinfo and disassembled with nvdisasm -gi. Each LDL and STL is then classified twice: by loop, and by where in the loop it sits.

  • Loop. An instruction belongs to the main or the diagonal loop when its inline stack has a frame on that loop's _attention_tiles call site in fused_attention. Otherwise it is outside both loops.
  • Loop body or peeled. It is in the loop body when it also lies within the address range of a backward branch. Otherwise it is peeled: prologue and epilogue copies of a pipelined loop, or the helper's setup.
  • Width. It comes from the opcode suffix (4 B unless .64, .128 or a narrow type).

The per-iteration estimate weights the two parts by the loop's trips, counted from the shape as microbench.spill_counters counts them. With V CTA iterations and E loop entries over the launch, the estimate is (body x (V - E) + peeled x E) / V. It assumes a peeled copy runs once per loop entry. That assumption is not checked.

Check of the parse. On both targets and all 108 configs, the bytes of all LDL and STL in the SASS equal the assembler's spill_loads_bytes and spill_stores_bytes exactly.

Results​

Spilling configs: 27 of 108 on sm_89 and 28 on sm_121. m64n32-w8-s3 of b2-q32-kv4-s768-d128-causal spills on sm_121 only.

S1's per-iteration estimate against the core's figure per loop (spill_loads_bytes / 4 / spill_loop_count), over the spilling configs:

sm_89sm_121
Main loop, S1 over core: median (range)0.13 (0.00 to 0.86)0.31 (0.01 to 0.63)
Diagonal loop, S1 over core: median (range)0.40 (0.00 to 0.86)0.31 (0.00 to 0.45)
Main over diagonal, where both reload: median (range)1.17 (0.01 to 2.26)0.99 (0.02 to 2.04)
Share of a launch's LDL instructions outside both loops: median (range)0.14 (0.03 to 0.83)0.17 (0.03 to 0.95)
Share of LDL instructions peeled from the loop bodies: median (range)0.17 (0.04 to 0.43)0.21 (0.04 to 0.57)
LDL wider than 4 B, all scopes4 of 4935540 of 5317
Predicated LDLnonenone
  1. The core's figure overcounts every spilling config on both targets. On no config does S1 reach the core's per-loop figure; the highest ratio is 0.86. The largest absolute cases are the m128n128-w4 configs: the core charges 322 to 366 reloads per loop, and S1 gives 173 to 238 in the main loop and 96 to 127 in the diagonal one.
  2. The two loops hold different spill code. In the m128n128-w8 configs the main loop has almost no reloads (0.0 to 0.3) and the diagonal loop has 1 to 8. In the m128n128-w4 configs the main loop reloads about twice as much as the diagonal one.
  3. A part of the static figure is outside both loops, or peeled. By instruction count, the median is 14% (sm_89) and 17% (sm_121) outside, and 17% and 21% peeled. In the b1-q16-kv16-s1025-d64 configs most reloads are outside both loops (S1 is 0.0 to 3.6 per iteration against a core figure of 2.5 to 21.5).
  4. Wider reloads are almost all on sm_121. There, 540 of 5317 LDL are 8 B, against 4 on sm_89 (peeled copies of the main loop of m128n32-w4-s2/s3). Where reloads are 8 B wide, bytes over 4 B overcount the reloads.
  5. The targets differ. The same configs spill differently on sm_121 and sm_89. Of the 27 configs that spill on both, 23 have more spill load bytes on sm_121. The ratio is 0.99 to 8.6, the largest for b1-q16-kv16-s1025-d64 m128n64-w4-s2 (172 B against 20 B). A count made for one target does not carry over to the other.

Orientation only, not a reading. Three configs of b2-q32-kv4-s768-d128-causal were also compiled for sm_86. They give the same S1 as sm_89. Against the post-hoc RTX 3070 counters (spill-counters-rtx3070-posthoc.md):

ConfigLoopS1RTX 3070 counters
m128n64-w4-s2main32.032.4
m128n64-w4-s2diagonal16.023.5
m128n128-w8-s2main00
m128n128-w8-s2diagonal3.03.0

The plan sets this comparison aside: the RTX 3070 is not a reference GPU, and the readings of step 3 use RTX 4070 counters only.

What this does not settle​

  • S1 against executed counts. The agreement of S1 with D1 is step 3 of the plan. It needs counters on the RTX 4070, and on GB10 root access that the project does not have. Until then S1 on GB10 stays unchecked.
  • The peeled weighting. One peeled copy per loop entry is an assumption, and the diagonal loop of m128n64-w4-s2 is the case where it gives 16.0 against the RTX 3070's 23.5.
  • No model change. Using S1 in the core waits for the spill decision of ad1d505 to be scored, as the plan states.