feat(shader,pipeline): offline DXIL cache pre-warming (--save-cache) and opt-in multi-drop pipeline wait budget #572

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

@⁠iMarllun on GitHub · 2026-12-06 03:02 UTC · original
iMarllun:feat/offline-shader-prewarm → main · +146 −7 · 6 files · 1 commits · open

Summary

Adds two opt-in shader/pipeline stutter reduction features:

  1. Offline DXIL shader cache pre-warming (larp translate --save-cache):

    • Exposes shader_cache::probe_host(), shader_cache::warm_shader(), and shader_cache::counts() (re-exported through larp-hle::modules::d3d12x).
    • Adds --save-cache to larp translate, which opens the runtime cache/shaders directory, probes the host GPU's wave size (wave32) and descriptor heap limits ( iew_heap_limit, iew_title_limit) via probe_view_limit(), and translates all unique shader containers found in the provided paths in parallel directly into the runtime DXIL cache using identical cache keys to larp run.
    • Eliminates the RDNA2 -> IR -> DXIL CPU translation cost for lazy shaders encountered during gameplay.
  2. Opt-in multi-drop per-frame wait budget (LARP_PIPELINE_WAIT_MULTI_DROP=1):

    • Preserves the default dropped_once safeguard from #335 (
**@⁠iMarllun** on GitHub · 2026-12-06 03:02 UTC · [original](https://github.com/gamingwithhomie/larp/pull/572) `iMarllun:feat/offline-shader-prewarm` → `main` · +146 −7 · 6 files · 1 commits · open ## Summary Adds two opt-in shader/pipeline stutter reduction features: 1. **Offline DXIL shader cache pre-warming (larp translate --save-cache)**: - Exposes shader_cache::probe_host(), shader_cache::warm_shader(), and shader_cache::counts() (re-exported through larp-hle::modules::d3d12x). - Adds --save-cache to larp translate, which opens the runtime cache/shaders directory, probes the host GPU's wave size (wave32) and descriptor heap limits ( iew_heap_limit, iew_title_limit) via probe_view_limit(), and translates all unique shader containers found in the provided paths in parallel directly into the runtime DXIL cache using identical cache keys to larp run. - Eliminates the RDNA2 -> IR -> DXIL CPU translation cost for lazy shaders encountered during gameplay. 2. **Opt-in multi-drop per-frame wait budget (LARP_PIPELINE_WAIT_MULTI_DROP=1)**: - Preserves the default dropped_once safeguard from #335 (
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-06 03:04:00 +00:00
Author
Owner

@⁠christopear on GitHub · 2026-12-06 03:09 UTC · original

There’s an avoidable cold cache on upgrade to c2f06aee, even for players who never opt in. build() hashes the entire text of shader_cache.rs, including the new wrappers and the visibility change to counts(). Both ordinary and quad-masked DXIL entries use that build digest.

I ran the extracted build() hash in a native Rust test with the real larp-shader sources, holding host settings fixed (no device probe) and varying only the included file bytes. Digest prefixes in that fixture were

File bytes Build digest
Merge base 459db13 9f1eb03fd2f4
PR head 84b5fc4d54ab
Base with just counts made public 8be1368de64d
Base bytes restored 9f1eb03fd2f4

Could the three public forwarding functions live in larp-gpu’s lib.rs or a sibling module? They can call the existing crate-visible counts(), host_shader() and probe_view_limit() while leaving shader_cache.rs byte-identical. That preserves the existing invalidation mechanism for actual encoding changes.

This affects reuse across the upgrade. Offline warming and runtime in the same build can still agree. Old entries remain on disk. I haven't measured gameplay impact.

One separate CLI detail from reading translate::run. The early return for --save-cache silently skips --validate, --pipelines and --list even though clap accepts them together. Declaring conflicts would keep a successful warm-up from looking like a successful validation run.

**@⁠christopear** on GitHub · 2026-12-06 03:09 UTC · [original](https://github.com/gamingwithhomie/larp/pull/572#issuecomment-7450478084) There’s an avoidable cold cache on upgrade to `c2f06aee`, even for players who never opt in. [build()](https://github.com/gamingwithhomie/larp/blob/c2f06aee21/crates/larp-gpu/src/shader_cache.rs#L61-L102) hashes the entire text of shader_cache.rs, including the new wrappers and the visibility change to counts(). Both ordinary and quad-masked DXIL entries use that build digest. I ran the extracted build() hash in a native Rust test with the real larp-shader sources, holding host settings fixed (no device probe) and varying only the included file bytes. Digest prefixes in that fixture were | File bytes | Build digest | | --- | --- | | Merge base 459db13 | `9f1eb03fd2f4` | | PR head | `84b5fc4d54ab` | | Base with just counts made public | `8be1368de64d` | | Base bytes restored | `9f1eb03fd2f4` | Could the three public forwarding functions live in larp-gpu’s lib.rs or a sibling module? They can call the existing crate-visible counts(), host_shader() and probe_view_limit() while leaving shader_cache.rs byte-identical. That preserves the existing invalidation mechanism for actual encoding changes. This affects reuse across the upgrade. Offline warming and runtime in the same build can still agree. Old entries remain on disk. I haven't measured gameplay impact. One separate CLI detail from reading translate::run. The early return for --save-cache silently skips --validate, --pipelines and --list even though clap accepts them together. Declaring conflicts would keep a successful warm-up from looking like a successful validation run.
This pull request can be merged automatically.
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/572/head:github-bot/gh-572'
git switch 'github-bot/gh-572'

Merge

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