Repository navigation
GPU: indirect dispatches past 65,535 groups in x run the rest in a second execution - #834
SantannaCarlos wants to merge 1 commit into
Conversation
|
On the requests past 131,070 listed under "Not covered": they come from pipeline warm-up, not from real work. Two 10-minute runs from that save, with this change and the counter:
So the counts are built while passes that make or clear them have no pipeline yet. No record seen asks for y or z over 1, and every program seen cut reads its group id in x. |
|
Independent RTX 5080 16 GB check, driver 617.14, Windows 11 Pro 25H2 (26200.9974). I applied On the identical executable and cache seed, both settings reached controllable prison and bound Follow-up on the rebase In a third launch I toggled only this shader's split while holding the camera at the prison window. The client dimensions stayed at 1735 × 911. In the initial off phase the first record carried 65,535 of 74,400–74,808 requested groups and the bottom band was visible. With splitting enabled, the second record carried the remaining 10,185–10,393 groups and most of the band cleared. Disabling again clipped the records immediately, and the band stayed mostly clear in the sampled view. That persistence is consistent with previously written tiles retaining their updated values. Stepped character edges remained. Diagnostic code and pinned report |
|
Heads-up for merging: #646 also adds a host-computed user-data code at |
|
A/B on an RTX 5070 Ti (wave32, NVIDIA 616.64), Series S profile. Tree:
I didn't compare pictures for the lower-right blocks in this pair, so this only covers cost and stability on a second card and profile. |
|
Turing hardware test result on unchanged PR head 4b44212. Windows, NVIDIA GeForce RTX 2080 Ti, Windows driver version 32.0.16.2101. No game files or in-game run. I ran the existing split-dispatch fixture in an instrumented test harness. The local change only selects hardware versus WARP, asserts the adapter type/name, replaces the fixture's silent initialization skip with an expect, and logs the cases. Production split code and the readback assertions were unchanged. Command: Both runs passed (1 test each, exit 0):
All eight split cases ran: 1x1x1, 65535x1x1, 65536x1x1, 89968x1x1, 131070x1x1, 200000x1x1, 70000x2x3 and 70000x16x1. The unsplit negative control passed too. The fixture checks per-group hits, the 131070 x cap and the budget rejection for the oversized case; this is not a claim that all 200000 groups run. The untouched baseline fixture also passed, but the adapter-logged runs above are the evidence that the instrumented fixture actually executed on each adapter. Rollback verification was not completed because the local tool rejected that command. This supports the synthetic split logic on Turing; no conclusions about in-game visual changes or frame rate. AI-assisted (OpenAI Codex); tests executed locally. |
… 0x105 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016TFkzoCQk3ZUibQWPNRBXE
|
Heads-up for merging this together with #220 (cheaper indirect draws, open): the two combine without a textual conflict in the clamp shader, but the result is wrong.
AI-assisted (Claude Code). |
4b44212 to
0135c41
Compare
|
Rebased onto
Checked on the rebased tree, WARP: the |
|
@VibeClauding thanks, the same three came up in the rebase onto |
|
A heads-up for when this is rebased over f85101b (we merged both into a lab stack on an RTX 2080 and hit it). f85101b rewrites the clamp shader's dispatch branch ( uint rest = ((has_count & 4u) != 0 && g.x == 65535u) ? min(asked.x - 65535u, 65535u) : 0u;now reads the outer scalar Two more things that need adapting on rebase: f85101b passes Separately, on f85101b itself: |
…her codes 0x104/0x105/0x106 - fxceless#646 (USER_DISPATCH_THREADS), fxceless#834 (USER_GROUP_BASE) and our USER_VIEW_SLOT each took 0x104; here they are 0x104, 0x106, 0x105. - record_clamp_with takes the scratch buffer's state as record_clamp_as does since fxceless#220, and bound_split tracks it like clamp_into. - The split read asked.x, which since fxceless#220 is the mesh records' count (a scalar, 0 for dispatches): every full dispatch got 65,535 more groups and twice the charge. It reads the record's x now, as the second record's store does. warp_split_runs_every_group_of_a_wide_ dispatch_once passes again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016TFkzoCQk3ZUibQWPNRBXE
…celess#834, after fxceless#646's 0x104), USER_VIEW_SLOT 0x106 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016TFkzoCQk3ZUibQWPNRBXE
|
For whoever weighs this: myokex already split dispatches the same way in myokex/victory-amd on the 24th ("Shaders: compute programs add the number of the first group" and "GPU: ... dispatches in parts", 892d259 and 4436f8f there), and it was carried into ZSlayerHQ/victory-world-runtime and vitutu1/victory-perf. I found it only after opening this; it never came here as a pull request, and main took myokex's view guard but not this part. Same idea and even the same names (
Take whichever fits better, or the direct-dispatch part of that one on top of this. If you prefer that one, I'll close this; the measurements here apply to both. |
|
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head AI-assisted (Claude Code); no game data. |
…not the dark-cell cause) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Follow-up on "Not covered" (requests past 131,070 groups in x). Setup: RTX 4070, 10-minute runs, this branch plus the cut counter.
|
|
Second RTX 4070 data point for the cut (AI-assisted, Claude; run on my machine): RTX 4070 (undervolted, 100 W limit), Ryzen 5 5600 at 3.95 GHz (6 cores), Windows 11, driver 621.01, Series X profile. This branch (
|
|
More data on the same pass, from our tree (RTX 5070 Ti, NVIDIA 621.40, Windows 11). One trap we hit, in case a later version reads the count on the CPU: when the list is recorded, the record's title memory can still hold a value the title has not written yet. We read 4,294,903,655 once. We treat a count over 2^20 as not a count, and clamp it as before. |
|
Tested in game on an RTX 5070 Ti (16 GB, driver 621.24, Windows 11): this fixes the blocky "old picture" artifacts we had in the world. Before: from a save past the prologue (a balcony over a garden and the sea), screen-aligned blocks on walls, the wooden floor, a glass railing and the sea showed pieces of an earlier view, for example trees and parked cars from where the camera had looked before. The blocks stayed put while the camera moved. A target dump of one such frame showed them already in the lit scene, before TAA. Ruled out first, each in its own run with the artifacts unchanged:
With this PR merged onto main a253706 (+ #854 and two local patches; the merge was clean), the artifacts are gone in the same scene:
One thing worth knowing: the change to the translation invalidates the shader cache, so the first launch rebuilt about 2,600 pipelines. That was roughly 10 minutes of a mostly black picture, with missing colours and meshes. On the next launch, with the cache warm, everything was normal. |
…execution A dispatch runs at most 65,535 thread groups in each dimension; the console's go further in x. One lighting pass of the prologue asks for 85,000 to 115,200 groups in a one-record indirect dispatch every frame, and the clamp cut it to 65,535, so a fifth to two fifths of its tiles kept what an earlier frame left there, which matches the square blocks in the lower right of fxceless#310. The clamp now writes, behind a free flag bit, a second record per dispatch record with the groups past 65,535 in x (up to 65,535 more), y and z as asked, and charges both to the list's budget; the 2^20 groups a dispatch may run hold for the two together. The host runs those second records as a second execution with a new user-data dword at 65,535, which the translated program adds to its group id in x. Only programs that read the group id in x get the dword and the second execution; VICTORY_DISPATCH_SPLIT=0 turns it off.
0135c41 to
b9ab1ee
Compare
|
Rebased onto Checked on the rebased tree (WARP): all 16 |
|
Tested in the title on an RTX 5080 16 GB (driver 621.14, Windows 11, Series X profile): the blocks along the bottom edge of the prison shots are gone. Build: diagnostics build of The records: a local log of the dispatch records as the title wrote them showed Picture, the same shots in runs of the same tree without and with the PR, warm caches:
Stability: no errors and no device loss in two 10-minute runs. The refused compute pipelines are the three that #823 leaves. AI-assisted (Claude Code, Claude Opus 5.5). Counts and descriptions only, nothing from the game attached. |
…fxceless#834) and share shader cache between release and diag
Adapt fxceless/victory-fork#834, preserving the native AMD path and the thread-count constants. Opt in with VICTORY_DISPATCH_SPLIT=1 on a 32-lane host. Split single compute records without count buffers and leave other dispatches on their existing path. (cherry picked from commit b9ab1ee0fbc7e66a60322f60f768aeb43e3e23e3)
Problem
A D3D12 dispatch runs at most 65,535 thread groups in each dimension, while the console's go further in x. The README lists it under "Known and counted, not fixed yet": the clamp cuts an indirect compute record that asks for more to 65,535 in x, and the groups past it never run.
In the prologue on an RTX 4070 it is always one program,
2dc364df5d3278b8(named with a local counter of the cut executions):ExecuteIndirect.VICTORY_SHADER_OPT=0shows too.Change
indirect.rs). Behind bit 3 of the flags word, which was free, the clamp writes a second record after each dispatch record,stride * recordsbytes on in the scratch buffer.USER_GROUP_BASE(RootType::Other(0x104)), is added toSV_GroupID.xin programs that read their group id in x. Other programs come out unchanged. The translator emits noSV_DispatchThreadID; the console code builds global ids from the group-id register, so the base reaches those too.draw.rs). For an indirect dispatch whose program has the dword, the clamp runs withbound_split. After the usualExecuteIndirect, the host sets the dword to 65,535, runs the second records with the same command signature,maxand count buffer, then sets the dword back to 0. Direct dispatches and every other path see 0.VICTORY_DISPATCH_SPLIT=0turns the split off.The second execution runs exactly the groups past 65,535, so there are no surplus groups to stop.
shortcut: only programs that read their group id in x are split. A second execution for every indirect dispatch would double the indirect compute commands of a frame, so the others are still cut, which matters for one that takes its work from a counter. The one program seen asking for more in the prologue reads it.
Not covered:
Related
2cc4c197ee29e291(the reflection tiling program) run on 32-lane hosts and reports a band of blocks gone in the same shot. That program is refused in all seven runs below, with and without the split, so the difference in them is the split's. The two may each account for part of the blocks.Tested
indirect::tests::warp_split_runs_every_group_of_a_wide_dispatch_once(WARP): one record goes through the clamp and both executions, and a shader counts each group in a UAV.emit::tests::the_group_id_in_x_starts_at_the_host_base: a hand-written program that stores its group-id register is translated, validated and run with three groups. It reads 0, 1, 2 with the dword at 0, and 65,535, 65,536, 65,537 with it at 65,535.cargo clippy --workspace --all-targets -- -D warnings, with and without--all-features: only what9376fd6already fails on (draw.rssort_unstable_by_key,indirect.rsRig::depth_written, and without the featuresplaced_filler_twins).cargo test -p victory-shader: 216 passed on the card. Under WARP 4 fail (ds_min_max_f32_order...,v_permlane16_and_x16...,whole_wave_f64_sum...,a_lane_mask_joined_with_a_number...), the same way as on9376fd6.cargo test -p victory-gpu --lib(WARP): all pass butdepth_bounds_pipeline_loads_and_filters_draws, which fails on9376fd6under WARP too.cargo xtask policy.indirecttests pass.6b82bc7d22016cb5and refused it withE_INVALIDARG; earlier runs on trees without this change refuse it the same way.The README line under "Known and counted, not fixed yet" can say "up to 131,070 groups in x run" once this is in.