Skip to content

GPU: budget indirect mesh emulation work - #53

Open
Personed wants to merge 4 commits into
mainfrom
fix/mesh-indirect-budget
Open

Personed wants to merge 4 commits into
mainfrom
fix/mesh-indirect-budget

Conversation

@Personed

@Personed Personed commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Prepare indirect mesh work directly from the original argument and count buffers; no generic clamp scratch is used on this path.
  • Charge the shared per-list budget only for compacted groups that fit in the emulation output chunk.
  • Bound record scanning, invalidate the cached indirect draw window, and keep preparation/mesh pipeline state transitions balanced.

Validation

  • Added a WARP regression covering CPU- and GPU-produced count buffers, source immutability, compacted slot-map IDs, repeated over-cap mesh batches, and a later indirect dispatch in the same list.
  • git diff --check passed and rustfmt parsed the edited Rust files.
  • CI and Devin review passed on the previous head; the slot-map assertion is a follow-up and its CI/review are pending.
  • Local Windows compilation is blocked by missing link.exe / Visual C++ Build Tools; RX 580 runtime/FPS measurements remain pending.

@Personed

Copy link
Copy Markdown
Owner Author

@devin-ai-integration Focused review request: please verify that the emulated mesh path applies the existing per-list indirect budget through indirect::bound, including count-buffer reads and the 65,535-record/slot-map bounds; audit the scratch-state sequence INDIRECT_ARGUMENT → UAV → COMMON and every failure return; and confirm clearing self.window prevents reuse of overwritten indirect scratch. Please also assess whether charging the per-record clamped count before the prep pass overcharges work when group_cap is smaller than 65,535.

devin-ai-integration[bot]

This comment was marked as resolved.

@Personed
Personed force-pushed the fix/mesh-indirect-budget branch from 7634fef to 1262ee1 Compare November 25, 2026 08:16
@Personed

Copy link
Copy Markdown
Owner Author

@devin-ai-integration Please re-review the updated head 1262ee1 focusing on: (1) the prep pass now reads source args/count in UAV state directly, with no prior SRV clamp, and uses a UAV barrier for a GPU-written count; (2) the per-list budget charges only groups retained by group_cap; (3) the WARP regression test runs 16 over-cap mesh preps followed by an indirect dispatch for both CPU- and GPU-produced counts; and (4) cached draw-window and PSO/root cache handling on success/failure paths.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 2 new potential issues.

Devin Review

Comment thread crates/victory-gpu/src/indirect.rs Resolved
Comment on lines 3431 to +3436
list,
args.gpu(arguments),
count_gpu,
budget_gpu,
stride,
max,
record_count,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 A descrição do PR não corresponde ao caminho dos buffers

A descrição diz que a emulação usa o buffer temporário do clamp e o devolve a COMMON. A preparação lê diretamente os buffers de origem, que têm requisitos de sincronização diferentes.

(Refers to this code)

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@Personed

Copy link
Copy Markdown
Owner Author

@devin-ai-integration Please review head 42200c8. I fixed the WARP test so the counted case has 5 groups in record 0 and 65,535 in record 1 (count=1), then separately runs 16 uncounted over-cap prep passes before a 64-group indirect dispatch. Assertions cover emitted mesh work, exact shared-budget usage, source immutability, CPU/GPU count producers, and the follow-up dispatch. I also corrected the PR body to describe direct source-buffer prep (no generic clamp scratch). Please confirm the state/budget/cache findings are addressed.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

Comment on lines +946 to +956
transition(
&slot_map,
D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,
),
]);
warp.list.SetComputeRootSignature(&warp.worker.root);
warp.list.SetPipelineState(&warp.worker.pso);
warp.list.SetComputeRootUnorderedAccessView(0, hits_gpu);
warp.list
.ExecuteIndirect(&signature, 1, &prepared, 0, None, 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 O teste WARP não verifica o mapa de slots

O shader de teste conta os grupos, mas não lê o mapa de slots. O teste passaria mesmo se os 16 slots viessem do segundo registro, em vez de cinco do primeiro e 11 do segundo.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@Personed

Copy link
Copy Markdown
Owner Author

@devin-ai-integration Please re-review head 480f0a7. I now assert the final 16 slot_map entries are [0,1,2,3,4,0,1,2,3,4,5,6,7,8,9,10], checking record-local group IDs across the 5+11 compaction. All prior findings were addressed; please confirm this closes the remaining map-test gap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant