mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:05:54 +01:00
[PR #511] d3d12: LEONIDA_LAZY_PSO=1 builds pipelines at their first draw or dispatch and keeps no unedited shader modules (RT-LAZY-PSO) #559
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#559
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/511
Author: @VibeClauding
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:cont-lazy-pso📝 Commits (1)
88658f1d3d12: LEONIDA_LAZY_PSO=1 builds pipelines at their first draw or dispatch and keeps no unedited shader modules (RT-LAZY-PSO)📊 Changes
4 files changed (+182 additions, -37 deletions)
View changed files
📝
docs/d3d12_vulkan.md(+8 -0)📝
runtime/CMakeLists.txt(+9 -0)📝
runtime/shims/d3d12_vulkan_device.cpp(+151 -33)📝
runtime/src/vulkan_replay.h(+14 -4)📄 Description
Claimed in #14 as
RT-LAZY-PSO.What and why
Opt-in
LEONIDA_LAZY_PSO=1(off by default, nothing changes without it):variant(0).prepare_drawtakes the base pipeline fromvariant(0)whenpipelineis null.ComputePipeline::build(both dispatch sites inprepare). The subgroup-size request is still decided, recorded (pipeline_subgroup_requests) and reported at creation in both modes.build()makes each from the library's words for the pipeline it creates and destroys it after (ModuleCleanup). Edited stages keep their module as today.The retail title creates some 50,000 PSOs before its first frame and draws with far fewer. On a 16 GB RAM + 8 GB pagefile Windows machine (RTX 3070, driver 610.88), building them all eagerly ran the process out of commit between 50 and 300 s into the boot: the driver's copy of every module plus every pipeline. With deferred pipelines and no kept modules, private memory stayed at 11-17 GB and the title's own loading continued instead of stalling behind the compiles. Those measurements were on a forge-based branch with this change and others; this pull request is the change alone, onto
main.Trade-off: a pipeline the driver refuses fails its draw or dispatch (
unresolved_resource, logged once) instead ofCreatePipelineState, and the first draw with a new PSO pays its compile. That is why it is a switch.Tests
d3d12_compute_lazy_pso,d3d12_draw_lazy_pso,d3d12_mesh_lazy_pso: the existing tests run with the switch on (CTestENVIRONMENT).cteston Windows 11, MSVC, RTX 3070: default mode and withLEONIDA_LAZY_PSO=1set for the whole run, 302/303 in both. The one failure,d3d12_execute_indirect_validation(5 count-buffer parity rows), fails the same way on unchangedmainon this machine.scripts/check_no_game_data.pyon the changed files: clean.Docs: a bullet in
docs/d3d12_vulkan.mdsection 3.6.AI-assisted (Claude Code); built and tested on the machine above.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.