D3D12.X: system-memory sparse pools (#2987) give back heaps whose tiles are all free #3613
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3613"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T19:52:56Z.
Carries #2987 (treybertram06's commit unchanged, rebased on main) and adds the system-pool retirement asked for in its review; supersedes #2987 if its author does not return.
The system-memory pools of
XCL_SPARSE_SYSMEM=1only grew: unlike the video pools they had no way to give back a heap whose tiles are all free, so the process kept its peak (about 3.8 GB in our world runs). Review point: https://github.com/xcl-dev/xcl/pull/2987#discussion_r4759072509What is in it
D3D12.X: sparse tiles outside the GPU heaps can live in system memory- treybertram06's commit, unchanged (sparse.rs,kernelx.rs); default off.D3D12.X: system-memory sparse pools give back heaps whose tiles are all free(crates/xcl/src/hle/d3d12x/sparse.rs):SysPools::retirereleases a heap whose 64 tiles are all free or cooled (COOL), keeps it in a retired list until the sparse queue's fence is past its mark (asState::retireddoes), and a retired heap is taken back before a new one is made. Heap slots areOptionso the indexes in live tile handles never move; the next heap takes a free slot.State::retire_free_pools_withcalls it, and the submit path'sretire_duealso looks at the system pools' cooling queue. Test:a_system_memory_heap_with_all_tiles_free_is_given_back(checksbytes()drops, live heap keeps its index, retired heap waits for the fence, a later heap reuses the slot); it fails with the retirement disabled.Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4on headb98038bb(after bmjask's third review): 3012 passed, 0 failed, 52 ignored, 25SKIPPEDlines.XCL_RESIDENCY_PRIORITY=1): run 505 withXCL_SPARSE_SYSMEMoff: peak 18,948 MB of a 15,171 MB budget, 3.13 presents/s. Run 506 with it on: peak 15,737 MB of 15,166 MB (−3.2 GB), 3.01 presents/s (−4 %). Neither run had a device removal or crash.SKIPPEDlines in the log: 25 (gpu, hle, shaders andheap_window_out_of_memory_falls_back_to_the_switch_form); not counted as coverage.retiredisabled (panic at the firstbytes()assertion after retirement).Regression run
main
817eb1fc9:this PR's head:
Not tested
AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T20:11:51Z.
merge-check
base:
6bfb5c5153head:
24a84ca327merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2908 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read the whole diff (+354/-12). The new commit makes the system-memory pools retire heaps the same way the video pools already do, and I found no problem in when a heap is released, but two open points from #2987's review are still unfixed and the new tests skip part of the path. Findings: (1) The mixed hot/cold skip from #2987 is still there. In
materialize(sparse.rs~3978),wait = left > 0 || …means that once one tile in a GPU heap finds no video memory, every later tile in the same call is skipped, including cold tiles that would have got system memory. The carried commit is byte-identical to #2987's head15b74314(range-diff=), so the regression reported on that head still applies; nobody answered it. (2) A refused system-memory heap is retried for every cold tile. WhenCreateHeapfails intake_sys_tile(~3637), it logs, falls back totake_tileand remembers nothing, so the next cold tile asks for a new 64 MiB heap again. This was raised in two #2987 merge-checks (one run showed 15 failed creations in a row), and retirement can make heap creation more frequent. (3) The test leaves out part of the path.a_system_memory_heap_with_all_tiles_free_is_given_back(~11645) callsSysPoolsdirectly. It covers the negative cases (a heap with one live tile is kept, a heap still cooling is kept, a heap waits for the fence), but nottake_sys_tiletaking back a retired heap throughretired.pop()(~3624), the call fromretire_free_pools_with(~3747), or thesys_waitingterm added toretire_dueon the submit path (~7953), so broken wiring would still pass. (4) A run can't show that retirement works.sys_pool_bytes()(~583) has no caller, and neitherpool_bytesnormemory_bytes_forcounts the system-memory heaps. Retirement writes no log line, andbytes()drops as soon as a heap is retired although the heap stays allocated inretireduntil the fence passes and 2 s have gone by. The growth log (~3647) now counts only live heaps, so it prints again each time the count climbs back to a power of two. A world run therefore can't confirm the 3.8 GB this PR is meant to give back (the description says so under Not tested). (5)SYS_POOLSoutlives a replaced state (older than this PR).initswapsSTATE(~3554) but leaves the global system-memory pools in place, so tiles the old state had mapped never come back and their heaps are never retired; only matters ifinitruns twice (unverified that any title does). Fine: a heap is retired only when all 64 of its tiles are free or have cooled for the fullCOOLtime; tiles reach cooling only through quarantine (behind the sparse queue's and the title queues' fences) or when a placed buffer is released, so parked, kept, pinned and quarantined tiles keep their heap. A retired heap stays inretireduntil the sparse queue's fence reachesself.valueand 2 s have passed, and is taken back before a new heap is created, as in the video path. Live heap indexes never move, andFreePools::clear_heapruns before a slot is reused.retire,take_sys_tile,coolandpool_heapall run with theSTATElock held and takeSYS_POOLSinside it in the same order, so a map into the same heap can't race a retirement. With the switch off,SYS_POOLSstaysNoneandtake_tile_forgoes totake_tile; the only additions on the default path are theHOTnote/forget once per GPU heap and one uncontended lock per submit and per retire. Thekernelx.rschange matchessparse::free.performance: 60 s smoke of a retail title, main
6bfb5c51vs this merge (24a84ca3): 1646 -> 1670 frames shown (101 %; last presents per 2 s: 60 60 61), peak commit 18685 -> 18803 MB, 0 device removals, 0 crashes. WithXCL_SPARSE_SYSMEM=1: 1663 frames, peak commit 18343 MB, 0 device removals, 0 crashes; the system-memory pools were used (up to 512 MB of heaps in the log), but no retirement shows in a 60 s run and nothing logs one (finding 4).verdict: not yet: two points from #2987's review are still open on the carried commit (finding 1, cold tiles skipped after one tile finds no video memory, and finding 2, a refused system-memory heap retried for every cold tile), and nothing yet shows the 3.8 GB coming back (finding 4). Nothing breaks: the suite passes and both smoke runs, with the switch off and on, are clean
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T00:18:13Z.
merge-check claim
head:
24a84ca327Imported from ivall/xcl. Originally posted by vasanex on 2026-12-02T00:33:17Z.
merge-check
base:
1c8b551475head:
24a84ca327merge: clean (merged tree 7cbdd9c3,
git diff --checkclean)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> two runs on the merge: 2912 passed, 1 failed, 51 ignored, then 2913 passed, 0 failed, 51 ignored; SKIPPED: 25 in both (22 no wave64, 2 no heap windows, 1 cannot disable the driver cache), the same set as on the base; base alone, same machine: 2909 passed, 0 failed, 51 ignored. Failing in the first run only:
two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs(tests/gpu_two_pass_cache_e2e.rs:584, "releasing the title PSOs releases their two-pass state", left 1, right 0, in itswarmcase). That is the assertion of the open issue #3441. Alone with--exact --test-threads=1: on the merge 9 of 11 passed (the 2 failures came right after the suite run, the next 8 runs passed), on the base 6 of 6. I do not see how this PR reaches that test (it does not setXCL_SPARSE_SYSMEM, and the change touches no pipeline or late-release code), and the second whole run is clean, so I count it as #3441's flake, not as this PR's; the numbers are here so that others can judge. The PR's four new tests pass in both runs (a_system_memory_heap_with_all_tiles_free_is_given_back,a_lazy_tile_outside_the_gpu_heaps_gets_system_memory,a_parked_system_memory_tile_gives_way_to_a_gpu_heap,the_title_gpu_heaps_are_hot_and_nothing_around_them); the two GPU ones did not skip here, so the L0 custom heap was made and mapped on this card.review: whole diff read (sparse.rs, kernelx.rs), in the merge result. No blocking finding. Checked:
SYS(bit 31 of the pool index) against theLAZYsentinel (all bits set): every path that reachescool,pool_heapor the quarantine count already leavesLAZYout, as on main. All frees of a pool tile go throughState::cool, so noSYSindex reaches the video pools'FreePoolstable (the second GPU test asserts that). Lock order is always the sparse state, thenSYS_POOLS/HOT;take_sys_tiledropsSYS_POOLSbefore it falls back totake_tile. A heap slot given back isNoneand reused byadd_heap, so indexes in live tile handles stay valid; a retired heap waits for the sparse queue's fence and 2 s, as the video pools do. Smaller points: (1)XCL_SPARSE_SYSMEMhas no line in README.md (the switch comes from #2987's commit); (2) the retirement test uses plain default heaps and no tile mapping, as the description says, so giving back an L0 heap that was mapped is covered only by reasoning (the fence mark); (3)sys_pool_bytes()has no caller, so the memory lines of the log do not show these heaps yet; (4) I did not repeat the "fails withretiredisabled" run. Duplicates: it carries #2987 (open, same first commit; #1607 group D262 with #3112) and adds one commit; nothing else found forXCL_SPARSE_SYSMEM.performance: off by default. With the switch off the cost is one
OnceLockread per tile taken, one uncontendedSYS_POOLSlock per submit (retire_waiting) and per pool retirement, and a bit test per freed tile: reasoned, not measured. No title run in this check; nothing here says what the switch does to frame time on a 10 GB card.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 3080 10 GB (driver 621.40), AMD Ryzen 9 7950X, Windows 11 Pro 26200, rustc 1.100.0, debug / Claude Code with Claude Fable 5.2. Run and posted without a human check of each point.
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T08:39:24Z.
In the world with #3617 and residency priority on current
main(RTX 4080 16 GB, 900 s, same save and inputs, no draws skipped):XCL_SPARSE_SYSMEM=12.95 and 2.97 presents/s at 15.6 / 15.8 GB video memory (runs 429, 431) against 3.15 at 18.7 GB without it (run 430), so ~3 GB less video memory for ~6 % frame rate in this combination. Non-local (system) video memory at the end of the runs: 8.9 GB with the switch, 4.9 GB without — the retirement here gives back heaps only once all their tiles are free, which this title's working set apparently never reaches within 15 minutes; the unit test covers the logic, but no measurable drop in the world yet.AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-12-02T08:45:18Z.
Follow-up on exact head
24a84ca3, addressing the mixed hot/cold allocation finding.I added a synthetic regression to the unchanged head. It failed because the failed hot-tile allocation caused the adjacent cold tile to remain
LAZY. With the candidate below, that same test passed on the RTX 3080 Ti, and GPU readback matched the CPU-written bytes. The full sparse test module passed: 145 passed, 0 failed, 1 ignored, noSKIPPEDnotices.The change tracks failure separately for video and system-memory allocation, so failure in one pool does not suppress an attempt from the other. If both the L0 request and its video fallback fail, it preserves the existing
no_memoryretry state. This addresses finding 1 only; repeated L0 heap attempts after a successful video fallback remain open, as do the other review coverage and measurement points. This is not a merge-check: I did not run the full workspace or paired title smoke on this candidate.NVIDIA GeForce RTX 3080 Ti (driver 621.40), AMD Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1.
Candidate diff
AI use: OpenAI Codex (GPT-6.2 Sol) prepared and tested this candidate.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:03:39Z.
Code review location:
crates/xcl/src/hle/d3d12x/sparse.rs; line 11598Medium:
LAZYis (u32::MAX, u32::MAX), which has the SYS bit set. So a LAZY handle that reachespool_heaporcoolis routed to SYS_POOLS with index 0x7FFFFFFF, an out-of-bounds panic where it used to hit the existing "live pool" check. In the test,assert_ne!(pool.0 & SYS, 0, ...)also passes even when the tile never got memory. Checking for LAZY before the SYS test (inpool_heap,cooland the test) would avoid both.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:03:39Z.
Code review location:
crates/xcl/src/hle/d3d12x/sparse.rs; line 3658Medium: Only the XCL_COHERENT_HEAPS=sparse heaps are marked hot, so every other GPU-critical sparse allocation goes to system memory under the flag: XMemAllocDefault graphics memory and MEM_GRAPHICS VirtualAlloc (kernelx.rs:967 and 1432), console descriptor tables (console_heap.rs:869 via
alloc_in), and command-list scratch (console_list.rs:662, bind.rs:4978). With XCL_SPARSE_SYSMEM=1, a title's XMemAlloc render targets and textures, and the descriptor tables shaders read every draw, get L0 tiles and are read and written over PCIe. The flag is described as moving only tiles outside the title's GPU heaps, so marking those allocations hot too would match the description.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:03:39Z.
Code review location:
crates/xcl/src/hle/d3d12x/sparse.rs; line 4035Medium: The swap from a system-memory tile to a video tile at a GPU-heap address only checks
parked, so a SYS tile held inkeptat that address is taken back as-is by.or_else(|| self.kept.remove(&t)). With XCL_SPARSE_SYSMEM=1 plus XCL_VIEW_KEEP or a placed buffer's kept tile, a non-hot reservation leaves a SYS tile inkept. If the address is then reused for a title GPU heap (alloc_as(.., true)),ensure_mappedfinds the tile inkept,swapis false, and the GPU heap's tile stays in system memory.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:03:39Z.
Code review location:
crates/xcl/src/hle/d3d12x/sparse.rs; line 549Medium: Not certain about this one: SYS_POOLS is a process-global static, but the video pools, the fence and the quarantine live in State, which
sparse::initreplaces, so the system-memory pools outlive the State whose tiles and fence values they track. Ifsparse::initruns again (two firstreal::initcalls, or crates/xcl/tests/sparse_reinit.rs), the old State's mapped, parked and quarantined SYS tiles are dropped without being cooled, so SYS_POOLS counts them in use forever and those heaps never retire. Retired heaps also keep fence marks from the old fence, compared against a new one that restarts at 0, and heaps made on the old device can be handed to the new State's UpdateTileMappings. Keeping the sys pools inside State would tie their lifetime to it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:03:39Z.
Review: COMMENTED
Review of
24a84ca3: 4 finding(s) (4 medium), most severe first.crates/xcl/src/hle/d3d12x/sparse.rs:11598:LAZYis (u32::MAX, u32::MAX), which has the SYS bit set. (inline)crates/xcl/src/hle/d3d12x/sparse.rs:3658: Only the XCL_COHERENT_HEAPS=sparse heaps are marked hot, so every other GPU-critical sparse allocation goes to system memory under the flag: XMemAllocDefault graphics memory and MEM_GRAPHICS VirtualAlloc (kernelx.rs:967 and 1432), consol.... (inline)crates/xcl/src/hle/d3d12x/sparse.rs:4035: The swap from a system-memory tile to a video tile at a GPU-heap address only checksparked, so a SYS tile held inkeptat that address is taken back as-is by.or_else(|| self.kept.remove(&t)). (inline)crates/xcl/src/hle/d3d12x/sparse.rs:549: Not certain about this one: SYS_POOLS is a process-global static, but the video pools, the fence and the quarantine live in State, whichsparse::initreplaces, so the system-memory pools outlive the State whose tiles and fence values t.... (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:03:46Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-12-02T17:13:21Z.
Linux / AMD RDNA4 (RADV, Wine + vkd3d-proton): full test suite on
24a84caMerged onto
main5eaadb54(clean merge) and compared withmainrun twice on the same machine.Setup
v3.1-83-gcae8353edand DXVKdxgi.dllfrom GE-Proton11-16, DXC 1.9.2609.5x86_64-pc-windows-msvcwithcargo-xwin; test binaries run under WineTested:
cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-fail-fast -- --test-threads=4 --skip <31 tests>main5eaadb54main: none.the_title_gpu_heaps_are_hot_and_nothing_around_them,a_system_memory_heap_with_all_tiles_free_is_given_back).a_lazy_tile_outside_the_gpu_heaps_gets_system_memory: fails withInvalid parameter (0x80070057), the #175 failure above, asmain's tests of the same kind do here.a_parked_system_memory_tile_gives_way_to_a_gpu_heap: fails withInvalid parameter (0x80070057), the #175 failure above, asmain's tests of the same kind do here.About the failures on
mainand the 31 skipped tests (same for every PR in this batch)main's 177 failures under Wine come from #175: once a test has set up the real device, vkd3d-proton refuses the command allocators XCL adopts (d3d12_command_list_Reset: Invalid command allocator), and later tests getE_INVALIDARG(0x80070057). Running vkd3d-proton master with its vtable check taken out,hle::d3d12x::sparse::testsgoes from 106 passed / 38 failed to 144 / 0.std::terminate()(Cannot reliably convert LLVM pointer type, we cannot differentiate between Function and Private), which kills the whole test binary. They are the split-wave64, dispatch-chain and bridged-mask GPU tests,gpu_compute_mode_dispatch_abi,gpu_compute_thread_limits_leave_the_lanes_past_them_out, the twogpu_mesh_mode_*tests, andconsole_wave64_compute_through_the_pso_hook_dispatch_and_read_back, plusserialize_root_signature_strips_console_flags_and_preserves_pc_flags, whose null descriptor vkd3d-proton dereferences. The dxil-spirv ones crash the same way with vkd3d-proton master (f8c1cae8, dxil-spirv93ab44c5).mainwas run twice: same counts, same failure set.SKIPPEDlines (same asmain): no heap windows (2), no D3D12 debug layer (2-3), driver cache control not implemented in vkd3d-proton (1).Not tested: Windows, NVIDIA, a retail title /
scripts/smoke.ps1, a review of the diff. This is a test report, not amerge-check.AI use: omp (Claude Opus 5.5) merged, built and ran the suites on this machine, compared the results with
main, and drafted this report. The user asked for it to be posted.Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T17:22:29Z.
merge-check
base:
5eaadb54c1head:
24a84ca327verdict: not yet: the workspace abort affected both trees. The mixed-range allocation concern remains, and retail heap release and frame performance were unverified on this head.
Windows / AMD RDNA4 (native D3D12) — workspace suite and sparse heap checks on
24a84caClean merge onto
mainat5eaadb54(merge commitf882efbc75f69e7d01e9aff52d347240876622e4).git diff --checkwas clean.Setup
d3d12SDKLayers.dll, DXC 1.9.2609.5Tested
cargo build --workspacepassed.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputexited 101. The table reuses the recordedmainrun from the same commit, machine, SDK, and command.SKIPPEDnoticesmainCounts are partial because two test processes aborted on each build.
main— none observed in the comparable results.--exact --test-threads=1 --show-output. These cover hot heap classification, GPU readback from a system-backed lazy tile, replacing a parked system-backed tile with a video-memory tile, and releasing a fully free heap after cooling and fence completion.uploads_start_from_each_subresources_statepassed.Shared failures and process aborts
fuzz_validate_and_gpu_1,fuzz_validate_and_gpu_3, andtwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsreported failures on both builds.gpu_compute_e2etest processes exited with0xc0000409on both builds.Retail smoke
Ran
scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary>withXCL_UMA_DRIVER=mixedfor title hash2c508222. Themainrow is from the prior run under that setup.main0xc00004090xc0000409XCL_SPARSE_SYSMEM=10xc0000409The enabled run logged seven pool-allocation milestones, up to 256 MiB of system-memory pool heaps. It ended before retail heap reclamation could be measured.
Diff review
Read the full diff and confirmed the existing mixed-range concern in
materialize. Once a tile incrementsleft, later system-memory candidates also wait even if only video-memory allocation failed first.take_sys_tilecan also retry a refused system-memory heap creation on the next eligible tile when the video-memory fallback succeeds. Neither failure path was exercised in this run.Not tested
Tests after the aborts, retail pool reclamation, frame performance, and allocation behavior under forced VRAM pressure.
AI use
Codex (GPT-6) merged and built the PR, ran the tests and smoke checks, compared the results with the prior
mainrun, reviewed the diff, and drafted this report.Imported from ivall/xcl. Originally posted by UncommonDLL on 2026-12-02T18:18:30Z.
Following up on the retry reported above, we tested
24a84ca327cdbed51c37f2622585b2ea89d77336on an RTX 5070 Ti with NVIDIA driver621.40. In onematerializecall for two cold tiles, the test forced an out-of-memory response at the system-memoryCreateHeapboundary. We counted two heap creation requests of 4 MiB each.Video-memory fallback succeeded for both tiles, and each received a distinct slot. The only assertion that failed was the request count: expected one, observed two. This was a synthetic allocator test. No title was run.
Imported from ivall/xcl. Originally posted by UncommonDLL on 2026-12-02T18:25:37Z.
On
24a84ca3, I tested the repeated L0 heap request after successful video fallback. The fixture injectedE_OUTOFMEMORYat the 4 MiB system-memoryCreateHeapboundary. Video fallback and tile placement used native D3D12 on an RTX 5070 Ti, driver 621.40.For two consecutive cold
LAZYtiles in onematerializecall, the baseline made two refused requests. The candidate made one. The unchanged regression observed the same two successful DEFAULT placements in both runs: heap 0, slots 1 and 2. A second call on the same allocator made a fresh L0 request and placed a third tile in slot 3.The candidate checks reusable tiles and retired system heaps before suppressing another creation attempt. The refusal expires when
materializereturns. The sparse module finished with 146 passed, 0 failed, 1 ignored (early_commit_timing), and 0 runtime skips. OpenAI Codex implemented the candidate and ran the synthetic tests.The production patch applies independently to
24a84ca327cdbed51c37f2622585b2ea89d77336. To reproduce the tested source, apply the original regression, production change, and call-boundary test in that order.1. Original regression
2. Production change
3. Call-boundary test
Imported from ivall/xcl. Originally posted by throny on 2026-12-02T21:25:49Z.
Rebased onto main
5ad98adband fixed the two open points; new head84646d4d. Both fixes are folded into the first commit (the one that adds the system-memory tiles). The second commit is still only the heap retirement.(1) Cold tiles skipped after one tile finds no video memory.
materialize(sparse.rs:4004) used to wait onleft > 0. Now it keeps one "found nothing" flag per kind of memory (no_video,no_sys), so when a GPU heap's tile finds no video memory, the cold tiles after it in the same run still go to the system-memory pools. Theshort_of_memorywait still applies only to video-memory tiles. Test:a_gpu_heap_tile_without_video_memory_leaves_the_next_cold_tile_its_system_memory(sparse.rs:11694). It sets up a hot tile with no video memory (NO_TILES) next to a cold tile in one upload, checks that the cold tile gets aSYStile, and reads its bytes back from the GPU. It fails without the fix.(2) A refused system-memory heap is retried for every cold tile.
take_sys_tilenow records the time of a failedCreateHeapinState::sys_refused(sparse.rs:3669). For 1 s after that, cold tiles reuse free or retired system-memory tiles first and otherwise take video memory without asking for a new heap (sparse.rs:3646). This is the same 1 s waitno_memoryuses for video memory. Test:a_refused_system_memory_heap_is_not_asked_for_at_each_tile(sparse.rs:11724). A test-only switch (NO_SYS_HEAP,sparse.rs:580) makes the pools refuse. The test maps 3 cold tiles and checks for 1 heap request (it was 3 without the fix), then 2 requests once a second has passed.(3) "Workspace suite aborted on both builds." I don't think this PR causes it. The report's own table shows the same abort (
0xc0000409) in the lib andgpu_compute_e2eprocesses onmain, with the same counts. The PR doesn't touchgpu_compute_e2e. Every GPU test this PR adds callsskip_testwhen the adapter can't run it, and none of them sets anything up that could bring the process down rather than fail the test.Tested at
84646d4d(RTX 4080, Windows 11 26300, debug; a game run was using the GPU at the same time):cargo build --workspace-> ok.cargo test -p xcl --lib sparse -- --test-threads=1-> 164 passed, 0 failed, 1 ignored, 0 SKIPPED. With 4 threads: 164 passed, 0 failed, 1 ignored. Some GPU tests printedSKIPPED(no tiled resources tier 2) with 4 threads, and the PR head without these fixes did the same while the game run was going. With the two fixes undone, the two new tests failed (0 passed, 2 failed).Still open: showing the 3.8 GB coming back in a title run (finding 4). We will measure it.
The memory coming back, measured at
84646d4d: two 900 s warm runs. Peak video memory 18,948 MB withXCL_SPARSE_SYSMEMoff and 15,737 MB with it on (−3.2 GB, now at the 15.2 GB budget). 3.13 vs 3.01 presents/s (−4 %). No device removal or crash in either. The whole suite: 3011 passed, 0 failed. Smoke blocks are in the description.@Foniass @stijn-boer could you re-check
84646d4d? An AMD check would help too (gpu:both).AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T21:44:38Z.
merge-check
base:
5ad98adbc3head:
84646d4de8verdict: not yet: all six focused tests passed and the workspace abort affected both trees. Enabling sparse system memory moved frames and peak commit in opposite directions between the two tested stacks. On this head, retail heap release and repeatable performance remained unverified.
Windows / AMD RDNA4 — sparse system-memory heaps on
84646d4Follow-up for the later #3613 head. I applied #3707 at
912ff558e932264511f386eb8b7e97cbf7cf46e2to both test builds so the comparison isolates #3613 on top of that patch. Both local merges were clean andgit diff --checkpassed. The baseline wasmain+ #3707 at3a6d3b1206e84742d369309a7ca50651e1b42b59. The comparison build was #3613 + #3707 at56396bfec31a746d8cf4c66348a47628bfa09eff. Each build used a separate Cargo target directory for the reported runs.Setup
AMD Radeon RX 9060 XT (driver 32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332, Rust 1.100.0 debug, Agility SDK 1.620.2 with matching debug layer, DXC 1.9.2609.5.
Tested
cargo build --workspacepassed on both builds.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputexited 101 on both.SKIPPEDnoticesmain+ #3707Counts are partial because the library process exited with
0x80004005on both builds. No additional named failure appeared in the comparison. Both debug-layer E2E tests, including DRED, and the texture-state test passed on both.Focused sparse tests — 6 passed, 0 failed, 0 ignored, 0 skip notices with isolated libtest invocations using
--exact --test-threads=1 --show-output --nocapture. Both new regression tests passed. A hot tile that runs out of video memory leaves the following cold tile eligible for system memory, and a refused system-memory heap is not requested again for each successive tile. The heap-retirement test also passed.Shared failures and skips
fuzz_validate_and_gpu_1,fuzz_validate_and_gpu_3,gpu_smem_flat_descriptor_windows_and_limits,f32_programs_on_the_gpu,gpu_f32_compares_with_nan,gpu_float_compares_random, andgpu_ps_readfirstlane_loop_on_a_primitive_edge_ends.two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobsreported two failures on each build.two_pass_binds_set_the_shared_view_heapandheap_window_out_of_memory_falls_back_to_the_switch_formwith heap windows disabled.Retail smoke
Ran
scripts/smoke.ps1 -Game <local folder> -Seconds 60 -Xcl <debug binary>withXCL_UMA_DRIVER=mixedand a fresh data root for each run. Title hash2c508222.XCL_SPARSE_SYSMEMmain+ #37070x00x010x0All three runs logged zero device removals and zero crashes. The enabled run logged system-memory pool allocation milestones up to 512 MiB. On the same build, enabling the flag corresponded to about 14% fewer frames and 421 MB more peak process commit in this pair. One run per setting leaves repeatability and the cause open. The allocation milestones do not measure subsequent heap release or net VRAM savings.
Merge request
Could maintainers prioritize merging #3707 and #3455 once their required checks pass? In this retest, plain
mainexited before logging frames and the builds with #3707 completed the smoke run. The request for #3455 is based on the AMD tester’s separate experience of a substantial improvement on AMD cards.Not tested
A standalone #3613 retail run, retail heap reclamation and net VRAM savings, repeated performance pairs, and #3455 in this test configuration.
AI use
Codex (GPT-6) prepared the two local builds, ran the tests and smoke comparisons, reviewed the changed allocation paths, and drafted this report.
Follow-up with #3455 added to both builds
Same #3613 head,
84646d4de8e5655c32a1a9b20e9b0d987adb4da1, and samemainbase,5ad98adbc360225ac8a57ad9661e16fe8df9d8dd. Both local builds included #3707 at912ff558e932264511f386eb8b7e97cbf7cf46e2and #3455 at1895d9e8ea3c64f7e91f4a0211f2a7aacff5c525. The resulting baseline wascfdacf961cf9cced7aba34f4f11e6219ce55df2dand the #3613 build was5b9a3ea398a8c62fc9de5659d0c113a08b922ab5. Both merges were clean. Separate Cargo target directories were used.Tested
cargo build --workspacepassed on both.cargo test --workspace --no-fail-fast -- --test-threads=4 --show-outputexited 101 on both.SKIPPEDnoticesmain+ #3707 + #3455The library exited
0x80004005on both builds. These counts are partial. Both had the same named failures and skip notices listed in the earlier run above. Both debug-layer E2E tests and the texture-state check passed. All six focused sparse tests passed again in isolated libtest runs with--exact --test-threads=1 --show-output --nocapture, with zero skips.Retail smoke
Same AMD host, title hash
2c508222, and 60-secondscripts/smoke.ps1runs withXCL_UMA_DRIVER=mixed. Each run used a fresh data root.XCL_SPARSE_SYSMEMmain+ #3707 + #34550x00x010x0All three runs logged zero device removals and zero crashes. With both companion PRs included, enabling the switch corresponded to about 23% more frames and 31% lower peak process commit versus leaving it unset on the same build. The enabled run again logged a 512 MiB system-memory pool allocation milestone. This single pair reversed the earlier switch comparison. An isolated #3455 effect, repeatability, retail heap release, and net VRAM savings remain unverified.
Follow-up verdict — not yet. The combined smoke runs completed and the focused checks passed. Both full workspace runs still aborted.
Imported from ivall/xcl. Originally posted by Pipodi on 2026-12-02T22:08:53Z.
merge-check
base:
5ad98adbc3head:
84646d4de8merge: clean (
git merge --no-ffonto5ad98adb, merge 63f1ebe8; d3d12x/sparse.rs +448/-11, kernelx.rs +2/-1)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3011 passed, 0 failed, 52 ignored; failing: none (SKIPPED 25: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache). The six new sparse tests all ran and passed (none printed SKIPPED: the system-memory pool heap was made on this adapter).
title run: retail title on NVIDIA GeForce RTX 4090, no save, into the in-engine intro cutscenes, same env and frame presses for every run, 420 s each (ended by XCL_RUN_SECONDS). Switch off (default), two runs: 379 s and 370 s in the cutscenes (from the first 2 s window with cutscene draws to the end), 4.24 and 3.92 presents/s there (from the log's 2 s activity lines), 0 device removals, 0 crashes (exit 0x0), peak video memory 21201 / 21785 MB local, peak private 43.4 / 44.2 GB. Main
5ad98adb, two runs tonight: 4.83 presents/s over 388 s, exit 0x0, 21394 MB local, 43.5 GB; and a device hang (0x887a0006) on main itself at 297.8 s after 238 s in the cutscenes at 4.64 presents/s. With XCL_SPARSE_SYSMEM=1, one run: 390 s in the cutscenes, 4.82 presents/s, 0 removals, 0 crashes, peak video memory 16804 MB local (-4.4 to -5.0 GB against the switch-off runs) and 11834 MB non-local (+4.8 GB; the log grew the system-memory pools to 4096 MB), peak private 44.0 GB. Title binary = merge result + local scripted-press commits (input only) and two local log-only diagnostics, the same stack as the main runs.review: read the whole diff and the paths it changes in sparse.rs (
take_tile,materialize,ensure_mapped,retire_free_pools_with, the quarantine/cooling code). No blocking findings. 1) Switch off, the behaviour is the same as main:take_tile_forand thesystest short-circuit onsysmem_tiles()beforeis_hot, no tile getsSYS, and thematerializechange fromleft > 0tono_videogives the same waits (a tile that waited leavesshort_of_memory/at_handas they were, so the later ones wait too). What runs by default is one uncontendedSYS_POOLSlock per submit (the retire check) and per retire, an AddRef/Release of the heap inpool_heapper tile-mapping call, andnote_hot/forget_hotper sparse GPU heap alloc/free. 2) Lock order is State, thenSYS_POOLSeverywhere;take_sys_tiledropsSYS_POOLSbefore it falls back totake_tile; I found no path taking them the other way round. 3) The two points of the first check on24a84caare addressed on this head (no_video/no_sysper kind,sys_refusedfor 1 s), each with a test that passes here; the memory coming back (its point 4) shows above on NVIDIA. 4) Minor: withoutXCL_COHERENT_HEAPS=sparseno tile is "hot", so the switch puts every sparse-window tile in system memory (the 4 GB above);XCL_SPARSE_SYSMEMis not in README.md yet. 5)HOTis matched by the reservation's start address; whole-reservation releases only, which is whatsparse_releasedoes.performance: default off: nothing per frame beyond the lock and AddRef above; the switch-off runs (4.24, 3.92 presents/s) are below the main run (4.83), but the spread between runs of builds that cannot differ per frame is as large tonight (another PR whose diff is never called per frame: 3.86; main's second run 4.64 before it hung), and peak private and video memory match main. With the switch on: -4.4 GB video memory, +4.8 GB non-local, 4.82 presents/s, no removal.
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4090 24 GB, driver 621.40; Intel Core i9-13900K, 32 GB; Windows 11 build 26300; rustc 1.100.0, debug (tests) / release (title runs); Claude Code, Claude Opus 5.5
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:09:56Z.
Review: COMMENTED
Review of
84646d4d: 4 finding(s) (1 high, 3 medium), most severe first.crates/xcl/src/hle/d3d12x/sparse.rs:549: The system-memory pools (SYS_POOLS) are a process global, but the tiles, quarantine, fence (value/done) and device that drive them belong to oneState, so the pools don't follow that State's lifetime or device. (inline)crates/xcl/src/hle/d3d12x/sparse.rs:3650: When the system-memory pools are refused,take_sys_tilefalls back totake_tile()and skips the video-memory waitsmaterializeapplies to hot tiles (no_video, andshort_of_memory() && !at_hand). (inline)crates/xcl/src/hle/d3d12x/sparse.rs:3666:take_sys_tilecalls CreateHeap with the state lock held but without theflush_pending()thattake_tiledoes first, andtake_tile's comment explains why: a CPU signal waiting meanwhile gives up after 2 ms. (inline)crates/xcl/src/hle/d3d12x/sparse.rs:488: TheSYStag (bit 31) overlaps the sentinelsLAZY = (u32::MAX, u32::MAX)andSHADOW_POOL = u32::MAX, sopool.0 & SYS != 0is also true for a tile with no memory or a shadow tile. (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:09:56Z.
Code review location:
crates/xcl/src/hle/d3d12x/sparse.rs; line 549High: The system-memory pools (
SYS_POOLS) are a process global, but the tiles, quarantine, fence (value/done) and device that drive them belong to oneState, so the pools don't follow that State's lifetime or device.initcan replace STATE (when the windows are set up again). The old State takes its mapped, parked and quarantined SYS tiles with it, so their heaps never become all free and leak. Entries inSysPools.retiredkeep the old fence's marks and are compared with the new fence'sdone, which restarts at 0, so heaps can be reused while the GPU may still use them. A new State on another device then maps heaps made on the old device (pool_heap-> UpdateTileMappings), which gives a D3D12 error or device removal. Owning the system pools in State, like the video pools, would fix all three.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:09:57Z.
Code review location:
crates/xcl/src/hle/d3d12x/sparse.rs; line 3650Medium: When the system-memory pools are refused,
take_sys_tilefalls back totake_tile()and skips the video-memory waitsmaterializeapplies to hot tiles (no_video, andshort_of_memory() && !at_hand). After a hot tile fails to get video memory (settingno_video/no_memory), the next cold tile computeswait = no_sys(false) and callstake_sys_tile, which within 1 s ofsys_refusedgoes totake_tile(), runsflush_pendingand another failing CreateHeap, and logs 'no video memory for more tiles'. This repeats on everymaterializein that second, which is exactly whatno_memory/short_of_memoryprevent. When it does succeed, cold tiles take video memory while hot GPU-heap tiles are made to wait. Respectingno_videoin the fallback would fix it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:09:57Z.
Code review location:
crates/xcl/src/hle/d3d12x/sparse.rs; line 3666Medium:
take_sys_tilecalls CreateHeap with the state lock held but without theflush_pending()thattake_tiledoes first, andtake_tile's comment explains why: a CPU signal waiting meanwhile gives up after 2 ms. Tiles already pending inself.pending(e.g. from earlier iterations of the sameensure_mappedloop) aren't sent before the slow custom-L0 CreateHeap, so a title queue or CPU signal waiting on their mapping times out, the regressiontake_tileguards against. Callingflush_pending()first would match.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T22:09:57Z.
Code review location:
crates/xcl/src/hle/d3d12x/sparse.rs; line 488Medium: The
SYStag (bit 31) overlaps the sentinelsLAZY = (u32::MAX, u32::MAX)andSHADOW_POOL = u32::MAX, sopool.0 & SYS != 0is also true for a tile with no memory or a shadow tile. Ina_lazy_tile_outside_the_gpu_heaps_gets_system_memory,assert_ne!(s.mapped[&base].pool.0 & SYS, 0, ...)passes when the tile is still LAZY, so that check proves nothing. Any SYS check that sees a LAZY or shadow entry (incool,pool_heaporpool_bytes) would treat it as system heap 0x7FFF_FFFF, soFreePools::pushwould resizeby_heapto 2^31 entries, orpool_heapwould index out of bounds and panic. Excluding the sentinels in anis_sys()helper would close it.Imported from ivall/xcl. Originally posted by throny on 2026-12-02T22:16:00Z.
@stijn-boer thanks for the AMD run. On the two points:
main+ #3707 (1584 passed, 9 failed, 47 ignored on both builds). So it comes from the base or the machine, not from this PR. On an RTX 4080 the whole suite runs through at84646d4d(3011 passed, 0 failed).XCL_SPARSE_SYSMEM=1), and without the switch nothing changes.Did the RX 9060 XT reach the world with the switch on, and how much video memory did it save there?
AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by throny on 2026-12-03T01:43:59Z.
Thanks for the third round. One of the four points is a real bug and is fixed. The other three are explained below with what I would do as follow-ups. Since the code changed, the merge check claimed on
84646d4dhas to be redone on the new head (b98038bb4, amended locally, not pushed yet when this was written).3. Medium:
take_sys_tilecalls CreateHeap withoutflush_pending(). Fixed in our commit (the second one). Before it asks for a new system-memory heap,take_sys_tilenow sends the pending mappings (crates/xcl/src/hle/d3d12x/sparse.rs:3663-3668), astake_tiledoes. It releases theSYS_POOLSlock for that and takes it again, becauseflush_pending→map_tiles→pool_heaptakes it, and keeping it would deadlock. Test:pending_mappings_go_out_before_a_system_memory_heap_is_made(:11758). A GPU-heap tile takes video memory and waits for its mapping, then a cold tile asks for a system heap. The test records how many tiles are pending at that moment: 0 with the fix. Without it the test fails (left: 1, right: 0); I checked that by removing the flush and running it.1. High:
SYS_POOLSis process-global while the tiles and fence are perState. Correct as a description of the structure, but no title run can reach it.sparse::initis called only fromreal::open_uma, and that runs only frominit_with_remapwhen no device exists yet.init_with_remapreturns early onceDEVICEis set, and the device is kept for the life of the process. So a process has one device and oneState, and thatStateis never replaced while system tiles exist. All three effects need a secondinit: leaked heaps, retired marks compared with a new fence, and heaps of an old device mapped by a new one. The unit tests make their ownStates on the one adapter's device (D3D12 gives the same device for the same adapter), so they do not mix devices either. Owning the pools inStateis the right shape, and I would do it as a follow-up. It moves the carried commit's structure (everySYS_POOLSuse plussys_pool_bytes), which I would rather not do inside this PR.2. Medium: the fallback to
take_tile()skips the video-memory waits. The fallback happens, but only when both kinds of memory fail in the same second: the system heap was refused less than 1 s ago and video memory is short. Even then, eachmaterializecall makes at most one failingCreateHeap, because the firstNonesetsno_sysfor the rest of the call. That is the same as what every eager tile does on main:ensure_mappedcallstake_tilewith noshort_of_memorygate. The cost is a log line and a failing call permaterializeduring that second, not a wrong mapping. A follow-up can treat a cold tile as a video tile inmaterialize'swaitwhilesys_refusedis recent. I would rather not make that change and reset the merge check for it.4. Medium:
SYS(bit 31) overlaps theLAZY/SHADOW_POOLsentinels. True of the encoding, but noSYScheck sees a sentinel.pool_heapis reached throughmap_tiles, which asserts that no tile isLAZY, and buffer tiles filterLAZYout.coolis reached throughrelease_if_unusedanddrain_quarantined_with, which only handle real pool tiles.pool_bytesonly counts quarantined tiles. A sentinel reaching any of these would already break the video path on main:FreePoolswould be indexed withu32::MAX, orpools[u32::MAX]used. SoSYSadds no new way to reach them. Ina_lazy_tile_outside_the_gpu_heaps_gets_system_memory, the& SYSassertion alone would pass forLAZY, as you say. But the next assertion compares the window's bytes with the written tile, and aLAZYtile reads zeros, so the test still fails if no tile was given. Anis_sys()helper that leaves out the sentinels is a good hardening follow-up.Tests (Windows, debug, RTX 4080):
cargo test -p xcl --lib d3d12x::sparse -- --test-threads=4was run 3 times on the new head, each with 147 passed, 0 failed, 1 ignored (early_commit_timing) and 0 SKIPPED. Runs with the default thread count (24 here) sometimes failed or hung, withE_OUTOFMEMORYfromCreateCommandQueue. That happened on84646d4das well, so it is not this change.Each round has found new points so far. Would the remaining ones (1, 2, 4) block the merge, or can they be follow-ups once this round is in?
Pushed as
b98038bb. The whole suite passes there (3012 passed, 0 failed), and the smoke block in the description is updated.AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by throny on 2026-12-03T01:44:10Z.
@Pipodi heads-up for your merge-check claim: the head moved from
84646d4dtob98038bb(one fix from bmjask's review: pending tile mappings are sent before a system-memory heap is made; details above). Sorry for the extra round. AI use: Claude Code (Claude Opus 5.5).Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T04:45:12Z.
merge-check
base:
078358a058head:
b98038bb43merge: clean
build: ok
tests: 3013 passed, 0 failed, 52 ignored; 28 skipped, the same as on main
review: 5 medium, 3 nits (below)
performance: 60 s smoke run: 1669 → 1649 frames (98 % of main), peak commit 17577 → 18134 MB, no device removal, no crash
title run: retail title on the RTX 5070 Ti (driver 621.14), into the world by scripted presses: 221 s there, 0 device removals, 0 crashes, 2.6 presents/s; run with
XCL_SKIP_CS=95cc13288a27a96e(the NVIDIA hang at the end of loading, #3541) and NVIDIA's 2048 MB shader heap (#2590)verdict: not yet:
PR descriptionis red; otherwise no blocking finding, the suite passes and the smoke run is cleanhardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
In short: The PR carries #2987's opt-in XCL_SPARSE_SYSMEM commit and adds retirement of system-memory pool heaps whose tiles are all free. The new push (range-diff against
84646d4d) only adds flush_pending before a system-memory heap is made, with a test, and the rest of the diff is unchanged. Nothing blocks merging and the default path is unchanged, but the earlier medium points (cold-tile fallback skipping the video waits, kept SYS tiles at GPU-heap addresses, untested retirement wiring, a description that no longer matches the commits or the head) are still open.Medium
15b74314shows sys_refused, no_video/no_sys, NO_SYS_HEAP and their tests folded into it under Trey Bertram's authorship. Tested and both smoke blocks name84646d4d, notb98038bb. AI use names only Claude Sonnet 5.5, while the second commit now also carries Opus 5.5 and the folded-in fixes were written with Opus 5.5 (per the PR comments). Say what was added to the first commit and by whom (or split the fixes into their own commit), and rerun the suite and smoke atb98038bb.15b74314with a different version of the same first commit, so merging either one leaves the other conflicting. Its review points now live only here. Close #2987 in favour of this PR, or rebase this one onto it, and note it in #1607 (group D262 with #3112; #3620 is also an opt-in L0 spill of the sparse pools).Nit
Checked and fine
How this was tested
078358a0, thencargo build --workspaceandcargo test --workspace --no-fail-fast -- --test-threads=4.scripts/smoke.ps1: 60 s of a retail title on main078358a0and on this merge; presents per 2 s at the end: 61 60 60.XCL_RUN_SECONDS=300and scripted A presses counted from the first frame (XCL_PRESS_BASE=frame, #3712) into the world from an existing save; time in the world is counted from the first in-world draw call to the end of the run.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Pipodi on 2026-12-03T05:42:26Z.
merge-check
base:
395405e4c0head:
b98038bb43merge: clean (
git merge --no-ffonto395405e4, merge 641b2e09; d3d12x/sparse.rs +479/-11, kernelx.rs +2/-1). main changed sparse.rs since the last check (#3702, staged-upload hashing); it does not touch the pool, tile or pending-mapping code this PR changes.build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3019 passed, 0 failed, 56 ignored; failing: none (SKIPPED 25: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache). The seven new sparse tests all ran and passed (none printed SKIPPED). With the new
flush_pending()taken out again,pending_mappings_go_out_before_a_system_memory_heap_is_madefails (left: 1, right: 0), so the test covers the fix.title run: retail title on NVIDIA GeForce RTX 4090, no save, into the in-engine intro cutscenes, same env and frame presses for every run, 420 s each (ended by XCL_RUN_SECONDS); the binaries were warm (the measured-run gate passed). Presents/s are counted from the first 2 s activity window with more than 5000 dispatches (the cutscene's first) to the end. This differs from the 3000-draw window of my last check, so the numbers here are lower than there. Main
395405e4, two runs: 330 s and 342 s in the cutscenes, 2.02 and 2.09 presents/s, 0 removals, 0 crashes, peak video memory 21169 / 21550 MB local, peak private 43.4 / 44.2 GB. This PR, switch off (default), three runs: 338 s and 338 s at 2.01 and 2.11 presents/s, exit 0x0, 21225 / 21665 MB local, 43.4 / 44.7 GB. The third run hit a device hang (0x887a0006) at 210.7 s, after 89 s in the cutscenes at 1.98 presents/s. DRED reported device state 7 and no page fault, the same signature as the hang on main5ad98adbitself in my last check (297.8 s). No system-memory heap was made in that run. With XCL_SPARSE_SYSMEM=1, one run: 336 s in the cutscenes, 2.02 presents/s, 0 removals, 0 crashes, peak video memory 16622 MB local (-4.6 to -5.0 GB against the switch-off runs) and 11924 MB non-local (+4.9 GB; the system-memory pools grew to 4096 MB, no heap refused), peak private 44.0 GB. Title binary = merge result + local scripted-press commits (input only) and two local log-only diagnostics, the same stack as the main runs.review: read the incremental diff 84646d4d..b98038bb and the whole merge diff again. No blocking findings. 1) The fix:
take_sys_tiledropsSYS_POOLS, callsflush_pending()and locks again beforeCreateHeap, astake_tiledoes. Re-locking is needed becausemap_tiles->pool_heaptakesSYS_POOLS. Nothing read before the unlock is used after it:refuseis a test switch, andpis taken again. The State lock stays held, and there is one State per process, so the free/retired lists cannot change in between. If the flush's submit retires a heap meanwhile, a new heap is made instead of taking that one back, which is harmless. 2) Switch off, the behaviour is still the same as main: the new code is only on the system-memory path, whichtake_tile_fordoes not enter withoutXCL_SPARSE_SYSMEM. 3) The three review points left as follow-ups (pools process-global; the fallback totake_tileduring the 1 s after a refusal; theSYSbit overlapping the sentinels) are as the author describes on this head. I found no path where a title creates a secondState, and noSYScheck that seesLAZY/SHADOW_POOL. 4) The other check on this head points out that akeptsystem-memory tile (XCL_VIEW_KEEP) is taken back unchanged at an address that is now in a GPU heap (ensure_mapped: onlyparkedtiles are swapped). I see the same. The tile is still mapped, so it costs speed, not correctness, and only with the switch on. 5) Minor, as before:XCL_SPARSE_SYSMEMis not in README.md. When I looked, onlyCIhad reported on this head (green);PR checkshad not.performance: default off: nothing per frame beyond one uncontended
SYS_POOLSlock per submit and an AddRef/Release per tile-mapping call (same as the last head). Measured: the two full switch-off runs (2.01, 2.11 presents/s) match main's two runs (2.02, 2.09), and peak video and private memory match. The one device hang is not from this diff: it happened with the switch off, after no system-memory tile was ever made, with main's own hang signature. With the switch on: -4.6 to -5.0 GB video memory, +4.9 GB non-local, 2.02 presents/s, no removal.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4090 24 GB, driver 621.40; Intel Core i9-13900K, 32 GB; Windows 11 build 26300; rustc 1.100.0, debug (tests) / release (title runs); Claude Code, Claude Opus 5.5
Replaces my check of
84646d4d(head moved).Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-03T06:48:54Z.
@throny when I tested it main still wouldn't reach world loading on main.
That's is why I would kindly request you to merge in #3707 and #3455 as they help get further.
I'll check today if I can find some combination of PRs that will let me run all test.
Imported from ivall/xcl. Originally posted by throny on 2026-12-03T17:20:52Z.
@stijn-boer thanks. On our side, current main reaches the world:
e99b0bdf, release, plus our scripted-press patch.XCL_RESIDENCY_PRIORITY=1, starting on an empty shader cache.So what stops you there may depend on your setup. Could you post your GPU and driver, the commit you ran, the switches you set, and the last lines of the log before it stops (counts and messages only, no game data)? Then we can see whether #3707 or #3455 is the actual fix for you.
#3707 is already merged (12:48 UTC today), so main
e99b0bdfincludes it. Merges are paused for the moment; I am running a merge check of #3455 now.Claude Code, Claude Opus 5.5 (ran the test and wrote this).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.