mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1308] runtime: a pipeline cache from the runtime's own device (RT-RUNTIME-PIPELINE-CACHE) #1338
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#1338
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/1308
Author: @Daolyap
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:rt-runtime-pipeline-cache📝 Commits (1)
8fb2bderuntime: a pipeline cache from the runtime's own device (RT-RUNTIME-PIPELINE-CACHE)📊 Changes
6 files changed (+168 additions, -5 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+15 -1)📝
runtime/CMakeLists.txt(+7 -0)📝
runtime/shims/d3d12_com.h(+5 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+61 -3)📝
runtime/src/vulkan_backend.h(+1 -1)➕
runtime/test/pso_warmup.cpp(+79 -0)📄 Description
Item: RT-RUNTIME-PIPELINE-CACHE (claimed in #14). Complements #218, which persists the cache at device teardown.
Why
The
pipelinesstage'spipeline_cache.binpasses the runtime's header check, but it misses for the runtime'spipelines. A driver keys its cache on the device's enabled extensions and features, and
vk_pipeline_checkcreates a different device. The runtime enables 17 extensions the checker doesn't (mesh shader,
maintenance5/8, shader FMA and clock, fragment barycentrics and interlock among them), and the two build their
feature lists differently: the checker sets every core feature through
Features2and the 1.1/1.2/1.3 structs,the runtime a subset through per-extension structs. I diffed both
VkDeviceCreateInfos with a local dump.Measured on an RTX 3070, driver 32.0.16.1692, with the retail 1.0.2.1 BVH builder's 52 compute programs:
LoadInstances)vk_pipeline_check, coldvk_pipeline_check, re-run on its own cachepso_warmup(runtime device), coldpso_warmup, re-run on its own cacheThis matters for booting. The title creates the BVH builder's pipelines on its graphics-init thread, and its own
watchdog ends the process after about 26 s, so the cold 28 s compile kills every launch the same way, with nothing
in the log. With a
pso_warmupcache besidegta6rt.exe, the #432 stack on native Windows gets past graphics initand into its frame loop (details in #14).
Change
DeviceState::save_pipeline_cache(path):vkGetPipelineCacheDatawritten through a temporary file and renamed.rt::d3d12::save_pipeline_cache(ID3D12Device*, path)exposes it for a device fromcreate_vulkan_device*.vkGetPipelineCacheDatais added to the backend's function table.pso_warmup <dir of .dxbc compute programs> <out file>(runtime/test/pso_warmup.cpp, built with the otherWindows tools): builds every program through
CreateComputePipelineStateoncreate_vulkan_device_standalone,then writes that device's cache. It needs
LEONIDA_SHADERSand the user's carved programs; nothing of the game isin the source.
LEONIDA_PIPELINE_CACHE_OUT=<file>: the runtime saves after every compute compile of 250 ms or more, so a runthat ends without a teardown (a watchdog, a crash) keeps what it compiled.
docs/d3d12_vulkan.mdsection 4: replaces the sentence implying the checker's cache serves the runtime with themeasurement and both new paths.
Not in this PR: wiring
pso_warmupintomake_game.py'spipelinesstage, and the graphics PSO path. Both arefollow-ups once this shape is agreed.
Tested
gta6rtandpso_warmupbuild without new warnings.tests/test_docs_env_vars.pyandtests/test_text_write_line_endings.pypass.check_no_game_data.pyon every changed file passes.AI-assisted (Claude Code).
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.