Shaders: s_cbranch_vccz/vccnz tests raw VCC, not VCC & EXEC #2631
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2631
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@dutch2005 on GitHub · 2026-11-25 17:12 UTC · original
dutch2005:backport/raw-vcc→main· +36 −3 · 1 files · 1 commits · openWhy
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.
@oni-swr on GitHub · 2026-11-25 17:38 UTC · original
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.
@kotekompotek on GitHub · 2026-11-25 17:52 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 22:21 UTC · original
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
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.