Repository navigation
Shaders: lower ds_inc_u32, ds_inc_rtn_u32, ds_dec_u32, and ds_dec_rtn_u32 in pure 32-bit DXIL - #2113
geiyiliyabumo wants to merge 1 commit into
Conversation
…_u32 in pure 32-bit DXIL
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC, with dxil.dll validator):
cargo test -p victory-shader --lib lds_wrap_atomics_— 3 passed, 0 failed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(lds_wrap_atomics_update_and_return_under_execandlds_wrap_atomics_serialize_contending_lanes)cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean pure-32-bit DXIL lowering of ds_inc_u32, ds_inc_rtn_u32, ds_dec_u32, and ds_dec_rtn_u32 verified under contention and EXEC masking on hardware and WARP. Looks great.
AI-assisted (Gemini 4 Neon).
|
Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at I also read the lowering. Overlap, from reading: #1606 (open, conflicting with AI-assisted (Claude Code). |
|
Read the semantics (they look right), measured the three-way collision, and one question about the spin I checked the arithmetic against the rule this instruction family has, and it matches what I understand of the ISA:
which is exactly the shape of the One thing I would like to see in the tests, because it is where a wrong reading survives everything else: the boundary pairs. The question I have is about the retry loop. The patch loops on m.terminate(retry, Term::CondBr(success, done, retry));unbounded. On the console this is one LDS atomic instruction, and the host's version is a compare-exchange spin. Under contention that is normal GPU practice and it terminates — but "normal practice" and "bounded" are not the same thing, and the failure mode when it does not is a TDR and a removed device, which is much harder to diagnose than a wrong value: the log says the device was removed and nothing about which shader was spinning. I am not asking for a bound for its own sake; I am asking for the decision to be written down, either as a comment ("the loop terminates because the address is not contended across the wave" if that is the argument) or as a bounded retry with a defined fallback. A merge-order thing, measured: this pull request and #2116 and #2119 are three changes to the same Each is clean against No game data is involved: instruction names and test counts. Written with an AI assistant. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
144 passed / 0 failed / 2 ignored. ds_inc/dec_u32 + rtn variants lowered — atomic increment/decrement return-value ops.
Offline measurement on a retail dumpResult: no count change against I merged head 9c8b9a2 onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
|
Automated triage for the maintainers. Needs rebase. This PR no longer merges cleanly into Previous verdict for this head: merge candidate. Generated by Claude Code |
Summary
ds_inc_u32,ds_inc_rtn_u32,ds_dec_u32, andds_dec_rtn_u32incrates/victory-shader/src/emit/lower.rs(fn ds) using anEXEC-guarded pure 32-bitcmpxchgretry loop without enablingInt64/WIDE_OPS.incwrapsold >= limitto0(elseold + 1),decwrapsold == 0 || old > limittolimit(elseold - 1), and_rtnreturns the previous LDS value while inactive lanes preservevdst.crates/victory-shader/src/emit/semantics_tests.rscovering wrap sequences, unsigned edge cases (old > limit), non-returning updates,EXEC-masked destination preservation, and 32-/31-lane concurrent LDS contention, assertingInt64is not set.Verification
cargo xtask policy: passedcargo clippy -p victory-shader --tests -- -D warnings: passedcargo test -p victory-shader --lib lds_wrap_atomics -- --test-threads=1with Microsoftdxil.dll: passed on AMD Radeon RX 9060 XT (RDNA4) and Microsoft Basic Render Driver (WARP) (0 hardware/WARP mismatches, multi-lane LDS contention passed on both)