Repository navigation
victory: translate --cache and the pre-build say where their time went (slowest shaders and pipelines, library saves) - #2951
0xkn0wh3r3 wants to merge 2 commits into
Conversation
A warm-up of a title's shaders can take many minutes, and nothing said whether the time was ours or the driver's, nor which shaders. At their end both now print a "time" section: - translate --cache: the time translating containers (summed over the worker threads) and the 10 slowest by hash; - the pre-build: the time translating pipelines' shaders (or finding them in the cache), the time making host pipelines (the driver's compilation, or the library's lookup), each with the 10 slowest pipelines by key and shaders, and the library saves: how many, how long, and how long the library was locked serialising (pipelines being made wait to be stored meanwhile; the library is about 1.7 GB on NVIDIA and saved every 20 s). Prebuild::make_timed returns the two times; victory_gpu::pipeline:: library_saves the saves. Nothing changes in what is made.
With Marvisak#2907: the summary lines go through progress::say, and Marvisak#2951's time section follows them; the library save keeps Marvisak#2129's directory creation and staging files beside Marvisak#2951's timing.
Marvisak#2951's time sections (translations, pipelines' shaders, host pipelines, library saves) are printed as Marvisak#2907's summary lines are, so that a pre-build at run's start also has them in the progress window's log and the run's log.
|
Local verification on Windows / rustc 1.100.0 / MSVC, no game data, no GPU, no clippy/rustup.
AI-assisted (Hy4 flash). |
|
Code review and Windows 11 verification at head
LGTM. |
kotekompotek
left a comment
There was a problem hiding this comment.
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.
|
Automated triage for the maintainers. Merge candidate (recommending a look, not approving). Thanks for taking the minor point. In 2a7976c, CI: passing ( Generated by Claude Code |
The time spent with the library's lock held is counted only for saves that serialise it, so SAVES[2] stays part of the time the counted saves took.
|
Took the minor point in 2a7976c: |
# Conflicts: # crates/victory-gpu/src/pipeline/library.rs
Dukestar69
left a comment
There was a problem hiding this comment.
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 --cache and pre-build.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal
left a comment
There was a problem hiding this comment.
Reviewed and verified head 2a7976c2d29e57e0096f3bdd0fa9612190d685af (clean merge with origin/main 63bcca43) 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)- Additional local probe verified empty
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.
A 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.