perf(gpu): batch scattered indirect clamps and coalesce ready queue parts #43
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/PastiiJay--klbf-lab!43
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-43"
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?
@Vladimir-Human on GitHub · 2026-11-25 21:05 UTC · original
Vladimir-Human:perf/indirect-gather-join→beta· +5464 −1539 · 5 files · 1 commits · openAI-assisted clean-room contribution (
victory-gpu, D3D12 unit/WARP/hardware tests + synthetic indirect & ready-queue benchmarks only — no title files used).Summary
Combines scattered indirect argument clamping (
VICTORY_INDIRECT_GATHER, on by default, off via=0) and ready-queue adjacent part coalescing (VICTORY_JOIN_PARTS, on by default, off via=0) acrosscrates/victory-gpu/src/{draw.rs, host.rs, indirect.rs, list.rs, queue.rs}while integratingklbf-lab's existingBufferStates(ae89047) and compute group diagnostics (015af28):indirect.rs,draw.rs,list.rs,host.rs):GATHER_PASS1_CS -> GATHER_PASS2_CS) with batched mid-pass UAV barriers acrosscosts_res,budget_res, and distinct destination chunks.record_pending_scalarfalls back under allocation failure, caps rawByteAddressBufferelement counts at(1 << 30) - 1(4 GiB - 4 B), and callssources_read(clamps, ...)forBufferStates.queue.rs,host.rs):Partsubmissions underVICTORY_JOIN_PARTS, blocking coalescing onbacks/texture_backs/back_wanted, overlappingGpuWrite/writesvsblocked_by/Refresh/cross-shadow aliasing, WAR hazards (Refresh/TexturevsCopy/Step::Run), andHeld::Valuewait-range writes (lists_write_range).git merge-treeclean againstbeta(e328c88),#15,#41,#42, and our pending lazy-copyback/VRAM branches.Verification (
betae328c88, RTX 4070 SUPER / i5-13400F)cargo clippy -p victory-gpu --all-targets(default&--features diagnostics): 0 warnings in added/modified code.cargo test -p victory-gpu -- --test-threads=1: 161 passed, 0 failed (5 ignored).VICTORY_D3D12_DEBUG=1 VICTORY_REQUIRE_HW_GPU=1 cargo test -p victory-gpu --features diagnostics -- --test-threads=1: 169 passed, 0 failed (6/6livehw_gather_/hw_coalesce_tests including multi-frameHostList::resetreuse with 0 D3D12 debug errors/warnings), and kill switches (VICTORY_INDIRECT_GATHER=0,VICTORY_JOIN_PARTS=0,VICTORY_HOIST_CLAMPS=0) all pass.86.56xat 256 buffers);join_parts7.47x–12.89x (16 -> 1submissions).- Port hoisted indirect argument clamps (VICTORY_HOIST_CLAMPS, mode 7 default) and GPU gather-clamp batching (VICTORY_INDIRECT_GATHER, on by default): - Single-pass [numthreads(64,1,1)] prefix-sum shader for <= 8 uniform groups and 2-pass parallel gather + exact original-order budget pass for scattered multi-buffer batches, preserving compute and mesh budget diagnostics. - Preserves BufferStates source/count read tracking (sources_read), gates hoist reuse on dispatches, buffer-writing draws, copies, readbacks, and bottom-of-pipe writes, and skips hoisting when cut-waits is disabled. - Enforces all F1-F5 audit invariants: mid-pass UAV barriers over costs, budget, and all destination chunks; budget UAV barriers across flushes and scalar fallbacks; allocation-failure scalar fallback retaining SRV/UAV lifetimes; 2^30 - 1 raw SRV/UAV element cap. - Port ready-queue part coalescing (VICTORY_JOIN_PARTS, on by default): - Coalesces consecutive ready Held::Run parts across satisfied Wait/Value gates while stopping at Held::Signal, unsatisfied waits, or CPU/GPU hazards. - Preserves F3/F4 WAR refresh/copy/Run checks, texture copy-back checks, and lists_write_range guard preventing stale CPU wait bypasses.@PastiiJay on GitHub · 2026-11-25 21:08 UTC · original
Thanks a lot @Vladimir-Human! The indirect clamps are one of the costs we are looking at right now, so this one goes first in our queue. We test one change at a time on the RX 9070 XT (same save, same 7-minute run, fps and picture compared with our reference build, with and without
VICTORY_INDIRECT_GATHER/VICTORY_JOIN_PARTS). Results will be posted here.@HandshakeHackin on GitHub · 2026-11-25 21:20 UTC · original
I ran both switches independently on Microsoft WARP at
4f71557, using the PR source unchanged. WithVICTORY_JOIN_PARTS=0, the queue fixture observed four submissions. At=1, it observed one, with the same four written values. The unsatisfied-wait and intervening-fence checks passed in both runs. WithVICTORY_INDIRECT_GATHER=0and=1, the end-to-end test read back the expected indirect arguments, including the clamped record. Each setting ran in a fresh process and required a D3D12 device. All four runs passed. Windows test logThat gives the RX 9070 XT comparison a correctness baseline for the two switches. The software-adapter tests did not measure in-game timing.
@PastiiJay on GitHub · 2026-11-25 21:21 UTC · original
Thanks @HandshakeHackin, that's exactly the baseline we wanted before the hardware runs. What we keep: on WARP, with each switch tested on its own in a fresh process,
VICTORY_JOIN_PARTS=1folds four submissions into one with the same written values and the wait/fence checks still passing, andVICTORY_INDIRECT_GATHERreads back the expected indirect arguments either way, clamped record included.So when we run #43 on the RX 9070 XT, any difference we see in fps or picture comes from the GPU path, not from correctness. We'll post the on/off results for both switches here.
View 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.