victory: translate --cache and the pre-build say where their time went (slowest shaders and pipelines, library saves) #2951
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!2951
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2951"
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?
@0xkn0wh3r3 on GitHub · 2026-11-26 01:22 UTC · original
0xkn0wh3r3:tools/build-timing→main· +175 −3 · 6 files · 2 commits · openA warm-up of a title's shaders (
translate --cache --pipelines) can take many minutes. Its output says how many shaders were translated and how many pipelines were made, but not whether the time went to our translator or the driver, nor which shaders.What
At their end, both halves now print a
timesection:translate --cache: the time spent translating containers, summed over the worker threads, and the 10 slowest by hash. Only containers translated now are counted, not cache hits.Prebuild::make_timedreturns the two times, andvictory_gpu::pipeline::library_savesreports the saves. What gets made doesn't change.Why: it's the measurement to take before choosing between the open speed-ups for long warm-ups. Candidates are the translator's slow passes (#2662, #2640, #2657, #2665), smaller emitted programs (#2150, #2825), sharded library saves (#1653), and worker counts (#2752).
Tests
slowest::tests::it_sums_all_and_names_the_slowest: the totals are summed, the 10 slowest are kept in order, and only items that make the top 10 are named.cargo test -p victoryand-p victory-gpu --lib pipelinepass.cargo clippy --locked -p victory -p victory-gpu --all-targetsis clean, with and without--features diagnostics.Not run on a title here: there are no game files on this machine. The report is meant to be read from a real warm-up's output.
@cloph-dsp on GitHub · 2026-11-26 01:35 UTC · original
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.
842b0cb: 7 files, +187/-6.git diff --checkflags the same trailing whitespace in README.md:17 (displayed.).it_sums_all_and_names_the_slowestis absent from the base commit.cargo test --locked -p victory --bin victory -- slowest::tests::it_sums_all_and_names_the_slowest --exact --quiet-> 1 passed, 14 filtered (CARGO_BUILD_JOBS=2).cargo test --locked -p victory --bin victory --quiet-> 15 passed, 0 failed.AI-assisted (Hy4 flash).
@fuzeofficlal on GitHub · 2026-11-26 01:35 UTC · original
Code review and Windows 11 verification at head
19a68c592fe7onmain(63bcca43c6a0):apps/victory/src/slowest.rs,crates/victory-gpu/src/pipeline/library.rs):Slowestaccumulatestotal_usandcountlock-free viaAtomicU64, lockingkept: Mutex<Vec<(Duration, String)>>only for Top-10 entries and evaluatingname: impl FnOnce() -> Stringlazily only when a duration enters the top 10 (zero string allocations on the fast path).library::SAVESrecords save count, total time, and lock-hold time cleanly (skipping lock/counters whenadded == 0 && !prebuilt_changed && !USED_CHANGED; minor non-blocking note: ifzeroed/SerializereturnsErrinside the lock, theTimeddrop guard still bumpsSAVES[2]without bumpingSAVES[0]/SAVES[1]).Prebuild::make_timedsplits monotonicInstanttranslate vs create durations cleanly.cargo xtask policy:192 files ok;cargo clippy -p victory -p victory-gpu --all-targets -- -D warnings: 0 warningscargo test --locked -p victory: 19/19 passed (15 unit includingit_sums_all_and_names_the_slowest+ 4 integration)victory-gpu --lib -- pipeline::(RTX 5090,VICTORY_D3D12_DEBUG=1): 23/23 passed.LGTM.
@Marvisak on GitHub · 2026-11-26 05:24 UTC · original · edited 2026-11-26 07:19 UTC
Automated triage for the maintainers.
Merge candidate (recommending a look, not approving). Thanks for taking the minor point. In
2a7976c2,library::save(crates/victory-gpu/src/pipeline/library.rs) adds the time it held the lock toSAVES[2]only on theSerializesuccess path, and theTimedguard is gone. Early returns (failedzeroedorSerialize) no longer add lock time without a counted save. The rest is as reviewed before:apps/victory/src/slowest.rskeeps totals and the 10 slowest by name,Prebuild::make_timedsplits translate time from create time, and nothing about what gets built changes.CI: passing (
check).Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-26 05:28 UTC · original
Took the minor point in
2a7976c2:library::savenow adds the time it held the lock only for saves that serialise, so an early return (failedzeroedorSerialize) no longer adds toSAVES[2]without a counted save. TheTimedguard is gone.@kotekompotek on GitHub · 2026-11-26 02:28 UTC · original · reviewed
Verified: Slowest sums all durations but only formats names for entries that make the top-10 (locked vec, lazy FnOnce name). The pre-build timing split is clean — translated = first quiet dispatch, created = elapsed minus translated. SAVES[2] correctly measures only the locked serialize window via the Timed drop guard while SAVES[1] is the whole save including atomic write. translate --cache gates on translated+refused>0 and marks refused entries.
@Dukestar69 on GitHub · 2026-11-26 09:11 UTC · original · approved these changes
Verified against
origin/main(63bcca4):cargo test -p victory -- --test-threads=1: 15 lib + 4 integration tests passed (includingslowest::tests::it_sums_all_and_names_the_slowest).cargo clippy -p victory --all-targets -- -D warnings: clean.cargo xtask policy: 192 files ok.Cleanly reports timing totals and the slowest shaders/pipelines during
translate --cacheand pre-build.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-26 14:15 UTC · original · approved these changes
Reviewed and verified head
2a7976c2d29e57e0096f3bdd0fa9612190d685af(clean merge withorigin/main63bcca43) on Windows 11 x64 with NVIDIA GeForce RTX 5090 and D3D12 WARP (VICTORY_D3D12_DEBUG=1, Rust 1.98.1).Code review
apps/victory/src/slowest.rs(L11-64): accumulatestotal_usandcountvia lock-freeAtomicU64(saturatingas_micros()cleanly tou64::MAX), guards division by zero withcount.max(1)so empty reports produce0 in 0.0 swith noNaN, bounds retained memory toKEPT = 10entries, and evaluatesnamelazily only when an entry enters the top 10.crates/victory-gpu/src/pipeline.rs:Prebuild::make_timed(L668, inside#[cfg(windows)] impl Prebuild) andlibrary_saves(L708,#[cfg(windows)]) preserve non-Windows#[cfg]hygiene and leave pipeline compilation/caching behavior and on-disk library format untouched.crates/victory-gpu/src/pipeline/library.rs(L55,L343,L360-361):SAVES[2]now records lock-held serialization time only on theSerializesuccess path (avoiding inflated lock time on early error returns), and merges cleanly with #2646 with zero conflicts.apps/victory/src/translate.rs(L340,L377,L435) andprebuild.rs(L227,L248,L287): cleanly exclude cache hits from translation timings and skip thetimesection when no work ran.Verification
cargo xtask policy:192 files okcargo clippy --workspace --all-targets --locked -- -D warnings(default &--all-features): 0 warningscargo test --locked -p victory -- --test-threads=1: 19/19 passed (15 unit includingslowest::tests::it_sums_all_and_names_the_slowest+ 4 integration)cargo test --locked -p victory-gpu --lib -- pipeline::: 23/23 passed (RTX 5090 default), 26/26 passed (RTX 5090--features diagnostics+VICTORY_D3D12_DEBUG=1), 26/26 passed (WARP--features diagnostics+VICTORY_D3D12_DEBUG=1)Slowest(noNaN), all-zero durations,Duration::MAXclamping, and 8-thread concurrentSlowest::add(8,000 items: exact total, exact count, top-10 sorted descending); combined#2951 + #2646merge passed--all-featuresClippy cleanly.Clean, useful diagnostics; approving.
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.