Repository navigation
One CTA an SM, six K stages and two accumulators: the configuration cuBLASLt runs (#80) - #86
Merged
Merged
Conversation
This was referenced Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cuBLASLt's kernel was decoded in #80 as
nvjet_tst_128x256_64x6_2x1_2cta: our tile, our cluster, ourBLOCK_K— and six K stages at one CTA an SM against our three at two. This PR is that configuration, with the three resources the halving frees actually spent.Twelve of fourteen model rows cross 0.90; the mean goes 0.906 → 0.939 against a same-day
main, and the accumulator handoff — the term #84 left as the whole residual — is measured at 4 815 → 100 SM ticks.The change is three constants and one 16 KiB
CTAS_PER_SMkeeps its old formula512 / ACCUM_COLSand now reads 1 — and for the first time the two residency limits agree instead of one binding before the other is consulted: the six-stage ring is 196 608 B and asks for one CTA an SM independently.MAX_CLUSTERSfalls out at 74.Increment 1 — the accumulator is a ping-pong
Every route to overlapping the drain with the next item's MMA died on the same fact: a second 256-column accumulator needs tensor memory an SM does not have at two CTAs an SM. At one it has exactly enough. Consecutive items alternate between the two halves of one 512-column allocation (
Tile::slot), and the release moves fromempty(i + 1)toempty(i + SLOTS)— what the next item waits on is no longer this item's drain but the one before it, which has had a whole item's MMA to finish.This is
80-column-halves' discipline lifted onto a full-width tile. It cost that branch ×1.50 on the operand fill because it had to split 256 columns; here the tile does not change at all, and the ping-pong costs one register.Increment 2 — the bf16 drain gets the wide staging tile
STAGE_Nwas 64 because four[32, 128]staging tiles are 32 768 B against 16 384, and at two CTAs an SM the plan had no such 16 KiB. So the bf16 band was(32/16)·(64/64) = 2.x8issues a pass and four exposed TMEM latencies a band, where #84 got the fp32 store down to two. At 128 a band is exactlyISSUE_LIMITissues behind one wait and exactly the 128 registers a thread holds — the shapeWide's half-row has had since #84 — so the bf16 band leaves tensor memory in two waits and the drain is two passes instead of four.Reducekeeps its ownREDUCE_N = 64, since the reduction store's box is what fixes that width, and simply borrows a prefix of the wider buffer.Plan: 114 816 B → 229 632 B, against the 232 448 the device's own
MAX_SHARED_MEMORY_PER_BLOCK_OPTINgrants a CTA. cuBLASLt declares 213 280.The phase probe says the handoff is gone
80-pingpong-probecarries theclock64instrument with the ping-pong itself behind a const, so before and after are one binary at the same residency, the same six stages and the same plan — onlySLOTSdiffers. Per item, rank-0 SM ticks:Four shapes, same story: ACC 4 289 → 114 and 4 244 → 114 at the gate_up geometry, 4 679 → 100 at K = 9216. The handoff is not smaller, it is off the critical path — the drain itself gets slower (7 990 → 10 470, it now contends with a running MMA) and the item gets 14% shorter anyway.
What is left of the issuer's item is the feed:
FEEDis 3 411 of 27 736 ticks at K = 3072 and 9 422 of 81 045 at K = 9216 — 12% either way — whereFILLis 118 andACCis 100. That is the next term, and it is not one this PR's structure can reach: six stages is 196 608 B and a seventh does not fit.model_shapes,
--features cublas, B200Two sessions of this branch against a same-day
main@ 0b652de.ppis the mean of three sessions of increment 1 alone (80-ping-pong), kept because it is what separates the two increments.bwd down dW— the row this issue has never moved — goes 0.797 → 0.928, and its wave arithmetic is why: 192 tiles over 74 clusters is 86.5% last-wave efficiency where over 148 it was 64.9%, and 86.4% is what #84 recorded cuBLASLt itself reaching on that shape.What is honestly not there yet
lm_head fwdsits at 0.895 on the session mean and it is the one row that misses the bar. Both bf16 store rows are also by far the noisiest in the table — 0.933 / 0.888 / 0.863 across three sessions of increment 1 — because they are the two biggest matrices in the model and their cuBLASLt denominators move 3–5% between containers. Increment 2 is what moved them, and the honest measurement of it is the absolute throughput, not the ratio:On those same sessions the ratios are 0.876 → 0.895 and 0.870 → 0.900. So the wide staging tile is worth about two points on each, and lm_head fwd still needs about half a point more.
Square bench, same-day
mainNine cells improve by 3–7 points, three sit within ±0.01. No per-shape dispatch was needed — the CTA halving refunds at every square size, including the deep-K rows the gate was worried about.
One caveat on the record: increment 1 alone measured 16384³ f32 store at 0.875 in its own container and this PR measures 0.913, and this PR does not touch the fp32 store path at all — 5.955 ms against 5.612 ms for the same code. That cell is the one #83 and #84 both recorded moving the wrong way for L2 reasons at a 1 GiB
C, and it is worth ±0.04 between containers. Read it loosely.Full-step A/B, same container, both orders
--baseline-ref 0b652de, run at d0725de — the head adds oneconst _: () = assert!and nothing else. Only the=== baseline ===/=== candidate ===pair is the measurement;compare_profileemits four profiles and the two build-time ones are not it.The two orders agree on the GEMM-row sum to 0.9 ms and disagree on the full step by 2.9, so the GEMM-row sum is the number: −4.22 ms of 166, −2.5%. Only GEMM rows can move here, and the ~60 others carry ±2 ms of container noise between the two runs — which is also why the implied second-position penalty comes out negative this time where #84 measured +4.97 ms from both orders independently. Read the full-step column loosely and the GEMM column as the measurement.
Per row, mean of the two orders:
The three rows that pay are the
dWtransposed-walk rows, which is exactly whatmodel_shapessays:bwd qkv dWandbwd o_proj dWare the two rows this configuration costs 2 points on, and they are the two rows whose tile counts (432 and 144) were already quantizing well over 148 clusters and now quantize no better over 74.GROUP stays 8, and now for a reason
The brief on this increment asked not to inherit
GROUP = 8blindly through a halved cluster count. Measured at 16 on this branch: neutral to slightly worse on absolute throughput at every row and nothing on the two bf16 rows it was aimed at (qkv fwd 1824 TF/s against 1809/1778, but o_proj 1734 against 1779/1765, bwd qkv dx 1761 against 1814/1784, bwd lm_head dx 1606 against 1650/1610).The arithmetic agrees.
groupedwalksGROUPtile-rows down a column before moving right, so a wave ofMAX_CLUSTERSclusters covers aGROUP × (MAX_CLUSTERS / GROUP)rectangle of tiles, and the operand footprint in flight is smallest when that rectangle is square. At 148 clustersGROUP = 8gave 8 × 18.5 — lopsided. At 74 it gives 8 × 9.25, and√74 = 8.60. The constant was tuned for the wrong residency and the new one happens to be what it wanted.Gates
--kernel gemmparity: green, all shapes, both layouts, store and accumulate. ptxas 134 / 168 / 146, zero spill on all three. The budgets are ratcheted to those, and two of them rose by one register — the ping-pong'ssequence % SLOTSand the bf16 drain's wider band. That the counts barely moved is itself the result: at one CTA an SM a thread is granted the architecture's 255 rather than the ~170 twelve warps left it, so the ceiling that closed The drain runs beside the next item's MMA, not in front of it (#80 remedy 2) #83's two-band hoist is gone and nothing in this kernel needed it.--kernel ops: green.--kernel model: green on rerun. The first run took the known stochastic miss of the MoE overfit assertion at 0.0597 against the 0.05 bound — the same value The drain runs beside the next item's MMA, not in front of it (#80 remedy 2) #83 and The item stream has no boundary, and the drain lifts half-rows behind one wait (#80) #84 both recorded — with every numerical parity row green above it.main, all above.Branches preserved
80-ping-pong— increment 1 alone (deep ring + ping-pong,STAGE_Nstill 64), the measurement point the two increments are separated at.80-pingpong-probe— the phase probe on this kernel, withgemm_probe_f32_nopingas the one-slot control. A stopwatch does not belong in the shipped module.