Repository navigation
d3d12: LEONIDA_LAZY_PSO=1 builds pipelines at their first draw or dispatch and keeps no unedited shader modules (RT-LAZY-PSO) - #511
Conversation
…patch and keeps no unedited shader modules (RT-LAZY-PSO) Graphics PSOs build their driver pipeline as variant(0) at the first draw; compute PSOs compile through ComputePipeline::build at the first dispatch. A stage the runtime does not edit (no f16 link, no D24 depth patch) keeps no VkShaderModule: build() makes one from the library's words per pipeline and destroys it after. The compute subgroup request is still decided and recorded at creation in both modes. Off by default. Tests: d3d12_compute_lazy_pso, d3d12_draw_lazy_pso, d3d12_mesh_lazy_pso (the existing tests with the switch on). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Measured on the retail boot with an AMD Radeon RX 9070 XT (RDNA4, driver 32.0.32029.2010), Windows 11 26300, MSVC 19.44 (CMake + Ninja), i7-14700K, own 1.0.2.1 copy, On AMD's Windows driver the eager PSOs are what holds the boot back, so this switch matters there:
So the ~51,000 PSOs that took the whole 300 s now go by in about 14 s, and the boot reaches later stops: the 256 MB default arena first, then format 118 in One thing to watch when this meets a rectangle-list path (not a defect of this PR on Not run: this PR's three new AI-assisted (Claude Code). |
… lazy PSOs, console formats, XG, title memory) Measured on the retail boot under Wine 11.22 (RX 9060 XT, RADV): it now creates 10,000+ slot 57 pipelines, runs its loading frame loop at ~2.5-4 GB, and, with the hang check held off (LEONIDA_SLOW_STARTUP=1), starts real rendering at ~120 s. Frames are still black, and that run stops at game+0x13360a3 (a game object with a garbage vtable; not caused by anything below that was tested). From open pull requests (applied as patches, conflicts resolved here): - ProjectLeonida#511 (VibeClauding): LEONIDA_LAZY_PSO=1, pipelines built at first draw/dispatch. Local fix on top: the rect-list path's VS words were cleared before rect_list_geometry read them, refusing every rectangle-list PSO; the compute compile keeps this branch's host-stall scope. - ProjectLeonida#496 (Rüzgar Koray Genç): console pipeline-stream numbering (24 = mesh shader). - ProjectLeonida#461 (oscarlosu-lab): xg_xs texture layout and computer (ported from Marvisak/VIctory, GPL-3.0). - Draft ProjectLeonida#321 (Mumogg, 237f9e0): vertex/index views in title CPU memory copied into a ring (title_memory). Local fixes: - Slot 57 pipeline blob elements: +0x00 is SemanticIndex, +0x08 InputSlot (swapped before; docs/fspx.md and the device_proxy test updated). ~4,900 "input layout does not feed COLOR1" refusals were this. - FSPX graphics stages that read their code base use the kind-6 program as code (was empty -> E_OUTOFMEMORY). - Console formats 118/119/120 (hypothesis: D16_UNORM_S8_UINT family) aliased to the D24S8 family at the device's entry points. - Depth-stencil + UAV stand-in extended to slots 108, 127 and the slot-133 texture fallback; a UAV initial state on such a texture starts in COMMON. Slot 108 logs refusals (the title asserts its answer is below 4 GiB). - 8-bit RGBA/BGRA render targets accept a UNORM/sRGB view without a castable list. - Fence slot 12 mirrors refreshed by one poller thread (LEONIDA_FENCE_MIRROR=tp keeps the thread-pool waits, which queued on Wine's wait-queue lock); xs_proxy_mock tests run in tp mode. - Slot-133 shadow buffers keep their VirtualQuery layout between refreshes (178 MB: 70 ms -> ~8.5 ms) and the refresh counts as a host stall. Diagnostics and experiments (off unless noted): - LEONIDA_DRAW_DIAG=1: per-present draw counts and per-draw pipeline/target/depth/viewport/vb0 for early frames. - Slot 57 refusal layout dump and created/failed totals; refused RTV and committed-resource details; failed ExecuteCommandLists names its vulkan_replay.h line (on by default, test-branch lines). - LEONIDA_SLOW_STARTUP=1: guest Sleep of 1-2.1 s lasts 2.1 s, so the startup hang check never counts (hides hangs). - LEONIDA_XG_NO_COPY=1: texture computer slots 8/9 copy nothing. Co-authored-by: VibeClauding <360230414+VibeClauding@users.noreply.github.com> Co-authored-by: Rüzgar Koray Genç <koray_genc1@hotmail.com> Co-authored-by: oscarlosu-lab <251827664+oscarlosu-lab@users.noreply.github.com> Co-authored-by: Mumogg <104529023+Mumogg@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es at their first draw or dispatch and keeps no unedited shader modules (RT-LAZY-PSO)
…nd multi-scissor rendering (1..16 viewports/scissors) Resolved against ProjectLeonida#499's emit_graphics_pass, ProjectLeonida#469's depth bounds and ProjectLeonida#511's lazy modules: the viewport/scissor setup moves into emit_graphics_pass, the pipeline's dynamic-state list keeps DEPTH_BOUNDS and picks the *_WITH_COUNT states, and ProjectLeonida#499's ExecuteIndirect draws now carry the bound depth bounds and viewports like record_draw. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I used PortBridge to independently replay towade’s rectangle-list finding and the order already used in LloydNicholson’s integration. At rectangle PR #207 head The remaining integration check is |
|
Native Windows pixel-readback follow-up to the standalone reproduction. I merged #207
I applied only the guard that keeps Windows 11 build 26100, RTX 3060 Ti driver 610.88, MSVC 19.44, LLVM 23.1.5, Khronos validation 1.4.369 with |
|
@towade Would you be willing to run the synthetic |
|
Retail check of
So on this machine the lazy path does what the description says and moves the first stop from the title's start-up to the depth format, then the arena, then wave64 graphics shaders; no device loss in any of the three runs, and no exception other than the title's own int3. I did not look at #207 together with this PR (DadaCap's report about the rectangle-list path); #207 alone on the base stack, without lazy PSOs, reached the loop (473,041 AI-assisted: yes (Claude Code, Sonnet 5.5) |
|
checked:
The failures are the same tests with and without the variable, so the lazy path adds none. On Intel they are sparse/tiled resources, DXR and some formats; on AMD they are Retail, with this PR on For the rectangle-list interaction, see my note on #682: the same AI-assisted (Claude Code). |
|
Independent eager/lazy A/B on Windows 10 22H2 (19045), RTX 5070 / NVIDIA 610.88, MSVC 19.51.36256, Vulkan with Khronos validation 1.4.369. Tested the same binaries in separate processes with
Synthetic results only. This run did not measure retail startup or memory consumption. No game files. AI-assisted (Codex). |
|
Independent check. Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, RTX 5060 Ti, each without and with Synthetic tests only, no game files. AI-assisted (Claude Code): I read the diff and ran the tests on that machine. |
|
PortBridge connected this PR to SceneGate VI's changing-color readback control. I applied that method to the offscreen Vulkan fixture at On RTX 4070 Ti SUPER, Windows 11 build 28000, driver 617.14, both The test-only patch and reproduction guide use the existing |
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.