Repository navigation
Conversation
Every rebuild changed the executable's hash and so retranslated every shader on the next run (minutes of first-run stalls) even when the translator had not changed. Key the cache on victory-shader's source digest (computed by its build script, as upstream PR Marvisak#254 does), this file (the entry encoding), the build profile and the loop/spin limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSBL6gm6bCVwNso3jAy
|
Tested current PR head
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. |
|
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. Warm-up ( 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. |
mercuryVM
left a comment
There was a problem hiding this comment.
Tested 0e6b2b4 on Windows 11, RTX 5070, MSVC: cargo test -p victory-pipeline -p victory-gpu -p victory-shader -p victory -- --test-threads=1 123 passed. Clippy shows only the two existing warnings (host.rs:267, xmem.rs:747).
- Safety check: the new
crates/victory-shader/build.rsonly reads the crate's ownsrc/**/*.rsand hashes them withblake3, already a workspace dependency, as a build-dependency. It downloads and runs nothing.Cargo.lockgains only edges. victory translate <exe> --write-cacheworks. WithVICTORY_CACHE_DIRpointed at a scratch folder, the first run on a local title executable wrote 12 entries and a second run reported "0 written (12 already cached)".- Keying on
(MAGIC, CACHE_SCHEMA_VERSION, SOURCE_HASH, loop_limit)instead ofcurrent_exe()stops unrelated rebuilds from invalidating the whole cache, which is the right trade. - Things I couldn't verify here without running the title:
- That the runtime looks up exactly the keys
--write-cachewrites. The CLI and runtime must agree onloop_limit, and the CLI uses the default. A test asserting that the CLI's key for a container equalsshader_cache's runtime key would pin it. - That in-flight dedup never holds a translation lock across a pipeline wait.
- That the runtime looks up exactly the keys
- This currently conflicts with main (and with mercuryVM/VIctory main), so it needs a rebase.
AI-assisted (Claude Code).
…ey, in-flight dedup, and AOT warm-up Conflicts resolved by hand: - victory-shader/build.rs: one main() that computes the source hash (this PR) and then opts test binaries into an app-local Agility SDK runtime (upstream main), both unchanged. - translate.rs: this PR's file work queue, fed by the fork's scan_entries() so traversal errors are still counted and reported; Tally keeps the cache counters and the smallest-label example (Marvisak#673). - shader_cache.rs doc: this PR's wording with plain backticks (Marvisak#675). - victory-pipeline cache.rs: this PR's get_or_convert_bytes path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged with Marvisak#254's shader cache: the host's wave sizes (Target) are part of every cache key, the offline warm-up (translate --write-cache) stores under the same key and detects this machine's GPU when no target is given, and the worker queue passes the target to each worker. Stale test initializers from Marvisak#650 and Marvisak#233 updated (Parts::target/console_cf, Container::total_size). On the RTX 4070 no compute pipeline is refused any more and the world shows a full skyline of lights. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…up, and AOT warm-up Resolved: the cache key is the PR's source-hash fingerprint plus HEAD's spin-wait limit, then HEAD's per-host wave target (key()); shader_cache::store takes the target so --write-cache entries match runtime lookups. translate.rs takes the PR's work queue with HEAD's target in Checks; main.rs passes both write_cache and host_lanes. shader.rs keeps HEAD's in_record filter (also in source_refs) with the PR's total_size trim; sgd5::record_at maps HEAD's Found. victory-pipeline takes the PR's in-flight dedup with HEAD's create_new temp write in write_atomic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s total_size Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m-up Avoid wiping the shader cache on unrelated rebuilds, eliminate duplicate concurrent translations and redundant disk read-backs, and support ahead-of-time cache warming via `victory translate --write-cache`: - victory-pipeline: add `Cache::get_or_convert_bytes` (returning converted bytes directly in memory on a miss without re-reading from disk) and `Cache::put`, deduplicate concurrent in-flight conversions per key via a panic-safe `InFlightGuard`, and remove staging temp files on write or rename failure. - victory-shader: compute a deterministic BLAKE3 digest of `src/**/*.rs` at build time (`victory_shader::SOURCE_HASH`) and expose `total_size` on `dxbc::Container`. - victory-gpu: key `shader_cache` on `(MAGIC, CACHE_SCHEMA_VERSION, victory_shader::SOURCE_HASH, loop_limit)` instead of hashing `current_exe()`, use `get_or_convert_bytes`, and expose `open`/`store` for offline cache warming. - victory CLI: share one persistent worker pool (keeping `Validator` and D3D12 `Host` alive across all input files), slice raw DXBC containers to `total_size`, and add `victory translate --write-cache` to pre-populate `<cache_dir>/shaders`. - tests: add unit tests for direct bytes return, concurrent in-flight dedup, staging temp-file cleanup on rename failure, fingerprint stability and sensitivity, and `store` warm-up round-trips.
0e6b2b4 to
b19ad94
Compare
Where a fork-only change duplicates upstream's own version of a feature, upstream's is kept and the fork's dropped: - victory-shader is upstream's crate with the fork-only merges replayed onto it oldest first; those that do not apply onto upstream are dropped (37 of 63: among them Marvisak#704/raw views, gather4_l, the lane-mask and Marvisak#308 ports, Marvisak#947, Marvisak#1022, Marvisak#1112, Marvisak#1090, Marvisak#1182). Marvisak#284 (legacy fused madds) and Marvisak#98 (permlane16 in whole-wave sections) are dropped too: the first disagrees with upstream's hardware-checked model, the second refused 46 programs upstream translates. - translate: upstream's --cache replaces Marvisak#254's write-cache and work queue; Marvisak#378, Marvisak#517, Marvisak#673 and the victory.toml console are re-applied. - victory-gpu: upstream's stride table, page table and heap views replace the fork's Marvisak#704/stride-table wiring; fork-only fixes re-applied on top. Package (shaders.rpf, translate --validate --list, counts): vertex/pixel emitted 12559 -> 14295 of 14337, compute 2359 -> 2628 validated, mesh 2730 -> 2811 validated. Tests: the failures left (rect fourth corner, two stride tests, row order, gather4 at a level, memory table, dynamic heap slots) fail on upstream main as well on this host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
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)