d3d12: leonida warm marks pipelines by what is in them (D3D12-WARM-BY-CONTENT) #3517

Code

Clone this repository

Checkout

From your project repository, check out a new branch and test the changes.

git fetch -u origin "+refs/pull/3517/head:oreofr/warm-marks-by-content"
git switch "oreofr/warm-marks-by-content"
Open
leonida/mandy
OreoFR wants to merge 1 commit from oreofr/warm-marks-by-content into main AGit

This branch is out-of-date with the base branch

Conversation
Reviewers 0 approvals
  • No reviewers
Details
This pull request is blocked because it's outdated.
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/3517/head:oreofr/warm-marks-by-content'
git switch 'oreofr/warm-marks-by-content'
Member

Item: D3D12-WARM-BY-CONTENT (asked by OreoFR, 2026-12-05). Follows #3511.

Problem. warm-done.txt marked each pipeline under the fingerprint of the whole translation. Any translator change (#3420 touches about 10 of 2,734 programs) made all ~90k pipelines again (about an hour), and each new set went into NVIDIA's shader cache on top of the old ones until it was full. From then on the driver kept nothing new and every start compiled in game (RTX 4070: 13 GB of driver files, full; a player's RTX 5080 shows the same warning).

Change.

  • leonida warm names the pipelines this translation has not made yet by what is in them (known::names, HostPipeline::name_of): the library name of their translated code, root signature and graphics state. Nothing is compiled; only root signatures are asked of the driver.
  • Those already made under that name (<content mark> <name> lines) are only marked, since the driver keeps them by what is in them. The content mark holds the driver and the static sampler list, not the translator.
  • Made pipelines are marked both ways (the pipeline library step still reads the old marks).
  • The first time, the pipelines this translation already made are named once, so a later translation finds them.
  • A start with nothing new names nothing.
  • library::name_only: pipeline() makes and loads nothing while naming, with a plain-data thread_local flag and no destructor (runtime trap in AGENTS.md). Refusal reports and the rectangle-stage retry are skipped while naming.
  • LEONIDA_WARM_BY_CONTENT=0: as before.
  • Adapted from Darner's marks by name (TrustNo1/Darner, GPL-3.0).

Measured (RTX 4070, on a copy of our cache, no game run):

  • 93,673 pipelines named in 74 s the first time (shaders not translated yet), 4.8 s after.
  • 100 pipelines made, then this translation's marks dropped to stand for a translator change: 566 found made before by their content, none compiled. Several title pipelines give the same host pipeline, a small extra saving.
  • LEONIDA_WARM_BY_CONTENT=0 gives the old counts.

Tested (Windows 11):

  • cargo test -p leonida warm: 14, 2 new.
  • cargo test -p leonida-gpu pipeline: 71.
  • clippy, the diag build, tests/test_d3d12_switches.py (switches.md regenerated), check_no_game_data.
  • Not run in game yet: the next step is a real translator change (main → beta) on the 4070, timing the precompile and counting in-game compiles.

AI-assisted (oreofr-agent).

🤖 Generated with Claude Code

Item: D3D12-WARM-BY-CONTENT (asked by OreoFR, 2026-12-05). Follows #3511. **Problem.** `warm-done.txt` marked each pipeline under the fingerprint of the whole translation. Any translator change (#3420 touches about 10 of 2,734 programs) made all ~90k pipelines again (about an hour), and each new set went into NVIDIA's shader cache on top of the old ones until it was full. From then on the driver kept nothing new and every start compiled in game (RTX 4070: 13 GB of driver files, full; a player's RTX 5080 shows the same warning). **Change.** - `leonida warm` names the pipelines this translation has not made yet by what is in them (`known::names`, `HostPipeline::name_of`): the library name of their translated code, root signature and graphics state. Nothing is compiled; only root signatures are asked of the driver. - Those already made under that name (`<content mark> <name>` lines) are only marked, since the driver keeps them by what is in them. The content mark holds the driver and the static sampler list, not the translator. - Made pipelines are marked both ways (the pipeline library step still reads the old marks). - The first time, the pipelines this translation already made are named once, so a later translation finds them. - A start with nothing new names nothing. - `library::name_only`: `pipeline()` makes and loads nothing while naming, with a plain-data `thread_local` flag and no destructor (runtime trap in AGENTS.md). Refusal reports and the rectangle-stage retry are skipped while naming. - `LEONIDA_WARM_BY_CONTENT=0`: as before. - Adapted from Darner's marks by name (TrustNo1/Darner, GPL-3.0). **Measured** (RTX 4070, on a copy of our cache, no game run): - 93,673 pipelines named in 74 s the first time (shaders not translated yet), 4.8 s after. - 100 pipelines made, then this translation's marks dropped to stand for a translator change: **566 found made before by their content, none compiled**. Several title pipelines give the same host pipeline, a small extra saving. - `LEONIDA_WARM_BY_CONTENT=0` gives the old counts. **Tested** (Windows 11): - `cargo test -p leonida warm`: 14, 2 new. - `cargo test -p leonida-gpu pipeline`: 71. - clippy, the diag build, `tests/test_d3d12_switches.py` (switches.md regenerated), `check_no_game_data`. - **Not run in game yet**: the next step is a real translator change (main → beta) on the 4070, timing the precompile and counting in-game compiles. AI-assisted (oreofr-agent). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
warm-done.txt marked each pipeline under the fingerprint of the whole translation, so any translator
change made every pipeline again (about an hour), and each new set went into NVIDIA's shader cache on top
of the old ones until it was full: then the driver kept nothing new and every start compiled in game.

Now the pipelines this translation has not made are named by what is in them (known::names: the library
name of their translated code, root signature and graphics state, computed with HostPipeline::name_of
without asking the driver for anything but root signatures), and those made before under that name are
only marked: the driver keeps them by what is in them. The content mark is made of the driver and the
static sampler list, not the translator. Made pipelines are marked both ways (the library step still
reads the old marks). The first time, the pipelines this translation already made are named once so a
later translation finds them. A start with nothing new names nothing. LEONIDA_WARM_BY_CONTENT=0: as before.

library::name_only runs HostPipeline::new with pipeline() making and loading nothing (a plain-data
thread_local flag, no destructor; the first name is kept per thread), and the refusal reports and the
rectangle-stage retry are skipped while naming. After Darner's marks by name (TrustNo1/Darner, GPL-3.0).

Measured on a copy of our cache (RTX 4070, no game run): 93,673 pipelines named in 74 s the first time
(shaders not yet translated), 4.8 s after. 100 pipelines made, then this translation's marks dropped to
stand for a translator change: 566 found made before by their content (pipelines of the title that give
the same host pipeline), none compiled.

Tested: cargo test -p leonida warm (14, 2 new), cargo test -p leonida-gpu pipeline (71), clippy, the
diag build, tests/test_d3d12_switches.py, check_no_game_data. Not run in game yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
First-time contributor

Verified at head 07483d39, merge base 93b9d90a. Both new tests are absent on the base (git grep -F for each name at 93b9d90a: no match), and run green here.

cargo test -p leonida --locked warm::tests::marks_are_read_under_their_own_mark_only -- --exact
#   test warm::tests::marks_are_read_under_their_own_mark_only ... ok   1 passed
cargo test -p leonida --locked warm::tests::a_pipeline_made_before_by_its_content_is_not_made_again -- --exact
#   test warm::tests::a_pipeline_made_before_by_its_content_is_not_made_again ... ok   1 passed
cargo test -p leonida --locked warm::tests::
#   14 passed; 0 failed
cargo test -p leonida-gpu --locked --lib pipeline::
#   71 passed; 0 failed; 8 ignored (ignored not counted)

git diff --check against 93b9d90a: clean. scripts/check_no_game_data.py on the five changed files: clean.

Scope. The two tests are pure unit tests of marked and by_name (marks read under their own mark; names made before by content reused, unknown names and no-name entries made as before), so they need no device and none was used. The leonida-gpu run was a regression check on the touched pipeline module, not new-test evidence. This PR's diff does not touch play-nvidia.ps1; it was verified standalone on the base, without #3511 applied.

Limits. Unit-level only: the "about 10 of 2,734 programs change" premise and the hour saved per translator change are the author's measurements, not reproduced here.

AI-assisted (Hy4 flash). GPU: RTX 5060 Laptop (driver 621.40) and Radeon 780M present, unused (no test creates a device). No game data used or needed.

Verified at head 07483d39, merge base 93b9d90a. Both new tests are absent on the base (`git grep -F` for each name at 93b9d90a: no match), and run green here. ```powershell cargo test -p leonida --locked warm::tests::marks_are_read_under_their_own_mark_only -- --exact # test warm::tests::marks_are_read_under_their_own_mark_only ... ok 1 passed cargo test -p leonida --locked warm::tests::a_pipeline_made_before_by_its_content_is_not_made_again -- --exact # test warm::tests::a_pipeline_made_before_by_its_content_is_not_made_again ... ok 1 passed cargo test -p leonida --locked warm::tests:: # 14 passed; 0 failed cargo test -p leonida-gpu --locked --lib pipeline:: # 71 passed; 0 failed; 8 ignored (ignored not counted) ``` `git diff --check` against 93b9d90a: clean. `scripts/check_no_game_data.py` on the five changed files: clean. **Scope.** The two tests are pure unit tests of `marked` and `by_name` (marks read under their own mark; names made before by content reused, unknown names and no-name entries made as before), so they need no device and none was used. The `leonida-gpu` run was a regression check on the touched `pipeline` module, not new-test evidence. This PR's diff does not touch `play-nvidia.ps1`; it was verified standalone on the base, without #3511 applied. **Limits.** Unit-level only: the "about 10 of 2,734 programs change" premise and the hour saved per translator change are the author's measurements, not reproduced here. AI-assisted (Hy4 flash). GPU: RTX 5060 Laptop (driver 621.40) and Radeon 780M present, unused (no test creates a device). No game data used or needed.
First-time contributor

Correction to my verification above: the second test's name is a_pipeline_made_before_by_its_content_is_not_made_again (the prose garbled it; the command block has the right name). Results stand: both new tests pass, warm::tests 14 passed.

AI-assisted (Hy4 flash). No game data.

Correction to my verification above: the second test's name is `a_pipeline_made_before_by_its_content_is_not_made_again` (the prose garbled it; the command block has the right name). Results stand: both new tests pass, `warm::tests` 14 passed. AI-assisted (Hy4 flash). No game data.
Sign in to join this conversation.
No description provided.