Game: short-circuit pipeline state enumeration once wanted hashes are found #2575
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!2575
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2575"
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?
@reeledMarek on GitHub · 2026-11-25 16:08 UTC · original
reeledMarek:fix/game-pipelines-perf→main· +109 −29 · 1 files · 1 commits · openSummary
Short-circuits pipeline state enumeration in
victory_game::pipelinesas soon as all wanted hashes are resolved, instead of always exhausting the entire search space.Changes
name_from_registers,depth_space, andraster_spaceinNamed::findwhen their correspondingwantsets are already empty.std::ops::ControlFlow<()>fromraster_space,depth_space,depth_from_registers, andblend_from_registerssoNamed::findandname_from_registersstop immediately once every wanted hash (or the current record's target hash) has been matched.raster_space_short_circuits_on_breakto verify early termination.Scope
Trimmed to only the
ControlFlowearly exits per triage feedback; candidate generation inblend_from_registersandraster_spaceis unchanged.Verification
cargo test -p victory-game --lockedcargo clippy -p victory-game --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningscargo test -p xtask --lockedd8831f29a4todfcfa60fb7@Marvisak on GitHub · 2026-11-25 22:16 UTC · original · edited 2026-11-26 07:18 UTC
Automated triage for the maintainers.
Needs work. Re-reviewed at
dfcfa60. Thevisited < 2_000_000assertion is gone, and the rewrite ofcrates/victory-game/src/pipelines.rsstill reads as behaviour-preserving (ControlFlowearly exits, the array forms ofper_target/twins, the reusedtargetsbuffers,basesdedup).Reply to the author: you are right, and our earlier comment was wrong:
apps/victory/src/prebuild.rscallsNamed::findduringvictory prebuild. That is still a one-off offline step, though. Your benchmark uses a pack whose wanted states are all D3D12 defaults. That is the best case for the early exits, because enumeration stops at once. With a real pack, any hash that is never named still walks the whole space. What would change the verdict: the time ofNamed::findin a realvictory prebuildrun, before and after, as a share of the whole command. Timings only, no title data. If that gain is small, a smaller change limited to the early exits would be easier to take.CI:
checkpassing.Generated by Claude Code
@reeledMarek on GitHub · 2026-11-26 05:56 UTC · original
Updated to address the triage feedback:
visited < 2_000_000assertion fromthe_depth_space_holds_the_d3d12_default.Named::findis called byapps/victory/src/prebuild.rs:92duringvictory prebuild.cargo test --release -p victory-game, 9 runs, synthetic pack with matched D3D12 default depth-stencil and default rasterizer states,main63bcca4vs this PR):main: median 153.94 ms (min 153.66 ms, max 157.13 ms)Game: skip redundant pipeline state enumeration and eliminate inner-loop blend Vec allocationsto Game: short-circuit pipeline state enumeration once wanted hashes are founddfcfa60fb7toa894f0d59b@reeledMarek on GitHub · 2026-11-26 10:39 UTC · original
Trimmed this PR down to only the
ControlFlowearly exits (and rebased onto currentmain), dropping theblend_from_registersallocation rewrite so the change stays small and focused as suggested.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.