GPU: split compute dispatches past 65,535 groups in x #3098

Closed
neonbyte1 wants to merge 4 commits from upstream-pr/3100 into main
neonbyte1 commented 2026-11-26 08:02:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T08:02:06Z.


D3D12 allows at most 65,535 thread groups per dimension per dispatch, and the indirect clamp cuts larger counts to that. GTA VI asks for more. indirect_diffuse_lighting:CS_FinalGather (2dc364df5d3278b8) dispatches 74,192 to 83,008 groups in x depending on the view, 8 per screen tile. With the clamp, about 1,000 tiles at the end were never gathered. The bottom rows of the lit picture showed stale tile content from earlier frames, a band of coloured blocks along the bottom edge.

Stacked on #2969 (this extends its Wine-compilable clamp) and #3097 (lower.rs tests in their own file, for room under the 512 KiB limit). Please review from GPU: split compute dispatches past 65,535 groups in x on.

What changes:

  • Translator. A compute shader that reads TGID x adds a group-id base: one dword in b0 of register space 3 (GROUP_BASE_SPACE), loaded once in the entry block. Mesh shaders, y and z are unchanged.
  • Direct dispatch. For such a pipeline, the host sets the base as a root constant and dispatches at most 65,535 groups at a time. Pipelines whose shaders don't read TGID x dispatch as before.
  • Indirect dispatch. The clamp expands each dispatch record into 17 records of {base, x, y, z}. 17 × 65,535 covers the clamp's 2^20 limit. They execute through a command signature [CONSTANT base, DISPATCH] made for the pipeline's root signature, with the title's count multiplied by 17. Empty chunks dispatch nothing.

Census over the title's shader pack (VICTORY_EMIT_DUMP, byte comparison of every emitted program, before and after on this branch):

Stage Programs DXIL changed
Compute 2,658 2,532 (those reading TGID x)
Pixel 12,055 0
Mesh 8,765 0
Vertex 2,191 0

The same programs fail to translate before and after (227).

In game (Linux: GE-Proton11-14 Wine, vkd3d-proton, RTX 5090 driver 620.73.04; prison yard, frames 1450–1700). I measured the share of bright blocky pixels in the bottom 4% of the frame:

Build Bottom-edge blocks
before 16.6% at frame 1500
clamp lifted to 2^20 groups (diagnostic only, not valid D3D12) 0%, 2 runs
this PR 0% in all 11 captured frames, 3 runs

The diagnostic switch only confirmed the cause. It isn't something to ship: NVIDIA's Vulkan driver happens to accept more than 65,535 groups, but D3D12 drivers needn't.

With the fix, the lit yard looks the same as with the cap lifted. There was no device removal or Xid in any run.

Tests, under cargo xtask wine-test (#1218) on the same machine: indirect 8/8 and the new tests below. cargo clippy --workspace --all-targets (with and without diagnostics) and cargo xtask policy are clean.

  • chunked_dispatch_records_hold_every_word: [140000, 1, 1] becomes bases 0, 65,535 and 131,070 with x 65,535, 65,535 and 8,930, then 14 empty chunks, count 17.
  • group_base_covers_a_dispatch_past_the_host_limit: 70,000 groups, direct and through ExecuteIndirect. Every one of the 70,000 output words is written once.
  • A lowering test that only compute TGID x gets the base.

Limits:

  • The GPU test dispatches an HLSL shader that binds the base the way the translator does, not a translated GFX10 program. The translator side is covered by the lowering test and the census.
  • I have no Windows machine. The changed root signatures (one more root constant for those compute pipelines) haven't been run on a native D3D12 driver.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6622185602 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3100). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-26T08:02:06Z. --- D3D12 allows at most 65,535 thread groups per dimension per dispatch, and the indirect clamp cuts larger counts to that. GTA VI asks for more. `indirect_diffuse_lighting:CS_FinalGather` (`2dc364df5d3278b8`) dispatches 74,192 to 83,008 groups in x depending on the view, 8 per screen tile. With the clamp, about 1,000 tiles at the end were never gathered. The bottom rows of the lit picture showed stale tile content from earlier frames, a band of coloured blocks along the bottom edge. **Stacked on #2969** (this extends its Wine-compilable clamp) **and #3097** (`lower.rs` tests in their own file, for room under the 512 KiB limit). Please review from `GPU: split compute dispatches past 65,535 groups in x` on. **What changes:** - **Translator.** A compute shader that reads TGID x adds a group-id base: one dword in `b0` of register space 3 (`GROUP_BASE_SPACE`), loaded once in the entry block. Mesh shaders, y and z are unchanged. - **Direct dispatch.** For such a pipeline, the host sets the base as a root constant and dispatches at most 65,535 groups at a time. Pipelines whose shaders don't read TGID x dispatch as before. - **Indirect dispatch.** The clamp expands each dispatch record into 17 records of `{base, x, y, z}`. 17 × 65,535 covers the clamp's 2^20 limit. They execute through a command signature `[CONSTANT base, DISPATCH]` made for the pipeline's root signature, with the title's count multiplied by 17. Empty chunks dispatch nothing. **Census** over the title's shader pack (`VICTORY_EMIT_DUMP`, byte comparison of every emitted program, before and after on this branch): | Stage | Programs | DXIL changed | |---|---|---| | Compute | 2,658 | 2,532 (those reading TGID x) | | Pixel | 12,055 | 0 | | Mesh | 8,765 | 0 | | Vertex | 2,191 | 0 | The same programs fail to translate before and after (227). **In game** (Linux: GE-Proton11-14 Wine, vkd3d-proton, RTX 5090 driver 620.73.04; prison yard, frames 1450–1700). I measured the share of bright blocky pixels in the bottom 4% of the frame: | Build | Bottom-edge blocks | |---|---| | before | 16.6% at frame 1500 | | clamp lifted to 2^20 groups (diagnostic only, not valid D3D12) | 0%, 2 runs | | this PR | 0% in all 11 captured frames, 3 runs | The diagnostic switch only confirmed the cause. It isn't something to ship: NVIDIA's Vulkan driver happens to accept more than 65,535 groups, but D3D12 drivers needn't. With the fix, the lit yard looks the same as with the cap lifted. There was no device removal or Xid in any run. **Tests**, under `cargo xtask wine-test` (#1218) on the same machine: `indirect` 8/8 and the new tests below. `cargo clippy --workspace --all-targets` (with and without `diagnostics`) and `cargo xtask policy` are clean. - `chunked_dispatch_records_hold_every_word`: `[140000, 1, 1]` becomes bases 0, 65,535 and 131,070 with x 65,535, 65,535 and 8,930, then 14 empty chunks, count 17. - `group_base_covers_a_dispatch_past_the_host_limit`: 70,000 groups, direct and through `ExecuteIndirect`. Every one of the 70,000 output words is written once. - A lowering test that only compute TGID x gets the base. **Limits:** - The GPU test dispatches an HLSL shader that binds the base the way the translator does, not a translated GFX10 program. The translator side is covered by the lowering test and the census. - I have no Windows machine. The changed root signatures (one more root constant for those compute pipelines) haven't been run on a native D3D12 driver. _AI-assisted (Claude); measured on my machine, no game data shared._
Dukestar69 commented 2026-11-26 09:05:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T08:10:12Z.

Review: APPROVED


Verified on RTX 5090 & WARP against origin/main (63bcca4):

  • cargo test -p victory-gpu --lib draw:: -- --test-threads=1: 21/21 passed on RTX 5090 (including group_base_covers_a_dispatch_past_the_host_limit, also passed under VICTORY_WARP=1).
  • cargo test -p victory-gpu --lib indirect:: -- --test-threads=1: 8/8 passed on RTX 5090 (including chunked_dispatch_records_hold_every_word).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings & cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 193 files ok.

Cleanly splits compute dispatches past the D3D12 65,535 x group limit via a root constant group base for both direct and indirect dispatches.

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

<!-- greyfinch-sync:Marvisak/VIctory:review:6070481570 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3100#pullrequestreview-6070481570). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T08:10:12Z. **Review:** APPROVED --- Verified on RTX 5090 & WARP against `origin/main` (`63bcca4`): - `cargo test -p victory-gpu --lib draw:: -- --test-threads=1`: 21/21 passed on RTX 5090 (including `group_base_covers_a_dispatch_past_the_host_limit`, also passed under `VICTORY_WARP=1`). - `cargo test -p victory-gpu --lib indirect:: -- --test-threads=1`: 8/8 passed on RTX 5090 (including `chunked_dispatch_records_hold_every_word`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings` & `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 193 files ok. Cleanly splits compute dispatches past the D3D12 65,535 `x` group limit via a root constant group base for both direct and indirect dispatches. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-26 09:05:52 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Covering ExecuteIndirect for compute dispatches past 65,535 groups in x is genuinely useful (building beyond #3086, which handles direct dispatches), and the clamp + [CONSTANT, DISPATCH] command-signature idea is the right direction. However, reviewing 6d3848e0 line by line and testing natively on Windows 11 (RTX 5090, WARP, and Windows SDK fxc.exe) turned up several blocking bugs, including a silently skipped test:

1. Accidental deletion of || self.memory.is_some() in DXIL emission (crates/victory-shader/src/emit/shader.rs:630-633)

Replacing || self.memory.is_some() with || self.group_base.is_some() omits the entire !dx.resources emission for any shader whose only resource is read-only title memory (self.memory.is_some(), e.g., a VS/PS/MS or a CS that does not read TGID x and has no user data/samplers/root views/view marks). Please keep || self.memory.is_some() alongside || self.group_base.is_some().

2. Counted ExecuteIndirect still passes the unmultiplied title count buffer (crates/victory-gpu/src/draw.rs:1853-1879)

In draw.rs, indirect::bound writes min(counts[0], records) * 17 into clamped at host_stride * host_max, and the #[cfg(feature = "diagnostics")] read_indirect block reads that multiplied count — but the ExecuteIndirect call right above it still passes the original title count buffer:

list.list.ExecuteIndirect(
    &signature,
    host_max,
    &clamped,
    0,
    counter.as_ref().map(|(s, _)| &s.buffer),
    counter.as_ref().map_or(0, |(s, at)| s.offset(*at)),
)

For any counted indirect compute dispatch (e.g. title count = 1, x = 80,000), ExecuteIndirect reads count 1 instead of 17 and drops chunks 1..16.
Also, in the diagnostics block below it, if chunked { Some((&clamped, ...)) } passes Some even when counter is None (where count_word was false and nothing was allocated/written at that offset). Both ExecuteIndirect and read_indirect should use Some((&clamped, u64::from(host_stride) * u64::from(host_max))) if and only if chunked && counter.is_some().

3. 17x buffer under-allocation in indirect::bound (crates/victory-gpu/src/indirect.rs:676-679)

let host_stride = if chunked { 16 } else { stride };
let words = (host_stride / 4) as u64 * u64::from(records.max(1));
let count_word = chunked && count.is_some();
let out = list.arguments(4 * (words + u64::from(count_word)))?;

words multiplies by records instead of records * 17 when chunked (kind == 3), even though the clamp shader writes records * 17 * 4 words plus the count word at index records * 17 * 4. Small counts (records <= 240) happen to be masked by list.arguments's 64 KiB floor, but any records > 240 overflows the UAV buffer on the GPU.

4. Three logic bugs in the kind == 3 clamp HLSL (crates/victory-gpu/src/indirect.rs:520-594)

  • Accepted chunked dispatches never deduct from left / budget[0]: in the lane == 0 loop, else { left -= costs[i]; } is attached to if (kind == 3) { ... } else if (costs[i] > left) { ... } else { left -= costs[i]; }, so left -= costs[i] never executes for kind == 3.
  • Multi-record / cross-tile budget rejection leaves chunks unzeroed: storing a single scalar reject means a second over-budget title record in the same 64-lane tile (or across a tile boundary) overwrites reject, so h - h % CHUNKS == reject only zeroes the latest rejected record's remaining chunks while earlier rejected records' chunks 1..16 still run. Since left drops to 0 on the first rejection, checking h >= reject (once reject is set on the first rejected record) cleanly zeroes every chunk from that point on across all remaining tiles.
  • GROUPS = 2^20 cap is bypassed for kind == 3: dispatch_cost returns 0 when x > GROUPS / (y * z), so e.g. [65535, 65535, 1] charges cost = 0 (passes budget) while clamped writes [0, 65535, 65535, 1] straight into dest (4.3B groups), and [2_000_000, 1, 1] writes 17 * 65535 = 1,114,095 > 2^20 groups. Please apply the same GROUPS clamp/zeroing to dest for kind == 3 as kind == 2 does.

5. draw::tests::group_base_covers_a_dispatch_past_the_host_limit silently skips on FXC syntax error (crates/victory-gpu/src/draw.rs:4017-4198)

Compiling SOURCE directly with Windows SDK fxc.exe /T cs_5_1 /E main fails with:

error X3000: syntax error: unexpected token 'out'

out is a reserved HLSL keyword (RWStructuredBuffer<uint> out : register(u0);). Because the test does let Ok((root, pso)) = compute(...) else { return; // no shader compiler here };, it silently returns ok on every run without dispatching anything!
Once out is renamed, there is also a second bug on line 4146: params[0] is a Root UAV (D3D12_ROOT_PARAMETER_TYPE_UAV), yet l.SetComputeRootUnorderedAccessView(uav_param, gpu) passes slots.0.GetGPUDescriptorHandleForHeapStart().ptr (a descriptor-heap GPU handle) instead of out.GetGPUVirtualAddress() (and slots creates an unused raw UAV for an RWStructuredBuffer<uint>). Please fix both and assert on compilation failure rather than returning early when D3DCompile rejects the shader.

6. Architecture / coordination note with #3086

Since #3086 already covers direct dispatches cleanly by placing GROUP_BASE inside stage.user_data (which is always a D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS root parameter in pipeline/host.rs:479-492), note that D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT can target (param, DestOffsetIn32BitValues = u.index, Num32BitValuesToSet = 1) directly without needing a separate GROUP_BASE_SPACE = 3 root parameter or HostShader/shader_cache schema changes. Also, on the direct-dispatch path, splitting x > 65_535 even when group_base is None (as #3086 does) avoids passing an illegal x > 65_535 to ID3D12GraphicsCommandList::Dispatch.

<!-- greyfinch-sync:Marvisak/VIctory:review:6070845111 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3100#pullrequestreview-6070845111). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T08:40:02Z. **Review:** CHANGES_REQUESTED --- Covering `ExecuteIndirect` for compute dispatches past 65,535 groups in `x` is genuinely useful (building beyond `#3086`, which handles direct dispatches), and the clamp + `[CONSTANT, DISPATCH]` command-signature idea is the right direction. However, reviewing `6d3848e0` line by line and testing natively on Windows 11 (RTX 5090, WARP, and Windows SDK `fxc.exe`) turned up several blocking bugs, including a silently skipped test: ### 1. Accidental deletion of `|| self.memory.is_some()` in DXIL emission (`crates/victory-shader/src/emit/shader.rs:630-633`) Replacing `|| self.memory.is_some()` with `|| self.group_base.is_some()` omits the entire `!dx.resources` emission for any shader whose only resource is read-only title memory (`self.memory.is_some()`, e.g., a VS/PS/MS or a CS that does not read TGID `x` and has no user data/samplers/root views/view marks). Please keep `|| self.memory.is_some()` alongside `|| self.group_base.is_some()`. ### 2. Counted `ExecuteIndirect` still passes the unmultiplied title count buffer (`crates/victory-gpu/src/draw.rs:1853-1879`) In `draw.rs`, `indirect::bound` writes `min(counts[0], records) * 17` into `clamped` at `host_stride * host_max`, and the `#[cfg(feature = "diagnostics")]` `read_indirect` block reads that multiplied count — **but the `ExecuteIndirect` call right above it still passes the original title count buffer**: ```rust list.list.ExecuteIndirect( &signature, host_max, &clamped, 0, counter.as_ref().map(|(s, _)| &s.buffer), counter.as_ref().map_or(0, |(s, at)| s.offset(*at)), ) ``` For any counted indirect compute dispatch (e.g. title count = 1, `x = 80,000`), `ExecuteIndirect` reads count `1` instead of `17` and drops chunks `1..16`. Also, in the `diagnostics` block below it, `if chunked { Some((&clamped, ...)) }` passes `Some` even when `counter` is `None` (where `count_word` was `false` and nothing was allocated/written at that offset). Both `ExecuteIndirect` and `read_indirect` should use `Some((&clamped, u64::from(host_stride) * u64::from(host_max)))` if and only if `chunked && counter.is_some()`. ### 3. 17x buffer under-allocation in `indirect::bound` (`crates/victory-gpu/src/indirect.rs:676-679`) ```rust let host_stride = if chunked { 16 } else { stride }; let words = (host_stride / 4) as u64 * u64::from(records.max(1)); let count_word = chunked && count.is_some(); let out = list.arguments(4 * (words + u64::from(count_word)))?; ``` `words` multiplies by `records` instead of `records * 17` when `chunked` (`kind == 3`), even though the clamp shader writes `records * 17 * 4` words plus the count word at index `records * 17 * 4`. Small counts (`records <= 240`) happen to be masked by `list.arguments`'s 64 KiB floor, but any `records > 240` overflows the UAV buffer on the GPU. ### 4. Three logic bugs in the `kind == 3` clamp HLSL (`crates/victory-gpu/src/indirect.rs:520-594`) - **Accepted chunked dispatches never deduct from `left` / `budget[0]`**: in the `lane == 0` loop, `else { left -= costs[i]; }` is attached to `if (kind == 3) { ... } else if (costs[i] > left) { ... } else { left -= costs[i]; }`, so `left -= costs[i]` never executes for `kind == 3`. - **Multi-record / cross-tile budget rejection leaves chunks unzeroed**: storing a single scalar `reject` means a second over-budget title record in the same 64-lane tile (or across a tile boundary) overwrites `reject`, so `h - h % CHUNKS == reject` only zeroes the latest rejected record's remaining chunks while earlier rejected records' chunks `1..16` still run. Since `left` drops to `0` on the first rejection, checking `h >= reject` (once `reject` is set on the first rejected record) cleanly zeroes every chunk from that point on across all remaining tiles. - **`GROUPS = 2^20` cap is bypassed for `kind == 3`**: `dispatch_cost` returns `0` when `x > GROUPS / (y * z)`, so e.g. `[65535, 65535, 1]` charges `cost = 0` (passes budget) while `clamped` writes `[0, 65535, 65535, 1]` straight into `dest` (4.3B groups), and `[2_000_000, 1, 1]` writes `17 * 65535 = 1,114,095 > 2^20` groups. Please apply the same `GROUPS` clamp/zeroing to `dest` for `kind == 3` as `kind == 2` does. ### 5. `draw::tests::group_base_covers_a_dispatch_past_the_host_limit` silently skips on FXC syntax error (`crates/victory-gpu/src/draw.rs:4017-4198`) Compiling `SOURCE` directly with Windows SDK `fxc.exe /T cs_5_1 /E main` fails with: ```text error X3000: syntax error: unexpected token 'out' ``` `out` is a reserved HLSL keyword (`RWStructuredBuffer<uint> out : register(u0);`). Because the test does `let Ok((root, pso)) = compute(...) else { return; // no shader compiler here };`, it silently returns `ok` on every run without dispatching anything! Once `out` is renamed, there is also a second bug on line 4146: `params[0]` is a Root UAV (`D3D12_ROOT_PARAMETER_TYPE_UAV`), yet `l.SetComputeRootUnorderedAccessView(uav_param, gpu)` passes `slots.0.GetGPUDescriptorHandleForHeapStart().ptr` (a descriptor-heap GPU handle) instead of `out.GetGPUVirtualAddress()` (and `slots` creates an unused raw UAV for an `RWStructuredBuffer<uint>`). Please fix both and assert on compilation failure rather than returning early when `D3DCompile` rejects the shader. ### 6. Architecture / coordination note with `#3086` Since `#3086` already covers direct dispatches cleanly by placing `GROUP_BASE` inside `stage.user_data` (which is always a `D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS` root parameter in `pipeline/host.rs:479-492`), note that `D3D12_INDIRECT_ARGUMENT_TYPE_CONSTANT` can target `(param, DestOffsetIn32BitValues = u.index, Num32BitValuesToSet = 1)` directly without needing a separate `GROUP_BASE_SPACE = 3` root parameter or `HostShader`/`shader_cache` schema changes. Also, on the direct-dispatch path, splitting `x > 65_535` even when `group_base` is `None` (as `#3086` does) avoids passing an illegal `x > 65_535` to `ID3D12GraphicsCommandList::Dispatch`.
Marvisak commented 2026-11-26 09:06:07 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

Needs work. Splitting x past 65,535 groups with a group-id base is a reasonable approach to a real D3D12 limit, and CI passes. The PR's own commit (6d3848e, on top of #2969 and #3097) has a regression in the translator, though:

  • crates/victory-shader/src/emit/shader.rs, the resource-metadata condition: the diff replaces || self.memory.is_some() with || self.group_base.is_some() instead of adding the new term. A program whose only resource is the title-memory page table (t0 in MEMORY_SPACE, from memory_handle) would no longer get its resource metadata, so its SRV is not declared. Please keep the memory term and add group_base beside it.
  • Same file, struct Shader: the doc comment of user_data ("Dwords of user data the shader reads") was replaced by group_base's doc, so user_data lost its doc. Please restore it.
  • indirect.rs, clamp shader, kind 3 budget rejection: reject holds a single record. If two chunked records are rejected in the same tile, or a rejected record's chunks spill into a tile where a later record is rejected, the second loop marks only the last rejected record's chunks PAST. The earlier record's remaining chunks then run with their x counts. That leaves a partial dispatch once the 2^27 budget runs out. A test with the budget exhausted across more than one chunked record would cover it.

What would change the verdict: the first two fixed, the third fixed or shown not to happen, and a test for a memory-only program's metadata. The PR will also need a rebase once #2969 and #3097 land. It also overlaps #3086 and #2312, which handle the same 65,535 limit.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7186557957 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3100#issuecomment-7186557957). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T08:24:33Z. --- <!-- victory-triage v1 head=6d3848e0d7f08cf3db8bc17f60f4a554626a6917 verdict=needs-work at=2026-11-26T08:18:11Z --> Automated triage for the maintainers. **Needs work.** Splitting x past 65,535 groups with a group-id base is a reasonable approach to a real D3D12 limit, and CI passes. The PR's own commit (6d3848e, on top of #2969 and #3097) has a regression in the translator, though: - **`crates/victory-shader/src/emit/shader.rs`, the resource-metadata condition:** the diff replaces `|| self.memory.is_some()` with `|| self.group_base.is_some()` instead of adding the new term. A program whose only resource is the title-memory page table (`t0` in `MEMORY_SPACE`, from `memory_handle`) would no longer get its resource metadata, so its SRV is not declared. Please keep the `memory` term and add `group_base` beside it. - **Same file, `struct Shader`:** the doc comment of `user_data` ("Dwords of user data the shader reads") was replaced by `group_base`'s doc, so `user_data` lost its doc. Please restore it. - **`indirect.rs`, clamp shader, kind 3 budget rejection:** `reject` holds a single record. If two chunked records are rejected in the same tile, or a rejected record's chunks spill into a tile where a later record is rejected, the second loop marks only the last rejected record's chunks `PAST`. The earlier record's remaining chunks then run with their x counts. That leaves a partial dispatch once the 2^27 budget runs out. A test with the budget exhausted across more than one chunked record would cover it. What would change the verdict: the first two fixed, the third fixed or shown not to happen, and a test for a memory-only program's metadata. The PR will also need a rebase once #2969 and #3097 land. It also overlaps #3086 and #2312, which handle the same 65,535 limit. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-26 10:04:45 +00:00
neonbyte1 commented 2026-11-26 10:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by neonbyte1 on 2026-11-26T09:46:50Z.


Thanks for the careful review, and you're right on all of it. In particular:

  • || self.memory.is_some() was replaced instead of extended.
  • The counted ExecuteIndirect gets the title's unmultiplied count.
  • The argument buffer is sized for records, not records × 17.
  • The kind-3 budget logic in the clamp has the three bugs you describe.
  • group_base_covers_a_dispatch_past_the_host_limit never ran: out doesn't compile, and the test returns early as if no compiler were present. I reported it as passing. That was wrong, and I should have checked that it actually dispatched.

I also missed that #2312 (Xvania7, opened earlier) already fixes the same issue, #2256, for direct and indirect dispatches, and that #3086 covers direct ones. So I'm closing this rather than fixing it, and I'll test #2312 on the RTX 5090 under Wine in the scene where I found the bug. The scene: GTA VI's indirect_diffuse_lighting:CS_FinalGather asks for 74,192–83,008 groups in x through ExecuteIndirect. With the clamp at 65,535, about 1,000 screen tiles were never gathered, and the bottom of the lit picture showed stale tiles. I'll post the before/after on #2312.

AI-assisted (Claude); measured on my machine, no game data shared.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188460151 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3100#issuecomment-7188460151). Originally posted by [neonbyte1](https://github.com/neonbyte1) on 2026-11-26T09:46:50Z. --- Thanks for the careful review, and you're right on all of it. In particular: - `|| self.memory.is_some()` was replaced instead of extended. - The counted `ExecuteIndirect` gets the title's unmultiplied count. - The argument buffer is sized for `records`, not `records × 17`. - The kind-3 budget logic in the clamp has the three bugs you describe. - `group_base_covers_a_dispatch_past_the_host_limit` never ran: `out` doesn't compile, and the test returns early as if no compiler were present. I reported it as passing. That was wrong, and I should have checked that it actually dispatched. I also missed that #2312 (Xvania7, opened earlier) already fixes the same issue, #2256, for direct and indirect dispatches, and that #3086 covers direct ones. So I'm closing this rather than fixing it, and I'll test #2312 on the RTX 5090 under Wine in the scene where I found the bug. The scene: GTA VI's `indirect_diffuse_lighting:CS_FinalGather` asks for 74,192–83,008 groups in x through `ExecuteIndirect`. With the clamp at 65,535, about 1,000 screen tiles were never gathered, and the bottom of the lit picture showed stale tiles. I'll post the before/after on #2312. _AI-assisted (Claude); measured on my machine, no game data shared._

Pull request closed

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!3098
No description provided.