d3d12: rewrite a missed journal file from an empty cache when the seeded one kept its data (RT-JOURNAL-SEEDED-REWRITE) #2179

Closed
Krashgamer wants to merge 4 commits from upstream-pr/2179 into main
Krashgamer commented 2026-11-26 02:38:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-26T02:38:34Z.


Claimed in the coordination issue as: RT-JOURNAL-SEEDED-REWRITE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7180979118)

What and why

The compute pipeline journal (#2098) rewrites a pipeline's file after a miss. When the file was loaded (the cache was seeded from it) and the pipeline still missed, the rewrite came from that seeded cache. On NVIDIA that cache came back exactly as loaded, without the pipeline just compiled, so the file never changed and the same pipelines missed and compiled in the driver on every boot, holding the compile gate while the title waited to submit.

Measured on an RTX 3080 10 GB, NVIDIA 610.88:

  • The same ~21 library compute pipelines missed in every boot (file loaded, creation feedback no hit, 2.4–9 s each, about 140 s per boot). Two boots in a row wrote byte-identical files for all of them.
  • With those files moved aside, one boot compiled them into empty caches and the next took all 21 from their files (40–60 ms each). So the files, not the pipelines, were the problem.
  • vk_pipeline_check alone does not reproduce it: a cache seeded with another pipeline grows and gives a hit the next run. Where the stale files first came from is not determined.

Change: after a seeded miss, JournalCache::restart_empty() asks the cache for its data size. If it is still the loaded size, the cache is swapped for an empty one and the pipeline is created once more against it; that pipeline is kept and its cache is written. The second create took 15–78 ms (mean ~41 ms over 28), since the driver still has the pipeline. A seeded cache that did take the pipeline (a different size) is rewritten as before, so drivers without this behaviour are unchanged. One log line per rebuild: pipeline journal: <name> missed its journal file (N ms); built again against an empty cache in M ms.

Tested

Boots of 180–300 s on Windows 11, LEONIDA_COMPILE_HELPER=1 LEONIDA_ASYNC_PIPELINES=1 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_CONSOLE_FIX_US=0, on main 88479ff65 + #2138 + #1914 + #1886 with this change (the PR branch itself is this commit alone on current main; built with Ninja/MSVC, gta6rt links):

boot warm-up hits slow warm-up misses compile-gate stalls
before (3 boots) 1423 20–24 (~140 s) 21
with the change, 1st — 28 rebuilt, 15–78 ms extra each 26
2nd 28 of 28 rebuilt now hit 20 (further files, rebuilt) 18
3rd (300 s) 1770, 48 of 48 rebuilt hit 4 (33 s) 4

Each boot repairs the stale files it reaches; the count goes down as the warm-up gets further.

Changes since the first version

  • c5bc7b0c5 (from ecox982745's review): when the create against the empty cache fails, the first pipeline is kept and nothing is published, so the old file stays as it was.
  • 7a70814b6 (from the reviews of zmasi, ecox982745 and timbot103): restart_empty() compares the cache's size with the payload Vulkan was given (info.initialDataSize, recorded in create()), not with the writable file's size. The two differ when the data came from the read-only seed folder (local file missing or invalid) and, with #2511, by its 24-byte stamp. file_.bytes stays for the disk budget.
  • Rebased on main 8f41d7d01 (conflict in build_compute_pipeline: main's hit_reported and this PR's journal_retry_failed both kept). The commits above had other IDs before the rebase (abbc1a4f8, 4212cf5ab, 49b8998de); the changes are the same.

Test: d3d12_compute_journal_seeded_miss (f230da518)

d3d12_compute_journal_test gets a test-only layer between the runtime and the driver (--keep-seeded-cache-data): a pipeline cache made from initial data answers vkGetPipelineCacheData with exactly that data, as NVIDIA 610.88 did here. Other drivers grow the cache instead, so the layer makes the case reproducible on any GPU, the way merzleckeier's wrapper did. Pipelines, dispatches and readbacks stay the real driver's, and no production code changes for the test. --fail-cache-retry also fails the create against the empty cache.

scripts/check_compute_journal_seeded_miss.py (registered in CTest) runs each case in its own process and cache folder, with shader A's journal data under shader B's key:

case required
stale-local: A's data in B's local file the file is rewritten with B's pipeline; a fresh process seeded from it hits (asserted when a control run shows the driver reports application-cache hits)
external-seed: no local file, A's data in the seed folder the local file is written with B's pipeline; the seed keeps its bytes and last-write time
invalid-local-external-seed: 7 invalid local bytes, A's data in the seed as external-seed
failed-retry: as stale-local, retry create fails the dispatch still reads back (4,14); the file keeps its bytes and last-write time

Red and green, Windows 11 (26200), RTX 3080 10 GB, NVIDIA 610.88, Ninja RelWithDebInfo:

  • Green, on the same changes merged with main ad36782c6 (c9777e386, before the rebase): all four cases pass, 5 runs in a row; also with LEONIDA_VK_VALIDATION=1 (0 validation errors). The runtime logs the retry (built again against an empty cache ... (VkResult 0)).
  • Red, main ad36782c6 with only the test applied: ERROR: stale-local: the journal file was rewritten with the data it was read from. Run by hand on main, all four cases fail: B's local file ends with A's bytes in the three rewrite cases, and in failed-retry no retry happens and the file is rewritten.
  • Negative control, this head with only the size comparison put back to file_.bytes (as in the first two commits): stale-local passes, external-seed fails. So the test covers both fixes separately.

Full suite (ctest -j 6, 577 tests each), c9777e386 against main ad36782c6 + the test: no new failure. xbox_present fails on both (as on main in OreoFR's run); d3d12_compute_journal_seeded_miss fails only on main; d3d12_state_sweep and dxgi_waitable_latency failed once in the parallel run on the PR tree and pass 3 of 3 alone on both trees. After the rebase onto 8f41d7d01 (no commit since ad36782c6 touches this PR's files) gta6rt builds, the three journal tests pass 3 runs in a row, and the seeded-miss script passes with LEONIDA_VK_VALIDATION=1.

GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 Pro 26200

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change; this PR only changes the runtime's pipeline journal)

Related: HasiKe's finding in #1608 that the NVIDIA session cache keeps its loaded size across checkpoints may be the same driver behaviour for the shared cache; this PR does not touch that path.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5502993277 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-26T02:38:34Z. --- Claimed in the coordination issue as: RT-JOURNAL-SEEDED-REWRITE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7180979118) ### What and why The compute pipeline journal (#2098) rewrites a pipeline's file after a miss. When the file was loaded (the cache was seeded from it) and the pipeline still missed, the rewrite came from that seeded cache. On NVIDIA that cache came back exactly as loaded, without the pipeline just compiled, so the file never changed and the same pipelines missed and compiled in the driver on every boot, holding the compile gate while the title waited to submit. Measured on an RTX 3080 10 GB, NVIDIA 610.88: - The same ~21 library compute pipelines missed in every boot (file loaded, creation feedback no hit, 2.4–9 s each, about 140 s per boot). Two boots in a row wrote byte-identical files for all of them. - With those files moved aside, one boot compiled them into empty caches and the next took all 21 from their files (40–60 ms each). So the files, not the pipelines, were the problem. - `vk_pipeline_check` alone does not reproduce it: a cache seeded with another pipeline grows and gives a hit the next run. Where the stale files first came from is not determined. Change: after a seeded miss, `JournalCache::restart_empty()` asks the cache for its data size. If it is still the loaded size, the cache is swapped for an empty one and the pipeline is created once more against it; that pipeline is kept and its cache is written. The second create took 15–78 ms (mean ~41 ms over 28), since the driver still has the pipeline. A seeded cache that did take the pipeline (a different size) is rewritten as before, so drivers without this behaviour are unchanged. One log line per rebuild: `pipeline journal: <name> missed its journal file (N ms); built again against an empty cache in M ms`. ### Tested Boots of 180–300 s on Windows 11, `LEONIDA_COMPILE_HELPER=1 LEONIDA_ASYNC_PIPELINES=1 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_CONSOLE_FIX_US=0`, on main 88479ff65 + #2138 + #1914 + #1886 with this change (the PR branch itself is this commit alone on current main; built with Ninja/MSVC, `gta6rt` links): | boot | warm-up hits | slow warm-up misses | compile-gate stalls | |---|---|---|---| | before (3 boots) | 1423 | 20–24 (~140 s) | 21 | | with the change, 1st | — | 28 rebuilt, 15–78 ms extra each | 26 | | 2nd | 28 of 28 rebuilt now hit | 20 (further files, rebuilt) | 18 | | 3rd (300 s) | 1770, 48 of 48 rebuilt hit | 4 (33 s) | 4 | Each boot repairs the stale files it reaches; the count goes down as the warm-up gets further. ### Changes since the first version - `c5bc7b0c5` (from ecox982745's review): when the create against the empty cache fails, the first pipeline is kept and nothing is published, so the old file stays as it was. - `7a70814b6` (from the reviews of zmasi, ecox982745 and timbot103): `restart_empty()` compares the cache's size with the payload Vulkan was given (`info.initialDataSize`, recorded in `create()`), not with the writable file's size. The two differ when the data came from the read-only seed folder (local file missing or invalid) and, with #2511, by its 24-byte stamp. `file_.bytes` stays for the disk budget. - Rebased on `main` `8f41d7d01` (conflict in `build_compute_pipeline`: `main`'s `hit_reported` and this PR's `journal_retry_failed` both kept). The commits above had other IDs before the rebase (`abbc1a4f8`, `4212cf5ab`, `49b8998de`); the changes are the same. ### Test: `d3d12_compute_journal_seeded_miss` (`f230da518`) `d3d12_compute_journal_test` gets a test-only layer between the runtime and the driver (`--keep-seeded-cache-data`): a pipeline cache made from initial data answers `vkGetPipelineCacheData` with exactly that data, as NVIDIA 610.88 did here. Other drivers grow the cache instead, so the layer makes the case reproducible on any GPU, the way merzleckeier's wrapper did. Pipelines, dispatches and readbacks stay the real driver's, and no production code changes for the test. `--fail-cache-retry` also fails the create against the empty cache. `scripts/check_compute_journal_seeded_miss.py` (registered in CTest) runs each case in its own process and cache folder, with shader A's journal data under shader B's key: | case | required | |---|---| | stale-local: A's data in B's local file | the file is rewritten with B's pipeline; a fresh process seeded from it hits (asserted when a control run shows the driver reports application-cache hits) | | external-seed: no local file, A's data in the seed folder | the local file is written with B's pipeline; the seed keeps its bytes and last-write time | | invalid-local-external-seed: 7 invalid local bytes, A's data in the seed | as external-seed | | failed-retry: as stale-local, retry create fails | the dispatch still reads back (4,14); the file keeps its bytes and last-write time | Red and green, Windows 11 (26200), RTX 3080 10 GB, NVIDIA 610.88, Ninja RelWithDebInfo: - **Green**, on the same changes merged with `main` `ad36782c6` (`c9777e386`, before the rebase): all four cases pass, 5 runs in a row; also with `LEONIDA_VK_VALIDATION=1` (0 validation errors). The runtime logs the retry (`built again against an empty cache ... (VkResult 0)`). - **Red**, `main` `ad36782c6` with only the test applied: `ERROR: stale-local: the journal file was rewritten with the data it was read from`. Run by hand on `main`, all four cases fail: B's local file ends with A's bytes in the three rewrite cases, and in failed-retry no retry happens and the file is rewritten. - **Negative control**, this head with only the size comparison put back to `file_.bytes` (as in the first two commits): stale-local passes, external-seed fails. So the test covers both fixes separately. Full suite (`ctest -j 6`, 577 tests each), `c9777e386` against `main` `ad36782c6` + the test: no new failure. `xbox_present` fails on both (as on `main` in OreoFR's run); `d3d12_compute_journal_seeded_miss` fails only on `main`; `d3d12_state_sweep` and `dxgi_waitable_latency` failed once in the parallel run on the PR tree and pass 3 of 3 alone on both trees. After the rebase onto `8f41d7d01` (no commit since `ad36782c6` touches this PR's files) `gta6rt` builds, the three journal tests pass 3 runs in a row, and the seeded-miss script passes with `LEONIDA_VK_VALIDATION=1`. GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 Pro 26200 AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change; this PR only changes the runtime's pipeline journal) Related: HasiKe's finding in #1608 that the NVIDIA session cache keeps its loaded size across checkpoints may be the same driver behaviour for the shared cache; this PR does not touch that path. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ecox982745 commented 2026-11-26 02:48:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-26T02:48:52Z.


If the optional second compilation fails, the dispatch still works, but this head replaces the existing journal entry with a 36-byte empty NVIDIA cache. I reproduced this in both directions with the two authored modules from d3d12_compute_journal_test, on abbc1a4f8276c1dd84b5885ace81aa5e7e577592 (RTX 4090, Windows 11, NVIDIA 616.64, Khronos validation on).

Case What happened on this head
Normal driver, A’s journal under B’s key or vice versa Cache grew to 15,464 bytes. The next process reported a journal hit for the target shader.
Simulated unchanged-size miss, successful second create The replacement held the target shader. Both fresh processes reported journal hits and returned the expected counters.
Same miss, second create returns VK_ERROR_OUT_OF_HOST_MEMORY The first pipeline still dispatched correctly, but the 7,747- and 7,753-byte files were each overwritten with 36 bytes.

For the last two cases I changed the first post-build cache-size query to return the size loaded from disk. For the failure case only, the test shim also returned the error on the second pipeline create. All other driver calls and GPU readbacks were real. The unmodified driver grew the cache in this synthetic test.

The first create produced a valid pipeline, so journal.finish gets built=true even when nothing was built into the replacement cache. The empty blob on this driver is larger than the 32-byte minimum. The change below keeps the usable pipeline and prevents publication on that path. With it, the old files kept their SHA-256 hashes in both failure cases, the successful retries still produced next-process hits, and all dispatches returned the expected (4,10) or (4,14).

AI-assisted with OpenAI Codex (gpt-6.2-astra).

Tested patch against abbc1a4f8
--- a/runtime/shims/d3d12_vulkan_device.cpp
+++ b/runtime/shims/d3d12_vulkan_device.cpp
@@ -10405,6 +10405,7 @@
     auto& compiling = leonida::driver_compile;
     VkResult created = VK_ERROR_UNKNOWN;
     bool from_shared = false, probe_compiled = false;
+    bool journal_retry_failed = false;
     ULONGLONG probe_ms = 0, driver_ms = 0;
     {
         // Every driver call of the build (shader module, journal cache, pipeline) in one turn through the compile
@@ -10455,7 +10456,8 @@
                 const ULONGLONG at_again = GetTickCount64();
                 const VkResult again_result = vk.vkCreateComputePipelines(dev, journal.cache, 1, &pipeline_info, nullptr, &again);
                 const ULONGLONG again_ms = GetTickCount64() - at_again;
-                if (again_result == VK_SUCCESS && again) {
+                journal_retry_failed = again_result != VK_SUCCESS || !again;
+                if (!journal_retry_failed) {
                     vk.vkDestroyPipeline(dev, built, nullptr);
                     built = again;
                 }
@@ -10467,7 +10469,7 @@
         }
         compiling.name.store(nullptr, std::memory_order_release);
         vk.vkDestroyShaderModule(dev, module, nullptr);  // Vulkan lets a module go once the pipeline exists
-        journal.finish(!from_shared && created == VK_SUCCESS && built, trace.hit(), driver_ms);
+        journal.finish(!from_shared && !journal_retry_failed && created == VK_SUCCESS && built, trace.hit(), driver_ms);
     }
     std::vector<std::uint32_t>().swap(words);
     profile.finish(int(created));
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7181142402 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2179#issuecomment-7181142402). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-26T02:48:52Z. --- **If the optional second compilation fails, the dispatch still works, but this head replaces the existing journal entry with a 36-byte empty NVIDIA cache.** I reproduced this in both directions with the two authored modules from `d3d12_compute_journal_test`, on `abbc1a4f8276c1dd84b5885ace81aa5e7e577592` (RTX 4090, Windows 11, NVIDIA 616.64, Khronos validation on). | Case | What happened on this head | |---|---| | Normal driver, A’s journal under B’s key or vice versa | Cache grew to 15,464 bytes. The next process reported a journal hit for the target shader. | | Simulated unchanged-size miss, successful second create | The replacement held the target shader. Both fresh processes reported journal hits and returned the expected counters. | | Same miss, second create returns `VK_ERROR_OUT_OF_HOST_MEMORY` | The first pipeline still dispatched correctly, but the 7,747- and 7,753-byte files were each overwritten with 36 bytes. | For the last two cases I changed the first post-build cache-size query to return the size loaded from disk. For the failure case only, the test shim also returned the error on the second pipeline create. All other driver calls and GPU readbacks were real. The unmodified driver grew the cache in this synthetic test. The first create produced a valid pipeline, so `journal.finish` gets `built=true` even when nothing was built into the replacement cache. The empty blob on this driver is larger than the 32-byte minimum. The change below keeps the usable pipeline and prevents publication on that path. With it, the old files kept their SHA-256 hashes in both failure cases, the successful retries still produced next-process hits, and all dispatches returned the expected `(4,10)` or `(4,14)`. AI-assisted with OpenAI Codex (`gpt-6.2-astra`). <details><summary>Tested patch against abbc1a4f8</summary> ```diff --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp @@ -10405,6 +10405,7 @@ auto& compiling = leonida::driver_compile; VkResult created = VK_ERROR_UNKNOWN; bool from_shared = false, probe_compiled = false; + bool journal_retry_failed = false; ULONGLONG probe_ms = 0, driver_ms = 0; { // Every driver call of the build (shader module, journal cache, pipeline) in one turn through the compile @@ -10455,7 +10456,8 @@ const ULONGLONG at_again = GetTickCount64(); const VkResult again_result = vk.vkCreateComputePipelines(dev, journal.cache, 1, &pipeline_info, nullptr, &again); const ULONGLONG again_ms = GetTickCount64() - at_again; - if (again_result == VK_SUCCESS && again) { + journal_retry_failed = again_result != VK_SUCCESS || !again; + if (!journal_retry_failed) { vk.vkDestroyPipeline(dev, built, nullptr); built = again; } @@ -10467,7 +10469,7 @@ } compiling.name.store(nullptr, std::memory_order_release); vk.vkDestroyShaderModule(dev, module, nullptr); // Vulkan lets a module go once the pipeline exists - journal.finish(!from_shared && created == VK_SUCCESS && built, trace.hit(), driver_ms); + journal.finish(!from_shared && !journal_retry_failed && created == VK_SUCCESS && built, trace.hit(), driver_ms); } std::vector<std::uint32_t>().swap(words); profile.finish(int(created)); ``` </details>
Krashgamer commented 2026-11-26 02:50:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-26T02:50:45Z.


Thanks, @ecox982745, that's a real hole. Your change is in 4212cf5ab: a failed create against the empty cache now keeps the first pipeline and publishes nothing, so the old file stays. Rebuilt gta6rt and d3d12_compute_journal_test on the branch; the test passes on an RTX 3080 (NVIDIA 610.88, Windows 11). AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7181169750 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2179#issuecomment-7181169750). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-26T02:50:45Z. --- Thanks, @ecox982745, that's a real hole. Your change is in 4212cf5ab: a failed create against the empty cache now keeps the first pipeline and publishes nothing, so the old file stays. Rebuilt `gta6rt` and `d3d12_compute_journal_test` on the branch; the test passes on an RTX 3080 (NVIDIA 610.88, Windows 11). AI-assisted (Claude Code, Claude Opus 5.5).
lixonik commented 2026-11-26 11:03:03 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T11:03:03Z.

Review: COMMENTED


Built d3d12_compute_journal_test at this head with MSVC on Windows 11. The authored overlay scenario passed: cold A and new B both produced journal entries, external A was a driver hit with zero local entries, and the follow-up B was a local hit. Readbacks matched in all four processes. GPU: NVIDIA GeForce RTX 5070, driver 610.88. This covers the normal cold, seeded-hit and local-hit paths. The synthetic fixture did not trigger a same-size seeded miss, so it did not verify the new retry path.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6072989792 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#pullrequestreview-6072989792). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T11:03:03Z. **Review:** COMMENTED --- Built `d3d12_compute_journal_test` at this head with MSVC on Windows 11. The authored overlay scenario passed: cold A and new B both produced journal entries, external A was a driver hit with zero local entries, and the follow-up B was a local hit. Readbacks matched in all four processes. GPU: NVIDIA GeForce RTX 5070, driver 610.88. This covers the normal cold, seeded-hit and local-hit paths. The synthetic fixture did not trigger a same-size seeded miss, so it did not verify the new retry path. AI-assisted.
Krashgamer commented 2026-11-26 15:22:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-26T15:22:59Z.


CI note: all six red jobs come from main, not from this change (it only touches runtime/shims/d3d12_vulkan_device.cpp):

  • linux-gpu-tools: vk_null_descriptor_test.cpp:97 uses LEONIDA_TEST_NULL_DESCRIPTORS_SPV unguarded, but runtime/CMakeLists.txt only defines it when glslangValidator is found. Main has the same code, and #2055 is open for it.
  • macos: GPU test cs_imgatomic_ext fails (6 of 64 sint words), and vk_overlapping_occlusion now passes but is still in the expected failures. Neither touches the journal path.
  • windows: the job was canceled at about 35 minutes during the build, so it never reached the tests.
  • check, macos-python: Python test files fail on main as well (test_bink_names, test_opus_tags, test_world_names, test_mod_pack_output_alias, ...). They are tracked in #1608 with open PRs.
  • translator-tests: the two cs_dpp_cmp.asm cases fail with llvm-mc 21 ("dpp variant of this instruction is not supported"). Per #1608, main is green there since #1375 was merged.

I'll rebase once main is green.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7196189194 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2179#issuecomment-7196189194). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-26T15:22:59Z. --- CI note: all six red jobs come from main, not from this change (it only touches `runtime/shims/d3d12_vulkan_device.cpp`): - **linux-gpu-tools**: `vk_null_descriptor_test.cpp:97` uses `LEONIDA_TEST_NULL_DESCRIPTORS_SPV` unguarded, but `runtime/CMakeLists.txt` only defines it when `glslangValidator` is found. Main has the same code, and #2055 is open for it. - **macos**: GPU test `cs_imgatomic_ext` fails (6 of 64 sint words), and `vk_overlapping_occlusion` now passes but is still in the expected failures. Neither touches the journal path. - **windows**: the job was canceled at about 35 minutes during the build, so it never reached the tests. - **check**, **macos-python**: Python test files fail on main as well (`test_bink_names`, `test_opus_tags`, `test_world_names`, `test_mod_pack_output_alias`, ...). They are tracked in #1608 with open PRs. - **translator-tests**: the two `cs_dpp_cmp.asm` cases fail with llvm-mc 21 ("dpp variant of this instruction is not supported"). Per #1608, main is green there since #1375 was merged. I'll rebase once main is green.
zmasi commented 2026-11-29 01:39:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:39:09Z.


Independently verified head 4212cf5ab3b133375af0f7baa723c38ea5896b17 merged cleanly onto origin/main (5825b02ff89bca1a2d1331d982818e3dbb74d597) on Windows 11 (10.0.26200), MSVC 19.44.35207 (RelWithDebInfo), NVIDIA GeForce RTX 3090 (driver 595.79), with VK_LAYER_KHRONOS_validation 1.4.363.1 (LEONIDA_VK_VALIDATION=1). No game files used.

Verification Results

  • Standard CTest Suite (#2179 merged with origin/main 5825b02ff8, LEONIDA_VK_VALIDATION=1 on RTX 3090):
    • pipeline_cache_journal: Passed (0.11 s).
    • compile_helper: Passed (0.65 s).
    • d3d12_compute_journal: Passed (0.59 s, direct Dispatch(4,1,1) copied both expected words (4,10), 0 Khronos validation errors).
    • d3d12_compute: Passed (1.13 s, 0 Khronos validation errors).
    • scripts/check_no_game_data.py: Passed.
  • Simulated Unchanged-Size Seeded Miss Probe on RTX 3090:
    • Seeded shader 2's cs-*.vkcache slot with shader 1's journal file in d3d12_compute_journal_test while forcing restart_empty()'s post-build size check to match NVIDIA's unchanged-size seeded miss:
      • First --second-shader process logged pipeline journal: counter missed its journal file (...); built again against an empty cache in ... ms (VkResult 0) to rewrite it, dispatched cleanly ((4,14)), and rewrote the journal file (0 Khronos validation errors).
      • Next fresh --second-shader process reported 1 compute pipeline(s) found in their journal file (so far: 1 from journal files, 0 written, 0 from the shared cache) and dispatched (4,14) cleanly (0 Khronos validation errors).
  • Also verified journal_retry_failed (4212cf5ab) correctly suppresses journal.finish publication (!journal_retry_failed) while keeping the first usable built VkPipeline if the optional empty-cache vkCreateComputePipelines fails.

Important Cross-PR Interaction Catch with Open PR #2511 (RT-PIPELINE-JOURNAL-BUILD-ID)

git merge-tree --write-tree between #2179 (4212cf5ab3) and #2511 (4a497c8f1b) auto-merges with 0 text conflicts, so Git will not flag an overlap — however, #2511's 24-byte LPJ1 stamp will silently disable #2179's restart_empty() 100% of the time on stamped files:

  1. In #2511 (runtime/src/pipeline_cache_journal.h), read_entry_file records entry.bytes = size (the on-disk file size, i.e., stamp_bytes (24) + blob_size, which JournalCache::publish() needs for replace_bytes(total, file_.bytes, file.size())) and then strips the 24-byte LPJ1 prefix from entry.data before JournalCache::create() passes info.initialDataSize = file_.data.size() (file_.bytes - 24) to vkCreatePipelineCache.
  2. In #2179, JournalCache::restart_empty() checks:
    if (vk.vkGetPipelineCacheData(device_.info.device, cache, &size, nullptr) != VK_SUCCESS || size != file_.bytes)
        return false;
    
    When NVIDIA returns the seeded driver blob unchanged (size == file_.bytes - 24), size != file_.bytes evaluates to true (blob_size != blob_size + 24), causing restart_empty() to return false without rebuilding against an empty cache!
  3. 1-line fix (works identically whether #2179 lands before or after #2511): record seeded_bytes_ = file_.data.size() in JournalCache::create() right before vkCreatePipelineCache / swapping file_.data, and compare size != seeded_bytes_ in JournalCache::restart_empty() while leaving file_.bytes untouched for publish()'s on-disk byte budget accounting.

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248925233 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7248925233). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:39:09Z. --- Independently verified head `4212cf5ab3b133375af0f7baa723c38ea5896b17` merged cleanly onto `origin/main` (`5825b02ff89bca1a2d1331d982818e3dbb74d597`) on Windows 11 (`10.0.26200`), MSVC `19.44.35207` (`RelWithDebInfo`), **NVIDIA GeForce RTX 3090** (driver `595.79`), with `VK_LAYER_KHRONOS_validation` `1.4.363.1` (`LEONIDA_VK_VALIDATION=1`). No game files used. ### Verification Results - **Standard CTest Suite (`#2179` merged with `origin/main` `5825b02ff8`, `LEONIDA_VK_VALIDATION=1` on RTX 3090)**: - `pipeline_cache_journal`: **Passed** (`0.11 s`). - `compile_helper`: **Passed** (`0.65 s`). - `d3d12_compute_journal`: **Passed** (`0.59 s`, `direct Dispatch(4,1,1) copied both expected words (4,10)`, `0` Khronos validation errors). - `d3d12_compute`: **Passed** (`1.13 s`, `0` Khronos validation errors). - `scripts/check_no_game_data.py`: **Passed**. - **Simulated Unchanged-Size Seeded Miss Probe on RTX 3090**: - Seeded shader 2's `cs-*.vkcache` slot with shader 1's journal file in `d3d12_compute_journal_test` while forcing `restart_empty()`'s post-build size check to match NVIDIA's unchanged-size seeded miss: - First `--second-shader` process logged `pipeline journal: counter missed its journal file (...); built again against an empty cache in ... ms (VkResult 0) to rewrite it`, dispatched cleanly (`(4,14)`), and rewrote the journal file (`0` Khronos validation errors). - Next fresh `--second-shader` process reported `1 compute pipeline(s) found in their journal file (so far: 1 from journal files, 0 written, 0 from the shared cache)` and dispatched `(4,14)` cleanly (`0` Khronos validation errors). - Also verified `journal_retry_failed` (`4212cf5ab`) correctly suppresses `journal.finish` publication (`!journal_retry_failed`) while keeping the first usable `built` `VkPipeline` if the optional empty-cache `vkCreateComputePipelines` fails. ### Important Cross-PR Interaction Catch with Open PR `#2511` (`RT-PIPELINE-JOURNAL-BUILD-ID`) `git merge-tree --write-tree` between `#2179` (`4212cf5ab3`) and `#2511` (`4a497c8f1b`) **auto-merges with `0` text conflicts**, so Git will not flag an overlap — **however, `#2511`'s 24-byte `LPJ1` stamp will silently disable `#2179`'s `restart_empty()` 100% of the time on stamped files**: 1. In `#2511` (`runtime/src/pipeline_cache_journal.h`), `read_entry_file` records `entry.bytes = size` (the **on-disk** file size, i.e., `stamp_bytes (24) + blob_size`, which `JournalCache::publish()` needs for `replace_bytes(total, file_.bytes, file.size())`) and then strips the 24-byte `LPJ1` prefix from `entry.data` before `JournalCache::create()` passes `info.initialDataSize = file_.data.size()` (`file_.bytes - 24`) to `vkCreatePipelineCache`. 2. In `#2179`, `JournalCache::restart_empty()` checks: ```cpp if (vk.vkGetPipelineCacheData(device_.info.device, cache, &size, nullptr) != VK_SUCCESS || size != file_.bytes) return false; ``` When NVIDIA returns the seeded driver blob unchanged (`size == file_.bytes - 24`), `size != file_.bytes` evaluates to **`true`** (`blob_size != blob_size + 24`), causing `restart_empty()` to return `false` without rebuilding against an empty cache! 3. **1-line fix** (works identically whether `#2179` lands before or after `#2511`): record `seeded_bytes_ = file_.data.size()` in `JournalCache::create()` right before `vkCreatePipelineCache` / swapping `file_.data`, and compare `size != seeded_bytes_` in `JournalCache::restart_empty()` while leaving `file_.bytes` untouched for `publish()`'s on-disk byte budget accounting. AI-assisted: yes
ecox982745 commented 2026-11-29 02:07:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-29T02:07:32Z.


The retry also misses external seeds on this PR by itself. If the writable entry is missing, file_.bytes is zero. If it contains seven invalid bytes, file_.bytes is seven. In either case the driver successfully loaded 7,747 or 7,753 bytes from the external seed. The suggested payload-size comparison fixes these cases and the stamped-file interaction with #2511. The attached patch can land on this PR now.

I tested 4212cf5ab3 standalone and a clean merge of this head and #2511 4a497c8f1 onto main 791899f652 (combined tree 5506db631b05da371d3b37f01cdbd0cb5303a0c7). Windows 11, physical RTX 4090, NVIDIA 616.64, Vulkan validation enabled. I put each of the two synthetic compute shaders' caches under the other's key, testing both directions.

Writable entry Retries on #2179 Retries with #2511 also applied With patch, on each tree
Valid local seed 2/2 0/2 2/2
Missing, valid external seed 0/2 0/2 2/2
Seven invalid local bytes, valid external seed 0/2 0/2 2/2

What was simulated. The table covers an unchanged-size cache miss. A test-only hook substituted the size Vulkan originally accepted for the single post-build size observation in restart_empty(). On this driver the real cache grew to 15,464 bytes. With the real observation, all 24 control cases correctly skipped the retry. Pipeline creation, dispatch, readback and subsequent fresh-process cache hits used the real driver throughout. Both shaders returned their expected words, and the external seed files retained their hashes and modification times.

I also rebuilt the patched standalone tree without the hook. The CPU pipeline_cache_journal and GPU d3d12_compute_journal CTests each passed three times. The patch applies cleanly to both tested trees. It preserves the on-disk size used for budget accounting. Coordination claim. AI-assisted with OpenAI Codex (GPT-6).

Patch for git am

Save the block as journal-payload.patch and run git am journal-payload.patch.

From d8a5b7bc6572695ead478e4e6ba3696111a1c8a4 Mon Sep 17 00:00:00 2001
From: OpenAI Codex <[email protected]>
Date: Sun, 29 Nov 2026 12:05:29 +1000
Subject: [PATCH] d3d12: compare journal retries with the loaded driver payload

The writable file can be absent or invalid when a pipeline cache is initialized from an external seed. Remember the size Vulkan accepted, and keep the on-disk byte count for replacement accounting.

AI-assisted with OpenAI Codex (GPT-6).
---
 runtime/shims/d3d12_vulkan_device.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp
index 72cf1f2cb..fe096fcce 100644
--- a/runtime/shims/d3d12_vulkan_device.cpp
+++ b/runtime/shims/d3d12_vulkan_device.cpp
@@ -10124,6 +10124,7 @@ public:
                                        file_.data.empty() ? nullptr : file_.data.data()};
         if (!file_.data.empty() && vk.vkCreatePipelineCache(device_.info.device, &info, nullptr, &cache) == VK_SUCCESS) {
             seeded = true;
+            seeded_bytes_ = info.initialDataSize;
         } else {
             cache = VK_NULL_HANDLE;  // no file, or one the driver declined: start empty, and the build rewrites it
             info.initialDataSize = 0;
@@ -10141,7 +10142,7 @@ public:
         if (!cache || !seeded) return false;
         const auto& vk = device_.context->vk;
         std::size_t size = 0;
-        if (vk.vkGetPipelineCacheData(device_.info.device, cache, &size, nullptr) != VK_SUCCESS || size != file_.bytes)
+        if (vk.vkGetPipelineCacheData(device_.info.device, cache, &size, nullptr) != VK_SUCCESS || size != seeded_bytes_)
             return false;  // it took the pipeline (or cannot say): rewritten from it as before
         vk.vkDestroyPipelineCache(device_.info.device, cache, nullptr);
         cache = VK_NULL_HANDLE;
@@ -10229,6 +10230,7 @@ private:
     leonida::SubmitMutex* submits_ = nullptr;  // null: compute_driver_turn, for a build outside the submit lock
     const char* trigger_ = "";
     const char* name_;
+    std::size_t seeded_bytes_ = 0;  // Driver payload, which may come from outside the writable journal.
     bool enabled_ = false;
     bool built_ = false;
     bool write_ = false;

Retest of the adopted fix. I merged head 49b8998de66deb8007d3ce9fc91b1d47ac8c99cf with main 51d343b861fdf7e13885e416ccd6922f219070d2. The unmodified integration tree b228c052d6f8dc6a9433630ea529730b0b08530b passed the CPU pipeline_cache_journal and GPU d3d12_compute_journal CTests on Windows 11 and an RTX 4090, driver 616.64, with Khronos validation enabled.

I repeated the two-shader matrix with the same test-only substitution of the single post-build size observation. All six simulated unchanged-size misses retried, covering a valid local entry, a missing local entry with an external seed, and a seven-byte invalid local entry with an external seed. All six unmodified-size controls skipped the retry because the driver's cache grew. Every fresh-process check found the rewritten entry, both shaders returned the expected words, and the external seeds kept their hashes and timestamps. These runs tested #2179 on its own. Author's update

AI-assisted with OpenAI Codex (GPT-6.2 Sol).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249225414 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7249225414). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-29T02:07:32Z. --- The retry also misses **external seeds on this PR by itself**. If the writable entry is missing, `file_.bytes` is zero. If it contains seven invalid bytes, `file_.bytes` is seven. In either case the driver successfully loaded 7,747 or 7,753 bytes from the external seed. The [suggested payload-size comparison](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7248925233) fixes these cases and the stamped-file interaction with #2511. The attached patch can land on this PR now. I tested `4212cf5ab3` standalone and a clean merge of this head and #2511 `4a497c8f1` onto main `791899f652` (combined tree `5506db631b05da371d3b37f01cdbd0cb5303a0c7`). Windows 11, physical RTX 4090, NVIDIA 616.64, Vulkan validation enabled. I put each of the two synthetic compute shaders' caches under the other's key, testing both directions. | Writable entry | Retries on #2179 | Retries with #2511 also applied | With patch, on each tree | | --- | ---: | ---: | ---: | | Valid local seed | 2/2 | 0/2 | 2/2 | | Missing, valid external seed | 0/2 | 0/2 | 2/2 | | Seven invalid local bytes, valid external seed | 0/2 | 0/2 | 2/2 | **What was simulated.** The table covers an unchanged-size cache miss. A test-only hook substituted the size Vulkan originally accepted for the single post-build size observation in `restart_empty()`. On this driver the real cache grew to 15,464 bytes. With the real observation, all 24 control cases correctly skipped the retry. Pipeline creation, dispatch, readback and subsequent fresh-process cache hits used the real driver throughout. Both shaders returned their expected words, and the external seed files retained their hashes and modification times. I also rebuilt the patched standalone tree without the hook. The CPU `pipeline_cache_journal` and GPU `d3d12_compute_journal` CTests each passed three times. The patch applies cleanly to both tested trees. It preserves the on-disk size used for budget accounting. [Coordination claim](https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7249155573). AI-assisted with OpenAI Codex (GPT-6). <details> <summary>Patch for git am</summary> Save the block as `journal-payload.patch` and run `git am journal-payload.patch`. ~~~~patch From d8a5b7bc6572695ead478e4e6ba3696111a1c8a4 Mon Sep 17 00:00:00 2001 From: OpenAI Codex <[email protected]> Date: Sun, 29 Nov 2026 12:05:29 +1000 Subject: [PATCH] d3d12: compare journal retries with the loaded driver payload The writable file can be absent or invalid when a pipeline cache is initialized from an external seed. Remember the size Vulkan accepted, and keep the on-disk byte count for replacement accounting. AI-assisted with OpenAI Codex (GPT-6). --- runtime/shims/d3d12_vulkan_device.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/shims/d3d12_vulkan_device.cpp b/runtime/shims/d3d12_vulkan_device.cpp index 72cf1f2cb..fe096fcce 100644 --- a/runtime/shims/d3d12_vulkan_device.cpp +++ b/runtime/shims/d3d12_vulkan_device.cpp @@ -10124,6 +10124,7 @@ public: file_.data.empty() ? nullptr : file_.data.data()}; if (!file_.data.empty() && vk.vkCreatePipelineCache(device_.info.device, &info, nullptr, &cache) == VK_SUCCESS) { seeded = true; + seeded_bytes_ = info.initialDataSize; } else { cache = VK_NULL_HANDLE; // no file, or one the driver declined: start empty, and the build rewrites it info.initialDataSize = 0; @@ -10141,7 +10142,7 @@ public: if (!cache || !seeded) return false; const auto& vk = device_.context->vk; std::size_t size = 0; - if (vk.vkGetPipelineCacheData(device_.info.device, cache, &size, nullptr) != VK_SUCCESS || size != file_.bytes) + if (vk.vkGetPipelineCacheData(device_.info.device, cache, &size, nullptr) != VK_SUCCESS || size != seeded_bytes_) return false; // it took the pipeline (or cannot say): rewritten from it as before vk.vkDestroyPipelineCache(device_.info.device, cache, nullptr); cache = VK_NULL_HANDLE; @@ -10229,6 +10230,7 @@ private: leonida::SubmitMutex* submits_ = nullptr; // null: compute_driver_turn, for a build outside the submit lock const char* trigger_ = ""; const char* name_; + std::size_t seeded_bytes_ = 0; // Driver payload, which may come from outside the writable journal. bool enabled_ = false; bool built_ = false; bool write_ = false; ~~~~ </details> **Retest of the adopted fix.** I merged head `49b8998de66deb8007d3ce9fc91b1d47ac8c99cf` with main `51d343b861fdf7e13885e416ccd6922f219070d2`. The unmodified integration tree `b228c052d6f8dc6a9433630ea529730b0b08530b` passed the CPU `pipeline_cache_journal` and GPU `d3d12_compute_journal` CTests on Windows 11 and an RTX 4090, driver 616.64, with Khronos validation enabled. I repeated the two-shader matrix with the same test-only substitution of the single post-build size observation. All six simulated unchanged-size misses retried, covering a valid local entry, a missing local entry with an external seed, and a seven-byte invalid local entry with an external seed. All six unmodified-size controls skipped the retry because the driver's cache grew. Every fresh-process check found the rewritten entry, both shaders returned the expected words, and the external seeds kept their hashes and timestamps. These runs tested #2179 on its own. [Author's update](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7256061544) AI-assisted with OpenAI Codex (GPT-6.2 Sol).
timbot103 commented 2026-11-29 04:28:31 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:28:31Z.

Review: COMMENTED


Static review of 4212cf5ab only. I ran no builds or GPU tests.

[MAJOR] runtime/shims/d3d12_vulkan_device.cpp:10144 — A same-size miss from an external seed bypasses the empty-cache retry. runtime/src/pipeline_cache_journal.h:176 can load a compatible external payload while retaining zero bytes for a missing writable file or the size of an invalid writable file. When Vulkan reports the same size as the payload it loaded, restart_empty() compares that size with the writable file's byte count and skips the retry. The miss can then publish the unchanged payload locally, causing the next launch to prefer that stale entry and miss again.

Save info.initialDataSize after successful seeded cache creation and compare the returned size with that value. Keep file_.bytes for the disk budget. The existing overlay probe in scripts/check_compute_journal_overlay.py:41 covers cold creation, an external hit, and a local hit. Add a forced same-size external miss with a missing or invalid writable entry, and check that the local rewrite hits in a fresh process and leaves the seed intact.

The driver calls stay within the build's existing driver turn, and each build owns its journal cache. With a valid local seed, a size increase or decrease follows the existing rewrite path. An equal size attempts the empty-cache retry. The seeded cache is destroyed before replacement creation. A failed replacement creation or retry preserves the first pipeline and skips publication. If the replacement cache was created, finish() destroys it even when the retry fails. Publication uses the existing staged rename and accounts bytes only after a successful write. Concurrent publishers still share the existing best-effort budget check. The changed shim is part of the Windows runtime target. The portable journal tests and file writer are unchanged.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6101399720 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#pullrequestreview-6101399720). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-29T04:28:31Z. **Review:** COMMENTED --- Static review of `4212cf5ab` only. I ran no builds or GPU tests. **[MAJOR] `runtime/shims/d3d12_vulkan_device.cpp:10144`** — A same-size miss from an external seed bypasses the empty-cache retry. `runtime/src/pipeline_cache_journal.h:176` can load a compatible external payload while retaining zero bytes for a missing writable file or the size of an invalid writable file. When Vulkan reports the same size as the payload it loaded, `restart_empty()` compares that size with the writable file's byte count and skips the retry. The miss can then publish the unchanged payload locally, causing the next launch to prefer that stale entry and miss again. Save `info.initialDataSize` after successful seeded cache creation and compare the returned size with that value. Keep `file_.bytes` for the disk budget. The existing overlay probe in `scripts/check_compute_journal_overlay.py:41` covers cold creation, an external hit, and a local hit. Add a forced same-size external miss with a missing or invalid writable entry, and check that the local rewrite hits in a fresh process and leaves the seed intact. The driver calls stay within the build's existing driver turn, and each build owns its journal cache. With a valid local seed, a size increase or decrease follows the existing rewrite path. An equal size attempts the empty-cache retry. The seeded cache is destroyed before replacement creation. A failed replacement creation or retry preserves the first pipeline and skips publication. If the replacement cache was created, `finish()` destroys it even when the retry fails. Publication uses the existing staged rename and accounts bytes only after a successful write. Concurrent publishers still share the existing best-effort budget check. The changed shim is part of the Windows runtime target. The portable journal tests and file writer are unchanged. AI-assisted.
Krashgamer commented 2026-11-29 12:47:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-29T12:47:06Z.


Thanks, @zmasi, @ecox982745 and @timbot103. You are right: read_with_seed replaces data with the seed's but keeps the local file's bytes, so restart_empty() compared against the wrong size for an external seed, and against 24 bytes too many with #2511's stamp. Fixed in 49b8998de, following @ecox982745's patch. create() now records seeded_bytes_ = info.initialDataSize, and restart_empty() compares against that. file_.bytes stays as it was for the disk budget.

Tested on Windows 11, RTX 3080, NVIDIA 610.88: gta6rt builds, and the pipeline_cache_journal and d3d12_compute_journal CTests pass. I did not add the forced same-size external-miss case to check_compute_journal_overlay.py. @ecox982745's table already covers that path with the same change.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7256061544 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7256061544). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-29T12:47:06Z. --- Thanks, @zmasi, @ecox982745 and @timbot103. You are right: `read_with_seed` replaces `data` with the seed's but keeps the local file's `bytes`, so `restart_empty()` compared against the wrong size for an external seed, and against 24 bytes too many with #2511's stamp. Fixed in 49b8998de, following @ecox982745's patch. `create()` now records `seeded_bytes_ = info.initialDataSize`, and `restart_empty()` compares against that. `file_.bytes` stays as it was for the disk budget. Tested on Windows 11, RTX 3080, NVIDIA 610.88: `gta6rt` builds, and the `pipeline_cache_journal` and `d3d12_compute_journal` CTests pass. I did not add the forced same-size external-miss case to `check_compute_journal_overlay.py`. @ecox982745's table already covers that path with the same change.
merzleckeier commented 2026-11-29 13:47:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T13:47:18Z.


AGENT-MSG | 2026-11-29 13:46 UTC | merzleckeier | AI-assisted: Codex

BASE: 51d343b86 + 49b8998de, clean merge. The negative control restores only the old size comparison against file_.bytes.
MACHINE: RTX 4070 SUPER (NVIDIA 620.73.04) and Radeon 610M (RADV Mesa 26.3.1) | CachyOS, Wine 11.22.
EVIDENCE: MEASURED, 18 synthetic test processes and 12 fresh-process reloads, with a test-only Vulkan wrapper.

I put the first synthetic shader's driver cache under the second shader's key. Both drivers reported a miss and grew the cache (NVIDIA 7,947 → 15,864 bytes, RADV 904 → 1,776). To exercise the unchanged-size branch, the wrapper substitutes the accepted input byte count for the first post-build size query only. Initial pipeline creation and dispatch used the real driver.

  • With 49b8998de, a missing or seven-byte invalid writable entry plus an external seed triggered one empty-cache retry on each GPU (4/4). A fresh process with the external seed hidden hit each repaired local cache. With only the old comparison restored, the same four cases skipped the retry. A valid local-format seed still triggered it on both GPUs in the old control.
  • I also injected VK_ERROR_OUT_OF_HOST_MEMORY into the optional second pipeline create. On both GPUs, the first pipeline still returned the expected (4,14), valid and invalid writable entries kept their content and mtime, and an absent entry stayed absent (6/6 cases). The external seeds kept their bytes and mtime throughout.
  • With the native size observation, both drivers took the ordinary write path with no retry and hit the resulting local cache at the next launch.

The unchanged CPU journal test and the two ordinary GPU dispatch readbacks also passed. Host Khronos validation reported the same device-creation VUID 01387 in both variants.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7256801039 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7256801039). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T13:47:18Z. --- AGENT-MSG | 2026-11-29 13:46 UTC | merzleckeier | AI-assisted: Codex BASE: `51d343b86` + `49b8998de`, clean merge. The negative control restores only the old size comparison against `file_.bytes`. MACHINE: RTX 4070 SUPER (NVIDIA 620.73.04) and Radeon 610M (RADV Mesa 26.3.1) | CachyOS, Wine 11.22. EVIDENCE: MEASURED, 18 synthetic test processes and 12 fresh-process reloads, with a test-only Vulkan wrapper. I put the first synthetic shader's driver cache under the second shader's key. Both drivers reported a miss and grew the cache (NVIDIA 7,947 → 15,864 bytes, RADV 904 → 1,776). To exercise the unchanged-size branch, the wrapper substitutes the accepted input byte count for the first post-build size query only. Initial pipeline creation and dispatch used the real driver. - With `49b8998de`, a missing or seven-byte invalid writable entry plus an external seed triggered one empty-cache retry on each GPU (4/4). A fresh process with the external seed hidden hit each repaired local cache. With only the old comparison restored, the same four cases skipped the retry. A valid local-format seed still triggered it on both GPUs in the old control. - I also injected `VK_ERROR_OUT_OF_HOST_MEMORY` into the optional second pipeline create. On both GPUs, the first pipeline still returned the expected `(4,14)`, valid and invalid writable entries kept their content and mtime, and an absent entry stayed absent (6/6 cases). The external seeds kept their bytes and mtime throughout. - With the native size observation, both drivers took the ordinary write path with no retry and hit the resulting local cache at the next launch. The unchanged CPU journal test and the two ordinary GPU dispatch readbacks also passed. Host Khronos validation reported the same device-creation VUID `01387` in both variants.
OreoFR commented 2026-11-29 14:59:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T14:59:13Z.


TAKEN by OreoFR (Windows, RTX 4070 8 GB)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257729574 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7257729574). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T14:59:13Z. --- TAKEN by OreoFR (Windows, RTX 4070 8 GB)
OreoFR commented 2026-11-29 21:33:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T21:33:11Z.


Verified by OreoFR — NO RED (no test)

  • Base: main c22a0a732 + this PR (head 49b8998de) merged with --no-ff
  • Red: the PR adds no test, so there is nothing to run on main. The existing journal tests pipeline_cache_journal and d3d12_compute_journal pass on main and on the merge; on this GPU their fixtures do not reach the seeded same-size miss that the retry handles.
  • Green (merge): ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p3 = main + #2179 + #2224 (no shared files): 506 tests, new failures vs main: none. xmem_no_write_watch, d3d12_mesh and d3d12_mesh_heavy_cache failed in the parallel run and pass when re-run alone (main alone: 505 tests, 6 failures: big_compile_gate and api_ref_state and d3d12_queue_wait_timeout timeouts, xs_proxy_mock, vk_compile_gate_calibration, xbox_present; xbox_present fails in every package as on main)
  • gta6rt.exe links without the XMA decoder (LEONIDA_CARGO=OFF, LEONIDA_XMA2_DECODER_LIB empty) in package p3; imports unchanged vs main (25 DLLs, 755 functions, no WS2_32)
  • Diff read: no bug. seeded_bytes_ now records info.initialDataSize, the payload the driver took (seed or stamp-stripped), so the external-seed case from timbot103's review is covered by 49b8998de. The retry runs inside the same driver turn, and a failed second create leaves the journal unwritten (journal_retry_failed) while the first pipeline is kept. A test for the forced same-size miss (as merzleckeier did with a wrapper) would let CI cover the retry.
  • Other runs: Consistent with zmasi's and merzleckeier's runs (merzleckeier's covers the retry with a test-only Vulkan wrapper) and lixonik's review.
  • Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44

AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262965930 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7262965930). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T21:33:11Z. --- **Verified by OreoFR** — NO RED (no test) - Base: main c22a0a732 + this PR (head 49b8998de) merged with --no-ff - Red: the PR adds no test, so there is nothing to run on main. The existing journal tests `pipeline_cache_journal` and `d3d12_compute_journal` pass on main and on the merge; on this GPU their fixtures do not reach the seeded same-size miss that the retry handles. - Green (merge): ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p3 = main + #2179 + #2224 (no shared files): 506 tests, new failures vs main: none. `xmem_no_write_watch`, `d3d12_mesh` and `d3d12_mesh_heavy_cache` failed in the parallel run and pass when re-run alone (main alone: 505 tests, 6 failures: big_compile_gate and api_ref_state and d3d12_queue_wait_timeout timeouts, xs_proxy_mock, vk_compile_gate_calibration, xbox_present; xbox_present fails in every package as on main) - gta6rt.exe links without the XMA decoder (`LEONIDA_CARGO=OFF`, `LEONIDA_XMA2_DECODER_LIB` empty) in package p3; imports unchanged vs main (25 DLLs, 755 functions, no WS2_32) - Diff read: no bug. `seeded_bytes_` now records `info.initialDataSize`, the payload the driver took (seed or stamp-stripped), so the external-seed case from timbot103's review is covered by 49b8998de. The retry runs inside the same driver turn, and a failed second create leaves the journal unwritten (`journal_retry_failed`) while the first pipeline is kept. A test for the forced same-size miss (as merzleckeier did with a wrapper) would let CI cover the retry. - Other runs: Consistent with zmasi's and merzleckeier's runs (merzleckeier's covers the retry with a test-only Vulkan wrapper) and lixonik's review. - Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44 AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
Krashgamer commented 2026-11-30 19:07:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-30T19:07:47Z.


Thanks, @OreoFR. The test is in now (c9777e386), and main is merged in (f58522a21, conflict resolved).

d3d12_compute_journal_seeded_miss (CTest) runs scripts/check_compute_journal_seeded_miss.py. A test-only layer in d3d12_compute_journal_test makes a seeded cache answer with the data it was loaded from, as NVIDIA 610.88 did here, so the retry path runs on any GPU without test hooks in the runtime. Four cases, each in its own process: stale local file, data only in the seed folder, invalid local file plus seed, and a failed retry create.

  • Red on main ad36782c6 with only the test applied: stale-local: the journal file was rewritten with the data it was read from. Run by hand on main, all four cases fail.
  • Green on this head: all four pass, 5 runs in a row, and with LEONIDA_VK_VALIDATION=1.
  • With only the old file_.bytes comparison restored, only the seed cases fail, so both fixes are covered.
  • Full suite, ctest -j 6, 577 tests each: no new failure against main (xbox_present fails on both; two timing tests failed once in the parallel run and pass 3 of 3 alone on both trees).

RTX 3080 10 GB, NVIDIA 610.88, Windows 11. Details are in the description. AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7288888032 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7288888032). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-30T19:07:47Z. --- Thanks, @OreoFR. The test is in now (`c9777e386`), and `main` is merged in (`f58522a21`, conflict resolved). `d3d12_compute_journal_seeded_miss` (CTest) runs `scripts/check_compute_journal_seeded_miss.py`. A test-only layer in `d3d12_compute_journal_test` makes a seeded cache answer with the data it was loaded from, as NVIDIA 610.88 did here, so the retry path runs on any GPU without test hooks in the runtime. Four cases, each in its own process: stale local file, data only in the seed folder, invalid local file plus seed, and a failed retry create. - Red on `main` `ad36782c6` with only the test applied: `stale-local: the journal file was rewritten with the data it was read from`. Run by hand on `main`, all four cases fail. - Green on this head: all four pass, 5 runs in a row, and with `LEONIDA_VK_VALIDATION=1`. - With only the old `file_.bytes` comparison restored, only the seed cases fail, so both fixes are covered. - Full suite, `ctest -j 6`, 577 tests each: no new failure against `main` (`xbox_present` fails on both; two timing tests failed once in the parallel run and pass 3 of 3 alone on both trees). RTX 3080 10 GB, NVIDIA 610.88, Windows 11. Details are in the description. AI-assisted (Claude Code, Claude Opus 5.5).
Krashgamer commented 2026-11-30 19:14:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-30T19:14:27Z.


Rebased on main 8f41d7d01 instead of the merge, as CONTRIBUTING asks of a pull request's author (my mistake to merge). The changes are the same, but the commit IDs differ: abbc1a4f8 → 871788a57, 4212cf5ab → c5bc7b0c5, 49b8998de → 7a70814b6, test c9777e386 → f230da518. After the rebase, gta6rt builds and the three journal tests pass 3 runs in a row; the description says which runs were on which tree.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7289067727 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7289067727). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-30T19:14:27Z. --- Rebased on `main` `8f41d7d01` instead of the merge, as CONTRIBUTING asks of a pull request's author (my mistake to merge). The changes are the same, but the commit IDs differ: `abbc1a4f8` → `871788a57`, `4212cf5ab` → `c5bc7b0c5`, `49b8998de` → `7a70814b6`, test `c9777e386` → `f230da518`. After the rebase, `gta6rt` builds and the three journal tests pass 3 runs in a row; the description says which runs were on which tree.
ecox982745 commented 2026-11-30 19:17:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-30T19:17:06Z.


Independent native Windows red/green check of the new stock seeded-miss fixture. The tested merge of c9777e386 onto 8f41d7d01 has the exact same tree (8dd25c895) as the rebased head f230da518. MSVC 19.44 Release, RTX 4090 (NVIDIA 616.64), Windows 11 and Khronos Vulkan validation 1.4.369.

  • Green: pipeline_cache_journal, d3d12_compute_journal, and d3d12_compute_journal_seeded_miss each passed three runs. The new fixture exercised all four cases. A fresh process hit the repaired local journal in every run, both external-seed variants preserved their seed, and the injected retry failure preserved the original journal. The synthetic GPU readbacks matched throughout.
  • Red: I rebuilt the same test and harness after replacing only runtime/shims/d3d12_vulkan_device.cpp with the exact base version. The stock fixture failed at stale-local: the journal file was rewritten with the data it was read from.

The fixture forces the seeded cache to report its original data to exercise the retry. GPU pipeline creation and readback were native. AI-assisted with OpenAI Codex (GPT-6.2 Sol).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7289140659 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7289140659). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-30T19:17:06Z. --- Independent native Windows red/green check of the new stock seeded-miss fixture. The tested merge of `c9777e386` onto `8f41d7d01` has the exact same tree (`8dd25c895`) as the rebased head `f230da518`. MSVC 19.44 Release, RTX 4090 (NVIDIA 616.64), Windows 11 and Khronos Vulkan validation 1.4.369. - **Green:** `pipeline_cache_journal`, `d3d12_compute_journal`, and `d3d12_compute_journal_seeded_miss` each passed three runs. The new fixture exercised all four cases. A fresh process hit the repaired local journal in every run, both external-seed variants preserved their seed, and the injected retry failure preserved the original journal. The synthetic GPU readbacks matched throughout. - **Red:** I rebuilt the same test and harness after replacing only `runtime/shims/d3d12_vulkan_device.cpp` with the exact base version. The stock fixture failed at `stale-local: the journal file was rewritten with the data it was read from`. The fixture forces the seeded cache to report its original data to exercise the retry. GPU pipeline creation and readback were native. AI-assisted with OpenAI Codex (GPT-6.2 Sol).
kurrutako commented 2026-12-01 08:50:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kurrutako on 2026-12-01T08:50:58Z.


Tested on Windows 11, RTX 5070, MSVC 2022, Release, with the CI options (LEONIDA_D3D12_SHIM_TESTS=ON, LEONIDA_REQUIRE_VULKAN=ON).

  • PR head f230da518: d3d12_compute_journal, d3d12_compute_journal_seeded_miss and cpu_emulation pass.
    • scripts/check_compute_journal_seeded_miss.py passes every case: stale-local, external-seed, invalid-local-external-seed, failed-retry, control and repaired.
    • The driver reports cache hits.
  • main cd73ddab7 with only the new test and script copied over: the script fails at stale-local ("the journal file was rewritten with the data it was read from"). So the test catches the bug.
  • Note: #2511 also changes the journal in d3d12_vulkan_device.cpp. It merges with this PR there without conflicts (the only textual conflict is runtime/CMakeLists.txt). Whichever lands second should re-run the seeded-miss test.

AI-assisted (Claude Code)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7305865766 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7305865766). Originally posted by [kurrutako](https://github.com/kurrutako) on 2026-12-01T08:50:58Z. --- Tested on Windows 11, RTX 5070, MSVC 2022, Release, with the CI options (`LEONIDA_D3D12_SHIM_TESTS=ON`, `LEONIDA_REQUIRE_VULKAN=ON`). - PR head f230da518: `d3d12_compute_journal`, `d3d12_compute_journal_seeded_miss` and `cpu_emulation` pass. - `scripts/check_compute_journal_seeded_miss.py` passes every case: stale-local, external-seed, invalid-local-external-seed, failed-retry, control and repaired. - The driver reports cache hits. - main cd73ddab7 with only the new test and script copied over: the script fails at stale-local ("the journal file was rewritten with the data it was read from"). So the test catches the bug. - Note: #2511 also changes the journal in `d3d12_vulkan_device.cpp`. It merges with this PR there without conflicts (the only textual conflict is `runtime/CMakeLists.txt`). Whichever lands second should re-run the seeded-miss test. AI-assisted (Claude Code)
aslan2142 commented 2026-12-01 17:25:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:25:19Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319272326 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2179#issuecomment-7319272326). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:25:19Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!2179
No description provided.