GPU: forward all direct mesh dispatch group counts #2624

Open
github-bot wants to merge 4 commits from github-bot/gh-2624 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 17:02 UTC · original
andrewpozdnakov7-jpg:codex1/mesh-dispatch-dimensions → main · +204 −13 · 3 files · 4 commits · draft

Direct List6 DispatchMesh forwards only X and substitutes 1 for Y and Z. For example, a 2 × 3 × 4 dispatch launches two groups. Forward the three group counts. Direct DispatchMeshX still supplies a one-dimensional grid. D3D12 mesh dispatch

The regression records the calls through VIctory's list vtable. A native D3D12 pipeline-statistics query counts invocations of a synthetic one-thread mesh shader on WARP. The fixture locates the entry points in the active guest list layout.

Call Main 63bcca4 Patch 22f5207
DispatchMesh(2, 1, 1) 2 2
DispatchMesh(2, 3, 1) 2 6
DispatchMesh(2, 1, 4) 2 8
DispatchMesh(2, 3, 4) 2 24
DispatchMesh(2, 0, 4) 2 0
Direct DispatchMeshX(2, …) 2 2

The same test failed six times on main and passed each time with the patch. The full WARP GPU suite passed with 247 tests and one ignored under both D3D12 debug settings. Strict GPU Clippy in both configurations and repository policy passed. The project shader emitter generates the synthetic shader in-process. The test needs a host with mesh pipeline statistics. AI-assisted. Synthetic tests only.

The patch leaves indirect DispatchMeshX to #1546 and #1749. #24 also edits direct dispatch and would need a conflict resolution in list.rs.

Coordination claim

Please preserve the Git author when reapplying the change. If you fold the code or test into another commit, please add this trailer.

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

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 17:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/2624) `andrewpozdnakov7-jpg:codex1/mesh-dispatch-dimensions` → `main` · +204 −13 · 3 files · 4 commits · draft Direct List6 DispatchMesh forwards only X and substitutes 1 for Y and Z. For example, a 2 × 3 × 4 dispatch launches two groups. Forward the three group counts. Direct DispatchMeshX still supplies a one-dimensional grid. [D3D12 mesh dispatch](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html) The regression records the calls through VIctory's list vtable. A native D3D12 pipeline-statistics query counts invocations of a synthetic one-thread mesh shader on WARP. The fixture locates the entry points in the active guest list layout. | Call | Main 63bcca4 | Patch 22f5207 | | --- | --- | --- | | DispatchMesh(2, 1, 1) | 2 | 2 | | DispatchMesh(2, 3, 1) | 2 | 6 | | DispatchMesh(2, 1, 4) | 2 | 8 | | DispatchMesh(2, 3, 4) | 2 | 24 | | DispatchMesh(2, 0, 4) | 2 | 0 | | Direct DispatchMeshX(2, …) | 2 | 2 | The same test failed six times on main and passed each time with the patch. The full WARP GPU suite passed with 247 tests and one ignored under both D3D12 debug settings. Strict GPU Clippy in both configurations and repository policy passed. The project shader emitter generates the synthetic shader in-process. The test needs a host with mesh pipeline statistics. AI-assisted. Synthetic tests only. The patch leaves indirect DispatchMeshX to #1546 and #1749. #24 also edits direct dispatch and would need a conflict resolution in list.rs. [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) Please preserve the Git author when reapplying the change. If you fold the code or test into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:10:35 +00:00
Author
Owner

@⁠Bj0rnis on GitHub · 2026-11-25 17:32 UTC · original

Independent Windows 11 hardware + WARP verification of #2624 at 827fbf89 (clean git merge-tree with origin/main 13f91cae, Rust 1.98.1 MSVC):

  • NVIDIA GeForce RTX 5070 Ti (real hardware): cargo test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1 -> 197 passed, 2 failed, 1 ignored (2.89s; includes the new test, only the 2 pre-existing #1744 NVIDIA 1M view-heap baseline failures also present on main 13f91cae).
  • WARP (VICTORY_D3D12_WARP=1): 199 passed, 0 failed, 1 ignored (1.76s).
  • Clippy: cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings -> 0 warnings.
  • Asset policy: cargo xtask policy -> 184 files ok.

Not tested: live game workload.

AI-assisted test run and summary.

**@⁠Bj0rnis** on GitHub · 2026-11-25 17:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2624#issuecomment-7169655471) Independent Windows 11 hardware + WARP verification of #2624 at `827fbf89` (clean `git merge-tree` with `origin/main` `13f91cae`, Rust 1.98.1 MSVC): - **NVIDIA GeForce RTX 5070 Ti (real hardware):** `cargo test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1` -> **197 passed, 2 failed, 1 ignored** (2.89s; includes the new test, only the 2 pre-existing #1744 NVIDIA 1M view-heap baseline failures also present on `main` `13f91cae`). - **WARP (`VICTORY_D3D12_WARP=1`):** **199 passed, 0 failed, 1 ignored** (1.76s). - **Clippy:** `cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings` -> **0 warnings**. - **Asset policy:** `cargo xtask policy` -> **184 files ok**. Not tested: live game workload. AI-assisted test run and summary.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 17:45 UTC · original

Reviewed: forwards the real (x, y, z) to DispatchMesh instead of forcing 1x1, indirect path keeps (x,1,1) as before. The old once-warn on y*z!=1 is correctly gone since it now works. CI green.

**@⁠kotekompotek** on GitHub · 2026-11-25 17:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/2624#issuecomment-7169947317) Reviewed: forwards the real (x, y, z) to `DispatchMesh` instead of forcing 1x1, indirect path keeps (x,1,1) as before. The old once-warn on y*z!=1 is correctly gone since it now works. CI green.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:15 UTC · original · edited 2026-11-26 03:23 UTC

Automated triage for the maintainers.

Verdict: merge candidate (changed from needs work). Re-reviewed at 22f5207, which merges cleanly into main. The fix is unchanged: State::dispatch_mesh in crates/victory-gpu/src/draw.rs passes the caller's x, y, z to DispatchMesh, the List6 dispatch_mesh in list.rs forwards all three, and the direct DispatchMeshX path keeps (x, 1, 1).

On your reply: confirmed. direct_mesh_dispatch_uses_all_group_counts in crates/victory-gpu/src/pipeline/host.rs now builds a one-thread synthetic mesh program (s_endpgm only) through the crate's own ir/structure/emit path. It no longer writes HLSL or spawns dxc.exe, and reads no environment variable, which was the only reason for the previous verdict. It skips cleanly where mesh shaders or mesh pipeline statistics are unavailable. The expected MSInvocations [2, 6, 8, 24, 0, 2] match the group grids it dispatches.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2624#issuecomment-7176135362) · edited 2026-11-26 03:23 UTC <!-- victory-triage v1 head=22f5207f2c50c81e02764929b1273701db81dd45 verdict=merge-candidate at=2026-11-26T03:23:48Z --> Automated triage for the maintainers. **Verdict: merge candidate** (changed from needs work). Re-reviewed at `22f5207`, which merges cleanly into `main`. The fix is unchanged: `State::dispatch_mesh` in `crates/victory-gpu/src/draw.rs` passes the caller's `x, y, z` to `DispatchMesh`, the List6 `dispatch_mesh` in `list.rs` forwards all three, and the direct `DispatchMeshX` path keeps `(x, 1, 1)`. On your reply: confirmed. `direct_mesh_dispatch_uses_all_group_counts` in `crates/victory-gpu/src/pipeline/host.rs` now builds a one-thread synthetic mesh program (`s_endpgm` only) through the crate's own `ir`/`structure`/`emit` path. It no longer writes HLSL or spawns `dxc.exe`, and reads no environment variable, which was the only reason for the previous verdict. It skips cleanly where mesh shaders or mesh pipeline statistics are unavailable. The expected `MSInvocations` `[2, 6, 8, 24, 0, 2]` match the group grids it dispatches. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 22:39 UTC · original

I resolved the test-module conflict in 14c1fc2. The mesh-dispatch test and the new upstream test both pass.

The same six guest vtable calls on f3578e3 report [2, 2, 2, 2, 2, 2] mesh shader invocations. The updated branch reports [2, 6, 8, 24, 0, 2]. This covers the X-only and Xbox calls and the Y, Z and zero-axis controls. Six paired WARP runs, both serial GPU suites at 244 passed and one ignored, strict Clippy, and asset policy passed.

Please retain the Git author on cherry-pick or rebase. If folding the fix or test into another commit, please add this trailer.

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

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 22:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/2624#issuecomment-7176630898) I resolved the test-module conflict in [14c1fc2](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/14c1fc285569ec1be0722214829788c3f9c8a283). The mesh-dispatch test and the new upstream test both pass. The same six guest vtable calls on `f3578e3` report `[2, 2, 2, 2, 2, 2]` mesh shader invocations. The updated branch reports `[2, 6, 8, 24, 0, 2]`. This covers the X-only and Xbox calls and the Y, Z and zero-axis controls. Six paired WARP runs, both serial GPU suites at 244 passed and one ignored, strict Clippy, and asset policy passed. Please retain the Git author on cherry-pick or rebase. If folding the fix or test into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 22:59 UTC · original

Updated this branch after #158 changed the command-list table tests. Commit 498b5c1df87242b38731cf1137574abe83dc0941 retains the previous tested head and uses the table that belongs to the test list to locate the guest dispatch entry points.

The same WARP statistics test on base 842b0cb76f8f5fa9289bd779783c51ec24d75302 reports [2, 2, 2, 2, 2, 2]; with the patch it checks [2, 6, 8, 24, 0, 2]. Both upstream depth-bounds tests also pass. Full GPU suite: 247 passed, 1 ignored, with each D3D12 debug setting. Strict GPU Clippy in both configurations and asset policy passed.

If you cherry-pick the fix or test, please preserve the Git author. If you fold the work into another commit, please include Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 22:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2624#issuecomment-7177010642) Updated this branch after #158 changed the command-list table tests. Commit `498b5c1df87242b38731cf1137574abe83dc0941` retains the previous tested head and uses the table that belongs to the test list to locate the guest dispatch entry points. The same WARP statistics test on base `842b0cb76f8f5fa9289bd779783c51ec24d75302` reports `[2, 2, 2, 2, 2, 2]`; with the patch it checks `[2, 6, 8, 24, 0, 2]`. Both upstream depth-bounds tests also pass. Full GPU suite: 247 passed, 1 ignored, with each D3D12 debug setting. Strict GPU Clippy in both configurations and asset policy passed. If you cherry-pick the fix or test, please preserve the Git author. If you fold the work into another commit, please include `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 00:49 UTC · original

22f5207 addresses the test review. The fixture builds a one-thread synthetic mesh shader with VIctory's in-process shader emitter. It binds a guest view heap through the list vtable and uses the normal sampler fallback. The dispatch fix and statistics query are unchanged.

In six paired Windows/WARP runs with the same fixture and no external compiler, 63bcca43c6a00a758510398fa43096ce7e4f7df0 reported [2, 2, 2, 2, 2, 2] and the updated head reported [2, 6, 8, 24, 0, 2]. Both depth-bounds tests pass. Full WARP GPU suite, 247 passed and one ignored under each D3D12 debug setting. Strict GPU Clippy in both configurations and asset policy passed.

Please retain the Git author on cherry-pick. If folding the fix or test into another commit, please include Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 00:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/2624#issuecomment-7179148574) [22f5207](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/22f5207f2c50c81e02764929b1273701db81dd45) addresses [the test review](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2624). The fixture builds a one-thread synthetic mesh shader with VIctory's in-process shader emitter. It binds a guest view heap through the list vtable and uses the normal sampler fallback. The dispatch fix and statistics query are unchanged. In six paired Windows/WARP runs with the same fixture and no external compiler, `63bcca43c6a00a758510398fa43096ce7e4f7df0` reported `[2, 2, 2, 2, 2, 2]` and the updated head reported `[2, 6, 8, 24, 0, 2]`. Both depth-bounds tests pass. Full WARP GPU suite, 247 passed and one ignored under each D3D12 debug setting. Strict GPU Clippy in both configurations and asset policy passed. Please retain the Git author on cherry-pick. If folding the fix or test into another commit, please include `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 03:59 UTC · original

I found a correctness problem in this head that the pipeline-statistics test cannot see. I am putting this PR back in draft.

I ran the same one-thread translated mesh program on 63bcca4 and 22f5207. It reads the guest mesh-group input and atomically increments that group's counter. The guest List6 command recorded DispatchMesh(3, 2, 4), and the submitted WARP work produced:

Revision GPU readback
63bcca4 [1, 1, 1, 0, ...]
22f5207 [8, 8, 8, 0, ...] in all six runs

Input::MeshGroup multiplies SV_GroupID.x by the mesh stride. The extra Y/Z groups therefore revisit the first three indices and leave the other 21 counters untouched. This is the same lowering interaction caught in #2996's indirect path. The per-axis D3D12 bound also means a single X-only call cannot cover every valid direct grid. The D3D12 specification defines the host limit. We still need the direct guest mesh-group numbering for a multi-axis call or an implementation that carries the grid dimensions all the way to lowering and can be checked against that contract.

AI-assisted with Codex. Synthetic Windows/WARP tests.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 03:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/2624#issuecomment-7182199157) I found a correctness problem in this head that the pipeline-statistics test cannot see. I am putting this PR back in draft. I ran the same one-thread translated mesh program on `63bcca4` and `22f5207`. It reads the guest mesh-group input and atomically increments that group's counter. The guest List6 command recorded DispatchMesh(3, 2, 4), and the submitted WARP work produced: | Revision | GPU readback | | --- | --- | | `63bcca4` | [1, 1, 1, 0, ...] | | `22f5207` | [8, 8, 8, 0, ...] in all six runs | `Input::MeshGroup` multiplies `SV_GroupID.x` by the mesh stride. The extra Y/Z groups therefore revisit the first three indices and leave the other 21 counters untouched. This is the same lowering interaction caught in #2996's indirect path. The per-axis D3D12 bound also means a single X-only call cannot cover every valid direct grid. The [D3D12 specification](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html#dispatchmesh-api) defines the host limit. We still need the direct guest mesh-group numbering for a multi-axis call or an implementation that carries the grid dimensions all the way to lowering and can be checked against that contract. AI-assisted with Codex. Synthetic Windows/WARP tests.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2624'
git switch 'github-bot/gh-2624'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2624'
git switch 'github-bot/gh-2624'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2624'
git switch 'main'
git merge --squash 'github-bot/gh-2624'
git switch 'main'
git merge --ff-only 'github-bot/gh-2624'
git switch 'main'
git merge 'github-bot/gh-2624'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2624
No description provided.