mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #218] d3d12: persist the runtime Vulkan pipeline cache across launches #270
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#270
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/218
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9953📝 Commits (1)
99cefc9d3d12: persist the runtime Vulkan pipeline cache across launches (framed and checksummed file, saved after a cache miss and under 1 GiB, merged across sessions, never the build seed)📊 Changes
14 files changed (+1328 additions, -35 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+18 -0)📝
runtime/CMakeLists.txt(+22 -0)📝
runtime/shims/d3d12_com.h(+15 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+279 -18)📝
runtime/src/pipeline_cache_file.h(+21 -12)📝
runtime/src/pipeline_cache_snapshot.h(+0 -0)➕
runtime/src/pipeline_cache_store.h(+264 -0)📝
runtime/src/vulkan_backend.h(+1 -1)➕
runtime/test/d3d12_pipeline_cache_persist_test.cpp(+582 -0)📝
runtime/test/pipeline_cache_file_test.cpp(+1 -1)📝
runtime/test/pipeline_cache_snapshot_test.cpp(+1 -1)➕
runtime/test/pipeline_cache_store_test.cpp(+120 -0)📝
runtime/test/vk_pipeline_check.cpp(+2 -2)📝
runtime/test/vk_test_device.h(+2 -0)📄 Description
Original description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):Rebased cleanly on current main; supersedes
#7396closed during org migration.What
The runtime's Vulkan pipeline cache now survives launches. Today main only reads a build-time
pipeline_cache.binseed, so every launch recompiles every PSO from scratch (the first-frame and PSO-creation stall).runtime/src/pipeline_cache_store.h;pipeline_cache_file.handpipeline_cache_snapshot.hmove from test/ to src/).LEONIDA_PIPELINE_CACHE=offturns it off (tests).PipelineCacheStatsreports created / hits / time so a test can see the effect.Why
PSO creation is the cold-boot cost before the first frame; the cache makes the second launch skip it. A checksum and size cap keep a damaged or huge file from breaking a launch.
Tested
On this base (current main, native g++):
pipeline_cache_store_test(new, framing, checksum, merge, size cap, rejection of damaged files): prints "pipeline cache store: ok", exit 0.pipeline_cache_file_testandpipeline_cache_snapshot_test(moved to src/): exit 0 each.pipeline_cache_store_testdoes not build on origin/main (src/pipeline_cache_store.hdoes not exist there); the persistence behaviour is absent.NOT run on this base (be aware):
d3d12_pipeline_cache_persist_test(GPU test, Windows exe under Wine) and the compile ofshims/d3d12_vulkan_device.cpp. The GPU pods are off and this host has no unpacked Windows SDK; mingw headers cannot parse the Windows code. The earlier version of this PR (#7396, older base) measured 26x faster PSO creation on the second launch on an RTX 4090. The merge needed three keep-both conflict resolutions (d3d12_com.h,d3d12_vulkan_device.cpp,vk_test_device.h; the host-pointer fields andcreate_buffer_at_host_addressfrom main sit next to the new cache fields andpipeline_cache_stats); that second-launch speedup has not been reproduced here. Please rund3d12_pipeline_cache_persiston CI/maintainer hardware before merging.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.