Shaders: every barrier-free 1D compute program takes the DispatchX thread-count guard #3561
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3561"
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 CocoBeans64 on 2026-11-27T17:52:30Z.
Stacked on #3426. It needs #3426's thread-count guard and its host-side conversion, and should merge after it or together with it. The commit that is new here is the top one,
b900021; the rest of the diff is #3426. FIND-38 (#1633).What
DispatchXwith flag0x20passes thread counts, not group counts.0x8020, 32-thread groups). They are not named, so they are not converted, and they still run 32 times the threads they ask for.s_barriertakes the guard.DispatchXwith flag0x20, and leaves it at 0 (no limit) for every other dispatch, so other dispatches run exactly as before.s_barrieris left out: a lane that left at entry would not reach the barrier.Measured
In the title, on an RX 6800 XT (RDNA 2, 32..64 lanes), Windows 10 22H2, Agility SDK 1.614.
main63bcca4+ #2118, then with #3426, then with #3426 + this PR.VICTORY_GPU_TIMING=1, DRED. Menus by hand, then a few minutes in the opening world area.dispatch_x, not part of this PR. It counts the lanes eachDispatchXlaunches against the threads the counts ask for, over 300 frames while the builder runs.main+ #21180x20)0x20)0x8020)0x8020)The full numbers are in the measurement comment on #3426.
a root view's offset: no root view, or outside title buffers). So these runs don't show the builder's own cost with and without the guard.Tests
emit::thread_limit_tests:one_dimensional_groups_without_a_barrier_take_the_thread_limit: 32×1×1 and 64×1×1;programs_the_guard_would_break_or_not_cover_keep_their_groups: withs_barrier, 8×8×1, 32×1×2 and 1×1×1.partial_dispatch_guards_threads_past_the_tailanddispatch_x_counts_are_groups_without_a_partial_dispatch_guard. All pass.cargo clippy --locked -p victory-shader --all-targets -- -D warnings, with and without--all-features.cargo xtask policypasses.cargo test --workspace. Windows 10's runtime gives the GPU tests no SM 6.6 device without local changes, so CI will be the first to run it.No title data in this pull request: the tests are hand-written programs (
s_barrier,s_endpgm). AI-assisted (Claude).🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by pickles976 on 2026-11-27T18:23:35Z.
Verified production head
b9000218ccon Linux 6.17 / Wine 11 / physical RTX 4060 Laptop 8 GiB (NVIDIA 590.48.1), 16 GiB system RAM. This is the disclosed diagnostic-relaxed-vtable vkd3d-proton 2576c0b4adfae4a+ stack, not stock certification. Production unchanged; local test-only strengthening/addition retained in VIctory-pr3561.Five focused checks passed:
The new hardware fixture emits two synthetic wave32-logical programs with 32x1x1 and 64x1x1 groups. Each stores globalThreadId.x+1 at its own UAV word. Two groups execute for each limit 0, 1, width-1, width, width+1, 2width-1, 2width, and 2*width+7. Limit zero exercises ordinary unlimited dispatch. All 1,792 output words across 16 actual NVIDIA dispatches matched, including untouched partial tails and the extra 16-word guard band. Both emitted modules passed the mandatory SDK validator. No WARP request or adapter skip.
Scope: the GPU fixture binds the thread-limit metadata through the test host; it is not an end-to-end production State::DispatchX invocation or original XboxBvhBuilder shader execution. These synthetic programs do not exercise split-Wave64/translator-inserted barriers, the unresolved scalar/lane-loop semantics, or gameplay. No matched-parent, frame-time or memory-saving claim. Preserve the barrier exclusion when evolving paired-wave lowering: early per-thread returns must not strand group-wide synchronization.
Local evidence:
.compat-runtime/logs/verify-pr3561-dispatch-tail-20261127T181754Z/
.compat-runtime/logs/verify-pr3561-dispatch-counts-20261127T181802Z/
Resource guards unchanged (9 GiB scope/512 MiB swap; global GPU 6000 MiB, available RAM 2048 MiB, disk 10 GiB). The hardware leg sampled GPU peak 234 MiB and available RAM minimum 11333 MiB. No title launched.
Imported from Marvisak/VIctory. Originally posted by kilolimaVI on 2026-11-27T18:42:24Z.
Hardware run, head
b900021: Windows 11, Radeon 780M (RDNA3 iGPU), toolchain 1.98.1.cargo test -p victory-shaderon the 780M: 309 passed, 0 failed, includingpartial_dispatch_guards_threads_past_the_tailandthread_limit_tests::programs_the_guard_would_break_or_not_cover_keep_their_groups.cargo test -p victory-gpu --features diagnostics: 249 passed, 0 failed on the 780M and on WARP, includingdispatch_x_counts_are_groups_without_a_partial_dispatch_guard.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.