GPU: number bounded indirect mesh groups consecutively #2994

Open
andrewpozdnakov7-jpg wants to merge 2 commits from upstream-pr/2996 into main
andrewpozdnakov7-jpg commented 2026-11-26 02:48:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T02:48:04Z.


Indirect mesh commands carry three group counts. VIctory's translated mesh input MeshGroup reads the host's SV_GroupID.x and applies the shader's stride. Flattening every record to its original X count loses work. Passing the full grid through leaves X repeated across Y and Z.

The clamp now uses [x*y*z, 1, 1] for grids within the existing 65,535-group per-record ceiling. This gives each translated group its own index. Oversized records keep the original bounded fallback. The list budget still uses the work charged to each record.

  • Same synthetic translated mesh shader on the earlier PR head 9a851cd, through the ordinary State::execute_indirect path: an atomic counter for each MeshGroup records eight hits in each of the first three slots and zero in the remaining 21.
  • On 5385cc6, each of the 24 slots receives one hit. Six paired WARP runs agreed. The argument-buffer test covers empty and oversized inputs plus list budget exhaustion.
  • Full GPU suite on WARP: 248 passed and one ignored in each run. Strict GPU Clippy and the asset policy passed.

This covers VIctory's translated indirect mesh path. #2624 covers direct mesh calls, whose translated group-index behavior needs its own check. #2472's batched clamp needs the same indirect rule if combined.

Coordination · D3D12 mesh indirect argument specification

If you move the patch, please keep its Git author. If you combine it with another commit, please include:

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted with Codex. Synthetic GPU inputs.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5503077515 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T02:48:04Z. --- Indirect mesh commands carry three group counts. VIctory's translated mesh input `MeshGroup` reads the host's `SV_GroupID.x` and applies the shader's stride. Flattening every record to its original X count loses work. Passing the full grid through leaves X repeated across Y and Z. The clamp now uses `[x*y*z, 1, 1]` for grids within the existing 65,535-group per-record ceiling. This gives each translated group its own index. Oversized records keep the original bounded fallback. The list budget still uses the work charged to each record. - Same synthetic translated mesh shader on the earlier PR head `9a851cd`, through the ordinary `State::execute_indirect` path: an atomic counter for each `MeshGroup` records eight hits in each of the first three slots and zero in the remaining 21. - On `5385cc6`, each of the 24 slots receives one hit. Six paired WARP runs agreed. The argument-buffer test covers empty and oversized inputs plus list budget exhaustion. - Full GPU suite on WARP: 248 passed and one ignored in each run. Strict GPU Clippy and the asset policy passed. This covers VIctory's translated indirect mesh path. #2624 covers direct mesh calls, whose translated group-index behavior needs its own check. #2472's batched clamp needs the same indirect rule if combined. [Coordination](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7181066180) · [D3D12 mesh indirect argument specification](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html#executeindirect) If you move the patch, please keep its Git author. If you combine it with another commit, please include: Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted with Codex. Synthetic GPU inputs.
kotekompotek commented 2026-11-26 02:58:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T02:58:04Z.

Review: APPROVED


LGTM — the fallback min(g, uint3(65535,1,1)) is elementwise, so oversized grids collapse to (x,1,1) not (65535,1,1) — the test's (257,256,1)→(257,1,1) and (u32::MAX,2,3)→(65535,1,1) both confirm. Overflow analysis holds: the per-axis check makes the product check unreachable when x or y exceeds 65535, so g.xg.y ≤ 65535² fits u32; dividing the ceiling by z avoids xyz overflow. Kept grids charge xyz128 — same 65535-group ceiling, so the budget semantics are preserved exactly (the test's 65532-group records → 16 of 18 run). The clamped_words refactor asserting fields <= per keeps the read-back honest.

<!-- greyfinch-sync:Marvisak/VIctory:review:6067951141 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#pullrequestreview-6067951141). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T02:58:04Z. **Review:** APPROVED --- LGTM — the fallback `min(g, uint3(65535,1,1))` is elementwise, so oversized grids collapse to (x,1,1) not (65535,1,1) — the test's (257,256,1)→(257,1,1) and (u32::MAX,2,3)→(65535,1,1) both confirm. Overflow analysis holds: the per-axis check makes the product check unreachable when x or y exceeds 65535, so g.x*g.y ≤ 65535² fits u32; dividing the ceiling by z avoids x*y*z overflow. Kept grids charge x*y*z*128 — same 65535-group ceiling, so the budget semantics are preserved exactly (the test's 65532-group records → 16 of 18 run). The `clamped_words` refactor asserting `fields <= per` keeps the read-back honest.
steven-seagull27 commented 2026-11-26 03:05:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T03:01:59Z.


Confirmed the missing groups at execution time on both RTX 5080 and Microsoft WARP. I ran a mesh shader that increments a separate counter for each SV_GroupID. I compared native DispatchMesh with the production clamp followed by ExecuteIndirect, then checked all 64 coordinate counters against CPU enumeration. The largest grid dimension was four.

Input records Direct groups Indirect on 63bcca43 Indirect on 9a851cd3
One (3,2,4), 12-byte stride 24 3 24
(2,3,1) and (1,1,2), 16-byte stride 8 3 8
66 small grids crossing the clamp's 64-record boundary, 20-byte stride 512 132 512

Both adapters gave the same results. At the PR head, every coordinate matched direct dispatch, including both visits to the origin in the two-record case. The input argument buffers also remained byte-identical.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7181334623 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7181334623). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T03:01:59Z. --- Confirmed the missing groups at execution time on both RTX 5080 and Microsoft WARP. I ran a mesh shader that increments a separate counter for each `SV_GroupID`. I compared native `DispatchMesh` with the production clamp followed by `ExecuteIndirect`, then checked all 64 coordinate counters against CPU enumeration. The largest grid dimension was four. | Input records | Direct groups | Indirect on `63bcca43` | Indirect on `9a851cd3` | |---|---:|---:|---:| | One `(3,2,4)`, 12-byte stride | 24 | 3 | 24 | | `(2,3,1)` and `(1,1,2)`, 16-byte stride | 8 | 3 | 8 | | 66 small grids crossing the clamp's 64-record boundary, 20-byte stride | 512 | 132 | 512 | Both adapters gave the same results. At the PR head, every coordinate matched direct dispatch, including both visits to the origin in the two-record case. The input argument buffers also remained byte-identical.
oni-swr commented 2026-11-26 03:05:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-26T03:02:28Z.


Independent Windows WARP test run of 9a851cd3c00d94fcf13b9825d1b98673a1de0cf5, compared with its exact parent 63bcca43c6a00a758510398fa43096ce7e4f7df0. This reports test results only, not a review verdict.

Setup. Software only. VICTORY_D3D12_WARP=1 and VICTORY_WARP=1, built with --features diagnostics (WARP selection in victory-gpu is behind that feature). VICTORY_DXIL pointed at the Windows SDK 10.0.26100.0 x64 dxil.dll, but the victory-gpu lib tests never loaded it: a probe found no dxil.dll module in the process. Before any dispatch, each probe checked that the host device's adapter LUID matches EnumWarpAdapter: Microsoft Basic Render Driver, vendor 0x1414, device 0x8c, software flag set. No hardware GPU was used. No game files, dumps or shader data, only synthetic arguments.

Command. cargo test --locked -j 4 -p victory-gpu --features diagnostics --lib -- --test-threads=1, plus filtered runs (probe_attest, probe_, indirect::).

Local probes (not pushed). They run the production clamp through bound/done and read back all three words of every mesh record:

Probe Parent 63bcca4 Head 9a851cd3
Grids within the 65,535-group ceiling keep x/y/z: [5,7,9], [2,2,2], [255,257,1] (exactly 65,535), [1,1,65535] and [3,5,4369] (the z-division edge), [0,9,9], [65535,65535,0]. Over-ceiling or over-axis grids fall back: [256,256,1]→[256,1,1], [2,1,65535]→[2,1,1], [1,1,65536]→[1,1,1], [70000,2,2] and u32::MAX³→[65535,1,1] fails: every y/z becomes 1 ([5,1,1], …, [65535,1,0]) passes
40 records of [32,32,32] (32,768 groups each) against the 2^20-group list budget: exactly 32 run, 8 run empty fails: 40 run as [32,1,1] passes: 32 run
Budget shared across two clamp calls in one list, 20 × [64,64,8]: the second call has 12 left fails: 20 run passes: 12 run
Control: 17 × [65535,2,1] charged at the fallback size, 16 run passes passes

Counts.

  • indirect:: on the head: 11 passed (the 7 module tests, including mesh_clamp_keeps_group_grid_and_charges_all_axes, plus the 4 probes).
  • Full victory-gpu lib suite on the head: 247 of the tree's 248 tests passed, 1 ignored (benchmark_private_data_release). The suite total also included the WARP attestation probe and 4 unrelated local ClearState probes for #2984, which fail here as they do on the parent.
  • Parent: 246 passed, 1 ignored. The 3 grid/budget probes failed as shown above. The fallback control passed.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7181341800 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7181341800). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-26T03:02:28Z. --- Independent Windows WARP test run of `9a851cd3c00d94fcf13b9825d1b98673a1de0cf5`, compared with its exact parent `63bcca43c6a00a758510398fa43096ce7e4f7df0`. This reports test results only, not a review verdict. **Setup.** Software only. `VICTORY_D3D12_WARP=1` and `VICTORY_WARP=1`, built with `--features diagnostics` (WARP selection in victory-gpu is behind that feature). `VICTORY_DXIL` pointed at the Windows SDK 10.0.26100.0 x64 `dxil.dll`, but the victory-gpu lib tests never loaded it: a probe found no `dxil.dll` module in the process. Before any dispatch, each probe checked that the host device's adapter LUID matches `EnumWarpAdapter`: `Microsoft Basic Render Driver`, vendor `0x1414`, device `0x8c`, software flag set. No hardware GPU was used. No game files, dumps or shader data, only synthetic arguments. **Command.** `cargo test --locked -j 4 -p victory-gpu --features diagnostics --lib -- --test-threads=1`, plus filtered runs (`probe_attest`, `probe_`, `indirect::`). **Local probes (not pushed).** They run the production clamp through `bound`/`done` and read back all three words of every mesh record: | Probe | Parent `63bcca4` | Head `9a851cd3` | |---|---|---| | Grids within the 65,535-group ceiling keep x/y/z: `[5,7,9]`, `[2,2,2]`, `[255,257,1]` (exactly 65,535), `[1,1,65535]` and `[3,5,4369]` (the z-division edge), `[0,9,9]`, `[65535,65535,0]`. Over-ceiling or over-axis grids fall back: `[256,256,1]`→`[256,1,1]`, `[2,1,65535]`→`[2,1,1]`, `[1,1,65536]`→`[1,1,1]`, `[70000,2,2]` and `u32::MAX`³→`[65535,1,1]` | fails: every y/z becomes 1 (`[5,1,1]`, …, `[65535,1,0]`) | passes | | 40 records of `[32,32,32]` (32,768 groups each) against the 2^20-group list budget: exactly 32 run, 8 run empty | fails: 40 run as `[32,1,1]` | passes: 32 run | | Budget shared across two clamp calls in one list, 20 × `[64,64,8]`: the second call has 12 left | fails: 20 run | passes: 12 run | | Control: 17 × `[65535,2,1]` charged at the fallback size, 16 run | passes | passes | **Counts.** - `indirect::` on the head: 11 passed (the 7 module tests, including `mesh_clamp_keeps_group_grid_and_charges_all_axes`, plus the 4 probes). - Full victory-gpu lib suite on the head: 247 of the tree's 248 tests passed, 1 ignored (`benchmark_private_data_release`). The suite total also included the WARP attestation probe and 4 unrelated local ClearState probes for #2984, which fail here as they do on the parent. - Parent: 246 passed, 1 ignored. The 3 grid/budget probes failed as shown above. The fallback control passed. AI-assisted: Claude Code (Claude Opus 5.5), coordinated by Codex (gpt-6.2-sol).
fuzeofficlal commented 2026-11-26 03:07:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T03:07:55Z.

Review: CHANGES_REQUESTED


Code review on 9a851cd3 (static source inspection; no runtime GPU execution):

  • High — Multi-axis indirect mesh grids alias SV_GroupID.x across all Y/Z slices (crates/victory-gpu/src/indirect.rs, crates/victory-shader/src/emit/lower.rs:1498-1504):
    • Keeping all three grid axes (x, y, z) in the clamped argument buffer passes multi-axis grids directly to ExecuteIndirect (draw.rs:1811).
    • However, emit/lower.rs:1498-1504 still lowers Input::MeshGroup strictly as groupId.i32(0) * mesh_stride (SV_GroupID.x * mesh_stride), ignoring SV_GroupID.y and SV_GroupID.z.
    • For a grid like (3, 2, 4), the host launches 24 threadgroups, but every (y, z) slice receives the same three MeshGroup indices (0, 1, 2 × mesh_stride), processing the first three meshlets 8 times instead of 24 distinct groups. The new unit test reads back only the clamped argument buffer and does not execute a mesh shader consuming Input::MeshGroup.
    • Please verify the console's multi-axis mesh group numbering and either lower Input::MeshGroup across (x, y, z) or linearize the grid before launching multi-axis DispatchMesh grids (with a mesh-shader execution test consuming Input::MeshGroup).
<!-- greyfinch-sync:Marvisak/VIctory:review:6068018271 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#pullrequestreview-6068018271). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T03:07:55Z. **Review:** CHANGES_REQUESTED --- Code review on `9a851cd3` (static source inspection; no runtime GPU execution): - **High — Multi-axis indirect mesh grids alias `SV_GroupID.x` across all Y/Z slices (`crates/victory-gpu/src/indirect.rs`, `crates/victory-shader/src/emit/lower.rs:1498-1504`)**: - Keeping all three grid axes `(x, y, z)` in the clamped argument buffer passes multi-axis grids directly to `ExecuteIndirect` (`draw.rs:1811`). - However, `emit/lower.rs:1498-1504` still lowers `Input::MeshGroup` strictly as `groupId.i32(0) * mesh_stride` (`SV_GroupID.x * mesh_stride`), ignoring `SV_GroupID.y` and `SV_GroupID.z`. - For a grid like `(3, 2, 4)`, the host launches 24 threadgroups, but every `(y, z)` slice receives the same three `MeshGroup` indices (`0, 1, 2` × `mesh_stride`), processing the first three meshlets 8 times instead of 24 distinct groups. The new unit test reads back only the clamped argument buffer and does not execute a mesh shader consuming `Input::MeshGroup`. - Please verify the console's multi-axis mesh group numbering and either lower `Input::MeshGroup` across `(x, y, z)` or linearize the grid before launching multi-axis `DispatchMesh` grids (with a mesh-shader execution test consuming `Input::MeshGroup`).
upstream-sync changed title from [PR #2996] GPU: keep the group grid in bounded indirect mesh dispatches to [PR #2996] GPU: number bounded indirect mesh groups consecutively 2026-11-26 04:05:55 +00:00
andrewpozdnakov7-jpg commented 2026-11-26 04:06:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T03:37:21Z.


I reproduced the repeated indices from your review using a translated mesh program that reads Input::MeshGroup and atomically adds to a counter for that group. The program runs through VIctory's normal indirect execution path. The same 3×2×4 record touches only the first three counters, eight times each, on 9a851cd.

5385cc6 gives one hit to each of the 24 counters by dispatching the bounded count along X. The test verifies the supported VIctory scalar input path. Console hardware numbering for multidimensional calls remains unverified. The oversized fallback and work limits are covered separately by GPU argument-buffer readback tests.

Six paired WARP runs agreed. Full GPU suite 248 passed and one ignored, both strict GPU Clippy configurations and policy passed. The branch also merges cleanly with #2624 and current main.

Please preserve the Git author if you cherry-pick this follow-up, or add this trailer if the fix or fixture is folded into another commit.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7181880012 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7181880012). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T03:37:21Z. --- I reproduced the repeated indices from your [review](https://github.com/Marvisak/VIctory/pull/2996#pullrequestreview-6068018271) using a translated mesh program that reads `Input::MeshGroup` and atomically adds to a counter for that group. The program runs through VIctory's normal indirect execution path. The same `3×2×4` record touches only the first three counters, eight times each, on `9a851cd`. [5385cc6](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/5385cc62cbfbaece4c8eb2dde871b14703f119cb) gives one hit to each of the 24 counters by dispatching the bounded count along X. The test verifies the supported VIctory scalar input path. Console hardware numbering for multidimensional calls remains unverified. The oversized fallback and work limits are covered separately by GPU argument-buffer readback tests. Six paired WARP runs agreed. Full GPU suite 248 passed and one ignored, both strict GPU Clippy configurations and policy passed. The branch also merges cleanly with #2624 and current `main`. Please preserve the Git author if you cherry-pick this follow-up, or add this trailer if the fix or fixture is folded into another commit. Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted with Codex.
steven-seagull27 commented 2026-11-26 05:04:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T04:07:02Z.


@andrewpozdnakov7-jpg I verified 5385cc6 with the batch path from #2472. Inline handed a translated (3,2,4) mesh 24 distinct scalar group indices. Our previous batch integration still repeated three indices eight times each. I carried your normalization into the batch kernel and retained your original commit and authorship. RTX 5080 and WARP now agree on all 64 counters for each of the three record sets, including 66 records across the batch boundary. Full results and combined branch

<!-- greyfinch-sync:Marvisak/VIctory:comment:7182308552 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7182308552). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T04:07:02Z. --- @andrewpozdnakov7-jpg I verified `5385cc6` with the batch path from #2472. Inline handed a translated `(3,2,4)` mesh 24 distinct scalar group indices. Our previous batch integration still repeated three indices eight times each. I carried your normalization into the batch kernel and retained your original commit and authorship. RTX 5080 and WARP now agree on all 64 counters for each of the three record sets, including 66 records across the batch boundary. [Full results and combined branch](https://github.com/Marvisak/VIctory/pull/2472#issuecomment-7182304476)
Marvisak commented 2026-11-26 06:03:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T05:44:57Z.


Automated triage for the maintainers.

Verdict: needs work. The change is in the mesh arm of the clamp shader in crates/victory-gpu/src/indirect.rs. In-budget records now become [x*y*z, 1, 1] instead of [min(x, 65535), 1, 1]. Oversized records keep the old fallback, and the list budget is charged for every axis. The new test indirect_mesh_visits_each_translated_group_index (pipeline/host.rs) shows each translated MeshGroup index visited once for a (3,2,4) record. The HLSL looks right: x*y can't overflow once each axis is at most 65,535, and the total is checked by dividing by z.

What's missing is evidence about the console. The comment this replaces on main says the console's mesh dispatches are one-dimensional. If that holds, y = z = 1 and this PR changes nothing for the title. If it doesn't, the result depends on how the console numbers the groups of a multi-dimensional dispatch. Your own follow-up says that numbering is unverified. Row-major linearisation is a guess the test can't confirm, because the test only checks that VIctory's own scalar index is unique.

To change the verdict, show one of:

  • that the title issues indirect mesh records with y or z above 1, for example from VICTORY_DUMP_ARGUMENTS-style logging or the frame trace;
  • a hardware or documentation reference for how the console derives the mesh group index from a 3D grid.

With either, this is a clear fix. The budget accounting part is independently sound.

CI: passing (check).


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7183769909 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7183769909). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T05:44:57Z. --- <!-- victory-triage v1 head=5385cc62cbfbaece4c8eb2dde871b14703f119cb verdict=needs-work at=2026-11-26T05:44:45Z --> Automated triage for the maintainers. **Verdict: needs work.** The change is in the mesh arm of the clamp shader in `crates/victory-gpu/src/indirect.rs`. In-budget records now become `[x*y*z, 1, 1]` instead of `[min(x, 65535), 1, 1]`. Oversized records keep the old fallback, and the list budget is charged for every axis. The new test `indirect_mesh_visits_each_translated_group_index` (`pipeline/host.rs`) shows each translated `MeshGroup` index visited once for a `(3,2,4)` record. The HLSL looks right: `x*y` can't overflow once each axis is at most 65,535, and the total is checked by dividing by `z`. What's missing is evidence about the console. The comment this replaces on `main` says the console's mesh dispatches are one-dimensional. If that holds, `y = z = 1` and this PR changes nothing for the title. If it doesn't, the result depends on how the console numbers the groups of a multi-dimensional dispatch. Your own follow-up says that numbering is unverified. Row-major linearisation is a guess the test can't confirm, because the test only checks that VIctory's own scalar index is unique. To change the verdict, show one of: - that the title issues indirect mesh records with `y` or `z` above 1, for example from `VICTORY_DUMP_ARGUMENTS`-style logging or the frame trace; - a hardware or documentation reference for how the console derives the mesh group index from a 3D grid. With either, this is a clear fix. The budget accounting part is independently sound. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 09:05:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T09:05:15Z.

Review: APPROVED


5385cc62 cleanly addresses the Input::MeshGroup aliasing issue from the earlier review on 9a851cd3:

  • Bounded multi-axis indirect mesh grids are now linearized to [g.x * g.y * g.z, 1, 1] in crates/victory-gpu/src/indirect.rs, giving each translated MeshGroup a distinct consecutive index while preserving overflow-safe bounds checks (g.x * g.y fits in u32 once g <= 65535, zero axes yield [0, 1, 1] with cost 0, oversized grids keep the existing fallback, and the list budget charges 128 per group).
  • pipeline::host::tests::indirect_mesh_visits_each_translated_group_index executes a translated GFX10 mesh shader reading Input::MeshGroup through State::execute_indirect and verifies all 24 slots for a (3, 2, 4) grid receive exactly one hit.

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

  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean
  • RTX 5090: indirect:: 7/7 passed; indirect_mesh_visits_each_translated_group_index 3/3 passed
  • RTX 5090 + VICTORY_D3D12_DEBUG=1 (--features diagnostics): indirect_mesh_visits_each_translated_group_index 1/1 passed
  • WARP + VICTORY_D3D12_DEBUG=1 (--features diagnostics, VICTORY_D3D12_WARP=1): indirect:: + indirect_mesh_visits_each_translated_group_index 8/8 passed
  • cargo xtask policy: 191 files ok

(Note for maintainers: while RTX 5090 and WARP pass cleanly here including under the D3D12 Debug Layer, see the AMD RX 6750 XT report above on the new mesh test in case AMD drivers dislike a pixel-shader-less / outputs: [] mesh test pipeline.)

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:review:6071174613 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#pullrequestreview-6071174613). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T09:05:15Z. **Review:** APPROVED --- `5385cc62` cleanly addresses the `Input::MeshGroup` aliasing issue from the earlier review on `9a851cd3`: - Bounded multi-axis indirect mesh grids are now linearized to `[g.x * g.y * g.z, 1, 1]` in `crates/victory-gpu/src/indirect.rs`, giving each translated `MeshGroup` a distinct consecutive index while preserving overflow-safe bounds checks (`g.x * g.y` fits in `u32` once `g <= 65535`, zero axes yield `[0, 1, 1]` with cost `0`, oversized grids keep the existing fallback, and the list budget charges `128` per group). - `pipeline::host::tests::indirect_mesh_visits_each_translated_group_index` executes a translated GFX10 mesh shader reading `Input::MeshGroup` through `State::execute_indirect` and verifies all 24 slots for a `(3, 2, 4)` grid receive exactly one hit. Verified locally on Windows 11 (RTX 5090 + WARP + D3D12 Debug Layer): - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean - RTX 5090: `indirect::` 7/7 passed; `indirect_mesh_visits_each_translated_group_index` 3/3 passed - RTX 5090 + `VICTORY_D3D12_DEBUG=1` (`--features diagnostics`): `indirect_mesh_visits_each_translated_group_index` 1/1 passed - WARP + `VICTORY_D3D12_DEBUG=1` (`--features diagnostics`, `VICTORY_D3D12_WARP=1`): `indirect::` + `indirect_mesh_visits_each_translated_group_index` 8/8 passed - `cargo xtask policy`: 191 files ok *(Note for maintainers: while RTX 5090 and WARP pass cleanly here including under the D3D12 Debug Layer, see the AMD RX 6750 XT report above on the new mesh test in case AMD drivers dislike a pixel-shader-less / `outputs: []` mesh test pipeline.)* LGTM.
wwwwwwww3333333 commented 2026-11-26 09:06:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by wwwwwwww3333333 on 2026-11-26T08:38:59Z.


AMD hardware run of 5385cc6 (on main 63bcca4). RX 6750 XT (RDNA2), driver 32.0.21045.29003, Windows 11, Rust 1.98.1.

cargo test -p victory-gpu --lib -- pipeline::host::tests::indirect_mesh_visits_each_translated_group_index --exact, hardware adapter, three runs:

  • run 1: the test process died with STATUS_STACK_BUFFER_OVERRUN (0xC0000409);
  • run 2: it returned after 26.5 s with 24 zeros where the test expects 24 ones;
  • run 3: the same 0xC0000409 as run 1.

The display went black for a moment during the first runs and came back. The same test passes on WARP (three runs out of three). The other four tests of that module pass on the hardware adapter without it.

I have not separated whether this comes from the change or from indirect mesh dispatch on this driver, because I did not run the same test on main. The test is new, so main has nothing to compare with. I'd treat it as "unverified on RDNA2" and not as a regression.

Unit tests only, no game files.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7186851351 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7186851351). Originally posted by [wwwwwwww3333333](https://github.com/wwwwwwww3333333) on 2026-11-26T08:38:59Z. --- AMD hardware run of 5385cc6 (on main 63bcca4). RX 6750 XT (RDNA2), driver 32.0.21045.29003, Windows 11, Rust 1.98.1. `cargo test -p victory-gpu --lib -- pipeline::host::tests::indirect_mesh_visits_each_translated_group_index --exact`, hardware adapter, three runs: - run 1: the test process died with `STATUS_STACK_BUFFER_OVERRUN` (0xC0000409); - run 2: it returned after 26.5 s with 24 zeros where the test expects 24 ones; - run 3: the same 0xC0000409 as run 1. The display went black for a moment during the first runs and came back. The same test passes on WARP (three runs out of three). The other four tests of that module pass on the hardware adapter without it. I have not separated whether this comes from the change or from indirect mesh dispatch on this driver, because I did not run the same test on main. The test is new, so main has nothing to compare with. I'd treat it as "unverified on RDNA2" and not as a regression. Unit tests only, no game files.
wwwwwwww3333333 commented 2026-11-26 10:05:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by wwwwwwww3333333 on 2026-11-26T09:23:42Z.


A note on the approval above, in case it was written from the WARP/NVIDIA result: the AMD run in my earlier comment is still the open item for 5385cc6. On the RX 6750 XT (driver 32.0.21045.29003) indirect_mesh_visits_each_translated_group_index on the hardware adapter ended with STATUS_STACK_BUFFER_OVERRUN (0xC0000409) in two of three runs and returned 24 zeros instead of 24 ones in the third, while WARP passed three out of three. I have not found the cause and I am not claiming the linearization is wrong. It is the one result I have that disagrees with the passing runs, so it may be worth another AMD or non-NVIDIA run before merging. Happy to rerun any build you want me to try.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7187911198 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7187911198). Originally posted by [wwwwwwww3333333](https://github.com/wwwwwwww3333333) on 2026-11-26T09:23:42Z. --- A note on the approval above, in case it was written from the WARP/NVIDIA result: the AMD run in my earlier comment is still the open item for 5385cc6. On the RX 6750 XT (driver 32.0.21045.29003) `indirect_mesh_visits_each_translated_group_index` on the hardware adapter ended with STATUS_STACK_BUFFER_OVERRUN (0xC0000409) in two of three runs and returned 24 zeros instead of 24 ones in the third, while WARP passed three out of three. I have not found the cause and I am not claiming the linearization is wrong. It is the one result I have that disagrees with the passing runs, so it may be worth another AMD or non-NVIDIA run before merging. Happy to rerun any build you want me to try.
steven-seagull27 commented 2026-11-26 10:05:08 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T09:57:24Z.


@wwwwwwww3333333, thanks for offering to rerun this on the RX 6750 XT. I adapted Andrew’s translated mesh fixture so you can test the same shader, pipeline, UAV and readback on upstream 63bcca43 and this PR’s 5385cc62. Each command runs one fresh process and prints all 24 counters before releasing the resources. Test commit · Download patch

RTX 5080 and Windows WARP agreed in two runs per case on each revision (24 processes total).

Dispatch Upstream base PR head
Direct (24,1,1) All 24 counters hit once All 24 hit once
Indirect (24,1,1) All 24 hit once All 24 hit once
Indirect (3,2,4) Counters 0–2 hit once, 3–23 stayed zero All 24 hit once

From your VIctory checkout in PowerShell, prepare both worktrees.

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2996-rdna2-mesh-controls
git worktree add --detach ..\mesh2996-head 338064395afd7609b894d703510f3d61230a72c6
git worktree add --detach ..\mesh2996-base 63bcca43c6a00a758510398fa43096ce7e4f7df0
git -C ..\mesh2996-base cherry-pick --no-commit 338064395afd7609b894d703510f3d61230a72c6

In the same shell, run this with $tree = 'base', then with 'head'. Hardware uses VICTORY_D3D12_WARP=0. Set it to 1 for the WARP comparison.

$tree = 'base'
$env:MESH2996_EXPECT_X_ONLY = if ($tree -eq 'base') { '1' } else { '0' }
$env:VICTORY_D3D12_WARP = '0'
$env:VICTORY_D3D12_DEBUG = '1'
foreach ($case in 'direct_24x1x1', 'indirect_24x1x1', 'indirect_3x2x4') {
    cargo test --manifest-path "..\mesh2996-$tree\Cargo.toml" --locked -p victory-gpu --features diagnostics --lib "pipeline::host::mesh2996::$case" -- --exact --nocapture --test-threads=1
    if ($LASTEXITCODE -ne 0) { break }
}

Could you share the revision, first failing case, last MESH_ line and exit code, or the three readbacks if they pass? A failure on direct dispatch would reproduce the problem without the indirect clamp. If direct passes, the one-dimensional indirect control distinguishes a general indirect failure from one specific to the three-dimensional record.

AI-assisted with Codex. Synthetic inputs only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7188706831 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7188706831). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T09:57:24Z. --- @wwwwwwww3333333, thanks for offering to rerun this on the RX 6750 XT. I adapted Andrew’s translated mesh fixture so you can test the same shader, pipeline, UAV and readback on upstream `63bcca43` and this PR’s `5385cc62`. Each command runs one fresh process and prints all 24 counters before releasing the resources. [Test commit](https://github.com/steven-seagull27/VIctory/commit/338064395afd7609b894d703510f3d61230a72c6) · [Download patch](https://github.com/steven-seagull27/VIctory/commit/338064395afd7609b894d703510f3d61230a72c6.patch) RTX 5080 and Windows WARP agreed in two runs per case on each revision (24 processes total). | Dispatch | Upstream base | PR head | |---|---|---| | Direct `(24,1,1)` | All 24 counters hit once | All 24 hit once | | Indirect `(24,1,1)` | All 24 hit once | All 24 hit once | | Indirect `(3,2,4)` | Counters 0–2 hit once, 3–23 stayed zero | All 24 hit once | From your VIctory checkout in PowerShell, prepare both worktrees. ```powershell git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2996-rdna2-mesh-controls git worktree add --detach ..\mesh2996-head 338064395afd7609b894d703510f3d61230a72c6 git worktree add --detach ..\mesh2996-base 63bcca43c6a00a758510398fa43096ce7e4f7df0 git -C ..\mesh2996-base cherry-pick --no-commit 338064395afd7609b894d703510f3d61230a72c6 ``` In the same shell, run this with `$tree = 'base'`, then with `'head'`. Hardware uses `VICTORY_D3D12_WARP=0`. Set it to `1` for the WARP comparison. ```powershell $tree = 'base' $env:MESH2996_EXPECT_X_ONLY = if ($tree -eq 'base') { '1' } else { '0' } $env:VICTORY_D3D12_WARP = '0' $env:VICTORY_D3D12_DEBUG = '1' foreach ($case in 'direct_24x1x1', 'indirect_24x1x1', 'indirect_3x2x4') { cargo test --manifest-path "..\mesh2996-$tree\Cargo.toml" --locked -p victory-gpu --features diagnostics --lib "pipeline::host::mesh2996::$case" -- --exact --nocapture --test-threads=1 if ($LASTEXITCODE -ne 0) { break } } ``` Could you share the revision, first failing case, last `MESH_` line and exit code, or the three readbacks if they pass? A failure on direct dispatch would reproduce the problem without the indirect clamp. If direct passes, the one-dimensional indirect control distinguishes a general indirect failure from one specific to the three-dimensional record. AI-assisted with Codex. Synthetic inputs only.
wwwwwwww3333333 commented 2026-11-26 11:04:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by wwwwwwww3333333 on 2026-11-26T10:37:24Z.


@steven-seagull27 thanks for the fixture. I ran it on the RX 6750 XT (RDNA2, driver 32.0.21045.29003, Windows 11) with VICTORY_D3D12_WARP=0; MESH_DEVICE reported the RX 6750 XT in the runs below.

Upstream 63bcca43 + test commit 3380643: direct_24x1x1 run 1 died with 0xC0000409 right after MESH_SUBMIT, run 2 read back all 24 counters as 0; indirect_24x1x1 the same (0xC0000409, then all zeros); indirect_3x2x4 run 1 all zeros.

PR head 5385cc6 + the same test commit, after a reboot: direct_24x1x1 died with 0xC0000409 right after MESH_SUBMIT (the script stopped there, so the other two cases were not run on the head).

So the direct dispatch already fails on this GPU on both revisions, without the indirect clamp involved. I do not know the cause. After the first failures on the base, a few runs came up on the Microsoft Basic Render Driver after the display driver reset (the display went black a few times), so I am not reporting those.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7189610891 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7189610891). Originally posted by [wwwwwwww3333333](https://github.com/wwwwwwww3333333) on 2026-11-26T10:37:24Z. --- @steven-seagull27 thanks for the fixture. I ran it on the RX 6750 XT (RDNA2, driver 32.0.21045.29003, Windows 11) with `VICTORY_D3D12_WARP=0`; `MESH_DEVICE` reported the RX 6750 XT in the runs below. Upstream 63bcca43 + test commit 3380643: `direct_24x1x1` run 1 died with 0xC0000409 right after `MESH_SUBMIT`, run 2 read back all 24 counters as 0; `indirect_24x1x1` the same (0xC0000409, then all zeros); `indirect_3x2x4` run 1 all zeros. PR head 5385cc6 + the same test commit, after a reboot: `direct_24x1x1` died with 0xC0000409 right after `MESH_SUBMIT` (the script stopped there, so the other two cases were not run on the head). So the direct dispatch already fails on this GPU on both revisions, without the indirect clamp involved. I do not know the cause. After the first failures on the base, a few runs came up on the Microsoft Basic Render Driver after the display driver reset (the display went black a few times), so I am not reporting those.
Calvix2k commented 2026-11-26 11:04:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-26T10:40:12Z.


Supporting measurement for the direction: in the prologue's heavy view the card is ~40% of the frame (94-113 ms on an RX 7800 XT), and 350-600 draws a frame are still dropped without a host pipeline. The published Kelvaroq patch series measures 58-94 ms of card time for 4,500-6,400 indirect mesh draws when each record goes through the per-record clamp (~14 us each) against ~4 us when the group count is known up front (0041, launching through an amplification stage). Numbering the groups consecutively is the cheap half of that win and does not need the new stage.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7189673485 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7189673485). Originally posted by [Calvix2k](https://github.com/Calvix2k) on 2026-11-26T10:40:12Z. --- Supporting measurement for the direction: in the prologue's heavy view the card is ~40% of the frame (94-113 ms on an RX 7800 XT), and 350-600 draws a frame are still dropped without a host pipeline. The published Kelvaroq patch series measures 58-94 ms of card time for 4,500-6,400 indirect mesh draws when each record goes through the per-record clamp (~14 us each) against ~4 us when the group count is known up front (0041, launching through an amplification stage). Numbering the groups consecutively is the cheap half of that win and does not need the new stage.
andrewpozdnakov7-jpg commented 2026-11-26 12:05:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T11:40:38Z.


Thanks for rerunning the controls on the RX 6750 XT. With the same fixture, direct (24,1,1) dispatch failed on both 63bcca43 and 5385cc6. That control runs without the indirect clamp. The run on 5385cc6 stopped at the direct case, so the indirect cases on that head remain unverified on this adapter. AMD retest

<!-- greyfinch-sync:Marvisak/VIctory:comment:7191028870 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7191028870). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T11:40:38Z. --- Thanks for rerunning the controls on the RX 6750 XT. With the same fixture, direct `(24,1,1)` dispatch failed on both `63bcca43` and `5385cc6`. That control runs without the indirect clamp. The run on `5385cc6` stopped at the direct case, so the indirect cases on that head remain unverified on this adapter. [AMD retest](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7189610891)
andrewpozdnakov7-jpg commented 2026-11-27 06:32:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T06:32:00Z.


The needs work verdict here (2026-11-26 05:44Z) predates the approving review on the current head: fuzeofficlal approved 5385cc6 at 09:05Z, after the changes requested on 9a851cd. Nothing has changed on the branch since.

Asking for a re-triage rather than a code change: the earlier request (a consecutive linearization of bounded indirect mesh groups, and the Input::MeshGroup aliasing it found) is the one 5385cc6 answers. CI is green and the PR is clean on main.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7211612951 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7211612951). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T06:32:00Z. --- The `needs work` verdict here (2026-11-26 05:44Z) predates the approving review on the current head: `fuzeofficlal` approved `5385cc6` at 09:05Z, after the changes requested on `9a851cd`. Nothing has changed on the branch since. Asking for a re-triage rather than a code change: the earlier request (a consecutive linearization of bounded indirect mesh groups, and the `Input::MeshGroup` aliasing it found) is the one `5385cc6` answers. CI is green and the PR is clean on `main`.
CQ187901 commented 2026-11-30 04:14:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by CQ187901 on 2026-11-30T04:14:39Z.


Same rule as this PR, and it holds up in practice — posting a note because it was the whole cause of a visible bug in a title we port:

What we saw. A shoreline's near-field terrain layer never drew at all, while the far band was fine. The near layer is drawn from meshlet grids, the far band is a single slice. Everything else checked out (texture waits, early depth, the terrain shaders, water coverage, upload skipping); the G-buffer for the near ground was all zeros and the depth was only the water's, i.e. no fragment was ever written because the groups that would have written them were never dispatched.

Cause. With the per-record clamp uint3(min(g.x, 65535u), min(g.y, 1u), min(g.z, 1u)), a (x, y, z) grid runs only its first slice, and the translated mesh takes its group index from SV_GroupID.x, so the other y*z - 1 slices have no way to run at all.

Fix we landed locally (same shape as here): within the per-record bound, flatten the grid to x*y*z groups, [x*y*z, 1, 1]; a grid whose product is past the bound keeps the x-only fallback. Two things worth stating for review:

  • A record past the per-dispatch bound is still an unfilled slot in the title's memory and runs empty, as before.
  • The list's budget is still charged the record's product, since that is how many groups it now really runs (records that would have been cheap before are now honest about their cost).

Verification. RTX 3070, same save, same spot, stock switches: before, the near sand was absent (looking through it to the water below); after, it renders. Nothing else changed in the picture, and the FPS cost is the extra groups that were simply never run before.

Branch with the change on top of main (one entry point there; our fork's batch path got the same rule): https://github.com/CQ187901/VIctory/tree/mesh-groups-whole

<!-- greyfinch-sync:Marvisak/VIctory:comment:7268597434 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2996#issuecomment-7268597434). Originally posted by [CQ187901](https://github.com/CQ187901) on 2026-11-30T04:14:39Z. --- Same rule as this PR, and it holds up in practice — posting a note because it was the whole cause of a visible bug in a title we port: **What we saw.** A shoreline's near-field terrain layer never drew at all, while the far band was fine. The near layer is drawn from meshlet grids, the far band is a single slice. Everything else checked out (texture waits, early depth, the terrain shaders, water coverage, upload skipping); the G-buffer for the near ground was all zeros and the depth was only the water's, i.e. no fragment was ever written because the groups that would have written them were never dispatched. **Cause.** With the per-record clamp `uint3(min(g.x, 65535u), min(g.y, 1u), min(g.z, 1u))`, a (x, y, z) grid runs only its first slice, and the translated mesh takes its group index from `SV_GroupID.x`, so the other `y*z - 1` slices have no way to run at all. **Fix we landed locally** (same shape as here): within the per-record bound, flatten the grid to `x*y*z` groups, `[x*y*z, 1, 1]`; a grid whose product is past the bound keeps the x-only fallback. Two things worth stating for review: - A record past the per-dispatch bound is still an unfilled slot in the title's memory and runs empty, as before. - The list's budget is still charged the record's product, since that is how many groups it now really runs (records that would have been cheap before are now honest about their cost). **Verification.** RTX 3070, same save, same spot, stock switches: before, the near sand was absent (looking through it to the water below); after, it renders. Nothing else changed in the picture, and the FPS cost is the extra groups that were simply never run before. Branch with the change on top of `main` (one entry point there; our fork's batch path got the same rule): https://github.com/CQ187901/VIctory/tree/mesh-groups-whole
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/2996:upstream-pr/2996'
git switch 'upstream-pr/2996'

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/2996'
git switch 'upstream-pr/2996'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2996'
git switch 'upstream-pr/2996'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2996'
git switch 'main'
git merge --squash 'upstream-pr/2996'
git switch 'main'
git merge --ff-only 'upstream-pr/2996'
git switch 'main'
git merge 'upstream-pr/2996'
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!2994
No description provided.