Shaders: enforce inactive-lane EXEC rules for DPP16, DPP8 and ds_swizzle_b32 #1581
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1582"
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?
Imported from Marvisak/VIctory. Originally posted by Capt-Speed on 2026-11-24T19:26:56Z.
Summary
Fixes divergent-
EXECinactive-source semantics, out-of-rowwaveReadLaneAtUB, and pixel-shader quad helper-lane handling across RDNA2 cross-lane lowering (VIC-BT-008andVIC-BT-018in #1242):0xFA): Honorfi(already decoded ingfx10::fields), evaluate source-laneEXECactivity viadx.op.waveActiveBallot(guard)before applying write-onlyrow_mask/bank_mask, combineinside & src_activewhen!fi, and enforcebound_ctrl(1→ substitute0,0→ disable destination write preserving oldvdst).0xE9) vs DPP8FI (0xEA): Active destination lanes always write; whenEXEC[src] == 0,0xE9(fi:0) substitutes0assrc0(matching AMD RDNA2 ISA &gfx1031hardware measurements), while0xEA(fi:1) fetches the inactive lane'ssrc0.ds_swizzle_b32: Return0when the selected source lane is inactive underEXEC(covering guarded straight-lineEXEC, branchedEXEC, and nested branch+guard paths).waveReadLaneAtindexing: Guard reads withselect(valid, src, lane)before callingwaveReadLaneAt, eliminating0xFFFF_FFFFout-of-bounds lane reads onrow_shr(even whenfi == 1) and avoiding DXIL UB on inactive source lanes.ds_swizzle_b32andDPP quad_permviaquad_pick(dx.op.quadReadLaneAt) and skipwaveActiveBallotwhen unguarded so DXIL does not zero out WQM helper lanes on triangle edges; when aguardis present, test the quad peer's guard viaquad_pick.Relationship to #1485 and #1416
While this branch was being tested locally, #1485 (
VIC-BT-008) and #1416 (VIC-BT-018, compute-only) were opened. This PR unifies both under one sharedLower::src_lane_active()helper and addresses three issues observed in #1485:DPP8(0xE9,fi:0) substitutes0rather than disabling the destination write on RDNA2 (gfx1031).waveReadLaneAtmust be guarded against out-of-row (0xFFFF_FFFF) / inactive source indices before reading.waveActiveBallotunconditionally, since DXIL excludes pixel helper lanes from ballot masks.Verification (NVIDIA GeForce RTX 5090 D, Driver 621.14, Windows 11 26H1, D3D12 Debug Layer enabled)
Added 100% synthetic RDNA2 tests with a CPU reference oracle in
crates/victory-shader/src/emit/crosslane_tests.rs:EXECWave32 compute GPU cases): 10 passed, 13 failed, 0 skipped (DPP16 5/14, DPP8 3/4,ds_swizzle_b322/5).crosslane_tests: 5/5 tests passed — 29/29 compute GPU cases passed (18 DPP16, 5 DPP8/DPP8FI, 6ds_swizzle_b32, covering guarded, branched, nested branch+guard, andbank_masksource-activity independence), plus CPU oracle boundary checks and pixel-shaderdxil.dllvalidation + RTX 5090D/WARP graphics PSO creation.cargo clippy --workspace --all-targets --locked -- -D warnings: pass (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: pass (0 warnings)cargo test --workspace --locked: pass (0 failed;victory-shader125 passed / 1 ignored,victory-gpu50 passed / 1 ignored,xtask4 passed includingrepository_passes_policy)cargo xtask policy:155 files okLimitations / Not Verified on Hardware
WaveLaneCountMin = WaveLaneCountMax = 32, so the Wave64 upper-dword ballot path ((ballot_lane >> 5) & 1) was checked analytically (masking shift by& 31to avoid poison) but not executed on a 64-lane GPU.fi:1across truly divergent DXIL hardware branches remains constrained by DXILWaveReadLaneAtrules and is tested under straight-lineguardnarrowing.dxil.dllvalidation and RTX 5090D/WARP PSO creation, not via a rasterized edge-pixel readback draw.Related to #1242 (
VIC-BT-008,VIC-BT-018).Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T19:32:06Z.
Verified commit
ab416b2on Windows 11 / AMD Radeon RX 9060 XT (RDNA4,gfx1200, SM 6.6) + WARP:cargo test -p victory-shader --lib: 125 passed, 0 failed, 1 ignored[SUMMARY] DPP8/DPP8FI: 5 passed, 0 failed, 0 skipped[SUMMARY] ds_swizzle_b32: 6 passed, 0 failed, 0 skipped[SUMMARY] DPP16: 18 passed, 0 failed, 0 skippedAI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:31:27Z.
Automated triage for the maintainers.
Recommended for a maintainer's look. In
crates/victory-shader/src/emit/lower.rs,Lower::dppnow honoursfiand treats a source lane that is out of EXEC like an out-of-row one (zero withbound_ctrl, otherwise no write; DPP8 withfi:0reads zero), andds_swizzle_b32returns zero from an inactive source, both through a newsrc_lane_activehelper built onwaveActiveBallot. ThewaveReadLaneAtindex is also redirected to the lane itself when the source is invalid, so no read targets an inactive or out-of-range lane. This matches the RDNA2 ISA's description of DPPFI/BOUND_CTRL. I checked that pixel shaders only reach this path for quad ops (cross_lanerefuses the rest), so thequad_pickof the guard there is correct, and that unguarded pixel quad ops skip the ballot so helper lanes are not dropped. Overlap: #1416 (computeds_swizzle_b32only, open, needs rebase) does a subset of this; #1485 is closed. The Wave64 upper-dword ballot path is not run on hardware, as the description says. CI: passing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Capt-Speed on 2026-11-25T01:58:12Z.
Rebased onto current \main\ (\
940d32f) at commit \80abf15:Imported from Marvisak/VIctory. Originally posted by StExpeditus on 2026-11-25T09:23:47Z.
Test report: RTX 5060 Ti (Blackwell), Windows 11 Pro 26200, driver 621.24. Branch at
80abf15.cargo test --workspace --locked --no-fail-fast-> 701 passed, 5 failed, 10 ignored. The failures are the same 5 pre-existing NVIDIA 1M-view-heap-cap failures (also on main; see my reports on #2030 and #1940). Nothing introduced by this PR fails on this machine.