Indirect compute records past the host's group limit run in pieces too (on top of #976); the group base goes to the group id only #1222

Open
github-bot wants to merge 2 commits from github-bot/gh-1222 into main AGit
Owner

@⁠Steenax6 on GitHub · 2026-11-26 00:30 UTC · original
Steenax6:pr/dispatch-pieces-indirect → main · +615 −80 · 9 files · 2 commits · open

What

#976 (MoscaLosca, open) runs direct dispatches of more than 65,535 thread groups in pieces. This adds the indirect case, which is the one we hit, and one correction to the translated program.

In the first room a band along the bottom of the picture held stale blocks, old tiles of earlier frames, in the scene target and in several history targets (it looks like HUD garbage; it is not HUD). A compute pass of the title's indirect lighting is run by an indirect record that asks for about 74,816 thread groups in x. A host dispatch runs 65,535, and the argument clamp cut the record there, so the last tiles of the list, the bottom of the screen, were never written. About 1.2 such records a frame.

Commits

  1. #976 as it is, cherry-picked onto 4aa6e8c with MoscaLosca as author (two conflicts, both "keep both sides"). This branch is stacked on it; if #976 is merged first this commit drops out.
  2. Ours:
    • For a program that reads its group id, the argument clamp writes each indirect compute record VICTORY_GROUP_PIECES times (2 by default, at most 16), piece p holding clamp(x - p * 65535, 0, 65535) groups, and the execution is recorded once a piece with that piece's group base (USER_GROUP_BASE). No count is read back. All pieces of a record charge the list's budget as one.
    • The translated program adds the base to its group id only. In #976 it is added to the thread id in the group as well (both go through the same helper), so a program reading its thread id in the group reads it too large by the base in every piece after the first.
    • Still cut, and counted on the frame line: a record of a program that reads no group id, a record asking for more than all its pieces run, and everything with VICTORY_GROUP_SPLIT=0.
    • On this base only the clamp where the record runs needs it: a dispatch record is never served from a window and never gathered (VICTORY_INDIRECT_GATHER=1), so the gather pass gets one piece and is otherwise unchanged.

Measured (in our tree, Steenax6/VIctory-NVID ac7664d, RTX 4070 Ti)

The largest count asked for is 74,816; the records over the limit run whole and the band is gone. No cost in frame time (88.7 ms with two pieces, 87.6 with one).

What I can and cannot say for this tree

  • Compiled and linted on 4aa6e8c: both clippy runs of the CI give exactly the warnings main gives, none new. cargo test --workspace --locked: victory-shader passes with the extended group-base test, and a new WARP test runs a record of 70,000 groups in two pieces and in one. Failing and not from this change: xtask repository_passes_policy (two files under diagnostics/ on main are over the size limit) and one of two WARP tests in watch.rs / inplace.rs, a different one in each run.
  • Not run with the title on this base. Our tree clamps hoisted in the list prelude as well; that machinery is not brought along, so the code here is the same idea written against this tree's clamp, not a copy of what was measured.
  • The translator changes, so every shader is translated again on the next start.

🤖 Generated with Claude Code

**@⁠Steenax6** on GitHub · 2026-11-26 00:30 UTC · [original](https://github.com/fxceless/victory-fork/pull/1222) `Steenax6:pr/dispatch-pieces-indirect` → `main` · +615 −80 · 9 files · 2 commits · open ## What #976 (MoscaLosca, open) runs **direct** dispatches of more than 65,535 thread groups in pieces. This adds the **indirect** case, which is the one we hit, and one correction to the translated program. In the first room a band along the bottom of the picture held stale blocks, old tiles of earlier frames, in the scene target and in several history targets (it looks like HUD garbage; it is not HUD). A compute pass of the title's indirect lighting is run by an indirect record that asks for about 74,816 thread groups in x. A host dispatch runs 65,535, and the argument clamp cut the record there, so the last tiles of the list, the bottom of the screen, were never written. About 1.2 such records a frame. ## Commits 1. **#976 as it is**, cherry-picked onto 4aa6e8c with MoscaLosca as author (two conflicts, both "keep both sides"). This branch is stacked on it; if #976 is merged first this commit drops out. 2. **Ours:** - For a program that reads its group id, the argument clamp writes each indirect compute record `VICTORY_GROUP_PIECES` times (2 by default, at most 16), piece p holding `clamp(x - p * 65535, 0, 65535)` groups, and the execution is recorded once a piece with that piece's group base (`USER_GROUP_BASE`). No count is read back. All pieces of a record charge the list's budget as one. - The translated program adds the base to its **group id only**. In #976 it is added to the thread id in the group as well (both go through the same helper), so a program reading its thread id in the group reads it too large by the base in every piece after the first. - Still cut, and counted on the frame line: a record of a program that reads no group id, a record asking for more than all its pieces run, and everything with `VICTORY_GROUP_SPLIT=0`. - On this base only the clamp where the record runs needs it: a dispatch record is never served from a window and never gathered (`VICTORY_INDIRECT_GATHER=1`), so the gather pass gets one piece and is otherwise unchanged. ## Measured (in our tree, Steenax6/VIctory-NVID [ac7664d](https://github.com/Steenax6/VIctory-NVID/commit/ac7664d), RTX 4070 Ti) The largest count asked for is 74,816; the records over the limit run whole and the band is gone. No cost in frame time (88.7 ms with two pieces, 87.6 with one). ## What I can and cannot say for this tree - Compiled and linted on 4aa6e8c: both clippy runs of the CI give exactly the warnings `main` gives, none new. `cargo test --workspace --locked`: `victory-shader` passes with the extended group-base test, and a new WARP test runs a record of 70,000 groups in two pieces and in one. Failing and not from this change: `xtask` `repository_passes_policy` (two files under `diagnostics/` on `main` are over the size limit) and one of two WARP tests in `watch.rs` / `inplace.rs`, a different one in each run. - **Not run with the title on this base.** Our tree clamps hoisted in the list prelude as well; that machinery is not brought along, so the code here is the same idea written against this tree's clamp, not a copy of what was measured. - The translator changes, so every shader is translated again on the next start. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title asks some passes for more thread groups in x than the host
runs in one dispatch (65,535), and the groups after it were lost, or
the count itself went to the driver, which has no duty to survive it:

- Dispatch, DispatchX and DispatchMesh are run as pieces of at most
  65,535 groups, and the translated program adds the piece's first
  group to its group id (SV_DispatchThreadID and the mesh stage's group
  are built from the same op, so all of them move with it). The dword
  is one the host computes (USER_GROUP_BASE, an Other root kind after
  USER_VIEW_BIAS), bound at 0 by every bind and set again before each
  piece from the second on. VICTORY_GROUP_SPLIT=0 turns it off.
- A dispatch past the limit whose program reads no group id is clamped
  to 65,535 with a note (its ids cannot move), where before the whole
  count went to the driver.
- A group count that arrives in GPU memory (the indirect light pass's
  compute record of about 77,500 groups, run 200) is still clamped, now
  counted as well: the clamp notes the largest group count its compute
  records asked for (budget words 12 and 16, beside the mesh notes at 4
  and 8), and the frame line reports it, so the next run measures what
  the cut-off costs.

Built and unit-tested (the program that reads its group id is checked
to read the base with the split on and not with it off); not yet seen
in a run of the title.
On top of the commit before (pull request #976), which runs direct
dispatches of more than 65,535 groups in x in pieces and leaves a count
that arrives in GPU memory cut at 65,535.

What was seen: in the first room a band along the bottom of the picture
held stale blocks, old tiles of earlier frames, in the scene target and in
several history targets. A compute pass of the title's indirect lighting is
run by an indirect record that asks for about 74,816 thread groups in x; a
host dispatch runs 65,535, and the argument clamp cut the record there, so
the last tiles of the list, the bottom of the screen, were never written.
1.2 such records a frame.

- Indirect compute records: for a program that reads its group id, the
  argument clamp writes each record VICTORY_GROUP_PIECES times (2 by
  default, at most 16), the copies a record list apart in the scratch
  buffer, piece p holding clamp(x - p * 65,535, 0, 65,535) groups, and the
  execution is recorded once a piece with that piece's group base
  (USER_GROUP_BASE). No count is read back. All pieces of a record charge
  the list's budget as one: a record runs whole or not at all. A piece with
  no groups is an empty dispatch.
- Only the clamp where the record runs needs this here: a dispatch record
  is never served from a window and never gathered
  (VICTORY_INDIRECT_GATHER=1 gathers only what a window could hold), so the
  gather pass is given one piece and is otherwise unchanged.
- The translated program adds the base to its group id only. In the commit
  before it was added to the thread id in the group as well (both are read
  through the same helper), so a program that reads its thread id in the
  group read it too large by the base in every piece after the first.
- Still cut, and counted: a record of a program that reads no group id, a
  record that asks for more than all its pieces run, and everything with
  VICTORY_GROUP_SPLIT=0 (one piece, as before). The frame line reports the
  indirect compute records over 65,535 a frame, those over what their
  pieces run, the pieces after the first that ran groups, the executions
  recorded in pieces, and the direct dispatches split.
- The clamp's root constants go from 6 to 8 (the benchmark's old clamp gets
  the same root signature), and the budget buffer's notes from 4 words to 7.

Measured and looked at in another tree, not on this base
(Steenax6/VIctory-NVID, commit ac7664d, RTX 4070 Ti): the largest count
asked for is 74,816, the records over the limit run whole, the band is
gone, and no cost in frame time was measured (88.7 ms with two pieces, 87.6
with one). On this base it has been compiled, linted and unit-tested only
(a WARP test runs a record of 70,000 groups in two pieces and in one); it
has not been seen in a run of the title.

The translator changes, so every shader is translated again on the next
start.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:50 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/draw.rs
  • crates/victory-gpu/src/indirect.rs
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/mod.rs
  • crates/victory-shader/src/emit/shader.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/1222/head:github-bot/gh-1222'
git switch 'github-bot/gh-1222'

Merge

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