d3d12: a helper-sized module's stale journal file goes to the helper, not a compile here (RT-JOURNAL-STALE-PROBE) #2228

Closed
Krashgamer wants to merge 4 commits from upstream-pr/2228 into main
Krashgamer commented 2026-11-26 08:13:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-26T08:13:08Z.


Claimed in the coordination issue as: RT-JOURNAL-STALE-PROBE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7186300903)

Depends on: #2179 (this branch is on top of it; the first two commits are #2179's, the last one is this change)

What and why

build_compute_pipeline asks the compile helper (LEONIDA_COMPILE_HELPER=1) only when a compute pipeline has no journal file. When the file is there but the driver no longer takes it, the cache is seeded from it and the pipeline is compiled in the title's process. For the largest library modules that is a minute or more inside vkCreateComputePipelines, and every vkQueueSubmit of the title waits at the compile gate meanwhile.

On a 900 s boot through the story load (RTX 3080 10 GB, NVIDIA 610.88, helper and async pipelines on), modules of 3.6–4.7 MB were built that way on the dispatch worker, 55–84 s each. The gate held submissions up to 83 s, 580 s in all.

Change: for a module the helper would build, a seeded create carries VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT. That means a module of at least LEONIDA_COMPILE_HELPER_MIN_BYTES with the helper on, and pipelineCreationCacheControl present.

  • On VK_PIPELINE_COMPILE_REQUIRED the file is removed and the build is asked once more without the probe. That is the no-file way: a request to the helper, deferred with async pipelines.
  • A file the driver takes is a hit as before, in milliseconds.
  • A driver that compiles anyway instead of answering gives the pipeline as before.
  • A file that can't be removed is seeded and compiled here as before. The retry does not probe again, so the recursion is bounded at one.
  • Without the helper, and in the helper and --precompile-pipelines processes (compile_helper::wanted is false there), nothing changes.

Tested

Boots on Windows 11, boot.ps1 with LEONIDA_COMPILE_HELPER=1 LEONIDA_ASYNC_PIPELINES=1 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_CONSOLE_FIX_US=0 LEONIDA_HOST_IMAGE_COPY=0. The tree was main (2026-11-26) + #2138 + #2179 + #1472 + #2195 + #2183 + #2174 + #1914 + #1886 with this change. The scripted pad was used through the first-run pages to the story load.

boot stale files caught modules built in the title process longest gate wait gate wait in all
before (t4-i) – yes, 4.5 MB module at 857 s and still in the driver at the end 37 s and counting –
this change (t4-l) 27, answered in 0–16 ms 12, after the helper's 120 s limit (did not build it within 120000 ms; built here) 83 s 580 s
this change + LEONIDA_COMPILE_HELPER_WAIT_MS=0 LEONIDA_COMPILE_HELPER_PENDING_MS=0 LEONIDA_COMPILE_HELPER_IDLE_THREADS=0 (t4-m) 8 none (the 85–116 s builds ran in the helper) 0.455 s 25 s

So the probe takes the stale files out of the title's process. With the default 120 s helper limits, a busy helper (one request thread next to the idle fill, ~80 s a module) still hands some back. I left those limits alone: they are a policy of the helper's design, and the no-limit setting is one environment pair away.

Branch build: gta6rt and d3d12_compute_journal_test link (Ninja, MSVC Build Tools 18); d3d12_compute_journal_test passes on the RTX 3080.

GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 Pro 26200 (Intel i7-10700K)

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

Checklist

  • Based on current main and merges cleanly (on top of #2179).
  • 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)

Draft while #2179 is open (one open pull request per contributor).

🤖 Generated with Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5506373249 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2228). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-26T08:13:08Z. --- Claimed in the coordination issue as: RT-JOURNAL-STALE-PROBE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7186300903) Depends on: #2179 (this branch is on top of it; the first two commits are #2179's, the last one is this change) ### What and why `build_compute_pipeline` asks the compile helper (`LEONIDA_COMPILE_HELPER=1`) only when a compute pipeline has no journal file. When the file is there but the driver no longer takes it, the cache is seeded from it and the pipeline is compiled in the title's process. For the largest library modules that is a minute or more inside `vkCreateComputePipelines`, and every `vkQueueSubmit` of the title waits at the compile gate meanwhile. On a 900 s boot through the story load (RTX 3080 10 GB, NVIDIA 610.88, helper and async pipelines on), modules of 3.6–4.7 MB were built that way on the dispatch worker, 55–84 s each. The gate held submissions up to 83 s, 580 s in all. Change: for a module the helper would build, a seeded create carries `VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT`. That means a module of at least `LEONIDA_COMPILE_HELPER_MIN_BYTES` with the helper on, and `pipelineCreationCacheControl` present. - On `VK_PIPELINE_COMPILE_REQUIRED` the file is removed and the build is asked once more without the probe. That is the no-file way: a request to the helper, deferred with async pipelines. - A file the driver takes is a hit as before, in milliseconds. - A driver that compiles anyway instead of answering gives the pipeline as before. - A file that can't be removed is seeded and compiled here as before. The retry does not probe again, so the recursion is bounded at one. - Without the helper, and in the helper and `--precompile-pipelines` processes (`compile_helper::wanted` is false there), nothing changes. ### Tested Boots on Windows 11, `boot.ps1` with `LEONIDA_COMPILE_HELPER=1 LEONIDA_ASYNC_PIPELINES=1 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_CONSOLE_FIX_US=0 LEONIDA_HOST_IMAGE_COPY=0`. The tree was main (2026-11-26) + #2138 + #2179 + #1472 + #2195 + #2183 + #2174 + #1914 + #1886 with this change. The scripted pad was used through the first-run pages to the story load. | boot | stale files caught | modules built in the title process | longest gate wait | gate wait in all | |---|---|---|---|---| | before (t4-i) | – | yes, 4.5 MB module at 857 s and still in the driver at the end | 37 s and counting | – | | this change (t4-l) | 27, answered in 0–16 ms | 12, after the helper's 120 s limit (`did not build it within 120000 ms; built here`) | 83 s | 580 s | | this change + `LEONIDA_COMPILE_HELPER_WAIT_MS=0 LEONIDA_COMPILE_HELPER_PENDING_MS=0 LEONIDA_COMPILE_HELPER_IDLE_THREADS=0` (t4-m) | 8 | none (the 85–116 s builds ran in the helper) | 0.455 s | 25 s | So the probe takes the stale files out of the title's process. With the default 120 s helper limits, a busy helper (one request thread next to the idle fill, ~80 s a module) still hands some back. I left those limits alone: they are a policy of the helper's design, and the no-limit setting is one environment pair away. Branch build: `gta6rt` and `d3d12_compute_journal_test` link (Ninja, MSVC Build Tools 18); `d3d12_compute_journal_test` passes on the RTX 3080. GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 610.88, Windows 11 Pro 26200 (Intel i7-10700K) AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (on top of #2179). - [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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a) Draft while #2179 is open (one open pull request per contributor). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Krashgamer commented 2026-11-26 08:43:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-26T08:43:57Z.


Not ready, found a limit of this change in a longer boot (t4-n, 1,122 s, same settings as the last row of the table). AI-assisted (Claude Code, Claude Opus 5.5).

For library modules of about 4–6 MB, a file the helper writes is itself not taken by the title's process. For example, the helper builds and journals a 4.1 MB module in 63 s. The title's probe then answers VK_PIPELINE_COMPILE_REQUIRED for that same file, in 0 ms. This change removes the file. The next ask finds its request is gone and its journal file is not usable ... built here, and the module is compiled in the title's process after all. That happened for 8 modules of 3.8–5.9 MB. The gate held submissions up to 83 s again, 552 s in all. The 0.455 s of t4-m was a boot where these modules did not come up.

What I checked so far, RTX 3080, NVIDIA 610.88:

  • vk_pipeline_check builds the same 4.1 MB module in one process (55 s) and takes it from the saved cache in the next (0.08 s hit). So the driver can carry a pipeline of this size between processes.
  • 6 modules of ~0.7 MB and 6 of ~70 KB written by --precompile-pipelines were all hits in the title's process.
  • The --precompile-pipelines file and the title-written file for the 4.1 MB module have the same first-entry key and differ in the compressed entry data (5,664,176 vs 5,662,821 bytes).

So for the largest modules, the helper and the title's process apparently don't produce pipelines the other takes. The cause is not found yet. Until it is, this change only moves those builds around. I'll keep it a draft and report back.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7186950702 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2228#issuecomment-7186950702). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-26T08:43:57Z. --- Not ready, found a limit of this change in a longer boot (t4-n, 1,122 s, same settings as the last row of the table). AI-assisted (Claude Code, Claude Opus 5.5). For library modules of about 4–6 MB, a file the **helper** writes is itself not taken by the title's process. For example, the helper builds and journals a 4.1 MB module in 63 s. The title's probe then answers `VK_PIPELINE_COMPILE_REQUIRED` for that same file, in 0 ms. This change removes the file. The next ask finds `its request is gone and its journal file is not usable ... built here`, and the module is compiled in the title's process after all. That happened for 8 modules of 3.8–5.9 MB. The gate held submissions up to 83 s again, 552 s in all. The 0.455 s of t4-m was a boot where these modules did not come up. What I checked so far, RTX 3080, NVIDIA 610.88: - `vk_pipeline_check` builds the same 4.1 MB module in one process (55 s) and takes it from the saved cache in the next (0.08 s hit). So the driver can carry a pipeline of this size between processes. - 6 modules of ~0.7 MB and 6 of ~70 KB written by `--precompile-pipelines` were all hits in the title's process. - The `--precompile-pipelines` file and the title-written file for the 4.1 MB module have the same first-entry key and differ in the compressed entry data (5,664,176 vs 5,662,821 bytes). So for the largest modules, the helper and the title's process apparently don't produce pipelines the other takes. The cause is not found yet. Until it is, this change only moves those builds around. I'll keep it a draft and report back.
lixonik commented 2026-11-26 15:32:32 +00:00 (Migrated from github.com)

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

Review: COMMENTED


The four synthetic compute-journal overlay cases passed at this head on Windows 11 (NVIDIA GeForce RTX 5070, 610.88). They cover ordinary cold and seeded creation. The helper-sized stale-file branch was outside those cases. I found one path through that branch by inspection, below.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6076817014 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2228#pullrequestreview-6076817014). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T15:32:32Z. **Review:** COMMENTED --- The four synthetic compute-journal overlay cases passed at this head on Windows 11 (NVIDIA GeForce RTX 5070, 610.88). They cover ordinary cold and seeded creation. The helper-sized stale-file branch was outside those cases. I found one path through that branch by inspection, below. AI-assisted.
lixonik commented 2026-11-26 15:32:32 +00:00 (Migrated from github.com)

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

Code review location: runtime/shims/d3d12_vulkan_device.cpp; line 10495

@@ -10425,18 +10453,54 @@ ComputeBuild build_compute_pipeline(DeviceState& device, const leonida::ShaderEn
             if (!from_shared) built = VK_NULL_HANDLE;
         }
         if (!from_shared) {
+            const bool probing = probe_file && journal.seeded;
+            if (probing) pipeline_info.flags |= VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT;
             const ULONGLONG at = GetTickCount64();
             created = vk.vkCreateComputePipelines(dev, cache, 1, &pipeline_info, nullptr, &built);
             driver_ms = GetTickCount64() - at;
+            if (probing) {
+                pipeline_info.flags &= ~VkPipelineCreateFlags(VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT);
+                stale_file = created == VK_PIPELINE_COMPILE_REQUIRED;
+                if (stale_file) built = VK_NULL_HANDLE;
+            }
+            // A seeded miss the cache did not take: built once more against an empty cache, so the file is rewritten
+            // with this pipeline instead of as it was read.
+            if (created == VK_SUCCESS && built && journal.seeded &&
+                leonida::pipeline_journal::should_write(true, trace.hit(), driver_ms) && journal.restart_empty()) {
+                VkPipeline again = VK_NULL_HANDLE;
+                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;
+                journal_retry_failed = again_result != VK_SUCCESS || !again;
+                if (!journal_retry_failed) {
+                    vk.vkDestroyPipeline(dev, built, nullptr);
+                    built = again;
+                }
+                std::fprintf(stderr, "[rt] d3d12: pipeline journal: %s missed its journal file (%llu ms); built again "
+                                     "against an empty cache in %llu ms (VkResult %d) to rewrite it\n",
+                             entry->name.c_str(), static_cast<unsigned long long>(driver_ms),
+                             static_cast<unsigned long long>(again_ms), int(again_result));
+            }
         }
         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));
     trace.end(trigger, entry->name.c_str(), 0, bytes, created);
     if (big_lock.owns_lock()) big_lock.unlock();
+    if (stale_file) {
+        std::error_code removed;
+        std::filesystem::remove(out.journal_path, removed);

[P2] Bypass the rejected external seed on the helper retry.

journal.load(path) can supply data from the read-only seed overlay while out.journal_path still points to the local destination. If that cache returns VK_PIPELINE_COMPILE_REQUIRED and no local file exists, remove(out.journal_path) returns false with no error. The recursive retry logs removal, then loads the same external seed with probing disabled. journal.has_file_data() stays true and skips the helper, so the foreground compile this change is meant to avoid can still happen. Can the retry treat that stale seed as absent and leave the overlay untouched?

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4710492684 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2228#discussion_r4710492684). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-26T15:32:32Z. **Code review location:** `runtime/shims/d3d12_vulkan_device.cpp`; line 10495 ~~~~diff @@ -10425,18 +10453,54 @@ ComputeBuild build_compute_pipeline(DeviceState& device, const leonida::ShaderEn if (!from_shared) built = VK_NULL_HANDLE; } if (!from_shared) { + const bool probing = probe_file && journal.seeded; + if (probing) pipeline_info.flags |= VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT; const ULONGLONG at = GetTickCount64(); created = vk.vkCreateComputePipelines(dev, cache, 1, &pipeline_info, nullptr, &built); driver_ms = GetTickCount64() - at; + if (probing) { + pipeline_info.flags &= ~VkPipelineCreateFlags(VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT); + stale_file = created == VK_PIPELINE_COMPILE_REQUIRED; + if (stale_file) built = VK_NULL_HANDLE; + } + // A seeded miss the cache did not take: built once more against an empty cache, so the file is rewritten + // with this pipeline instead of as it was read. + if (created == VK_SUCCESS && built && journal.seeded && + leonida::pipeline_journal::should_write(true, trace.hit(), driver_ms) && journal.restart_empty()) { + VkPipeline again = VK_NULL_HANDLE; + 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; + journal_retry_failed = again_result != VK_SUCCESS || !again; + if (!journal_retry_failed) { + vk.vkDestroyPipeline(dev, built, nullptr); + built = again; + } + std::fprintf(stderr, "[rt] d3d12: pipeline journal: %s missed its journal file (%llu ms); built again " + "against an empty cache in %llu ms (VkResult %d) to rewrite it\n", + entry->name.c_str(), static_cast<unsigned long long>(driver_ms), + static_cast<unsigned long long>(again_ms), int(again_result)); + } } 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)); trace.end(trigger, entry->name.c_str(), 0, bytes, created); if (big_lock.owns_lock()) big_lock.unlock(); + if (stale_file) { + std::error_code removed; + std::filesystem::remove(out.journal_path, removed); ~~~~ --- [P2] Bypass the rejected external seed on the helper retry. `journal.load(path)` can supply data from the read-only seed overlay while `out.journal_path` still points to the local destination. If that cache returns `VK_PIPELINE_COMPILE_REQUIRED` and no local file exists, `remove(out.journal_path)` returns false with no error. The recursive retry logs removal, then loads the same external seed with probing disabled. `journal.has_file_data()` stays true and skips the helper, so the foreground compile this change is meant to avoid can still happen. Can the retry treat that stale seed as absent and leave the overlay untouched?
Krashgamer commented 2026-11-26 15:38:47 +00:00 (Migrated from github.com)

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

Code review location: runtime/shims/d3d12_vulkan_device.cpp; line 10495

@@ -10425,18 +10453,54 @@ ComputeBuild build_compute_pipeline(DeviceState& device, const leonida::ShaderEn
             if (!from_shared) built = VK_NULL_HANDLE;
         }
         if (!from_shared) {
+            const bool probing = probe_file && journal.seeded;
+            if (probing) pipeline_info.flags |= VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT;
             const ULONGLONG at = GetTickCount64();
             created = vk.vkCreateComputePipelines(dev, cache, 1, &pipeline_info, nullptr, &built);
             driver_ms = GetTickCount64() - at;
+            if (probing) {
+                pipeline_info.flags &= ~VkPipelineCreateFlags(VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT);
+                stale_file = created == VK_PIPELINE_COMPILE_REQUIRED;
+                if (stale_file) built = VK_NULL_HANDLE;
+            }
+            // A seeded miss the cache did not take: built once more against an empty cache, so the file is rewritten
+            // with this pipeline instead of as it was read.
+            if (created == VK_SUCCESS && built && journal.seeded &&
+                leonida::pipeline_journal::should_write(true, trace.hit(), driver_ms) && journal.restart_empty()) {
+                VkPipeline again = VK_NULL_HANDLE;
+                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;
+                journal_retry_failed = again_result != VK_SUCCESS || !again;
+                if (!journal_retry_failed) {
+                    vk.vkDestroyPipeline(dev, built, nullptr);
+                    built = again;
+                }
+                std::fprintf(stderr, "[rt] d3d12: pipeline journal: %s missed its journal file (%llu ms); built again "
+                                     "against an empty cache in %llu ms (VkResult %d) to rewrite it\n",
+                             entry->name.c_str(), static_cast<unsigned long long>(driver_ms),
+                             static_cast<unsigned long long>(again_ms), int(again_result));
+            }
         }
         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));
     trace.end(trigger, entry->name.c_str(), 0, bytes, created);
     if (big_lock.owns_lock()) big_lock.unlock();
+    if (stale_file) {
+        std::error_code removed;
+        std::filesystem::remove(out.journal_path, removed);

Thanks, @lixonik, that's right: the remove did nothing for a file read from the seed, and the retry loaded the same seed again. Fixed in 7982880cb. When the refused file came from the seed overlay (EntryFile::from_seed), the overlay now stays untouched, and the retry passes skip_seed so JournalCache::load reads the seed as absent. has_file_data() is then false and the build goes to the helper. The helper reads with ReadRole::materialize_local, which never takes the seed, and its file lands locally. A local stale file is still removed as before.

Built gta6rt on Windows 11 with MSVC 18. I have not run it with a seed overlay yet, so that branch is untested here.

<!-- greyfinch-sync:ubiquitarianism/leonida:review-comment:4710559895 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2228#discussion_r4710559895). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-26T15:38:47Z. **Code review location:** `runtime/shims/d3d12_vulkan_device.cpp`; line 10495 ~~~~diff @@ -10425,18 +10453,54 @@ ComputeBuild build_compute_pipeline(DeviceState& device, const leonida::ShaderEn if (!from_shared) built = VK_NULL_HANDLE; } if (!from_shared) { + const bool probing = probe_file && journal.seeded; + if (probing) pipeline_info.flags |= VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT; const ULONGLONG at = GetTickCount64(); created = vk.vkCreateComputePipelines(dev, cache, 1, &pipeline_info, nullptr, &built); driver_ms = GetTickCount64() - at; + if (probing) { + pipeline_info.flags &= ~VkPipelineCreateFlags(VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT); + stale_file = created == VK_PIPELINE_COMPILE_REQUIRED; + if (stale_file) built = VK_NULL_HANDLE; + } + // A seeded miss the cache did not take: built once more against an empty cache, so the file is rewritten + // with this pipeline instead of as it was read. + if (created == VK_SUCCESS && built && journal.seeded && + leonida::pipeline_journal::should_write(true, trace.hit(), driver_ms) && journal.restart_empty()) { + VkPipeline again = VK_NULL_HANDLE; + 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; + journal_retry_failed = again_result != VK_SUCCESS || !again; + if (!journal_retry_failed) { + vk.vkDestroyPipeline(dev, built, nullptr); + built = again; + } + std::fprintf(stderr, "[rt] d3d12: pipeline journal: %s missed its journal file (%llu ms); built again " + "against an empty cache in %llu ms (VkResult %d) to rewrite it\n", + entry->name.c_str(), static_cast<unsigned long long>(driver_ms), + static_cast<unsigned long long>(again_ms), int(again_result)); + } } 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)); trace.end(trigger, entry->name.c_str(), 0, bytes, created); if (big_lock.owns_lock()) big_lock.unlock(); + if (stale_file) { + std::error_code removed; + std::filesystem::remove(out.journal_path, removed); ~~~~ --- Thanks, @lixonik, that's right: the remove did nothing for a file read from the seed, and the retry loaded the same seed again. Fixed in 7982880cb. When the refused file came from the seed overlay (`EntryFile::from_seed`), the overlay now stays untouched, and the retry passes `skip_seed` so `JournalCache::load` reads the seed as absent. `has_file_data()` is then false and the build goes to the helper. The helper reads with `ReadRole::materialize_local`, which never takes the seed, and its file lands locally. A local stale file is still removed as before. Built `gta6rt` on Windows 11 with MSVC 18. I have not run it with a seed overlay yet, so that branch is untested here.
Krashgamer commented 2026-11-30 19:42:50 +00:00 (Migrated from github.com)

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


Closing this. As found in the comment above, for the largest library modules (about 4–6 MB) the title's process refuses the journal file the helper writes, so the probe only sends those modules back to a compile in the title's process: the gate waits stay the same. The cause of that cross-process refusal was not found, and without it this change does not fix what it set out to fix.

The measurements above (t4-l, t4-m, t4-n) and the vk_pipeline_check result stay here for whoever picks up the compile stalls on the gta6rt path. The claim RT-JOURNAL-STALE-PROBE is released in #2570.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7289824457 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2228#issuecomment-7289824457). Originally posted by [Krashgamer](https://github.com/Krashgamer) on 2026-11-30T19:42:50Z. --- Closing this. As found in the comment above, for the largest library modules (about 4–6 MB) the title's process refuses the journal file the helper writes, so the probe only sends those modules back to a compile in the title's process: the gate waits stay the same. The cause of that cross-process refusal was not found, and without it this change does not fix what it set out to fix. The measurements above (t4-l, t4-m, t4-n) and the `vk_pipeline_check` result stay here for whoever picks up the compile stalls on the `gta6rt` path. The claim RT-JOURNAL-STALE-PROBE is released in #2570. AI-assisted (Claude Code, Claude Opus 5.5).

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!2228
No description provided.