Repository navigation
D3D12.X: XCL's render-target arenas and window pools get a residency priority - #3156
Conversation
|
On an RTX 5070, enabling residency priority alone issued no HIGH request for the three target placements I tested. All three went through tiled texture pages under the default backing policy. Forcing arena backing supplied a positive control: the native driver accepted HIGH for each of the three arena heaps. I tested exact head
For the proposed world-load comparison, counting target placements by actual backing would help interpret an on/off result: a hot render or depth target can share a default-priority texture-page pool on this adapter. This was a bounded placement test, four passes and zero skips. It did not exercise sparse-window buffer pools or measure OS eviction order, residency under pressure, frame time, or a retail workload. AI use: OpenAI Codex (GPT-6) prepared the test-only fixture, ran the native controls, and wrote this report. |
599a31d to
a067891
Compare
|
Thanks @andrewDoing, the placement test and the arena control made this clear. Confirmed: What changed (amended into the single commit; rebased onto
The full suite was run against Written with Claude Code (Claude Opus 5.5). |
15d8246 to
2a96db1
Compare
…priority On an 8 GB card a retail title's world holds about 16 GB of local video memory against a 7.25 GB DXGI budget (10 GB with the lazy sparse and level-page switches). Windows then demotes allocations to system memory with no hint which matter, so what a frame renders to can be paged out while idle texture pages stay. XCL never called SetResidencyPriority on its own heaps (only xcl-dev#3007's GPU_UPLOAD segment, under XCL_UMA_DRIVER=mixed). With XCL_RESIDENCY_PRIORITY=1 (read once, off by default so it can be measured) each heap gets the priority of its role once, with nothing per frame: - render-target / depth arenas (vram.rs arena_heap): HIGH, when made - tile pools of the sparse windows, which hold the title's buffers (sparse.rs take_tile): HIGH, when made; a retired pool taken back keeps it - 64 MiB texture page pools holding pages of a render target, depth buffer or UAV texture: HIGH, once per pool, when the target is mapped onto it (Pages::keep_pools, from place_on_pages and remap_if_unmapped). By default `place` puts these targets on texture pages, not in arenas (arenas only with XCL_VRAM_ARENAS=1 or for a target that cannot be reserved), so without this the switch gave HIGH to no target at all. A reclaimed pool's slot forgets it; a pool keeps HIGH after its target leaves. - other texture page pools (vram.rs alloc_pool_heap): NORMAL, the default, so no call None gets MAXIMUM, which stays xcl-dev#3007's. The mapping is pure (role_priority, pages_role, newly_high) with unit tests; a failed call is logged once and leaves the heap at the default. The heaps given HIGH are counted by role and logged at each power of two of the total. andrewDoing's test report on the PR found that with the default backing policy render, depth and UAV targets went on texture pages and the switch issued no HIGH call; only XCL_VRAM_ARENAS=1 gave the arenas HIGH. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2a96db1 to
8137789
Compare
|
World test of 8137789 with
Seconds per 100 world frames (frames 50→150), same exe, the write-combined GPU heaps in video memory as #505 describes:
Without the priorities, Windows demotes per-frame targets and tile pools while over budget, and the GPU sits at ~59 W with ~4.6 GB/s read over PCIe. On this card the switch is the larger half of a ~2.2× gain. Not tested: AI-assisted. |
|
No open or merged PR sets residency priorities on these heaps. The merged #3007 ( AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
Queued an in-world A/B of this on an RTX 4080 16 GB: AI use: Claude Code (Claude Opus 5.5). |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
|
First in-world pair, RTX 4080 16 GB (621.40),
No device removal or crash in either. That is the largest single gain we have measured from a switch (+52 %), while video memory stays just as far over budget, which fits the switch deciding what stays resident rather than how much. A repeat pair in reverse order is running to rule out run-to-run noise; I'll add it here. AI use: Claude Code (Claude Opus 5.5). |
|
Repeat pair in reverse order confirms it (same build and settings as above):
So about +50 % presents/s and half the GPU time per call for the most expensive program on an RTX 4080 16 GB, with video memory just as far over budget either way; no device removal or crash in four runs. I'm doing a merge check on this head next. AI use: Claude Code (Claude Opus 5.5). |
|
merge-check claim |
|
merge-check |
|
Merged at the checked head AI use: Claude Code (Claude Opus 5.5). |
|
A/B on AMD under Linux, for the "default on AMD too?" question: Setup: AMD Radeon RX 7800 XT (16 GB, RADV NAVI32), Mesa 26.3.1, Linux 7.3, Wine 11.21 (staging), vkd3d-proton 3.1, Ryzen 7 7800X3D. The build is
The switch was active: the log shows Result: no measurable effect on this AMD/Linux setup. Frames are within run-to-run noise (+0.8 %), and the memory curve is the same: it stays far over budget on both sides and spills to system memory either way. That matches an earlier measurement here: on vkd3d-proton + RADV, residency priorities do not change what gets demoted. It does no harm either: no extra faults or crashes. So on AMD under Linux there is no reason for or against a default; whether it helps AMD on Windows (AMD's own driver) is untested here. |
Over its video memory budget a process has heaps demoted to system memory, and Windows has no hint which matter. XCL_RESIDENCY_PRIORITY (xcl-dev#3156) gives render-target arenas, window tile pools and texture page pools holding targets HIGH, so idle texture pages are demoted first. It was off unless XCL_RESIDENCY_PRIORITY=1. Measured on an RTX 4080 16 GB (Windows) in four world runs on xcl-dev#3156: 3.37 / 3.49 presents/s with it against 2.22 / 2.39 without (+50 %). lucsoft's A/B on an AMD RX 7800 XT under Linux/RADV shows no change. Windows + AMD is not measured yet. It is now on unless XCL_RESIDENCY_PRIORITY=0, which turns it off. The parse moves into residency_priority_enabled so a unit test covers unset, 0 and 1. Part of xcl-dev#505 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Over its video memory budget a process has heaps demoted to system memory, and Windows has no hint which matter. XCL_RESIDENCY_PRIORITY (xcl-dev#3156) gives render-target arenas, window tile pools and texture page pools holding targets HIGH, so idle texture pages are demoted first. It was off unless XCL_RESIDENCY_PRIORITY=1. Measured on an RTX 4080 16 GB (Windows) in four world runs on xcl-dev#3156: 3.37 / 3.49 presents/s with it against 2.22 / 2.39 without (+50 %). lucsoft's A/B on an AMD RX 7800 XT under Linux/RADV shows no change. Windows + AMD is not measured yet. It is now on unless XCL_RESIDENCY_PRIORITY=0, which turns it off. The parse moves into residency_priority_enabled so a unit test covers unset, 0 and 1. Part of xcl-dev#505 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Over its video memory budget a process has heaps demoted to system memory, and Windows has no hint which matter. XCL_RESIDENCY_PRIORITY (xcl-dev#3156) gives render-target arenas, window tile pools and texture page pools holding targets HIGH, so idle texture pages are demoted first. It was off unless XCL_RESIDENCY_PRIORITY=1. Measured on an RTX 4080 16 GB (Windows) in four world runs on xcl-dev#3156: 3.37 / 3.49 presents/s with it against 2.22 / 2.39 without (+50 %). lucsoft's A/B on an AMD RX 7800 XT under Linux/RADV shows no change. Windows + AMD is not measured yet. It is now on unless XCL_RESIDENCY_PRIORITY=0, which turns it off. The parse moves into residency_priority_enabled so a unit test covers unset, 0 and 1. Part of xcl-dev#505 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On an 8 GB card a retail title's world holds about 16 GB of local video memory against a 7.25 GB DXGI budget (10 GB with
XCL_TEXTURE_LEVEL_PAGES=1 XCL_SPARSE_LAZY=1). Windows then demotes allocations to system memory with no hint which ones matter, so per-frame render targets and the title's buffers can be paged out while idle texture pages stay resident. XCL never callsID3D12Device1::SetResidencyPriorityon its own heaps; #3007 does it only for theGPU_UPLOADsegment underXCL_UMA_DRIVER=mixed, and this builds on the rest.With
XCL_RESIDENCY_PRIORITY=1(off by default so it can be measured first) XCL's own heaps get a priority by role, once; nothing runs per frame. By defaultvram::placeputs a render target or depth buffer on texture pages, not in an arena (andrewDoing's measurement), so a 64 MiB texture page pool getsHIGHonce it holds pages of a render target, depth buffer or UAV texture; a pool of only sampled textures stays at the default. Related: the "residency under a budget" work in #2688 and #3098 (evicting texture mips): this does not evict anything, it only tells Windows what to demote last.What is in it
crates/xcl/src/hle/d3d12x/vram.rs:HeapRole(target arena, window pool, texture pages holding a target, other texture pages),pages_roleand the pure mappingrole_priority: the first threeHIGH, other texture pagesNORMAL(the default, no call); nothingMAXIMUM, which stays D3D12.X: XCL_UMA_UPLOAD_PRIORITY=1 keeps a mixed window's GPU_UPLOAD segment resident (nvidia-dev) #3007's.set_heap_prioritybehind the switch, called fromarena_heapandalloc_pool_heap; a failure is logged once and leaves the default; the heaps givenHIGHare counted by role and logged at each power of two of the total.Pages::keep_pools: when a target is mapped onto texture pages (place_on_pages, andremap_if_unmappedwhen a superseded target comes back), the pools holding its pages getHIGH, each pool once (newly_high); a reclaimed pool's slot forgets it.role_priority_keeps_targets_and_windows_over_texture_pagesanda_target_on_texture_pages_gets_its_pools_high_once.crates/xcl/src/hle/d3d12x/sparse.rs: a new sparse-window tile pool getsHIGH; a retired pool taken back keeps the priority it got.Tested
main5b0d5fa (same commands, same machine). The head pushed here is the same change rebased ontomain9dfbe3e without conflicts;main's newer commits also changevram.rs, which the rebase merged. CI on this head stopped with an access violation (0xc0000005) in the lib test binary whileeh::tests::the_process_ends_while_another_thread_holds_the_heapwas running, a test of code this PR does not touch (it changes onlysparse.rsandvram.rs); I cannot rerun it from my side. The test counts below were measured before that rebase.maind52ff48), the lib tests of the modules this PR touches (hle::d3d12x::sparse,hle::d3d12x::vram), release, serial, with the 20 skips: 199 passed, 0 failed, 2 ignored.cargo test --release --workspace --no-fail-fast -- --test-threads=4: the lib test binary ends early onmaintoo (exit 0x80004005 aftersparse upload preparation still failed after bounded retries), so the lib was also run alone, serially (--test-threads=1), with--skipfor the 20 tests that end the binary onmain(6list_x, 12sparse, 1texture_upload, 1uma_driver; each passes alone).main5b0d5fa):main: 139 passed, 0 failed, 20 ignored. The failure,gpu_two_pass_cache_e2e::two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs("releasing the title PSOs releases their two-pass state", 1 vs 0), is intermittent onmaintoo: run 8 times alone, it failed 2 times on this head and 2 times onmain.main: 2604 passed, 13 failed, 29 ignored. The 13 failures aremain's except thatvram::d32s8_targets_take_their_own_size_of_video_memory(which fails onmainin the long run) ended the binary here instead and was skipped, andalloc_pool::tests::a_reset_that_puts_the_allocator_aside_keeps_what_the_gpu_still_readsfailed. The first passes alone 2/2 on this head and onmain; the second passes alone 3/3 onmainand failed the same way in the serial run of D3D12.X: DRED's VA 0 output follows the device state it comes with #3119, whose change does not reach it. The first needs about 1 GB of depth targets and depends on what the run before left in video memory.XCL_RESIDENCY_PRIORITY, so the change is off there; the two new unit tests pass.main): the wave64 forms (no wave64), three f16/f32 per-lane forms refused by the recompiler, and the heap-window tests (no heap windows).Regression run
scripts/smoke.ps1 -Seconds 120 -Title 'retail title A', release builds of clean trees, one after the other on the machine in Tested, withXCL_DEVICE_TYPE=lockhart XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_WATCH_HOT=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=60000. The title is left on its own, with no input; the shader cache was warmed by two runs ofmainbefore.main:This PR:
Not tested
HIGHin it.AI use
🤖 Generated with Claude Code