CLI/GPU: avoid rescanning game_dir and re-inflating/re-hashing cached containers during warm prebuild, and stop Named::find early #2787

Open
github-bot wants to merge 1 commit from github-bot/gh-2787 into main AGit
Owner

@⁠RVZO6 on GitHub · 2026-11-25 20:23 UTC · original
RVZO6:rvzo/prebuild-warm-fast → main · +368 −35 · 5 files · 1 commits · open

Claimed in #1633: #1633

Summary

Speeds up warm victory translate --cache --pipelines and prebuild runs (e.g. the warm-cache overhead reported in #2602) with byte-for-byte identical pipeline keys and zero shader-cache invalidation (shader_cache.rs is intentionally untouched):

  1. Avoid rescanning game_dir a second time (apps/victory/src/translate.rs): translate::warm records the paths of files containing containers or the shader pack during its walk and passes only those paths to prebuild::run, avoiding a full second walk and read of the entire game directory.
  2. Zero-inflate, zero-rehash prebuilt key check (apps/victory/src/prebuild.rs, crates/victory-gpu/src/pipeline.rs, crates/victory-gpu/src/pipeline/make.rs):
    • prebuild::run computes and caches each container's 16-char BLAKE3 hex hash once during the initial programs scan.
    • Adds Prebuild::compute_key(hash) and Prebuild::graphics_key(stream, &[(stage, hash)]) (via make::key_from_hashes) so prebuild::run checks pipeline::prebuilt(&key) and wanted_early(&key) for all pack records without re-inflating, double-copying, or re-hashing every container ~55,000+ times before filtering to unbuilt todo jobs.
    • shaders_of reuses the cached hash too.
  3. Early-exit Named::find (crates/victory-game/src/pipelines.rs): skips and breaks out of the 2.49M-iteration depth_space and 478k-iteration raster_space enumerations via ControlFlow::Break as soon as want empties.

Measured on 13f91ca (--release pipeline::tests::bench_prebuild_key_vs_full, median of 3 runs, 4,000 jobs × 64 KiB containers, exact identical keys)

Path Time (4,000 jobs) Speedup
Full Prebuild::{graphics,compute}::key() (13f91ca) 123.37 ms baseline
Prebuild::{graphics_key,compute_key}() 35.20 ms 3.50× (-71.5%)

(In real SGD5 warm pre-build runs this additionally skips ~55,000+ miniz_oxide container inflations and the entire second game_dir disk scan.)

Not a duplicate of

  • Checked #2534 (shaderpack::find, intentionally left untouched), #2592 (rejects VS+GS), #2706 / #2646 (pipeline library file splitting), and #2211 (pipeline::shader() + Translated.atomics64). None overlaps these changes.

Verification

  • Verified on windows-latest MSVC + WARP SM 6.6 CI (both clippy -D warnings profiles, xtask policy 6/6, victory-game 16/16 including space_enumerations_stop_early_when_wanted_empties, victory-gpu 198/198 including prebuild_key_shortcuts_match_full_prebuild_keys): https://github.com/RVZO6/VIctory/actions/runs/45693633259
  • Not run: the title; any hardware GPU.

AI-assisted: T3 Code (Antigravity, gemini-4-neon)

**@⁠RVZO6** on GitHub · 2026-11-25 20:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2787) `RVZO6:rvzo/prebuild-warm-fast` → `main` · +368 −35 · 5 files · 1 commits · open Claimed in #1633: https://git.gtahub.st/github/Marvisak--VIctory/issues/1633 ### Summary Speeds up warm `victory translate --cache --pipelines` and `prebuild` runs (e.g. the warm-cache overhead reported in #2602) with **byte-for-byte identical pipeline keys** and **zero shader-cache invalidation** (`shader_cache.rs` is intentionally untouched): 1. **Avoid rescanning `game_dir` a second time (`apps/victory/src/translate.rs`):** `translate::warm` records the paths of files containing containers or the shader pack during its walk and passes only those paths to `prebuild::run`, avoiding a full second walk and read of the entire game directory. 2. **Zero-inflate, zero-rehash prebuilt key check (`apps/victory/src/prebuild.rs`, `crates/victory-gpu/src/pipeline.rs`, `crates/victory-gpu/src/pipeline/make.rs`):** - `prebuild::run` computes and caches each container's 16-char BLAKE3 hex hash once during the initial `programs` scan. - Adds `Prebuild::compute_key(hash)` and `Prebuild::graphics_key(stream, &[(stage, hash)])` (via `make::key_from_hashes`) so `prebuild::run` checks `pipeline::prebuilt(&key)` and `wanted_early(&key)` for all pack records without re-inflating, double-copying, or re-hashing every container ~55,000+ times before filtering to unbuilt `todo` jobs. - `shaders_of` reuses the cached hash too. 3. **Early-exit `Named::find` (`crates/victory-game/src/pipelines.rs`):** skips and breaks out of the 2.49M-iteration `depth_space` and 478k-iteration `raster_space` enumerations via `ControlFlow::Break` as soon as `want` empties. ### Measured on `13f91ca` (`--release pipeline::tests::bench_prebuild_key_vs_full`, median of 3 runs, 4,000 jobs × 64 KiB containers, exact identical keys) | Path | Time (4,000 jobs) | Speedup | |---|---:|---:| | Full `Prebuild::{graphics,compute}::key()` (`13f91ca`) | `123.37 ms` | baseline | | `Prebuild::{graphics_key,compute_key}()` | `35.20 ms` | **3.50× (-71.5%)** | *(In real SGD5 warm pre-build runs this additionally skips ~55,000+ `miniz_oxide` container inflations and the entire second `game_dir` disk scan.)* ### Not a duplicate of - Checked #2534 (`shaderpack::find`, intentionally left untouched), #2592 (rejects VS+GS), #2706 / #2646 (pipeline library file splitting), and #2211 (`pipeline::shader()` + `Translated.atomics64`). None overlaps these changes. ### Verification - Verified on `windows-latest` MSVC + WARP SM 6.6 CI (both clippy `-D warnings` profiles, `xtask` policy 6/6, `victory-game` 16/16 including `space_enumerations_stop_early_when_wanted_empties`, `victory-gpu` 198/198 including `prebuild_key_shortcuts_match_full_prebuild_keys`): https://github.com/RVZO6/VIctory/actions/runs/45693633259 - **Not run:** the title; any hardware GPU. AI-assisted: T3 Code (Antigravity, gemini-4-neon)
Speed up warm `translate --cache --pipelines` and `prebuild` runs without
touching `shader_cache.rs` (zero cache invalidation) or changing any
pipeline key:
- `translate::warm`: record files containing containers or the shader pack
  during its walk and pass only those paths to `prebuild::run`, avoiding
  a full second walk/read of the entire game directory.
- `prebuild::run`: compute and cache each container's 16-char BLAKE3 hex
  hash during the single initial `programs` scan, and check
  `pipeline::prebuilt(&key)` / `wanted_early(&key)` via new
  `Prebuild::compute_key` and `Prebuild::graphics_key` shortcuts (backed by
  `make::key_from_hashes`) instead of re-inflating, copying, and re-hashing
  every container in the pack before filtering to unbuilt `todo` jobs.
- `victory-game::pipelines`: skip and early-exit `depth_space` /
  `raster_space` enumerations via `ControlFlow::Break` as soon as `want`
  empties.

Measured on 13f91ca (--release pipeline::tests::bench_prebuild_key_vs_full,
median of 3 runs, 4,000 jobs x 64 KiB containers, exact identical keys):
- Full Prebuild::{graphics,compute}::key(): 123.37 ms
- Prebuild::{graphics_key,compute_key}():    35.20 ms (3.50x, -71.5%)
(In real SGD5 prebuild runs this also skips ~55,000+ zlib inflates on
warm caches and the full second game_dir scan.)

Assisted-by: T3 Code (Antigravity, gemini-4-neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:14:12 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 20:40 UTC · original

The hot path is right: hashing each container's trimmed bytes once up front (0x18..0x1c size field) means warm prebuild keying never re-inflates. The claimed equivalence key_of == prepare(job).map(|p| p.key()) is the load-bearing invariant - from reading, compute takes the single stage hash and graphics take vs.or(gs) then ps, which matches the pipeline key order. A unit test asserting both paths agree on a synthetic container set would make the invariant durable.

**@⁠kotekompotek** on GitHub · 2026-11-25 20:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2787#issuecomment-7174014661) The hot path is right: hashing each container's trimmed bytes once up front (0x18..0x1c size field) means warm prebuild keying never re-inflates. The claimed equivalence key_of == prepare(job).map(|p| p.key()) is the load-bearing invariant - from reading, compute takes the single stage hash and graphics take vs.or(gs) then ps, which matches the pipeline key order. A unit test asserting both paths agree on a synthetic container set would make the invariant durable.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 20:58 UTC · original

WARP/CPU verification of head 38614b414ce21a5a3b7e53e69d67702ace984aef

Environment: Windows 11 x64, rustc/cargo 1.98.1, WARP/CPU only (VICTORY_WARP=1, VICTORY_D3D12_WARP=1), no physical GPU, no game files. DXIL validation with Windows SDK 10.0.26100.0 x64 dxil.dll 1.8.2502.11. PR head merged cleanly onto origin/main 13f91caee2.

Tests (cargo test --no-fail-fast -p victory -p victory-game -p victory-gpu)

  • origin/main baseline: victory 10 + census 2; victory-game 15; victory-gpu 195 passed, 1 ignored. 0 failed.
  • With this PR: victory 10 + census 2 (unchanged); victory-game 16; victory-gpu 196 passed, 2 ignored (+1 space_enumerations_stop_early_when_wanted_empties, +1 prebuild_key_shortcuts_match_full_prebuild_keys, +1 ignored bench_prebuild_key_vs_full, not run). 0 failed.

Negative control (each applied alone, then reverted)

  • graphics_key drops the graphics state: prebuild_key_shortcuts_match_full_prebuild_keys fails.
  • compute_key uses the wrong stage name: same test fails.
  • Early-exit disabled (f(b)? becomes let _ = f(b) in the space enumerators): space_enumerations_stop_early_when_wanted_empties fails.
  • Dropping the stage name inside the shared key_from_hashes is not caught, since the test compares against the full path, which calls the same function (expected for a comparison test).

Lint: cargo clippy --all-targets -- -D warnings clean. cargo fmt --check: +6 hunks (891 on main, 897 with the PR): apps/victory/src/prebuild.rs +1, apps/victory/src/translate.rs +1, crates/victory-game/src/pipelines.rs +2 (the two over-long fn raster_space/fn depth_space signatures), crates/victory-gpu/src/pipeline.rs +2 (test code). Note: cargo fmt --check is already red on origin/main here (891 hunks, none from these PRs), so I compared per-file hunk counts against that baseline.

Review: read the full diff. The shortcut key matches the full key for compute, VS+PS, VS-only and MS+PS streams; stream(..) only stores the shader pointers, so passing empty slices is safe; translate::warm's relevant list uses the same predicate (shader pack magic or non-empty sources) and the same size filter as prebuild::run's own file scan, so the pack, databases and containers it sees are unchanged. Gaps: no test covers key_of end to end or the relevant filtering (both run only against a game directory, which I did not use), and the speed-up itself is unmeasured here (the benchmark is #[ignore]). No game files, dumps, shader names, or retail hashes.

AI disclosure: this verification was done by Claude Code (Claude Sonnet 5.5).

**@⁠oni-swr** on GitHub · 2026-11-25 20:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/2787#issuecomment-7174447240) **WARP/CPU verification of head `38614b414ce21a5a3b7e53e69d67702ace984aef`** **Environment:** Windows 11 x64, rustc/cargo 1.98.1, WARP/CPU only (VICTORY_WARP=1, VICTORY_D3D12_WARP=1), no physical GPU, no game files. DXIL validation with Windows SDK 10.0.26100.0 x64 dxil.dll 1.8.2502.11. PR head merged cleanly onto origin/main 13f91caee25f2fdf2c062be5f7a27f058e51cbca. **Tests (`cargo test --no-fail-fast -p victory -p victory-game -p victory-gpu`)** - `origin/main` baseline: victory 10 + census 2; victory-game 15; victory-gpu 195 passed, 1 ignored. 0 failed. - With this PR: victory 10 + census 2 (unchanged); victory-game 16; victory-gpu 196 passed, 2 ignored (+1 `space_enumerations_stop_early_when_wanted_empties`, +1 `prebuild_key_shortcuts_match_full_prebuild_keys`, +1 ignored `bench_prebuild_key_vs_full`, not run). 0 failed. **Negative control** (each applied alone, then reverted) - `graphics_key` drops the graphics state: `prebuild_key_shortcuts_match_full_prebuild_keys` fails. - `compute_key` uses the wrong stage name: same test fails. - Early-exit disabled (`f(b)?` becomes `let _ = f(b)` in the space enumerators): `space_enumerations_stop_early_when_wanted_empties` fails. - Dropping the stage name inside the shared `key_from_hashes` is **not** caught, since the test compares against the full path, which calls the same function (expected for a comparison test). **Lint:** `cargo clippy --all-targets -- -D warnings` clean. `cargo fmt --check`: **+6 hunks** (891 on main, 897 with the PR): `apps/victory/src/prebuild.rs` +1, `apps/victory/src/translate.rs` +1, `crates/victory-game/src/pipelines.rs` +2 (the two over-long `fn raster_space`/`fn depth_space` signatures), `crates/victory-gpu/src/pipeline.rs` +2 (test code). Note: `cargo fmt --check` is already red on `origin/main` here (891 hunks, none from these PRs), so I compared per-file hunk counts against that baseline. **Review:** read the full diff. The shortcut key matches the full key for compute, VS+PS, VS-only and MS+PS streams; `stream(..)` only stores the shader pointers, so passing empty slices is safe; `translate::warm`'s `relevant` list uses the same predicate (shader pack magic or non-empty `sources`) and the same size filter as `prebuild::run`'s own file scan, so the pack, databases and containers it sees are unchanged. Gaps: no test covers `key_of` end to end or the `relevant` filtering (both run only against a game directory, which I did not use), and the speed-up itself is unmeasured here (the benchmark is `#[ignore]`). No game files, dumps, shader names, or retail hashes. AI disclosure: this verification was done by Claude Code (Claude Sonnet 5.5).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 21:13 UTC · original

Reviewed and benchmarked 38614b41 on Windows 11 (RTX 5090 + WARP + dxil.dll) against main (13f91ca).

Code review

  • Filtering &relevant in translate::warm via data.starts_with(shaderpack::MAGIC) || !jobs.is_empty() matches prebuild.rs:53 while leaving VICTORY_PREBUILD_KEYS on full &paths.
  • Caching 16-byte BLAKE3 hex digests and hashing via Prebuild::{compute_key, graphics_key} (make::key_from_hashes) matches full Prebuild::key() (prebuild_key_shortcuts_match_full_prebuild_keys), and Named::find stopping early with ControlFlow::Break once want.depth/want.raster empty is equivalent.
  • Merge note: clean git merge-tree vs 13f91ca, #2664, #2784, #2785, #2786; conflicts in apps/victory/src/prebuild.rs with #2592 (which rejects vs && gs instead of silently dropping gs via vs.or(gs)—worth keeping key_of aligned with prepare if both land).

Verification & same-machine --release benchmark (rustc 1.98.1 MSVC)

  • victory CLI: 12/12 passed; victory-game: 16/16 passed (including space_enumerations_stop_early_when_wanted_empties); victory-gpu (pipeline:: & shader_cache::) on both RTX 5090 and WARP: 19/19 passed.
  • cargo clippy --locked -p victory -p victory-gpu -p victory-game --all-targets -- -D warnings: 0 warnings; cargo xtask policy: 184 files ok.
  • pipeline::tests::bench_prebuild_key_vs_full (--release, 3-run median, 4,000 jobs × 64 KiB): 126.91 ms -> 22.00 ms (5.77× / -82.7%).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 21:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2787#issuecomment-7174776354) Reviewed and benchmarked `38614b41` on Windows 11 (RTX 5090 + WARP + `dxil.dll`) against `main` (`13f91ca`). ### Code review - Filtering `&relevant` in `translate::warm` via `data.starts_with(shaderpack::MAGIC) || !jobs.is_empty()` matches `prebuild.rs:53` while leaving `VICTORY_PREBUILD_KEYS` on full `&paths`. - Caching 16-byte BLAKE3 hex digests and hashing via `Prebuild::{compute_key, graphics_key}` (`make::key_from_hashes`) matches full `Prebuild::key()` (`prebuild_key_shortcuts_match_full_prebuild_keys`), and `Named::find` stopping early with `ControlFlow::Break` once `want.depth`/`want.raster` empty is equivalent. - **Merge note**: clean `git merge-tree` vs `13f91ca`, `#2664`, `#2784`, `#2785`, `#2786`; conflicts in `apps/victory/src/prebuild.rs` with `#2592` (which rejects `vs && gs` instead of silently dropping `gs` via `vs.or(gs)`—worth keeping `key_of` aligned with `prepare` if both land). ### Verification & same-machine `--release` benchmark (`rustc 1.98.1` MSVC) - `victory` CLI: **12/12 passed**; `victory-game`: **16/16 passed** (including `space_enumerations_stop_early_when_wanted_empties`); `victory-gpu` (`pipeline::` & `shader_cache::`) on both **RTX 5090** and **WARP**: **19/19 passed**. - `cargo clippy --locked -p victory -p victory-gpu -p victory-game --all-targets -- -D warnings`: **0 warnings**; `cargo xtask policy`: **184 files ok**. - `pipeline::tests::bench_prebuild_key_vs_full` (`--release`, 3-run median, 4,000 jobs × 64 KiB): `126.91 ms` -> **`22.00 ms`** (**5.77× / -82.7%**).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:25 UTC · original

Automated triage for the maintainers.

This speeds up warm pre-builds in three ways, all without changing the pipeline keys. translate::warm passes prebuild::run only the files that hold containers or the pack; the predicate is the same as prebuild::run's own file filter. prebuild::run hashes each container once during its scan and keys jobs with the new Prebuild::compute_key/graphics_key (through make::key_from_hashes, which make::key now uses as well) instead of copying and re-hashing containers per job. Named::find stops the depth and raster enumerations once nothing is left to find. I checked that the hash matches Shader::new (BLAKE3 of the container trimmed to its own size, first 16 hex digits). A job that key_of accepts but prepare would refuse now reaches the make loop and is skipped there, so the skip counts stay the same. Expect a conflict in apps/victory/src/prebuild.rs with #2592; key_of should follow whatever prepare does about VS+GS if both land. CI passes.

This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/2787#issuecomment-7177538763) <!-- victory-triage v1 head=38614b414ce21a5a3b7e53e69d67702ace984aef verdict=merge-candidate at=2026-11-25T23:25:13Z --> Automated triage for the maintainers. This speeds up warm pre-builds in three ways, all without changing the pipeline keys. `translate::warm` passes `prebuild::run` only the files that hold containers or the pack; the predicate is the same as `prebuild::run`'s own file filter. `prebuild::run` hashes each container once during its scan and keys jobs with the new `Prebuild::compute_key`/`graphics_key` (through `make::key_from_hashes`, which `make::key` now uses as well) instead of copying and re-hashing containers per job. `Named::find` stops the depth and raster enumerations once nothing is left to find. I checked that the hash matches `Shader::new` (BLAKE3 of the container trimmed to its own size, first 16 hex digits). A job that `key_of` accepts but `prepare` would refuse now reaches the make loop and is skipped there, so the skip counts stay the same. Expect a conflict in `apps/victory/src/prebuild.rs` with #2592; `key_of` should follow whatever `prepare` does about VS+GS if both land. CI passes. This is a recommendation for a maintainer to look, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 03:51 UTC · original · approved these changes

Tested merged onto origin/main (63bcca4) on Windows 11 x64:

  • cargo test -p victory-game --lib pipelines::: 8 passed, 0 failed (including new space_enumerations_stop_early_when_wanted_empties).
  • cargo test -p victory-gpu --lib pipeline::tests: 5 passed, 0 failed, 1 ignored (including new prebuild_key_shortcuts_match_full_prebuild_keys).
  • cargo clippy -p victory-game -p victory-gpu -p victory --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 03:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2787#pullrequestreview-6068310451) · **approved these changes** Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - `cargo test -p victory-game --lib pipelines::`: **8 passed, 0 failed** (including new `space_enumerations_stop_early_when_wanted_empties`). - `cargo test -p victory-gpu --lib pipeline::tests`: **5 passed, 0 failed, 1 ignored** (including new `prebuild_key_shortcuts_match_full_prebuild_keys`). - `cargo clippy -p victory-game -p victory-gpu -p victory --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 14:39 UTC · original · approved these changes

Reviewed 38614b414ce21a5a3b7e53e69d67702ace984aef merged cleanly onto main (63bcca43c6a0) and verified on Windows 11 x64 (Ryzen 9 9950X, NVIDIA GeForce RTX 5090 + Microsoft WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1).

Code Review

  • Directory rescan avoidance (apps/victory/src/translate.rs:341,359,436): Recording relevant paths with data.starts_with(shaderpack::MAGIC) || !jobs.is_empty() under the same MAX_FILE bound matches prebuild::run's filter (apps/victory/src/prebuild.rs:50-52) identically, while VICTORY_PREBUILD_KEYS continues scanning full &paths.
  • Zero-inflate / zero-rehash keying (apps/victory/src/prebuild.rs:31,97,129-180,275, crates/victory-gpu/src/pipeline.rs:627,637, crates/victory-gpu/src/pipeline/make.rs:95,112):
    • Each container is validated against its 0x18..0x1c size field (rejecting truncated or empty slices) and hashed once to the same 16-char BLAKE3 hex prefix used by Shader::new.
    • victory_game::pipelines::stream only writes (ptr, len) into shader bytecode subobjects without reading shader bytes, Prebuild::graphics_key reads the identical GraphicsState via read_stream(stream, |_, _| None) without dereferencing shader pointers, and make::key_from_hashes is bit-for-bit identical to make::key (omitting update(&[]) for None is a BLAKE3 no-op).
  • Early-exit Named::find (crates/victory-game/src/pipelines.rs:91-110,167,203): Because try_one gates insertion on want.remove(&hash), once want.depth or want.raster empties no subsequent candidate can insert or overwrite anything, so ControlFlow::Break preserves exact selection semantics.
  • Merge-batch note: Conflicts in apps/victory/src/prebuild.rs with #2592 (vs && gs handling); if both land, keep key_of aligned with prepare.

Verification (9950X + RTX 5090 + WARP + VICTORY_D3D12_DEBUG=1, Rust 1.98.1)

  • cargo run --locked -p xtask -- policy: 191 files ok.
  • cargo clippy --workspace --all-targets --locked -- -D warnings (default and --all-features): 0 warnings.
  • victory CLI: 18/18 passed (14 unit + 2 census + 1 census_unreadable + 1 translate).
  • victory-game: 16/16 passed (including space_enumerations_stop_early_when_wanted_empties).
  • victory-gpu pipeline:: (VICTORY_D3D12_DEBUG=1): 24/24 passed (1 benchmark ignored) on RTX 5090; 27/27 passed (1 benchmark ignored) on WARP (--features diagnostics), including prebuild_key_shortcuts_match_full_prebuild_keys.
  • --release pipeline::tests::bench_prebuild_key_vs_full on Ryzen 9 9950X (4,000 jobs × 64 KiB containers): full=122.71 ms, key_only=22.11 ms (5.55x).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 14:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/2787#pullrequestreview-6075994876) · **approved these changes** Reviewed `38614b414ce21a5a3b7e53e69d67702ace984aef` merged cleanly onto `main` (`63bcca43c6a0`) and verified on Windows 11 x64 (Ryzen 9 9950X, NVIDIA GeForce RTX 5090 + Microsoft WARP, `VICTORY_D3D12_DEBUG=1`, Rust `1.98.1`). ### Code Review - **Directory rescan avoidance (`apps/victory/src/translate.rs:341,359,436`)**: Recording `relevant` paths with `data.starts_with(shaderpack::MAGIC) || !jobs.is_empty()` under the same `MAX_FILE` bound matches `prebuild::run`'s filter (`apps/victory/src/prebuild.rs:50-52`) identically, while `VICTORY_PREBUILD_KEYS` continues scanning full `&paths`. - **Zero-inflate / zero-rehash keying (`apps/victory/src/prebuild.rs:31,97,129-180,275`, `crates/victory-gpu/src/pipeline.rs:627,637`, `crates/victory-gpu/src/pipeline/make.rs:95,112`)**: - Each container is validated against its `0x18..0x1c` size field (rejecting truncated or empty slices) and hashed once to the same 16-char BLAKE3 hex prefix used by `Shader::new`. - `victory_game::pipelines::stream` only writes `(ptr, len)` into shader bytecode subobjects without reading shader bytes, `Prebuild::graphics_key` reads the identical `GraphicsState` via `read_stream(stream, |_, _| None)` without dereferencing shader pointers, and `make::key_from_hashes` is bit-for-bit identical to `make::key` (omitting `update(&[])` for `None` is a BLAKE3 no-op). - **Early-exit `Named::find` (`crates/victory-game/src/pipelines.rs:91-110,167,203`)**: Because `try_one` gates insertion on `want.remove(&hash)`, once `want.depth` or `want.raster` empties no subsequent candidate can insert or overwrite anything, so `ControlFlow::Break` preserves exact selection semantics. - **Merge-batch note**: Conflicts in `apps/victory/src/prebuild.rs` with `#2592` (`vs && gs` handling); if both land, keep `key_of` aligned with `prepare`. ### Verification (9950X + RTX 5090 + WARP + `VICTORY_D3D12_DEBUG=1`, Rust `1.98.1`) - `cargo run --locked -p xtask -- policy`: `191 files ok`. - `cargo clippy --workspace --all-targets --locked -- -D warnings` (default and `--all-features`): 0 warnings. - `victory` CLI: **18/18 passed** (14 unit + 2 `census` + 1 `census_unreadable` + 1 `translate`). - `victory-game`: **16/16 passed** (including `space_enumerations_stop_early_when_wanted_empties`). - `victory-gpu` `pipeline::` (`VICTORY_D3D12_DEBUG=1`): **24/24 passed** (1 benchmark ignored) on RTX 5090; **27/27 passed** (1 benchmark ignored) on WARP (`--features diagnostics`), including `prebuild_key_shortcuts_match_full_prebuild_keys`. - `--release` `pipeline::tests::bench_prebuild_key_vs_full` on Ryzen 9 9950X (4,000 jobs × 64 KiB containers): `full=122.71 ms`, `key_only=22.11 ms` (**5.55x**). LGTM.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 15:57 UTC · original

I checked the #2592 conflict raised in review. Integration 3e2bb33 combines exact 38614b4, dd2d861 and 63bcca4, preserving both PR histories.

The fast cache-key path and full preparation now share the stage check. Both reject VS+GS before looking up a container, even if the vertex key would already be cached. Diagnostics list all stages and reuse their cached hashes. The regression checks that VS+PS and MS+PS get identical keys via both paths. Restoring the old fast-path stage selection makes that test fail specifically at the VS+GS lookup.

On synthetic inputs, all 19 CLI tests, 8 game pipeline tests and the GPU key-equivalence test passed. Strict all-feature Clippy for the affected packages and the asset-policy check passed. The integration branch is available when you choose the merge order.

Please retain the Git authors on pickup. If folding the integration or its test into another commit, use Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 15:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2787#issuecomment-7196977801) I checked the #2592 conflict raised in review. [Integration `3e2bb33`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/3e2bb33f614cdd6b123e37aa117e1afa63c537d9) combines exact `38614b4`, `dd2d861` and `63bcca4`, preserving both PR histories. The fast cache-key path and full preparation now share the stage check. Both reject VS+GS before looking up a container, even if the vertex key would already be cached. Diagnostics list all stages and reuse their cached hashes. The regression checks that VS+PS and MS+PS get identical keys via both paths. Restoring the old fast-path stage selection makes that test fail specifically at the VS+GS lookup. On synthetic inputs, all 19 CLI tests, 8 game pipeline tests and the GPU key-equivalence test passed. Strict all-feature Clippy for the affected packages and the asset-policy check passed. The [integration branch](https://github.com/andrewpozdnakov7-jpg/VIctory/tree/codex/prebuild-2787-2592) is available when you choose the merge order. Please retain the Git authors on pickup. If folding the integration or its test into another commit, use `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2787/head:github-bot/gh-2787'
git switch 'github-bot/gh-2787'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2787'
git switch 'github-bot/gh-2787'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2787'
git switch 'github-bot/gh-2787'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2787'
git switch 'main'
git merge --squash 'github-bot/gh-2787'
git switch 'main'
git merge --ff-only 'github-bot/gh-2787'
git switch 'main'
git merge 'github-bot/gh-2787'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2787
No description provided.