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
pull from: upstream-pr/2179
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2179"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
vk_pipeline_checkalone 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 main88479ff65+ #2138 + #1914 + #1886 with this change (the PR branch itself is this commit alone on current main; built with Ninja/MSVC,gta6rtlinks):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 increate()), 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_.bytesstays for the disk budget.main8f41d7d01(conflict inbuild_compute_pipeline:main'shit_reportedand this PR'sjournal_retry_failedboth 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_testgets a test-only layer between the runtime and the driver (--keep-seeded-cache-data): a pipeline cache made from initial data answersvkGetPipelineCacheDatawith 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-retryalso 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:Red and green, Windows 11 (26200), RTX 3080 10 GB, NVIDIA 610.88, Ninja RelWithDebInfo:
mainad36782c6(c9777e386, before the rebase): all four cases pass, 5 runs in a row; also withLEONIDA_VK_VALIDATION=1(0 validation errors). The runtime logs the retry (built again against an empty cache ... (VkResult 0)).mainad36782c6with only the test applied:ERROR: stale-local: the journal file was rewritten with the data it was read from. Run by hand onmain, 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.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),c9777e386againstmainad36782c6+ the test: no new failure.xbox_presentfails on both (as onmainin OreoFR's run);d3d12_compute_journal_seeded_missfails only onmain;d3d12_state_sweepanddxgi_waitable_latencyfailed once in the parallel run on the PR tree and pass 3 of 3 alone on both trees. After the rebase onto8f41d7d01(no commit sincead36782c6touches this PR's files)gta6rtbuilds, the three journal tests pass 3 runs in a row, and the seeded-miss script passes withLEONIDA_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
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).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
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, onabbc1a4f8276c1dd84b5885ace81aa5e7e577592(RTX 4090, Windows 11, NVIDIA 616.64, Khronos validation on).VK_ERROR_OUT_OF_HOST_MEMORYFor 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.finishgetsbuilt=trueeven 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
abbc1a4f8Imported 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. Rebuiltgta6rtandd3d12_compute_journal_teston the branch; the test passes on an RTX 3080 (NVIDIA 610.88, Windows 11). AI-assisted (Claude Code, Claude Opus 5.5).Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T11:03:03Z.
Review: COMMENTED
Built
d3d12_compute_journal_testat 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.
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):vk_null_descriptor_test.cpp:97usesLEONIDA_TEST_NULL_DESCRIPTORS_SPVunguarded, butruntime/CMakeLists.txtonly defines it whenglslangValidatoris found. Main has the same code, and #2055 is open for it.cs_imgatomic_extfails (6 of 64 sint words), andvk_overlapping_occlusionnow passes but is still in the expected failures. Neither touches the journal path.test_bink_names,test_opus_tags,test_world_names,test_mod_pack_output_alias, ...). They are tracked in #1608 with open PRs.cs_dpp_cmp.asmcases 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.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:39:09Z.
Independently verified head
4212cf5ab3b133375af0f7baa723c38ea5896b17merged cleanly ontoorigin/main(5825b02ff89bca1a2d1331d982818e3dbb74d597) on Windows 11 (10.0.26200), MSVC19.44.35207(RelWithDebInfo), NVIDIA GeForce RTX 3090 (driver595.79), withVK_LAYER_KHRONOS_validation1.4.363.1(LEONIDA_VK_VALIDATION=1). No game files used.Verification Results
#2179merged withorigin/main5825b02ff8,LEONIDA_VK_VALIDATION=1on 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),0Khronos validation errors).d3d12_compute: Passed (1.13 s,0Khronos validation errors).scripts/check_no_game_data.py: Passed.cs-*.vkcacheslot with shader 1's journal file ind3d12_compute_journal_testwhile forcingrestart_empty()'s post-build size check to match NVIDIA's unchanged-size seeded miss:--second-shaderprocess loggedpipeline 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 (0Khronos validation errors).--second-shaderprocess reported1 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 (0Khronos validation errors).journal_retry_failed(4212cf5ab) correctly suppressesjournal.finishpublication (!journal_retry_failed) while keeping the first usablebuiltVkPipelineif the optional empty-cachevkCreateComputePipelinesfails.Important Cross-PR Interaction Catch with Open PR
#2511(RT-PIPELINE-JOURNAL-BUILD-ID)git merge-tree --write-treebetween#2179(4212cf5ab3) and#2511(4a497c8f1b) auto-merges with0text conflicts, so Git will not flag an overlap — however,#2511's 24-byteLPJ1stamp will silently disable#2179'srestart_empty()100% of the time on stamped files:#2511(runtime/src/pipeline_cache_journal.h),read_entry_filerecordsentry.bytes = size(the on-disk file size, i.e.,stamp_bytes (24) + blob_size, whichJournalCache::publish()needs forreplace_bytes(total, file_.bytes, file.size())) and then strips the 24-byteLPJ1prefix fromentry.databeforeJournalCache::create()passesinfo.initialDataSize = file_.data.size()(file_.bytes - 24) tovkCreatePipelineCache.#2179,JournalCache::restart_empty()checks: When NVIDIA returns the seeded driver blob unchanged (size == file_.bytes - 24),size != file_.bytesevaluates totrue(blob_size != blob_size + 24), causingrestart_empty()to returnfalsewithout rebuilding against an empty cache!#2179lands before or after#2511): recordseeded_bytes_ = file_.data.size()inJournalCache::create()right beforevkCreatePipelineCache/ swappingfile_.data, and comparesize != seeded_bytes_inJournalCache::restart_empty()while leavingfile_.bytesuntouched forpublish()'s on-disk byte budget accounting.AI-assisted: yes
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_.bytesis zero. If it contains seven invalid bytes,file_.bytesis 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
4212cf5ab3standalone and a clean merge of this head and #25114a497c8f1onto main791899f652(combined tree5506db631b05da371d3b37f01cdbd0cb5303a0c7). 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.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_journaland GPUd3d12_compute_journalCTests 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.patchand rungit am journal-payload.patch.Retest of the adopted fix. I merged head
49b8998de66deb8007d3ce9fc91b1d47ac8c99cfwith main51d343b861fdf7e13885e416ccd6922f219070d2. The unmodified integration treeb228c052d6f8dc6a9433630ea529730b0b08530bpassed the CPUpipeline_cache_journaland GPUd3d12_compute_journalCTests 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).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:28:31Z.
Review: COMMENTED
Static review of
4212cf5abonly. 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:176can 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.initialDataSizeafter successful seeded cache creation and compare the returned size with that value. Keepfile_.bytesfor the disk budget. The existing overlay probe inscripts/check_compute_journal_overlay.py:41covers 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.
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-29T12:47:06Z.
Thanks, @zmasi, @ecox982745 and @timbot103. You are right:
read_with_seedreplacesdatawith the seed's but keeps the local file'sbytes, sorestart_empty()compared against the wrong size for an external seed, and against 24 bytes too many with #2511's stamp. Fixed in49b8998de, following @ecox982745's patch.create()now recordsseeded_bytes_ = info.initialDataSize, andrestart_empty()compares against that.file_.bytesstays as it was for the disk budget.Tested on Windows 11, RTX 3080, NVIDIA 610.88:
gta6rtbuilds, and thepipeline_cache_journalandd3d12_compute_journalCTests pass. I did not add the forced same-size external-miss case tocheck_compute_journal_overlay.py. @ecox982745's table already covers that path with the same change.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 againstfile_.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.
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.VK_ERROR_OUT_OF_HOST_MEMORYinto 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.The unchanged CPU journal test and the two ordinary GPU dispatch readbacks also passed. Host Khronos validation reported the same device-creation VUID
01387in both variants.Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T14:59:13Z.
TAKEN by OreoFR (Windows, RTX 4070 8 GB)
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T21:33:11Z.
Verified by OreoFR — NO RED (no test)
c22a0a732+ this PR (head49b8998de) merged with --no-ffpipeline_cache_journalandd3d12_compute_journalpass on main and on the merge; on this GPU their fixtures do not reach the seeded same-size miss that the retry handles.xmem_no_write_watch,d3d12_meshandd3d12_mesh_heavy_cachefailed 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)LEONIDA_CARGO=OFF,LEONIDA_XMA2_DECODER_LIBempty) in package p3; imports unchanged vs main (25 DLLs, 755 functions, no WS2_32)seeded_bytes_now recordsinfo.initialDataSize, the payload the driver took (seed or stamp-stripped), so the external-seed case from timbot103's review is covered by49b8998de. 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.AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-30T19:07:47Z.
Thanks, @OreoFR. The test is in now (
c9777e386), andmainis merged in (f58522a21, conflict resolved).d3d12_compute_journal_seeded_miss(CTest) runsscripts/check_compute_journal_seeded_miss.py. A test-only layer ind3d12_compute_journal_testmakes 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.mainad36782c6with only the test applied:stale-local: the journal file was rewritten with the data it was read from. Run by hand onmain, all four cases fail.LEONIDA_VK_VALIDATION=1.file_.bytescomparison restored, only the seed cases fail, so both fixes are covered.ctest -j 6, 577 tests each: no new failure againstmain(xbox_presentfails 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).
Imported from ubiquitarianism/leonida. Originally posted by Krashgamer on 2026-11-30T19:14:27Z.
Rebased on
main8f41d7d01instead 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, testc9777e386→f230da518. After the rebase,gta6rtbuilds and the three journal tests pass 3 runs in a row; the description says which runs were on which tree.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
c9777e386onto8f41d7d01has the exact same tree (8dd25c895) as the rebased headf230da518. MSVC 19.44 Release, RTX 4090 (NVIDIA 616.64), Windows 11 and Khronos Vulkan validation 1.4.369.pipeline_cache_journal,d3d12_compute_journal, andd3d12_compute_journal_seeded_misseach 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.runtime/shims/d3d12_vulkan_device.cppwith the exact base version. The stock fixture failed atstale-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).
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).f230da518:d3d12_compute_journal,d3d12_compute_journal_seeded_missandcpu_emulationpass.scripts/check_compute_journal_seeded_miss.pypasses every case: stale-local, external-seed, invalid-local-external-seed, failed-retry, control and repaired.cd73ddab7with 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.d3d12_vulkan_device.cpp. It merges with this PR there without conflicts (the only textual conflict isruntime/CMakeLists.txt). Whichever lands second should re-run the seeded-miss test.AI-assisted (Claude Code)
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.Pull request closed