d3d12-gpu: prove the pipeline library survives a restart, with the deleted-file falsifier (#3103) #3489

Code

Clone this repository

Checkout

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

git fetch -u  "d3d12/library-roundtrip:KelboLive-d3d12/library-roundtrip"
git switch "KelboLive-d3d12/library-roundtrip"
Open
leonida/mandy
KelboLive wants to merge 2 commits from KelboLive/mandy:d3d12/library-roundtrip into main

This pull request can be merged automatically.

Conversation
Reviewers 0 approvals
  • No reviewers
Details
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 'd3d12/library-roundtrip:KelboLive-d3d12/library-roundtrip'
git switch 'KelboLive-d3d12/library-roundtrip'
First-time contributor

What/why

#3103's second ask: prove the pipeline library survives a process restart, against the finding that warm-precompiled pipelines were still recompiled in play.

Three child processes through the existing places harness, one isolated cache dir:

child 1  makes a named compute PSO, saves   -> made 2, loaded 0   (host-pipelines.bin 4,786 B)
child 2  fresh process, same folder           -> made 1, loaded 1   (loaded: true, wrong 0, read [1,2,3])
child 3  library file deleted, same name      -> made 2, loaded 0   (falsifier: made again)

The third child is committed inside the test: deleting the file (rather than skipping save) keeps the producer intact, so the middle line's load is attributable to the saved library and not to the driver's own cache. Timing cannot make that distinction; only the counters can, because library::pipeline raises LOADED on LoadComputePipeline success and MADE on the Create*PipelineState fallback.

LEONIDA_LIBRARY_PLAY_SAVE_MB=0 is set on every child (the parent's value is removed first), so every in-play write of host-pipelines.bin is refused and only the explicit library::save(true) can create the file. That save is conditional (!USED_CHANGED && added == 0 returns early); here the named StorePipeline makes added == 1.

Harness change

  • places/tests.rs: run delegates to a new run_with(dir, save, steps, env) so the test can set the save limit per child; a_run prints a counters made=... loaded=... line (parsed only by the new test's new arm); the new test is #[ignore]d like its neighbours.
  • library.rs: LIBRARY_FILE is pub(super) so the test can name the file it removes. Visibility only.

Does / does not prove

Proves: a named PSO stored by one process is written by library::save(true), and a fresh process on the same isolated folder loads it (LOADED +1, MADE -1, wrong 0, same reads), and does not when the file is gone.

Does not prove: the full title lifecycle - the child returns after library::save(true), whereas the title calls the same function from lifecycle::end before TerminateProcess; no window/device teardown, known::flush_on_exit, pipeline worker pool or in-play save. Nor the production static-sampler naming path on NVIDIA: ! is a test-only plain-name bypass of library::allows_static_samplers, safe here because Places::learn gives the samplers the places the next run's list gives them. The save/load itself is vendor-neutral, so the test has no nvidia guard. #3103's first-use report on a real run remains the in-title evidence.

Finding (pre-existing, not caused here)

On this machine (RTX 4070 Ti SUPER, driver 621.01) four of the module's existing #[ignore]d place tests fail on pristine origin/main 6b0498d37: a_stored_pipeline_reads_through_the_places_of_the_run_that_stored_it, pipelines_with_static_samplers_come_from_the_library, the_check_looks_at_every_kind_of_sampler, the_table_of_static_samplers. They assert the empirical static-sampler place model (first-use place order; a library-loaded pipeline keeps the storing process's places); that model appears driver-specific. This PR changes no place logic. Worth tracking separately.

Tests

  • New test, --ignored, three children: pass. Neighbouring a_run and harness tests: pass.
  • Full serial lib suite: 790 passed, 0 failed, 61 ignored.
  • clippy -D warnings clean; check_no_game_data.py exit 0; git diff --check clean.

Item: D3D12-PIPELINE-FIRST-USE (part 2), claimed in #3312. Depends on: none.
AI-assisted: DeepSeek V4.1 Flash (OpenCode); a read-only reviewer audited the diff and the falsifier.

## What/why #3103's second ask: prove the pipeline library survives a process restart, against the finding that `warm`-precompiled pipelines were still recompiled in play. Three child processes through the existing `places` harness, one isolated cache dir: ```text child 1 makes a named compute PSO, saves -> made 2, loaded 0 (host-pipelines.bin 4,786 B) child 2 fresh process, same folder -> made 1, loaded 1 (loaded: true, wrong 0, read [1,2,3]) child 3 library file deleted, same name -> made 2, loaded 0 (falsifier: made again) ``` The third child is committed inside the test: deleting the file (rather than skipping `save`) keeps the producer intact, so the middle line's load is attributable to the saved library and not to the driver's own cache. Timing cannot make that distinction; only the counters can, because `library::pipeline` raises `LOADED` on `LoadComputePipeline` success and `MADE` on the `Create*PipelineState` fallback. `LEONIDA_LIBRARY_PLAY_SAVE_MB=0` is set on every child (the parent's value is removed first), so every in-play write of `host-pipelines.bin` is refused and only the explicit `library::save(true)` can create the file. That save is conditional (`!USED_CHANGED && added == 0` returns early); here the named `StorePipeline` makes `added == 1`. ## Harness change - `places/tests.rs`: `run` delegates to a new `run_with(dir, save, steps, env)` so the test can set the save limit per child; `a_run` prints a `counters made=... loaded=...` line (parsed only by the new test's new arm); the new test is `#[ignore]`d like its neighbours. - `library.rs`: `LIBRARY_FILE` is `pub(super)` so the test can name the file it removes. Visibility only. ## Does / does not prove **Proves:** a named PSO stored by one process is written by `library::save(true)`, and a fresh process on the same isolated folder loads it (`LOADED` +1, `MADE` -1, `wrong 0`, same reads), and does not when the file is gone. **Does not prove:** the full title lifecycle - the child returns after `library::save(true)`, whereas the title calls the same function from `lifecycle::end` before `TerminateProcess`; no window/device teardown, `known::flush_on_exit`, pipeline worker pool or in-play save. Nor the production static-sampler naming path on NVIDIA: `!` is a test-only plain-name bypass of `library::allows_static_samplers`, safe here because `Places::learn` gives the samplers the places the next run's list gives them. The save/load itself is vendor-neutral, so the test has no `nvidia` guard. #3103's first-use report on a real run remains the in-title evidence. ## Finding (pre-existing, not caused here) On this machine (RTX 4070 Ti SUPER, driver 621.01) four of the module's existing `#[ignore]`d place tests fail on pristine `origin/main` `6b0498d37`: `a_stored_pipeline_reads_through_the_places_of_the_run_that_stored_it`, `pipelines_with_static_samplers_come_from_the_library`, `the_check_looks_at_every_kind_of_sampler`, `the_table_of_static_samplers`. They assert the empirical static-sampler place model (first-use place order; a library-loaded pipeline keeps the storing process's places); that model appears driver-specific. This PR changes no place logic. Worth tracking separately. ## Tests - New test, `--ignored`, three children: **pass**. Neighbouring `a_run` and harness tests: pass. - Full serial lib suite: **790 passed, 0 failed, 61 ignored**. - clippy `-D warnings` clean; `check_no_game_data.py` exit 0; `git diff --check` clean. Item: D3D12-PIPELINE-FIRST-USE (part 2), claimed in #3312. Depends on: none. AI-assisted: DeepSeek V4.1 Flash (OpenCode); a read-only reviewer audited the diff and the falsifier.
The save/reload path had no test that a pipeline stored by one process
is loaded by the next, only the in-process and driver-cache ones. Add
`a_stored_pipeline_is_loaded_by_the_next_process`, three child runs of
the existing `a_run` harness on one isolated cache folder:

- the first makes a synthetic compute pipeline under its plain name
  (`pipe=c!`) and leaves through `save`, `library::save(true)`;
- the second is a fresh process with the same folder and asks for the
  same name: it must load it (`LOADED` up one, `MADE` down one against
  the first run, `wrong` 0);
- the third deletes `host-pipelines.bin` (and the `.next` file) and asks
  again: it must make it (`LOADED` 0, `MADE` as in the first run), so the
  test fails without the saved file while the producer stays intact.

The test sets `LEONIDA_LIBRARY_PLAY_SAVE_MB=0`, so the in-play gate
(`in_play_most`) refuses every in-play write of `host-pipelines.bin` and
only the end-of-run save can write it; it asserts the file is non-empty
after the first child. The harness now prints the process's `MADE`/
`LOADED` counters, and `run_with` passes extra child env while removing
the parent's save limit for every child.

On NVIDIA `!` bypasses `allows_static_samplers` for the test; it is safe
because `Places::learn` gives `1,2p,3w` the places the next run's list
does. The save/load is vendor-neutral, so the test has no `nvidia`
guard. The child returns after `save(true)`, not through the title's
`lifecycle::end`, so the window/device lifecycle, `flush_on_exit` and
the worker pool are not exercised.
KelboLive force-pushed d3d12/library-roundtrip from 10ae88a5a6 to 6d3a5e1785 2026-12-04 20:53:18 +00:00 Compare
Author
First-time contributor

Replayed onto main 0036195a7 (head 6d3a5e178). No conflicts. One docs commit: the new test adds a LEONIDA_LIBRARY_PLAY_SAVE_MB reference, so the generated page counted it one higher; regenerated. 790 passed, 0 failed, 61 ignored (the new card test is #[ignore]d; its three-child run was green at the previous base and the rebase changed no test logic).

Replayed onto `main` `0036195a7` (head `6d3a5e178`). No conflicts. One docs commit: the new test adds a `LEONIDA_LIBRARY_PLAY_SAVE_MB` reference, so the generated page counted it one higher; regenerated. 790 passed, 0 failed, 61 ignored (the new card test is `#[ignore]`d; its three-child run was green at the previous base and the rebase changed no test logic).
KelboLive force-pushed d3d12/library-roundtrip from 6d3a5e1785 to 427078c67c 2026-12-04 23:20:35 +00:00 Compare
Author
First-time contributor

Replayed onto main f4b0404e9 (head 427078c67). No conflicts. 790 passed, 0 failed, 61 ignored.

Replayed onto `main` `f4b0404e9` (head `427078c67`). No conflicts. 790 passed, 0 failed, 61 ignored.
First-time contributor

Test report from a second machine (I changed no code). Not a review of the code.

  • Head 427078c67 merged onto main 93b9d90a2: clean merge.
  • RTX 3060 Ti 8 GB, driver 610.88, Windows 11.
  • cargo test -p leonida-gpu --lib --locked a_stored_pipeline_is_loaded_by_the_next_process -- --ignored --nocapture --test-threads=1: passed. The three children report the counters the description gives:
stored:                          made: 2, loaded: 0, loaded: false, wrong: 0, read: [1, 2, 3]
loaded:                          made: 1, loaded: 1, loaded: true,  wrong: 0, read: [1, 2, 3]
made again without the library:  made: 2, loaded: 0, loaded: false, wrong: 0, read: [1, 2, 3]
  • cargo test -p leonida-gpu --lib --locked pipeline::places -- --ignored --test-threads=1: 9 passed, 0 failed. That includes the four tests the description reports failing on an RTX 4070 Ti SUPER with driver 621.01 (a_stored_pipeline_reads_through_the_places_of_the_run_that_stored_it, pipelines_with_static_samplers_come_from_the_library, the_check_looks_at_every_kind_of_sampler, the_table_of_static_samplers). They pass here on 610.88, which fits the description's guess that the place model depends on the driver.
  • cargo test -p leonida-gpu --lib --locked -- --test-threads=1: 790 passed, 0 failed, 61 ignored.
  • Not run: clippy, the clean-room check, any in-game run.

GPUs tested: RTX 3060 Ti 8 GB, driver 610.88. No game files were used.

AI-assisted: yes (Claude Code, Claude Fable 5.2; verification only).

Test report from a second machine (I changed no code). Not a review of the code. - Head `427078c67` merged onto `main` `93b9d90a2`: clean merge. - RTX 3060 Ti 8 GB, driver 610.88, Windows 11. - `cargo test -p leonida-gpu --lib --locked a_stored_pipeline_is_loaded_by_the_next_process -- --ignored --nocapture --test-threads=1`: **passed**. The three children report the counters the description gives: ```text stored: made: 2, loaded: 0, loaded: false, wrong: 0, read: [1, 2, 3] loaded: made: 1, loaded: 1, loaded: true, wrong: 0, read: [1, 2, 3] made again without the library: made: 2, loaded: 0, loaded: false, wrong: 0, read: [1, 2, 3] ``` - `cargo test -p leonida-gpu --lib --locked pipeline::places -- --ignored --test-threads=1`: **9 passed, 0 failed**. That includes the four tests the description reports failing on an RTX 4070 Ti SUPER with driver 621.01 (`a_stored_pipeline_reads_through_the_places_of_the_run_that_stored_it`, `pipelines_with_static_samplers_come_from_the_library`, `the_check_looks_at_every_kind_of_sampler`, `the_table_of_static_samplers`). They pass here on 610.88, which fits the description's guess that the place model depends on the driver. - `cargo test -p leonida-gpu --lib --locked -- --test-threads=1`: 790 passed, 0 failed, 61 ignored. - Not run: clippy, the clean-room check, any in-game run. GPUs tested: RTX 3060 Ti 8 GB, driver 610.88. No game files were used. AI-assisted: yes (Claude Code, Claude Fable 5.2; verification only).
KelboLive force-pushed d3d12/library-roundtrip from 427078c67c to dff44cd0ed 2026-12-05 05:34:57 +00:00 Compare
Author
First-time contributor

Replayed onto main 93b9d90a2 (head dff44cd0e). No conflicts. 790 passed, 0 failed, 61 ignored.

Replayed onto `main` `93b9d90a2` (head `dff44cd0e`). No conflicts. 790 passed, 0 failed, 61 ignored.
KelboLive force-pushed d3d12/library-roundtrip from dff44cd0ed to a06ee33f9e 2026-12-05 08:44:34 +00:00 Compare
Author
First-time contributor

Replayed onto main c5355dd25 (head a06ee33f9). No conflicts. 791 passed, 0 failed, 61 ignored.

Replayed onto `main` `c5355dd25` (head `a06ee33f9`). No conflicts. 791 passed, 0 failed, 61 ignored.
KelboLive force-pushed d3d12/library-roundtrip from a06ee33f9e to b964df2d48 2026-12-05 08:53:35 +00:00 Compare
Author
First-time contributor

Replayed onto main e1b0248c1 (head b964df2d4). No conflicts. 791 passed, 0 failed, 61 ignored.

Replayed onto `main` `e1b0248c1` (head `b964df2d4`). No conflicts. 791 passed, 0 failed, 61 ignored.
KelboLive force-pushed d3d12/library-roundtrip from b964df2d48 to d413fc3003 2026-12-05 09:59:51 +00:00 Compare
Author
First-time contributor

Replayed onto main d99bb4d7a (head d413fc300). No conflicts. 794 passed, 0 failed, 61 ignored.

Replayed onto `main` `d99bb4d7a` (head `d413fc300`). No conflicts. 794 passed, 0 failed, 61 ignored.
Sign in to join this conversation.
No description provided.