GPU: hoisted indirect clamps (VICTORY_HOIST_CLAMPS) and a cap on the planned card budget (VICTORY_VIDEO_BUDGET_MB), both off by default #1184
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/fxceless--victory-fork!1184
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1184"
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?
@Marukooh on GitHub · 2026-11-25 23:10 UTC · original
Marukooh:hoist-indirect-clamps→main· +591 −21 · 5 files · 2 commits · draftTwo switches, both off by default: hoisted indirect clamps (
VICTORY_HOIST_CLAMPS=1) and a cap on the card budget the layer plans with (VICTORY_VIDEO_BUDGET_MB). The second turned out to decide most of what the first was measured against, so they come together.1.
VICTORY_VIDEO_BUDGET_MB: a cap on the planned card budgetHost::video_memoryreports at most this budget. The texture queue (resource::room), card copies of buffers and windows all use that number.On an RTX 5070 Ti under Proton the system's budget starts near 12.4 GB. In most runs it drops to about 10.5 GB near frame 725 ("the system changed the budget of the card's memory"). In 13 runs on 25-26 November, the indirect compute
982f3cccd5c04294took:982fper callThat held for every run, both ways, with hoisted clamps on or off. In the slow runs the card was 97% busy at 82-89 W instead of 96-104 W, and NVML showed less memory in use. Both are signs of memory the driver moved out to the PC's. The texture queue fills the card to nine tenths of the budget, so with 12.4 GB it overfills.
With
VICTORY_VIDEO_BUDGET_MB=10500: 4 runs of 4 fast (198.7-204.8 ms a frame, GPU 84-97 ms,982f11-13 ms). Without it, in the same hour: 6 runs of 6 slow (314-425 ms a frame,982f160-169 ms). With the cap the system's budget also dropped every time. I cannot say why; the outcome is what was measured.2.
VICTORY_HOIST_CLAMPS=1: clamps of a run of indirect draws in a list before itThe argument clamps of a run of indirect draws are recorded in a host list of their own that runs before the list that draws. Between the draws of the run there is then no dispatch of ours and no barrier. An inline clamp has two global UAV waits around it, and the prologue records about 4,000 clamps a frame. Adapted from Belobug/VIctory-Belobug-AMD@ccab973.
List::runs, a list for the run's clamps is opened after it (indirect::Hoist), and the title's calls go on in a new host list with the state replayed (State::replay), as a cut at a wait does.COMMONat its end, none between clamps.List::runsneed no waits. They go throughdetach,detach_partsand the in-place paths (list::host_runsinqueue.rs), so hoisting does not move lists onto the held path.translated().stores, the rule windows use). It also ends at cuts for waits, close and reset.HostList::budget_to_lend/lend_budget). The card's copy goesCOMMON -> UAV -> COMMONin each list that borrows it. After a cut at a wait the new piece has its own, as before.Measured with the budget cap at 10500 and the system's budget dropped in both runs; same build, switch at 0 and 1. Prologue, windows of 2,500-6,000 draws a frame with pipelines ready, 70 s each:
982fper callRTX 5070 Ti 16 GB, driver 620.73, CachyOS, Proton Experimental with vkd3d-proton, 3840x2160 swap chain. The measurements come from the same changes on an older base (
0b0074eplus local work, which also has the fill-ahead part of #860); this branch has the changes alone on6d20eed.Correction to the first version of this PR: its numbers (GPU 95.5 -> 57.8 ms) and its "what did not work first" section came from runs mixed between the two budget states above. The 982f slowdowns I blamed on hoisting were the budget. The rule that draws whose shaders store end a run is kept because it is safe, but no effect of it was shown.
Tests
host_list_hoisted_clamps_serve_the_next_list_at_their_offsetsandhost_list_lent_budget_is_spent_across_lists(with the card's budget copy and without).victory-gpu --libunder Proton (WARP): 187 passed, 5 ignored, 1 failed withVICTORY_HOIST_CLAMPSat 0 and at 1. The failure,drvwatch::tests::the_system_takes_the_subscription, fails the same way on6d20eed.Not covered
@Proudnoob4 on GitHub · 2026-11-26 15:13 UTC · original
RTX 4080 / i5-13600K (Win10) measurement when stacked with
VICTORY_INDIRECT_BATCH=1Ported
#1184(VICTORY_HOIST_CLAMPS=1+VICTORY_VIDEO_BUDGET_MB) onto ourVIctory-NVIDIAtree (989e5c6, which already runsVICTORY_INDIRECT_BATCH=1by default and is currently CPU-bound onvictory-submitat32.8 mswhile RTX 4080 sits61%busy).Unit test note: On trees where
VICTORY_INDIRECT_REST=0by default,3 × (65535 × 16 × 64)leaves2,048budget remaining (2^27 - 2 × 67,107,840), so[1, 1, 1]still fits; using2 × [32768, 32, 1](2 × 67,108,864 == 2^27) makeshost_list_lent_budget_is_spent_across_listspass under bothREST=0andREST=1. Both#1184unit tests passed cleanly.10-minute live A/B (
VICTORY_HOIST_CLAMPS=0vs=1, withVICTORY_INDIRECT_BATCH=1active;hoist()gated to skip single-record uncounted draws already handled bybatch):HOIST_CLAMPS=0)HOIST_CLAMPS=1+SECTION_MB=2)32.00/32.0030.70/30.05-1.30/-1.95 fpsVICTORY_THINlists / pieces203.0/312.2223.0/376.4+20 lists / +64 piecesread-backs and lists7.46 ms12.35 ms+4.89 msVICTORY_CARD_STEPSfills4,282(1,612 KB)7,503(3,046 KB)+75%fillsvictory-submitworking32.8 ms36.7 ms+3.9 mst=140..600s)0/230black0/230blackWhy it regressed on our CPU-bound
INDIRECT_BATCH=1setup: Splitting a title list into extra host lists (+20 lists/frame) adds+4.89 msof list reset/readback bookkeeping on the relay thread and breaks per-HostListfill_scratchCBV deduplication (4,282 -> 7,503fills), which matters whenvictory-submitis the bottleneck. Visually it was 100% clean (0/230black frames,4,582draws/frame). Good confirmation that keepingVICTORY_HOIST_CLAMPSopt-in (default off) is the right call — especially whenVICTORY_INDIRECT_BATCH=1is already active!View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.