GPU: prioritize repeat-demanded pipelines with non-mesh tie-breaking and anti-starvation #1551
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!1551
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1551/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?
@Sakura-Byte on GitHub · 2026-11-24 19:03 UTC · original
Sakura-Byte:pr/repeat-demand-pipeline-priority→main· +434 −37 · 1 files · 1 commits · closed without mergingSummary
Replaces the single FIFO
mpsc::channelincrates/victory-gpu/src/pipeline/make.rswith a repeat-demand priorityWorkQueueso pipelines requested repeatedly by active draws and dispatches compile ahead of single-hit entries,meshties, and speculativeearlypre-warms, while preserving bounded forward progress for 1-hit pipelines.Changes (
crates/victory-gpu/src/pipeline/make.rs)UNQUEUED -> EARLY -> DEMAND):ready()promotes unstartedearlyentries into the demand lane via CAS without double-countingWAITINGorPEAK, andPending::claim()ensures each pipeline is compiled at most once even if present in both lanes or re-pushed on a tier upgrade.demand_tier,MAX_TIER = 10): Tracks demandhitsatomically and buckets them into logarithmic tiers (1..=3, then33 - hits.leading_zeros()capped at tier10forhits >= 256). AWorkItemis pushed to the demandBinaryHeaponly whentier_queued.fetch_max(tier) < tier, bounding extra heap entries to at most 10 per pipeline.WorkItem::cmp): Within the same tier, non-mesh pipelines (!shaders.iter().any(|s| s.stage == "mesh")) sort ahead of mesh pipelines, with submission sequenceseqpreserving FIFO order within(tier, non_mesh).FAIR_STRIDE = 16,fair_fifo): After 16 consecutive higher-tier (tier >= 2) pops,pop_claimed()drains one oldest unclaimed demand entry fromfair_fifoso 1-hit pipelines cannot starve under sustained repeat demand.!workers_alive),make_inlinecompiles once viaclaim()while maintainingWAITING/PEAKaccounting.main's existingwait()budget and worker thread setup untouched in this PR for a minimal single-file diff.Verification
Tested cleanly on
2fc9b94(based onffe310e) on Windows with WARP (VICTORY_D3D12_WARP=1,VICTORY_WARP=1):git diff --check: passcargo xtask policy: pass (154 files ok)cargo clippy --workspace --all-targets --locked -- -D warnings: pass (0 warnings)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: pass (0 warnings)cargo test -p victory-gpu --features diagnostics --locked -- pipeline::make::: 4 passed; 0 failed; 0 ignoredfirst_use_is_made_by_a_workerpriority_queue_runs_ready_and_promoted_before_earlyrepeated_demand_jumps_ahead_of_hundreds_of_single_hit_pipelinestie_breaks_favor_non_mesh_and_fair_stride_prevents_starvationcargo test -p victory-gpu --features diagnostics --locked -- --test-threads=1: 56 passed; 0 failed; 1 ignored (existingtexture_checks_per_submissionbenchmark)cargo test -p victory-gpu --locked -- --test-threads=1: 53 passed; 0 failed; 1 ignoredAI-assisted; synthetic tests only, zero game assets.
@Marvisak on GitHub · 2026-11-25 00:42 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.Replaces 'the single FIFO channel' with a repeat-demand priority queue; main already replaced that channel with a draws-first queue and early-entry promotion (make.rs). The extra repeat counts, mesh tie-breaks and anti-starvation come with no measurement.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed