Repository navigation
Shaders: lower RDNA 2 ADDTID memory instructions to DXIL - #1663
THE-PRO-GAME wants to merge 1 commit into
Conversation
Lower DS_READ_ADDTID_B32, DS_WRITE_ADDTID_B32 and GLOBAL_LOAD_DWORD_ADDTID with explicit guest lane addresses and EXEC guards. Keep wave-dependent LDS phases on the guest wave size. Verify operand decoding and dispatch synthetic compute shaders through D3D12 WARP and hardware with both guest wave sizes.
catminou4
left a comment
There was a problem hiding this comment.
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 97 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows.
RDNA2 ADDTID memory instructions lowered (global/local/flat variants via build/run/exec_ops/wave_bounds helpers, wave64 + LDS + SRV encodings covered by hardware tests).
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
Offline measurement on a retail dump, and the shader tests on AdaResult: no count change against Offline. I merged head 20c6c26 onto No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on Tests: with the same merge, No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
Base branch
Marvisak/VIctory:mainatffe310eb2098e52169f4c44db5ffdabf43a72622.Head
review/rdna2-addtidat20c6c269bf24179e4ad44ab484bebceb69a756e0.Changes
Lower
ds_read_addtid_b32,ds_write_addtid_b32andglobal_load_dword_addtid. All three use4 * guest_laneas a byte offset. LDS addsM0[15:0]and the 16-bit immediate. GLOBAL adds the signed 12-bit immediate and tracks the scalar base through the existing resource binding path. LDS accesses respect the workgroup allocation and all three operations respect EXEC. AMD RDNA 2 ISA §9.1 · AMD RDNA 2 ISA §10.4.3 · LLVM GFX1030 syntaxThe group-synchronized compute path derives the guest lane from the flattened group thread ID. When LDS ordering requires guest wave layout, the emitted shader retains the physical
WaveSizerequirement. Synthetic tests cover both guest widths, signed GLOBAL offsets, LDS limits and inactive-lane preservation.Individual validation
cargo test --workspace --lockedpassed 347 tests. The--all-featuresrun passed 351. Both had zero failures and six ignored tests.--all-targets --locked -- -D warningspassed with default and all features. All five targeted ADDTID tests passed.dxvv1.9.2609) accepted all 10 emitted containers. D3D12 WARP and an NVIDIA GeForce RTX 3060 each matched the CPU reference for 14 dispatches, seven per guest wave width. The LDS fallback that requires a matching physical wave size was checked through DXIL validation and metadata inspection.cargo test -p victory-shader --locked addtid -- --nocapture. SetVICTORY_DXILto the full path to Microsoft'sdxil.dllto select the validator explicitly. Microsoft DXC releaseJoint validation
A separate local integration check combined both commits and exercised all six instructions in one synthetic compute shader. The test chains GLOBAL ADDTID reads through the three SAD instructions into LDS ADDTID, then reads the resulting dwords back after a group barrier. Inactive lanes keep their original destination values. The mixed shader matched the CPU reference for two cases per guest wave width on each backend.
The local merge kept both decoder tests as separate functions after resolving an overlap at their insertion point. The mixed-shader fixture is local to the integration check.
The combined targeted run passed all 11 tests. Microsoft
dxvv1.9.2609 accepted 28 containers. WARP and the RTX 3060 each matched the CPU reference for 82 dispatches, including four mixed-shader dispatches. The integrated workspace reported 353 passing tests with default features and 357 with all features, with zero failures and six ignored tests in each run. Strict Clippy passed for both configurations. The existing Xbox SDK differential tests returned early on this host.Related work
PR #164 explicitly excludes ADDTID. PR #1606 covers LDS atomics and PR #1636 fixes immediate offsets in the FLAT encoding. The ADDTID global load uses the signed GLOBAL field. The recent upstream review found no proposal lowering the three selected operations. PR #164 · PR #1606 · PR #1636
Test scope and remaining validation
Execution verification used original synthetic compute shaders and a CPU reference derived from the public ISA. WARP and the RTX 3060 ran translated DXIL with traceable resource bases. Native RDNA 2 execution in Wave32 and Wave64 remains pending, including comparison of lane-addressed loads and stores and the wave-dependent LDS case. Graphics stages and retail shader coverage were outside the test scope. VIctory asset policy