mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1914] [MERGED] d3d12: a pipeline cache for the offline cache's misses, written while the game runs (RT-HEAVY-PIPELINE-CACHE) #1921
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1921
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1914
Author: @kawaii-shakal
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142
Base:
main← Head:heavy-pipeline-cache📝 Commits (5)
9f1f5bfd3d12: a pipeline cache for the offline cache's misses, written while the game runs (RT-HEAVY-PIPELINE-CACHE)e4c413aheavy pipeline cache: a write covers what was noted before it started, counted, not timed; teardown keeps fast builds tooc3b8520Merge upstream main into heavy-pipeline-cacheaab7653d3d12: retry a failed heavy cache write and never publish a VK_INCOMPLETE snapshota42bffdMerge origin/main into heavy-pipeline-cache📊 Changes
9 files changed (+439 additions, -5 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+19 -0)📝
runtime/CMakeLists.txt(+8 -0)📝
runtime/shims/d3d12_com.h(+3 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+196 -3)➕
runtime/src/heavy_pipeline_cache.h(+94 -0)📝
runtime/test/d3d12_mesh_test.cpp(+1 -0)📝
runtime/test/d3d12_translated_draw_test.cpp(+1 -0)➕
runtime/test/heavy_pipeline_cache_test.cpp(+109 -0)📝
runtime/test/vk_test_device.h(+8 -2)📄 Description
Claimed in the coordination issue as RT-HEAVY-PIPELINE-CACHE: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7167207402
Problem
The builds the offline
pipeline_cache.binmisses are compiled again on every boot. On an RTX 5070 Ti these are the pipeline library's compute programs, 3 to 7 s each and about 40 per boot before the world starts, and they are what keeps the render thread waiting at the title's hang watchdog.pipeline_cache.session.bincan't keep them for two reasons:LEONIDA_STARTUP_CACHE_CHECKPOINTShas the same problem.Change
VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT(DeviceState::create_pipeline).pipeline_cache.heavy.bin, next topipeline_cache.bin. That cache holds only the corpus's misses, so it stays small.LEONIDA_HEAVY_PIPELINE_CACHE_MS(500 by default) marks the cache dirty. A thread of its own writes it 3 s after the newest slow build and no later than 20 s after the first unwritten one, through the existing staging file and rename (CacheStagingFile), so the file on disk is always complete. A crash loses at most the last 20 s of slow builds. At teardown the thread stops and writes what is left.LEONIDA_HEAVY_PIPELINE_CACHE_MS=0turns it off, and with itpipelineCreationCacheControlunlessLEONIDA_PIPELINE_COMPILE=cache-onlyasks for it. A cache-only create (cache-only) is left exactly as it was.runtime/src/heavy_pipeline_cache.h, withheavy_pipeline_cache_test.vk_test_device.htakes the heavy path whenLEONIDA_HEAVY_PIPELINE_CACHE_MSis set, andd3d12_mesh_heavy_cacheruns the mesh test's draws through it.docs/d3d12_vulkan.mddescribes it next to the session cache.Measured (Windows 11 Pro 26300, RTX 5070 Ti, NVIDIA 617.42, VS 2026 RelWithDebInfo)
vk_pipeline_checkand a local probe that adds the flag (not part of this PR), against an empty cache. Four library compute programs the corpus lacks returnVK_PIPELINE_COMPILE_REQUIREDin under 1 ms, so the heavy path is taken for them. The mesh test's small shaders come backVK_SUCCESSfrom a cache-only create even into an empty cache, because the driver's own shader cache already holds them. That is why the CTest case checks correctness, not the file.heavy_pipeline_cache,pipeline_cache_store,pipeline_cache_file,d3d12_msaa_draw,d3d12_meshandd3d12_mesh_heavy_cacheall pass, 6 of 6.Not done here
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.