Pipelines: queue a new pipeline at creation, not at first draw (loading-screen stalls ≥70 ms 24 → 0) #622
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/Belobug--VIctory-Belobug-AMD!622
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-622"
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?
@11run11 on GitHub · 2026-11-27 14:29 UTC · original
11run11:performance/T-0037-eager-pipelines→a-publier· +139 −10 · 2 files · 2 commits · openA pipeline that no earlier run drew with is only made at its first draw today. A loading screen that creates and then uses many new pipelines per frame waits on its presenting thread for each one in turn. This change queues such a pipeline for the workers when the title creates it, behind requested ones, so it is usually ready by its first draw.
What it is
early()only started pipelines that were on the early list (drawn in an earlier run). A cold cache therefore made every pipeline at first use, one after another, on the thread that presents.The change (
crates/victory-gpu/src/pipeline/make.rsonly)early(): when a pipeline is not on the early list, it is queued atEARLYpriority if fewer thanVICTORY_PIPELINE_EAGERpipelines are waiting. The default limit is 256;0turns this off and restores the previous behaviour.QUEUElocked, andWAITINGonly grows under that lock, so it cannot be overshot (Queue::push_eager).EAGER, counts pipelines queued this way. It counts only newly queued entries.EAGER_USEDcounts the speculative pipelines that a draw or dispatch later used. Both counters are in the "host pipelines all made" and "host pipeline library saved" lines.admit()holdsstart()'s queueing and counting in one function. Behaviour does not change; it exists so the admission can be tested.speculative_admission_rechecks_capacity_before_queueing;concurrent_speculative_admission_holds_the_limit(8 threads × 200 creations admit exactly the limit);requested_work_goes_before_queued_speculative_work(a requested pipeline is taken before 200 queued speculative ones).Tested
Windows 11, RX 9070 XT (driver 32.0.32029.2010 family), Rust 1.98.1,
cargo build --release -p victory --features diagnostics.cargo test -p victory-gpu --features diagnostics: 452 passed, 0 failed (WARP). This includes the 10 tests inpipeline::make.VICTORY_PIPELINE_EAGER=0(as before)=0Measurements: limit values, cache state, program cost, unused pipelines
I measured the guest with
--warm(a second run over a cache that a first run filled) and with two extra settings:LOADING_MOVES(programs of 2048 instructions, so each is expensive to compile) andLOADING_UNUSED_PCT(a share of the created pipelines is never drawn). Each value is the median of 3 runs. Loading is the guest's own clock from its first loading frame to its last. CPU is the runtime process's user+kernel time, and peak is its peak private bytes. The scripts and JSON are in the fork's workbench, not in this PR.EAGERWhat this shows:
EAGER=0. Requested pipelines go before queued speculative ones (tested), so I did not add a reserved worker for requested work: nothing measured here asks for one.queued_at_creation/queued_at_creation_used("host pipelines all made" and "host pipeline library saved") show how many of a real title's speculative pipelines it actually drew. That is the number that decides whether the default should stay at 256, be lower, or be opt-in.Limits and risks
THREAD_PRIORITY_LOWEST.VICTORY_PIPELINE_EAGER=0restores the old behaviour, and I am happy to make the switch opt-in, or to lower the default, if you prefer.CI
Belobug's own
ci.yml, unmodified, passes on this branch in my fork (Clippy with-D warnings, default and diagnostics tests): https://github.com/11run11/VIctory-Belobug-11run/actions/runs/46030871483 (commitaf07fec).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.