[SM100] hd256 2CTA fwd: add missing tcgen05.wait::ld before TMEM slot… - #182
Merged
MatthewBonanni merged 2 commits intoAug 25, 2026
Merged
Conversation
… releases tcgen05.ld is asynchronous; consuming its registers does not order the TMEM read against a later writer (PTX ISA 9.7.17.6.4.5). Add fence_view_async_tmem_load() before the three releases that skipped it: correction_epilog O tile, correction_rescale stats slot and O slot. The ld->scale->st ring in correction_rescale needs no wait (the st consumes every register the ld produced) and is left unchanged. SASS confirms the stats release previously issued its SYNCS.ARRIVE with waitmask=0 ahead of the LDTM scoreboard; it now waits on it. No measurable perf change on bench_hd256.py.
Author
|
additional: also fix some deprecated APIs in this pr |
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.
[SM100] hd256 2CTA fwd: missing
tcgen05.wait::ldbefore TMEM slot releasesFollowup to #180.
The issue described above was already present in the kernel that we performance tuned in above PR, however only during further perf tuning i discovered this minor inconsistency with PTX docs.
tcgen05.ldis asynchronous. Consuming its destination registers is ordered by the registerscoreboard; the load's TMEM read is not ordered against a later TMEM writer. PTX ISA 9.7.17.6.4.5:
"a register dependency does not imply that a dependee instruction's memory accesses will be
performed before a dependent instruction's memory accesses …
tcgen05.wait::ldmust be used."Required producer pattern (9.7.17.6.4.4):
tcgen05.ld → tcgen05.wait::ld → mbarrier.arrive.Three releases in
sm100_hd256_2cta_fmha_forward.pyskipped the wait:correction_epilogO tileLd32x32bOp(32)×4o_handle.release()→ MMA warp overwrites Ocorrection_rescalestatsLd32x32bOp(2)stats_handle.release()→ softmax warptcgen05.stcorrection_rescaleOo_handle.release()→ MMA warp overwrites OThe softmax warp's S-tile release already had the wait.
Fix
cute.arch.fence_view_async_tmem_load()(tcgen05.wait::ld.sync.aligned) before each release.The ld→scale→st ring inside
correction_rescaleis left alone: thestto tile i-1 consumesevery register the
ldof tile i-1 produced, so that read has completed before the store issues.CUTLASS
77_blackwell_fmhauses the same ring without a wait.Evidence
B300, sm_103a.
tcgen05.wait::ldin kernel PTX: 1 → 7; ld/st/mma counts unchanged.correction_epilogbefore:after:
tcgen05.wait::ld.sync.aligned;follows each of the four loads.correction_rescalestats before — ptxas issues the arrive ahead of the scoreboard wait:after:
correction_rescaleO release after:No SASS change here — the ring's register chain had already retired the loads.
Benchmark
Local Benchmark was run and performance stays invariant under above changes.