Repository navigation
fix(victory-shader): keep wave64-on-wave32 TGSM within 32 KiB on 32-lane hosts - #295
Open
mauroalvare wants to merge 4 commits into
Open
mauroalvare wants to merge 4 commits into
mauroalvare wants to merge 4 commits into
Conversation
7 of 12 tasks
mauroalvare
force-pushed
the
fix/victory-wave64-lds-limit
branch
from
November 26, 2026 20:23
174f85c to
9134d56
Compare
mauroalvare
force-pushed
the
fix/victory-wave64-lds-limit
branch
from
November 26, 2026 22:47
9134d56 to
f1d5787
Compare
This branch has not been deployed
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.
Vice-Tay
On a 32-lane host, Vice-Tay now reuses one group-shared dword for the thread-numbering prologue when the shader declares the full 32 KiB. The prologue finishes using it before the emulated shader's LDS accesses. If cross-half exchange needs more group-shared memory than D3D12 supports, lowering reports the limit explicitly.
The NVIDIA test exercised a split wave that reads across halves at the limit. A second regression covers a shader whose exchange storage exceeds the limit.
Earlier Neptune description
Change
In VIctory's RDNA2-to-DXIL translator (
third_party/victory/crates/victory-shader/src/emit/lower.rs), the non-paired wave64-on-wave32 compute lowering (used on 32-lane hosts such as NVIDIA GPUs) could push thread-group shared memory (TGSM) past D3D12's hard 32 KiB (8,192 dwords) limit:halves(wave_base's LDS counter) unconditionally appended 1 dword (s.lds_dwords += 1), turning a 32 KiB console shader into 32,772 bytes (8,193dwords), rejected bydxil.dlland D3D12CreateComputePipelineState. The paired form already reuses slot 0 whens.lds_dwords == 8192becausewave_base()emits a post-countergroup_syncwheneverslot < cs.lds_bytes() / 4; the non-paired path now does the same.exchangeunconditionally added2 * group.div_ceil(64)dwords even whens.lds_dwordswas already at or near 8,192 (and even whengroup <= 32orLOCAL_WAVES, whereexchange_halvesnever touches LDS). Becauseemit_formsstill returnedOk((_, Some(32)))with invalid >32 KiB DXIL,emit_anynever fell back to the paired form (which needs zero exchange dwords and fits in 32 KiB). Checkings.lds_dwords + exchange_dwords <= 8192keepswave = 64whenexchangedoes not fit, lettingemit_anyfall back to the valid paired form.Linked issue: Refs #213
Verification
Base SHA:
c4c93bdc413191a9dc909998d2d53080a3f0c880(LooperSalty/AnyXboxX:main)Hardware: Windows 11, Ryzen 7 9700X, NVIDIA GeForce RTX 5070 Ti (driver
621.40),dxil.dll10.0.26100.0, Rust1.98.1(MSVC).Before the fix (both new tests failing on base
c4c93bd):After the fix (from
third_party/victory):Oracle and test data
Both new regression tests in
third_party/victory/crates/victory-shader/src/emit/wave64_tests.rssynthesize minimal GFX10 wave64 compute shaders with 32 KiB (32,768 bytes) of LDS:wave64_full_32kib_lds_without_exchange_fits_on_32_lane_host: 64 threads writing3*t + 1toLDS[4*t](includingLDS[0]) and reading mirror lane63 - tacross halves; validated withdxil.dlland checked dword-for-dword on RTX 5070 Ti.wave64_full_32kib_lds_with_exchange_falls_back_to_paired_on_32_lane_host: 128 threads writing5*t + 7toLDS[4*t], readingt ^ 32, and computings_bcnt1_i32_b64+v_mbcnt_lo/hi; verifies fallback to paired form,dxil.dllvalidation, and all 512 output dwords on RTX 5070 Ti.No game, console, or SDK files were used.
Checklist
E_NOTIMPL), never a fake success.AI assistance: investigated, implemented, tested on RTX 5070 Ti, and drafted with Antigravity (Gemini).