Warm: pipelines are marked done by what is in them, so a translator setting remakes only the pipelines it changed #2731

Manually merged
github merged 1 commit from github-bot/gh-2731 into gh-pr/2731/base 2026-11-30 14:17:13 +00:00 AGit
Owner

@⁠dyshay on GitHub · 2026-11-29 16:41 UTC · original
dyshay:pr/warm-marks-by-content → main · +278 −24 · 4 files · 1 commits · merged 2026-11-30 14:12 UTC

Related: #1262, #1483.

What it changes

victory warm, the step of victory preload that makes every known pipeline ahead of a run, wrote each pipeline down as done under one fingerprint. That fingerprint held the translator and every setting in the shader cache's key (shader_cache::translation). Changing one switch that alters a few programs therefore changed the fingerprint for all of them, and the next preload made every known pipeline again. Here that was 83,564 pipelines and 33.7 min on an RTX 4090, while the translations themselves take about 20 s.

The pipeline library already names each pipeline by what its host description holds (library::name: the translated code, our root signature and the graphics state). The driver's own cache also keys by those bytes. This PR uses the same name for the done marks:

  • library::name_only runs code on one thread with library::pipeline loading and making nothing. It records the first name asked for. A guard puts the thread back even after a panic. HostPipeline::name_of runs HostPipeline::new inside it, so the name is the one a real make would use. It covers compute, graphics, the rectangle geometry stage, linked mesh shaders, depth bounds and primed static-sampler places. Inside it, new returns early instead of reporting, refusing or retrying.
  • known::names names the warm's pipelines on the warm's threads. The shaders are translated once each (the cache's hits after preload's shader step). Only the root signature is asked of the driver. Nothing is compiled.
  • warm marks a pipeline <marks> <name>. marks hashes the driver, the static samplers' order, the program and the card (known::made_for plus mark_fingerprint), but not the translator. When the name is in the marks, the pipeline is not made again. When its translated code or root signature changed, the name changed and the pipeline is made. Two title pipelines with one host description are made once. A pipeline with no name here (no host pipeline) is made as before and never marked.
  • With VICTORY_WARM_SHARED, fill_library marks by name in the same way.
  • The quarantine (warm-bad.txt) still follows the translator's fingerprint, as before (#779).

A stale entry cannot be used. A name is the hash of the exact bytes handed to the driver, so changed code always gives a new name. Marks from before this change are under other fingerprints, so the first warm after it makes everything once. Shader translations are still keyed by the whole translator and its settings, unchanged: they are cheap, and only the compiled pipelines are reused.

Expected effect: a switch that changes N programs still re-translates every shader, about 20 s on all cores (104 to 153 s in the passes below, on 16 low-priority threads). Naming takes 4 to 13 s. After that, only the pipelines that use those N programs are compiled, instead of all of them.

How it was tested

  • On the card, with the title: the same change on our integration branch, Series S profile with ray tracing, house scene, 300 s after a full preload. Median 47.8 ms, p95 88.4 ms (the same scene on the base before: 50.1 ms, p95 2,217 ms with a cold cache). The ray-tracing structure builder ran, and no pipeline was dropped for want of a host pipeline. The run reused the library written by the preload (12,486 loaded, 170 made at the end of the preload).

  • RTX 4090 (driver as installed), Windows 11, i9-13900KF. Offline only: no title run. victory preload --all --jobs 16 was run with a renamed copy of the diag build and a cache folder of its own (VICTORY_CACHE_DIR). The cache folder held a copy of the known pipelines from earlier runs (83,564 pipelines, 19,104 shaders). The preload ran on logical CPUs 16-31 at low priority.

    Passes in order. "Kept" means made before under the same name. "To make" includes pipelines the memory guard put off in an earlier pass, which are never marked.

pass setting shader step naming kept to make (of which put off before) preload
A default (first, nothing marked) 110 s 4.7 s 0 74,257 (9,307 more share a name) 47 min
B MED3_CLAMP=1 (in the key, same code) 108 s 3.7 s 56,574 26,598 (all 26,598) 247 s
D MED3_CLAMP=0 (rewrite off) 104 s 5.6 s 50,476 31,775 (23,593) 44 min
F MED3_CLAMP=0 again 43 s 4.4 s 83,563 1 (the one with no host pipeline) 188 s
G MINMAX_NONZERO=0 (rewrite off) 153 s 12.8 s 64,833 16,716 (0) 403 s
  • B: the setting changes the translation key but no program, so every shader was translated again and no pipeline changed its name. Before this PR it would have made all 74,257 again.
  • D: turning the med3 rewrite off changed the code of 9,189 of the 59,665 pipelines marked by then (about 11 %). Only those were compiled, beside the ones put off before. D also made 23,593 pipelines that pass A's memory guard had put off, which is why it took 44 min.
  • F: going back to a setting that was made before costs the shader step and the naming, with no compile.
  • G: 16,716 of 83,564 pipelines changed (about 20 %), against all of them before. During this pass a title run on the same PC held 30 GB, so the memory guard put off 15,163 of them for a later warm. The 403 s is therefore not a full make.
  • Pipelines put off by the memory guard (the commit left would fall under its floor, other runs on the PC) are not marked and are tried again by the next warm, as before this PR.
  • Cost: the warm's own process now translates every shader it names (about 2.9 GB private while it ran here). Naming took 3.7 to 12.8 s.
  • New tests, none of which needs a GPU or game data:
    • library::tests::naming_only_makes_nothing_and_ends: nothing is loaded or made, the first name comes back, and the thread makes pipelines again afterwards, also after a panic.
    • warm::tests::only_pipelines_whose_contents_changed_are_made_again: unchanged names are reused, a changed name is made, twins are made once, unnamed pipelines are made, and --again remakes.
    • warm::tests::done_marks_are_read_by_name_under_their_fingerprint: older marks and other fingerprints do not count.
    • warm::tests::marks_by_name_follow_program_card_and_driver_only.
  • cargo test --locked -p victory-gpu --lib -- pipeline:: shader_cache: 82 passed. cargo test --locked -p victory --bin victory -- warm::: 11 passed. cargo clippy -p victory-gpu -p victory --all-targets shows no warning in the lines this PR changes. With -D warnings, clippy already fails on main in victory-loader (crash.rs, unwind_copy never used).
  • For shader changes, the wave sizes tested: none. No translation changes; the host is 32 lanes.

Checked for overlap

  • I searched the open and closed pull requests for "cache key", "shader cache", "pipeline library", "warm-done", "preload", "fingerprint" and "done marks", and the issues for preload and warm. Nothing marks warm pipelines by content. Related, without overlap:
    • #2289 reports the warm history and changes no format, but touches warm.rs near the same lines, so a small rebase may be needed.
    • #1581 makes the translator key ignore comments and tests. It is complementary: fewer translator changes reach the key at all.
    • #1618 (merged) is VICTORY_WARM_SHARED, which this keeps.
    • #779 (merged) is the quarantine fingerprint, unchanged here.

Provenance: written for this PR, not ported from another fork.

AI-assisted: written with Claude Code (Claude Opus 5.5). I reviewed the change, and the measurements above were taken on my PC.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PVi6XmTj4ohPL7QwUeFgV4

**@⁠dyshay** on GitHub · 2026-11-29 16:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2731) `dyshay:pr/warm-marks-by-content` → `main` · +278 −24 · 4 files · 1 commits · merged 2026-11-30 14:12 UTC Related: #1262, #1483. ## What it changes `victory warm`, the step of `victory preload` that makes every known pipeline ahead of a run, wrote each pipeline down as done under one fingerprint. That fingerprint held the translator and every setting in the shader cache's key (`shader_cache::translation`). Changing one switch that alters a few programs therefore changed the fingerprint for all of them, and the next preload made every known pipeline again. Here that was 83,564 pipelines and 33.7 min on an RTX 4090, while the translations themselves take about 20 s. The pipeline library already names each pipeline by what its host description holds (`library::name`: the translated code, our root signature and the graphics state). The driver's own cache also keys by those bytes. This PR uses the same name for the done marks: - `library::name_only` runs code on one thread with `library::pipeline` loading and making nothing. It records the first name asked for. A guard puts the thread back even after a panic. `HostPipeline::name_of` runs `HostPipeline::new` inside it, so the name is the one a real make would use. It covers compute, graphics, the rectangle geometry stage, linked mesh shaders, depth bounds and primed static-sampler places. Inside it, `new` returns early instead of reporting, refusing or retrying. - `known::names` names the warm's pipelines on the warm's threads. The shaders are translated once each (the cache's hits after `preload`'s shader step). Only the root signature is asked of the driver. Nothing is compiled. - `warm` marks a pipeline `<marks> <name>`. `marks` hashes the driver, the static samplers' order, the program and the card (`known::made_for` plus `mark_fingerprint`), but not the translator. When the name is in the marks, the pipeline is not made again. When its translated code or root signature changed, the name changed and the pipeline is made. Two title pipelines with one host description are made once. A pipeline with no name here (no host pipeline) is made as before and never marked. - With `VICTORY_WARM_SHARED`, `fill_library` marks by name in the same way. - The quarantine (`warm-bad.txt`) still follows the translator's fingerprint, as before (#779). A stale entry cannot be used. A name is the hash of the exact bytes handed to the driver, so changed code always gives a new name. Marks from before this change are under other fingerprints, so the first warm after it makes everything once. Shader translations are still keyed by the whole translator and its settings, unchanged: they are cheap, and only the compiled pipelines are reused. Expected effect: a switch that changes N programs still re-translates every shader, about 20 s on all cores (104 to 153 s in the passes below, on 16 low-priority threads). Naming takes 4 to 13 s. After that, only the pipelines that use those N programs are compiled, instead of all of them. ## How it was tested - On the card, with the title: the same change on our integration branch, Series S profile with ray tracing, house scene, 300 s after a full preload. Median 47.8 ms, p95 88.4 ms (the same scene on the base before: 50.1 ms, p95 2,217 ms with a cold cache). The ray-tracing structure builder ran, and no pipeline was dropped for want of a host pipeline. The run reused the library written by the preload (12,486 loaded, 170 made at the end of the preload). - RTX 4090 (driver as installed), Windows 11, i9-13900KF. Offline only: no title run. `victory preload --all --jobs 16` was run with a renamed copy of the diag build and a cache folder of its own (`VICTORY_CACHE_DIR`). The cache folder held a copy of the known pipelines from earlier runs (83,564 pipelines, 19,104 shaders). The preload ran on logical CPUs 16-31 at low priority. Passes in order. "Kept" means made before under the same name. "To make" includes pipelines the memory guard put off in an earlier pass, which are never marked. | pass | setting | shader step | naming | kept | to make (of which put off before) | preload | |---|---|---|---|---|---|---| | A | default (first, nothing marked) | 110 s | 4.7 s | 0 | 74,257 (9,307 more share a name) | 47 min | | B | `MED3_CLAMP=1` (in the key, same code) | 108 s | 3.7 s | 56,574 | 26,598 (all 26,598) | 247 s | | D | `MED3_CLAMP=0` (rewrite off) | 104 s | 5.6 s | 50,476 | 31,775 (23,593) | 44 min | | F | `MED3_CLAMP=0` again | 43 s | 4.4 s | 83,563 | 1 (the one with no host pipeline) | 188 s | | G | `MINMAX_NONZERO=0` (rewrite off) | 153 s | 12.8 s | 64,833 | 16,716 (0) | 403 s | - B: the setting changes the translation key but no program, so every shader was translated again and no pipeline changed its name. Before this PR it would have made all 74,257 again. - D: turning the med3 rewrite off changed the code of 9,189 of the 59,665 pipelines marked by then (about 11 %). Only those were compiled, beside the ones put off before. D also made 23,593 pipelines that pass A's memory guard had put off, which is why it took 44 min. - F: going back to a setting that was made before costs the shader step and the naming, with no compile. - G: 16,716 of 83,564 pipelines changed (about 20 %), against all of them before. During this pass a title run on the same PC held 30 GB, so the memory guard put off 15,163 of them for a later warm. The 403 s is therefore not a full make. - Pipelines put off by the memory guard (`the commit left would fall under its floor`, other runs on the PC) are not marked and are tried again by the next warm, as before this PR. - Cost: the warm's own process now translates every shader it names (about 2.9 GB private while it ran here). Naming took 3.7 to 12.8 s. - New tests, none of which needs a GPU or game data: - `library::tests::naming_only_makes_nothing_and_ends`: nothing is loaded or made, the first name comes back, and the thread makes pipelines again afterwards, also after a panic. - `warm::tests::only_pipelines_whose_contents_changed_are_made_again`: unchanged names are reused, a changed name is made, twins are made once, unnamed pipelines are made, and `--again` remakes. - `warm::tests::done_marks_are_read_by_name_under_their_fingerprint`: older marks and other fingerprints do not count. - `warm::tests::marks_by_name_follow_program_card_and_driver_only`. - `cargo test --locked -p victory-gpu --lib -- pipeline:: shader_cache`: 82 passed. `cargo test --locked -p victory --bin victory -- warm::`: 11 passed. `cargo clippy -p victory-gpu -p victory --all-targets` shows no warning in the lines this PR changes. With `-D warnings`, clippy already fails on `main` in `victory-loader` (`crash.rs`, `unwind_copy` never used). - For shader changes, the wave sizes tested: none. No translation changes; the host is 32 lanes. ## Checked for overlap - [x] I searched the open and closed pull requests for "cache key", "shader cache", "pipeline library", "warm-done", "preload", "fingerprint" and "done marks", and the issues for preload and warm. Nothing marks warm pipelines by content. Related, without overlap: - #2289 reports the warm history and changes no format, but touches `warm.rs` near the same lines, so a small rebase may be needed. - #1581 makes the translator key ignore comments and tests. It is complementary: fewer translator changes reach the key at all. - #1618 (merged) is `VICTORY_WARM_SHARED`, which this keeps. - #779 (merged) is the quarantine fingerprint, unchanged here. Provenance: written for this PR, not ported from another fork. AI-assisted: written with Claude Code (Claude Opus 5.5). I reviewed the change, and the measurements above were taken on my PC. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01PVi6XmTj4ohPL7QwUeFgV4
`victory warm` (the heart of `preload`) marked each pipeline done under a
fingerprint holding the translator and all its settings, so one switch that
changes a few programs made every known pipeline again (83,564 here; 33.7 min
on an RTX 4090). Each pipeline is now named first as the library names it
(the hash of its translated code, root signature and graphics state, with
nothing compiled: `HostPipeline::name_of`, via `library::name_only`), and
marked by that name under the driver, sampler order, program and card. A
pipeline whose code a change left as it was keeps its name and is not made
again; one whose code changed has a new name and is made. Pipelines sharing
one host description are made once. The quarantine still follows the
translator, as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PVi6XmTj4ohPL7QwUeFgV4
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 16:43:41 +00:00
github-bot changed target branch from main to gh-pr/2731/base 2026-11-30 14:16:14 +00:00
github manually merged commit dc31a059b9 into gh-pr/2731/base 2026-11-30 14:16:16 +00:00
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/trustno1-coder--VIctory-NVIDIA!2731
No description provided.