Repository navigation
GPU: number bounded indirect mesh groups consecutively - #2996
andrewpozdnakov7-jpg wants to merge 2 commits into
Conversation
kotekompotek
left a comment
There was a problem hiding this comment.
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.
|
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
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. |
|
Independent Windows WARP test run of Setup. Software only. Command. Local probes (not pushed). They run the production clamp through
Counts.
AI-assisted: Claude Code (Claude Opus 5.5), coordinated by Codex (gpt-6.2-sol). |
fuzeofficlal
left a comment
There was a problem hiding this comment.
Code review on 9a851cd3 (static source inspection; no runtime GPU execution):
- High — Multi-axis indirect mesh grids alias
SV_GroupID.xacross 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 toExecuteIndirect(draw.rs:1811). - However,
emit/lower.rs:1498-1504still lowersInput::MeshGroupstrictly asgroupId.i32(0) * mesh_stride(SV_GroupID.x * mesh_stride), ignoringSV_GroupID.yandSV_GroupID.z. - For a grid like
(3, 2, 4), the host launches 24 threadgroups, but every(y, z)slice receives the same threeMeshGroupindices (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 consumingInput::MeshGroup. - Please verify the console's multi-axis mesh group numbering and either lower
Input::MeshGroupacross(x, y, z)or linearize the grid before launching multi-axisDispatchMeshgrids (with a mesh-shader execution test consumingInput::MeshGroup).
- Keeping all three grid axes
|
I reproduced the repeated indices from your review using a translated mesh program that reads 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 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 andrewpozdnakov7-jpg@users.noreply.github.com AI-assisted with Codex. |
|
@andrewpozdnakov7-jpg I verified |
|
Automated triage for the maintainers. Verdict: needs work. The change is in the mesh arm of the clamp shader in What's missing is evidence about the console. The comment this replaces on To change the verdict, show one of:
With either, this is a clear fix. The budget accounting part is independently sound. CI: passing ( Generated by Claude Code |
|
AMD hardware run of 5385cc6 (on main 63bcca4). RX 6750 XT (RDNA2), driver 32.0.21045.29003, Windows 11, Rust 1.98.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. |
fuzeofficlal
left a comment
There was a problem hiding this comment.
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]incrates/victory-gpu/src/indirect.rs, giving each translatedMeshGroupa distinct consecutive index while preserving overflow-safe bounds checks (g.x * g.yfits inu32onceg <= 65535, zero axes yield[0, 1, 1]with cost0, oversized grids keep the existing fallback, and the list budget charges128per group). pipeline::host::tests::indirect_mesh_visits_each_translated_group_indexexecutes a translated GFX10 mesh shader readingInput::MeshGroupthroughState::execute_indirectand 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_index3/3 passed - RTX 5090 +
VICTORY_D3D12_DEBUG=1(--features diagnostics):indirect_mesh_visits_each_translated_group_index1/1 passed - WARP +
VICTORY_D3D12_DEBUG=1(--features diagnostics,VICTORY_D3D12_WARP=1):indirect::+indirect_mesh_visits_each_translated_group_index8/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.
|
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) |
|
@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 RTX 5080 and Windows WARP agreed in two runs per case on each revision (24 processes total).
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 338064395afd7609b894d703510f3d61230a72c6In the same shell, run this with $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 AI-assisted with Codex. Synthetic inputs only. |
|
@steven-seagull27 thanks for the fixture. I ran it on the RX 6750 XT (RDNA2, driver 32.0.21045.29003, Windows 11) with Upstream 63bcca4 + test commit 3380643: PR head 5385cc6 + the same test commit, after a reboot: 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. |
|
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. |
|
Thanks for rerunning the controls on the RX 6750 XT. With the same fixture, direct |
Regression test for the case reported on Marvisak#3197 together with Marvisak#2996 (5385cc6).
The window's pass carried its own copy of the mesh bounds; a change to the single clamp's rule (Marvisak#2996, 5385cc6) left the window on the old one and dropped mesh groups (reported on Marvisak#3197). Both shaders now take the rule from one HLSL function.
Indirect mesh commands carry three group counts. VIctory's translated mesh input
MeshGroupreads the host'sSV_GroupID.xand 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.9a851cd, through the ordinaryState::execute_indirectpath: an atomic counter for eachMeshGrouprecords eight hits in each of the first three slots and zero in the remaining 21.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.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 andrewpozdnakov7-jpg@users.noreply.github.com
AI-assisted with Codex. Synthetic GPU inputs.