Shaders: s_cbranch_vccz/vccnz tests raw VCC, not VCC & EXEC #2629
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2631"
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 dutch2005 on 2026-11-25T17:12:45Z.
Why
Back-port of Belobug #83 onto current
main(940d32f).s_cbranch_vccz/s_cbranch_vccnzwere lowered asVCC & EXEC. The hardware tests raw VCC: inactive lanes can leave bits set in VCC (an earlier compare or a scalar write), and masking with EXEC flips the branch when those are the only bits set.This was ported manually because
git apply --3wayof the Belobug commit does not apply to current upstreammain(the trees diverged). It is the same rule as the open upstream PR #2406, with the regression test from Belobug #83.What
VCC & EXECmasking instructure.rs::branch; use VCC directly for both branch directions.cbranch_vcc_tests_raw_vcc_without_exec_masking: a narrowed EXEC plus an explicit compare, then boths_cbranch_vccnzands_cbranch_vccz; the branch condition must support raw VCC only.Testing
On Windows 11, AMD RX 6700 XT, Rust 1.98.1, from
Marvisak/VIctory940d32f:cargo test -p victory-shader --lib cbranch_vcc_tests_raw_vcc_without_exec_masking -- --test-threads=1— 1 passed, 0 failed.cargo test -p victory-shader --lib -- --test-threads=1— 248 passed, 0 failed, 3 ignored (81 s).Notes
No game data on this machine; shader-level verification only. If #2406 is preferred, this PR can be closed in its favour — the code change is the same rule.
Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T17:38:08Z.
Independent verification (no physical GPU, no game files, no competing PR). AI-assisted: Claude Code (Claude Sonnet 5.5).
VICTORY_D3D12_WARP=1andVICTORY_WARP=1(software WARP only).origin/main=13f91caee21c5464146d(83 commits behindorigin/main; merges cleanly, and I tested the merge too)Results
cargo test -p victory-shader --lib --locked structure::on the head: 12 passed, 0 failed, 1 ignored, includingcbranch_vcc_tests_raw_vcc_without_exec_masking.origin/main). Full lib onorigin/main+ this PR merged (not committed): 268 passed, 3 failed, 3 ignored, against 267 / 3 / 3 onorigin/mainalone (+1 pass, same 3 failures).cargo clippy -p victory-shader --all-targets --locked: no warnings.Finding: the new test does not discriminate. With the fix reverted by hand (
vcc & execrestored),cbranch_vcc_tests_raw_vcc_without_exec_maskingstill passes. A debug print inLanes::branchshowsexecis the constantBool::TRUEat both branches in the test's program, sovcc & execandvccbuild the identical node; thev_cmpxbefore the branch is not whatself.exec(inst)returns there. The test therefore cannot catch a regression to the masked form. A program where EXEC at the branch is a lane atom (e.g. a divergents_and_saveexecregion before thes_cbranch_vcc*) would.Review: the code change matches the stated hardware behaviour (
s_cbranch_vccz/nztest raw VCC; compilers add the EXEC mask explicitly withs_and). No issue with the change itself, only with its test.Not tested: physical GPU, any retail title.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:52:48Z.
Reviewed: the change is semantically right — raw VCC without EXEC masking, with inactive lanes' stale VCC bits correctly driving the branch (matches the hardware evidence in #2406/#2405). Note this is the third PR for the same fix after #2405 — identical semantics, both with tests; whichever lands first closes the other. CI green.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:21:13Z.
Automated triage for the maintainers.
Proposed close (no change in behaviour; duplicate of #2406 / #2405). This is the same edit as #2406, which this run's triage already proposed closing for the same reason. In
crates/victory-shader/src/structure.rs,Lanes::execreturnsBool::TRUEfor an instruction that does not read EXEC, andcrates/victory-shader/src/ir.rsgivess_cbranch_vccz/s_cbranch_vccnzonly a VCC read, so onmainand(vcc, exec)already reduces tovcc. Dropping theandchanges nothing; an offline comparison over the title's shaders reported on #2406 found 0 programs gained or lost. The new testcbranch_vcc_tests_raw_vcc_without_exec_maskingtherefore passes onmainas well, and the added comment describes a behaviour change the diff does not make. What is actually wrong, per the readbacks on #2405 / #2406, is that the branch is decided per lane instead of once for the wave fromVCC != 0. A PR fixing that, with a test that fails onmain, would be welcome.This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T00:58:34Z.
Independent local verification of PR #2631 (Shaders:
s_cbranch_vccz/nztests raw VCC, not VCC & EXEC).Windows, rustc/cargo 1.100.0/MSVC, worktree-local
CARGO_TARGET_DIR=D:\Victory-Contrib\target-2631-watch,CARGO_BUILD_JOBS=2,cargo test --locked, synthetic instruction words only, no game data.cargo test --locked -p victory-shader --lib -- structure::tests::cbranch_vcc_tests_raw_vcc_without_exec_masking --exact --test-threads=1 --quiet->test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 250 filtered out, exit 0.git diff --check 940d32f HEAD(merge base) clean; diff is 1 file (+36/-3),crates/victory-shader/src/structure.rs.cbranch_vcc_tests_raw_vcc_without_exec_maskingis absent from merge base940d32fviagit grep.origin/main(63bcca4) flags an unrelated blank line at EOF incrates/victory-formats/src/xma/tables.rs; this is not from this PR.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.