host: allow configuring in-flight list cap via VICTORY_LATE_MOST #385
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/lobomfz--VIctory-xmem!385
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-385"
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?
@MikeSouza1 on GitHub · 2026-12-03 22:48 UTC · original
MikeSouza1:perf/victory-late-most→main· +135 −7 · 3 files · 5 commits · openMotivation
On multi-frame workloads where a single frame submits ~180–240 command lists, the hardcoded
LATE_MOST = 256cap incrates/victory-gpu/src/host.rscauses the submission thread to wait on256 lists in the airevery frame (~11.7–12.9 ms/frameaverage wait across 3,500+ log samples on RX 6750 XT / Ryzen 5 5600G).Exposing this cap as an opt-in runtime knob lets users and developers benchmark and debug in-flight list pressure without changing the default
256behavior (which remains important as back-pressure on GPU-bound setups).Change
LateMostParse,parse_late_most(), andlate_most()readingVICTORY_LATE_MOST(64..=512, defaulting toLATE_MOST = 256when unset/empty, logging atracing::warn!both when clamping out-of-range values and when falling back on unparseable/overflowing values).crate::list::IDLE_MOSTaspub(crate)and enforceconst _: () = assert!(LATE_MOST_MAX <= crate::list::IDLE_MOST.0);(plusLATE_MOST_MIN <= LATE_MOST <= LATE_MOST_MAX) at compile time so the upper bound stays tied to the 512-list idle pool (avoiding settle churn and keeping dynamic descriptor usage bounded onPORTABLE_VIEWShosts).late_most()inlate_threads,late_line, andexecute, and update thehost.rsdoc comment.host::relay_testscoveringDefault,Exact,Clamped { asked }, andInvalid.VICTORY_LATE_MOSTindocs/SETTINGS.md(under Runtime-only settings).Verification
PKG=victory-gpu ./build.sh check(0 warnings),PROFILE=diag PKG=victory-gpu ./build.sh check(0 warnings),PKG=victory-gpu ./build.sh test -- relay_tests(2 passed; 0 failed).CONSOLE=series-s,VICTORY_BVH_BUILDER=1,VICTORY_PARTS_ONE_CALL=1):256(default):lists_in_air = 12.94 ms/frame,avg_total_wait = 15.73 ms,gpu_wait = 18.5 ms.VICTORY_LATE_MOST=512:lists_in_air = 0.00 ms/frame,avg_total_wait = 2.23 ms,gpu_wait = 2.2 ms, anddynamic_refused=0.0across all 41stats: recordingsamples in adiagrun.512increased median FPS but hurt 1% lows / long presents and exposed tree-shadow flickering while driving — reinforcing keeping256as the default andVICTORY_LATE_MOSTstrictly opt-in.@Kal0s-design on GitHub · 2026-12-03 23:14 UTC · original
Went through this on native Windows 11 (MSVC). Short version: 256 really is just a soft trigger, nothing is sized by it, so raising it doesn't break any invariant I could find. A couple of things around it are worth a look though.
What I checked in crates/victory-gpu/src/host.rs:
LATE_MOSTis only used for the check insend_late(4298), the wait right after it (4306) and the two log lines (3425, 3566). No array, ring, pool or heap is sized from it anywhere in the crate. I also grepped for literal 256s in this area and none of them are tied to it.*flying += order.len(), so one submission bigger than the limit goes out anyway, andexecute_own(4334) adds the present without checking at all.relay_waitwaits forlists < limit, andlistsgets recounted from the flights still in the line every time something lands (around 4203-4215), so it can't hang even when a single flight is over the limit.STARTED(4517, 4706) before it goes in the line.FINISHEDonly moves when flights land (around 4183), andburysubtractsBURY_LAGfrom that (393). Title submissions that haven't started yet are covered byqueued()(queue/behind.rs 578/749/766). So more lists in the air doesn't let anything get dropped early.land()still holds back the last 128 landed flights (flights, not lists) before recycling (3382), same as before.Things that do interact with a higher value:
IDLE_MOSTis (512 lists, 256 MiB) in list.rs:228. Above 512, a settle that lands everything at once (the sweep settle every 1.5 s at host.rs:4508, a blocking fence wait, a read-back) hands back more lists than the pool keeps. The extra ones get dropped (list.rs:293/305) and the next frames create new lists, which is the churn the comment above it describes. Either cap the clamp at 512 or scaleIDLE_MOSTwithlate_most().dynamic_slots(descriptor/host.rs:1716) givesnull - countcapped there. A host that falls back toPORTABLE_VIEWS(1,000,000, title heap around 720k) gets about 280k, while lists hold their tables until they land (release_tables, host.rs:4166). Also, "no free dynamic descriptor slots" is only logged once per process (descriptor/host.rs:2032), so theDynamicRefusedcounter is a better check than counting warnings. It'd be good to note that 2048 is only tested at 512 so far.OnceLock, default is 256, and 0/1 clamp to 64. Garbage, negative and overflowing values all quietly fall back to 256, so "99999999999999999999" gives 256 rather than 2048. The resolved value does show up in the startup info line, so it's not invisible. A warn on an unparseable value would still help.VICTORY_*knobs, and this one should probably get a row there. The doc comment at 2677 still saysLATE_MOST.Tests,
cargo test -p victory-gpu --lib(skippingdescriptor::tests::views_die_with_their_resource), one NVIDIA desktop card. On the PR branch with the variable unset, set to 1024 and set to 1: 329 passed, 5 failed, 23 ignored every time. The failures are the same 5 as on current main:indirect::tests::host_list_reuses_and_grows_scratch_across_submissions,indirect::tests::host_list_window_executions_need_no_barrier_of_their_own, the twopipeline::host::testsmesh/depth-bounds ones, and the flakywatch::tests::the_rest_of_the_one_asking_has_a_number_of_its_own. Main passes more tests in total only because it has newer tests since the branch point. No unit test reachessend_late(only queue/behind.rs:746/762 call into it), so the env runs only show nothing else moved. They don't exercise the cap.I also pulled the parse into a pure function locally (not pushed) and checked unset, "", "abc", "-1", "0", "1", "63", "64", " 512 ", "1024", "2048", "2049", an overflowing number, "0x200" and "512.0". All came out as described above.
Clippy: no new warnings on the changed lines.
AI-assisted: yes
@MikeSouza1 on GitHub · 2026-12-03 23:37 UTC · original
Thanks a lot @Kal0s-design for the thorough review and testing on Windows! I've pushed a follow-up commit addressing all four points:
LATE_MOST_MAX = 512): Keeps the clamp aligned withlist::IDLE_MOST.0(512 idle host lists) so full settles don't trigger list-pool churn, and keeps it within the actually tested range (512already eliminates thelists_in_airstall).DynamicRefused: Good catch onPORTABLE_VIEWShosts (~280k dynamic slots) and the once-per-process warning log. Capping at 512 keeps descriptor pressure bounded, and I verifieddynamic_refused=0.0across all 41stats: recordingsamples in adiagrun atVICTORY_LATE_MOST=512.parse_late_most(Option<&str>) -> (usize, bool)with atracing::warn!on unparseable/overflowing values (while treating unset/empty cleanly as default) and added unit tests inhost::relay_testscovering bounds and invalid inputs (PKG=victory-gpu ./build.sh test --lib host::relay_testspasses).VICTORY_LATE_MOSTtodocs/SETTINGS.md(under Runtime-only settings) and updated the doc comment inhost.rsto referencelate_most.@Kal0s-design on GitHub · 2026-12-03 23:45 UTC · original
Rechecked at
f02f958, thanks for the quick turnaround. All four points look addressed: the clamp is now 64 to 512 (LATE_MOST_MAX, host.rs:2530),parse_late_mostis pure and warns only on unparseable input, the doc comment at host.rs:2725 points atlate_most, and the SETTINGS.md row matches the code (64 to 512, default 256).host::relay_testspassed 10 times in debug and 10 in release. The fullvictory-gpu --librun gives 340 passed, 5 failed, 23 ignored, and the 5 are the same known failures as on main. No new clippy warnings on the changed lines.Two small things, neither blocking. A value above 512 (say 2048) is clamped to 512 silently, which is fine since the startup line shows the resolved value, but a short note in the warn or the docs could save someone a confused moment. The PR description still says
64..=2048and mentions the 1,048,576 slots, so it's worth updating to match the new cap.AI-assisted: yes
@joaowtrdev on GitHub · 2026-12-04 00:05 UTC · original
Tried
VICTORY_LATE_MOST=512against the default 256 (d444868, merged onmainwith #354, #364, #382 and #376). Ryzen 7 5700X3D, RX 9070 XT, 4K output, FSR 4 Performance, RT on,VICTORY_PARTS_ONE_CALL=1, lsfg-vk 2x. One run each, back to back, from the same save: 1 min standing, then ~5 min driving through the city.It does what it says on the wait, but here the run got worse:
256/512 lists in the air, ms per framegpu_wait_ms, meanAlso, with 512 the tree shadows flickered while driving. I didn't see that with 256, nor in any earlier run on this build. So with more lists in the air something that the shadows read seems to get reused or rewritten before the card is done with it, even if I couldn't say what. BeanieMen saw lows drop with 512 in #369 too.
On this machine the card is already the limit most of the time, so the 8 ms wait at 256 seems to be mostly back-pressure rather than a stall. I'm keeping 256.
@MikeSouza1 on GitHub · 2026-12-04 00:49 UTC · original
Thanks @Kal0s-design for rechecking
f02f958! I'll update the PR description to match the64..=512cap and note silent clamping clearly.And thanks a lot @joaowtrdev for the detailed back-to-back driving benchmark on the 9070 XT! That's super useful data: it matches what I saw on the wait reduction and median FPS bump, while showing that on a GPU-bound 4K setup
256acts as helpful back-pressure for 1% lows — and the tree shadow flickering at512is a great catch (definitely reinforces keeping256as the default and keepingVICTORY_LATE_MOSTstrictly opt-in for experimentation/debugging).@Luxuride on GitHub · 2026-12-04 11:16 UTC · original
The conversion is complete — I checked that no bare
LATE_MOSTuse survives in the four paths (crates/victory-gpu/src/host.rs:3480,:3620,:4329,:4351,:4360), the doc at:2725was updated with the constant, andparse_late_mosthas a real table test.Two nits, both about the constant staying honest:
LATE_MOST_MAX = 512is justified athost.rs:2527-2529bycrate::list::IDLE_MOST.0, which is private atcrates/victory-gpu/src/list.rs:228. Nothing ties them, so if that pool shrinks the clamp silently stops being a bound. Aconst _: () = assert!(LATE_MOST_MAX <= 512);next to it, or re-exporting the constant, would make the claim enforceable instead of a comment.parse_late_mostreturnsvalid = truefor out-of-range numbers, soVICTORY_LATE_MOST=5120becomes 512 with no log line whileabcwarns. You say "clamped silently" in the body and the test pins it, so this is a choice — but a one-line warning for "asked for X, using Y" would save the next person the confusion, andvalidcurrently reads as "used as given", which is only true after the clamp.On the risk: this threshold was also what kept a frame's dynamic descriptor slots and scratch chunks from being held at once, so 512 is a real raise of that pressure. Default 256 plus your
dynamic_refused=0.0samples is the right conservative call.@MikeSouza1 on GitHub · 2026-12-04 17:05 UTC · original
Thanks for the review @Luxuride! Addressed both points in
e0cb97d:crate::list::IDLE_MOSTaspub(crate)and addedconst _: () = assert!(LATE_MOST_MAX <= crate::list::IDLE_MOST.0);(alongsideLATE_MOST_MIN <= LATE_MOST <= LATE_MOST_MAX) so the idle-pool upper bound is enforced at compile time rather than only in comments.(usize, bool)inparse_late_mostwith an explicitLateMostParseenum (Default,Exact,Clamped { asked },Invalid), added atracing::warn!inlate_most()when clamping out-of-range values (asked,using,min,max), and updatedrelay_testsand the PR description accordingly.Verified with
PKG=victory-gpu ./build.sh check,PROFILE=diag PKG=victory-gpu ./build.sh check(0 warnings on both), andPKG=victory-gpu ./build.sh test -- relay_tests(2 passed; 0 failed).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.