Shaders: fix whole-wave EXEC inline constant sign-extension and prefix lane validation (port of VIctory#646) #191
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/Belobug--VIctory-Belobug-AMD!191
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-191"
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?
@lcg007xd-c on GitHub · 2026-11-25 20:25 UTC · original
lcg007xd-c:port/vic-646→main· +294 −22 · 1 files · 1 commits · openPort of Marvisak/VIctory#646 by nathanbzrr. It is cherry-picked with
-x, so the commit keeps its author and its upstream hash. This fork'smain(000ffdd) does not have it, and it is not in #142.What it fixes
Whole-wave EXEC inline constants were not sign-extended (e.g.
exec = -2must mask only lane 0), and the prefix-lane validation accepted unsound prefixes.Tested (Linux, Rust 1.98.1)
constant_decodes_width_and_inline_kinds,exec_minus_two_masks_lane_zero_and_enforces_dpp_guard,wave32_mov_b64_all_lanes_keeps_exec_masked_for_dpp,per_lane_prefix_soundness. Upstream's helper was renamedbuild_endedso it does not clash with the fork'sbuild.cargo test -p victory-shader --libon this branch alone: no failures.mainwithout conflicts, and does not depend on the other open ports.Not run here: Windows/GPU tests, since I have no Windows machine.
🤖 Generated with Claude Code
@MamaLeVrai on GitHub · 2026-11-26 05:00 UTC · original
RDNA2 data point. This PR (
660b49c) merged onmain4f62c2a,cargo test --release -p victory-shader --libon an RX 6950 XT (Windows 11 build 26300, Rust 1.98.1):main: 275 passed, 2 failed.The 2 failures are the same as on
main: the RDNA2 wave-size testsscalar_counted_in_a_divergent_loop_read_after_itandscalar_counted_in_nested_divergent_loops, fixed by #110 and #204. No regression here. Not run in the game.harness machine: rx6950xt-w11 | AMD Radeon RX 6950 XT (RDNA2), driver 32.0.21045.29003 | 32 GB RAM | Windows 11 build 26300
AI-assisted (Claude Code); no game data.
@adrianmjim on GitHub · 2026-11-26 19:44 UTC · original
Tested on Windows 11 (build 26300) with an RX 7900 XT, Rust 1.98.1. I took the head
660b49cand applied its diff on top of main4f62c2a. The branch is based on000ffdd, but wave.rs is the same in both and the merge is clean.cargo test -p victory-shader --lib -- --test-threads=1: 281 passed, 0 failed, 6 ignored. Main gives 277, so the 4 extra are the new tests.4f62c2a, the same 4 fail:constant_decodes_width_and_inline_kinds,exec_minus_two_masks_lane_zero_and_enforces_dpp_guard,wave32_mov_b64_all_lanes_keeps_exec_masked_for_dpp,per_lane_prefix_soundness. The other 7 wave tests pass.translate --validate --host-lanes 32-64. All 25,623 emitted DXIL programs are byte-identical to main. The translated, validated and refused counts are unchanged, and so is the IR instruction total.I also counted every
s_movto EXEC in the archive (exec,exec_lo,exec_hi). Each one has one of these sources:-10(only inexec_lo)exec_lo/exec_hi)None uses a negative inline constant other than -1, a float inline constant, or
null. So the old and newconstant()give the same value for every one of them. The EXEC masking insimulate()and the stricterper_lane()checks also left every output unchanged. I did not trace why for those two.Not tested: anything on the GPU beyond validation. No pipelines were created and the title was not run. The unit tests are CPU-only. I only ran host lanes 32-64, with the default shader clean-up passes on.
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.