perf(gpu): memoize shared shader containers during known pipeline prewarm #627

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

@⁠chefulano on GitHub · 2026-12-05 20:27 UTC · original
chefulano:perf/warm-memoize-shaders → main · +52 −9 · 2 files · 1 commits · open

During victory warm, pipeline::known::make() re-reads and re-hashes the same shared shader container bytes from disk for every pipeline that references a given (stage, hash) pair.

This change memoizes resolved Arc<Shader> containers per (stage_idx, hash) inside known::make() and adds pipeline::shader_hashed() so each unique shader container is read from disk and hashed once per prewarm pass instead of once per pipeline entry.

Ported cleanly from gamingwithhomie/larp (PR #29).

Queue check

  • Independent of #549 (which updates apps/victory/src/warm.rs CLI flags and route filtering; this PR touches only crates/victory-gpu/src/pipeline.rs and crates/victory-gpu/src/pipeline/known.rs).

Checks

  • cargo xtask policy — pass (368 files ok)
  • cargo check --locked --release --target x86_64-pc-windows-msvc -p victory-gpu -p victory --tests — pass
  • cargo clippy --no-deps --locked --release --target x86_64-pc-windows-msvc -p victory-gpu --all-targets — 0 new warnings
  • PKG=victory-gpu ./build.sh test --lib -- pipeline::known::tests:: — 6/6 passed (including new parse_memoizes_shared_shader_containers verifying repeated (stage, hash) entries hit the memoized cache and return identical Arc pointers)
  • Cost: transient HashMap<(u8, [u8; 32]), Arc<Shader>> scoped to known::make(); dropped when prewarm finishes.

Created with Gemini 4 Neon in T3 Code.

**@⁠chefulano** on GitHub · 2026-12-05 20:27 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/627) `chefulano:perf/warm-memoize-shaders` → `main` · +52 −9 · 2 files · 1 commits · open During `victory warm`, `pipeline::known::make()` re-reads and re-hashes the same shared shader container bytes from disk for every pipeline that references a given `(stage, hash)` pair. This change memoizes resolved `Arc<Shader>` containers per `(stage_idx, hash)` inside `known::make()` and adds `pipeline::shader_hashed()` so each unique shader container is read from disk and hashed once per prewarm pass instead of once per pipeline entry. Ported cleanly from `gamingwithhomie/larp` (PR #29). ### Queue check - Independent of #549 (which updates `apps/victory/src/warm.rs` CLI flags and route filtering; this PR touches only `crates/victory-gpu/src/pipeline.rs` and `crates/victory-gpu/src/pipeline/known.rs`). ### Checks - `cargo xtask policy` — pass (`368 files ok`) - `cargo check --locked --release --target x86_64-pc-windows-msvc -p victory-gpu -p victory --tests` — pass - `cargo clippy --no-deps --locked --release --target x86_64-pc-windows-msvc -p victory-gpu --all-targets` — 0 new warnings - `PKG=victory-gpu ./build.sh test --lib -- pipeline::known::tests::` — 6/6 passed (including new `parse_memoizes_shared_shader_containers` verifying repeated `(stage, hash)` entries hit the memoized cache and return identical `Arc` pointers) - Cost: transient `HashMap<(u8, [u8; 32]), Arc<Shader>>` scoped to `known::make()`; dropped when prewarm finishes. Created with Gemini 4 Neon in T3 Code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 20:30:42 +00:00
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/627/head:github-bot/gh-627'
git switch 'github-bot/gh-627'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-627'
git switch 'github-bot/gh-627'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-627'
git switch 'github-bot/gh-627'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-627'
git switch 'main'
git merge --squash 'github-bot/gh-627'
git switch 'main'
git merge --ff-only 'github-bot/gh-627'
git switch 'main'
git merge 'github-bot/gh-627'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.