D3D12.X: XCL_UMA_UPLOAD_PRIORITY=1 keeps a mixed window's GPU_UPLOAD segment resident (nvidia-dev) #3007
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3007"
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 Kalmarv on 2026-11-27T11:54:37Z.
Stacked on #3006; only the top commit (
da9c69f7) belongs here. Part of #2688.With
XCL_UMA_DRIVER=mixed:<start_mb>:<size_mb>one range of the coherent window lives in aGPU_UPLOADheap: video memory the CPU writes through the BAR, which every console program reads its buffers from. When the process is over its video memory budget, Windows demotes heaps to system memory, and it can pick that one. Then every read of the window's hot range goes over PCIe. This switch gives theGPU_UPLOADsegmentD3D12_RESIDENCY_PRIORITY_MAXIMUM, so Windows demotes other heaps first. It is opt-in and does nothing withoutmixed.Why
On a 16 GB card in a retail title's world (title: ea3b5e4d, Series X profile; the nvidia-dev port with the mixed window), the process ran about 1.9 GB over its budget. A live ETW timeline of the run (locum
mem timeline) showed exactly one demoted heap of 1,792 MiB, the size of window 3'sGPU_UPLOADsegment (mixed:1536:1792). The same run with this switch, everything else equal (the env differs by this switch only up to the measured frames):The process stays over budget: Windows takes other heaps instead (the 64 MiB pool heaps), which cost far less per frame.
What is in it
crates/xcl/src/hle/d3d12x/uma_driver.rs:upload_priority_wanted(the switch, read once);mapped_segmentcallsID3D12Device1::SetResidencyPriority(MAXIMUM)on aGPU_UPLOADsegment's heap and logs it (or the error).Tested
XCL_DXC_DIR.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4onda9c69f7(withCARGO_PROFILE_DEV_DEBUG=0: no debug info, for disk space): 1832 passed, 9 failed, 48 ignored. The same command onnvidia-deva5e2d851: 1822 passed, 10 failed, 48 ignored.a5e2d851as well:console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly,hle::d3d12x::texture_upload::tests::gpu_parts_of_a_texture_go_up_and_the_rest_stays,hle::d3d12x::texture_upload::tests::pieces_hold_the_texels_of_their_levels,split_compute_prefers_the_offline_whole_pipeline,two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs.hle::d3d12x::vram::tests::gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark.gpu_retire_queue_holds_heap_until_blocked_queue_passes_markalone, 10 times on2fc61b64(cargo test -p xcl --lib gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark): 10 passed, 0 failed.gpu_retire_queue_holds_heap_until_blocked_queue_passes_markalone, 10 times ona5e2d851(cargo test -p xcl --lib gpu_retire_queue_holds_heap_until_blocked_queue_passes_mark): 10 passed, 0 failed.SKIPPED: 8 no wave64; 1 const_mask, wave64: no wave64; 1 f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's)); 1 f16 arithmetic, wave64: no wave64; 1 f32 arithmetic, wave64: no wave64; 1 f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's)); 1 f16 packed, wave64: no wave64; 1 f32 compares, wave64: no wave64; 1 integer arithmetic, wave64: no wave64; 1 mask_ff0_flbit, wave64: no wave64; 1 f64, wave64: no wave64; 1 f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's)); 1 f32 conversions, wave64: no wave64; 1 integer carries, wave64: no wave64; 1 f32 rounding, wave64: no wave64; 1 f32 transcendentals, wave64: no wave64; 1 f32 three-source, wave64: no wave64; 1 no heap windows (opt-in: XCL_HEAP_WINDOWS=1); 1 no heap windows.Build and test (Windows, no GPU)is red onnvidia-devitself and on every PR into it, this one included: the lib test process ends with0x887a0020in a sparse test on the runner's software adapter, with no test reported failed. #2837 fixes that test; nothing here touches it.Regression run
150 s runs, same title, same env (
XCL_HEAP_WINDOWS=1 XCL_DIRECT_DXIL=all XCL_DIRECT_SPLIT_INSTRUCTIONS=0 XCL_PSO_JOURNAL=0 XCL_DRED=1 XCL_GPU_WAIT_TIMEOUT_MS=120000, DXC 1.9), no switch of this PR set. Themainrun from a hard-link copy of our team branch's DXIL cache; the base and head runs from hard-link copies of one cache warmed onnvidia-deva5e2d851(on this branch the title starts after about 75-90 s of startup shader preparation, so 60 s would end inside it).A commit of
main(b49be183, the last one before the shader preparation screen of #2555):The base,
nvidia-deva5e2d851:This PR's head:
Not tested
GPU_UPLOADsegment in run NS8.mixed), so it shows the default path is unchanged; the switch itself ran only in NS8.GPU_UPLOADheap there may already be placed differently), cards with other budgets, titles other than ea3b5e4d, layouts other thanmixed:1536:1792.mixed: left opt-in.AI use
Claude Code: the change was written with Claude Fable 5; Claude Code (Claude Opus 5.5) ran the suite and the regression runs on the hardware above and wrote this description.
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by throny on 2026-11-27T16:09:05Z.
In-world test of this stack on an RTX 4080 16 GB (driver 621.40, 2 GiB shader-heap profile, Resizable BAR on: 16 GB BAR1), i9-12900K, Windows 11 26300, 64 GB + 32 GB page file. Tree:
nvidia-devd1be8103+ this PR's diff (which carries #3003-#3006) + #3008 + #3036 + #2987, and #684 / #2951 / a local press-timing patch so launches are quick and the scripted presses arrive. One build; the runs differ only in switches. Same save, 600 s each, default heap placement,XCL_TEXTURE_LEVEL_PAGES=1 XCL_CS_PSO_WAIT_MS=200 XCL_TWO_PASS_MB=3072. Presents per second are taken from 240 s after the first game frame to the end (356-358 s in the world).XCL_UMA_DRIVER=mixed:1536:1792GPU_UPLOAD+ 767 MB CUSTOMXCL_UMA_UPLOAD_PRIORITY=1+XCL_SMALL_TEXTURES=1No device removal, crash or pipeline-wait timeout in any of the three; process commit about 50 GB.
For scale, on the same card and save:
nvidia-devwithout this stack does about 0.3 presents/s at default placement, and 1.5-1.7 withXCL_COHERENT_HEAPS=sparse(runs earlier today on3f39671d/d1be8103). So the driver heap of #3003 alone is the big step here (0.3 → 2.75), and the mixed window adds about a third on top (2.75 → 3.71). The two extra switches in run C did not help on this card (3.30 against 3.71; one run each, so I would not call it a loss either). I see nothing like the 24-25 fps of #2938 here; the frame is GPU-bound at 100 % in all three.Not tested: the picture (the world is black on this machine on every build, see #505), runs longer than 10 minutes, an adapter without Resizable BAR, other range layouts, each of #3008 and #3036 on its own.
Numbers are from the logs of these runs. AI use: Claude Code (Claude Fable 5.2) ran the tests and wrote this.