Shaders: keep scalar comparisons between lane masks uniform #1411
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1412"
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 EatCodeSleep2 on 2026-11-24T17:50:15Z.
Addresses VIC-BT-006 in #1242. When s_cmp_eq/lg compares two tracked lane-width masks, preserve its scalar SCC for branching. The existing DXIL lowering compares the ballots as scalar values. This prevents lanes that agree locally from taking a different branch from lanes that differ.
The structuring test covers eq and lg at wave32 and wave64 and fails on main because it finds a lane condition where SCC should be uniform. The two-thread wave32 readback passes on the Windows hardware adapter. WARP skipped because it does not support the requested wave size. The shader suite passed 121 tests with the pre-existing v_med3_f32 host NaN failure excluded. Shader Clippy with warnings as errors passes.
AI use: Codex wrote and tested the change.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T17:57:02Z.
Review: APPROVED
Tested merged cleanly onto
main(ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):cargo test -p victory-shader emit::lower: 11 passed, 0 failedcargo clippy -p victory-shader --all-targets: 0 warningscargo xtask policy: okClean fix keeping scalar comparisons between lane masks uniform. Approving.
AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T17:59:49Z.
Independent verification of \
86b29fa\ on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, \gfx1200) / Rust 1.98.1 MSVC:Code audit: guarding the per-lane rewrite with !(a_mask && c_mask)\ cleanly keeps two-mask comparisons (\s_cmp_eq/lg_u32/u64) uniform for both wave32 and wave64.
AI-assisted; synthetic tests only, no game files.
Imported from Marvisak/VIctory. Originally posted by marquezinii on 2026-11-24T18:33:45Z.
NVIDIA data point next to the RDNA4 run above: RTX 5070 (desktop, driver 621.40, the only adapter), Windows 11 26300, Rust 1.98.1, head
86b29fa.cargo test -p victory-shader --lib -- --test-threads=1 --nocapturegives 122 passed, 0 failed, 1 ignored.scalar_lane_mask_comparison_is_wave_wideran on the hardware adapter, where wave32 is NVIDIA's only wave size, and passes for boths_cmp_eqands_cmp_lg. WARP skips it (no wave32 on warp), as your description says.Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T19:24:58Z.
Review: APPROVED
Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (
ffe310e),cargo test -p victory-shader --locked→ 97. GPU/valu execution tests are Windows-gated and were not run here.Comparisons between two tracked lane masks (
s_cmp_eq/lgwhere BOTH operands are masks) used to take the per-lane ballot path and produce a per-lane "no lane differs" result; now they're excluded (!(a_mask && c_mask)) so they lower as a scalar comparison of the two ballots, leaving a uniform SCC. The macOS structure test asserts the branch guard isAtom::Uniform(scc)for eq and ne on wave32 and wave64 (97 passed, +1); the valu test pins wave-wide behavior on hardware (Windows-only).Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-24T19:50:23Z.
Offline measurement on a retail dump, and the shader tests on Ada
Result: no count change against
main.Offline. I merged head
86b29faontomainffe310e(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 21,724 onmain, 21,724 with this PR.No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on
main. The count shows that the change rejects nothing. It does not show whether the output is right.Tests: with the same merge,
cargo test --locked -p victory-shader --libpassed 122, failed 0. The bitcode benchmark is ignored, as onmain, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, withVICTORY_WARPunset.No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:26:12Z.
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
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.