Skip to content

Memory: lazily map sparse VRAM tiles for Wine graphics heaps (#175) - #877

Open
gustavsi wants to merge 3 commits into
xcl-dev:mainfrom
gustavsi:wine/lazy-sparse-vram
Open

gustavsi wants to merge 3 commits into
xcl-dev:mainfrom
gustavsi:wine/lazy-sparse-vram

Conversation

@gustavsi

@gustavsi gustavsi commented Nov 24, 2026 •

Copy link
Copy Markdown

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; only the top commit (b112fe7) belongs here.

In #871, overflow PAGE_GRAPHICS_* heaps under Wine are routed into the sparse VRAM windows instead of the capped coherent userptr window. 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).

All lazy-allocation paths are gated behind util::under_wine() (with sparse::ensure_lazy_mapped short-circuiting when no lazy ranges exist); native Windows behavior is unchanged.

What is in it

  • crates/xcl/src/hle/d3d12x/sparse.rs: add alloc_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 via ensure_lazy_mapped), clean up lazy ranges on free, integrate with upstream parked-tile decommit / retired pool reuse (#532 / #923), 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: use sparse::alloc_lazy under util::under_wine() for overflow PAGE_GRAPHICS_* sparse allocations.
  • crates/xcl/src/hle/d3d12x/real.rs & crates/xcl/src/hle/d3d12x/list_x.rs: call sparse::ensure_lazy_mapped when registering placed buffers, buffer UAVs, and command-list GPU memory writes so GPU-written ranges have tiles mapped before execution.

Tested

  • Hardware / OS: AMD Radeon RX 9060 XT (16 GiB VRAM, RADV Mesa 26.2.7), Fedora Linux, GE-Proton11-14-x86_64, vkd3d-proton master ec20719452e916b (-Db_ndebug=true), DXC 1.9.2609.5, cross-compiled x86_64-pc-windows-msvc (clang-cl + lld-link).
  • Rebased onto main 689f2db + D3D12.X: preserve native vtables and wrap fences for vkd3d-proton under Wine (#175) #867 (a4c5a82) + Memory: avoid amdgpu userptr stalls under Wine (#175) #871 (b3f2f7c) and verified under Proton (--test-threads=1, XCL_DXC_DIR set for GPU tests):
    • hle::d3d12x::sparse::tests: 15 passed, 0 failed, 1 ignored
    • hle::d3d12x::real::: 36 passed, 0 failed, 0 ignored
    • hle::d3d12x::list_x::: 27 passed, 0 failed, 0 ignored
    • hle::d3d12x::late_release::: 2 passed, 0 failed, 0 ignored
    • hle::d3d12x::alloc_pool::: 3 passed, 0 failed, 0 ignored
    • gpu::uma::tests: 7 passed, 0 failed, 0 ignored
    • hle::d3d12x::title_textures::tests: 13 passed, 0 failed, 0 ignored
    • hle::dstorage::tests: 17 passed, 0 failed, 0 ignored
    • --exact gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem gpu::recomp::tests::gpu_valu_float_and_int: 2 passed, 0 failed, 0 ignored, 0 skipped
  • Retail title 60 s smoke run under GE-Proton11-14 (XCL_NETWORK=0 XCL_PSO_PRELOAD=0 XCL_RUN_SECONDS=60 XCL_ACTIVITY=1, VKD3D_CONFIG=""): 1134 frames shown (1134 PresentX, 49 42 10 presents/2 s) with 0 crashes and 0 device removals.

Regression run
Produced under Wine (GE-Proton11-14, AMD Radeon RX 9060 XT, vkd3d-proton ec20719452e916b, XCL_NETWORK=0 XCL_PSO_PRELOAD=0 XCL_RUN_SECONDS=60 XCL_ACTIVITY=1, VKD3D_CONFIG="") using the xcl-smoke v1 log extraction format (Linux environment; native Windows scripts/smoke.ps1 could not be run; peak commit: 0 MB is what 689f2db logs under Wine before #1097).

main (689f2db):

xcl-smoke v1
commit: 689f2db477c3c062cf162649781640ef8a977c18
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x3
frames shown: 0 (did not reach end)
presents per 2 s (last 3): 0 0
device removals: 0
crashes: 2
peak commit: 0 MB

This PR (b112fe7, stacked on #871):

xcl-smoke v1
commit: b112fe77c66a428111933dfed94a9cd6b105502d
gpu: AMD Radeon RX 9060 XT
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1134 (PresentX 1134)
presents per 2 s (last 3): 49 42 10
device removals: 0
crashes: 0
peak commit: 0 MB

Not tested

  • Native Windows (all new paths are gated behind util::under_wine()).
  • NVIDIA Linux GPUs.

AI use

  • Antigravity (Google DeepMind, exact model name not exposed to the agent) assisted with implementation, rebase, and running the Wine test/smoke verification on this machine.

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
… Linux PRs ivall#867/ivall#871/ivall#877

Update fork README for upstream/main 1ec4c98 (fenced late_release and queue-wait diagnostics), newly integrated PRs (ivall#838-ivall#841, ivall#849, ivall#851, ivall#864, ivall#875, ivall#876), live gameplay audio progress, and our three open upstream Linux PRs (ivall#867, ivall#871, ivall#877).

Assisted-by: Antigravity (Google DeepMind)
@oeirughrepuiohg

Copy link
Copy Markdown

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-proton cae8353e + scripts/linux/vkd3d-proton-xcl.patch (-Db_ndebug=true), VKD3D_CONFIG=ignore_shared_fence. Base: main 1ec4c98 + #793 #820 #759 #640 #889 #891 #826.

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.

@SlopTart

Copy link
Copy Markdown

Linux / AMD RDNA3 lane report, head 2f81d51 merged onto main 1ec4c98 (lane merge shas: 877 d905182, 871 8e45b96, 867 ad333d2 - 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 after gpu::recomp::tests::gpu_sparse_vram_descriptors_buffers_and_xmem, the sparse-VRAM test. That test passes clean on plain main 1ec4c98 on 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=1 run.

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.

@fromthemoonx

fromthemoonx commented Nov 24, 2026 •

Copy link
Copy Markdown

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 main 5796cc4 (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 main 5796cc4'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 for 2f81d51.


Native Windows / NVIDIA run, since Not tested lists native Windows.

Tested

Not tested

  • A retail title (no smoke.ps1 run here), and anything under Wine. Since the changes are behind under_wine(), this only shows the native Windows path is unchanged in the test suite.
  • Release build.

AI use

  • Claude Code (Claude Opus 5.5) ran the build and tests on the machine above and wrote this report from the log.

@Filip722

Copy link
Copy Markdown

I tested 2f81d51 together with #871 on an RTX 5060 Laptop GPU (8 GB, NVIDIA 615.78.08), Bazzite 44 and Proton Experimental 11.0-20261112. The test stack was XCL 47efa2e plus #640, #793 and #820, vkd3d-proton v3.1 with the #257 compatibility changes and dxil-spirv 1dc543f. Offline Series X, XCL_COHERENT_MB=512, XCL_PAGE_BUDGET_MB=2048 and XCL_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 vkAllocateMemory access 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.

@TobiasFornell

Copy link
Copy Markdown

Adding an AMD data point to @oeirughrepuiohg's report: the vkd3d_realloc: Out of memory crash after rebasing is not NVIDIA-specific.

Tested: RX 9070 XT (RDNA4), Mesa RADV 26.3.1, CachyOS (kernel 7.3), Proton Experimental 11.0-20261112 Wine, vkd3d-proton v3.1 from scripts/linux/build-vkd3d-proton.sh (ndebug, dxil-spirv 53aac418), retail title 1.0.2.1, XCL_NETWORK=0.

  • This stack on its own base 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 older main without the stack – the big win.
  • Stack merged onto main 47efa2e: frames up to 28 fps, then 10–20 s later during loading err:vkd3d-proton:vkd3d_realloc: Out of memory. and 0xc0000005 reading 0xffffffffffffffff – same signature as above. Merge resolved with the UnadoptGuards moved into the alloc_pool::reset_list closures (on pc_alloc), plus upstream's decommit_range with this PR's lazy_changed bump.
    • Same with only this stack on main (no other PRs), 2/2 runs.
    • Same with XCL_ALLOC_SWAP=0 → not alloc_pool.
    • main alone does not crash within 120 s on the same setup.
  • Suspect: the interaction with upstream's own lazy pages (Memory: map_pages asks VirtualQuery once per run of fresh pages #556/KernelX: a page mapped away moves to its next address directly, not by way of its home #849, 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.

@TobiasFornell

Copy link
Copy Markdown

Follow-up on the same RDNA4 setup, this time on the stack's own base (2f81d51 on beaa245, no rebase) with a real controller, to get past the first screens:

  • Menus and legal screens at 30 fps, the loading artwork renders correctly, ~5 GB of DirectStorage reads, then world loading at 1–10 fps (58k pipelines queued).
  • About 2.5 min in, during world loading: unhandled exception 0xc0000005 in ucrtbase.dll+0x1720b (read at address 0x400016000) – a memcpy from xcl.exe+0x17ecdd. That address is inside the 512 MB coherent window (UMA: … 512 MB coherent window at 0x400000000, 83/512 MB in use).
  • Just before it: video memory 15110 MB local, 528 MB non-local; sparse pools 3264 MB (3209 MB mapped) – VRAM nearly full on a 16 GB card – and DirectStorage … 16 failed in the last activity sample.
  • No vkd3d_realloc: Out of memory here; 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.

@gustavsi

Copy link
Copy Markdown
Author

Rebased onto main (930e8b4) + updated #867 (46944c2) + #871 (45b805c) at 2dc68c2:

gustavsi added a commit to gustavsi/xcl that referenced this pull request Nov 24, 2026
…ll#1221, and updated Linux PRs

Update fork README for upstream/main 930e8b4 (BCPack BC1-BC7, XCL_PSO_WAIT_MS, low-VA ASLR < 2^40, alloc_pool, sparse tile parking/pool reuse, direct page moves, write-watch merge), newly integrated PRs (ivall#1078, ivall#1097, ivall#1139, ivall#1142, ivall#1150, ivall#1156, ivall#1182, ivall#1191, ivall#1195, ivall#1221), and updated Linux PRs (ivall#867, ivall#871, ivall#877).

Assisted-by: Antigravity (Google DeepMind)
@TobiasFornell

Copy link
Copy Markdown

Retested 2dc68c2 (#877 rebased on 930e8b4, with #867 46944c2 + #871 45b805c) on RX 9070 XT (RDNA4) / RADV 26.3.1 / Proton Experimental's Wine + vkd3d-proton v3.1 from scripts/linux (ndebug), title 1.0.2.1:

  • ✅ The rebase OOM (vkd3d_realloc: Out of memory → 0xffffffffffffffff) is gone: boots, first game frame 3840x2160, account picker at 30 fps, no device removal.
  • ❌ The coherent-window read fault is still there, at the same point as in my earlier report: right after the account picker, on the first loading screen (~2 min in):
    unhandled exception 0xc0000005 in ucrtbase.dll+0x1720b (read at address 0x400016000)
    on the stack: xcl.exe+0x5e9038, xcl.exe+0x33080, ucrtbase.dll+0x1720b (x3), xcl.exe+0x4e33c3
    
    Same address as before. The new gpu::shader::readable check in title_textures.rs only guards content_hash; this fault is a memcpy reading 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.

@crastinator crastinator left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 onto main 930e8b4: no conflicts)

  • AMD Radeon RX 6700 XT (RDNA2, gfx1031, RADV NAVI22, Mesa 26.3.1), Ryzen 7 5700X, Linux 7.3.5 (CachyOS)
  • Proton Experimental 11.0-20261112's Wine, vkd3d-proton v3.1 + #257's patch (-Db_ndebug=true, dxil-spirv 53aac418 from #775), DXVK v3.1.1-209 dxgi, DXC 1.9.2609.5, libopus 1.5.2, XCL_REQUIRE_GPU=wave64,mesh (0 SKIPPED)
  • cross-built for x86_64-pc-windows-msvc (clang-cl / lld-link, xwin SDK 10.0.26100), Rust 1.99.1, debug
  • cargo test -p xcl --lib -- --test-threads=1 plus every integration test (--test '*' -- --test-threads=1), compared per test with the same runs on main 930e8b4. main here: 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} and vram::d32s8_targets… fail together in 2 of 5 main runs (the #718 family), so I do not count a pass of those as a fix either way.
  • PR: 746 passed, 8 failed, 41 ignored (main: 740 / 11 / 41, with the #718 flakes failing in that run). No test fails here that passes on main. hle::d3d12x::sparse::tests 14 passed and 1 ignored.

Not tested

  • Anything that needs game files: no XCL_SAMPLE_* was set, so the tests that read them (about 66) pass without running.
  • VRAM use with a retail title (no game here yet). NVIDIA.

AI use

  • Claude Code (Claude Opus 5.5) merged, built and ran this and wrote the report; I checked the results.

@gustavsi

Copy link
Copy Markdown
Author

Rebased onto main (b7aa9f3) + updated #867 (6e94390) + #871 (b66a150) at fbf1440:

  • Coherent-window 0xc0000005 read fault at 0x400016000 (@TobiasFornell): found the exact ucrtbase.dll memcpy path in title_textures.rs (read_committed had a coherent-window fast path calling std::ptr::copy_nonoverlapping directly, and title_bytes borrowed a raw slice across subresources). Fixed in Memory: avoid amdgpu userptr stalls under Wine (#175) #871 (b66a150) by routing coherent-window reads in read_committed, title_bytes, and refresh through copy_committed_region (ReadProcessMemory) under Wine so an unreadable coherent page zeroes cleanly instead of faulting.
  • Verified on RX 9060 XT / GE-Proton11-14 / vkd3d-proton ec20719452e916b (-Db_ndebug=true): sparse::tests 15/0/1, real:: 29/0, list_x:: 26/0, late_release:: 2/0, alloc_pool:: 3/0, gpu::uma::tests 7/0, title_textures::tests 13/0, dstorage::tests 17/0, --exact gpu_sparse_vram_descriptors_buffers_and_xmem gpu_valu_float_and_int 2/0, and a clean 60 s smoke run (exit 0x0, 1166 frames shown / 1166 PresentX, 52 47 31 presents/2 s, 0 crashes, 0 removals). Thanks @TobiasFornell and @crastinator for testing!

@TobiasFornell

Copy link
Copy Markdown

Correction to my two earlier reports here (13:25 and 15:39 UTC): the read at address 0x400016000 crash is not a coherent-window fault. The stack points to the CopyFromSubresource argument mismatch from #662 (fix: #684). With #684 on top, the title now calls CopyFromSubresource without faulting (see below).

What the crash report shows (run on 20df0cf = 2dc68c2 + #1395 + cmt8's UnadoptGuard hint, Proton Experimental's own vkd3d-proton, RX 9070 XT; xcl's report.json, symbolized with llvm-symbolizer and the build's xcl.pdb):

0xc0000005 in ucrtbase.dll+0x1720b (read at address 0x400016000)  rsi=rdx=0x400016000 rbx=0x1000
xcl.exe+0xb11fd  -> core::slice::copy_from_slice in gpu::tiling::Chain::detile_level (tiling.rs:438)
xcl.exe+0xbf8a0  -> hle::xg::copy_from (xg.rs:711), XGTextureAddressComputer slot 9 = CopyFromSubresource
game+0x4daa2c8, game+0x50bb3f0 (title callers)

Retest with #684: fbf1440 (this PR, with #867 6e94390 + #871 b66a150) + #1395 fd97d91 + #684 e56dbc3 + cmt8's UnadoptGuard hint, same setup, real controller:

Testing and write-up assisted by Claude Code (Claude Opus 5.5); runs on my own hardware, checked by me. No game data attached.

…er Wine (xcl-dev#175)

vkd3d-proton validates iface->lpVtbl on adopted D3D12 objects passed back into d3d12core.dll (command allocators, lists, heaps, resources, PSOs, and fences). On unmodified assertion-free vkd3d-proton (such as GE-Proton or -Db_ndebug=true builds), XCL's in-place vtable adoption causes CreateCommandList/Reset to fail with E_INVALIDARG and fence waits to reject adopted fences.

Under Wine (gated behind util::under_wine(), native Windows unchanged):
- UnadoptGuard temporarily restores the native vtable on adopted command allocators (including alloc_pool backings and reset_pc_allocator), command lists, heaps (CreatePlacedResource/CreatePlacedResource1), RTV resources, and PSOs around calls into d3d12core.dll.
- FenceProxy wraps title ID3D12Fence1 objects so the underlying PC fence keeps its native lpVtbl, unwrapping in queue Signal/Wait while preserving Fence::xcl-dev#12 completed_value_address and freeing on final Release.
- real::create_raw_fence creates un-proxied native ID3D12Fence objects for XCL's own internal queue tracking (late_release, alloc_pool, list_x, cpu_writes, present, vram, drain_gpu) so un-adopted internal queues like sparse::queue() never receive a FenceProxy.

Note: assert-enabled vkd3d-proton builds (such as stock Proton Experimental) still validate iface->lpVtbl inside an adopted object's own methods, so an assertion-free build (-Db_ndebug=true / GE-Proton) remains required for in-place adoption.

Assisted-by: Antigravity (Google DeepMind)
On Linux with amdgpu, a multi-GiB coherent UMA window imported via OpenExistingHeapFromAddress (VK_EXT_external_memory_host userptr) causes two severe stalls:
1. GetWriteWatch(WRITE_WATCH_FLAG_RESET) on the userptr range triggers amdgpu MMU-notifier evictions (~100-200 ms/submit).
2. A multi-GiB userptr BO stalls every Vulkan GPU submission (~150 ms/frame, dropping PresentX frames).

Under Wine (native Windows unchanged):
- Key the default 512 MiB coherent_hint() cap on AMD GPUs (DXGI VendorId 0x1002) under Wine so NVIDIA Linux keeps a full-size coherent window (unless XCL_COHERENT_MB is set).
- Allocate the coherent window without MEM_WRITE_WATCH and exclude it from watch_regions(), notifying title_textures on DirectStorage writes into it and hashing small/dynamic coherent textures with a 1/16 round-robin sweep for large ones.
- Route overflow PAGE_GRAPHICS_* title GPU heaps into the sparse VRAM windows so shaders still read them directly.

Assisted-by: Antigravity (Google DeepMind)
…#175)

Under Wine, overflow PAGE_GRAPHICS_* title heaps are routed to sparse VRAM
windows (xcl-dev#871). Eagerly mapping 64 KiB VRAM tiles for the full reserved
heap up front consumes ~3.2 GiB of local VRAM for zero-filled or never-
written pages before the title even leaves the menus.

Add sparse::alloc_lazy (used under util::under_wine() only; native Windows
unchanged):
- Commits CPU pages up front so host accesses never fault, while deferring
  64 KiB VRAM tile allocation until the first non-zero CPU write or GPU
  write target registration (placed buffers, buffer UAVs, and command-list
  memory writes via sparse::ensure_lazy_mapped).
- Unit tests cover lazy-range overlap, hole masks, non-zero page detection,
  and coalesced lazy tile allocation.

Assisted-by: Antigravity (Google DeepMind)
@Filip722

Filip722 commented Nov 25, 2026 •

Copy link
Copy Markdown

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 main bf9eebd + #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.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main — needs a rebase before it can be tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants