Skip to content

runtime, d3d12: memory leak fixes from one sweep (RT-LEAK-SWEEP) - #2569

Open
adrianmjim wants to merge 107 commits into
ProjectLeonida:mainfrom
adrianmjim:leaks/all
Open

adrianmjim wants to merge 107 commits into
ProjectLeonida:mainfrom
adrianmjim:leaks/all

Conversation

@adrianmjim

@adrianmjim adrianmjim commented Nov 28, 2026 •

Copy link
Copy Markdown

Claimed in the coordination issue as: RT-UPLOAD-ARENA-REWIND, RT-PSO-BYTECODE-INTERN, RT-SPARE-LIST-EPOCHS, RT-SLOT-RECORDS-BUCKETS, RT-REHYDRATE-SCRATCH-TICKET, RT-FSSM-ARENA-SHARE, RT-TITLE-BUFFER-FALLBACK, RT-SLOT70-DEVICE-CYCLE, RT-MEM-PROBE-WINDOWS, RT-ZERO-IMAGES-RETRY, RT-TITLE-TEXTURE-GONE-RANGES, RT-SHADOW-GPU-RELEASED-RANGES, RT-SLOT70-OWNED-RETIRE (#1608 (comment)); RS-HOST-LIST-ALLOCATOR-PEAK, RS-XTASKQUEUE-POOL-TRIM, RS-TEXTURE-READ-TRIM, RS-SNAPSHOT-POOL-TRIM, RS-EXACT-SPARE-CAP, RS-GRAPHICS-STATE-INTERN, RS-EARLY-START-AGE, RS-XMEM-FREE-DEFAULT, RS-THIN-UPLOAD-DROP, RS-APU-SCRATCH, RS-REPLACED-DRAIN (#1608 (comment)); RT-GEOMETRY-VIEWS-CONTAIN, RT-DRAW-VIEWS-UNCHANGED (#2570 (comment)); RS-ARENA-ONE-COPY, RS-SHADER-CONTAINER-FREE, RS-DSTORAGE-SCRATCH, RT-DEVICE-LOST-DRAIN (#2570 (comment)); RT-SESSION-CACHE-UNCHANGED (#2570 (comment)); RT-SHARED-PIPELINE-LAYOUTS (#2570 (comment)); RS-HOST-LIST-SCRATCH-TRIM, RS-PIPELINE-LIBRARY-FINGERPRINT, RT-ZERO-IMAGES-RELEASE, RT-DSTORAGE-CPP-SCRATCH (#2570 (comment))
Depends on: none. It conflicts with #1521 (both add a release at the same spot in ~Device; keep both), #2267 (runtime/CMakeLists.txt, runtime/test/d3d12_existing_heap_test.cpp) #2085 (runtime/shims/d3d12_geometry_views.h, runtime/test/geometry_views_test.cpp), #2480 (runtime/src/command_list.h) and #1756 (save_session_pipeline_cache in runtime/shims/d3d12_vulkan_device.cpp and the end of runtime/test/pipeline_cache_store_test.cpp: whichever lands second passes state->cache_origin in the checkpoint and calls record_session_seed only when the save succeeded; a bool does not convert to CacheOrigin, so a wrong merge does not compile).

What and why

Thirty-six fixes for memory that the two runtimes never give back, or keep longer than they need. Twenty are in the C++ runtime (runtime/: the D3D12 → Vulkan layer and the console D3D12 proxy), the thirteen below and seven more further down. Sixteen are in the Rust runtime (d3d12/). They were claimed one by one (links above) and were meant to be separate pull requests. GitHub only lets this account have one open pull request in this repository, so they come together here.

The fixes stay apart in the history, which makes them easy to review or revert one at a time. Each one is its own commit (or a few), merged into this branch with its own merge commit, and comes with its own test that fails on main and passes here. Each one also still exists on its own branch, adrianmjim/leonida:leaks/<name>, so any of them can become a separate pull request on request, or be dropped from this one.

# Item Change
1 RT-UPLOAD-ARENA-REWIND d3d12: upload memory comes back at its command allocator's Reset
2 RT-PSO-BYTECODE-INTERN d3d12_xs: PSO streams with equal shader bytecode share one copy
3 RT-SPARE-LIST-EPOCHS d3d12: an idle list-cut spare drops its recording and holds back no retired title window
4 RT-SLOT-RECORDS-BUCKETS d3d12: a slot-record bucket goes with the last half it holds
5 RT-REHYDRATE-SCRATCH-TICKET d3d12: a shim's scratch stays alive until the submission that used it has completed
6 RT-FSSM-ARENA-SHARE d3d12: the PSOs of one program share its code-base copy in the arena
7 RT-TITLE-BUFFER-FALLBACK d3d12: a title vertex or index view makes and keeps only a buffer that covers it
8 RT-SLOT70-DEVICE-CYCLE d3d12: an image made for slot-70 views holds no device reference, so a released device goes
9 RT-MEM-PROBE-WINDOWS mem probe: on native Windows a vmmap line shows the process's memory by kind
10 RT-ZERO-IMAGES-RETRY d3d12: a shape whose shared zero image could not be made is tried again, after a wait that doubles at each failure
11 RT-TITLE-TEXTURE-GONE-RANGES d3d12: a title texture destroyed inside the registry leaves the async refresh's indexes too
12 RT-SHADOW-GPU-RELEASED-RANGES d3d12: LEONIDA_SHADOW_GPU=1 alone keeps no released ranges for the console heap pass
13 RT-SLOT70-OWNED-RETIRE d3d12: a slot-70 image a newer texture covers, or whose pages went, is retired once no view names it

RT-SLOT70-OWNED-RETIRE is off by default (LEONIDA_TITLE_IMAGE_RETIRE=1 turns it on): a second review found cases where retiring an image too early could show wrong pixels. LEONIDA_UPLOAD_REWIND=0 turns RT-UPLOAD-ARENA-REWIND off. The other fixes have no switch.

A short description of each fix follows, to keep this text under GitHub's size limit. The full description, and what the fix's test checks, are in the commit messages on its branch, https://github.com/adrianmjim/leonida/commits/leaks/<name>:

1. RT-UPLOAD-ARENA-REWIND: d3d12: upload memory comes back at its command allocator's Reset

Console list slot 148 (AllocateUploadMemory) carved memory from an arena of persistently mapped UPLOAD buffers in runtime/shims/d3d12_xs_device.cpp that only ever advanced; only destroy_upload_state gave it back, when the device proxy went, so a title that uploads every frame grew it by one buffer each time the newest was full. Chunks now belong to an allocator: the allocator proxy's Reset (slot 8) rewinds them, a chunk idle for 8 of its allocator's Resets is given back, and the proxy's last release frees them. LEONIDA_UPLOAD_REWIND=0 keeps the one shared arena that only grows, as before; LEONIDA_UPLOAD_LOG=1 names each chunk given back.

2. RT-PSO-BYTECODE-INTERN: d3d12_xs: PSO streams with equal shader bytecode share one copy

PsoStreamRecord::capture (runtime/shims/d3d12_xs_pso_stream.cpp, copy_pointed_data) copied every shader stage's bytecode into the record's own blobs in both compile modes (including LEONIDA_PIPELINE_COMPILE=on-demand), so each slot 86 PSO kept a private copy of every container it was made from. copy_pointed_data now takes the bytecode from a process-wide table keyed by size and DXBC checksum, takes a candidate only when all its bytes are equal, and holds weak references only, so a container is freed with the last PSO that uses it. No switch is added, because what each PSO's stream holds and reads does not change.

3. RT-SPARE-LIST-EPOCHS: d3d12: an idle list-cut spare drops its recording and holds back no retired title window

A retired title window waits for every command list whose recording began before its retirement, and the list proxy's spare real lists (restart_recording in runtime/shims/d3d12_xs_device.cpp) kept their last recording's stamp until the proxy was released, holding back every window retired after it. restart_recording now drops each new spare's recording through rt::d3d12::drop_recording, so a dropped list carries no stamp until its next Reset, and a window still without a ticket after 30 s is logged once. There is no switch; without LEONIDA_VULKAN_DEVICE the spares are kept as before, and a closed list the title neither resets nor releases still holds back later windows.

4. RT-SLOT-RECORDS-BUCKETS: d3d12: a slot-record bucket goes with the last half it holds

The two indexes in runtime/src/console_heap_slot_records.h never erased a bucket, so for the main resource heap, which lives as long as the session, the bucket count grew with every (span class, granule) ever written, not with the live slots, and never went down. Each bucket now counts the halves it holds (Bucket::live), and set() lets the last half to leave a bucket erase it with its stale entries, so the buckets held are at most twice the halves recorded. There is no LEONIDA_*=0 switch: nothing a lookup returns changes, only memory that nothing reads anymore is freed.

5. RT-REHYDRATE-SCRATCH-TICKET: d3d12: a shim's scratch stays alive until the submission that used it has completed

When the title passes ScratchAccelerationStructureData = 0, rehydrate_scratch (shims/xbox_bvh_builder.cpp) hands its DEFAULT scratch buffer to the list with rt::d3d12::hold_until_reset; in the default synchronous submit mode (LEONIDA_SUBMIT_ASYNC unset) the list released it at its Reset while the build could still run, and ~Resource returned its arena range at once. A list now records those objects (kept_) and ExecuteCommandLists passes them to VulkanQueue::execute as a keep callback, so the scratch lives until the first queue call after its submission has completed. There is no switch to bring back the old behaviour, since that behaviour was a use-after-free.

6. RT-FSSM-ARENA-SHARE: d3d12: the PSOs of one program share its code-base copy in the arena

A PSO whose shader reads its code base copies that program into the fixed-size GPU address arena (create_compute and create_graphics in runtime/shims/d3d12_vulkan_device.cpp), and every PSO made its own copy, so N PSOs of one program held N copies of the same bytes until they were released. The device now keeps one copy per program (DeviceState::code_copies), keyed by the program's SHA-256; later PSOs take a reference and the last one returns the copy from ~PipelineState. LEONIDA_SHARE_CODE_BASE=0 gives every PSO a copy of its own, as before, and a compute index entry without a uses_code_base key is still copied. Not in this pull request: 2,426 of the 2,689 compute shaders in the main index have no uses_code_base key yet, so they are still copied; that is a translator change.

7. RT-TITLE-BUFFER-FALLBACK: d3d12: a title vertex or index view makes and keeps only a buffer that covers it

When make_title_buffer (runtime/shims/d3d12_vulkan_device.cpp) could neither import nor shadow the title's pages, create_at_host_address still returned an ordinary DEFAULT buffer that resolved nothing; it was kept in title_buffers_ until the device went and counted against LEONIDA_TITLE_BUFFERS_MB, and each rebind made another until the cap was used up. Now make_title_buffer gets E_OUTOFMEMORY instead (ordinary_fallback is false), keeps a buffer only when the context knows a buffer at the view's address (1 byte with LEONIDA_TITLE_BUFFER_COVERAGE=0), and after a refusal tries no range for a second, a refused range waiting twice as long each time, up to 64 s. No switch.

8. RT-SLOT70-DEVICE-CYCLE: d3d12: an image made for slot-70 views holds no device reference, so a released device goes

The images make_title_texture makes for slot-70 views held a device reference (attach_device) while the device's registry (state_.title_textures) and retired_title_textures_ held the images, and ~Device released neither, so a released device and its Vulkan objects were never destroyed. Each image now drops its device reference right after it is made, and ~Device releases the registry's images and the retired ones after vkDeviceWaitIdle (release_title_images). This is teardown only: during a session the refresh pass releases retired images, and a title never releases its device.

9. RT-MEM-PROBE-WINDOWS: mem probe: on native Windows a vmmap line shows the process's memory by kind

LEONIDA_MEM_PROBE=<seconds> (runtime/src/mem_probe.h) reads /proc/<pid>/smaps for its process-memory line, so on native Windows it only printed no /proc entry names gta6rt and could not say where 20+ GB of commit go. When proc_dir() finds no /proc entry, sample() now prints a vmmap line: private commit and working set from GetProcessMemoryInfo, committed bytes by kind (title, pe-private, pe-image, pe-section, vk-mapped) from a VirtualQuery walk, and the largest private allocations. It is a diagnostic only, with no LEONIDA_*=0 switch: with LEONIDA_MEM_PROBE unset nothing runs, and under Wine with a /proc entry the smaps line is unchanged.

10. RT-ZERO-IMAGES-RETRY: d3d12: a shape whose shared zero image could not be made is tried again, after a wait that doubles at each failure

When the shared zeroed image for a sampled BC texture's shape (DeviceState::zero_sampled_image) could not be made, for example under VRAM pressure, the shape was stored as nullptr in zero_images, so every later slot 133 placement of that shape took memory of its own for the rest of the session. The failure is now remembered in zero_image_retry and tried again after 1 s, doubling at each failure up to 64 s, and a shape that gets its image leaves the map. Only a shape whose image would pass the 256 MiB limit stays null for good; there is no switch.

11. RT-TITLE-TEXTURE-GONE-RANGES: d3d12: a title texture destroyed inside the registry leaves the async refresh's indexes too

With LEONIDA_TEXTURE_REFRESH_ASYNC=1, drain_titles_gone erased a destroyed slot-133 texture's registry entry but left its key in texture_ranges and mapped_title_textures, so the mapped list kept the TitleTexture alive and the next refresh pass's title_textures.at() threw std::out_of_range, ending the process (0xC0000409). drain_titles_gone now erases the range key with the registry entry and also erases a mapped entry that has no resource. The async pass's apply lambda uses find() and skips keys with no entry.

12. RT-SHADOW-GPU-RELEASED-RANGES: d3d12: LEONIDA_SHADOW_GPU=1 alone keeps no released ranges for the console heap pass

With LEONIDA_SHADOW_GPU=1 and LEONIDA_CONSOLE_HEAP_GPU unset, every arena release, destroyed title-window or geometry block, released slot-133 import and removed alias range added entries that only the console heap pass takes, so they piled up for as long as the process ran. In runtime/shims/d3d12_vulkan_device.cpp the pushes in backing() and title_block_gone now ask heap_pass_enabled(), the alias table records removals only when the pass runs, arena_release no longer calls backing(..., false) twice, and ~Device releases heap_gpu before the VkDevice goes. With LEONIDA_CONSOLE_HEAP_GPU=1 nothing changes apart from the duplicate range being gone.

13. RT-SLOT70-OWNED-RETIRE: d3d12: a slot-70 image a newer texture covers, or whose pages went, is retired once no view names it

Owned slot-70 images from make_title_texture were released (retire_title_texture) only when the same address got a slot-133 registration or another description, so a streaming title kept the image and bindless index of every address it ever named for the device's life. retire_idle_owned_images now retires an image superseded by a newer overlapping texture and not named since, or whose pages are gone, after LEONIDA_TITLE_IMAGE_IDLE_MS (2000 ms by default), with up to LEONIDA_TITLE_IMAGE_CHECKS (128) candidates a pass. Retirement is off by default (LEONIDA_TITLE_IMAGE_RETIRE=1 turns it on), because a descriptor the title wrote once would then sample the fallback. No in-game numbers back the claim that this fixes the bindless filling seen during the story load.

Two more runtime fixes (runtime/)

From a third pass over the same runtime, claimed in #2570, which continues #1608 (#2570 (comment)). Same rules as above: each is its own merge with
its own test that fails on main and passes here, and it still exists on its own branch.

# Item Change
25 RT-GEOMETRY-VIEWS-CONTAIN d3d12: a geometry range inside a live view is answered from that view, not copied again
26 RT-DRAW-VIEWS-UNCHANGED d3d12: draws that bind the same views again share one views block

RT-GEOMETRY-VIEWS-CONTAIN only acts with LEONIDA_GEOMETRY_MB set (off by default) and has its own switch,
LEONIDA_GEOMETRY_CONTAINED=0. It retires nothing for disuse or on a remap (the reason #2350 was reverted by #2370).

25. RT-GEOMETRY-VIEWS-CONTAIN: d3d12: a geometry range inside a live view is answered from that view, not copied again

GeometryViews::resolve (runtime/shims/d3d12_geometry_views.h) looked up only its exact (source, bytes) key, so with LEONIDA_GEOMETRY_MB set a range inside a live geometry copy got a copy of its own, all charged to the cap. An index of the outermost live views by source now answers a range inside a filled live view with that view's address plus its offset, and the range is retired with its view; this also fixes a lost update where a filled view over a tile with a file read in flight skipped its other written tiles for good. Nothing is retired for disuse, and LEONIDA_GEOMETRY_CONTAINED=0 restores the old behaviour.

26. RT-DRAW-VIEWS-UNCHANGED: d3d12: draws that bind the same views again share one views block

GraphicsCommandList (runtime/shims/d3d12_com.cpp) marked its DrawViews block stale in set_vertex_buffers and OMSetRenderTargets without comparing with what is already bound, so a title that rebinds the same vertex buffer before each draw got one make_shared<DrawViews> per draw (about 728 bytes), kept by the recorded draws until the list's Reset. Now set_vertex_buffers marks it stale only for a slot whose view changes, and OMSetRenderTargets only when the target count or a copied target view differs. What each draw records is unchanged.

Tested at 9fc3ad427 (all 26 fixes, with main 33db04a70 merged):

  • Full ctest, -j 3: 521 of 524 pass; the three that fail are the same as on plain main here (d3d12_texture_tiles, pipeline_cache_seed, d3d12_clear). d3d12_compile_pool failed once in an earlier full run and about 1 time in 3 alone; this branch does not touch the compile pool or its test.
  • Under LEONIDA_VK_VALIDATION=1: xs_proxy_mock, geometry_views, d3d12_geometry_views, d3d12_title_va, d3d12_title_va_shadow, d3d12_draw, d3d12_draw_views_sharing and d3d12_existing_heap pass 8/8, no validation errors.

The Rust runtime (d3d12/)

Eleven more fixes from the same sweep, in the Rust runtime this time, claimed in #1608 as well
(#1608 (comment)). They were meant to follow the runtime ones
one pull request at a time and come here for the same reason. A twelfth, RS-XASYNC-CANCEL-UAF, was withdrawn: zmasi's
earlier D3D12-HLE-XASYNC-CALLBACK-AND-CANCEL-LIFETIME covers it. As above, each fix is its own merge with its own test that
fails on main and passes here, and still exists on its own branch, adrianmjim/leonida:leaks/rs-<name>.

# Item Change
14 RS-HOST-LIST-ALLOCATOR-PEAK leonida-gpu: submitted lists hold no host list until reset, idle ones are trimmed
15 RS-XTASKQUEUE-POOL-TRIM leonida-hle: the XTaskQueue thread pool starts few workers in a burst and trims idle ones
16 RS-TEXTURE-READ-TRIM leonida-gpu: a texture refresh thread keeps at most 16 MiB of read buffer between textures
17 RS-SNAPSHOT-POOL-TRIM leonida-gpu: snapshot buffers no snapshot took for the idle time leave the pool
18 RS-EXACT-SPARE-CAP leonida-gpu: spare buffers of view copies are capped at 64 MiB and go when idle
19 RS-GRAPHICS-STATE-INTERN leonida-gpu: title pipelines of one graphics state share it
20 RS-EARLY-START-AGE leonida-gpu: the early pipeline list keeps the last two runs
21 RS-XMEM-FREE-DEFAULT leonida-hle: XMemFreeDefault tells the GPU side of freed 32-bit memory
22 RS-THIN-UPLOAD-DROP leonida-gpu: thin lists give back uploads a reset or release leaves behind
23 RS-APU-SCRATCH leonida-hle: XApu decodes each packet into memory the connection keeps
24 RS-REPLACED-DRAIN leonida-gpu: replaced host copies go with LEONIDA_TEXTURE_SWEEP=0 too

None of them changes what the title sees. RS-EARLY-START-AGE keeps the last 2 runs (LEONIDA_EARLY_RUNS, 0 = every run
as before) and RS-TEXTURE-READ-TRIM keeps 16 MiB a thread (LEONIDA_TEXTURE_READ_KEEP_MB).

14. RS-HOST-LIST-ALLOCATOR-PEAK: leonida-gpu: submitted lists hold no host list until reset, idle ones are trimmed

leonida-gpu host command lists keep their command allocators at peak size, every submitted title list (with LEONIDA_THIN=1, every back list) got a new host list at once that sat unused until the title's next reset, and the idle pool (IDLE, list.rs) kept up to 512 lists that nothing trimmed. A submission now takes the host list and leaves the title list none, and reset takes one from the pool. Once a second the sweep lets go of the oldest half of the idle lists nobody took since the last sweep, through retire, so they are freed on the reaper thread.

15. RS-XTASKQUEUE-POOL-TRIM: leonida-hle: the XTaskQueue thread pool starts few workers in a burst and trims idle ones

the XTaskQueue thread pool (d3d12/crates/leonida-hle/src/modules/xasync.rs, Pool), which also runs every XAsync completion on the process queue, starts about one thread per callback in a burst of short callbacks and never lets a worker go. So it keeps its peak thread count, each thread with its stack and the title's per-thread state. Fix: start a worker only when none is idle or coming, chain the next start while tasks wait, hand each task to the worker that went idle last, and let workers idle for 30 s leave down to 4. Test: 256 short callbacks start at most 32 workers, and 16 workers left idle drop to the one kept while a callback still comes every 10 ms. The tests do not compile on main (no constructor or worker count); with a test-only shim that adds both, they fail there (55 to 255 workers in the burst; 16 or 17 that never leave). No game files.

Test: pool_workers_stay_few_in_a_burst_of_short_callbacks, pool_workers_left_idle_leave_under_a_trickle_of_callbacks.

16. RS-TEXTURE-READ-TRIM: leonida-gpu: a texture refresh thread keeps at most 16 MiB of read buffer between textures

In leonida-gpu, each thread's texture read buffer (texture.rs READ, with_read) only grows, so the submitting thread and each shadow::wide_each helper keep room for the largest texture they ever read for the whole run. A thread now keeps at most LEONIDA_TEXTURE_READ_KEEP_MB (16 unless set) of its own; larger reads take a buffer from a process-wide pool and give it back, and the once-a-second sweep (texture::let_go_idle) hands buffers idle for host::ram_idle_ms to the reaper thread. Nothing the title sees changes.

17. RS-SNAPSHOT-POOL-TRIM: leonida-gpu: snapshot buffers no snapshot took for the idle time leave the pool

leonida-gpu's snapshot pool (shadow.rs POOL/give_back) keeps up to 512 MiB, or its largest buffer, of committed PC memory for the rest of the run, with no trim. Fix: stamp each pooled buffer when it is given back, take out those idle for host::ram_idle_ms in shadow::let_go_idle, and hand them to host::retire so the reaper thread frees them. Test: shadow::snapshot_pool_tests::buffers_the_pool_kept_for_the_idle_time_go (fails with d442851's behaviour, passes with the fix). No game files.

Test: shadow::snapshot_pool_tests::buffers_the_pool_kept_for_the_idle_time_go.

18. RS-EXACT-SPARE-CAP: leonida-gpu: spare buffers of view copies are capped at 64 MiB and go when idle

leonida-gpu's EXACT_SPARE (shadow.rs exact()) keeps up to 1,024 spare view-copy buffers (each 64 KiB to 64 MiB of committed PC memory) forever, reused only on an exact width match. Fix: also cap the spares at 64 MiB (counted in 64 KiB blocks, evicting the oldest), release what leaves outside the lock, and retire those parked for host::ram_idle_ms from shadow::let_go_idle. Test: shadow::exact_spare_tests::spares_of_widths_that_never_come_back_stay_under_64_mib_and_go_when_idle (fails with d442851's rule, passes with the fix). No game files.

Test: shadow::exact_spare_tests::spares_of_widths_that_never_come_back_stay_under_64_mib_and_go_when_idle.

19. RS-GRAPHICS-STATE-INTERN: leonida-gpu: title pipelines of one graphics state share it

every title pipeline created from a stream keeps its own heap copy of the full graphics state for the session (make.rs Pending.graphics: Box, pipeline.rs create_stream), ~84,000 copies of ~5,700 distinct states. Fix: Pending holds Arc, interned by a hash of describe() in a weak table, so equal states share one copy and are freed with their last pipeline. Test: two pipelines from the same synthetic stream must share one state and one with another topology must not; fails on main (two boxes), passes with the fix. No game files.

Test: pipelines_of_one_graphics_state_share_it.

20. RS-EARLY-START-AGE: leonida-gpu: the early pipeline list keeps the last two runs

early-pipelines.txt (d3d12/crates/leonida-gpu/src/pipeline/library.rs) holds every run ever and, since EARLY_MAX is above the title's pipeline count, is never trimmed, so every pipeline drawn with in any earlier run is started at creation at every load and its host PSO stays alive for the session. Each line now holds key run, and a save keeps only the keys requested in the last 2 runs (LEONIDA_EARLY_RUNS, 0 = every run as before). A process that requests nothing writes the list back unchanged, and old lists without runs still load.

21. RS-XMEM-FREE-DEFAULT: leonida-hle: XMemFreeDefault tells the GPU side of freed 32-bit memory

XMemFreeDefault's 32-bit path (d3d12/crates/leonida-hle/src/modules/xmem.rs) frees with the host VirtualFree directly. XMemAllocDefault's 32-bit path told the GPU side about that memory through XMemVirtualAlloc, but leonida_gpu::title_memory_freed never runs for the free, so the guarded, absent and foreign blocks, views and write-combined regions noted for the range survive and can be taken for true of the next memory at that address. The fix frees through title_virtual_free(address, 0, MEM_RELEASE), the title's own VirtualFree, which tells the GPU side first. A new unit test fails on main (the free never reaches the GPU side) and passes with the fix. No game files.

Test: free_default_tells_the_gpu_side_of_32bit_memory.

22. RS-THIN-UPLOAD-DROP: leonida-gpu: thin lists give back uploads a reset or release leaves behind

with LEONIDA_THIN=1, a title list reset or released while it records clears its words that were not handed over yet in Front::leave (d3d12/crates/leonida-gpu/src/list/thin.rs) without dropping the Box they name, so their 64 KiB upload arena blocks stay taken for good. The fix drops those uploads in leave(). The CPU unit test fails on main (the upload is never given back) and passes with the fix. No game files.

Test: uploads_of_words_never_handed_over_are_given_back.

23. RS-APU-SCRATCH: leonida-hle: XApu decodes each packet into memory the connection keeps

XApu's process() (d3d12/crates/leonida-hle/src/modules/apu.rs) allocates and zeroes a 46 KB Vec for every Opus packet, about 50 a second per playing stream, under the connection lock. The fix keeps one buffer in the connection's State. A unit test with a test-only counting allocator fails on main (10 large allocations for 10 packets) and passes with the fix (0). Processor time, not footprint. No game files.

Test: packets_decode_without_memory_of_their_own.

24. RS-REPLACED-DRAIN: leonida-gpu: replaced host copies go with LEONIDA_TEXTURE_SWEEP=0 too

with LEONIDA_TEXTURE_SWEEP=0, let_go_idle (d3d12/crates/leonida-gpu/src/resource.rs) returns before it drains REPLACED, so every host copy want_level replaces by one with more levels stays on the card for good although nothing can use it. The fix moves the drain above the switch; idle copies are still kept with the sweep off. The test runs a child process with the sweep off and checks that a replaced copy goes after four frames and a second: it fails on main and passes with the fix. No game files.

Test: replaced_copies_go_with_the_sweep_off.

Tested (leaks/all with the eleven merged; one conflict in shadow.rs, where two fixes add their call to the same
sweep, both kept; each fix's test is named in its details above):

  • cargo test --locked --offline -p leonida-hle --lib: 186 passed, 0 failed.
  • cargo test --locked --offline -p leonida-gpu --lib -- --test-threads=4: 493 passed, 4 failed, 46 ignored. The four
    (views_off_their_elements_get_a_copy_of_their_bytes, batch_tables, host_list_budget_starts_empty_at_each_submission,
    warp_batch_charges_every_execution) fail the same way on plain main on this machine (RX 7900 XT, AMD 32.0.32029.2010).
  • Each fix's test was first run on main d44285197 without the fix and failed there (the commit messages say how).
  • The C++ runtime of this head, rebuilt and run whole: 521 of 524 ctest pass at 9fc3ad427 (see the section above).
  • Recomputed by a second agent session on the same machine at 9fc3ad427: the same results (leonida-gpu --lib 493 passed with the same 4 failures; leonida-hle 186 passed). Plain main 33db04a70: leonida-gpu --lib 479 passed with the same 4 failures, leonida-hle 181 passed.

Four more fixes

From a fourth pass, three in the Rust runtime and one in the C++ runtime, claimed in #2570
(#2570 (comment)). Same rules as above: each is its own merge with
its own test that fails on main and passes here, and it still exists on its own branch, adrianmjim/leonida:leaks/<name>.
None of them has a switch.

# Item Change
27 RS-ARENA-ONE-COPY leonida-gpu: an arena of memory by address is in the PC's memory once
28 RS-SHADER-CONTAINER-FREE leonida-gpu: a translated shader lets its container go
29 RS-DSTORAGE-SCRATCH leonida-hle: DirectStorage workers reuse their request buffers
30 RT-DEVICE-LOST-DRAIN vulkan: after a device loss, released objects are destroyed at once
27. RS-ARENA-ONE-COPY: leonida-gpu: an arena of memory by address is in the PC's memory once

memory.rs held each 64 MiB arena twice in the PC's memory, as the arena itself (upload::reserve) and as the CPU side of its copy on the card (shadow::by_address) with the same bytes; with LEONIDA_BVH_BUILDER=1 that is up to 48 arenas, about 3 GiB. Memory::another() now makes the copy with shadow::by_address_opened, which opens the arena as a host heap so the arena itself is the CPU side, and bring()/take() resend exactly the changed dword runs; if the host does not open the memory, the copy is made as before. There is no switch, and a dword changed and changed back within one send window now goes up over what the builder stored there.

28. RS-SHADER-CONTAINER-FREE: leonida-gpu: a translated shader lets its container go

d3d12/crates/leonida-gpu/src/pipeline.rs kept every distinct shader container in the static SHADERS table (container: bytes.to_vec()) for the whole process, although after translation only small derived facts are read from it. Those facts are now kept in Translated and a new Facts, and after a successful translation Shader::translated lets the container go, except for a shader that stores while LEONIDA_PICKED_WRITES is on, until crate::picked has read its programs. Shaders that never translate or fail to translate keep their container, and nothing the title can see changes, so there is no switch.

29. RS-DSTORAGE-SCRATCH: leonida-hle: DirectStorage workers reuse their request buffers

d3d12/crates/leonida-hle/src/modules/dstorage.rs allocated new zero-filled buffers (read_source, the zlib output, into_pages) for every compressed request and freed them at its end, and staging_bytes counted only the compressed source, so the other buffers were outside LEONIDA_DSTORAGE_STAGING_MB. Each worker now keeps a Scratch it reuses, holding at most 16 MiB (SCRATCH_KEPT) between requests, and staging_bytes counts every buffer a request holds. What workers keep between requests is outside the staging limit, and the bytes written to destinations are the same as before.

30. RT-DEVICE-LOST-DRAIN: vulkan: after a device loss, released objects are destroyed at once

After a device loss, nothing drained the Vulkan layer's deferred deletion queue (runtime/src/vulkan_backend.h) until the context was destroyed, so every image, buffer, VkDeviceMemory, framebuffer and image-memory range the title released after the loss stayed allocated for the rest of the process. On a lost device VulkanContext::defer_destroy now destroys the object at once, and the first such call also destroys what was queued before (DeferredDeletionQueue::drain_lost); bindless slots and image views still wait until teardown. There is no switch, and completed_retire_ticket() deliberately still answers 0 after the loss, so the other ticket-gated frees still stop there.

Tested at eb145de6f (all 30 fixes, with main d48a957bb merged):

  • The four merged without a conflict, but the leonida-hle tests no longer built: RS-APU-SCRATCH and RS-DSTORAGE-SCRATCH each installed a counting #[global_allocator] in their tests, and a binary has one. The merge fix eb145de6f moves it to leonida-hle/src/test_alloc.rs, which tells both counters of each block. Test code only.
  • New tests, each first run on main without its fix, where it fails (the commit messages say how): memory::tests::an_arena_is_in_the_pcs_memory_once, pipeline::tests::translated_shaders_let_their_containers_go, modules::dstorage::tests::{compressed_requests_reuse_the_workers_buffers, staging_counts_every_buffer_a_request_holds} and vk_deferred_destroy_lost (ctest). All pass here, and vk_deferred_destroy_lost also passes under LEONIDA_VK_VALIDATION=1.
  • cargo test --workspace --no-fail-fast in d3d12/: leonida-gpu 496 passed with the same 4 failures as main, leonida-hle 189 passed. The other failures are the three described under "Latest main merge" below, in code that is the same as on main.
  • Full ctest, -j 8: 3 of 526 fail, the same three as on main (d3d12_texture_tiles, pipeline_cache_seed, d3d12_clear).
  • python -I scripts/check_no_game_data.py passes on every file these four change. The game was not run with them.

One more runtime fix

From a fifth pass, claimed in #2570 (#2570 (comment)). Same rules as above: its own merge, its own test that fails on main and
passes here, and its own branch, adrianmjim/leonida:leaks/session-cache-unchanged.

# Item Change
31 RT-SESSION-CACHE-UNCHANGED d3d12: a session file written beside the offline seed is loaded alone
31. RT-SESSION-CACHE-UNCHANGED: d3d12: a session file written beside the offline seed is loaded alone

With the offline seed loaded, pipeline_cache.session.bin is the driver's union of the seed and what sessions added (on the
RX 7900 XT a 1.88 GB seed and a 1.88–1.89 GB session file). Every launch still created a driver cache from the seed, then a
second one from the session file, and merged them. In the in-game sessions below, the mem probe's vmmap line shows private
commit going from 8.1 to 9.95 GB and back to 8.3 GB between 10 and 20 s. Now, whenever the session file is written beside this
device's seed, a small record pipeline_cache.session.seed (written after it, through the same temp-file + MoveFileEx
helper) notes the seed's size and last-write time and the session file's size. On the next launch, when the record matches the
current seed and session file and the session file's header fits the device, the cache is created from the session file alone:
pipeline_cache.bin is only stat'ed and nothing is merged. Everything else takes today's path: no record, a changed seed, a
session file of another size, a driver that declines the blob, LEONIDA_SESSION_CACHE_DIRECT_SEED=0 or
LEONIDA_DIRECT_SESSION_CACHE=0. A write-back smaller than what the cache was created from drops the record, so the next launch
merges the seed again. Nothing is deleted except a stale record. The ~1.9 GB write at exit is unchanged on purpose. Documented
in docs/d3d12_vulkan.md.

Tested at 652f45345 (all 31 fixes; merging this fix's branch also brings in main 9c49bd533, 63 commits after d48a957bb, with no conflict):

  • New ctest d3d12_session_cache_seed (d3d12_compile_teardown_test --seed, a real device and a seed that holds a real pipeline; its rounds cover the relaunch, a touched seed, LEONIDA_PIPELINE_CACHE_BYTES=0, the switch at 0, no seed, and a seed with a session file but no record) and new unit checks in pipeline_cache_store (the record's format and every truncation, a changed seed or session file, the shrink rule). With main's device code the relaunch fails: 1 merge(s), caches created from [3652, 7252] bytes. With the fix: 0 merge(s), caches created from [7252] bytes, 2 of 2 compute build(s) a cache hit.
  • That test and its neighbours (pipeline_cache_store, heavy_pipeline_cache, d3d12_compute_journal, d3d12_pipeline_checkpoint, d3d12_compile_teardown*, plus mem_probe_vmmap) under LEONIDA_VK_VALIDATION=1: 8/8.
  • Full ctest, -j 8: of 527, the same three as on main fail (d3d12_texture_tiles, pipeline_cache_seed, d3d12_clear), plus the presentation tests (vk_present*, dxgi_*, d3d12_present, xbox_present), because the monitor was off during the run; they pass with it on, as in the runs above. gta6rt_no_tls_callbacks failed once because an incremental link left an old gta6rt.map; after a full relink it passes.
  • cargo test --workspace --no-fail-fast in d3d12/ and the 555 standalone tests/test_*.py: the same results as at eb145de6f (this fix touches neither). python -I scripts/check_no_game_data.py passes on every changed file.
  • In the game: PROVISIONAL (n=1 on the new path). gta6rt from this fix's branch (a580819a5, on main 9c49bd533), a fresh copy of the port with the 1.88 GB seed and a 1.88 GB session file, the same harness as the sessions below. The first launch took the old path (loaded 1883920688 bytes from pipeline_cache.bin, then merged 1884044916 bytes from pipeline_cache.session.bin) and its checkpoint wrote the record. The second took the new one (loaded 1884044916 bytes from pipeline_cache.session.bin, which holds the 1883920688-byte pipeline_cache.bin it was written beside; the seed was not loaded and nothing merged) and booted and ran normally. MEASURED with an outside sample every ~11 s over the first 120 s: peak working set minus working set reached 2,685–3,272 MiB in all 5 launches on the old path (both sessions below and three today), with a peak working set of 9,456–9,490 MiB; on the new path, 307 MiB and 8,398 MiB. Private commit at launch was not measured on this build (it has no vmmap line), and the 11 s samples of private bytes are too coarse to show a transient of a few seconds on either path.

652f45345 also answers a review: under Wine the process's commit charge does not count what it commits, so mem_probe_vmmap checks it on Windows only, like the private working set next to it.

And one more

From a sixth pass, claimed in #2570 (#2570 (comment)), with its own merge, its own test that fails on main and passes here, and its
own branch, adrianmjim/leonida:leaks/shared-pipeline-layouts.

# Item Change
32 RT-SHARED-PIPELINE-LAYOUTS d3d12: PSOs share one pipeline layout per shape, destroyed at device teardown
32. RT-SHARED-PIPELINE-LAYOUTS: d3d12: PSOs share one pipeline layout per shape, destroyed at device teardown

Every PSO made its own VkPipelineLayout (PipelineState::create_graphics / create_compute) and destroyed it with the PSO,
although the create info only differs by push-constant stages and whether set 0 is the bindless layout, so a session's ~50k PSOs
held ~50k identical layouts. MEASURED standalone on the RX 7900 XT (driver 26.11.2) with the runtime's bindless set layout:
~2.3 KB of process memory per layout with the bindless set (the driver copies the 29-binding set layout into each), ~0.2 KB
without; ASSUMED from that, ~117 MB for 54k PSOs (not measured in the game). Now DeviceState::pipeline_layout keeps one layout
per distinct create info: the key is the whole create info (flags, every set layout handle in order, every push range), and a
pNext chain is refused rather than shared. Layouts are made on first use under a mutex, with the map slot reserved first. PSOs
no longer destroy them; ~Device does, once, after the compiler cancel, vkDeviceWaitIdle, the drained deferred deletions and
the stopped pipeline workers, and before the bindless set layout and the VkDevice. The mem probe's device line adds
PSO pipeline layouts N.

Tested at 20ca6dcf5 (all 32 fixes, main 8b318bd40 merged; this fix's base d57b78a9c is already in it):

  • New ctests d3d12_shared_pipeline_layouts and _eager (LEONIDA_LAZY_PIPELINES=0, LEONIDA_LAZY_COMPUTE=0): 256 PSOs of 4 shapes (graphics and compute, each with and without set 0) made on 4 threads to race the first creation, a dispatch that pushes constants and binds sets with a shared layout, and a second device; they count creates and destroys through the hooked vkGetDeviceProcAddr. With main's device code they fail: 256 PSOs of 4 shapes made 256 pipeline layout(s). Here: 4 made and 4 destroyed per device, 0 live, 0 bad destroys.
  • These and their neighbours (pipeline_workers, d3d12_pipeline_workers*, d3d12_compute, d3d12_draw, d3d12_set0_compute, d3d12_mesh*, d3d12_compile_teardown*, vulkan_mesh_limits): 15/15. Under LEONIDA_VK_VALIDATION=1, the new two, d3d12_pipeline_workers* and d3d12_compute: 8/8, no VUID line.
  • Full ctest, -j 8: of 529, the same three as on main fail, and d3d12_mesh_heavy_cache failed once: it and d3d12_mesh run the same program, which rewrites the same %TEMP%\leonida_mesh_test\index.json, and its log reads cannot open ...\leonida_mesh_test\index.json (READ IN CODE: runtime/test/d3d12_mesh_test.cpp:128, unchanged here). It passes alone and with d3d12_mesh beside it, 13 of 13 runs.
  • Not measured in the game.

And one more in d3d12/

From a seventh pass, claimed in #2570 (#2570 (comment)), with its own merge, its own test that fails on main and passes here, and its
own branch, adrianmjim/leonida:leaks/rs-host-list-scratch-trim.

# Item Change
33 RS-HOST-LIST-SCRATCH-TRIM leonida-gpu: an idle host list lets go of an indirect scratch buffer past 1 MiB
33. RS-HOST-LIST-SCRATCH-TRIM: leonida-gpu: an idle host list lets go of an indirect scratch buffer past 1 MiB

HostList::indirect_scratch (d3d12/crates/leonida-gpu/src/host.rs) only grows its device-local buffer of clamped indirect
arguments, doubling it. list::recycle reset a host list and put it in the idle pool with that buffer still attached, and the pool
hands its lists to any title list, so one large ExecuteIndirect kept its buffer in the card's memory for the rest of the run, in
every idle list that had served one (up to 512). recycle now calls HostList::idle_trim right after the reset: a scratch larger
than 1 MiB (IDLE_INDIRECT_MOST) is taken out and handed to retire_resource, which drops it once the submissions still running
have finished. Smaller ones stay, so ordinary frames keep reusing theirs, and title-list resets are unchanged. The frame-rate line
counts what idle lists let go. It works with the Pool described under the latest main merge.

Tested at ca5aed779 (all 33 fixes, main 8b318bd40; this fix's base is the same main):

  • New test list::tests::an_idle_list_lets_go_of_a_large_indirect_scratch: grows a list's scratch to 2 MiB, recycles the list, takes it back from the pool and checks that the next request gets a fresh 64 KiB buffer, then that a 1 MiB buffer survives the same trip. On main it fails (the large buffer was let go: left 2097152, right 65536); here it passes, with list::tests 10/10.
  • cargo test --workspace --no-fail-fast in d3d12/: leonida-gpu 524 passed and leonida-hle 214 passed; the failures are the same 4 in leonida-gpu, 2 in leonida-shader and 1 in xtask as on main. runtime/ is unchanged by this fix. python -I scripts/check_no_game_data.py passes on both changed files. Not run in the game (the Rust runtime is not gta6rt).

Three more

From the same seventh pass, claimed in #2570 (#2570 (comment)): one in d3d12/, two in runtime/. Each has its own merge, its own
test that fails on main and passes here, and its own branch on the fork (leaks/rs-pipeline-library-fingerprint,
leaks/zero-images-release, leaks/dstorage-cpp-scratch).

# Item Change
34 RS-PIPELINE-LIBRARY-FINGERPRINT leonida-gpu: the host pipeline library is kept for one set of translated shaders
35 RT-ZERO-IMAGES-RELEASE d3d12: a shared zero image no placed texture shows any more is released
36 RT-DSTORAGE-CPP-SCRATCH dstorage: queue workers reuse their staging buffers
34. RS-PIPELINE-LIBRARY-FINGERPRINT: leonida-gpu: the host pipeline library is kept for one set of translated shaders

d3d12/crates/leonida-gpu/src/pipeline/library.rs opened host-pipelines.bin whatever translation its pipelines came from and saved it back whole, so entries of older translator generations, which can never load again, stayed and the file only grew (the library's own line reads 1,490 MB in memory in run 65). The fingerprint leonida warm already uses (known::fingerprint()) is now written beside it as host-pipelines.fingerprint; a missing or different one gives an empty library, and that run's first save writes over the old generation. A save that is cut short leaves no fingerprint, never a stale library under the current one. One SAVING mutex now covers a whole save: overlapping saves shared host-pipelines.tmp on main too, and with the fingerprint that could leave a half-written library under a valid one.

35. RT-ZERO-IMAGES-RELEASE: d3d12: a shared zero image no placed texture shows any more is released

Placed BC textures with no memory of their own yet show a shared all-zero image of their shape (DeviceState::zero_sampled_image), on a CUSTOM WRITE_BACK / L0 heap (host memory on a discrete GPU) under a 256 MiB cap, and those images were only released at device teardown, so a session streaming many shapes filled the cap for good. The device now counts each image's users (acquire_zero_image); when the last one is destroyed or gets memory of its own, the image leaves the map and the cap, and its Resource is released through the deferred-deletion queue. With several queues, a return carries the execute epoch and is released only once no replay in progress at it is left. Shapes left out for not fitting get another try (the comment RT-ZERO-IMAGES-RETRY left in zero_sampled_image is corrected in 962bc1601).

36. RT-DSTORAGE-CPP-SCRATCH: dstorage: queue workers reuse their staging buffers

Each compressed, swizzled or physical-page DirectStorage request in runtime/shims/dstorage.cpp allocated a new zero-filled buffer at every stage and freed it at the end, the C++ side of RS-DSTORAGE-SCRATCH. Each queue worker now keeps two sets of buffers (its own request's and its paired helper's), grown only when a request needs more, keeps at most 16 MiB between requests (the budget can_prepare already used), and no longer zero-fills bytes that are always written before they are read or the request fails and publishes nothing.

Tested at 962bc1601 (all 36 fixes, main 8b318bd40; the three branches' base is the same main):

  • New tests, each failing on main and passing here: pipeline::library::tests::{a_library_saved_for_other_shaders_is_not_opened, overlapping_saves_leave_one_whole_library_and_its_lists} (main: no fingerprint written; the second fails 3 of 3 with the lock made a no-op), ctest d3d12_zero_image_release (12 shapes placed and released, with a second queue running during the copy's replay; main: 12 images and 47,104 bytes still held; here 0 and 0) and, in dstorage, test_reused_buffers (100 requests of two streams, outputs compared byte for byte: 300 blocks of 128 KiB or more on main, 6 here), test_kept_buffers_cap and test_kept_buffers_pair_cap.
  • dstorage, d3d12_zero_image_retry and d3d12_zero_image_release: 3/3; the two zero-image tests under LEONIDA_VK_VALIDATION=1: 2/2, no VUID line.
  • Full ctest, -j 8: 3 of 530 fail, the same three as on main. cargo test --workspace --no-fail-fast: leonida-gpu 528 passed (pipeline::library 15/15) and leonida-hle 214, with the same failures as on main. python -I scripts/check_no_game_data.py passes on every changed file. Not run in the game.

Tested

On Windows 11 Pro 26300, MSVC 14.44, Ninja, RelWithDebInfo and Vulkan SDK 1.4.363.0, with an RX 7900 XT and 32 GB of RAM, while another gta6rt was running on the same GPU.

Latest main merge: leaks/all at 5fe777296, all 31 fixes then in this branch with main 8b318bd40 merged in (154 commits since 7daa4a4a5). One conflict, in d3d12/crates/leonida-gpu/src/list.rs: main's 7efbbdd39 (LEONIDA_ALLOCATOR_TRIM=1, off by default: idle host lists older than the limit are let go) and RS-HOST-LIST-ALLOCATOR-PEAK (the idle pool as a Pool, its untouched lists halved once a second) both changed the idle host-list pool. The Pool stays; an idle list keeps when it was put by, and with LEONIDA_ALLOCATOR_TRIM its stale oldest are taken out of the Pool (new Pool::take_oldest, with a unit test) and counted in ALLOCATOR_TRIMS[2] as on main, under the same condition. MEASURED on the same machine:

  • Build: gta6rt and every test target, after a full relink.
  • ctest, whole suite, -j 8: 3 of 527 fail, the same three as on main. pso_stream, xs_proxy_mock*, pipeline_cache_store, d3d12_session_cache_seed and mem_probe_vmmap under LEONIDA_VK_VALIDATION=1: 14/14.
  • cargo test --workspace --no-fail-fast in d3d12/: leonida-gpu 523 passed (with list::tests 9/9) and leonida-hle 214 passed; the failures are the same 4 in leonida-gpu, 2 in leonida-shader and 1 in xtask described further down, all on main too.
  • Python: of 585 standalone tests/test_*.py, the same 10 fail as at the merges before (listed below); tests/, tools/ and scripts/ are as on main.

Earlier main merges, each MEASURED the same way with no failure that is not also on main: d51ad23b7 (main 7daa4a4a5; one conflict in runtime/test/pso_stream_test.cpp, where #2476's test_later_subobject_versions and RT-PSO-BYTECODE-INTERN's three tests are all kept) and abdb93f0e (main d48a957bb, no conflict). The failures on main that show in every run: leonida-shader emit::valu_tests::{typed_d16_table_uav_roundtrip_uint_sint_and_float, rdna_forms_give_what_the_spelled_out_ones_give} and xtask policy::tests::repository_passes_policy (lower.rs over the size limit), both in code these fixes do not touch, and 10 standalone Python tests (tests/, tools/ and scripts/ are as on main): test_bc_feature_validation, test_bcpack_history_calib, test_build_runtime_fallback, test_make_game_pipelines, test_make_game_preflight, test_progress_dashboard, test_sampler_source_census, test_spirv_metal_set0_cli_errors, test_spirv_metal_set0_extra, test_tool_stdout_encoding.

leaks/all at 098342d02: the 13 fixes, with main 33db04a70 merged in. One conflict came from #958, which made release_child_reference the single path that drops a child proxy's last reference (the queue and fence pins use it too). The allocator's upload memory is now given back in that function, by the proxy's kind, so every path that drops an allocator's last reference frees it. The mock in xs_proxy_mock_test.cpp keeps the fields from both sides.

# Item Its test (ctest)
1 RT-UPLOAD-ARENA-REWIND xs_proxy_mock (check_upload_rewind), new xs_proxy_mock_upload_rewind_off
2 RT-PSO-BYTECODE-INTERN pso_stream
3 RT-SPARE-LIST-EPOCHS new xbox_list_cut_spares, command_list
4 RT-SLOT-RECORDS-BUCKETS console_heap_slot_records
5 RT-REHYDRATE-SCRATCH-TICKET xbox_bvh_builder, xbox_bvh_builder_check
6 RT-FSSM-ARENA-SHARE new d3d12_code_base_share, d3d12_code_base_per_pso
7 RT-TITLE-BUFFER-FALLBACK new d3d12_title_buffer_fallback
8 RT-SLOT70-DEVICE-CYCLE d3d12_existing_heap under LEONIDA_VK_VALIDATION=1
9 RT-MEM-PROBE-WINDOWS new mem_probe_vmmap
10 RT-ZERO-IMAGES-RETRY new d3d12_zero_image_retry
11 RT-TITLE-TEXTURE-GONE-RANGES d3d12_existing_heap (check_mapped_plane_gone_in_registry)
12 RT-SHADOW-GPU-RELEASED-RANGES new d3d12_shadow_gpu_releases, d3d12_console_heap_gpu_releases
13 RT-SLOT70-OWNED-RETIRE new d3d12_title_image_retire, d3d12_title_image_idle, xmem
  • Before the fixes. Each fix's test was first run on main d44285197 without that fix, and failed there (the commit messages say how). Between d44285197 and 33db04a70, main changed these files for the stub pipelines (bbc750655, 78159b886), which do not touch the paths these fixes change, and for d3d12_xs: retain queue and fence wrappers through forwarded calls #958, merged as described above.
  • These tests and the ones next to them, 41 in all (xs_proxy_mock*, pso_stream, command_list, xbox_list_cut_spares, console_heap_slot_records, xbox_bvh_builder*, d3d12_code_base_*, d3d12_title_buffer_fallback, d3d12_existing_heap*, mem_probe_vmmap, memory_breakdown, d3d12_zero_image_retry, d3d12_*_gpu_releases, d3d12_title_image_*, xmem*, allocator_proxy, device_proxy, title_texture_refresh, d3d12_title_va, d3d12_compute, d3d12_draw), with -j 4: 41/41 passed.
  • Under LEONIDA_VK_VALIDATION=1. d3d12_existing_heap, d3d12_title_image_retire, d3d12_title_image_idle, d3d12_zero_image_retry, d3d12_title_buffer_fallback, d3d12_shadow_gpu_releases, d3d12_code_base_share, allocator_proxy and xs_proxy_mock passed 9/9. There were no validation errors and no VUID-vkDestroyDevice-device-05137. On main, d3d12_existing_heap leaves 93 objects at vkDestroyDevice.
  • Full suite, with -j 4, run twice (before and after merging 33db04a70): 519/523 both times. Three tests failed both times, and they also fail on plain main on this machine; none of these fixes touches them:
  • Builds. gta6rt and every test target build and link.
  • Python checks. python -I scripts/check_no_game_data.py passes on every changed file, and python -m compileall -q make_game.py tools tests is clean. Of the 534 standalone tests/test_*.py, 7 fail, the same 7 with the same output as on main 33db04a70 (test_docs_cli_flags, test_docs_env_vars, test_docs_python_deps, test_docs_repo_paths, test_make_game_preflight, test_progress_dashboard, test_tool_stdout_encoding). test_docs_env_vars fails only on LEONIDA_CLWB_PATCH, which is not from this branch; the new switches are all documented.

In the game: PROVISIONAL (n=1 per arm). Two sessions of 720 s each, both stopped by the harness at the end: main d48a957bb alone, and this branch at 32d2020f7 (all 30 fixes; its runtime/ is the same as at eb145de6f, which only adds the test-only leonida-hle merge fix). Same build type, the same first-run-UI input, each started from the same copy of the pipeline caches, LEONIDA_TITLE_WATCHDOG=0 with its kick, LEONIDA_MEM_PROBE=10, and an outside sample of the process every ~11 s. Resizable BAR off. The character stands still in the world from about 420 s.

  • MEASURED (n=1): no regression. Both ran the full time with no fault and no device loss (PresentX 8,940 with main, 9,218 with the fixes, none failed).
  • MEASURED (n=1): private bytes at 424 s were 20,755 MiB with main and 20,786 MiB with the fixes, and at the end (714 s) 20,965 and 21,010 MiB. Slope from 450 to 720 s: +41.5 and +47.8 MiB/min. Dedicated video memory, flat from about 420 s: 8,544 and 8,659 MiB. The runtime's Vulkan allocations (mem probe), flat from 360 to 700 s: 8,405 and 8,494 MiB. With one run per arm and no prediction written beforehand, these are observations: there is no measurable difference in 12 minutes.
  • MEASURED in both arms: the growth in the world follows the graphics pipelines being built, about 19 a minute (+94 with main, +91 with the fixes, after 420 s). MEASURED standalone (a separate Vulkan program, no code from this repository, on the same GPU and driver, 22 real vertex + pixel shader pairs from the translated library with the runtime's bindless set layout and dynamic states): each first compile leaves the driver holding a median 2.4 MiB of private memory (0.4–19 MiB) after its shader modules are destroyed; vkDestroyPipeline gives none of it back, destroying all 22 gives back about 0.3 MiB each, and compiling and destroying at once still adds 2.4–3.9 MiB a compile. A pipeline made again from the pipeline cache costs 23–47 KiB and 0.1–0.4 ms. About 19 new pipelines a minute at ~2.4 MiB each is the ~45 MiB/min seen in both sessions (an inference from the two measurements, not measured inside the game). So this growth is the driver's, per compile, and not from these fixes; only compiling less (a pipeline already in the seed or the heavy cache) reduces it, and destroying cold pipelines would give back little.
  • READ IN CODE and MEASURED: these sessions do not exercise what most of the fixes target. The 14 Rust fixes are in d3d12/ and do not run in gta6rt. AllocateUploadMemory (list slot 148) was never called in either session (the runtime logs every list slot's first call), so RT-UPLOAD-ARENA-REWIND was not exercised, and an idle character does not churn PSOs or retire title windows.
  • An earlier pair of ~7 minute boots (main d44285197 against the first 13 fixes, without the watchdog variables) ended at the title's hang watchdog at about 400 s in both, also with no regression.

GPUs tested: AMD Radeon RX 7900 XT, 20 GB, desktop (profile M), AMD Software 26.11.2 (D3D12 driver 32.0.32029.2010, Vulkan driver 2.0.416), Windows 11 Pro 26300, 32 GB RAM

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request. (Thirty-six leak fixes from one sweep, twenty in runtime/ and sixteen in d3d12/, together only because of the open pull request limit. Each one is its own merge here and its own branch on the fork.)
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

…a released device goes (RT-SLOT70-DEVICE-CYCLE)

make_title_texture made its image with create_committed, which attaches the device; the registry
(state_.title_textures) holds the image, and a retired image waits in retired_title_textures_ for
a refresh pass 3 s later, which only runs before a submission. A device released while such an
image existed was never destroyed and kept every Vulkan object it had: d3d12_existing_heap's
device without host image copies left 93 at vkDestroyDevice (VUID-vkDestroyDevice-device-05137).

The image now drops its device reference right after it is made, as the registry's reference
keeps it alive, and ~Device releases the registry's and the retired images after the GPU is idle
(release_title_images), before the deferred deletions are drained.

d3d12_existing_heap checks that the last Release of each device returns 0 and fails on
validation errors counted after vkDestroyDevice.
…SO-BYTECODE-INTERN)

PsoStreamRecord::capture copied the bytecode of every stage into the
record's own blobs, so each slot 86 PSO kept a private copy of every
container it was made from, and a slot 55 PSO kept another one when
keep_pso_stream captured its stream again. The title makes some 50 000
slot 86 calls in its first boot from about 26 500 shaders
(docs/embedded_shaders.md), and the carved containers average 9.6 KB
on this machine, so most of them were kept many times over: an
estimated 0.65 to 1.0 GB of private bytes. Both compile modes copied:
keep_pso_stream by default, prepare_console_stream with
LEONIDA_PIPELINE_COMPILE=on-demand.

copy_pointed_data now takes the bytecode from a process-wide table
keyed by the size and the DXBC checksum (bytes 4..19, as key_shader
uses; FNV-1a over the bytes for a container without one). A candidate
is only taken when all of its bytes are equal, since hand-built
containers can share a checksum. The record holds a shared reference in
payloads_->shaders and its stream points at the shared bytes, which are
never written. The table holds weak references, swept every 1024 new
entries, so a container is freed with the last PSO that uses it; the
copy is made outside the table's lock and looked up again before it is
added. The stream bytes, the bytecode every consumer reads and the
containers a caller passes in (shared_native_graphics) are unchanged.

pso_stream_test: two streams with equal bytecode in different buffers,
10000 streams of one VS/PS pair, and records made and freed on 8
threads share one copy per container; bytecode with an equal checksum
but other bytes, and checksum-less bytecode that differs in one byte,
are not merged. On d442851 5 of its 41 checks fail and the 10000
records grow private bytes by 202.9 MiB; with this change all pass and
they grow by 3.0 MiB.
…UPLOAD-ARENA-REWIND)

The arena behind console list slot 148 (AllocateUploadMemory) only
advanced: upload_alloc moved chunk->used forward and made a new 8 MiB
UPLOAD buffer whenever nothing fitted, and the only release was
destroy_upload_state when the device went. A title that uploads every
frame (the XDXR builder asks count * 40 bytes per build) grew it by one
buffer each time the newest was full, in VRAM with Resizable BAR and in
host memory without, for as long as it ran.

Each allocator now has its own chunks, keyed by the real allocator the
list records into (ListProxy::allocator). The allocator proxy's Reset
(slot 8), which D3D12 allows only once the GPU has finished the lists
recorded into it, starts them from the front again when the real Reset
succeeds; a chunk that served nothing for 8 of these in a row is given
back, and the allocator proxy's release frees its chunks. A list's own
Reset gives nothing back, and one allocator's Reset leaves another's
memory alone. A freed chunk leaves the title VA table too under
LEONIDA_UPLOAD_ALIAS=1, as at the device's release, and the upload log
names it. upload_translate finds the chunk through a map ordered by CPU
base instead of walking every chunk.

LEONIDA_UPLOAD_REWIND=0 keeps the one arena all lists share, which only
grows, as before (runtime/README.md). An allocator the device hands out
unwrapped (a PC runtime's) never reaches the proxy's Reset, so its
chunks still only advance until the device goes.

xs_proxy_mock_test check_upload_rewind: 200 frames of {list Reset, 1 MiB,
Close, allocator Reset} on one allocator made 25 chunks and moved the
pointer 199 times before; now one chunk and the same pointer. Two
allocators, a failed allocator Reset, a list moved to another allocator,
an idle chunk given back and an allocator's release are covered too;
--upload-rewind-off (new ctest) checks the switch.
…nsole heap pass (RT-SHADOW-GPU-RELEASED-RANGES)

With LEONIDA_SHADOW_GPU=1 and LEONIDA_CONSOLE_HEAP_GPU unset, setup_console_heap_gpu makes heap_gpu for the
shadows' page copies and turns the alias table's removal list on, but only the pass takes released_ranges and that
list (console_heap_gpu_begin), and the pass runs only with LEONIDA_CONSOLE_HEAP_GPU=1. Every arena release (the
per-submission geometry upload leases among them), title block destroyed, slot-133 import released and alias range
removed added an entry nothing took, for as long as the process ran.

The pushes in backing() and title_block_gone now ask heap_pass_enabled() (heap_gpu and LEONIDA_CONSOLE_HEAP_GPU=1),
and the alias table records removals only when the pass runs.

arena_release called backing() twice for a release since 9f98dcc. The second call erased nothing more: it only
repeated the slot change, the generation bump and the released range. It is gone, so a release is one range for
the pass and one slot change.

A device that owns its VkDevice (create_vulkan_device_standalone) faulted when released with either variable set:
the pass's pipeline and buffers went in ~DeviceState, after the VkDevice. ~Device now clears the context's prelude
and releases them first.

Test: d3d12_shadow_gpu_releases (new). LEONIDA_SHADOW_GPU=1 alone: 1,024 committed and 16 slot-133 buffers
released over 16 submissions leave nothing waiting (2,064 released ranges and 16 removed alias ranges on
d442851). With --console-heap-gpu, 64 releases are 64 ranges (128 before), all taken by the next submission. The
accessors are console_heap_gpu_pending (d3d12_com.h) and TitleVaAliases::removals_pending.
…etired title window (RT-SPARE-LIST-EPOCHS)

Since ProjectLeonida#2465 a retired title window is freed only once every command list
whose recording began before the retirement is gone (src/
command_list_epochs.h). The list proxy's spare real lists never were:
restart_recording moves the cut parts and the last real list into the
spares closed and not reset, and cut_list reuses the newest spare first.
After a recording cut twice or more, later recordings that cut at most
once reset only the newest spare, so the others kept their last
recording's stamp until the list proxy was released, and every title
window retired after it kept its memory as long. The idle spares also
kept their commands and the pipeline states, root signatures and BVH
scratch those held.

A spare is not executed again before a cut resets it: a submission names
only the proxy's parts and current list, and the title's Reset ended the
recording they made. restart_recording now drops a spare's recording
through rt::d3d12::drop_recording: the layer list clears its commands,
releases what it held and resets its state, as Reset does, and stays
closed with no epoch stamp (CommandList::drop_recording, Stamp::drop). A
copy a held batch made earlier keeps its own stamp.

A retired window still without a ticket 30 s after its retirement is
logged once, with what it waits for, and the title memory report at
device release counts the retired windows not freed yet and how many
command-list epochs ago the oldest live list began.

Tests: xbox_list_cut_spares (new; a Vulkan device and the queue and list
proxies, no game data) records a list with three cuts, advances the epoch
as a retirement does, then records it eight times with at most one cut.
On d442851 the oldest live recording stays at epoch 1 with the
retirement at 2, and the root signature the first recording set keeps 3
references; with the change the oldest is 2 and the references 1.
command_list checks CommandList::drop_recording and copies of a dropped
list.
… refresh's indexes too (RT-TITLE-TEXTURE-GONE-RANGES)

A slot-133 texture destroyed while its thread holds title_texture_mutex (a slot-70 view overwrote the descriptor
that held its last reference, 5f549cf) only stops naming its resource, and drain_titles_gone erases the registry
entry once the lock is free. With LEONIDA_TEXTURE_REFRESH_ASYNC=1 the entry is also in texture_ranges
(index_texture) and, once mapped, in mapped_title_textures, and drain_titles_gone left both. The next refresh pass
that saw a title write or a map change over the texture's memory looked the key up with title_textures.at(), and
the std::out_of_range ended the process on the refresh worker. The mapped list also kept the TitleTexture alive.

drain_titles_gone now erases the range key with the registry entry, as title_texture_gone does outside the
registry, and the mapped entry when it has no resource (also when a texture made at the address since replaced the
registry entry). The async pass looks a key up with find() and skips one without an entry. The other places an
entry leaves the registry already erase its range key or replace it; a texture made for slot-70 views is never in
the mapped list.

Test: d3d12_mapped_plane_async (d3d12_existing_heap_test --mapped-plane-async) adds
check_mapped_plane_gone_in_registry: a mapped slot-133 plane released under the registry's lock, then a write over
its pages and a pass of the refresh worker. On d442851 the process ends with 0xC0000409 (std::out_of_range from
the at() in refresh_title_textures, on the worker); now the registry is back to 0 entries, 0 range keys and 0
mapped textures. The accessors are title_texture_registry and release_in_title_registry (d3d12_com.h) and
TitleTextureRangeIndex::size.
…s retired once no view names it (RT-SLOT70-OWNED-RETIRE)

The images the layer makes for slot-70 texture views of the title's
memory (owned TitleTextures) were retired only when their own address
got another description or a slot-133 texture. A title that streams
places its textures at ever new addresses of the same memory, so each
address named kept its image (in VRAM, then in host-visible memory),
its bindless index and its turn in every refresh pass for the device's
life.

place_title_view now records when a view last named an image, and the
refresh pass (retire_idle_owned_images) also retires one once a texture
made or registered after that view covers some of its bytes, or once
none of its pages has been committed since a title_memory_map change
over them, in both cases when no view has named it for
LEONIDA_TITLE_IMAGE_IDLE_MS (2000 by default). An image over exactly
the same bytes (the other view of a stream pool) is not covered, one
never filled does not go with its pages, and two textures over the same
bytes that views keep naming both stay. The image is released 3 s
later, as before; a later view makes it again with the same T#, so the
descriptors the title kept find it once it is filled.
LEONIDA_TITLE_IMAGE_RETIRE=0 keeps the images as before. The title
textures census line counts the retirements under a newer texture and
with their pages gone.

d3d12_title_image_retire (d3d12_existing_heap_test --title-image-retire,
with LEONIDA_TITLE_IMAGE_IDLE_MS=0): 16 textures named 4 KiB apart in
one committed MiB leave one image (64 KiB) and one bindless index,
where they left 16 (1024 KiB) and 16; a texture named again after its
image was retired reads its texels and its first T# finds it again;
decommitted pages and a slot-133 texture over its bytes retire the last
image. Tests read the registry through title_images and title_image
(d3d12_com.h).
…-RECORDS-BUCKETS)

The two indexes of src/console_heap_slot_records.h hold each V# half of a
console resource heap under (span class, granule), one unordered_map per
class. A half that moved or was cleared left a stale entry behind, and
nothing erased a bucket: push() cleaned only a bucket that was pushed
again until it held 32 keys, find() skipped stale entries, and only
reset(), at heap creation, emptied the maps. The main resource heap lives
as long as the session, and fix_vsharp records as waiting any non-image
word with w[2] != 0, so data the title keeps in a slot made a new bucket
whenever it changed. The bucket count was every (class, granule) the
session had written, not the live slots: two halves moved 200,001 times
held 600,003 buckets, 60.4 MiB of private bytes (measured with a scratch
program), with nothing recorded.

A bucket now counts the halves it holds. set() works out, per index, the
bucket a half leaves and the one it enters, and the last half to leave a
bucket erases it with its stale entries. The buckets held are at most
twice the halves recorded. Lookups name the same slots: they skipped
those entries already. The heap's slot-record log line gives the bucket
count after the halves recorded.

console_heap_slot_records_test: a new case moves two halves 200,001 times
and expects at most 4 buckets while they live and none once both slots
are cleared (on main: 600,003 both times). Every apply() of the model now
also compares touched() with a walk of every recorded half, and the
random case bounds the buckets by twice the halves recorded after each
round; both checks hold on main too.
…by kind (RT-MEM-PROBE-WINDOWS)

LEONIDA_MEM_PROBE's smaps line reads /proc/<pid>/smaps through Wine's Z: drive. Native Windows has no such entry,
so there the line only said "no /proc entry names gta6rt", and the log had no breakdown of the process's own memory
on the platform most testers run.

Where no /proc entry is found, the probe now prints in its place

  [rt] mem-probe vmmap t=<s> (<ms>, <n> regions): private commit C MiB (peak P), working set W MiB (private V,
  peak Q); committed T MiB by kind: title A (n regions), pe-private B (n regions), pe-image C (n regions),
  pe-section D (n regions), vk-mapped E (n regions); reserved R MiB; largest private allocations MiB: 0x... N, ...

The counters come from GetProcessMemoryInfo with the PROCESS_MEMORY_COUNTERS_EX2 size (the private working set,
Windows 10 21H2 and later), falling back to the _EX size. The kinds come from a VirtualQuery walk over the user
address space with the smaps line's title and vk_mapped ranges; the rest of a committed region is named by its type.
A region is cut at the ranges' edges, so a reservation the title commits only part of counts in each kind it reaches.
The walk's time is in the line: 131 203 regions take about 75 ms here.

Diagnostic only: it runs on the probe's own thread, and with LEONIDA_MEM_PROBE unset nothing runs. Under Wine with a
/proc entry the smaps line is printed as before.

- src/mem_probe.h: VmTally (the classifier: regions and ranges in, committed bytes and region counts per kind out),
  process_counters, walk_address_space, vmmap_text and sample_vmmap; sample() prints the vmmap line when proc_dir()
  finds no /proc entry.
- runtime/README.md: LEONIDA_MEM_PROBE's row names the vmmap line.

Test: mem_probe_vmmap_test (CPU, Windows). Synthetic regions cut at unsorted, overlapping title ranges and a
vk_mapped range give the expected bytes and region counts per kind; the line's text; a walk of the test process sees
64 MiB it commits as pe-private and in the commit charge, or as title memory inside a title range, and a 16 MiB
section view as pe-section, or as vk-mapped inside a vk_mapped range; a 4 GiB reservation with 65 536 committed pages
is walked and timed. It does not build on d442851, where the native sampler does not exist.
… has completed (RT-REHYDRATE-SCRATCH-TICKET)

RehydrateRaytracingAccelerationStructureBatched2X makes its own scratch
buffer when the title passes ScratchAccelerationStructureData = 0 (the
retail title does) and hands it to the list with hold_until_reset. The
list released it at its Reset or release, which D3D12 allows as soon as
ExecuteCommandLists returns. In the default synchronous submit mode
nothing else held it, and a default-heap buffer's arena range is free
the moment the buffer is destroyed, so the next DEFAULT buffer of that
size could get the range, and be zeroed by the CPU, while the build
still ran.

ExecuteCommandLists now also gives the queue the objects its lists hold
through hold_until_reset (keep_lists), and a batch submitted at once
keeps them until its submission has completed; drain_pins releases them
as it releases the fences. Held batches and LEONIDA_SUBMIT_ASYNC already
kept them, with the lists' pipeline states (pin_lists). A list without
such objects costs one size check. The rehydrate is the only user of
hold_until_reset.

xbox_bvh_builder_test: a rehydrate without the title's scratch is
executed, the list is Reset at once on another allocator (a second list
is released), and a DEFAULT buffer of the scratch's size is made before
any Signal. On d442851 it got the scratch's own VA and the sentinels
the lists held were already released (3 of 33 checks failed); now its
range is elsewhere, and the sentinels go once the submission has
completed.
…(RT-FSSM-ARENA-SHARE)

A compute or graphics PSO whose shader reads its code base (s_getpc_b64 and
the constant tables in its own program) copies that program into the GPU
address arena, which has a fixed size (256 MiB by default, at most 4095 MiB).
Each PSO made its own copy, so N PSOs of one program held N copies of the
same bytes until they were released.

The device now keeps one copy per program, keyed by the SHA-256 the PSO found
the program's translation by (fssm_sha256, or fspx_code_sha256 for a kind-6
program), which is the hash of the bytes copied. The first PSO makes the
copy, the others take a reference, and the last one returns it to the arena
when that PSO is deleted: the same point a PSO's own copy was returned, after
any build of it a compile worker was running. Compute entries whose index has
no uses_code_base key are still copied, as before.

LEONIDA_SHARE_CODE_BASE=0 gives every PSO a copy of its own, as before
(runtime/README.md).

d3d12_code_base_share_test creates four compute PSOs of one program, others
of programs with and without a code base or with no uses_code_base key, and
two graphics PSOs whose pixel shader reads its code base. It checks the
arena's shader bytes and each PSO's code base VA and bytes through two
read-only test hooks (arena_shader_bytes, pipeline_code_base). Without the
sharing it fails: four PSOs of a 4004-byte program held 16016 bytes.
d3d12_code_base_per_pso runs it with LEONIDA_SHARE_CODE_BASE=0.
…t (RT-TITLE-BUFFER-FALLBACK)

make_title_buffer makes a buffer over the title's pages the way slot
133 does: the pages imported, or a shadow copied from them. When both
fail (no import, the arena full, no host-visible memory left),
create_at_host_address still answers S_OK with an ordinary DEFAULT
buffer that has neither the title's VA nor its bytes. make_title_buffer
only checked FAILED(hr), so it kept that buffer until the device went
and counted it against LEONIDA_TITLE_BUFFERS_MB. The view stayed
uncovered, so the next IASetVertexBuffers or IASetIndexBuffer of the
same view made another one (each with its own memory, zero fill and
device reference), until the cap was used up; after that no new title
view was resolved for the rest of the session, even once the memory
was back.

A buffer is now kept and counted only when the context knows a buffer
at the view's address afterwards (knows_buffer_va over the backed
prefix, as the check before it). Otherwise it is released, and its
range is remembered for a second (refused_title_ranges_, by start,
pruned of expired entries at 256), so the binds in between return
without trying again. A range whose buffer could not be made at all is
remembered the same way.

d3d12_title_buffer_fallback_test fills a 16 MiB arena, refuses
host-visible allocations behind the instance-proc pointer it hands the
layer and runs with LEONIDA_SLOT133_IMPORT=0, then binds one 2 MiB
title view 16 times as vertex and index views. Before: 16 buffers
kept, 32 buffers of the view's size created. Now: none kept, 2 created
(by the first bind), and after the retry delay one more try, still
nothing kept.
…in (RT-ZERO-IMAGES-RETRY)

A sampled BC texture placed on the title's memory waits for memory of
its own, and its views name one shared, zeroed image of its exact shape
(DeviceState::zero_sampled_image). When that image could not be made
(create_texture failed, as it does under VRAM pressure, or the image
lost its host-transfer usage after its memory was refused), the shape
was stored as null in zero_images for the device's life: every later
placement of it took memory of its own at once, for the rest of the
session, even after the pressure had passed.

Such a failure is now remembered in zero_image_retry with a time a
second later: placements of the shape before then do not try again
(each try makes an image and asks for its memory), and the first one
after it does. A shape whose image would pass the 256 MiB the shared
images may take still stays null: those images are never released, so
it stays past the limit.

d3d12_zero_image_retry_test refuses the next vkCreateImage of one BC1
shape behind the instance-proc pointer it hands the layer (the shared
image, made before the placement's own), on a device without host
image copies so that the shape takes a shared image at all. Before:
after the delay a third placement still had memory of its own (one
image of the shape made for it). Now it is shared (two made: the shared
image and its own).
…it kept, and a failed call keeps nothing (RT-REHYDRATE-SCRATCH-TICKET)

The queue lets go of what a submission kept in the first of its calls
that finds the submission completed, after that call's own submission.
With LEONIDA_SUBMIT_ASYNC that call runs on the worker, so the fence of
its Signal can be reached before the release has run, and the test's
last check read the sentinels too early: it failed in 2 of 20 runs with
LEONIDA_SUBMIT_ASYNC=4. The test now signals and waits until both
sentinels are released, up to eight more Signals. The worker runs the
calls in order, so a release has finished by the time the next
Signal's fence is reached. The sentinels are static, so a late release,
or one at teardown after a failed step returned early, never touches a
frame that has ended.

execute_sync asks for the lists' kept objects only when the call
succeeded. A failed call submitted nothing of the lists, and on a lost
device the references would otherwise stay in pin_queue_ until the
queue is destroyed.

pin_lists and keep_lists take their references through one helper,
reference_lists.
…ed views make one try a second in all (RT-TITLE-BUFFER-FALLBACK)

The previous commit let go of the ordinary DEFAULT buffer that slot 133
answers with when a view's pages can be neither imported nor shadowed,
but every retry still made one: vkCreateBuffer, a dedicated
device-local allocation of up to 64 MiB (the arena being full is why
the shadow failed), a zero fill, then a deferred free. That happened
once a second for each refused range while the pressure lasted, under
memory_mutex(), where the title's own allocations wait.
create_at_host_address now takes ordinary_fallback (true by default,
so slot 133 keeps its stand-in); make_title_buffer passes false and
gets the shadow's HRESULT back instead. A buffer that does not cover
the view is still let go.

The retry was also per range: a title binding many views of one
refused pool made one full try per distinct start per second. Now,
after a refusal no range is tried for a second (title_buffer_retry_),
and a range refused again waits twice as long as its last wait, up to
64 s, so one that keeps failing does not take every second's try from
ranges that could get a buffer. Both checks come before the page walk,
so a held-back bind makes no VirtualQuery call.

d3d12_title_buffer_fallback_test now fills the arena with 64 KiB
buffers, counts device-local allocations of a view's size while
host-visible ones are refused, and binds a second view right after the
first is refused and again later. With the previous commit: 2
device-local allocations (one per view) and the second view tried at
once. Now: none, the second view held back for that second, and the
first view, refused a second time, waits 2 s.
… a range, a few images a pass (RT-SLOT70-OWNED-RETIRE)

title_memory_map::changed() with no range records [0, UINTPTR_MAX). On
Windows, xmem records one for each run of pages it commits for a
DirectStorage transfer, and one for every MEM_RELEASE. The refresh pass
took such a change for a change over every owned image. It then walked
the pages of each with VirtualQuery, under the registry lock, on the
title's submitting thread, nearly every pass of a streaming load. A
look costs about 0.5 us here, so 60,000 images would cost about 30 ms a
pass.

A change anywhere now marks no image: it says that something changed,
not where. title_free_impl records a whole release over the range that
allocation_extent finds before the free, so a released pool is still
found. It falls back to a change anywhere when the walk stopped early.
A pass visits at most LEONIDA_TITLE_IMAGE_CHECKS (128) of the images
that may be retired, from where the last pass stopped. A candidate not
reached keeps its mark.

A slot-133 texture covers owned images only with the layout of the
title's XG computer, or with the one its first slot-70 view gives it.
The guess from its description (Layout 0) can be larger than what the
title placed. The census line counts the images that a view named again
after a newer texture covered them. The test hooks are now
owned_title_images and owned_title_image, and the predicate is now
owned_image_retirement_on.

d3d12_title_image_retire adds four checks. A change anywhere with 13
images makes 0 looks (13 before). A change over 12 images makes 4 looks
a pass with LEONIDA_TITLE_IMAGE_CHECKS=4 (12 in one pass before). A
guessed slot-133 layout covers nothing until a view names the texture.
An image never filled stays when its pages go. The new
d3d12_title_image_idle (LEONIDA_TITLE_IMAGE_IDLE_MS=500) checks the
idle time for both reasons, and that a view of an image whose pages
went keeps it until a later change over them. xmem_test checks the
range a whole release records. All of them fail on d442851.
…each failure, up to 64 s (RT-ZERO-IMAGES-RETRY)

The previous commit tried such a shape again a second after each
failure. A failure is not always transient: where the driver allows no
memory type for host-transfer images (the NVIDIA Pascal case
create_texture documents), the image loses host-transfer usage at
every try, so each BC shape there would cost two vkCreateImage calls, a
pool suballocation and bind, and a deferred free every second for the
whole session, where before it cost one try per shape per session.

zero_image_retry now keeps the last wait with the retry time. It is a
second after the first failure and doubles at each failure after it,
up to 64 s; a shape that gets its image is dropped from the map. A
shape that fails for good costs about one try a minute. One that
failed under pressure gets its image at the first placement after its
current wait, so at most 64 s after the memory is back.

d3d12_zero_image_retry_test now refuses the shape's image a second
time at the first retry. 1.5 s after that, a placement still has memory
of its own (refused twice, the shape waits 2 s); 1.5 s later one gets
the shared image. With the previous commit the placement 1.5 s after
the second refusal already took the shared image.
# Conflicts:
#	runtime/shims/d3d12_com.h
#	runtime/shims/d3d12_vulkan_device.cpp
…es it (RT-SLOT70-OWNED-RETIRE)

LEONIDA_TITLE_IMAGE_RETIRE is off by default now; 1 turns it on. Retirement decides on a newer
texture over an image's bytes or on its pages going, and on no slot-70 view naming it for a while.
A title that samples such an image through a descriptor it wrote once (a heap it copies from, a
table it keeps) with no later view of the address would sample the fallback once the image goes,
and the census cannot see that. With the switch off nothing changes for the title; with it on, a
streaming session can show whether the images stay at the textures still there.

d3d12_title_image_retire and d3d12_title_image_idle run with the switch on. A negative
LEONIDA_TITLE_IMAGE_IDLE_MS counts as 0.
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
Conflict in d3d12/crates/leonida-gpu/src/list.rs: main's 7efbbdd
(LEONIDA_ALLOCATOR_TRIM=1, idle host lists older than the limit let go)
and RS-HOST-LIST-ALLOCATOR-PEAK (the idle pool as a Pool trimmed once a
second) both changed the idle host-list pool. The Pool stays; an idle
list keeps when it was put by, and with LEONIDA_ALLOCATOR_TRIM the
oldest stale ones are taken out of the Pool (Pool::take_oldest, which
keeps its bytes and its count of untouched lists) and counted in
ALLOCATOR_TRIMS[2], as on main, when a list is given back.
@adrianmjim
adrianmjim requested a max review from Copilot November 28, 2026 19:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@adrianmjim
adrianmjim requested a balanced review from Copilot November 28, 2026 19:28
…ed (RT-ZERO-IMAGES-RELEASE)

The shared all-zero BC image of each shape (zero_sampled_image) was kept for
the device's life on a write-back L0 heap, host memory on a discrete GPU, and
its bytes stayed counted against the 256 MiB cap. The device now counts the
placed textures showing each image (acquire_zero_image); when the last one is
destroyed, the image leaves the map and the cap, and the Resource's destructor
queues it for deletion after the submissions made so far, behind the views of
it that texture's forget_image queued. A texture that got memory of its own
keeps its count until it goes, since views of the shared image made before then
may stay in replaced_images. Shapes left without an image because they did not
fit get another try once room is freed.

d3d12_zero_image_release places twelve BC1 shapes (one twice), releases them,
and checks that no shared image or byte is left, that every one is destroyed
after two submissions, and that a shape placed again gets an image.
…SCRATCH)

Every compressed, swizzled or page request allocated zero-filled buffers
and freed them at the end: the source read from its file, the zlib
output, the BCPack output and the unshuffled bytes, each a new vector.
Blocks of 1 MiB and more come from fresh virtual memory, so streaming
paid an allocation, a zero-fill, page faults and a free per stage.

Each queue's worker now keeps two buffers per request it runs (its own,
and its paired helper's) in its own frame, not in a thread_local, and
the stages take turns writing into one and reading the other. A buffer
grows only when a request needs more than it holds, and is replaced
rather than grown, since nothing in it needs copying. Between requests
a set keeps at most 16 MiB, the budget of a request that may run beside
another (can_prepare), dropping its larger buffer first.

The buffers no longer zero their new bytes: the read fills all of them
or fails, inflate appends only what it writes (zlib_inflate now takes
any vector of bytes), BCPack writes every byte of each block it returns
(BC6H and BC7 clear a block before setting its bits), the stripes of a
swizzle group cover all of it, and a failed request publishes nothing.

test_reused_buffers counts, under a test-only counting operator new,
the blocks of 128 KiB or more that 100 identical 512 KiB zlib plus
swizzle requests from a file allocate: three per request before (300),
six now (three for each of the worker's two sets). Every destination is
checked against the inflated stream unshuffled.
…ted shaders and starts empty when they change (RS-PIPELINE-LIBRARY-FINGERPRINT)

host-pipelines.bin was opened whatever translation its pipelines came from and saved back whole, so the entries of every earlier translator change stayed in the file and in what the host reads of it. The fingerprint leonida warm already keeps its list by (known::fingerprint: the translator, its settings, what it was told of the host, the driver) is now written beside it as host-pipelines.fingerprint; a start that finds none or another starts an empty library, and its first save writes over the old one. A save deletes the fingerprint before renaming a library of other shaders into place and writes it after, and drops a library an earlier save left waiting, so a save cut short never pairs a stale library with the current fingerprint.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unsynchronized arena reads can cause Rust data races, while a device-loss enqueue race can leave released objects allocated until teardown.

4 open issues
3 resolved since last review

Review effort: Balanced

Comment on lines +239 to +243
// but for a side that is memory of ours (`Shadow::opened`,
// an arena of `crate::memory`'s): there a recording thread
// may write a word while it is read here, or while
// `copy_all` below reads its run. Two plain accesses at
// once are a race the language leaves undefined. What the
Comment on lines +2022 to 2027
if (is_device_lost() && !DeferredDeletionQueue::kept_after_loss(kind)) {
if (!lost_queue_drained_.exchange(true, std::memory_order_acq_rel)) deletion_queue_.drain_lost(device_, vk);
DeferredDeletionQueue::destroy({0, raw_handle, kind}, device_, vk, nullptr, nullptr);
return;
}
std::lock_guard lock(submit_mutex_);
if let Some(last) = self.keys.get_mut(key) {
return std::mem::replace(last, self.run) != self.run;
}
self.keys.len() < EARLY_MAX && self.keys.insert(key.to_owned(), self.run).is_none()
Comment on lines +148 to +149
return recorded && seed.bytes >= header_bytes && recorded->seed == seed &&
recorded->session_bytes == session_bytes && session_bytes >= seed.bytes;
… drop its fingerprint (RS-PIPELINE-LIBRARY-FINGERPRINT)

A worker save and the shutdown save could interleave their fingerprint check, delete, rename and write, so one could delete the fingerprint the other had just written and then fail its rename: the next start found none and compiled everything again. They now take one lock. The start that cannot rename a waiting library into place says why it does not open the older file even under its own fingerprint (it may be of the shaders before), and the new comments are wrapped like the rest of the file.
…t lists let go, and the test takes its own list back without dropping others (RS-HOST-LIST-SCRATCH-TRIM)
…quests (RT-DSTORAGE-CPP-SCRATCH)

Each queue has its own worker, and each worker kept two sets of buffers
(its own and its paired helper's), each trimmed to 16 MiB apart: a queue
whose requests pair could keep 32 MiB while idle, outside the 64 MiB
window docs/directstorage.md says bounds private staging. The worker now
trims both sets together after each request or pair, giving up the
largest buffers first until what it keeps holds at most 16 MiB, as the
Rust workers trim theirs. The doc now says what the workers keep, how
much per queue, and that it is outside the window.

test_kept_buffers_cap runs a zlib request inflating 20 MiB from 5.6 MiB
twice and counts the blocks of 2 MiB or more each allocates: the second
allocates both again (2, 2), so nothing over the cap was kept. A request
inflating 4 MiB after them allocates none, so the kept source buffer was
reused. On main the three allocate 2, 2 and 1. With trim doing nothing
the second allocates only 1, since the 20 MiB output buffer was kept;
dropping the smallest first drops everything and the third allocates 1.

test_reused_buffers now takes turns between two different streams of the
same size, so a stage that left bytes of a reused buffer unwritten would
publish the other stream's bytes, and checks each destination against
its own stream.
…ed zero image go (RT-ZERO-IMAGES-RELEASE)

A placement held its claim on the shared zero image of its shape until it was
destroyed, even after it got memory of its own. By then publish_streamed_texture
has queued every view at the texture's address for deletion, the ones in
replaced_images included, and erased its pending keys, so nothing reaches the
image any more; yet it stayed in host memory and in the 256 MiB for as long as
any texture of that shape lived. publish_streamed_texture now gives the claim
back there. The bind runs inside command prepare with the context's resource
lock held, so the claim goes to a list the device drains before the next
submission, where the image is released through the deferred queue as before.

d3d12_zero_image_release also gives a placement memory of its own with a copy
and checks that its shape's image is gone while the texture lives, makes views
of placements and checks that no shared image is destroyed before its views,
and fills the cap with large shapes to check that the one that did not fit gets
an image once another is released.
…STORAGE-CPP-SCRATCH)

test_kept_buffers_cap only sends requests over 16 MiB, which never pair,
so trimming each set apart gives it the same 2, 2, 0 blocks: it does not
test that a worker's own and helper sets share the cap.

test_kept_buffers_pair_cap submits a zlib request inflating 8 MiB from
2.2 MiB and one inflating 6 MiB from 1.7 MiB together. Each stages at
most 16 MiB, so they pair: their blocks of 2 MiB or more come from two
threads (the worker and the pool thread preparing the helper's). The two
sets then hold 17.9 MiB, each under 16 MiB, and the worker drops the
8 MiB buffer, so the first request alone afterwards allocates its source
and output again (2 blocks). With the per-set trim of 6c3a24e restored
it allocates only its output (1) and the test fails.
… share its serialised file (RS-PIPELINE-LIBRARY-FINGERPRINT)

Every save serialises into host-pipelines.tmp, yet only the serialisation (the library's own lock) and the rename with its fingerprint were locked. A worker save done serialising could rename that file into place while the shutdown save truncated and refilled it: a library still being written under a valid fingerprint, and the shutdown save, finding no file to rename, failed and wrote neither the slow nor the early list. Main shared the file the same way, with no lock on the rename at all; the fingerprint made it worse, as it now vouches for whatever was renamed. One lock now covers the whole save, from serialising to the early list, taken after the 20 s check so a worker that finds a save running returns instead of waiting; no caller of the save holds a lock and none taken inside it is held by anyone who saves. A file of its own for each save was not chosen: two saves could then rename in the other order, an older library over a newer one, and leave files to clean up. The save's file side takes the serialisation as a closure, so a test runs two overlapping saves against a temporary folder (it fails with only those two steps locked).
… at its return (RT-ZERO-IMAGES-RELEASE)

A placed texture gives its claim on its shape's shared zero image back during the prepare of a replay, whose
earlier commands may still sample the image and whose submission is recorded only later. Another queue's replay
can run before_execute meanwhile, drain the return and queue the image's deletion at the next ticket, which its
own submission takes: the image could be destroyed while the first submission is still pending.

Each return now records the last ExecuteCommandLists replay begun (GeometryViews::execute_epoch) and is drained
only once none of the replays in progress at that point is left (oldest_execute), as a retired geometry view
waits for kAfterExecutes. The deferred deletion is then ticketed after their submissions.

d3d12_zero_image_release starts a compute queue's replay from inside the copy's vkEndCommandBuffer, after the
copy gave the texture memory of its own, and checks the image is kept until the direct queue's next replay.
… the limit now that images are released

RT-ZERO-IMAGES-RETRY's comment said the shared images are never released;
since RT-ZERO-IMAGES-RELEASE they are, and release_zero_image drops the
empty entries of shapes that did not fit. Comment only.
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 28, 2026
@Maticcm

Maticcm commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Native Windows C++ runtime check of 962bc1601b37be431f7417840dfa6adc85408224, with the shared DirectStorage test also run on common ancestor 8b318bd4037e37a29bebda7417da0062d869f365. RTX 3080 desktop, 10 GiB, NVIDIA 630.20, Windows 11 build 26340, MSVC 19.50.35717 RelWithDebInfo and Vulkan SDK 1.4.363.1.

  • dstorage passed on both revisions. The head includes and executed the new paired-worker scratch-cap check.
  • d3d12_zero_image_release passed on the head on RTX 3080 with Khronos validation enabled, including the overlapping replay test.
  • mem_probe_vmmap passed on native Windows. Its live measurement showed private commit rise from 1 to 65 MiB with the 64 MiB allocation.

Overall 3/3 on the head and 1/1 on the ancestor, no CTest skips. Focused C++ synthetic checks only. AI-assisted (Codex).

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused follow-up on RS-PIPELINE-LIBRARY-FINGERPRINT at 962bc1601 merged locally with main aa918e5d9. Windows 10 22H2, Rust/MSVC, diag profile. The 15 library tests and one additional local file-lock fixture passed, including concurrent saves and fingerprint handling.

The extra fixture held the old cache file open without delete sharing and saved a synthetic blob for the new fingerprint. The implementation wrote the replacement to the waiting file. A read while the old file was locked correctly returned an empty library; after releasing the handle the new file was promoted and its bytes were read under the new fingerprint. This check only covers the Rust pipeline library lane of the sweep.

AI-assisted.

@zmasi

zmasi commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Native Windows 11 + NVIDIA GeForce RTX 3090 Verification (d3d12/ Rust Head 962bc1601b)

Verified the updated head 962bc1601b37be431f7417840dfa6adc85408224 merged cleanly onto origin/main (aa918e5d9f9e2f03e078d8f08854324890b5e176, git merge-tree --write-tree rc=0) on native Windows 11 (26200) + NVIDIA GeForce RTX 3090 (driver 610.88), covering the 6 Rust d3d12/ leak-remediation additions landed after 9fc3ad427c (RS-HOST-LIST-SCRATCH-TRIM, RS-PIPELINE-LIBRARY-FINGERPRINT, RS-ARENA-ONE-COPY, RS-SHADER-CONTAINER-FREE, RS-DSTORAGE-SCRATCH, and shared test_alloc counting allocator) alongside all earlier d3d12/ suites.

1. Red -> Green Hardware Reproduction (RS-ARENA-ONE-COPY on RTX 3090)

  • Red (origin/main aa918e5d9f): Probed Memory::another() across 3 consecutive 64 MiB arenas on RTX 3090 (ID3D12Device3::OpenExistingHeapFromAddress supported): each 64 MiB arena added 192 MiB of process commit (128 MiB beside its 64 MiB GPU side: 64 MiB upload::reserve + duplicate 64 MiB UPLOAD shared_buffer), failing grew < card + ARENA + ARENA / 2.
  • Green (origin/main + 962bc1601b): memory::tests::an_arena_is_in_the_pcs_memory_once passed (4/4 memory::tests green): each 64 MiB arena added 128 MiB total commit (64 MiB GPU side + 64 MiB CPU arena, 64 MiB less commit per arena), card_data() == at for all 3 arenas (by_address_opened via inplace::place_part), and an_arena_sends_up_only_the_dwords_the_title_changed confirmed dword-granular dirty-run uploads leave untouched GPU-written dwords intact.

2. d3d12/ Test Suites Executed (100% Green)

  • leonida-gpu (default & --features diagnostics, RTX 3090 D3D12):
    • memory::tests::*: 4/4 passed (an_arena_is_in_the_pcs_memory_once, an_arena_sends_up_only_the_dwords_the_title_changed, a_piece_takes_what_changed, a_packed_structure_is_known_by_its_header).
    • list::tests::*: 10/10 passed (an_idle_list_lets_go_of_a_large_indirect_scratch in both default and --features diagnostics, a_submitted_list_keeps_no_host_list_until_its_reset, idle_lists_nobody_takes_are_let_go, taking_out_the_oldest_keeps_the_pools_counts).
    • list::thin::tests::*: 4/4 passed (uploads_of_words_never_handed_over_are_given_back).
    • pipeline::tests::*: 4/4 passed (translated_shaders_let_their_containers_go, pipelines_of_one_graphics_state_share_it).
    • pipeline::library::tests::*: 15/15 passed (a_library_is_reused_only_for_the_same_shaders, a_library_saved_for_other_shaders_is_not_opened, a_save_writes_its_fingerprint_with_the_library, overlapping_saves_leave_one_whole_library_and_its_lists, the_early_list_keeps_the_last_two_runs).
    • resource::tests::replaced_copies_go_with_the_sweep_off (1/1), shadow::snapshot_pool_tests::* (1/1), shadow::exact_spare_tests::* (1/1), texture::read_buffer_tests::* (2/2): 5/5 passed.
  • leonida-hle (default with test_alloc & --features diagnostics):
    • modules::apu::tests::*: 3/3 passed (packets_decode_without_memory_of_their_own under shared test_alloc).
    • modules::dstorage::tests::*: 21/21 passed in default (compressed_requests_reuse_the_workers_buffers under shared test_alloc, a_worker_keeps_its_buffers_up_to_a_bound, staging_counts_every_buffer_a_request_holds) + 20/20 passed under --features diagnostics.
    • modules::xasync::tests::*: 15/15 passed (pool_workers_stay_few_in_a_burst_of_short_callbacks, pool_workers_left_idle_leave_under_a_trickle_of_callbacks, pool_callbacks_queued_together_may_wait_for_each_other).
    • modules::xmem::tests::*: 22/22 passed (free_default_tells_the_gpu_side_of_32bit_memory).
  • leonida & Docs/Policy:
    • cargo test --locked -p leonida: 40/40 passed (36 unit + 2 agility + 2 census).
    • tests/test_docs_*.py (56/56 OK) and scripts/check_no_game_data.py (rc=0).

AI-assisted.

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants