Repository navigation
Conversation
|
Independent Windows 11 hardware + WARP verification of #2472 at
Not tested: live game workload / frame-time benchmark ( AI-assisted test run and summary. |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:
- Hoisting and batching indirect argument clamps into the list prelude passes all 11 live GPU indirect tests and draw tests cleanly under both default and
diagnosticsbuilds. cargo test -p victory-gpu indirect::: 11/11 passed on RTX 5090, 11/11 passed on WARP (1 benchmark ignored).cargo test -p victory-gpu draw::tests: 5/5 passed on RTX 5090.cargo clippy -p victory-gpu --all-targets -- -D warnings(both default and--features diagnostics): 0 warnings.cargo xtask policy: 183 files ok.
AI-assisted (Gemini 4 Neon).
catminou4
left a comment
There was a problem hiding this comment.
Hoist and batch indirect argument clamps (+973). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Large perf change; needs hardware validation.
|
Tested
Points that may matter as other PRs land:
The title was not used in these tests. AI-assisted |
|
Thanks for the RTX 5090, RTX 5070 Ti, and WARP / equivalence / benchmark verification @DenRakEiw, @Bj0rnis, and @r4tedx! Addressed point #2 from @r4tedx in
(Note on point #1: once #2168's count_buf clamp lands on main, we can trivially extend the packed job descriptor with has_count / count_offset + count_buf SRV binding.) |
|
Tested on Windows with AMD Ryzen 5 5600X + NVIDIA GeForce RTX 4060:
All existing and new tests in this branch pass on RTX 4060; the only 2 failures are the known 1,000,000 view heap cap tests ( |
1b1fedd to
187db6f
Compare
|
Automated triage for the maintainers. Merge candidate (kept). Re-reviewed at
These are all safety fixes. The clamp bounds and in-order budget charging still match The known differences are still worth a maintainer's note. A hoisted draw that is dropped no longer charges the budget. After #2168, the batched path would need its own count-aware charge. The speedup comes from synthetic benchmarks only. Merges cleanly; CI: Generated by Claude Code |
|
Rebased onto
Thanks also to @Vedoxdev123 for the RTX 4060 run! |
|
Traced the full path; the design is sound and the hazards I went looking for are covered:
|
…g & shared indirect rendering scopes - Replace per-ExecuteIndirect vkCreateBuffer/vkAllocateMemory in IndirectDispatchCounter::Batch with a persistent per-slot/per-queue reusable device-local ring buffer (64 KiB initial, 16-byte aligned bump suballocation, 2x growth with overflow retention until GPU completion, reset_for_reuse() frees overflow rings and zeroes cursor; bounded pool of 8 rings on VulkanQueue for ZERO vkAllocateMemory per frame in steady state). Adapted from fxceless/victory-fork#1000 (PiloteCode, GPL-3.0). - Add IndirectDispatchCounter::emit_batch() emitting 1 before-barrier, 1 compute pipeline bind, N back-to-back disjoint dispatches, and 1 tightly-scoped COMPUTE_SHADER -> DRAW_INDIRECT after-barrier (replacing per-draw ALL_COMMANDS -> COMPUTE / COMPUTE -> ALL_COMMANDS barriers). - Add plan_indirect_clamp_batches() in vulkan_replay.h to hoist and batch indirect clamps across contiguous barrier-free draw runs (ExecuteIndirect DRAW/DRAW_INDEXED and Draw mesh_indirect) and indirect dispatch runs ahead of the rendering scope, keeping compatible indirect and direct draws inside one unbroken dynamic rendering scope (#1877). Adapted from Marvisak/VIctory#2472 (ESAT586, GPL-3.0) and fxceless/victory-fork#1000 (GPL-3.0). - Verify ubiquitarianism/leonida#1929 (zero-Z mesh draw drop in CommandList::draw(Draw&&)) is already superseded by CommandList::has_draw_work() and add explicit regression coverage. - Add unit and live-GPU validation tests for zero-alloc steady-state ring reuse, 2x growth, pre-scope clamp batching with unbroken rendering scopes, and multi-frame GPU parity.
|
Thanks for the thorough trace and verification, @kotekompotek! Updated the PR description to match the current non-destructive scratch design (removing the obsolete BTreeMap overlap-check description from the pre-315cea1 in-place revision). Good catch on 65535² < 2^32 headroom as well. |
|
Code review (same-list GPU-write hazard audit) and RTX 5090 + WARP verification at head
Hazard boundaries are airtight and hardware/WARP runs are clean; LGTM. |
|
Independent verification of CI checks & synthetic GPU benchmark:
Live title run (release build, warm shader & pipeline cache):
The run later ended in an unrelated title-side access violation ( No game data, shader names, or screenshots are included, per |
… chunk buffer Port of RVZO6 Marvisak#2168 onto the hoisted bound_chunk model (our always-hoist chunk-hoist is already landed; Marvisak#2168 targets the old per-call bound() and does not apply). Picks the small clamp PR over Marvisak#2472 (1.1k-line prelude batch pass, no hardware A/B available) and Marvisak#242 (conflicting branch). - bound_chunk: leading global NULL-resource UAV flush becomes targeted barriers on each clamp's argument copy (deduplicated) and any distinct count buffer; per-request trailing global barrier becomes a barrier on the shared budget only. Same order, same transitions. - Zero-record requests run no dispatch and need no barriers; their slice is never read. execute_indirect with max == 0 skips refresh, clamp and execution entirely, counting the draw/dispatch. - HostList::budget now hands out the budget buffer with its address, for the targeted budget barrier. - The chunk clamps into slices of one argument buffer at increasing 16-byte offsets (was: every request at offset 0 of the same cached buffer, so every execution of a multi-request chunk read the last clamp's records, and transitions mismatched under the debug layer). run_pending executes at the request's offset; done_chunk reverts once. - Test: chunk_scopes_uav_barriers_and_zero_records (barrier scope, slice offsets, transition balance via replay).
|
The batch prelude needs the same mesh-grid rule as #2996 when these two patches meet. I tested the clean merge of On the merged tree, a single valid In the scratch build I applied #2996's bounded-grid decision to the mesh branch reading The change is now available as a single cherry-pick on top of the two PRs. It credits the original mesh-grid implementation and adds an explicit |
|
@andrewpozdnakov7-jpg’s translated mesh-group fix changes what #2472 should put into the precomputed argument buffer. The earlier integration preserved the three grid dimensions. VIctory supplies the translated mesh shader with a scalar group index derived from X. If the batch kernel preserves Y and Z after the inline kernel has started flattening the grid, it schedules the right number of groups with repeated indices. I merged the original commits and compared direct scalar-index dispatch, inline clamping and batch clamping. The table counts distinct scalar indices touched, with every one of the 64 counters checked. RTX 5080 and Windows WARP gave the same results in two fresh processes each.
Multiple records start numbering at zero, so a correct counter can receive more than one hit. For the single record the old batch hit the same three counters eight times. The corrected batch hit each of 24 counters once. On RTX I also ran a read-only translated mesh shader through the normal Integration commit. The branch includes both PRs, the earlier batch integration, and the original git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2472-translated-mesh-groupsAI-assisted with Codex. Synthetic draws and readbacks. |
|
ran this in the title on an rx 9070 xt, merged onto 63bcca4 plus #2122 (this card's driver crashes in its shader compiler without that one). nothing broke: about six minutes in the world, no device removed, no warnings, dropped draws per frame in the same range as before. i did not compare pictures. i could not measure a change in gpu time though. this is gpu ms per frame from the frame lines, bucketed by draws per frame because the scene moves on at a different pace in each run:
diag build with the diagnostics feature and no switches set, series-x, the same key presses, warm shader and pipeline caches, one run of 11 minutes each, about 60 world lines each. with one run each, 10 ms in a bucket is noise. a line fit over all world lines gives 60 ms + 26 us per draw before and 69 ms + 27 us per draw with it. so on this card most of the gpu time is a fixed part per frame, and the cost per indirect call is not where it goes. what may explain the missing gain: a captured world frame here has about 1,100 indirect calls and about 490 of them are dispatches, which this change leaves inline and which end the prefix. i did not count how many calls took the hoisted path in the title. a hoisted / inline count in the frame line would answer that, and would show what the 3060 ti number turns into in a real frame. from reading the diff, three small things, none of them a wrong result that i could find. the prefix rule holds on every path i followed (compute or uav-writing bind, uav clear, the non-hoistable branch, external record, close), and the cpu refresh of the arguments lands before the prelude reads them.
|
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed c673921c across draw.rs, external.rs, host.rs, and indirect.rs, and confirmed a clean git merge-tree against origin/main (63bcca43).
Key invariants checked:
- Hoisting is strictly confined to a list's initial non-writing prefix:
end_hoisted_indirect()closes the prefix and returns all used scratch chunksINDIRECT_ARGUMENT -> COMMONonce before any compute bind, UAV/memory/heap-writing graphics pipeline (pipeline_writes_uav),clear_unordered, non-hoistable indirect call,external::record, orclose(). BATCH_SOURCE(c673921c) guards tail lanes with[branch]before root-SRV loads and avoids FXC non-short-circuiting oncosts[64]; relativesrc_offset + len <= u32::MAXandHOIST_CHUNKbounds are enforced inHoistedClamps::push; prelude barriers (UAV(None)-> chunkCOMMON -> UAV-> per-runUAV(None)->UAV(budget)+ chunkUAV -> INDIRECT_ARGUMENT) order cleanly after earlier lists' compute writes and allow re-submission of closed hoisted lists.
Verified locally on Windows 11 (RTX 5090 + WARP + VICTORY_D3D12_DEBUG=1):
cargo clippy --workspace --all-targets [--all-features] -- -D warnings: clean;cargo xtask policy:184 files ok- RTX 5090
indirect::: 12/12 passed (1 ignored benchmark) - RTX 5090 +
VICTORY_D3D12_DEBUG=1indirect::: 12/12 passed with zero Debug Layer warnings/errors (includinghoisted_prelude_orders_after_earlier_list_compute_write) - WARP (
--features diagnostics,VICTORY_D3D12_WARP=1) +VICTORY_D3D12_DEBUG=1indirect::: 12/12 passed - RTX 5090 release benchmark (
benchmark_hoisted_vs_inline_indirect_clamps, 9,000 draws):inline 38.45 ms/framevshoisted 2.35 ms/frame(16.3x)
LGTM.
|
CPU cost per call of Method. KainanP/VIctory@perf/list-call-bench now has
The same on main + #1978 + #2821 + #3258 + #3274 + #3275 (the draw path with the texture-lock contention mostly gone,
Your GPU benchmark on another card ( Tests,
The failures are the same as on main on each adapter (the NVIDIA heap pair; on Intel that pair plus AI use: Claude Code (Claude Opus 5.5) extended the benchmark, ran the measurements and drafted this comment. |
Summary
Hoists and batches indirect draw argument clamps (
indirect::bound) from inline per-draw compute dispatches into a single batched compute pass insideHostList::prelude, eliminating per-draw global UAV barriers, graphics-to-compute context switches, buffer state transitions, and forced graphics PSO rebinds (self.host_pipeline = 0) across runs of indirect draws.Why this matters
Previously, every
ExecuteIndirectcall ran inline:UAV(None)barrier,Dispatch(1, 1, 1)(clobberingself.host_pipeline = 0),UAV(None)+UNORDERED_ACCESS -> INDIRECT_ARGUMENTbarrier,ExecuteIndirect,INDIRECT_ARGUMENT -> COMMONbarrier (indirect::done).In scenes with ~9,000 indirect draws per frame, this inserts ~18,000 global UAV barriers, ~18,000 resource transitions, and ~9,000 graphics/compute switches per frame.
Design & Soundness Invariants
BATCH_SOURCEincrates/victory-gpu/src/indirect.rs):[kind, stride, records, src_offset, dst_offset, 0, 0, 0]from a persistent per-HostListupload buffer (mirrored in host RAM so mid-list growth never reads back from write-combined upload memory, and reused acrossHostList::reset()with zero per-frame allocations in steady state).nevermutating or transitioning title-owned buffers) and writes clamped records into disjoint 16-byte-aligned slices of the list's own scratch chunks (COMMON -> UNORDERED_ACCESS -> INDIRECT_ARGUMENTin the prelude, restored toCOMMONonce atend_hoisted_indirect()/HostList::close()).2^24vertices,2^26vertex instances,65535groups/dim,2^20dispatch groups,2^27per-list budget) and exact sequential budget charging as the inline shader.records == 1) jobs in parallel across all 64 lanes in one wave, falling back seamlessly to the 64-lane tiled loop forrecords > 1, with explicit[branch]/[loop]+breakguards so FXC never emits out-of-bounds root-SRV or LDS loads.Dispatch(1, 1, 1)per contiguous run sharing(src_gpu, dst_gpu)(with aUAV(None)barrier between distinct runs to keep bothbudgetand adjacent slices of the same scratch chunk coherent), preceded by oneUAV(None)barrier for earlier lists' writes and followed by a single batched[UAV(budget), Transition(chunk: UNORDERED_ACCESS -> INDIRECT_ARGUMENT)...]barrier.kind != DISPATCH) whose pipeline does not write to any buffer UAV (!pipeline_writes_uav(p)— checkingmarks,root_uavs,memory_dirty,heap_writes, tableResourceType::Uav, andROOT_UAV_VIEW) are hoisted. (No per-buffer overlap map is needed because hoisted jobs read title buffers strictly read-only and write disjoint scratch offsets.)prepare/prepare_forruns before enqueueing a hoisted clamp, so dropped draws no longer clamp arguments or spend list budget.ClearUnorderedAccessView*,external::record, non-hoistable indirect call, orHostList::close()callsHostList::end_hoisted_indirect(), transitioning hoisted scratch chunks backINDIRECT_ARGUMENT -> COMMONonce and falling back to the existing inlinebound/donepath for the remainder of the list.HostListwithoutreset()preserves its hoisted jobs and re-clamps cleanly.Verification
cargo test --release -p victory-gpu --locked -- --ignored --nocapture benchmark_hoisted_vs_inline_indirect_clampson NVIDIA GeForce RTX 3060 Ti, Windows 11):9000 indirect draw clamps: inline 45.28 ms/frame vs hoisted 2.14 ms/frame (21.1x)(measuring clamp dispatches + barriers alone, before savings from eliminating interleaved graphics PSO rebinds and graphics/compute switches).indirect::, latestc673921):25/25acrossindirect::+draw::).VICTORY_D3D12_DEBUG=1 VICTORY_D3D12_GBV=1 RUST_LOG=warn,--features diagnostics): 12 passed, 0 failed, zero D3D12 warnings or errors.VICTORY_D3D12_WARP=1,--features diagnostics): 12 passed, 0 failed.cargo clippy -p victory-gpu --all-targets --all-features --locked— 0 warnings in modified files.cargo xtask policy—asset policy: 184 files ok.(Authored and verified with AI assistance; synthetic GPU tests and benchmarks only, no game files or data.)