Direct dispatches past 65,535 groups in x run in parts #662
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/662"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by 0xkn0wh3r3 on 2026-11-28T02:58:28Z.
What
A direct dispatch with more than 65,535 thread groups in x now runs in parts.
The console runs more than 65,535 groups in x in one dispatch. D3D12 refuses more than
D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION(65,535), andState::dispatchpassed the title's counts straight through.Ported from Marvisak/VIctory#3086, which came from DexNom/VIctory@570a941. It's rebuilt on this tree's host words instead of #3086's own user-data plumbing. DexNom is credited with
Co-authored-by.How
USER_GROUP_BASE(RootType::Other(0x107)), a dword the host sets through the existinghost_wordmechanism. As bound, it is 0.USER_DISPATCH_THREADS_X) reads group x on its own, so it adds the base too.State::dispatchruns a dispatch of more than 65,535 groups in x in parts of at most 65,535 (dispatch_parts).indirect.rs,widest). That's a separate fix.Tests
emit::wave64_tests::group_x_starts_at_the_dispatch_partruns on the GPU. It runs a translated program in which each lane adds 1 tocounter[group x], as 2 groups with base 0 and base 3, on the hardware adapter and on WARP.draw::thread_tests::large_dispatches_run_in_partschecks the split for 0, 100, 65,535, 65,536, 115,200 andu32::MAXgroups. Every part is at most 65,535, the parts follow each other, and together they cover every group once.the_lanes_past_a_count_of_threads_do_not_run(the counted path, now through the base) still passes.cargo test -p victory-shader --lib: 291 passed, 0 failed.cargo test -p victory-gpu --lib: 442 passed, 2 failed. Both fail the same way onmain:indirect::tests::host_list_budget_starts_empty_at_each_submissionandindirect::tests::warp_batch_charges_every_execution.cargo clippy -p victory-gpu -p victory-shader --all-targets, with and without--all-features: no new warnings. (mainhas 78, the same count, two of them moved down a few lines indraw.rs.)Performance, before and after
This is a correctness fix, and I haven't measured any performance numbers for it.
Dispatchcall and no extra root constant. The only added work for them is looking up whether the pipeline has the base dword. I expect no change, but didn't measure it.Dispatchwas called with a count D3D12 refuses.Dispatchcalls, plus oneSetComputeRoot32BitConstantper part after the first and one to reset the base.Not measured: the title's own dispatches. DexNom's fork recorded a 115,200 × 1 × 1 dispatch. I haven't checked which of this title's dispatches go over 65,535, or what they draw.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T05:38:34Z.
Review: APPROVED
LGTM — verified on Windows (RTX 5090):
cargo test -p victory-shader --lib emit::tests::passed (22/22)cargo test -p victory-gpu --lib draw::passed (9/9, includingdraw::thread_tests::large_dispatches_run_in_parts)cargo xtask policypassed (294 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.