Improve post-load GPU memory and pipeline handling (RT-POST-LOAD-GPU-MEMORY) #2098
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2098
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2098/head"
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?
@Moriz82 on GitHub · 2026-11-25 20:31 UTC · original
pr/upstream-1125→main· +16735 −972 · 113 files · 12 commits · merged 2026-11-26 00:01 UTCThis draft follows #1723. When the shared Vulkan buffer arena fills, an eligible committed buffer can now use a dedicated allocation. An earlier Proton run stopped during upscaler initialization when no arena slice fit the requested buffer.
Claimed as RT-POST-LOAD-GPU-MEMORY. Coordination issue
Changes
Independent review work overlaps the fixed-count and counted indirect mesh paths and pipeline compile workers. Fixed-count mesh dispatches · Count-buffer mesh dispatches · Pipeline compile workers
Verification
db1a22d29, LinuxThe public commit still needs a title boot. Native Windows and playable world rendering remain unverified.
GPU used for the source integration was an NVIDIA GeForce RTX 4070 on Linux under Proton. Public-head runtime checks are in progress.
Contributors include Plaaasma and ivanepsilondelta. AI-assisted.
c1e1ef0b8into RT-POST-LOAD-GPU-MEMORY (#2098) 3a2820b3bf@Snooozs on GitHub · 2026-11-25 20:48 UTC · original
Native Windows boot of this draft (
9f98dcc61), one run. Counts only, no game data.Machine: Windows 10 19045, RTX 5060 Ti 16 GB, NVIDIA 621.01, 32 GB RAM, own 1.0.2.1, MSVC RelWithDebInfo (builds clean). Shaders from my work folder (47,772 loaded, 0 refused), cold pipeline cache,
LEONIDA_ARENA_MB=2048 LEONIDA_TITLE_WINDOWS_MB=1024 LEONIDA_DEVICE_TYPE=6 LEONIDA_TITLE_WATCHDOG=0 LEONIDA_MEM_PROBE=20, no other change. Run time 431 s, ended by me. No device loss, no driver error in the event log.Reached: the loading screens and the world start. Then it stops the same way as my runs without it: the last submission is number 2,216 at t=217 s,
list valuesstays at 7,685 recorded / 7,528 landed (157 pending), 14 gates held, 0 met, 14 timed out (9 of them at the short timeout), while the process sits idle except for one pipeline build thread. So the draft does not cause the stall and does not remove it, on this machine (RT-LIST-VALUES-STALL-SNAPSHOT, tiguan26, is the one to watch). 825 compute and 54 graphics pipelines were made, 141.6 s and 65.2 s invkCreate*Pipelines; indirect draws: 9,446 recorded, 512 emitted.What it does save, against my earlier runs:
heapsphase of a submissionNot a clean comparison: the runs differ in much (geometry copies, a 1.1 to 1.6 GB heavy pipeline cache in most of mine, host copies). One thing stands out either way:
LEONIDA_MEM_PROBEsayspipeline cache 0 MiBhere, where mine held a 1.1 to 1.6 GB cache in memory, and the journal of this run was 791 files, 1.6 MB.The loading was slow here: 1 to 4 frames/s from 20 to 60 s, because the cache was cold. Is there anything you want measured with a warm journal or a switch (
LEONIDA_COMPILE_HELPER=1,LEONIDA_ASYNC_PIPELINES=1)? I can run it. What I would watch for: whether the helper lowers the RAM peak further.A question on the stall, since your title frame counter advanced to 2,830 at 600 s under Proton: did
list values ... recorded / landedkeep moving there, and what are your last counters?AI-assisted (Claude Code, Claude Opus 5.5).
@TheGeogeo on GitHub · 2026-11-25 21:17 UTC · original · edited 2026-11-25 21:19 UTC
Overlap with #1889 (RT-BIG-COMPUTE-BUDGET), so that neither of us finds out at the merge. Read from the code of
9f98dcc6and from trial merges; I have not built or run this pull request. I do not have the game, so I cannot test on it directly: what I check is the project's own tests and synthetic modules.main72006d61, and has six hunks with #1889 at0bf7ef80:d3d12_vulkan_device.cpp5,vulkan_replay.h1. #1889 now lists it inDepends on:; neither builds on the other, and whichever lands second rebases.build_compute_pipelinekeeps the staticbig_compilemutex for modules over 128 KiB. #1889 replaces it by default with a place atbig_compile_gate()(by estimate, what a submission waits for before the warm-up), and keeps the mutex forLEONIDA_SERIAL_BIG_COMPILES=1only. With both in, the place has to be taken before the PSO'svariants_mutex_(enter_build), because a thread that waits for memory must hold no PSO lock.LEONIDA_COMPILE_HELPERbuilds are in another process, so the gate does not count them; it only sees that the free memory is lower. If #1889 lands second I do that rebase.LEONIDA_COMPILE_HELPER_THREADSsays about 3.5 GB of host memory for a module over 3 MB. #1889 estimates 512 bytes for each byte of SPIR-V, from synthetic modules on NVIDIA and from RADV. If those are modules near 3 MB, 3.5 GB is more than twice that. Which module sizes, GPU and driver was that, and was it one compile alone, as peak private memory of the process? If it holds, the estimate should go up, not down.AI-assisted (Claude Code).
@OreoFR on GitHub · 2026-11-25 21:32 UTC · original
A note on the async texture refresh (
LEONIDA_TEXTURE_REFRESH_ASYNC), from working on the same pass (RT-TITLE-EVERY-BUDGET): with async on, the submission only callsrequest_title_refresh(), so a mapped texture that has never been filled can be sampled empty by its first draw (a video plane, for example). In my local async branch I fill only those textures (mapped && !fills) synchronously in the before-execute hook, withtry_to_lockon the registry and no wait if the worker holds it (waiting could deadlock on a fill that needs this queue), then wake the worker for everything else. It only visits textures that have never been filled. Untested on your branch, just a suggestion. Our two PRs also touch the same loop inrefresh_title_textures; whichever lands second rebases.@aslan2142 on GitHub · 2026-11-26 00:01 UTC · original
Merged, thanks, @Moriz82, for the post-load memory and pipeline work, and to Snooozs, TheGeogeo and OreoFR for the boot run, the #1889 overlap map and the async-refresh catch.
main'sPipelineCompiles/PipelineWorkerspath within the #1889 budget again; the pre-pass is gone, at the maintainers' decision. The record-time build request and the compile-helper deferral are kept on top of it.pNextchain in the 2D mirror view (the 120 s hangs ind3d12_existing_heap,d3d12_r9g9b9e5_uav,d3d12_depth_stencil_uavand the Xbox depth-storage tests); the table scan no longer nulls V#s of the layer's own upload buffers below the arena (the iGPU compute failures); three test targets that did not build, a byte-order mark, and anxg_xscheck that contradictedmain.d3d12_mapped_plane_async, which fails 3 of 3 runs without the fix.LEONIDA_COMPUTE_WARMUP_LIVE_MAX_BYTESis opt-in (0 by default, somain's warm-up stays as it was), and 30 switches are documented.main33bd07cf8merged with this: no pass to fail from this PR.d3d12_set_descriptor_heapsfails onmainalone too, andxmemandxbox_presentpass alone on llvmpipe (xbox_presentfails on the iGPU with or without this PR). The translator suite passes (495 files, 6,333 tests).vk_presenter_sparse_capturefails under Wine, where creating its temp folder with an owner-rights access rule fails.main33bd07cf8+fc7153488: it merges cleanly; the semantic suite passes (495 files, 6,333 tests, 0 files failed); the 15 docs and writer tests pass;check_no_game_data.pyis clean on the 113 changed files.AI-assisted (Claude Code, Claude Opus 5.5).
@ammonium231 on GitHub · 2026-11-26 14:16 UTC · original
RTX 3090 / 621.40: xbox_present fails the resize present_planes check (xbox_present_test.cpp:1226 on main). First bad is
9f98dcc61; reverting only its captured_ gating in vulkan_present.h passes. After a resize recreate captured_ stays false, so read_back fails. LEONIDA_COMPILE_GATE=0 and the dxgi_swapchain.h hunk don't change the result.