gpu: optimize single-record indirect argument clamp #3913
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3913"
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?
Imported from Marvisak/VIctory. Originally posted by Tigoniukas on 2026-11-30T20:35:40Z.
Summary
This PR optimizes the single-record indirect argument clamp path in the D3D12 GPU backend.
When
records == 1, only lane 0 needs to process the argument and update the remaining budget. The new fast path avoids unnecessary group synchronization while preserving the existing tiled implementation for multiple records.Changes
GroupMemoryBarrierWithGroupSyncoperations in this case.Validation
cargo test --workspace --locked— passed.cargo clippy --workspace --all-targets— passed.git diff --check— passed.Performance measurements
Tested on:
Observed reduction in GPU execution time: approximately 27.6%.
The result was reproduced across repeated A/B benchmark runs.
Limitations: These measurements represent a synthetic GPU workload, not actual game performance. No in-game FPS improvement is claimed. CPU command-recording time did not show a consistent improvement.
Scope
This is a small, isolated optimization of the existing indirect argument clamp shader. Further reductions in dispatch and resource-barrier overhead are outside the scope of this PR.
Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-12-01T12:30:25Z.
Compared
661dbc6dwith parent63bcca43on an RTX 4090 Laptop GPU and WARP. With 1, 2 and 64 records, draw, indexed draw, compute and mesh all produced the expected argument words and remaining budget on both revisions. The input buffer stayed intact. When one record exhausted the budget exactly, the next record had zero work.On the 4090, eight fresh processes in ABBA BAAB order timed batches of 512 calls using GPU timestamps. For one record the process medians were 3.475 µs/call on the parent and 3.187 on the PR. The four paired changes were −21.4%, −22.7%, +5.9% and +20.0%, so these runs did not establish a consistent speedup. For 2 and 64 records the medians were 3.851 → 4.103 and 10.543 → 10.575 µs/call.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-12-01T13:32:51Z.
Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.
Base
63bcca43c6a00a758510398fa43096ce7e4f7df0, head661dbc6d106aab794217997e9ad431354347ce1c.git diff --numstat→ crates/victory-gpu/src/indirect.rs 34/0.The test is new on the base —
git grep -F one_record_clamps_and_spends_the_budget 63bcca43 -- .finds nothing, exit 1.git diff --check "63bcca43..661dbc6d"→ no output, exit 0.Result:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 232 filtered out; finished in 0.50s.The test works on plain indirect argument buffers, no device opened; GPU/driver N/A. No game data.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.