Repository navigation
fix: gemm sol phase4b - #1066
fix: gemm sol phase4b #1066
Conversation
nihalpasham
left a comment
There was a problem hiding this comment.
- The fix itself checks out line by line: TILE_INFO_FREE's 5 arrivals match the 5 reader warps (MMA plus four epilogue), the first publish is deliberately unguarded, the terminal has_work=0 publish waits without toggling, and cleanup invalidation sits behind the full block+cluster sync. The pre-fix race is real: the epilogue's coordinate reads lag the producer by a full tile with no acknowledgment.
- One structural blocker: this branch carries #1065's commit byte-for-byte, so merging it as-is would land the whole ptx-schedule crate under a fix title. Once #1065 merges, rebase (or say the word and we'll rebase for you) so the diff shrinks to the single gemm_sol file, then this goes in.
- Our host compile-gates sm_100a only, so the B200 evidence (seeds 56 and 135 fixed, TFLOPS within noise) stays author-attested; acceptable for a correctness fix.
- Worth a follow-up: phases 4A, 4C, and 4D use the identical mailbox pattern and were not swept.
34f00c0 to
7d98253
Compare
|
nihalpasham
left a comment
There was a problem hiding this comment.
- Blocker: the five-reader handshake fixes the Phase 4B TILE_INFO reuse, but the same producer/consumer race is still present in Phases 4A, 4C, and 4D.
- Where: Phase 4A publishes at
1624–1630and reads at1724–1727/1839–1849; Phase 4C publishes at2763–2766and2907–2920and reads at3031–3034/3141–3150; Phase 4D publishes at3460–3463and3573–3602and reads at3696–3699/3848–3857. - Required fix: give every phase the same explicit publish/read/ack ownership rule, then run per-phase B200 sweeps that exercise wraparound and the terminal tile. Compile-only checks cannot rule out a parity deadlock.
- DCO: amend the contributor commit with a
Signed-off-bytrailer. - Local validation: fmt, clippy, compile-only smoke, LLVM inspection, and
ptxas -arch sm_100apass for Phase 4B. No suitable GPU is available here, so the complete synchronization claim remains unverified.
The gemm_sol_clc producer warp republished the TILE_INFO mailbox after signaling TILE_READY without waiting for the MMA and epilogue warps to copy the current tile coordinates. Add a TILE_INFO_FREE mbarrier (arrival count 5, one leader per reader warp) that the producer waits on before each republish, including the final has_work = 0 publish. Found by the schedule perturbation campaign: seeds 56 and 135 of a 0..140 --focus mbarrier sweep on a B200 (sm_100a) failed the phase 4B validator 3/3; with this fix the same sweep is clean and phase 4b throughput is unchanged within noise. Signed-off-by: David Holtz <[email protected]>
7d98253 to
d6e7d92
Compare
Signed-off-by: David Holtz <[email protected]>
d6e7d92 to
368d812
Compare
|
thanks for re-reviewing, i've updated the pr to address all of the stages and resolved the other items below!
done - 4A, 4C, and 4D now use the same
ran the per-phase sweeps on a B200. they surfaced two deadlocks in the extension, both fixed: a producer readback race in 4A ( for p in 4a 4b 4c 4d; do
GEMM_SOL_PHASE=${p}-correctness cargo oxide fuzz-schedule gemm_sol \
--arch sm_100a --seeds 0..140 --focus mbarrier --confirm-runs 3 --timeout-secs 20
doneoutputs perf is within ~1% of the pre-fix kernels (interleaved A/B, means of 3: 4B 505.1 -> 500.1 TFLOPS at 4096, 497.0 -> 492.5 at 8192, 483.0 -> 478.8 at 16384) - the residual is the per-iteration warp sync, which is the minimum needed for the no stranding guarantee.
done
everything above ran on 1x B200 ( please let me know if there are any other adjustments/changes that should be made! thanks again |
There was a problem hiding this comment.
Thanks, @drbh — the latest push is an improvement.
Though a few full-path blockers remain:
- Both active
gemm_sol_finalkernels still use the unprotectedTILE_INFO/TILE_READYmailbox and the old wait/rearm sequence. Fixing onlygemm_solleaves the same race in the canonical final example. - Phase 4D multicast uses CTA-scope
mbarrierarrive/wait without a per-generation cluster rendezvous or async-proxy release/acquire fences. Cluster Launch Control multicast is a cluster operation; Phase 4C already shows the required repository pattern. Please use that complete protocol in 4D as well. - The current oracle is tile-periodic: inputs depend on row/column modulo 8 while tile strides are multiples of 8. A whole-tile permutation can therefore produce zero mismatches; a modeled 4096x4096 tile rotation did exactly that.
- There is still no committed regression that distinguishes the fix from a plausible wrong handshake. Changing one
TILE_INFO_FREEarrival count from 5 to 4 still passes compile-only smoke andptxas.
Please extend the fix across both final kernels, correct the Phase 4D cluster protocol, and add a tile-distinct full-output oracle plus a repeatable B200 fail-before/pass-after regression, an unaffected control, terminal/wraparound cases, and sanitizer evidence. Also update the title/body from Phase 4B to the actual scope.
That evidence is required by the acceptance criteria shared in Discord.
…ile-distinct Walsh validator for the CLC phases Phase 4D decoded the CLC response in all 32 producer lanes with no proxy fences and no rendezvous, unlike 4B/4C: the leader's next clc_try_cancel_multicast can overwrite both CTAs' CLC_RESPONSE while slow follower lanes still hold the old one, so is_canceled diverges and the warp hangs at the K-loop sync (reachable when k_iters == 4). Adopt the 4C pattern: CLC_READY cluster rendezvous armed before the local TILE_INFO_FREE wait, lane-0-only decode with async-proxy fences, and shuffle broadcast so the cancel branch is warp-uniform by construction. The TILE_INFO_FREE barrier itself stays CTA-scope; a comment now pins the CTA-locality invariant and the escalation path. The CLC correctness phases also swap their periodic inputs (every 128x128 output tile byte-identical - blind to exactly the tile permutations the mailbox race causes) for the 12-bit Walsh fingerprint validator with a full exact-BF16 output scan. A quadrant scale on A breaks the affine-code twin symmetry (code(x+2048) = code(x) ^ 0x800) that would otherwise leave each tile a byte-identical twin 16 tiles away; all values stay exact in f16/f32/bf16 in any accumulation order. Signed-off-by: nihalpasham <[email protected]>
The B200 evidence for PR NVIDIA#1066 previously lived only in the PR description. scripts/regress-gemm-sol-schedule.sh (just regress-gemm-sol) makes it repeatable: the default pass-after mode runs the mbarrier-focused fuzz-schedule campaign on the current tree with --fail-on-finding and asserts from summary.json that the baseline was Usable (a Declined baseline also exits 0), every variant ran, and AsyncProxy sites were classified (post-NVIDIA#1195 coverage incl. tcgen05 commit/wait). The opt-in --fail-before <ref> mode rebuilds the pre-fix tree in a throwaway worktree and asserts the race is CONFIRMED there. Seeds are per-build (site renumbering), so the pinned defaults document the lineage they were confirmed on and stay overridable. Gated on sm_100 hardware; skips cleanly elsewhere. Signed-off-by: nihalpasham <[email protected]>
|
A couple of points:
Details: Bug 1, the tile-info mailbox race:
Bug 2 — the stranded-lane hang:
Evidence:
Plain runs pass by the hundreds: natural schedules don't open the race window, and delays can't break correctly-synchronized code — so these are real orderings bugs, not fuzzer artifacts. Repro: GEMM_SOL_MODE=validate cargo oxide fuzz-schedule gemm_sol_final \
--arch sm_100a --seeds 0..30 --focus mbarrier --confirm-runs 3The fix pattern (TILE_INFO_FREE handshake + post-wait warp syncs) is in |
this pr fixes a tile-metadata race in the gemm_sol phase 4B kernel (
gemm_sol_clc), found by the schedule perturbation campaign in this pr #1065**note: this change set looks bigger than it is because it includes the the commit from #1065, if the schedule perturbation campaign commit is merged, this pr only updates a single file (the gemm_sol file) as seen in my forks version of this pr drbh#3
the producer warp publishes
{tile_m, tile_n, has_work}through the sharedTILE_INFOmailbox, signalsTILE_READY, and then reuses the mailbox for the next stolen tile. the MMA warp and four epilogue warps wait onTILE_READYand read the mailbox, but nothing acknowledged that all five readers had copied the current values before the producer overwrote them, so a different warp schedule could pair epilogue output with the wrong tile coordinates.the fix adds a
TILE_INFO_FREEmbarrier with an arrival count of 5:TILE_READYwait, syncs its lanes, and lane 0 arrives onTILE_INFO_FREETILE_INFO_FREEparity before republishingTILE_INFO(including the finalhas_work = 0publish)before and after
on 1x B200 (
sm_100a), withGEMM_SOL_PHASE=4b-correctnessisolating the 4096x4096x4096 phase 4B validator, the campaign surfaced the race on the unfixed kernel at seeds 56 and 135 of a 0..140--focus mbarriersweep, each reproduced 3/3:on the unfixed kernel this outputs
and the example's own validator reports, identically on all three executions:
264 of 1024 output tiles were never written: epilogue warps woke from
TILE_READY, were delayed past the producer republishingTILE_INFO, and drained their TMEM stage onto another tile's coordinates. the pristine baseline passes; only the injected timing differs.with the fix, the same command passes and the full sweep is clean:
performance
the added wait is once per tile, off the K-loop, so
GEMM_SOL_PHASE=4bthroughput is unchanged within noise: 502.8 -> 501.5 TFLOPS at 4096, 497.3 -> 497.3 at 8192, 484.2 -> 481.8 at 16384.