GPU: the indirect budget is charged in record order and no longer wraps #1510
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!1510
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1510/head"
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?
@rouges78 on GitHub · 2026-11-24 18:37 UTC · original
rouges78:fix/indirect-budget-in-order→main· +138 −11 · 1 files · 1 commits · merged 2026-11-25 00:17 UTCThe list's indirect budget wraps. Rejected records still add their cost to it, so 64 draw records of 2^26 bring the word back to zero and work is let in again: of 128 garbage draws four run where two fit (report, confirmed by a second reader).
This charges the budget in record order, with no word shared between groups: one group walks the records in tiles of 64, every lane clamps its own record, and the first lane charges the tile's records in order. The bounds, the root signature, the constants and the in-place clamp are unchanged; only the budget part of the shader and the dispatch count (one group) change.
Visible effect: a list whose budget is spent stays spent, so indirect work after it in the same list runs empty where main let it in again after a wrap; and the records that run are the first in the buffer, not whichever threads added first. Once the budget is spent, a record that costs nothing keeps its clamped first word where main zeroed it; it does no work either way.
One file,
crates/victory-gpu/src/indirect.rs. Four tests:rejected_records_do_not_wrap_the_budget(four draws run instead of two) anda_spent_budget_stays_spent(two run again on a second execution) fail on main;the_budget_goes_to_the_first_recordsanda_record_that_does_not_fit_ends_the_budgetpin the order and the rule. Every test also checks that the record after the last one is left as written.Clamp alone through
host.executeon an RTX 4080, N draw records that all fit, median of 5 runs, ms:Not in here: the count buffer and the scratch copy, which #242 and #583 carry. #583's compare-exchange budget, and #242's before e5ec341, timed out on this RTX 4080 once many records fit (device removed at 16,384; measurements in #242); this walk is the alternative measured there. #242 walks tiles in one group too since e5ec341; run here at
6cb8fbe, it admits the same records as this PR on 614 cases (#242), except with a count below the maximum, where it does not charge the inactive tail and this PR, like main, does. So this PR is that part alone, on main's shader, in one file. #190 and #1470 replace this HLSL shader with emitted DXIL and #1279 rewrites it for Wine's compiler; all three keep the plain add, so the wrap survives them and whichever lands second has to carry the walk over. This shader is not tried under Wine's compiler, which already refuses main's (#1279).Checked: both clippy configurations,
cargo test --workspace --lockedon the RTX 4080 (346 passed), theindirecttests on WARP. Not run against the title: I do not have it.AI-assisted (Claude wrote the change and the tests with me; the numbers are from real runs on the card).
🤖 Generated with Claude Code
@acetonahard-code on GitHub · 2026-11-24 22:31 UTC · original
Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current
main(70564ae):cargo test -p victory-gpumainmain+ this PRmain,--all-featuresmain+ this PR,--all-featurescargo clippy --all-targets -- -D warnings, with and without--all-features: clean.victory-gputests fail on currentmainon this NVIDIA card:dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views. That's the 1,000,000-view heap cap, see #1744. They fail the same way with this PR, and no other test does.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.