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!3023
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3023"
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?
@wwwwwwww3333333 on GitHub · 2026-11-26 03:36 UTC · original
wwwwwwww3333333:fix/vcc-branch-whole→main· +598 −54 · 6 files · 5 commits · openFixes the open point of #2780 that both #2783 and #2836 leave (noted in the triage there):
s_cbranch_vccz/s_cbranch_vccnztest VCC as a whole (RDNA2 ISA, 12.5: VCCZ is VCC == 0), one decision for the wave, not each lane's bit.Built on #2836: its two commits are kept as they are (Devin, @kotekompotek), rebased onto main
63bcca4. The third commit is this change.What changes
Atom::Opaque, both dwords since #2836) now gives a newAtom::Nonzero(lo, hi)at the branch, the same in every lane, lowered as(lo | hi) != 0. The branch is uniform (uniform_joinand the translate counts treat it so).GPU test
synthetic_tests::vcc_branches_test_the_whole_mask: a full wave64 group, VCC written by twos_mov_b32, v4 = 17 on the taken path and 43 otherwise. Lanes takings_cbranch_vcczwith only VCC_HI set (the hardware takes none):63bcca4RX 6750 XT (driver 32.0.21045.29003) and WARP. This replaces a CPU replay with a GPU run; the numbers for main and #2836 match the ones reported on #2780.
Also:
structure::tests::vcc_branches_on_scalar_masks_are_uniformchecks the branch's condition isAtom::Nonzeroalone, without a GPU.Suites (Windows 11, Rust 1.98.1 MSVC): victory-shader 305 passed, twice.
cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo check -p victory: clean.Not measured: any title. Unit tests only, no game files.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LwHmoV6jP696CZH3DVW7V1
@zed6000 on GitHub · 2026-11-26 04:02 UTC · original
Measured offline on the title's shaders (the method in #1247): head
8fc606dmerged ontomain63bcca4(a clean merge, security-reviewed first),victory translate --validate --listovershaders.rpf1.0.2.1, program by program: 0 gained, 0 lost. All 24,850 programs that validate onmainstill validate. Since this is the same VCC-branch area where #2405's head lost 1,829 programs (and the hardware-exact variant on #2406 lost 18,170), that's the number that matters here: the wave-uniform reading of scalar VCC doesn't cost this title anything. Offline counts only; no program names or data.@steven-seagull27 on GitHub · 2026-11-26 04:03 UTC · original
On
8fc606d, all six checked-in cases passed on the RTX 5080 (621.40), Windows’ built-in WARP and WARP 1.0.22: 0/384 wrong lane values per device. A separate Wave64 test found a remaining issue inside the positiveAtom::Nonzerocase. An SGPR copied into VCC can already have a different host value in each lane.The fixture initializes
s12 = 0, sets EXEC to just lane 0, and usess_cbranch_execzto skips_mov_b32 s12, 1only if EXEC is empty. Lane 0 exists, so the scalar write executes once for the guest wave. It then restores EXEC, copiess12tovcc_lo, clearsvcc_hi, and branches. The branch should see VCC = 1 for every lane. These are counts read from the UAV on all three devices:s_cbranch_vccnzs_cbranch_vcczs_cbranch_vccnzs_cbranch_vcczThat’s 378/512 wrong lane values per device across the eight cases. With lane 0 selected, WARP 1.0.22 also gives 63/64 wrong on parent
fd2b765forvccnz. RTX and built-in WARP skip that parent Wave64 pipeline. The PR’s original uniform scalar controls pass on all three.I put a conservative guard and low/high-word regression on the fork. It follows scalar inputs through copies and operations before treating a VCC word as wave-wide. When a contributing scalar phi can select different incoming edges across lanes, it returns an explicit refusal. The regression fails on this PR head and passes with the guard. On all three devices the six original readbacks still pass, along with 1,728/1,728 additional results for constant VCC values under empty, single-lane and full EXEC. This guard covers the joined scalar input. The reviewer’s
s_not_b64ands_cselect_b64expression cases are separate.Shader Clippy with
-D warningsand asset policy passed. AI-assisted; synthetic fixtures only. Title coverage is unmeasured.@wwwwwwww3333333 on GitHub · 2026-11-26 05:47 UTC · original
Thanks @fuzeofficlal, both points were right, and thanks @steven-seagull27 for the guard.
3228393): a VCC whose diagram tests only atoms held in scalars (opaque pairs, constants, SCC selects) is now one condition for the wave, however it was combined. With constants and SCC alone it is decided in the structure pass, lane by lane over the constants, sos_cselect_b64 vcc, 1, 2ands_mov_b64 vcc, 1give TRUE. With an opaque pair (s_not_b64,s_and_b64with a constant) it becomesAtom::Any, lowered as the mask's two words and tested for zero (VCC_LO alone in wave32). Steven's join guard also runs on the pairs inside it. A VCC from compares or from a mask join (Atom::Phi) still branches per lane, the shortcut already marked in the code.vcc_branches_test_the_whole_masknow fails if a device runs some cases but makes no pipeline for others. It has 14 cases, includings_mov_b64,s_cselect_b64(2 and 0),s_not_b64(hi bit only, and zero) ands_and_b64. The structure test now coverss_mov_b64,s_cselect_b64,s_not_b64ands_and_b64directly.91f3915) is on the branch with his authorship.On an RX 6750 XT and WARP, every lane took the expected path in all 14 cases, both ways. Before this,
s_cselect_b64 2ands_and_b64 2took the branch in lane 1 alone, ands_not_b64 hi 1in lane 32 alone. victory-shader passed 307 of 307, and Clippy with-D warnings,cargo check -p victoryand the xtask tests are clean.lower.rsis 521,058 bytes. The title's shaders are not measured on this head: @zed6000's 0/0 count was on8fc606d.@Marvisak on GitHub · 2026-11-26 06:18 UTC · original · edited 2026-11-26 08:25 UTC
Automated triage for the maintainers.
The direction is right and the evidence is cited: RDNA2 ISA 12.5 (VCCZ tests the whole of VCC), with GPU readbacks on an RX 6750 XT and WARP. The change spans
structure.rs,emit/lower.rsand the newemit/lower/scalar_vcc.rs:Lanes::wholeturns a VCC built only from scalar atoms into one condition for the wave:Atom::Nonzerofor an opaque pair, a per-lane fold over constants (Bools::some_lane), orAtom::Anyfor scalar expressions.Atom::Opaquenow carries both dwords of the pair, replacingpair_high's guess at the next register (from #2836).check_scalar_vcc_joinsrefuses a VCC fed by a scalar phi that can diverge across lanes.Update after the author's reply: merge order is settled. The first two commits here (
64c89b9,fd2b765) are #2836's two commits rebased onto main with the same messages, so reviewing this PR alone and closing #2836 in its favour is the maintainer's call.What is still needed before it can be recommended:
8fc606d. Since then the head addsAtom::Anylowering throughmask_wordsand a new refusal ("a scalar VCC branch depending on a divergent scalar join"), and either could cost programs. #2405 lost 1,829 programs in this same area. A program-by-program count on3228393(gained/lost) from anyone with the title's shaders would settle it.CI
check: passing.Generated by Claude Code
@wwwwwwww3333333 on GitHub · 2026-11-26 08:09 UTC · original
Thanks for the triage.
Merge order: #3023 carries #2836's two commits unchanged, so I'd suggest closing #2836 in favour of this PR and reviewing one stack. If you'd rather land #2836 first, say so and I'll rebase this PR onto it so only the guard and the whole-VCC commits remain.
Title count: I can't measure the title's shaders on
3228393(I have no dump here). The new parts since8fc606dareAtom::Anylowering and the divergent-scalar-join refusal. @zed6000, if you can rerun your offline count on3228393, a gained/lost number would settle that point. Until then it is unmeasured, and I'm not claiming a safe count.Unit tests only, no game files.
@fuzeofficlal on GitHub · 2026-11-26 03:56 UTC · original · requested changes
Reviewed
8fc606d0againstmain(63bcca43;emit/lower.rsstays at 520,714 bytes, safely under the 512 KiB limit). Two concrete issues to fix before merge:Scalar
VCCexpressions beyond a single positiveAtom::Opaque/Atom::Constantstill fall back to a per-lane branch (crates/victory-shader/src/structure.rs:1371-1383)wholeonly matchesSome((Atom::Opaque(lo, hi), Bool::FALSE, Bool::TRUE))andSome((Atom::Constant(_), Bool::FALSE, Bool::TRUE)).s_not_b64 vcc, s[2:3](produces(Atom::Opaque(lo, hi), Bool::TRUE, Bool::FALSE)),s_cselect_b64 vcc, 1, 2(instructure.rs:1120, buildsite(Atom::Uniform(scc), Atom::Constant(1), Atom::Constant(2)), whose root isAtom::Uniform(scc)), orAtom::Phi)misses
wholeand falls through toself.b.and(vcc, exec). Fors_cselect_b64 vcc, 1, 2+s_cbranch_vccnz, the whole wave must take the branch for eitherSCCvalue, but falling back to per-lanevcc & execcauses only lane 0 or lane 1 to take it (and a CFG join can produce a mask PHI whose scalar inputs the wave64 emitter rejects).Test coverage gaps (
crates/victory-shader/src/emit/synthetic_tests.rs:681-684,crates/victory-shader/src/structure.rs:1767)vcc_branches_test_the_whole_mask,host.compute_pipeline(&shader)errorscontinueandassert!(ran > 0)is only checked once across all 6 cases. If the keyvcc_hi = 1case fails pipeline creation whilevcc = 0succeeds, the test still passes silently. Tracking a per-case run count (or failing on pipeline creation once a valid SM 6.6 device is created) avoids hiding regressions.structure.rs:1767, the second fixture setsvcc_lo = 0andvcc_hi = -1via twos_mov_b32instructions, which createsAtom::Opaque(lo, hi)rather thanAtom::Constant, so theAtom::Constantarm atstructure.rs:1377isn't actually exercised (and the assertion accepts eitherBool::TRUEorAtom::Nonzero). Using a 64-bit constant move (e.g.s_mov_b64 vcc, 1) or testings_cselect_b64/s_not_b64would directly cover the non-Opaquepaths.@kotekompotek on GitHub · 2026-11-26 04:41 UTC · original · approved these changes
LGTM — making Atom::Opaque carry the pair (lo,hi) explicitly removes the fragile pair_high lookup; Nonzero ORs both dwords under wave64 with the hi!=lo dedup. cbranch_vccz/vccnz on a scalar VCC deciding on pair-nonzero matches hardware.
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.