GPU, Shaders: direct dispatches past 65,535 groups in x run in parts #3084

Open
0xkn0wh3r3 wants to merge 3 commits from upstream-pr/3086 into main
0xkn0wh3r3 commented 2026-11-26 07:03:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T07:03:27Z.


What

The console runs more than 65,535 thread groups in x in one dispatch. D3D12 refuses more than D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, and State::dispatch passed the title's counts straight through.

A direct Dispatch with more than 65,535 groups in x now runs in parts of at most 65,535, with y and z as asked.

  • Shader side: a compute program's group x adds a user-data dword that the host fills itself, RootType::Other(GROUP_BASE), placed past the console's user data. It holds the first group of the part being run, and is 0 as bound.
  • Host side: State::dispatch sets that dword to each part's first group (dispatch_parts), then back to 0 afterwards.
  • A program that doesn't read its group x gets no such dword. It runs alike in every part, so splitting it needs nothing more.
  • Groups past 65,535 in y or z are still passed through, now with a warning.
  • Translations of programs that read their group x change. The shader cache key already hashes the translator's sources (victory_shader::SOURCE_HASH), so old entries aren't found and the cache magic stays VSH1.

Relation to #2312 and #2841

  • #2312 spreads x across z, but only when z == 1, and it also covers indirect dispatches. This PR covers direct dispatches of any y and z, including z > 1, which #2312 leaves out. This PR doesn't touch indirect dispatches.
  • If #2312 lands first, either rule can take z == 1. I'll rebase to whichever you prefer. Both claim the first user-data dword past the console's, so the second to land moves its word by one.
  • #2841 refuses requests over 65,535 per axis, so it doesn't overlap.

Where it came from

From DexNom's fork, DexNom/VIctory@570a941: USER_GROUP_BASE added to the group id, and the direct dispatch run in parts. Here it's on this tree's user-data model. DexNom applied it only to programs that read neither group y nor group z. Adding the base to group x is right whatever else the program reads, so this PR applies it to every compute program that reads group x. Credited with Co-authored-by: DexNom.

Tested

  • emit::semantics_tests::group_x_starts_at_the_dispatch_part: a translated program run with base 1, on the hardware adapter and on WARP, reads its input and writes its output as group 1. Group 0's output stays untouched. It fails without the change (no base dword).
  • draw::tests::large_dispatches_run_in_parts: 0, 100, 65,535, 65,536, 115,200 and u32::MAX groups each split into parts of at most 65,535 that cover every group once.
  • cargo test -p victory-gpu --lib: 231 passed. The 2 failures are the ones #2121 fixes; they fail the same on main.
  • cargo test -p victory-shader --lib (skipping heap_direct_texture_reads_mark_their_heap_index, which crashes on main): 297 passed and 5 failed. All 5 fail the same on main: the 2 stride_tests, gathers_at_a_level_match_the_hardware, rectangles_get_their_fourth_corner and elements_sharing_a_row_keep_their_order.
  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings, and victory-gpu with --features diagnostics: clean.

Not tested

  • Not run with the title. DexNom's fork shows a 115,200 × 1 × 1 dispatch; I haven't seen one with z > 1 in a title.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6621372456 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T07:03:27Z. --- ## What The console runs more than 65,535 thread groups in x in one dispatch. D3D12 refuses more than `D3D12_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION`, and `State::dispatch` passed the title's counts straight through. A direct `Dispatch` with more than 65,535 groups in x now runs in parts of at most 65,535, with y and z as asked. - **Shader side:** a compute program's group x adds a user-data dword that the host fills itself, `RootType::Other(GROUP_BASE)`, placed past the console's user data. It holds the first group of the part being run, and is 0 as bound. - **Host side:** `State::dispatch` sets that dword to each part's first group (`dispatch_parts`), then back to 0 afterwards. - A program that doesn't read its group x gets no such dword. It runs alike in every part, so splitting it needs nothing more. - Groups past 65,535 in y or z are still passed through, now with a warning. - Translations of programs that read their group x change. The shader cache key already hashes the translator's sources (`victory_shader::SOURCE_HASH`), so old entries aren't found and the cache magic stays `VSH1`. ## Relation to #2312 and #2841 - **#2312** spreads x across z, but only when z == 1, and it also covers indirect dispatches. This PR covers direct dispatches of any y and z, including z > 1, which #2312 leaves out. This PR doesn't touch indirect dispatches. - If #2312 lands first, either rule can take z == 1. I'll rebase to whichever you prefer. Both claim the first user-data dword past the console's, so the second to land moves its word by one. - **#2841** refuses requests over 65,535 per axis, so it doesn't overlap. ## Where it came from From DexNom's fork, [DexNom/VIctory@570a941](https://github.com/DexNom/VIctory/commit/570a941e9b4e945121c26eb30dfc10c126845207): `USER_GROUP_BASE` added to the group id, and the direct dispatch run in parts. Here it's on this tree's user-data model. DexNom applied it only to programs that read neither group y nor group z. Adding the base to group x is right whatever else the program reads, so this PR applies it to every compute program that reads group x. Credited with `Co-authored-by: DexNom`. ## Tested - `emit::semantics_tests::group_x_starts_at_the_dispatch_part`: a translated program run with base 1, on the hardware adapter and on WARP, reads its input and writes its output as group 1. Group 0's output stays untouched. It fails without the change (no base dword). - `draw::tests::large_dispatches_run_in_parts`: 0, 100, 65,535, 65,536, 115,200 and `u32::MAX` groups each split into parts of at most 65,535 that cover every group once. - `cargo test -p victory-gpu --lib`: 231 passed. The 2 failures are the ones #2121 fixes; they fail the same on main. - `cargo test -p victory-shader --lib` (skipping `heap_direct_texture_reads_mark_their_heap_index`, which crashes on main): 297 passed and 5 failed. All 5 fail the same on main: the 2 `stride_tests`, `gathers_at_a_level_match_the_hardware`, `rectangles_get_their_fourth_corner` and `elements_sharing_a_row_keep_their_order`. - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings`, and `victory-gpu` with `--features diagnostics`: clean. ## Not tested - Not run with the title. DexNom's fork shows a 115,200 × 1 × 1 dispatch; I haven't seen one with z > 1 in a title.
Dukestar69 commented 2026-11-26 07:07:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T07:07:13Z.

Review: APPROVED


Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP + dxil.dll):

  • cargo test -p victory-shader group_x_starts_at_the_dispatch_part -- --test-threads=1 (RTX 5090 & WARP): 1 passed, 0 failed on both.
  • cargo test -p victory-gpu draw::tests -- --test-threads=1 (RTX 5090): 21 passed, 0 failed (including large_dispatches_run_in_parts).
  • cargo test -p victory-gpu shader_cache::tests: 4 passed, 0 failed.
  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6069840688 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086#pullrequestreview-6069840688). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T07:07:13Z. **Review:** APPROVED --- Tested locally merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP + `dxil.dll`): - `cargo test -p victory-shader group_x_starts_at_the_dispatch_part -- --test-threads=1` (RTX 5090 & WARP): 1 passed, 0 failed on both. - `cargo test -p victory-gpu draw::tests -- --test-threads=1` (RTX 5090): 21 passed, 0 failed (including `large_dispatches_run_in_parts`). - `cargo test -p victory-gpu shader_cache::tests`: 4 passed, 0 failed. - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-26 08:00:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T08:00:08Z.

Review: COMMENTED


Tested locally on Windows 11 x64 (rustc 1.98.1, NVIDIA GeForce RTX 5090 + WARP + SDK dxil.dll):

  • cargo clippy -p victory-shader -p victory-gpu --all-targets --locked -- -D warnings (default and --all-features): clean.
  • cargo test -p victory-shader --lib --locked -- emit::semantics_tests --test-threads=1: 35 passed, 0 failed, 1 ignored (group_x_starts_at_the_dispatch_part verified on both RTX 5090 and WARP).
  • cargo test -p victory-gpu --lib --locked -- draw::tests --test-threads=1: 21 passed, 0 failed on both RTX 5090 and WARP (--features diagnostics, VICTORY_D3D12_WARP=1).
  • cargo test -p victory-gpu --lib --locked -- shader_cache::tests --test-threads=1: 4 passed, 0 failed on both RTX 5090 and WARP.
  • cargo xtask policy: 191 files ok.

The lowering and split logic look solid: lower.rs does not emit SV_DispatchThreadID (threadId.i32), so offsetting Input::GroupId(0) shifts derived global IDs consistently; index = max(p.user_data + p.sgprs) avoids collisions with ROOT_SRV_VIEW/ROOT_UAV_VIEW/ROOT_VIEW_OFFSET; and dispatch_parts handles 0..=u32::MAX without overflow.

One small diagnostics bug to fix in crates/victory-gpu/src/draw.rs (op_text, under #[cfg(feature = "diagnostics")]):

  • State::bind special-cases RootType::Other(victory_shader::emit::GROUP_BASE) => 0, but op_text iterates t.host.user_data.iter().filter(|u| !is_root_view(u)) and calls self.user_value(compute, u.slot, u.root, u.dword). For any compute shader reading GroupId(0), that hits user_value's fallback _ => arm, logging a spurious "a shader reads a root argument the title did not set" warning (slot = 0, root = Other(260)) and printing a bogus [heap 0: ...] lookup in op_text. Filtering out u.root == RootType::Other(victory_shader::emit::GROUP_BASE) alongside !is_root_view(u) avoids this.

Minor non-blocking note:

  • Bumping MAGIC from VSH1 to VSH2 in crates/victory-gpu/src/shader_cache.rs is not strictly needed: the binary encoding didn't change (root_code/root_type already round-trip RootType::Other(0x104)), and shader_cache::build() already hashes victory_shader::SOURCE_HASH into both the cache subdirectory and key. Keeping VSH1 would avoid an unnecessary merge conflict with other PRs touching shader_cache.rs (such as #2948).
<!-- greyfinch-sync:Marvisak/VIctory:review:6070370697 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086#pullrequestreview-6070370697). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T08:00:08Z. **Review:** COMMENTED --- Tested locally on Windows 11 x64 (`rustc 1.98.1`, NVIDIA GeForce RTX 5090 + WARP + SDK `dxil.dll`): - `cargo clippy -p victory-shader -p victory-gpu --all-targets --locked -- -D warnings` (default and `--all-features`): clean. - `cargo test -p victory-shader --lib --locked -- emit::semantics_tests --test-threads=1`: 35 passed, 0 failed, 1 ignored (`group_x_starts_at_the_dispatch_part` verified on both RTX 5090 and WARP). - `cargo test -p victory-gpu --lib --locked -- draw::tests --test-threads=1`: 21 passed, 0 failed on both RTX 5090 and WARP (`--features diagnostics`, `VICTORY_D3D12_WARP=1`). - `cargo test -p victory-gpu --lib --locked -- shader_cache::tests --test-threads=1`: 4 passed, 0 failed on both RTX 5090 and WARP. - `cargo xtask policy`: 191 files ok. The lowering and split logic look solid: `lower.rs` does not emit `SV_DispatchThreadID` (`threadId.i32`), so offsetting `Input::GroupId(0)` shifts derived global IDs consistently; `index = max(p.user_data + p.sgprs)` avoids collisions with `ROOT_SRV_VIEW`/`ROOT_UAV_VIEW`/`ROOT_VIEW_OFFSET`; and `dispatch_parts` handles `0..=u32::MAX` without overflow. One small diagnostics bug to fix in `crates/victory-gpu/src/draw.rs` (`op_text`, under `#[cfg(feature = "diagnostics")]`): - `State::bind` special-cases `RootType::Other(victory_shader::emit::GROUP_BASE) => 0`, but `op_text` iterates `t.host.user_data.iter().filter(|u| !is_root_view(u))` and calls `self.user_value(compute, u.slot, u.root, u.dword)`. For any compute shader reading `GroupId(0)`, that hits `user_value`'s fallback `_ =>` arm, logging a spurious `"a shader reads a root argument the title did not set"` warning (`slot = 0, root = Other(260)`) and printing a bogus `[heap 0: ...]` lookup in `op_text`. Filtering out `u.root == RootType::Other(victory_shader::emit::GROUP_BASE)` alongside `!is_root_view(u)` avoids this. Minor non-blocking note: - Bumping `MAGIC` from `VSH1` to `VSH2` in `crates/victory-gpu/src/shader_cache.rs` is not strictly needed: the binary encoding didn't change (`root_code`/`root_type` already round-trip `RootType::Other(0x104)`), and `shader_cache::build()` already hashes `victory_shader::SOURCE_HASH` into both the cache subdirectory and key. Keeping `VSH1` would avoid an unnecessary merge conflict with other PRs touching `shader_cache.rs` (such as #2948).
oni-swr commented 2026-11-26 08:03:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T07:27:16Z.


Independent WARP verification of this PR at exact head 44375c12 (parent 63bcca4, main). Claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7185324542

Setup. Windows 11, WARP only; the physical GPU was never used. VICTORY_WARP=1 (this is what makes the shader test host's Host::new(false) pick WARP too) and VICTORY_D3D12_WARP=1 (read by victory-gpu only with --features diagnostics, which I built with). The test device was confirmed from its LUID: Microsoft Basic Render Driver, DXGI_ADAPTER_FLAG_SOFTWARE set, vendor 0x1414, 0 dedicated VRAM. Shaders were validated with the Windows SDK dxil.dll (10.0.26100.0). cargo -j 4.

Boundary / group-ID check (local harness, not part of the PR: it lowers the same synthetic program as group_x_starts_at_the_dispatch_part, with unique input dwords, and runs it the way State::dispatch does: dispatch_parts split, GROUP_BASE = each part's first group). Per part it checks that the groups of that part hold exactly their own input, and that every other group is untouched.

x × y × z PR head exact parent (same harness, no GROUP_BASE dword)
1, 64, 65,534, 65,535 × 1 × 1 0 wrong lanes 0 wrong lanes (identical)
65,536 / 65,537 × 1 × 1 0 wrong 64 / 128 wrong lanes (part 2 re-runs group 0 onward)
131,070 / 131,071 × 1 × 1 0 wrong 4,194,240 / 4,194,304 wrong lanes
3×4×2, 65,536×2×3, 1×65,535×1, 1×1×65,535 0 wrong same as above for the x split; 0 wrong where x ≤ 65,535

PR head: 0 mismatches in all 12 cases (parts of at most 65,535 covering every x group once). The parent is the control: the same split without a base word gives the wrong group ids for every part after the first, so the check does tell the two apart. Dispatches of 65,535 in y or z and x=65,536 with y=2, z=3 ran and matched (the shader keys on group x only, so the y/z groups write the same values; this covers that y/z are passed through with the parts, not that y/z are numbered).

Focused suites on the PR head (all WARP):

  • cargo test -p victory-gpu --lib --features diagnostics -- draw::tests::large_dispatches_run_in_parts shader_cache: 5 passed (includes the VSH2 cache entries).
  • cargo test -p victory-shader --lib -- emit::semantics_tests --test-threads=1: 35 passed, 1 ignored (existing defect_ ignore), includes group_x_starts_at_the_dispatch_part. Both of its adapter iterations ran on WARP here.
  • emit::flow_tests, memory_tests, crosslane_tests, waterfall_tests, valu_tests: 51 passed.

Limitations. Synthetic inputs only; no game files, shader names, hashes, dumps or retail artifacts. WARP only, so nothing here speaks for GPU drivers. Not tested: y or z over 65,535 (D3D12 refuses it, and I did not send it to the device), indirect dispatches, the real State::dispatch command-list path (I replicated its split and base writes in the harness; dispatch_parts itself is covered by the PR's unit test), and the SetComputeRoot32BitConstant reset back to 0 for a following dispatch. The full victory-gpu and victory-shader suites were not run, so the PR's stated pre-existing failures were neither confirmed nor refuted.

The harness stayed local and the PR was not touched.

AI use: Claude Code (Claude Sonnet 5.5), coordinated by Codex (gpt-6.2-sol).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7185474577 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086#issuecomment-7185474577). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T07:27:16Z. --- Independent WARP verification of this PR at exact head 44375c12 (parent 63bcca4, `main`). Claim: https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7185324542 **Setup.** Windows 11, WARP only; the physical GPU was never used. `VICTORY_WARP=1` (this is what makes the shader test host's `Host::new(false)` pick WARP too) and `VICTORY_D3D12_WARP=1` (read by victory-gpu only with `--features diagnostics`, which I built with). The test device was confirmed from its LUID: `Microsoft Basic Render Driver`, `DXGI_ADAPTER_FLAG_SOFTWARE` set, vendor 0x1414, 0 dedicated VRAM. Shaders were validated with the Windows SDK `dxil.dll` (10.0.26100.0). `cargo -j 4`. **Boundary / group-ID check** (local harness, not part of the PR: it lowers the same synthetic program as `group_x_starts_at_the_dispatch_part`, with unique input dwords, and runs it the way `State::dispatch` does: `dispatch_parts` split, `GROUP_BASE` = each part's first group). Per part it checks that the groups of that part hold exactly their own input, and that every other group is untouched. | x × y × z | PR head | exact parent (same harness, no `GROUP_BASE` dword) | |---|---|---| | 1, 64, 65,534, 65,535 × 1 × 1 | 0 wrong lanes | 0 wrong lanes (identical) | | 65,536 / 65,537 × 1 × 1 | 0 wrong | 64 / 128 wrong lanes (part 2 re-runs group 0 onward) | | 131,070 / 131,071 × 1 × 1 | 0 wrong | 4,194,240 / 4,194,304 wrong lanes | | 3×4×2, 65,536×2×3, 1×65,535×1, 1×1×65,535 | 0 wrong | same as above for the x split; 0 wrong where x ≤ 65,535 | PR head: 0 mismatches in all 12 cases (parts of at most 65,535 covering every x group once). The parent is the control: the same split without a base word gives the wrong group ids for every part after the first, so the check does tell the two apart. Dispatches of 65,535 in y or z and x=65,536 with y=2, z=3 ran and matched (the shader keys on group x only, so the y/z groups write the same values; this covers that y/z are passed through with the parts, not that y/z are numbered). **Focused suites on the PR head (all WARP):** - `cargo test -p victory-gpu --lib --features diagnostics -- draw::tests::large_dispatches_run_in_parts shader_cache`: 5 passed (includes the `VSH2` cache entries). - `cargo test -p victory-shader --lib -- emit::semantics_tests --test-threads=1`: 35 passed, 1 ignored (existing `defect_` ignore), includes `group_x_starts_at_the_dispatch_part`. Both of its adapter iterations ran on WARP here. - `emit::flow_tests`, `memory_tests`, `crosslane_tests`, `waterfall_tests`, `valu_tests`: 51 passed. **Limitations.** Synthetic inputs only; no game files, shader names, hashes, dumps or retail artifacts. WARP only, so nothing here speaks for GPU drivers. Not tested: y or z over 65,535 (D3D12 refuses it, and I did not send it to the device), indirect dispatches, the real `State::dispatch` command-list path (I replicated its split and base writes in the harness; `dispatch_parts` itself is covered by the PR's unit test), and the `SetComputeRoot32BitConstant` reset back to 0 for a following dispatch. The full `victory-gpu` and `victory-shader` suites were not run, so the PR's stated pre-existing failures were neither confirmed nor refuted. The harness stayed local and the PR was not touched. AI use: Claude Code (Claude Sonnet 5.5), coordinated by Codex (gpt-6.2-sol).
fuzeofficlal commented 2026-11-26 08:29:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T08:29:39Z.

Review: APPROVED


Both points from the earlier review are cleanly addressed in e4fa1a1b (and the doc comment placement cleanup in 2fd63f00 looks good):

  • op_text in crates/victory-gpu/src/draw.rs now filters out RootType::Other(victory_shader::emit::GROUP_BASE), avoiding spurious missing-root-argument warnings and bogus heap lookups in diagnostics logs.
  • crates/victory-gpu/src/shader_cache.rs is left untouched on VSH1, relying on victory_shader::SOURCE_HASH for cache invalidation without colliding with other cache format work.

Verified locally on Windows 11 (RTX 5090 + WARP):

  • cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean
  • victory-shader emit::semantics_tests::group_x_starts_at_the_dispatch_part: passed (both hardware and WARP paths)
  • victory-gpu draw::tests (21/21 on RTX 5090, 21/21 on WARP with --features diagnostics) and shader_cache::tests (4/4): all passed
  • cargo xtask policy: 191 files ok

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6070711397 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086#pullrequestreview-6070711397). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T08:29:39Z. **Review:** APPROVED --- Both points from the earlier review are cleanly addressed in `e4fa1a1b` (and the doc comment placement cleanup in `2fd63f00` looks good): - `op_text` in `crates/victory-gpu/src/draw.rs` now filters out `RootType::Other(victory_shader::emit::GROUP_BASE)`, avoiding spurious missing-root-argument warnings and bogus heap lookups in diagnostics logs. - `crates/victory-gpu/src/shader_cache.rs` is left untouched on `VSH1`, relying on `victory_shader::SOURCE_HASH` for cache invalidation without colliding with other cache format work. Verified locally on Windows 11 (RTX 5090 + WARP): - `cargo clippy -p victory-shader -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean - `victory-shader` `emit::semantics_tests::group_x_starts_at_the_dispatch_part`: passed (both hardware and WARP paths) - `victory-gpu` `draw::tests` (21/21 on RTX 5090, 21/21 on WARP with `--features diagnostics`) and `shader_cache::tests` (4/4): all passed - `cargo xtask policy`: 191 files ok LGTM.
0xkn0wh3r3 commented 2026-11-26 09:06:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T08:03:56Z.


Thanks, both taken in e4fa1a1b. op_text now skips the GROUP_BASE root alongside root views, so a compute program that reads its group x no longer logs a spurious unset root argument or a heap lookup for it. The cache magic is back to VSH1: build() already hashes victory_shader::SOURCE_HASH (and the encoding file's own text) into the key, so old entries aren't found anyway. That also removes the VSH2 overlap with #2948. draw::tests and shader_cache pass with and without --features diagnostics, and clippy is clean both ways.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7186144049 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086#issuecomment-7186144049). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T08:03:56Z. --- Thanks, both taken in e4fa1a1b. `op_text` now skips the `GROUP_BASE` root alongside root views, so a compute program that reads its group x no longer logs a spurious unset root argument or a heap lookup for it. The cache magic is back to `VSH1`: `build()` already hashes `victory_shader::SOURCE_HASH` (and the encoding file's own text) into the key, so old entries aren't found anyway. That also removes the `VSH2` overlap with #2948. `draw::tests` and `shader_cache` pass with and without `--features diagnostics`, and clippy is clean both ways.
Marvisak commented 2026-11-26 09:06:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T08:21:07Z.


Automated triage for the maintainers.

Needs work (small). The approach looks right. State::dispatch splits a direct dispatch with more than 65,535 groups in x into parts (dispatch_parts). Each part's first group goes into a host-filled root constant (RootType::Other(GROUP_BASE)), which is bound as 0 in the user-data loop and reset to 0 after the parts. In emit/lower.rs, group_x adds that constant to group x for CS programs only. The unit test and the semantics test cover the split and the base.

Needed before merge:

  • In emit/lower.rs, group_x was inserted between compute_id and its doc comment. group_x's doc now begins with "A component of a compute thread or group id, read in the entry block." and compute_id has no doc. Please move that line back above fn compute_id.
  • This overlaps #2312 (spreading x across z, which also covers indirect dispatches and claims the same first user-data dword past the console's). Needs the maintainer's decision on which approach lands. The other one then needs a rebase.

CI: passing (check).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7186488920 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086#issuecomment-7186488920). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T08:21:07Z. --- <!-- victory-triage v1 head=e4fa1a1b03997b181285a45c51da0b817c592fd2 verdict=needs-work at=2026-11-26T08:17:59Z --> Automated triage for the maintainers. **Needs work (small).** The approach looks right. `State::dispatch` splits a direct dispatch with more than 65,535 groups in x into parts (`dispatch_parts`). Each part's first group goes into a host-filled root constant (`RootType::Other(GROUP_BASE)`), which is bound as 0 in the user-data loop and reset to 0 after the parts. In `emit/lower.rs`, `group_x` adds that constant to group x for CS programs only. The unit test and the semantics test cover the split and the base. Needed before merge: - In `emit/lower.rs`, `group_x` was inserted between `compute_id` and its doc comment. `group_x`'s doc now begins with "A component of a compute thread or group id, read in the entry block." and `compute_id` has no doc. Please move that line back above `fn compute_id`. - This overlaps #2312 (spreading x across z, which also covers indirect dispatches and claims the same first user-data dword past the console's). **Needs the maintainer's decision** on which approach lands. The other one then needs a rebase. CI: passing (check). --- _Generated by [Claude Code](https://claude.ai/code)_
0xkn0wh3r3 commented 2026-11-26 09:06:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-26T08:23:42Z.


Fixed in 2fd63f00: the doc line is back above fn compute_id, and group_x keeps only its own doc. On #2312: agreed, that's your call. Both claim the first user-data dword past the console's, so whichever lands second moves its word by one, and I'll rebase this onto #2312 if you take that one. The difference is that this PR covers direct dispatches with any y and z (including z > 1, which #2312 leaves out), while #2312 also covers indirect dispatches.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7186540869 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086#issuecomment-7186540869). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-26T08:23:42Z. --- Fixed in 2fd63f00: the doc line is back above `fn compute_id`, and `group_x` keeps only its own doc. On #2312: agreed, that's your call. Both claim the first user-data dword past the console's, so whichever lands second moves its word by one, and I'll rebase this onto #2312 if you take that one. The difference is that this PR covers direct dispatches with any y and z (including z > 1, which #2312 leaves out), while #2312 also covers indirect dispatches.
Jackster commented 2026-11-26 16:06:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T16:06:38Z.


AMD check on a Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010):

  • emit::semantics_tests::group_x_starts_at_the_dispatch_part passes on the hardware adapter (victory-shader with --features host).
  • draw::tests::large_dispatches_run_in_parts passes.
  • The test-only control does not compile on 63bcca4 (GROUP_BASE is added by this PR), so the "fails before" claim is not separable here.

Synthetic only. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7197194272 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3086#issuecomment-7197194272). Originally posted by [Jackster](https://github.com/Jackster) on 2026-11-26T16:06:38Z. --- AMD check on a Radeon RX 7900 XTX (gfx1100, 32.0.32029.2010): - `emit::semantics_tests::group_x_starts_at_the_dispatch_part` passes on the hardware adapter (`victory-shader` with `--features host`). - `draw::tests::large_dispatches_run_in_parts` passes. - The test-only control does not compile on 63bcca4 (`GROUP_BASE` is added by this PR), so the "fails before" claim is not separable here. Synthetic only. AI-assisted.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3086:upstream-pr/3086'
git switch 'upstream-pr/3086'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3086'
git switch 'upstream-pr/3086'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3086'
git switch 'upstream-pr/3086'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3086'
git switch 'main'
git merge --squash 'upstream-pr/3086'
git switch 'main'
git merge --ff-only 'upstream-pr/3086'
git switch 'main'
git merge 'upstream-pr/3086'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!3084
No description provided.