Memory: lazily map sparse VRAM tiles for Wine graphics heaps (#175) #871
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/877"
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 gustavsi on 2026-11-24T07:12:42Z.
Lazily allocate 64 KiB sparse VRAM tiles for overflow
PAGE_GRAPHICS_*heaps under Wine/vkd3d-proton so zero-filled or untouched pages do not exhaust local VRAM on 16 GiB GPUs. Part of #175, #1701, and #1773.Stacked on #871 (
cb3902a4); only the top commit (3b76b082) belongs here.In #871, overflow
PAGE_GRAPHICS_*heaps under Wine are routed into the sparse VRAM windows instead of the capped coherentuserptrwindow. Eagerly committing 64 KiB VRAM tiles for the entire allocation up front consumes ~3.2 GiB of local VRAM for zero-filled or never-written pages before a retail title even leaves the menus (dropping local VRAM usage on a 16 GiB RX 9060 XT from ~11.6 GiB to ~8.1 GiB in menus, and independently verified on an 8 GiB RTX 4060 Laptop at 6.5 GiB peak VRAM over 300 s and on an RX 9070 at −2.36 GiB VRAM / −43% mapped tiles).All lazy-allocation paths are gated behind
util::under_wine()(withsparse::ensure_lazy_mappedshort-circuiting when no lazy ranges exist); native Windows behavior is unchanged.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs: addalloc_lazy(commits CPU pages up front so host accesses never fault, while deferring 64 KiB VRAM tile allocation until first non-zero CPU write during dirty-page upload or explicit GPU write-target mapping viaensure_lazy_mapped), clean up lazy ranges onfree, integrate with upstream parked-tile decommit / retired pool reuse / quarantine (#532/#923/#2345), and add unit tests covering lazy-range overlap, hole masks, non-zero page detection, and coalesced lazy tile allocation.crates/xcl/src/hle/kernelx.rs: usesparse::alloc_lazyunderutil::under_wine()for overflowPAGE_GRAPHICS_*sparse allocations.crates/xcl/src/hle/d3d12x/real.rs&crates/xcl/src/hle/d3d12x/list_x.rs: callsparse::ensure_lazy_mappedwhen registering placed buffers, buffer UAVs, and command-list GPU memory writes so GPU-written ranges have tiles mapped before execution.Tested
GE-Proton11-14-x86_64,vkd3d-proton(-Db_ndebug=true), DXC 1.9.2609.5, cross-compiledx86_64-pc-windows-msvc(clang-cl+lld-link).cb3902a4, onmainf9a0cb80+ #867021b2c33) at3b76b082(no conflicts, commit diff unchanged) and verified underGE-Proton11-14(--test-threads=1unless noted,XCL_DXC_DIRset):hle::d3d12x::sparse::: 18 passed, 0 failed, 1 ignoredhle::d3d12x::vram::: 19 passed, 0 failed, 1 ignoredgpu::uma::: 12 passed, 0 failed, 0 ignoredhle::d3d12x::title_textures::: 21 passed, 0 failed, 0 ignoredhle::d3d12x::alloc_pool:: --test-threads=4: 4 passed, 0 failed, 0 ignoredpwsh ./scripts/smoke.ps1(withGE-Proton11-14wrapper,XCL_PREPARE=0):855frames shown (PresentX 855,41 13 0/2 s),exit: 0x0,0crashes,0device removals.Regression run
Produced under Wine (
GE-Proton11-14, AMD Radeon RX 9060 XT,XCL_PREPARE=0 XCL_NETWORK=0 XCL_PSO_PRELOAD=0 XCL_RUN_SECONDS=60 XCL_ACTIVITY=1,VKD3D_CONFIG=""). The PR run used unmodifiedpwsh ./scripts/smoke.ps1via a thin Wine wrapper;main(e0d93c84) crashed before writingreport.json, so its block was extracted from the samexcl.log(peak commit: 0 MBis what Wine reports inxcl.log).main(e0d93c84):This PR (
3b76b082, stacked on #871):Not tested
util::under_wine()).AI use
Gemini 4 Neon) restacked cleanly onto updated #871 (cb3902a4, onmainf9a0cb80), ran the Proton tests and 60 s smoke run at3b76b082, and updated this description.da893f3averification.mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #172mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #172Imported from ivall/xcl. Originally posted by oeirughrepuiohg on 2026-11-24T07:56:41Z.
Linux + NVIDIA data point for this stack (#867 → #871 → #877): the retail title crashes about 20 s after start with it, and does not without it.
Setup: RTX 4070 Ti 12 GB (620.70.06), Fedora 45 kernel 7.3, GE-Proton11-14 Wine with its
default_pfx, vkd3d-protoncae8353e+scripts/linux/vkd3d-proton-xcl.patch(-Db_ndebug=true),VKD3D_CONFIG=ignore_shared_fence. Base:main1ec4c98+ #793 #820 #759 #640 #889 #891 #826.err:vkd3d-proton:vkd3d_realloc: Out of memory., with an access violation reading0xfffffffffffffffffrom outside any module. Once withXCL_COHERENT_MB=1024, once with it unset.Not root-caused. The common factor with the stack is the overflow
PAGE_GRAPHICS_*heap routing into the sparse VRAM windows, so this may be NVIDIA-specific (the PR text mentions amdgpu). Our vkd3d-proton still carries the vtable patch; I have not yet tried #867's path on stock vkd3d-proton.AI-assisted (Claude Code). No game data attached.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #172Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-24T08:29:24Z.
Rerun on the new head
3b76b08(the stack rebased ontomainf9a0cb8; #871's commit has the conflict resolution intitle_textures.rs, the other two are unchanged): still passes on native Windows / NVIDIA.cargo test --workspace --no-fail-fast -- --test-threads=4(head = merged): 1470 passed, 0 failed, 47 ignored, 25SKIPPEDlines.hle::d3d12x::title_textures::(21 tests) at--test-threads=8: 3 of 3. The e2e debug-layer messages match currentmain's: 3× error id 93, 1× error id 1046, 1× warning id 820, 2× warning id 926 (onmainsince #2977), 8× id 0. Same RTX 3060 (driver 610.88), Rust 1.100.0, debug. Not tested: Wine / vkd3d-proton. The reports below are for older heads.Rerun on the new head
2935240(this commit and #871's unchanged, now on #867'sd9e6ad5): still passes on native Windows / NVIDIA.cargo test --workspace --no-fail-fast -- --test-threads=4, merged ontomain8b957be(clean): 1452 passed, 0 failed, 47 ignored, 25SKIPPEDlines. The merged tree's e2e debug-layer messages are the same asmain8b957be's: 3× error id 93, 1× error id 1046, 1× warning id 820, 8× id 0 at exit. Same RTX 3060 (driver 610.88), Rust 1.100.0, debug. Not tested: Wine / vkd3d-proton. The reports below are for older heads.Rerun on the new head
b112fe7(the whole stack rebased): still passes on native Windows / NVIDIA.cargo test --workspace --no-fail-fast -- --test-threads=4, now with no--skip: 978 passed, 0 failed, 45 ignored. Merged onto main5796cc4(no conflicts): 1060 passed, 0 failed, 45 ignored.lazy_range_helpers_track_tile_overlap_holes_and_nonzero_pages: 10 of 10. The e2e debug-layer messages on the merged tree are the same as main5796cc4's (3× id 93, 1× id 1046, 1× warning id 820). Same RTX 3060 (driver 610.88), DXC 1.9.2602.17, debug. Not tested: Wine / vkd3d-proton. The report below is for2f81d51.Native Windows / NVIDIA run, since Not tested lists native Windows.
Tested
2f81d51f555e42d845b69746570470f6cd4cb7e8(the whole stack:593b2e2#867,de6d71c#871,2f81d51this PR), clean worktree, not merged ontomainstable-x86_64-pc-windows-msvc; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); debugcargo build --workspace, thencargo test --workspace -- --test-threads=4 --skip a_freed_block_is_decommitted_before_its_address_is_reused: 715 passed, 0 failed, 41 ignored, 1 filtered out (lib 674 / 0 / 21). The skip is #913: on this 12 GB card, that test fills video memory and makes unrelated tests fail withE_OUTOFMEMORY.hle::d3d12x::sparse::tests::lazy_range_helpers_track_tile_overlap_holes_and_nonzero_pagesgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareXCL_SAMPLE_*not setNot tested
smoke.ps1run here), and anything under Wine. Since the changes are behindunder_wine(), this only shows the native Windows path is unchanged in the test suite.AI use
Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-24T08:09:52Z.
Linux / AMD RDNA3 lane report, head
2f81d51merged onto main1ec4c98(lane merge shas: 877d905182, 8718e45b96, 867ad333d2- see my note that all three of the #175-cluster PRs show the identical signature, whichever lands).This PR hard-crashes the test harness on my Wine/RDNA3 lane. Not a test failure: the lib test binary dies with exit status 5, no panic message, no failure list. Everything after it (e2e, gpu_compute_e2e, pls_quota, predication_e2e targets) then fails to run, which is why the lane totals look collapsed (36 passed / 2 suites).
Crash point, pinned with sequential runs (
--test-threads=1): it dies at or immediately aftergpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem, the sparse-VRAM test. That test passes clean on plain main1ec4c98on this exact rig (3 separate lanes this batch,... ok), and passed on this rig before. So the crash is attributable to this PR's change to the sparse/VRAM path, not the environment.Reproduced 3/3: full-suite lane run, isolated lib rerun, and a
--test-threads=1run.Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #172Imported from ivall/xcl. Originally posted by Filip722 on 2026-11-24T11:37:57Z.
I tested
2f81d51together with #871 on an RTX 5060 Laptop GPU (8 GB, NVIDIA 615.78.08), Bazzite 44 and Proton Experimental11.0-20261112. The test stack was XCL47efa2eplus #640, #793 and #820, vkd3d-proton v3.1 with the #257 compatibility changes and dxil-spirv1dc543f. Offline Series X,XCL_COHERENT_MB=512,XCL_PAGE_BUDGET_MB=2048andXCL_TRACE_MEM=5000.The trace recorded four lazy fallback reservations totaling 4,532 MiB of virtual address space. XCL sampled 1,846 presents and 45,240 DirectStorage executions with zero storage failures before the loading run hit the same
vkAllocateMemoryaccess violation as the preceding run without #871/#877. The last sample showed 3,075 MB mapped in 3,136 MB of sparse pools, and 6,658 MB local plus 4,117 MB non-local video memory. This confirms the lazy path ran on NVIDIA. I did not make a separate eager-#871 run to measure the savings from #877 alone.OpenAI Codex with GPT-6.2-Sol high assisted with the test and report.
upstream-sync referenced this pull request2026-11-24 13:02:56 +00:00
Imported from ivall/xcl. Originally posted by TobiasFornell on 2026-11-24T12:26:59Z.
Adding an AMD data point to @oeirughrepuiohg's report: the
vkd3d_realloc: Out of memorycrash after rebasing is not NVIDIA-specific.Tested: RX 9070 XT (RDNA4), Mesa RADV 26.3.1, CachyOS (kernel 7.3), Proton Experimental
11.0-20261112Wine, vkd3d-proton v3.1 fromscripts/linux/build-vkd3d-proton.sh(ndebug, dxil-spirv53aac418), retail title 1.0.2.1,XCL_NETWORK=0.beaa245: 8 min at a steady 30 fps on the first screen, no crash. Sparse write-watch 57 ms for the first report, vs. ~105 s (78M dirty pages) on an oldermainwithout the stack – the big win.main47efa2e: frames up to 28 fps, then 10–20 s later during loadingerr:vkd3d-proton:vkd3d_realloc: Out of memory.and0xc0000005reading0xffffffffffffffff– same signature as above. Merge resolved with theUnadoptGuards moved into thealloc_pool::reset_listclosures (onpc_alloc), plus upstream'sdecommit_rangewith this PR'slazy_changedbump.main(no other PRs), 2/2 runs.XCL_ALLOC_SWAP=0→ notalloc_pool.mainalone does not crash within 120 s on the same setup.9aec53d) and the parked-tile decommit (7f94c6f), both newer than this PR's base. A rebase by the author would settle it; happy to test it on RDNA4.Testing and write-up assisted by Claude Code (Claude Opus 5.5); runs on my own hardware, checked by me. No game data attached.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #172Imported from ivall/xcl. Originally posted by TobiasFornell on 2026-11-24T13:25:34Z.
Follow-up on the same RDNA4 setup, this time on the stack's own base (
2f81d51onbeaa245, no rebase) with a real controller, to get past the first screens:unhandled exception 0xc0000005 in ucrtbase.dll+0x1720b (read at address 0x400016000)– a memcpy fromxcl.exe+0x17ecdd. That address is inside the 512 MB coherent window (UMA: … 512 MB coherent window at 0x400000000, 83/512 MB in use).video memory 15110 MB local, 528 MB non-local; sparse pools 3264 MB (3209 MB mapped)– VRAM nearly full on a 16 GB card – andDirectStorage … 16 failedin the last activity sample.vkd3d_realloc: Out of memoryhere; that only appears on the rebased stack.So on its own base the stack gets much further on AMD than before, but a page of the coherent window is unreadable when the title copies from it under VRAM pressure. Happy to run a build with extra logging if useful.
Testing and write-up assisted by Claude Code (Claude Opus 5.5); runs on my own hardware, checked by me. No game data attached.
Imported from ivall/xcl. Originally posted by crastinator on 2026-11-24T15:44:11Z.
Review: COMMENTED
Tested on RDNA2 under Proton with a patched vkd3d-proton: no new failures, and that includes the commits from #867 and #871 under it.
Tested (head
2dc68c2, merged ontomain930e8b4: no conflicts)-Db_ndebug=true, dxil-spirv53aac418from #775), DXVK v3.1.1-209dxgi, DXC 1.9.2609.5, libopus 1.5.2,XCL_REQUIRE_GPU=wave64,mesh(0 SKIPPED)x86_64-pc-windows-msvc(clang-cl / lld-link, xwin SDK 10.0.26100), Rust 1.99.1, debugcargo test -p xcl --lib -- --test-threads=1plus every integration test (--test '*' -- --test-threads=1), compared per test with the same runs onmain930e8b4.mainhere: 8 stable Wine-lane failures (#530 ×2, #676, #890 ×2, e2e,pls_quota#810,predication_e2e#1272). Separately,title_textures::{placed_title_textures_share_vram_and_preserve_pixels, transitions_apply_when_their_list_is_submitted}andvram::d32s8_targets…fail together in 2 of 5mainruns (the #718 family), so I do not count a pass of those as a fix either way.main: 740 / 11 / 41, with the #718 flakes failing in that run). No test fails here that passes onmain.hle::d3d12x::sparse::tests14 passed and 1 ignored.Not tested
XCL_SAMPLE_*was set, so the tests that read them (about 66) pass without running.AI use
upstream-sync referenced this pull request2026-11-24 16:05:46 +00:00
Imported from ivall/xcl. Originally posted by gustavsi on 2026-11-24T15:14:14Z.
Rebased onto
main(930e8b4) + updated #867 (46944c2) + #871 (45b805c) at2dc68c2:vkd3d_realloc: Out of memory/0xffffffffffffffff/ exit-5 crashes (@TobiasFornell, @oeirughrepuiohg, @SlopTart): root-caused and fixed in #867 (late_releasewas signalling un-adoptedsparse::queue()with aFenceProxyfromdev_create_fence, now usingreal::create_raw_fence), and rebased cleanly onto upstream's parked-tile decommit (#532) and retired-pool reuse (#923).crate::gpu::shader::readableguard before hashing coherent-window textures in #871.late_releaseandalloc_poolenabled:sparse::tests14/0/1,real::24/0,list_x::26/0,late_release::2/0,alloc_pool::3/0,gpu_sparse_vram_descriptors_buffers_and_xmem1/0 (with DXC, 0 skipped), and a clean 60 s smoke run (exit 0x0,1084frames shown,0crashes,0device removals). Thanks @Filip722, @TobiasFornell, and @fromthemoonx for testing!Imported from ivall/xcl. Originally posted by TobiasFornell on 2026-11-24T15:39:55Z.
Retested
2dc68c2(#877 rebased on930e8b4, with #86746944c2+ #87145b805c) on RX 9070 XT (RDNA4) / RADV 26.3.1 / Proton Experimental's Wine + vkd3d-proton v3.1 fromscripts/linux(ndebug), title 1.0.2.1:vkd3d_realloc: Out of memory→0xffffffffffffffff) is gone: boots, first game frame 3840x2160, account picker at 30 fps, no device removal.gpu::shader::readablecheck intitle_textures.rsonly guardscontent_hash; this fault is amemcpyreading from the coherent window, so it looks like a second path (the copy after the hash, or another reader). I could only symbolize+0x33080(eh::cpp_exception_logger), the real caller is not in the printed frames.Happy to rerun with extra logging around coherent-window copies.
Testing and write-up assisted by Claude (AI); runs on my own hardware.
Imported from ivall/xcl. Originally posted by gustavsi on 2026-11-24T16:45:16Z.
Rebased onto
main(b7aa9f3) + updated #867 (6e94390) + #871 (b66a150) atfbf1440:0xc0000005read fault at0x400016000(@TobiasFornell): found the exactucrtbase.dllmemcpypath intitle_textures.rs(read_committedhad a coherent-window fast path callingstd::ptr::copy_nonoverlappingdirectly, andtitle_bytesborrowed a raw slice acrosssubresources). Fixed in #871 (b66a150) by routing coherent-window reads inread_committed,title_bytes, andrefreshthroughcopy_committed_region(ReadProcessMemory) under Wine so an unreadable coherent page zeroes cleanly instead of faulting.GE-Proton11-14/vkd3d-proton ec20719452e916b(-Db_ndebug=true):sparse::tests15/0/1,real::29/0,list_x::26/0,late_release::2/0,alloc_pool::3/0,gpu::uma::tests7/0,title_textures::tests13/0,dstorage::tests17/0,--exact gpu_sparse_vram_descriptors_buffers_and_xmem gpu_valu_float_and_int2/0, and a clean 60 s smoke run (exit 0x0,1166frames shown /1166PresentX,52 47 31presents/2 s,0crashes,0removals). Thanks @TobiasFornell and @crastinator for testing!Imported from ivall/xcl. Originally posted by TobiasFornell on 2026-11-24T18:07:58Z.
Correction to my two earlier reports here (13:25 and 15:39 UTC): the
read at address 0x400016000crash is not a coherent-window fault. The stack points to theCopyFromSubresourceargument mismatch from #662 (fix: #684). With #684 on top, the title now callsCopyFromSubresourcewithout faulting (see below).What the crash report shows (run on
20df0cf=2dc68c2+ #1395 + cmt8'sUnadoptGuardhint, Proton Experimental's own vkd3d-proton, RX 9070 XT; xcl'sreport.json, symbolized withllvm-symbolizerand the build'sxcl.pdb):0x400000000is the UMA base, i.e. the start of sparse window 0 (MEM_RESERVE | MEM_WRITE_WATCH, not committed). The 512 MB coherent window starts at base + 3 × 4 GiB =0x700000000(uma.rs,for_runtime_with). I misread the startup lineUMA: 3 sparse VRAM window(s) (12 GiB VA) + 512 MB coherent window at 0x400000000: the address there is the base of all four windows.copy_from, sosrcgets what #662 callsa5. The faulting address fitssrc= UMA base + subresource offset. I did not log the raw arguments.ReadProcessMemoryrouting added to #871 (b66a150) for my report is not needed for this crash. Sorry for the noise, @gustavsi.Retest with #684:
fbf1440(this PR, with #8676e94390+ #871b66a150) + #1395fd97d91+ #684e56dbc3+ cmt8'sUnadoptGuardhint, same setup, real controller:0x400016000fault; the run ends at similar load progress (last DirectStorage milestone request #65536, #131072 not reached) withnull write at game+0x23cf683(stackgame+0x4e4ba89,game+0x2215c35) at ~128 s, with fps dropping from 30 to 11 (~85 s). #662 already describesgame+0x23cf683as the title's stall-watchdog exit.copy_from:CopyFromSubresourcewas called at ~112 s (calls #1 and #2 logged, #4 not reached) with sane arguments in #684's 7-argument layout (row_pitch=0x800,slice_pitch=0x40000, then0x100/0x2000,srcin the title's memory, e.g.0xb659a9000) and no fault. The run again ended in thegame+0x23cf683watchdog.Testing and write-up assisted by Claude Code (Claude Opus 5.5); runs on my own hardware, checked by me. No game data attached.
Imported from ivall/xcl. Originally posted by Filip722 on 2026-11-25T01:44:17Z.
On an 8 GiB RTX 5060 Laptop GPU under Proton, deferring tiles saved about 3.3 GiB of early sparse backing. I ported the lazy allocation from this PR (
b112fe7) into the opt-in heap branch of #2009, on mainbf9eebd+ #1993. The comparison used the same integration with eager backing, matching Series X settings and separate copies of the same caches/prefix. This measures that port, not the complete #871/#877 stack.With
XCL_COHERENT_HEAPS=sparse:1024, the 1,172 and 2,199 MiB requests went to sparse windows in both runs. At the first sample with zero target pages, XCL reported 3,527 MiB mapped with eager backing and 128 MiB with lazy backing. At the next sample, with the first 64 MiB target pool, it reported 3,641 and 269 MiB mapped respectively.Six focused tests executed and passed. A synthetic RTX test checked that a zero write left a tile unmapped, a nonzero CPU write survived GPU readback, an explicit destination received a tile and releasing the allocation removed its mappings. In the title, the eager run stopped at the free-VRAM guard at 30.1 s. The lazy run stopped on host memory pressure at 34.4 s, with 2,350 MiB of VRAM free at the last sample. Both windows were still black, before account input. No new gameplay milestone.
On the same lazy build I also tried a smaller coherent window. Two fresh copies of one Series X profile started with 2,048 or 1,536 MiB, the same 1,024 MiB sparse-routing threshold and a 6,144 MiB host available-memory cutoff. Both kept the 563 and 596 MiB allocations coherent and routed the 1,172 and 2,200 MiB allocations to sparse VRAM. At 512 draws both used 1,242 MiB of coherent memory. The larger window reached the host cutoff at 33.1 s, the smaller at 46.6 s. Both displayed black throughout the captures. This confirms the smaller window preserved placement in this part of startup. The runs reached different stages, so the duration does not measure a loading-speed improvement.
A separate Series S (Lockhart) startup with a 4,096 MiB guest budget helped distinguish another source of VRAM use. In the lazy integration above, shrinking the coherent window from 1,536 to 768 MiB saved 768 MiB of resident host memory. Both retained the 194 and 258 MiB coherent allocations and still mapped over 4 GiB of sparse GPU tiles before the first submit. With temporary mapper counters and the 768 MiB window, 66,592 new 64 KiB tile bindings (4,162 MiB) came from mapping physical pages to their destination. The explicit commit path added 20 MiB and the ordinary eager allocation path added 84.25 MiB. Private-home I/O and the lazy CPU and GPU paths had added zero at that sample. Three focused regressions passed on the instrumented build. The startup remained black and stopped at the 2 GiB VRAM reserve. This identifies the separate allocation path without changing its mapping semantics.
Bazzite 44, driver 615.78.08, Proton Experimental 11.0-20261112, local vkd3d-proton 3.1.0 based on
4522cc1a8b1347f. OpenAI Codex (GPT-6.2-Sol) prepared the local port, ran the tests and wrote this report.upstream-sync referenced this pull request2026-11-25 04:08:41 +00:00
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T09:52:34Z.
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.Imported from ivall/xcl. Originally posted by gustavsi on 2026-11-25T15:20:55Z.
Thanks @DavidM1911 and @Filip722 (great to see the ~3.3 GiB early sparse savings confirmed on 8 GiB NVIDIA too)!
Rebased onto
main(06c9f55) + updated #871 (34cd677) ataec41e2(preserving #1981'slock_state()insparse::decommitted), verifiedsparse::17/0/1,vram::15/0/1, and a fresh 60 s smoke run (exit: 0x0,958frames,0crashes,0removals).upstream-sync referenced this pull request2026-11-25 17:06:01 +00:00
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-25T16:44:24Z.
Independent AMD RDNA4 / Linux (RADV, native wave64) test report for head
aec41e2cd15e0dd81ec4c28d82ff4a26929e892amerged locally ontomain55d64c2(clean merge).Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirv694cc674+ two-hunk relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnu(debug for tests, release for retail)Unit / GPU tests (
XCL_REQUIRE_GPU=wave64,VKD3D_CONFIG=ignore_shared_fence,--test-threads=1)hle::d3d12x::sparse::tests: 16 passed, 0 failed, 1 ignored (peak VRAM 1,032 MiB)gpu::uma::tests: 12 passed, 0 failed, 0 ignored (peak VRAM 1,018 MiB)hle::d3d12x::title_textures::tests: 19 passed, 0 failed, 0 ignored (peak VRAM 1,258 MiB)hle::d3d12x::vram::tests: 16 passed, 0 failed, 1 ignored (peak VRAM 1,624 MiB)Retail title (1.0.2.1) A/B vs clean
main55d64c2Same flags (
XCL_DIRECT_DXIL=1,XCL_TEXTURE_LEVEL_PAGES=1,XCL_PSO_WAIT_MS=50,XCL_SPLIT_MIDLIST_WAIT=0,XCL_COHERENT_MB=1024,VKD3D_CONFIG=ignore_shared_fence,XCL_PSO_PRELOAD=0,XCL_NETWORK=0,MemoryMax=18G):main55d64c2: no crash through 116 s (sparse 7447 MB, VRAM10,434 MiBat 75 s /11,879 MiBat 115 s,1,800+frames presented,31,193translated +4,988PC draws,65,536dispatches; stopped at 117 s by our 18 GiB cgroup cap with 7.5 GiB system RAM still free).55d64c2+#877(aec41e2):sparsereported11,413 MB(51,453tiles mapped;6,672 MBuploaded over 4,096 submits) and VRAM at 75 s was11,499 MiB(+1.0 GiB vs clean55d64c2).0x400016000):55d64c2includes#495(XMemMapPhysicalPagesScatternull-array unmap), which may be interacting with#877's lazy sparse pages.Not tested
vkd3d-proton, or default HLSL route.AI use
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-25T18:08:49Z.
Independent exact-head Wine/NVIDIA check for
aec41e2cd15e0dd81ec4c28d82ff4a26929e892a:2576c0b4adfae4a), with its release assertions intactcargo test --target x86_64-pc-windows-msvc sparse::: 16 passed, 0 failed, 1 ignoredThe retail-title run cannot reach the lazy-allocation path on this exact stack. It exits with status 3 after 4.13 s at the first internally-created sparse heap:
This is the known adopted-object incompatibility addressed by #1395:
sparse::take_tile()creates the heap through the adopted device, thenUpdateTileMappingspasses that adopted heap directly to vkd3d-proton. #867's temporary guards do not cover that queue call, and a guard around the heap's own methods cannot cover every vkd3d assertion site. An integration containing #1395 gets past this heap on the same machine, but that tree contains other PRs, so I am not presenting it as a controlled #877 performance result.Conclusion: the sparse tests pass, but exact #877 still needs #1395 (or an equivalent native-vtable solution) before its lazy mapping can be exercised with assertion-enabled release vkd3d-proton on Linux/NVIDIA.
AI-assisted investigation and report; exact output and hardware results verified locally.
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-25T18:14:55Z.
Update to my NVIDIA report above: #1395 was closed unmerged after I tested this exact head; its author explicitly permitted reuse of the code. Therefore exact #877 currently has no open upstream dependency that fixes this release-vkd3d heap assertion. It needs the equivalent native-vtable implementation to land elsewhere (or to be folded into this stack) before stock assertion-enabled vkd3d-proton can exercise the lazy path.
Imported from ivall/xcl. Originally posted by pickles976 on 2026-11-25T18:21:56Z.
Follow-up integration result on the RTX 4060 Laptop (not an exact-head comparison): I ported
aec41e2onto the existing local Wine integration, which includes closed #1395's permitted native-vtable implementation plus the other compatibility PRs needed by this title.Settings:
XCL_COHERENT_MB=512,XCL_PAGE_BUDGET_MB=2048,XCL_PSO_PRELOAD=0,XCL_NETWORK=0,XCL_DEFER_PRIVATE_HOME_TILES=1; stock assertion-enabled vkd3d-proton 3.2 (2576c0b4adfae4a), NVIDIA 590.48.1.The input automation missed the window, so the title remained on its front-end/setup path; this is not a gameplay stability claim. It does establish that the lazy port plus the native-vtable prerequisite survives five minutes on 8 GiB NVIDIA at the 30 fps cap with substantial memory headroom. The prior exact-head assertion remains reproducible without the #1395-equivalent code.
AI-assisted port and report; tests, telemetry, and title output verified locally.
Imported from ivall/xcl. Originally posted by gustavsi on 2026-11-25T19:43:40Z.
Thanks @pickles976 for the detailed 8 GiB RTX 4060 Laptop verification (300 s, 30.0 fps, 6,565 MiB peak VRAM)!
Rebased onto
main(2898511, including #2345) + updated #871 (cfcdca7) at2da0233. I also opened #2477 stacked on #867 carrying closed #1395's permitted in-place vtable patching so stock assertion-enabled vkd3d-proton has an active upstream path. Verified Proton tests (sparse::20/0/1,vram::19/0/1) and a fresh 60 spwsh ./scripts/smoke.ps1run (exit: 0x0,1021frames,0crashes,0removals).Imported from ivall/xcl. Originally posted by gustavsi on 2026-11-25T20:32:38Z.
Rebased onto
main(e0d93c84) + updated #867 (f98da36d, including theUnadoptGuard/orig_fnrace fix) + #871 (153730d7) at08abaa07, verified Proton tests (sparse::20/0/1,vram::19/0/1,list_x::40/0) and a fresh 60 spwsh ./scripts/smoke.ps1run (exit: 0x0,1154frames,50 50 24/2 s,0crashes,0removals).upstream-sync referenced this pull request2026-11-25 22:05:21 +00:00
upstream-sync referenced this pull request2026-11-25 22:06:31 +00:00
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-25T21:14:33Z.
Follow-up AMD RDNA4 / Linux (RADV, native wave64) test report for updated head
08abaa0715179a33ed3b40c3a75909550e614365(merged cleanly ontomain6d12f58), plus bisect against#871(153730d7).Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnu(debug for tests, release for retail)Unit / GPU tests (
XCL_REQUIRE_GPU=wave64,XCL_DXC_DIR,VKD3D_CONFIG=ignore_shared_fence,--test-threads=1 --nocapture)hle::d3d12x::sparse::: 18 passed, 0 failed, 1 ignored (0 skipped)gpu::uma::: 12 passed, 0 failed, 0 ignored (0 skipped)hle::d3d12x::title_textures::: 19 passed, 0 failed, 0 ignored (0 skipped)hle::d3d12x::vram::: 19 passed, 0 failed, 1 ignored (0 skipped)Retail title bisect (
#871alone vs#871+#877, pressingApast menus)Same flags (
XCL_DIRECT_DXIL=1,XCL_TEXTURE_LEVEL_PAGES=1,XCL_PSO_WAIT_MS=50,XCL_SPLIT_MIDLIST_WAIT=0,XCL_COHERENT_MB=1024,VKD3D_CONFIG=ignore_shared_fence,XCL_PSO_PRELOAD=0,XCL_NETWORK=0):main6d12f58)0x400016000crash#871alone (153730d7)13,935 MiB91,136(9,152 MBuploaded)76.600 s#871+#877(08abaa07)11,575 MiB(−2.36 GiB)51,871(6,704 MBuploaded)77.356 s#871alone shows that the deterministic0xc0000005at~77 sreading0x400016000(core::ptr::copy_nonoverlapping←tiling::Chain::detile_level (tiling.rs:464)←xg::copy_from (xg.rs:712)) is in#871, not#877(reported on#871).#871,#877cuts VRAM at 75 s by −2.36 GiB and mapped tiles by −43% (91,136→51,871).Not tested
#877past 77 s once#871's0x400016000crash is fixed.AI use
main, ran the tests and retail bisect under Proton on this machine, symbolized the crash stack, and drafted this report.Imported from ivall/xcl. Originally posted by gustavsi on 2026-11-26T02:12:52Z.
Thanks @ClosetPie107 for the RX 9070 bisect confirming −2.36 GiB VRAM at 75 s and −43% mapped tiles (
91,136→51,871) on top of #871!Rebased onto
main(08db8020) + updated #867 (e57cb659) + updated #871 (8f08d7cd) ata553a224:GE-Proton11-14(RX 9060 XT):sparse::18/0/1,vram::19/0/1,title_textures::19/0,real::62/0, plus a fresh 60 spwsh ./scripts/smoke.ps1run (959 frames /42 42 42per 2 s,exit: 0x0,0crashes,0device removals; block updated in PR description).AI use: Antigravity (Gemini 4 Neon) rebased onto
main+ updated #871, ran the Proton tests and smoke run, and drafted this comment.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T03:11:19Z.
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
Imported from ivall/xcl. Originally posted by ClosetPie107 on 2026-11-26T06:16:12Z.
Update for head
3b76b082(rebased ontomainf9a0cb80; earlier results for29352403below).git range-diff: this PR's commit and the #867 commit are unchanged; the #871 commit changed only intitle_textures.rs(see #871).Same machine and setup as below (RX 9070 16 GB / Mesa 26.3.1 RADV / Proton Experimental
experimental-11.0-20261112, vkd3d-proton masterec207194without the allocator / command-listlpVtblchecks, DXC 1.9.2609.5, Rust 1.96.0,x86_64-pc-windows-gnudebug build). The head itself, withmainf9a0cb80the same session as the baseline.Tests (
XCL_REQUIRE_GPU=wave64,--test-threads=1)hle::d3d12x::sparse::: 18 passed, 0 failed, 1 ignored (main: 17 passed, 0 failed, 1 ignored)hle::d3d12x::real::: 67 passed, 0 failed (main: 63);gpu::uma::12 passed, 0 failed;adapter5 passed, 0 failed (main: 4);hle::d3d12x::title_textures::21 passed, 0 failedcargo test --workspace --no-fail-fast -- --test-threads=4with--skip compositor_blends_ui_plane_over_scene_plane --skip failed_restore_stops_before_importing_an_unbacked_window --skip grooming_leaves_a_window_under_1_gib_only_its_hole(the first loses the RADV device here, the other two run out of memory under Wine): lib 1330 passed, 8 failed, 27 ignored;mainlib the same session: 1323 passed, 9 failed, 27 ignored (--test-threads=1and two--test-threads=4runs). All failures are amongmain's. The other binaries fail the same 3 tests as onmain(e2e,pls_quota,predication_e2e).d3d12_resource_and_syncended the process, as it does onmainhere.Not tested on this head: a retail run (the runs below are for
29352403, with #684 and #1993 added); native Windows, NVIDIA / Intel.AI use: Claude Code (Claude Opus 5.5) ran the builds and tests on my machine and wrote this update.
Update for head
29352403(earlier results fora553a224below)Same RX 9070 / RADV / Proton Experimental machine, patched
vkd3d-proton(masterec207194without the allocator / command-listlpVtblchecks), Rust 1.96.0,x86_64-pc-windows-gnu. Head merged ontomain8b957becwith #2849 (4e931734), test commit22716591. #871 conflicts with #2849 intitle_bytes; the resolution is on #871.Tests (debug,
XCL_REQUIRE_GPU=wave64,--test-threads=1)hle::d3d12x::sparse::: 18 passed, 0 failed, 1 ignored (main: 17 passed, 0 failed, 1 ignored)gpu::uma::12 passed, 0 failed;gpu::adapter::4 passed, 0 failed;hle::d3d12x::title_textures::19 passed, 0 failedcargo test --workspace --no-fail-fast -- --test-threads=4: 1438 passed, 11 failed, 47 ignored, 12 SKIPPED.mainthe same run: 1434 passed, 12 failed, 47 ignored, 12 SKIPPED. The 11 failures are all amongmain's 12 (mainalso failedsparse::flush_parked_does_not_free_or_reuse_tiles_while_unmap_is_in_flight).tests/d3d12_resource_and_sync.rsaborted here as well; it crashed onmaintoo (3 of 3 focused reruns).Retail title, 300 s (release; every run starts from a copy of the same warm-cache snapshot;
XCL_DIRECT_DXIL=1 XCL_TEXTURE_LEVEL_PAGES=1 XCL_PSO_WAIT_MS=50 XCL_SPLIT_MIDLIST_WAIT=0 XCL_COHERENT_MB=1024 XCL_PREPARE=1 XCL_PSO_PRELOAD=1 VKD3D_CONFIG=ignore_shared_fence,Apressed every 10 s)xg::copy_from, as with #871 alone (details there).e56dbc3f) and #1993 (0a755f0c) added to each tree:7b8df0d893678b46cd5508feNot tested
AI use
Re-tested rebased head
a553a224on latestmain(b49be183) together with #684 (e56dbc3f, fixing the #477xg::copy_fromcrash) and #1993 (0a755f0c, fixing the sparse copy-back fence cycle) on AMD RDNA4 / Linux (Proton Experimental):Hardware & environment
experimental-11.0-20261112),vkd3d-protonmasterec207194(3.2.0) +dxil-spirvb540c8a2+ relaxed-vtable patch (-Db_ndebug=true), DXVKv3.1.1-209, DXC1.9.2609.5, Rustx86_64-pc-windows-gnuTargeted unit tests (debug,
--test-threads=1):xcl.exe hle::d3d12x::sparse:: -- --test-threads=1: 26 passed, 0 failed, 1 ignored (early_commit_timing), includinglazy_range_helpers_track_tile_overlap_holes_and_nonzero_pages(8 of #1993's WARP-backed copy-back tests skipped withno WARP deviceunder Wine).300 s retail title run (1.0.2.1, pressing
Apast menus, release)Flags:
XCL_DIRECT_DXIL=1,XCL_TEXTURE_LEVEL_PAGES=1,XCL_PSO_WAIT_MS=50,XCL_SPLIT_MIDLIST_WAIT=0,XCL_COHERENT_MB=1024,VKD3D_CONFIG=ignore_shared_fence,XCL_PSO_PRELOAD=0,XCL_NETWORK=0.exit=0), 0 crashes, 0 device removals, 0sparse: the queue has not reached fence valuewarnings, cleanly composing with #1993.75 s:11,302 MiBvs13,677 MiBon the matching #871 + #684 + #1993 run (−2.32 GiB).50,177at 4,096 submits (vs91,136on #871), and only75,566tiles even after 8,192 submits deep into the world load.105,215translated draws (344skipped),556,261dispatches (119skipped),24,707chained split-compute dispatches (246split programs /2,587pieces,406 MiBscratch),1,825PresentXframes (1.4 fpssustained past 1,500 frames),66,073Opus packets (0 errors).16,297 MiBVRAM (late in the world load as render targets and split scratch grew; #2357 was not included),15,808 MiBRSS (min_avail=8,483 MiB,xcl_swap=0).Not tested
a553a224.AI use
main, ran the Proton unit tests and 300 s retail run on this machine, and drafted this follow-up.Imported from ivall/xcl. Originally posted by gustavsi on 2026-11-26T15:15:29Z.
Thanks @ClosetPie107 and @pickles976 for the runs.
0xc0000005reading0x400016000inChain::detile_levelunderxg::copy_from(@ClosetPie107): as @St5sz2Jk worked out on #871, that is #477: XCL readCopyFromSubresource's arguments with the wrong ABI and copied from the wrong address. #684 fixes it; @TobiasFornell's retest above shows the title callingCopyFromSubresourcewith #684's layout and no fault. It shows up with this stack because the title gets far enough to call it, not because of the lazy mapping.iface->lpVtbl == &d3d12_heap_vtblon the first adopted heap. #2477 (stacked on #867) writes XCL's slots into vkd3d-proton's own tables for the assert-checked classes, heaps included; #1395 is the other approach. Neither is part of this PR, so on a release vkd3d-proton with assertions on, #877 needs one of them. I have not run #877 together with #2477 on an assertion-enabled build myself.AI use: Claude Code (Claude Opus 5.5) drafted this reply; I checked it.
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T23:33:53Z.
A note on overlap, since nothing in this thread links them: #2897 (
XCL_SPARSE_LAZY=1, merged intonvidia-devatfb35a759, on top of #2895's never-written-tiles line) defers the video memory of committed sparse-window tiles until their first use. That is the same goal this PR has.What is the same (by reading
29352403againstnvidia-deveff3bcab):ensure_lazy_mappedfromlist_x.rs:677; there it iswill_writefromlist_x.rs:772,793.mapped_ranges, so they stay write-watched. Here that issparse.rs:1621; there, LAZY entries are keys ofs.mapped(sparse.rs:3998).What differs:
alloc_lazy(kernelx.rs:347, always on under Wine). There, everycommit_range(sparse.rs:2868), so everysparse::allocheap, opt-in and refused below tiled resources tier 2.LAZY_RANGESmap here. ALAZYsentinel pool ins.mappedthere (sparse.rs:137).upload_dirty,sparse.rs:2190), plus astarvedretry when no memory is found.CreateUnorderedAccessViewmaps buffer UAV ranges here (real.rs:2565). #2897 has no such hook.alloc_lazydoes not callcommitted(). With both present, a run under Wine withXCL_SPARSE_LAZY=1would have two separate lazy schemes over the sameState.git merge-treeof this head withnvidia-deveff3bcabalso conflicts insparse.rs,list_x.rs,real.rs,uma.rsandkernelx.rs, so this needs a rebase oncenvidia-devreachesmain. It may be worth deciding then whether the Wine case should go throughXCL_SPARSE_LAZY, keeping the UAV hook, or stay separate.AI-assisted (Claude Code, Claude Opus 5.5): read both branches and wrote this; nothing was run.
Imported from ivall/xcl. Originally posted by gustavsi on 2026-11-29T03:53:07Z.
Closing as I'm stepping away from the project, but anyone is welcome to rebase and reuse these commits.
Pull request closed