Pipeline & CLI: stable shader cache key, in-flight dedup, and AOT warm-up #254
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!254
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/254/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?
@wbkepler on GitHub · 2026-11-24 01:51 UTC · original
wbkepler:pipeline/stable-shader-cache-and-warmup→main· +829 −115 · 12 files · 1 commits · closed without mergingSummary
Prevents full shader-cache invalidation on unrelated crate rebuilds, eliminates duplicate concurrent shader translations and disk read-backs, and adds AOT shader cache warming via
victory translate --write-cache:victory-pipeline(cache.rs):get_or_convert_bytes(returning converted bytes directly on miss without disk read-back),put(), panic-safe per-key in-flight deduplication (InFlightGuardwith zero-clone uncontended fast path), andwrite_atomicstaging temp-file cleanup on write/rename failure.victory-shader(build.rs,dxbc.rs,lib.rs):src/**/*.rs(victory_shader::SOURCE_HASH), and exposesdxbc::Container::total_size.victory-gpu(shader_cache.rs):(MAGIC, CACHE_SCHEMA_VERSION, SOURCE_HASH, loop_limit)instead of hashingcurrent_exe(), usesget_or_convert_bytes, and exposesopen()/store()sharingKeySpec.apps/victory(translate.rs,main.rs,shader.rs):Validatorand D3D12Hostalive across all input files via boundedWorkQueue+SourceRef), slices raw DXBC containers to exacttotal_size, and adds--write-cacheto populate<cache_dir>/shaders.victory-pipeline(7/7) andvictory-gpu(46/46).Verification
cargo clippy --workspace --all-targets— passed (zero new warnings)cargo clippy -p victory --features diagnostics --all-targets— passedcargo test --workspace— passedcargo xtask policy— passed (152 files ok)@jeremygold02 on GitHub · 2026-11-24 05:53 UTC · original
Tested current PR head
0e6b2b4db5eee53aa3dde1e4eaafcf4e80f5aab9.cargo test --locked -p victory-pipeline --lib cache -- --test-threads=1: 7 passed. The tests cover first conversion versus disk hit, byte return without rereading, version invalidation, eight concurrent same-key callers converting once, cache prewarming, refusal of an in-repository cache, and cleanup of a staging file after rename failure (cache tests).cargo test --locked -p victory-gpu --lib shader_cache -- --test-threads=1: 5 passed. Fingerprints are deterministic and change with source hash, schema version, or loop limit; cache entries reject truncation/trailing bytes; prewarmed runtime lookups avoid translation; six concurrent lookups translate once (shader-cache tests).cargo test --locked -p victory-game --lib sgd5 -- --test-threads=1: 2 passed for record iteration and corrupt-stream handling, including the offset lookup used by the AOT source scanner (SGD5 record lookup).cargo test --locked -p victory-shader -- --test-threads=1: 69 passed, 0 doc tests.cargo test --locked -p victory -- --test-threads=1: the CLI package built and its 1 existing loader-lock test passed.cargo run --locked -p victory -- translate --helpdisplays the new--write-cacheoption (CLI option).No AOT translation was run over title files or other assets, and these checks do not exercise the full source-scanning/worker pipeline against an input file or a runtime D3D12 pipeline.
@Callimann8 on GitHub · 2026-11-24 11:06 UTC · original
Tested on an RTX 4070 (driver 32.0.16.2114, Ryzen 9 7945HX, Win 11), merged onto main
ffe310e.Merge: two small conflicts with current main, in victory-gpu/src/shader_cache.rs (doc comment) and victory-pipeline/src/cache.rs (imports, plus the convert/publish block that #161 changed). I took the PR's side, since get_or_convert_bytes' publish helper already removes the staging file. std::io::Write becomes unused.
cargo test -p victory-pipeline -p victory-gpupasses.Warm-up (
victory translate --write-cache, release build): 85 s, 26,148 programs, 21,898 written to the cache (606 MB). The rest fail translation for the known reasons (scalar memory read as data, 64-bit image atomics, ...).Effect (diag build, same scripted key presses, so this also checks that the cache key survives a different build profile):
So about 11 s off boot-to-world here. World fps can't be compared yet, because both runs hit the NVIDIA world hang (#97) shortly after.
Pull request closed