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

Open
opened 2026-11-26 21:20:19 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2179
Author: @Krashgamer
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/journal-seeded-miss


📝 Commits (2)

  • abbc1a4 d3d12: rewrite a missed journal file from an empty cache when the seeded one kept its data (RT-JOURNAL-SEEDED-REWRITE)
  • 4212cf5 d3d12: keep the journal file when the create against the empty cache fails

📊 Changes

1 file changed (+39 additions, -1 deletions)

View changed files

📝 runtime/shims/d3d12_vulkan_device.cpp (+39 -1)

📄 Description

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.

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)

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2179 **Author:** [@Krashgamer](https://github.com/Krashgamer) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/journal-seeded-miss` --- ### 📝 Commits (2) - [`abbc1a4`](https://github.com/ubiquitarianism/leonida/commit/abbc1a4f8276c1dd84b5885ace81aa5e7e577592) d3d12: rewrite a missed journal file from an empty cache when the seeded one kept its data (RT-JOURNAL-SEEDED-REWRITE) - [`4212cf5`](https://github.com/ubiquitarianism/leonida/commit/4212cf5ab3b133375af0f7baa723c38ea5896b17) d3d12: keep the journal file when the create against the empty cache fails ### 📊 Changes **1 file changed** (+39 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+39 -1) </details> ### 📄 Description 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. 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a) 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2183
No description provided.