Shader: a branch-only mask SCC is the console wave's "any lane" (#3491) #3500
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!3500
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3500"
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?
@oni-swr on GitHub · 2026-11-27 10:38 UTC · original
oni-swr:fix/3491-branch-only-mask-scc→main· +909 −15 · 9 files · 4 commits · openFixes #3491. Claim: #1633
Problem
s_and_b32/b64 sX, vcc, execfollowed directly bys_cbranch_scc0/1, with nothing else reading the mask, made each active lane pick its own arm. The scalar AND sets SCC when any bit of the result is set, so every active lane of the console wave must take the same arm.Change
structure.rs: finds these SCC values (Structured::any_sccs). They come from a bitwise mask operation that does not write EXEC, whose result nothing reads, and whose SCC onlys_cbranch_scc0/1read. The branch then tests the uniform SCC instead of the lane's own bit. A mask that is read (for example as EXEC in the arm) keeps the lane's bit, as before.lower.rs: gives such an SCC the wave's vote (WaveActiveAnyTrueof the mask's bit, or the number of a complement tested for zero). It declares the console's wave size, so the host wave is the console's 32 or 64 lanes. Outside compute it refuses cleanly instead of guessing.mask_branch_tests.rs): GFX10 programs for scc0 and scc1, with a common store and with a store in each arm. They run on Wave32 and Wave64, on whole groups and partial groups (lanes 0-47 of 64 active, selected lane inside and outside). They also check that a control that reads the mask too keeps the old path.Program/programvisible to the new tests and added two program kinds.Results (aggregate counts, incorrect dwords over nine dispatches)
Inactive lanes: 0 unexpected writes before and after.
WARP flake. In 12 repeated runs of the repro on head, 8 had zero wrong dwords. In 4, one or two cells had 40-80 wrong dwords, always in the "selected lane just outside the running lanes" cases. A plain DXC-compiled HLSL control (
if (lane < below) { WaveActiveAnyTrue(lane == selected) },WaveSizedeclared) gives the same wrong result on this WARP in 2 of 25 runs, and it is always the same compiled pipeline. The DXIL I emit is the same on every run. The new GPU test therefore rebuilds the pipeline and only fails after three wrong pipelines in a row. On base, every pipeline is wrong.cargo test -p victory-shader --lib(--test-threads=1, same WARP):63bcca4: 296 passed, 6 failed, 3 ignoredClippy
-D warningswith--all-featuresandcargo test -p xtask(policy) pass.Adapters
Microsoft.Direct3D.WARP), 32- and 64-lane waves.VICTORY_WARP=1,VICTORY_D3D12_WARP=1.Overlap
lower.rs(theconsole_lanes |=line and thesopmask check). A trial merge shows only adjacent textual conflicts; both hunks are meant to stay. Whichever lands second rebases.lower.rs. It does the whole-wave branch inside its own halves flow. #2633 merges cleanly.Left open
WaveSize(64), so I expect the pipeline to be refused there, not mis-executed. I did not run it. An exact cross-half reduction needs group barriers, which are not valid inside the divergent region where the vote sits. It would come with the halves flow of #233.AI-assisted: Claude Code (Claude Sonnet 5.5), results checked before posting.
🤖 Generated with Claude Code
@Venom2054 on GitHub · 2026-11-27 10:51 UTC · original
Physical NVIDIA readback on Windows, RTX 5070 Ti (32–32 hardware wave lanes), comparing the reporter-only baseline
b803d168with this head61df32dc.For guest Wave32, each of the three original translated programs went from 92/288 wrong on base to 0/288 on head. The DXC control was 0/288 on both. All inactive lanes kept their initial value. I also ran the four branch variants in the dedicated head test in 12 fresh processes. All 432 dispatches matched on the first pipeline, covering 13,824 output dwords.
For guest Wave64, the three baseline programs each produced 188/576 wrong on this adapter. On head, creation of the first translated Wave64 compute pipeline returned
E_INVALIDARGbefore dispatch. The separate 64-thread groupshared DXC reference was 0/576 on both revisions. A native Wave64 hardware result on head remains open.For comparison, a separate local two-Wave32 renderer with the DoubleGhosty SCC work adapted to it passed the same reporter matrix on the same card at both guest widths. That result depends on its split-wave implementation. All results here use synthetic programs. Testing assisted by Codex.
@andrewpozdnakov7-jpg on GitHub · 2026-11-27 10:58 UTC · original
Venom2054's RTX 5070 Ti run confirms the remaining Wave64 pipeline problem on a 32-lane adapter. On exact
61df32d, I also reproduced two WARP failures in the GPU test where the selected lane was outside EXEC. Physical adapter reportI built a group-vote follow-up directly on
61df32d. For acyclic compute groups of one console wave, it checks every reachable branch before using group synchronization. The scalar branch uses the shared vote, and stores keep their EXEC guards. The native wave path covers the other shapes. 18ececbOn app-local WARP, the GPU test passed all 80 dispatches on the first pipeline for each variant. The original #3491 matrix matched all 2,592 translated dwords and 864 DXC control dwords with no inactive-lane writes. Test-only builds that requested host
WaveSize(32)andWaveSize(4)also passed that matrix. The CLI check, strict shader Clippy, asset policy and the focused structure, range, lowerer and VALU tests passed.This is ready to try on the RTX 5070 Ti with the same Wave64 fixture. Please retain Git authorship if taking the commit. If folding it into another commit, please add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex. Synthetic shaders only.
@oni-swr on GitHub · 2026-11-27 11:19 UTC · original
Thank you both. @Venom2054, the Wave64 report found a real regression. @andrewpozdnakov7-jpg, thanks for the follow-up.
Cause. At
61df32da branch-only mask SCC set the shader's required wave size to the console width. A Wave64 program therefore requiredWaveSize(64), which a 32-lane host cannot create, and that matches theE_INVALIDARGon the RTX 5070 Ti. I could reproduce the same pipeline-creation failure on WARP at61df32d: the ignored DXC-reference matrix test (every_active_lane_observes_the_scc_of_a_mask_operation) stops with "The parameter is incorrect" at its first translated pipeline.Fix. I cherry-picked andrewpozdnakov7-jpg's 18ececb as
39438c9, with their authorship kept. For acyclic compute groups of at most one console wave, every reachable branch must be a plain EXEC ors_and vcc, execSCC branch. The decision is then one group-wide vote through a shared dword. Stores keep their EXEC guards, and no host wave size is declared. Other shapes (loops, indirect branches, scalar memory writes, groups over one console wave) keep the native wave path, so a Wave64 program of that kind still requiresWaveSize(64)and will not create on a 32-lane host. That is a clean refusal instead of wrong results, but a regression compared with base for those shapes.I read the diff before taking it. The barriers sit only in control flow that the pre-check has made uniform for the whole group. The vote slot is reset, written and read between barriers, and is not reused until after a third one. LDS is capped so the extra dword fits.
I added
a5ecc4bon top: a test that reads the emitted container's PSV0 and checks that the group-vote programs require no wave size, for Wave32 and Wave64. It also checks that a group of several console waves still declares its own width.Results. All of this ran on WARP only: adapter
d3d10warp.dll10.0.26100.9818, Windows 11 build 26200,dxil.dllfrom the Windows SDK,VICTORY_WARP=1andVICTORY_D3D12_WARP=1. Each commit was built in its own target directory.a5ecc4bshows 0/288 wrong at Wave32 and 0/576 at Wave64, for the DXC control and all three translated programs, with no inactive-lane writes. At61df32dit stops at "The parameter is incorrect", as above.a5ecc4b.victory-shader --lib(featureshost,diagnostics): base63bcca4has 298 passed, 4 failed, 3 ignored. Head has 303 passed, 4 failed, 4 ignored. The 4 failures are the same on both:synthetic_tests::{a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_mask_high_address_bits_and_divergent_branches, permutes_read_the_lane_named_and_zero_from_lanes_left_out}. They look like WARP's 4-lane waves, not this change. Head adds the new passing tests.victory-gpu --lib: 231 passed, 0 failed, 1 ignored, on base and head.-D warnings, all targets) is clean onvictory-shader, with and without the host features, and onvictory.Outside-EXEC failures. Our earlier report called the remaining failures a WARP flake, and I had not checked that. I re-ran the dedicated test on
61df32din 50 fresh processes and it passed all 50, so I could not reproduce the two failures where the selected lane was outside EXEC. That does not show they were not real. The WARP version and settings may differ, and the group vote removes that dependence on host wave layout anyway.Limits. This WARP test cannot confirm 32-lane hardware behaviour. WARP's waves are narrower, and its handling of a required wave size is not an NVIDIA driver's.
@Venom2054, could you re-run the Wave64 fixture, and the Wave32 one if convenient, on the RTX 5070 Ti at
a5ecc4b? The first translated Wave64 pipeline should now create. I'd also like to know whether any outputs differ from the DXC reference.AI use: this change, the review and this reply were done with Claude Code (Claude Sonnet 5.5). The shaders involved are synthetic.
Co-authored-by: andrewpozdnakov7-jpg [email protected]
@pickles976 on GitHub · 2026-11-27 11:42 UTC · original
Verified exact production head
a5ecc4bbb5227766472f990e1e67b86f4cae3bccon physical RTX4060 Laptop8GiB / Linux / Wine11 / NVIDIA590.48.1, 16GiB system RAM. This uses our disclosed diagnostic relaxed-vkd3d2576c0b4adfae4a+ stack, not stock/native-Windows certification.cargo test -p victory-shader --lib mask_branch_tests -- --nocapture --test-threads=1: 4passed,0failed,0ignored,1.72s; fresh compilation fromVIctory-pr3500,5.98s. Test-only strengthening requires a host, checks its actual DXGI LUID maps to NVIDIA vendor0x10de, and makes the DXIL validator mandatory. No production edits.The GPU fixture executed all 80 dispatches / 3,968 output words, covering both32- and64-lane console groups and all four SCC0/SCC1 common/separate-store forms, including empty/partial active masks and selected lanes immediately outside them. Full readbacks matched on the first run; no retry loop, no WARP and no skipped adapter. Eight translated modules passed the required validator. The separate multiple-console-wave test checks required wave-size metadata; it does not dispatch a multiwave Wave64 program on this GPU.
This validates the current head's single-logical-wave group-vote path on a32-lane physical GPU, beyond the earlier PR-body WARP evidence. Scope/guards unchanged; GPUpeak234MiB, minimum availableRAM10502.6MiB, disk15.580GiB. Evidence
.compat-runtime/logs/verify-pr3500-nvidia-mask-branch-20261127T114109Z/.No matched-parent GPU run or title/frame-rate claim. In particular
group_control_is_safeexcludes backedges, andfor_computelimits this path to one logical wave: this is not a fix for our independent-loop/multiwave BVH or post-loop scalar-state gates. It is a useful positive correctness result without promoting the currently failing #2633 integration.@ColorMeBoom on GitHub · 2026-11-27 13:15 UTC · original
AMD run: RX 5700 XT (RDNA1; the driver reports 32–64 lanes, so it may pick either; no mesh shaders), driver 32.0.21045.29003, Windows 11 26200, Rust 1.98.1. The PR head was merged onto
main63bcca4, tests ran on the native adapter (VICTORY_WARPunset), no game files. Heada5ecc4b. The NVIDIA reports here are from 32-lane-only cards; this card also runs 64-lane waves.mask_branchtests: 5 passed, 0 failed, 1 ignored.every_active_lane_takes_the_arm_of_the_waves_vote_on_gpuran its 80 dispatches.The ignored
every_active_lane_observes_the_scc_of_a_mask_operation(--ignored, with the Windows SDK's PC DXC):(incorrect / total, 0 inactive in every row.)
Full
victory-shadersuite (--features host): 307 passed, 0 failed, 4 ignored.AI use: Claude Code (Claude Opus 5.5).
@kilolimaVI on GitHub · 2026-11-27 13:58 UTC · original
Ran the ignored hardware test on AMD: head
a5ecc4b, Windows 11, AMD Radeon 780M (RDNA3, reports WaveLaneCountMin/Max 32/64), PCdxc.exefrom the Windows SDK, toolchain 1.98.1.every_active_lane_observes_the_scc_of_a_mask_operation(--ignored --nocapture): ok. DXC reference Wave32 0/288 and Wave64 0/576 incorrect; the test'stotal_wrong == 0assert covers the translated Branch / StoreOnScc0 / StoreOnScc1 programs too, for both widths.mask_branchtests: 5 passed (group_vote_branches_keep_vector_store_guards,a_group_of_several_console_waves_keeps_the_native_wave_size,every_active_lane_takes_the_arm_of_the_waves_vote_on_gpu,only_a_branch_reads_the_scc_of_a_mask_it_is_found,the_branches_on_the_waves_vote_validate).victory-shaderlib: 307 passed, 0 failed, 4 ignored.This card can run both wave sizes, so it doesn't exercise the 32-lane-only PSO creation from #3491, but it shows the change keeps the results right on a (32,64) AMD host.
AI-assisted (Claude).
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.