D3D12.X: the sparse windows' pool heaps are 4 MiB, so freed runs of tiles go back #2630
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2630
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2630"
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?
@imnicho on GitHub · 2026-11-26 03:18 UTC · original
imnicho:sparse-small-pools→main· +45 −9 · 1 files · 1 commits · openA pool heap of the sparse windows goes back only when every tile of it is free, and a title frees its tiles in runs spread over all its heaps. With heaps of 64 MiB a retail title's world load leaves 1.5 – 2.0 GB of video memory in live heaps as free tiles (and Windows charges that to the process's commit as well). This makes the heaps 4 MiB, so the heaps of the freed runs go back. Part of #1773 (its point 3); the measurements that led here are in my comment there.
What is in it
hle/d3d12x/sparse.rs:POOL_TILESis 64 (it was 1024).retire_free_poolsmarks the pools that go with a flag each. It searched a list of them once per free tile, which was fine for a handful of 64 MiB pools and is not for the hundreds of small ones a world load frees at once.pools_of_freed_runs_go_back: 192 MiB of tiles taken in order, of every 64 MiB the first 4 MiB kept and the rest freed. WithPOOL_TILESat 1024 it fails with3072 tiles of video memory stay in pools for 192 tiles in use (192 MiB for 12 MiB).Tested
cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4, run twice on this head: 1,436 passed, 0 failed, 47 ignored; and 1,435 passed, 1 failed, 47 ignored, the failure beinghle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memoryat its list'sClosewith0x80004005. That is the failure #2588 describes onmain(now and then in parallel runs); the test does not use the sparse pools and passed alone, 3 of 3.SKIPPEDlines in each run: 21 wave64 forms (no wave64 on this adapter), 3 per-lane f16 / f32 forms refused, 2 of the title under the debug layer and 1 upload test (no D3D12 debug layer here), 1no heap windows, 1 that cannot turn the driver cache off (no Developer Mode).POOL_TILESis put back to 1024.The retail title of #505, Series S profile,
XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_TEXTURE_LEVEL_PAGES=1, one run of 600 s each. Both builds (the second from this change before one comment was reworded) also carry #684 (without itmainends inxg::copy_fromat the world's set-up) and a local counter that is not in this PR (free tiles by pool, time ofCreateHeapand of the mappingUpdateTileMappingscalls):mainb49be18+ #684CreateHeapUpdateTileMappingscalls that map tiles, their timesparse windows: 16 submits: time spent, tiles mappedsparse windows: 8192 submits: time spentSo the pools follow what is mapped: 1,452 MB less in pool heaps and 1,060 MB less local video memory once the world loads, for 0.5 s more in
CreateHeapand 0.6 s more in tile mapping over the run. Both runs wait for pipelines after the world's set-up (no present there in either), so this compares the menus, the loading screens and the load itself. Process commit is not in the table: the two runs compiled different amounts in the driver at the same times (19 against 1 compute pipelines of 10 s or more), which moves it by more than the heaps do.The same change on
nvidia-devc044dc6d+ #684 (XCL_UMA_SHADOW=1, one run each, the runs before and after it in one night on the same caches):sparse windows: 16 submits: tiles mapped, time spentsparse windows: 8192 submits: time spent0x887a0006), dedicated video memory of all processes at 15.4 of 16 GBOne run each, so the last row shows no cause. Added 2026-11-26 after seven more runs of the 4 MiB build on the same caches (1200 s each): six ran their time, and one lost the device the same way at 241 s (
0x887a0006, DRED with the same operations around the stop) with local video memory at 12,986 MB. So that removal comes with 64 MiB and with 4 MiB heaps, and does not need a full card; the last row is no evidence for this change.Regression run
main:
this PR:
Two more pairs of the same 60 s run: frames shown 1141 and 1123 on
main, 1114 and 1242 here; peak commit 13,706 and 13,676 MB onmain, 13,656 and 13,684 MB here.Not tested
nvidia-dev57 – 87 % of the free tiles lay in wholly free aligned blocks of 64, 28 – 62 % in blocks of 256, and blocks of 16 added little (the comment linked above).AI use
Claude Code with Claude Fable 5.2 wrote the change and the test, ran the runs and wrote this text.
🤖 Generated with Claude Code
@futurepro62 on GitHub · 2026-11-26 03:37 UTC · original · edited 2026-11-26 03:40 UTC
NVIDIA and AMD full-suite run, to go with pickles976's run of the new test on an RTX 4060 under Wine above. Tested exact head
839a163f(on its baseb49be18).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1424 passed, 0 failed, 45 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,dispatch_chain_native_wave64_builds_whole,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.pools_of_freed_runs_go_back.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1435 passed, 0 failed, 47 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on mainb49be183too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@LocranKing on GitHub · 2026-11-26 05:13 UTC · original
Independent NVIDIA (8 GB VRAM) test report on exact head
839a163f5fc5c006cb2e53add20959ce6ce074fc(clean detached checkout, no local changes).Tested
32.0.16.2140/ 621.40), AMD Ryzen 5 5500, 32 GB RAM, Windows 11 Home (build 26300), Rust 1.100.0 (stable-x86_64-pc-windows-msvc), Windows SDK10.0.26100.0.cargo build --workspace+cargo test --workspace --no-fail-fast -- --test-threads=4(debug): 1436 passed, 0 failed, 47 ignored (xcl --lib: 1310 passed, 0 failed, 27 ignored;pools_of_freed_runs_go_backpassed).SKIPPEDGPU tests on this adapter: 21 wave64-only (no wave64), 3 wave32 per-lane f16/f32 semantics, 1no heap windows, 1 no D3D12 debug layer (0x887A002D), 1 cannot disable driver cache without Developer Mode (0x887A002D).Regression run
scripts/smoke.ps1 -Seconds 60, release builds oforigin/main(b49be18) and this PR's head (839a163):Even in the first 60 s (boot/intro/menus), logged sparse pools dropped from
896 MB (838 MB mapped)(6117 MBlocal,4685 MBnon-local) onmainto840 MB (838 MB mapped)(6062 MBlocal,4655 MBnon-local) on this PR.main:
PR:
Not tested
XCL_SAMPLE_*tests; longer 600 s world-load runs (the 60 s smoke run covers boot/intro/menus only).AI use
smoke.ps1commands on this machine and drafted this report from the captured outputs.@pickles976 on GitHub · 2026-11-26 03:25 UTC · original · edited 2026-11-26 05:20 UTC
RTX 4060 Laptop GPU (8 GiB), NVIDIA 590.48.1, Wine 11.0 / vkd3d-proton 3.2.0,
DXVK_CONFIG=dxgi.hideNvidiaGpu = False: exact head839a163f5fc5c006cb2e53add20959ce6ce074fcbuilt as Windows MSVC target andpools_of_freed_runs_go_backpassed 1/1, no skipped host. DXVK enumerated the actual NVIDIA device. The fixture allocates 192 MiB of tiles, keeps 12 MiB (192 tiles) in three separated 4 MiB runs and retires/free-lists the remainder; it asserts no more than 24 MiB remains in live pool heaps. This bound held under Wine/vkd3d on this 8 GiB GPU. Log on the testing machine:.compat-xcl/logs/verify-pr2630-wine-rtx4060-sparse-pool.log(not attached).This is isolated GPU pool-reclamation evidence, not a retail world-load or peak-host-RAM measurement; on Wine, smaller heaps may increase Vulkan allocation count/driver overhead. A matched guarded world-load comparison should sample pool bytes vs mapped bytes, driver allocation count, scope RAM and GPU usage. I did not launch XCL retail here because the existing console-facing in-place D3D12 vtable/root-signature assertions under stock vkd3d-proton precede this PR (#175), so this fixture cannot certify gameplay or the 16 GiB RAM floor.
Additional local-integration result (2026-11-26), not an exact-PR retail test: after installing diagnostic vkd3d-proton 3.2.0
2576c0b4adfae4a+(allocator/listfrom_ifacevtable checks relaxed; releaseb_ndebug=true), I transplanted the 4 MiB pool size and flag-based retirement into an older dirty06c9f55Wine integration. I adapted this PR's freed-run assertions into that integration's existing GPU pool-reuse/fence-release fixture: 1/1 passed, freshCompiling xcl .../xcl-runtime/...recorded.A separately fresh-built 1080p title trial still hit our unchanged 6000 MiB global GPU safety ceiling: stopped at 40.98 s, 6158 MiB GPU, 5389 MiB available system RAM, 4539 MiB scope memory / 4343.4 MiB anonymous, exit 137 from the guard. An 18-second window screenshot was black; no gameplay/input/FPS claim. Earlier same-integration 64 MiB-pool run at the same requested render resolution stopped at 38.86 s / 6039 MiB, but differing host state/cache history and absent pool-at-stop accounting mean these runs do not establish a performance or memory-saving comparison. Lowering title output from 4K to 1080p also did not by itself clear the ceiling.
The focused reclamation result remains positive; this integration result only says that this change alone did not make our workload fit. Sparse logging reported 61,095 mapped 64 KiB tiles at submission 16 and 57,495 at 128; these are intermediate live-page counts, not GPU allocations at the stop. This older integration lacks newer lazy-level texture residency, so please do not interpret it as coverage of current main or the full memory-fix stack.
Local evidence:
.compat-xcl/logs/verify-runtime-pr2630-sparse-reclamation.log,build-xcl-runtime-pr2630-provenance.log,20261126T051819Z-{console.log,resources.csv},menu-20261126T051837277328Z.png. AI-assisted verification: omp / OpenAI Codex GPT-6 Astra. No code PR or push.mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@Anon64 on GitHub · 2026-11-26 09:52 UTC · original
Tested on an RTX 3060 12 GB, retail world load, merged onto
nvidia-dev: the pools of freed runs do go back (free tiles in pools 4–39 MB, was 44–134 MB), but on that branch they were already small, so the sparse windows still grow by what stays mapped.Setup: RTX 3060 12 GB, NVIDIA 581.80, i9-14900KF, 32 GB RAM, Windows 11 26200, release build. Head
839a163merged locally ontonvidia-devaf2cecc4together with #2357 (both runs below carry #2357 withXCL_TARGET_PAGES_MB=4096, so only this PR differs). One conflict inretire_free_pools:nvidia-devalready retires a pool only when its tiles have cooled (free_heapsoverfreeandcooling). I kept that and took this PR's flag per pool in place ofgone.contains(...), plusPOOL_TILES = 64. So this is not the exact head. Same title and start,XCL_ADAPTER=3060 XCL_GFX_PSO_WAIT_MS=200 XCL_PREPARE=0 XCL_ACTIVITY=1, compute pipelines warmed, one run each.Sparse pools from the 2 s
memory:line (MB):nvidia-devit was already 44–134 MB rather than the 1.5–2.0 GB of the description (that branch's cooled retiring may be why), so the saving here is tens of MB.pools_of_freed_runs_go_backpasses on the merge. Other sparse tests (mirrored_tiles_stop_at_the_cap,pages_being_decommitted_stay_holes_for_a_submit,a_copy_back_does_not_wait_for_the_title_queue) failed in acargo test --lib sparserun on the merge and also on plainaf2cecc4, so not from this PR; run alone onaf2cecc4,mirrored_tiles_stop_at_the_cappasses, so it looks like tests sharing the device in parallel (as in #2588).Not tested: the exact head or
main; more than one run each; the whole suite on the merge; AMD.AI use: Claude Code (Claude Opus 5.5) merged the branch locally, ran the runs on this machine and wrote this report.
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.