Shaders: write v_writelane_b32 under wave-level EXEC (#111) #119
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!119
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-119"
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?
@adritoyalser on GitHub · 2026-11-24 21:38 UTC · original
adritoyalser:fix/writelane-outside-exec→main· +104 −3 · 2 files · 1 commits · openFixes #111.
Problem
On GFX10/RDNA2 hardware,
v_writelane_b32 vN, sX, Kwrites laneKwhenever any lane of the console wave is active inEXEC, ignoring laneK's ownEXECbit (and skips the write only whenEXEC == 0for the whole wave).Previously,
"v_writelane_b32"incrates/victory-shader/src/emit/lower.rsemittedselect(console_lane == lane, a, old)and wrote it viaint(self, r)->write_placed(..., guard), which wrapped the write inselect(guard, r, old)using the target lane's ownEXECbit. Whenever laneKwas outsideEXEC(or did not reach the block due to a per-lane skip), the write was dropped.Fix
"v_writelane_b32"(crates/victory-shader/src/emit/lower.rs):exchangewithgroup > 32and!local), requireall_lanes(cur_ir)(callingneed(cur_ir)and returning"a lane write where not every lane runs"soemit()retrieswithout_skips).guardisSome(g), computeexec_anywithdx.op.waveAnyTrue(g)(andexchange_halves+ OR across both 32-lane host waves when split), combine withconsole_lane == lane, and store viawrite_placed(inst, Reg::V(reg), r, None)so the target lane's ownEXECbit does not mask out the write.guardisNone, emit no wave ballot or exchange overhead.a_lane_write_reaches_its_lane_outside_execincrates/victory-shader/src/emit/wave64_tests.rsmatching the#111synthetic program (validating both 32-lane and 64-lane DXIL againstdxil.dll, verifying per-lane refusal ->without_skipspromotion, and running thes0 = 10, 62, 63GPU checks on SM 6.6 hardware).Verification
cargo clippy -p victory-shader --all-targets --locked -- -D warnings— cleancargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings— cleancargo test -p victory-shader --lib --locked wave64_tests— 6 passed, 0 failed (dxil.dll10.0.26100.0 validated both 32-lane and 64-lane DXIL; SM 6.6 hardware execution skipped on this Windows 10 host)@arminkhaleghirod on GitHub · 2026-11-24 22:23 UTC · original
Merged onto main
90228a7and ranvictory translate --validateover the full title (26,148 programs) on Windows 11 / RTX 4080.No change: every failure count matches main, and no new reason appears. What it changes at run time isn't covered by this check.
@HAL9000RELOADED on GitHub · 2026-11-25 08:08 UTC · original
A run of this PR on a 64-lane card. The RTX 4080 check above covered translation only. #139 addresses the same issue and was run on an RX 9060 XT. This is the run for this PR's version.
Setup: Radeon RX 7900 XTX (RDNA3, waves of 32 to 64 lanes), Adrenalin 32.0.32015.7029, i7-13700KF, Windows 10 Pro 22H2 (19045), Rust 1.98.1. Windows 10's in-box D3D12 stops at SM 6.5, so the tree also carries the D3D12 Agility SDK 1.620 (the same approach as #69). The DXIL validator comes from SDK 10.0.26100 (
VICTORY_DXIL). WARP stays below SM 6.6 on this machine, so the GPU cases ran on the card only. No game data used.Base:
mainc96b4f2plus the Agility patch and the stack-headroom test fix from Marvisak/VIctory#742. The PR head481569bwas merged on top of it.a_lane_write_reaches_its_lane_outside_execwave64_tests.rswave64_tests.rs:488getsNoneThe whole workspace with this PR: 506 passed, 0 failed.
481569b04fto94b95bd369View 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.