GPU: number bounded indirect mesh groups consecutively #2996
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2996
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2996"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 02:48 UTC · original
andrewpozdnakov7-jpg:codex1/indirect-mesh-grid→main· +170 −12 · 2 files · 2 commits · openIndirect 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 [email protected]
AI-assisted with Codex. Synthetic GPU inputs.
@steven-seagull27 on GitHub · 2026-11-26 03:01 UTC · original
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 nativeDispatchMeshwith the production clamp followed byExecuteIndirect, then checked all 64 coordinate counters against CPU enumeration. The largest grid dimension was four.63bcca439a851cd3(3,2,4), 12-byte stride(2,3,1)and(1,1,2), 16-byte strideBoth 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 on GitHub · 2026-11-26 03:02 UTC · original
Independent Windows WARP test run of
9a851cd3c00d94fcf13b9825d1b98673a1de0cf5, compared with its exact parent63bcca43c6a00a758510398fa43096ce7e4f7df0. This reports test results only, not a review verdict.Setup. Software only.
VICTORY_D3D12_WARP=1andVICTORY_WARP=1, built with--features diagnostics(WARP selection in victory-gpu is behind that feature).VICTORY_DXILpointed at the Windows SDK 10.0.26100.0 x64dxil.dll, but the victory-gpu lib tests never loaded it: a probe found nodxil.dllmodule in the process. Before any dispatch, each probe checked that the host device's adapter LUID matchesEnumWarpAdapter:Microsoft Basic Render Driver, vendor0x1414, device0x8c, 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/doneand read back all three words of every mesh record:63bcca49a851cd3[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]andu32::MAX³→[65535,1,1][5,1,1], …,[65535,1,0])[32,32,32](32,768 groups each) against the 2^20-group list budget: exactly 32 run, 8 run empty[32,1,1][64,64,8]: the second call has 12 left[65535,2,1]charged at the fallback size, 16 runCounts.
indirect::on the head: 11 passed (the 7 module tests, includingmesh_clamp_keeps_group_grid_and_charges_all_axes, plus the 4 probes).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.AI-assisted: Claude Code (Claude Opus 5.5), coordinated by Codex (gpt-6.2-sol).
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 03:37 UTC · original
I reproduced the repeated indices from your review using a translated mesh program that reads
Input::MeshGroupand atomically adds to a counter for that group. The program runs through VIctory's normal indirect execution path. The same3×2×4record touches only the first three counters, eight times each, on9a851cd.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.
@steven-seagull27 on GitHub · 2026-11-26 04:07 UTC · original
@andrewpozdnakov7-jpg I verified
5385cc6with 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@Marvisak on GitHub · 2026-11-26 05:44 UTC · original
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 testindirect_mesh_visits_each_translated_group_index(pipeline/host.rs) shows each translatedMeshGroupindex visited once for a(3,2,4)record. The HLSL looks right:x*ycan't overflow once each axis is at most 65,535, and the total is checked by dividing byz.What's missing is evidence about the console. The comment this replaces on
mainsays the console's mesh dispatches are one-dimensional. If that holds,y = z = 1and 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:
yorzabove 1, for example fromVICTORY_DUMP_ARGUMENTS-style logging or the frame trace;With either, this is a clear fix. The budget accounting part is independently sound.
CI: passing (
check).Generated by Claude Code
@kotekompotek on GitHub · 2026-11-26 02:58 UTC · original · approved these changes
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). Theclamped_wordsrefactor assertingfields <= perkeeps the read-back honest.@fuzeofficlal on GitHub · 2026-11-26 03:07 UTC · original · requested changes
Code review on
9a851cd3(static source inspection; no runtime GPU execution):SV_GroupID.xacross all Y/Z slices (crates/victory-gpu/src/indirect.rs,crates/victory-shader/src/emit/lower.rs:1498-1504):(x, y, z)in the clamped argument buffer passes multi-axis grids directly toExecuteIndirect(draw.rs:1811).emit/lower.rs:1498-1504still lowersInput::MeshGroupstrictly asgroupId.i32(0) * mesh_stride(SV_GroupID.x * mesh_stride), ignoringSV_GroupID.yandSV_GroupID.z.(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.Input::MeshGroupacross(x, y, z)or linearize the grid before launching multi-axisDispatchMeshgrids (with a mesh-shader execution test consumingInput::MeshGroup).@wwwwwwww3333333 on GitHub · 2026-11-26 08:38 UTC · original
AMD hardware run of
5385cc6(on main63bcca4). 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:STATUS_STACK_BUFFER_OVERRUN(0xC0000409);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 on GitHub · 2026-11-26 09:05 UTC · original · approved these changes
5385cc62cleanly addresses theInput::MeshGroupaliasing issue from the earlier review on9a851cd3:[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): cleanindirect::7/7 passed;indirect_mesh_visits_each_translated_group_index3/3 passedVICTORY_D3D12_DEBUG=1(--features diagnostics):indirect_mesh_visits_each_translated_group_index1/1 passedVICTORY_D3D12_DEBUG=1(--features diagnostics,VICTORY_D3D12_WARP=1):indirect::+indirect_mesh_visits_each_translated_group_index8/8 passedcargo 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 on GitHub · 2026-11-26 09:23 UTC · original
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_indexon 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 on GitHub · 2026-11-26 09:57 UTC · original
@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
63bcca43and this PR’s5385cc62. Each command runs one fresh process and prints all 24 counters before releasing the resources. Test commit · Download patchRTX 5080 and Windows WARP agreed in two runs per case on each revision (24 processes total).
(24,1,1)(24,1,1)(3,2,4)From your VIctory checkout in PowerShell, prepare both worktrees.
In the same shell, run this with
$tree = 'base', then with'head'. Hardware usesVICTORY_D3D12_WARP=0. Set it to1for the WARP comparison.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 on GitHub · 2026-11-26 10:37 UTC · original
@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_DEVICEreported the RX 6750 XT in the runs below.Upstream
63bcca43+ test commit 3380643:direct_24x1x1run 1 died with 0xC0000409 right afterMESH_SUBMIT, run 2 read back all 24 counters as 0;indirect_24x1x1the same (0xC0000409, then all zeros);indirect_3x2x4run 1 all zeros.PR head
5385cc6+ the same test commit, after a reboot:direct_24x1x1died with 0xC0000409 right afterMESH_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 on GitHub · 2026-11-26 10:40 UTC · original
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 on GitHub · 2026-11-26 11:40 UTC · original
Thanks for rerunning the controls on the RX 6750 XT. With the same fixture, direct
(24,1,1)dispatch failed on both63bcca43and5385cc6. That control runs without the indirect clamp. The run on5385cc6stopped at the direct case, so the indirect cases on that head remain unverified on this adapter. AMD retestView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.