Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by wwwwwwww3333333 on 2026-11-26T03:36:39Z.
Fixes 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
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T03:56:42Z.
Review: CHANGES_REQUESTED
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.Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-26T04:02:27Z.
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.Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T04:03:41Z.
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.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T04:41:35Z.
Review: APPROVED
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.
Imported from Marvisak/VIctory. Originally posted by wwwwwwww3333333 on 2026-11-26T05:47:47Z.
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.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:18:48Z.
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
Imported from Marvisak/VIctory. Originally posted by wwwwwwww3333333 on 2026-11-26T08:09:13Z.
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.
Imported from Marvisak/VIctory. Originally posted by playcations on 2026-11-27T06:01:31Z.
Independent NVIDIA/Linux validation of head
322839300283a9a4561da8303a935b3f1b0c864b: all 14 currentvcc_branches_test_the_whole_maskcases passed, checking all 64 UAV outputs per case (896/896 values). This includes the split-dword, b64 move, SCC select, NOT and AND controls.Environment: Ubuntu 26.04.1, RTX 5060 Ti 16 GiB, NVIDIA 595.99.02, Wine 11.22 Staging, vkd3d-proton 3.1 and DXVK 3.2. Queried the adapter from the created D3D12 device's LUID: NVIDIA vendor
10de, device2d04, software flag clear,WaveLaneCountMin/Max = 32/32.For this private test run I changed only the test harness: one required
Host::new(false)device, asserted the actual adapter IDs/name/software flag, required the public Microsoft DXIL validator to load and validate each shader, removed the WARP loop and all hardware/pipeline skip paths, and required exactly 14 completed cases.VICTORY_WARPwas unset. No shader/runtime implementation changes were applied. The Windows test binary was cross-built with Rust 1.98.1 / cargo-xwin; the CPU-only divergent-scalar-source refusal test also passed.This is a Linux/Wine synthetic readback result, not native Windows acceptance or title coverage. No game files were mounted or run. It does not settle the outstanding gained/lost title-shader count requested in triage. AI-assisted with Codex; the harness changes and captured adapter/readback logs were reviewed.
Imported from Marvisak/VIctory. Originally posted by playcations on 2026-11-27T06:39:49Z.
Follow-up for the outstanding title-shader count on current head
322839300283a9a4561da8303a935b3f1b0c864b: 0 emitted programs gained / 0 lost, and 0 validator passes gained / 0 lost, against main63bcca43c6a00a758510398fa43096ce7e4f7df0.I ran the offline
translate --validate --list --jobs 4pass on the same read-only primary shader archive for both builds. It held 26,503 containers; the translator skipped 614 duplicate native parts and scanned 26,084 native programs. Both releases used Rust 1.98.1 / cargo-xwin and the same public Microsoft DXIL validator under Wine 11.22 Staging. No pipelines were created, and no game or GPU was run during these passes.The other 390 native programs are Es/Gs (195 each), which do not emit here. The stock CLI lists 25,889 outcomes but silently omits the 195 Es programs because its offline path does not raise I/O for Es. I accounted for them explicitly with a separate native-part inventory, rather than counting them as validated.
For program-by-program matching, the inventory maps every source alias to native-part identity + stage. This matters because the threaded passes can choose different aliases among duplicate containers. The complete canonical populations and every listed outcome matched; emitted/validated counts also reconcile with the CLI's stage totals. The input bytes and release EXE hashes were checked, and the archive stayed unchanged. Raw identities, labels and individual outcomes remain private; none are posted here.
This is a count/validator result for that archive, not a byte-for-byte DXIL comparison, rendering acceptance, all possible title resources, or a gameplay claim. The earlier strict NVIDIA synthetic result is separate. The only private source edits in this PR build were the test-only adapter/skip assertions already described; release translator/runtime source was unchanged. AI-assisted with Codex GPT-6.1 Sol; comparison code, six synthetic reconciliation checks and final totals reviewed.
Imported from Marvisak/VIctory. Originally posted by ZeOs360 on 2026-11-28T12:09:47Z.
In-game data for this PR on AMD: it fixes the cause of #3486's consistent early writes. Plus one
latent gap at
v_cndmask_b32that no game shader hits.#3486 is the ray-tracing BVH builder's 4 GiB writes. Setup: RX 7800 XT, Windows 11, GTA6 with ray
tracing through the open RT PRs (#2098 #2118 #2703 #2841 #2810 #2501).
The cause is the builder's digit scan
f6eb6498409ca974(wave64, 64 threads, 4 digits per lane). Itcarries lane 31's running sum into lanes 32..63 with a mask set by halves:
On
mainlanes 32..63 tested s6, so digits 128..255 lacked the lower half's total. Snapshots of thesort's buffers between passes (local diagnostic) showed this in all three LBVH trees of the builder's
first list:
e63d22c4) wrote colliding positions and lost keys;f28a33a8built broken trees from them;5552dac6a2b7a1fdread wrong parent and child indices, and its 32-bit offsets wrapped.10-minute runs, counting that pass's wrapped-offset sites:
3228393)Notes on those runs:
v_cndmask_b32where it differs. So those two runs translate the game exactly as this PR does.where this PR's own run had its burst. Another such run ended earlier (frame 1950) and is not
counted.
Without the change, the wraps started within about 20 s of the builder starting in every run. That
includes two more runs, one with a snapshot diagnostic and one with an idxen range check: 38 and 46
sites, the first at 19-20 s. With it, three of four runs had none. The burst in one run, about 4
minutes in, is intermittent and probably has another cause; @upipibi's note on #3486 about compacted
sizes would be a candidate.
With this PR, a GPU copy of that carry passes on the RX 7800 XT: lanes 0..15 and 48..63 take the
value for
s6 = 0xffff,s7 = 0xffff0000. Onmainlanes 32..47 take it and 48..63 do not. A fulltranslation of the game's shaders refuses the same 229 containers with this PR as without it.
The latent gap.
Lanes::finishstill collapsesmasksandotherto the low dword(
masks: … (lo, m),other: … (lo, m)), andv_cndmask_b32looks its mask up by the low dword alone(
self.x.st.masks.get(&m).or_else(|| self.x.st.other.get(&m))). SinceAtom::Opaquenow holds bothdwords, two masks that share a low dword are two atoms but one map entry, and whichever survives
answers both selects. This GPU test fails with this PR on the RX 7800 XT: lanes 32..63 get 0, the
first mask.
It passes with a lookup by both dwords.
Lanes::stepalready registers the pair for every select(
self.mask(k)), so the lookup always finds it:Your PR's own tests still pass with it. Since nothing in the game hits this, it can just as well be a
follow-up after this PR.
AI-assisted: written by Claude Code (Claude Opus 5.5) and reviewed by Gemini 4 Neon;
the GPU tests and in-game runs were made on my machine.
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.