Skip to content

perf(gpu): give idle spare-list scratch back after a while - #474

Merged
pragyaangaur merged 1 commit into
pragyaangaur:mainfrom
romainhedouin:perf/idle-list-scratch-trim
Nov 27, 2026
Merged

pragyaangaur merged 1 commit into
pragyaangaur:mainfrom
romainhedouin:perf/idle-list-scratch-trim

Conversation

@romainhedouin

Copy link
Copy Markdown
Contributor

A spare host list kept its last cycle's upload scratch for good (the count was capped at 64, the bytes were not), and the staging pools and the upload list aged only on submissions with textures. Now a spare list's scratch goes after recent::WINDOW (10 s) idle, the oldest goes past 256 MB in all (the most texture staging keeps), and every submission does the trimming; a list made again from a spare makes its scratch as a new one does.

before after
Most spare scratch that can sit idle (counted from the code: 64 lists that kept 11.9 MiB each) 764 MiB, no time limit 256 MiB, 10 s
Steady play 600 s, peak / mean spare scratch (model) 26.2 / 7.8 MiB 22.5 / 4.6 MiB, 31 MiB made again per run
21 held lists a minute, peak / mean (model) 50.1 / 23.0 MiB 47.9 / 7.7 MiB, 98 MiB made again per run
64 held lists, then 300 s quiet, mean (model) 92.0 MiB 3.1 MiB

Tested: native victory-gpu lib tests (107 pass), Windows clippy in both configurations; not run under CrossOver, the model's list sizes and trace are assumed, so the RAM held and the scratch made again in a real run are unmeasured (diagnostics now print the spare lists and their scratch). Small conflicts with #403, #404, #417 and #447.

🤖 Generated with Claude Code

Spare host lists kept their last cycle's upload scratch for good: up to 64
lists, each as large as its biggest cycle (64 lists keeping 12 MB held 764
MB), and the texture staging pools and the upload list only aged on
submissions with textures to bring up, so a texture-free stretch held the
last staged memory.

A spare list's scratch now goes once the list has been idle for
recent::WINDOW, and the oldest goes past 256 MB in all (the most texture
staging keeps); a list made again from a spare makes its scratch as a new
one does. Every submission trims the spare lists and ages the staging
pools, and the upload list lets go of what it staged as soon as the next
submission begins (not only when that one has textures). Diagnostics print
the spare lists and the scratch they keep.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@pragyaangaur
pragyaangaur merged commit a0b90ea into pragyaangaur:main Nov 27, 2026
1 check passed
gdemontalivet added a commit to gdemontalivet/VIctory-macOS that referenced this pull request Nov 27, 2026
…ync submit worker (VICTORY_ASYNC_SUBMIT=1)

Implement Wait-Before-Prep Flight-1 overlap (VICTORY_FLIGHT1=1) and a dedicated victory-submit worker thread (VICTORY_ASYNC_SUBMIT=1) behind opt-in environment switches (default off), rebased cleanly onto main:

- Split Host::execute_with_barriers into prepare_submission, execute_sync, and finish_post_gpu, preserving all main submission behavior across both sync and Flight-1 paths (pragyaangaur#403 SUBMISSIONS_DONE/retire_any/advance_retired, pragyaangaur#417 ReadyDrain/release_worker, pragyaangaur#419 coalesced UAV barriers, pragyaangaur#453 hoisted indirect clamps in prelude, pragyaangaur#457 texback::land, pragyaangaur#474 trim_idle, and unconditional bindless::uploads).
- Keep pragyaangaur#417's bindless::Uploads semantics (Holder dirty tracking + ReadyDrain + release_worker) while checking out the upload HostList from LIST so Uploads is genuinely Send across the flight lifecycle without holding a MutexGuard across threads or GPU waits; call release_worker() immediately after the flight's GPU fence completes and return the upload list to LIST on drop.
- Enforce Wait-Before-Prep in host/flight.rs: finish_flight_locked drains Flight N-1 completely before Flight N touches any shared Shadow, descriptor heap, upload staging pool, or Mark buffer, and Host::quiet() drains any active flight under Host::submitted before heap creation/null-fill.
- Add coalescing Held::take_ready_with / finish_running so victory-submit and Flight-1 never hold HELD across GPU submission, preserving the lock DAG (SUBMIT_DRAIN -> HELD -> Host::submitted -> Host::flight -> Fence::waiters) and draining cleanly at PresentX, CopyPageMappingsBatchX, and synchronous Host::execute calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants