fix(victory-shader): bypass EXEC on v_writelane_b32 and mask lane indices #300
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!300
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-300"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mauroalvare on GitHub · 2026-11-26 01:51 UTC · original
mauroalvare:fix/victory-writelane-readlane→main· +163 −1 · 3 files · 3 commits · openChange
In VIctory's RDNA2-to-DXIL translator (
third_party/victory/crates/victory-shader/src/emit/lower.rs),v_writelane_b32andv_readlane_b32diverged from AMD RDNA 2 ISA semantics in two ways:v_writelane_b32obeyedEXEC(guard):valu_opfinishedv_writelane_b32withint(self, r)(self.write_i(inst, r, guard)), wrapping the lane write inselect(guard, r, old). On RDNA 2,v_writelane_b32ignoresEXEC— compilers rely on this to spill SGPRs into VGPR lanes inside guarded blocks and wave-wide branches (including every branch in the paired wave64-on-wave32 form on NVIDIA). PassingNoneas the guard towrite_ipreserves RDNA 2 semantics.v_writelane_b32andv_readlane_b32: On RDNA 2,src1is masked to the low 5 bits (wave32) or low 6 bits (wave64). Previouslyv_writelane_b32maskedlane & 63only in the paired form (self.twin.is_some()), andv_readlane_b32did not masklanein the split wave64exchangepath (cl == lanefailed whenever upper bits were set) or in the non-exchange compute path (passing an out-of-range lane index to DXILwaveReadLaneAtis undefined behavior). Both now masklanetowave_size - 1.Linked issue: none
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 (failing on base
c4c93bdon RTX 5070 Ti):After the fix (from
third_party/victory):Oracle and test data
The new regression test
writelane_ignores_exec_and_masks_lane_index_in_wave32_and_paired_wave64inthird_party/victory/crates/victory-shader/src/emit/wave64_tests.rssynthesizes three minimal GFX10 compute shaders (wave32 withEXECnarrowed to even lanes writing inactive lane37 & 31 = 5; paired wave64 on 32-lane host writing inactive lane109 & 63 = 45insideif (v0 < 32); split wave64exchangereading/writing lanes104 & 63 = 40and69 & 63 = 5). All three are validated withdxil.dlland executed on the RTX 5070 Ti against AMD RDNA 2 ISA semantics (also matchingPrototypeScarlett/emu/rdna2_exec_vop3.py).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).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.