Shaders: write v_writelane_b32 under wave-level EXEC (#111) #119
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from fxceless/victory-fork. Originally posted by adritoyalser on 2026-11-24T21:38:37Z.
Fixes #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)Imported from fxceless/victory-fork. Originally posted by arminkhaleghirod on 2026-11-24T22:23:54Z.
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.
Imported from fxceless/victory-fork. Originally posted by HAL9000RELOADED on 2026-11-25T08:08:26Z.
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.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.