Shaders: console waves may end before a title barrier in the console flow in halves (on #3683) #3759
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3759"
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 redNSF on 2026-11-28T16:07:01Z.
Stacked on #3683 (pair meetings, itself on #439); the last commit is this change.
Problem. With pair meetings, a wave64 program whose group holds several console waves is refused when a title
s_barrieris not met exactly once on every path ("a title barrier not met once by every console wave of a group in halves"). The title's classification programs fail that only because of their first lines: threads past the count are switched off for the rest of the program, and a console wave left with none branches tos_endpgm(v_cmpx_*thens_cbranch_execzto the end), around the barriers the other waves meet.Change.
barriers_oncebecomesbarriers_in_step: no block holding ans_barrieris in a cycle, and of any two such blocks one dominates the other. The barriers are then a chain, and each console wave meets a first stretch of it, each barrier once, up to where the wave ends or goes a way without barriers. A console wave that ends early is in no later barrier, on the console and on the host alike: both wait only for threads still running. Still refused: a barrier in a loop (nothing shows that every console wave runs the loop equally often) and barriers on different ways.Effect. Grand Theft Auto VI,
translate --list --host-lanes 32-32: compute programs that translate go from 2,619 (#3683) to 2,624 of 2,682; the 5 gained were refused for this reason, none are lost. They are the fourcascadeshadows_classifyprograms (CS_CalcRasterClassificationListCounts,CS_CalcRTClassificationListCounts,CS_WriteRasterClassificationResults,CS_WriteRTClassificationResults) andalphaResolve:CS_AlphTransmissionPrefilterMip. 7 stay refused with the reason, now worded "title barriers not met in one order by the console waves of a group in halves" (barriers in loops).Tests (RTX 3060, 32-lane waves only):
barriers_go_on_without_the_console_waves_that_ended: a 256-thread wave64 group counts its threads below a limit through LDS between two barriers; threads from the limit on are switched off and a console wave left with none ends before the first barrier. Run on a 32-lane hardware adapter (skipped elsewhere) with limits 40, 96, 200 and 256: every thread's count and its console wave's lane count are checked, and no thread past the limit stores.console_waves_may_end_before_the_title_barriers: that program translates; with its first barrier in a loop it is refused with the reason above. Runs anywhere.cargo test -p victory-shader --libon WARP: the same 4synthetic_testsfail here as on #3683 alone.Not run in the title yet: this PR claims that the programs translate and that the barrier behaves as the test checks on this card.
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T17:04:00Z.
NVIDIA row for this PR: it passes on Ampere. Its GPU test runs here, on a 32-lane card, and reads what the console computes at every limit. Without the change, both tests fail on this card, but by refusing the program, not with wrong values: the parent's code does not translate it.
RTX 3070 (desktop), driver 616.56, Windows 11 Pro 10.0.26100, debug. Head
17cf775. Its parent is82f99f7, the head of #3683, so the base for the control and the lib counts is that parent and not main.cargo test --locked -p victory-shader --lib -- barriers_go_on_without_the_console_waves_that_ended console_waves_may_end_before_the_title_barriers --nocapture: 2 passed, 0 failed, 0 ignored, in 3 of 3 runs on hardware. WithVICTORY_WARP=1, where every device is WARP, also 2 passed, 0 failed in 3 of 3 runs. But there the GPU test printedthe hardware adapter runs 64-lane waves: nothing to test; skipped, so under WARP only the translation test checks anything.The halves path: the GPU test prints nothing when it passes. So I ran it once more with two temporary
eprintln!s, ofHost::target()and of the readback, then restored the file.On hardware it printed
adapter lanes 32..32, so the test translates for a host without 64-lane waves. Each console wave64 then runs as two 32-lane waves, which is the halves path. The control below confirms it: the parent refuses this program on this card with a reason that ends "of a group in halves".The readback matches the test's expected values at every limit:
80, thread 400;160, thread 95128, thread 960;264, thread 199208, thread 2000;320.So the console waves with no thread below the limit (waves 1-3 at limit 40, waves 2-3 at 96) end before both barriers, and the waves that are left still meet them and count correctly. A half-empty wave (limits 96 and 200) also counts correctly.
Under
VICTORY_WARP=1it printedadapter lanes 4..4. WARP is skipped because its range is not 32..32, not because it runs 64 lanes, so the skip message inhardware()(from #3683) names the wrong reason here.Negative control: the parent's
emit/lower.rsandemit/lower/pairs.rs, with the PR'spair_meeting_tests.rskept. The test nameslower::pairs::BARRIERS_OUT_OF_STEP, which the parent lacks, so in the control that one reference is the constant's string.git diff --stat HEAD: 3 files, 29 insertions, 58 deletions (that test line is 1 of them).git diff --stat 82f99f7: onlypair_meeting_tests.rs, 141 insertions.GFX10 code at 0x0: a title barrier not met once by every console wave of a group in halves is not supported:console_waves_may_end_before_the_title_barriersat its firstexpect(waves that end before the barriers);barriers_go_on_without_the_console_waves_that_endedat itsemit(...).unwrap(), before any dispatch.VICTORY_WARP=1: 1 passed, 1 failed, in 3 of 3 runs. The translation test fails the same way, and the GPU test skips as above.So on the parent this program is refused rather than wrong. The control shows the PR is what lets it translate, but no GPU result exists to compare with the parent's.
cargo test --locked -p victory-shader --lib -- --skip heap_direct_texture_reads_mark_their_heap_index:82f99f7(#3683): 348 passed, 3 failed, 3 ignored.The two extra passes are the new tests. The 3 failures are the same on both, and they are the ones main has on this card:
stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride,stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zerosandsynthetic_tests::gathers_at_a_level_match_the_hardware. The skipped test crashes the binary on this card (open issue #2571). On the 3070 the stack shows none of the 4synthetic_testsfailures the description reports on WARP, but I did not run the suite under WARP.The last commit does not touch
victory-gpu, so I did not run its lib suite. The rest of the stack does touch it.NVIDIA-specific: this card is the case the change is for (32..32 lanes, halves). A console wave that ends before the barriers does not stop the others there, and every value matches the console's.
Not tested:
cascadeshadows_classify,alphaResolve) and its census, which need game files;VICTORY_WARP=1;AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this report.
Imported from Marvisak/VIctory. Originally posted by cxy0072019-sketch on 2026-11-28T17:45:44Z.
I checked the exact parent
82f99f7against17cf775on an RTX 5070 Ti with driver 621.24. On the same shader archive,translate --host-lanes 32-32 --validate --listwent from 2,619 to 2,624 emitted compute programs and from 1,884 to 1,889 DXIL validations. All five named programs pass, including the alpha prefilter. The synthetic early-exit test executed on the hardware adapter and passed.During a separate title startup with
17cf775, the runtime also logged successful D3D12 compute pipeline creation for2da4beb386509b77, the alpha prefilter. This startup used the title's 3840×2160 swap chain and the captured 3D scene was still dark with the HUD visible. The result confirms pipeline creation in the title. A scene-level visual result is still open.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.