Split wide indirect dispatches on 32-lane GPUs #10

Open
github-bot wants to merge 5 commits from github-bot/gh-10 into main AGit
Owner

@⁠gomeaw on GitHub · 2026-11-25 23:18 UTC · original
gomeaw:fix/portable-wide-dispatch → main · +445 −18 · 7 files · 5 commits · draft

What this addresses

On NVIDIA, this fork clamps indirect compute dispatches at 65,535 groups in X. Larger dispatches can miss the last lighting tiles and leave stale pixels. Related fxceless/victory-fork#834 includes world reports of this artifact on RTX cards. This adapts Carlos Sant'Anna's patch to this fork and preserves its commit attribution.

Change

With VICTORY_DISPATCH_SPLIT=1 on a 32-lane host, a single indirect compute record without a count buffer can run up to 131,070 groups in X. The two executions share the original budget. Only shaders that read the X group ID receive the extra root dword. The host sets it before the second execution and clears it afterward. The opt-in path bypasses the batch clamp for eligible calls so the tail executes next to the first part.

Verification

  • WARP ran the translated shader at group bases 0 and 65,535. The indirect fixture checked each group once across eight cases, including an 89,968-group workload, the upper cap, Y/Z coverage, and budget rejection. With splitting disabled, the fixture stops at 65,535. Windows validation

  • The native lowering test also checks that a 64-lane host gets no new group-base constant.

  • The replay regression verifies that skipping clamps copies both argument records. Replay clamp batching keeps lists with split dispatches in their recorded form.

  • The translator and pipeline cache keys now include the effective dispatch split setting. The regression test distinguishes on and off for wave32 and verifies a stable key for wave64. Thanks to sawetco for reproducing the collision and verifying the key strategy on an RTX 5070. Hardware cache investigation Windows regression check

For gameplay validation, compare the same checkpoint with and without splitting on a 32-lane GPU. The effect on frame time is unmeasured on this fork. scripts\play.ps1 can pass the switch through -More @{VICTORY_DISPATCH_SPLIT='1'}.

AI-assisted with Codex. The tests use synthetic shaders and buffers.

**@⁠gomeaw** on GitHub · 2026-11-25 23:18 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/10) `gomeaw:fix/portable-wide-dispatch` → `main` · +445 −18 · 7 files · 5 commits · draft ## What this addresses On NVIDIA, this fork clamps indirect compute dispatches at 65,535 groups in X. Larger dispatches can miss the last lighting tiles and leave stale pixels. Related [fxceless/victory-fork#834](https://github.com/fxceless/victory-fork/pull/834) includes world reports of this artifact on RTX cards. This adapts Carlos Sant'Anna's patch to this fork and preserves its commit attribution. ## Change With `VICTORY_DISPATCH_SPLIT=1` on a 32-lane host, a single indirect compute record without a count buffer can run up to 131,070 groups in X. The two executions share the original budget. Only shaders that read the X group ID receive the extra root dword. The host sets it before the second execution and clears it afterward. The opt-in path bypasses the batch clamp for eligible calls so the tail executes next to the first part. ## Verification - WARP ran the translated shader at group bases 0 and 65,535. The indirect fixture checked each group once across eight cases, including an 89,968-group workload, the upper cap, Y/Z coverage, and budget rejection. With splitting disabled, the fixture stops at 65,535. [Windows validation](https://github.com/gomeaw/VIctory-7900XTX/actions/runs/45720621864) - The native lowering test also checks that a 64-lane host gets no new group-base constant. - The replay regression verifies that skipping clamps copies both argument records. Replay clamp batching keeps lists with split dispatches in their recorded form. - The translator and pipeline cache keys now include the effective dispatch split setting. The regression test distinguishes on and off for wave32 and verifies a stable key for wave64. Thanks to sawetco for reproducing the collision and verifying the key strategy on an RTX 5070. [Hardware cache investigation](https://git.gtahub.st/github/avatarmanz--VIctory-7900XTX/pulls/10) [Windows regression check](https://github.com/gomeaw/VIctory-7900XTX/actions/runs/45724117447) For gameplay validation, compare the same checkpoint with and without splitting on a 32-lane GPU. The effect on frame time is unmeasured on this fork. `scripts\play.ps1` can pass the switch through `-More @{VICTORY_DISPATCH_SPLIT='1'}`. AI-assisted with Codex. The tests use synthetic shaders and buffers.
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)
Use the same host-gated setting that controls group-base lowering, keeping the key stable on wave64 when the switch is irrelevant. Regression and fix suggested by sawetco in PR #10.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:31:17 +00:00
Author
Owner

@⁠sawetco on GitHub · 2026-11-25 23:31 UTC · original · edited 2026-11-25 23:59 UTC

I found a shader-cache collision while testing d78024b on an RTX 5070, driver 621.24. It can mask the result of the proposed gameplay A/B if both runs reuse a cache.

For one compute shader, these are the first 12 hex digits of the SHA-256 of its cached translation:

Run Cached translation
Fresh cache, VICTORY_DISPATCH_SPLIT=0 22b1d00c958b
Separate fresh cache, VICTORY_DISPATCH_SPLIT=1 04b0f3aa1ca0
Reuse the first cache, switch from 0 to 1 22b1d00c958b

Both fresh translations used the same cache filename. You can also see the missing discriminator without game data: on this card victory warm --limit 0 --jobs 1 in two new processes printed the same fingerprint (82b4540fbd80e731) with the switch set to 0 and 1.

I tested a fix in crates/victory-shader/src/emit/lower.rs: extend host_settings() to [u32; 5] and append u32::from(split_group_base()). The shared cache then held two entries, and the enabled translation matched a fresh enabled cache byte for byte. The pipeline fingerprints also separated. A regression test using the existing host-wave overrides confirms that toggling changes the key on wave32 and preserves it on wave64. The existing group-base test still passed on WARP.

Until the key includes this setting, separate cache directories for off and on give a valid comparison. This check covers cache selection. In-game lighting is a separate measurement. AI-assisted test and report.

Retest on the published fix. I built an unmodified b390945 and repeated the same shared-cache test on the RTX 5070. The cache held one entry after off and two after switching on. Repeating on kept both entries, and the enabled entry matched a fresh enabled cache byte for byte. warm --limit 0 now reports distinct fingerprints (a426f76508304e04 off, c87a34a9996fa279 on).

In-game A/B. The gameplay executable was d78024b with the locally tested cache-key change and an input-only hook. Both runs used Series X, the published Safe settings, a copy of the same Jason house save, and their own 1,352 pretranslated shaders from identical inputs. Both started with an empty host pipeline library. For 30 seconds at the same porch railing, before any movement input, I measured host presents and sampled the composed window approximately every five seconds.

Dispatch split Intervals FPS Median frame p95 frame
Off 58 1.99 570 ms 995 ms
On 58 1.94 576 ms 1,005 ms

With splitting on, the channel behind Jason showed a blue-gray water surface and reflections in the sampled views. With splitting off the same area was pale and looked exposed down to the bed. A faint wireframe around the head was still visible in one enabled sample. One run per setting, with pipelines still warming. This is an outdoor visual observation, and does not establish the cause of the water difference or an interior-lighting fix.

**@⁠sawetco** on GitHub · 2026-11-25 23:31 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/10#issuecomment-7177680867) · edited 2026-11-25 23:59 UTC I found a shader-cache collision while testing d78024b on an RTX 5070, driver 621.24. It can mask the result of the proposed gameplay A/B if both runs reuse a cache. For one compute shader, these are the first 12 hex digits of the SHA-256 of its cached translation: | Run | Cached translation | | --- | --- | | Fresh cache, `VICTORY_DISPATCH_SPLIT=0` | `22b1d00c958b` | | Separate fresh cache, `VICTORY_DISPATCH_SPLIT=1` | `04b0f3aa1ca0` | | Reuse the first cache, switch from 0 to 1 | `22b1d00c958b` | Both fresh translations used the same cache filename. You can also see the missing discriminator without game data: on this card `victory warm --limit 0 --jobs 1` in two new processes printed the same fingerprint (`82b4540fbd80e731`) with the switch set to 0 and 1. I tested a fix in `crates/victory-shader/src/emit/lower.rs`: extend `host_settings()` to `[u32; 5]` and append `u32::from(split_group_base())`. The shared cache then held two entries, and the enabled translation matched a fresh enabled cache byte for byte. The pipeline fingerprints also separated. A regression test using the existing host-wave overrides confirms that toggling changes the key on wave32 and preserves it on wave64. The existing group-base test still passed on WARP. Until the key includes this setting, separate cache directories for off and on give a valid comparison. This check covers cache selection. In-game lighting is a separate measurement. AI-assisted test and report. **Retest on the published fix.** I built an unmodified `b390945` and repeated the same shared-cache test on the RTX 5070. The cache held one entry after off and two after switching on. Repeating on kept both entries, and the enabled entry matched a fresh enabled cache byte for byte. `warm --limit 0` now reports distinct fingerprints (`a426f76508304e04` off, `c87a34a9996fa279` on). **In-game A/B.** The gameplay executable was `d78024b` with the locally tested cache-key change and an input-only hook. Both runs used Series X, the published Safe settings, a copy of the same Jason house save, and their own 1,352 pretranslated shaders from identical inputs. Both started with an empty host pipeline library. For 30 seconds at the same porch railing, before any movement input, I measured host presents and sampled the composed window approximately every five seconds. | Dispatch split | Intervals | FPS | Median frame | p95 frame | | --- | ---: | ---: | ---: | ---: | | Off | 58 | 1.99 | 570 ms | 995 ms | | On | 58 | 1.94 | 576 ms | 1,005 ms | With splitting on, the channel behind Jason showed a blue-gray water surface and reflections in the sampled views. With splitting off the same area was pale and looked exposed down to the bed. A faint wireframe around the head was still visible in one enabled sample. One run per setting, with pipelines still warming. This is an outdoor visual observation, and does not establish the cause of the water difference or an interior-lighting fix.
Author
Owner

@⁠MoonYueya on GitHub · 2026-11-26 05:28 UTC · original

Tested on an RTX 3080 10 GB, driver 32.0.16.1742, Ryzen 7 7700, 31.1 GB RAM, Windows 11 26300, merged into MoonYueya/VIctory-Kira a3de053 on top of e2a28ec together with the other open NVIDIA PRs (#47 #48 #24 #23 #78 #42 #66 #18 #10 #4 #58 #17).

  • cargo test --workspace --locked --no-fail-fast -- --test-threads=1: 931 passed, 0 failed, 45 ignored after this PR was merged (never below the count before it; the branch started at 923).
  • Note VICTORY_DISPATCH_SPLIT is off by default, so the runs below do not exercise it.
  • With everything merged, three unattended runs reached the world with no device removal, panic or untranslated shader.

What this does not show: the PR was not run in the game on its own, so this is unit tests plus a combined run, not an in-game verification of this PR by itself; nothing here is about picture quality.

AI-assisted.

**@⁠MoonYueya** on GitHub · 2026-11-26 05:28 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/10#issuecomment-7183519162) Tested on an RTX 3080 10 GB, driver 32.0.16.1742, Ryzen 7 7700, 31.1 GB RAM, Windows 11 26300, merged into [MoonYueya/VIctory-Kira](https://github.com/MoonYueya/VIctory-Kira) `a3de053` on top of `e2a28ec` together with the other open NVIDIA PRs (#47 #48 #24 #23 #78 #42 #66 #18 #10 #4 #58 #17). - `cargo test --workspace --locked --no-fail-fast -- --test-threads=1`: **931 passed, 0 failed, 45 ignored** after this PR was merged (never below the count before it; the branch started at 923). - Note `VICTORY_DISPATCH_SPLIT` is off by default, so the runs below do not exercise it. - With everything merged, three unattended runs reached the world with no device removal, panic or untranslated shader. What this does **not** show: the PR was not run in the game on its own, so this is unit tests plus a combined run, not an in-game verification of this PR by itself; nothing here is about picture quality. *AI-assisted.*
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/draw.rs
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/mod.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/10/head:github-bot/gh-10'
git switch 'github-bot/gh-10'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-10'
git switch 'github-bot/gh-10'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-10'
git switch 'github-bot/gh-10'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-10'
git switch 'main'
git merge --squash 'github-bot/gh-10'
git switch 'main'
git merge --ff-only 'github-bot/gh-10'
git switch 'main'
git merge 'github-bot/gh-10'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.