Repository navigation
D3D12.X: XCL_UMA_DRIVER=mixed keeps part of the coherent window in VRAM (nvidia-dev) - #3005
Conversation
… on NVIDIA The title's GPU code reads and writes the coherent window (4 GiB of host memory) through a heap opened with OpenExistingHeapFromAddress. On an RTX 5070 Ti, GPU loads from such imported pages ran 8-24x and atomics 13-22x slower than from a driver CUSTOM write-back L0 heap in host memory, at the same CPU caching. A whole-frame replay of a captured title frame took 172 ms of GPU time with the window in a CUSTOM L0 heap and 1,427 ms with it imported as XCL does, the hot compute programs 18-39x slower each. At open_uma the window's written pages are copied out, the window is released, every other free stretch of 1 GiB or more is reserved for a moment so that the driver's CPU mapping of a new CUSTOM L0 heap can only land in the hole the window left, and the pages are copied back. The title keeps its pointers. If the mapping lands anywhere else, or a step fails, the window is made again at its address with its pages and imported as before; if the snapshot of its written pages fails, the window is not released at all (found in review by thehollowedone, with the test failed_write_watch_does_not_release_the_original_window). Buffers placed in it drop ALLOW_CROSS_ADAPTER. The heap is made with D3D12_HEAP_FLAG_ALLOW_WRITE_WATCH, and GetWriteWatch reads the mapped window on an RTX 5070 Ti (driver 610.74), so the window stays in the write-watched regions and the title's CPU writes reach its textures as with the import; a driver that refuses the flag, or whose mapping GetWriteWatch cannot read, keeps the import. On by default for an NVIDIA adapter outside Wine; XCL_UMA_DRIVER=0 turns it off, XCL_UMA_DRIVER=1 (or custom) turns it on elsewhere. Ported to nvidia-dev (joeypercia): the driver heap is tried in open_uma's per-window loop before nvidia-dev's import / video-memory shadow, and not with XCL_UMA_SHADOW=1; a shadowed or driver-heap window gets no ALLOW_CROSS_ADAPTER.
A title list's extra segments (mid-list splits) are parked as spares at the list's next Reset, and the segments KickoffX takes back become spares too. A spare records again only after its own later Reset, but alloc_pool still counted it as a user of the PC allocator it last recorded on, so that allocator was never free: each later Reset of the title's allocator while those were "in use" put another PC allocator aside, and none was ever reused or released. The previous recording a stand-in replaces at Reset pinned its allocator the same way. alloc_pool::park_list drops the list from its allocator's users (its submit marks stay, so the allocator is reused only once the GPU is past them). title_list::reset parks the moved segments and the replaced recording; KickoffX parks its reclaimed segments after both submits. Measured on the title (RTX 5070 Ti, Series X profile, 240 s untimed runs, object counts from 100 to 240 s): PC allocators 1,137 -> 1,928 without, 728-753 -> 862-897 with; non-local video memory 6.2 -> 9.6 GB without, 5.0 -> 5.4-5.5 GB with (about 4 GB less at 240 s). Timed pairs showed no frame-rate cost (late window 11.99 / 10.76 fps without, 10.76 / 11.76 with; run-to-run spread ~10 %). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With XCL_UMA_DRIVER=mixed:<start_mb>:<size_mb>[,...] the coherent window becomes several driver heaps instead of one CUSTOM heap: each listed range a GPU_UPLOAD heap (video memory the CPU writes through the BAR; on NVIDIA it stays in video memory up to 2 GiB) and the rest CUSTOM write-back L0 heaps. Each segment's CPU mapping lands at its place in the window (every slot reserved first, the rest of the address space groomed as for the single heap), and one reserved buffer over the window maps its 64 KiB tiles onto the segments' heaps, so shaders and placed resources see one window as before (UMA_HEAPS keeps the segments; uma_heap_for picks one). - The CUSTOM segments are write-watched as the single heap is; a segment that refuses it fails the remake, which restores the window and keeps the import. The GPU_UPLOAD segments are not write-watched: their write-combined pages refuse the watch trap's read-only protection. Uma::watch_regions lists only the watched segments. - CPU reads of the GPU_UPLOAD segments through the BAR ran at 12-84 MiB/s, so the title texture code reads them by a copy on the COPY queue into a readback buffer (read_vram_bytes). - A window that cannot be made again at its address after a failure stops the process, as the single-heap remake does. On the title (RTX 5070 Ti, Series X profile, mixed:1536:1792 with the team's set: watch trap, declared LDS, A9 byte stores, level pages, parked spares), fps.py over 187-229 s: 25.28 fps (TX1) and 24.15 (CB2m3), against 11.99 with one CUSTOM heap (CB2) in the same set. Written by reed (57496b69 on our team branch); ported onto xcl-dev#2844's head. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With 16 windows the coherent memory can be several windows (4095 + 999 MB for a retail title's 4582 MB of GPU heaps). The mixed ranges are offsets in the first one; in a second, smaller window they had no overlap, the remake failed with "no GPU_UPLOAD range inside the window" and the window stayed imported. Further coherent windows are one CUSTOM heap each. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@Kalmarv, carrying over one confirmed case from the closed #2938 so it doesn't get lost in the split. A title buffer placed at its own address (
The GPU regression test and its RTX 5090 result (control 3/3 pass, alias check 3/3 fail) are in #2938, #2938 (comment). The test applies here as it is. In our in-title runs at Your loyal testing minion, now following you from PR to PR like a lost duckling. AI use: Gemini (Antigravity) mapped the split; Claude Code (Claude Opus 5.5) checked the lines at |
|
RTX 3060 12 GB (NVIDIA), retail title, 300 s: this PR Release builds,
So the switch moves part of the coherent window from system memory into video memory, as described. On a 12 GB card the title is already about 5 GB past local video memory without it, and the switch adds to that. Frames and when presenting stops are the same either way here. Neither side gets past world load, so this says nothing about frame rate in the world. The comparison is with the RTX 3060 12 GB (driver 581.80), i9-14900KF, 64 GB RAM, Windows 11 26200. AI use: Claude Code (Claude Opus 5.5) built the trees, ran the title and wrote this report. |
|
@Kalmarv, we validated your work on an RTX 5090 (driver 621.24, no shader-heap profile): your Your
Your ports, as a local merge of #3007's head
If it helps:
Update: the same A/B on a graphics-warm cache. Each slot is a recording launch with creation-time graphics history, then a measured relaunch, ABBA. A' =
Update 2: the measurement, with the shader heap at 2 GiB (NVIDIA profile
So about 4.7x with your ports, consistent from run to run. Each recording launch captured 983-1,031 history records, including all 135 of the slow pipelines, and the measured relaunches had 0 slow cold graphics builds in three of the four slots (10 builds, 23.9 s, in one A' slot). Credit for all of this is yours. Tell us which of these would help. The minion has now driven your tree farther into the world than any of ours, and would like a raise in the form of more PRs to test. AI use: Claude Code (Claude Opus 5.5) ran the arms (t12) and wrote this comment; Gemini (Antigravity) mapped the trees and did the safety review. |
|
merge-check Local write-watch candidate (focused regression passed; not a complete PR fix)diff --git a/crates/xcl/src/hle/d3d12x/uma_driver.rs b/crates/xcl/src/hle/d3d12x/uma_driver.rs
@@
- match mapped_segment(device, len, upload, !upload) {
- Ok((heap, buf, p)) if p == want && (upload || readable(want, len)) => placed.push((off, len, upload, heap, buf)),
+ match mapped_segment(device, len, upload, true) {
+ Ok((heap, buf, p)) if p == want && readable(want, len) => placed.push((off, len, upload, heap, buf)),
@@
- if !upload {
- watched.push((base + off, len));
- }
+ watched.push((base + off, len));The regression should assert that |
|
Cross-adapter capability check for the proposed GPU_UPLOAD write-watch path on RTX 5070 / NVIDIA 616.92, Windows 11. I used native D3D12 and Win32 with a 1 MiB GPU_UPLOAD heap and a placed buffer configured like the PR; three fresh processes gave the same result.
This supports the proposed capability on this Blackwell card. It is a native API probe, not an end-to-end XCL fix: mixed-window rollback, texture-refresh integration, fixed-address aliases, submission cost, and retail behavior remain untested. AI use: OpenAI Codex with GPT-6.2 Astra built and ran the probe; Codex reviewed and prepared this report. |
|
@Kalmarv, one more thing from building #3005-#3007 onto current AI use: Claude Code (Claude Opus 5.5). |
|
Tested Clean I ran each test with
2 passed, 1 failed, 0 ignored, 0 runtime skips. Not tested The assertion stopped the fixture before the whole-buffer GPU copy and native VRAM reader checks. The run also excluded concurrent VA activity, unsupported adapters or fallback, retail smoke, performance, and the full suite. AI use T3 Code through the Codex harness ( Tested — readback and write-watch follow-up at Windows 11 25H2 build 26200.9974, Ryzen 7 3800X, Intel Arc A770 driver Each command used
2 passed, 0 failed, 0 ignored, 0 runtime skips in this follow-up. Both native and wrapper exits were 0, each lock released, and the executable hash matched before, during and after each lock. Not tested Unsupported adapters or fallback, concurrent address-space activity, other heap layouts, retail smoke, performance, and the full suite. AI use T3 Code through the Codex harness ( |
|
Integrated-main check at The mixed window was 64 MiB CUSTOM / 128 MiB GPU_UPLOAD / 64 MiB CUSTOM. Each round rewrote 128 contiguous 16-byte records (root index plus Dispatch dimensions, 2 KiB total). Both arms received each input pattern. The shader incremented the record-selected counter once per dispatched group; destination indices and group counts changed across pattern pairs. After each fenced round all 128 cumulative counters matched the CPU oracle: 6,144 checks across 48 rounds.
Alternating ABBA blocks, first eight rounds discarded, 20 measured per arm. Native GPU timestamps bracket argument preparation on the queue and the indirect dispatches; readback and the CPU wait lie outside the interval. GPU sample ranges overlapped (36.224–43.616 and 38.496–45.824 µs). CPU figures exclude recording/submission and use a debug test build. The fixture uses XCL's production mixed-window remake with native D3D12 command consumption; the staging arm is a matched explicit copy, not a measurement of an XCL guest staging policy. Each round waits before reusing the records, so this does not establish throughput with multiple frames in flight or a title-level speedup. I verified the heap mapping because a preliminary 48 MiB layout fell back to CUSTOM on this machine; that run was excluded. AI use: OpenAI Codex built the test-only fixture, ran the native controls and drafted this report. |
Stacked on #3004; only the top two commits (dbaa3b2, b3d6312) belong here. Part of #2688. The same change as the first part of #2938 on
main.With
XCL_UMA_DRIVER=mixed:<start_mb>:<size_mb>[,...]the coherent window becomes several driver heaps instead of one CUSTOM heap: each listed range aGPU_UPLOADheap (video memory the CPU writes through the BAR) and the rest CUSTOM write-back L0 heaps. Each segment's CPU mapping lands at its place in the window (every slot reserved first, the rest of the address space groomed as the single-heap remake does), and one reserved buffer over the window maps its 64 KiB tiles onto the segments' heaps, so shaders and placed resources still see one window. Off unless the switch is set; it applies to the first coherent window only.Measured share, on
main(RTX 5070 Ti 16 GB, Series X profile, timed runs alone; #2938): one CUSTOM heap 11.99 fps against the mixed window 24.15 fps over 187-229 s in the world, everything else equal (2.01x); the window'sGPU_UPLOADpart cut PCIe traffic by about two thirds. Onnvidia-devour team's world runs (16 GB card) all usedXCL_UMA_DRIVER=mixed:1536:1792; with it the next commits (#3007) took the world from ~1.8 to 5.1 fps, so it is the base of that work.What is in it
uma_driver.rs:mixed:parsing (parse_mixed,decide),build_segments,remake_window,remake_mixed, andread_vram_bytes(theGPU_UPLOADsegments read on the COPY queue into a readback buffer: CPU reads through the BAR ran at 12-84 MiB/s).GPU_UPLOADsegments are not write-watched;Uma::watch_regionslists only the watched ones (gpu/uma.rs).real.rs:UMA_HEAPSkeeps each window's segments,uma_heap_forpicks the one a placed resource falls in.title_textures.rs:with_title_bytesreadsGPU_UPLOADsegments throughread_vram_bytes.mixed_ranges_parse_in_order,mixed_segments_cover_the_window, the GPU testmixed_window_keeps_its_bytes_and_the_gpu_sees_every_segment.GPU_UPLOADheaps and for a console buffer across two segments are the next PR (D3D12.X: XCL_UMA_DRIVER=mixed falls back without GPU_UPLOAD heaps and keeps console buffers in one segment (nvidia-dev) #3006).Tested
XCL_DXC_DIR.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4on b3d6312 (withCARGO_PROFILE_DEV_DEBUG=0: no debug info, for disk space): 1831 passed, 8 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.SKIPPED: 8 no wave64; 1 f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f16 arithmetic, wave64: no wave64; 1 const_mask, wave64: no wave64; 1 f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f16 packed, wave64: no wave64; 1 f32 arithmetic, wave64: no wave64; 1 integer arithmetic, wave64: no wave64; 1 f64, wave64: no wave64; 1 mask_ff0_flbit, wave64: no wave64; 1 f32 compares, wave64: no wave64; 1 integer carries, wave64: no wave64; 1 f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's)); 1 f32 conversions, 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. Tests: sparse tests take CI's Basic Render Driver for a software device #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
mixed:1536:1792. Cards with less than 16 GB. The remake reserves the process's other free stretches so the driver maps each segment at its place; a thread that frees 64 MB or more of address space during it can let a segment map elsewhere, which stops the process. Not seen in title runs; the switch is opt-in.AI use
nvidia-dev, wrote the tests, ran the suite and the regression runs, and wrote this description.🤖 Generated with Claude Code