D3D12.X: report UMA DXGI backing and D3D12 heap commit without allocating UMA #3229
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3229"
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 lnqigr on 2026-11-28T23:25:18Z.
Follow-up to #2697; part of #3211 (Workstream C) and #1773.
On current
main,memory_report::snapshot()callsuma::get(), which can allocate and commit the coherent UMA window on a fresh process before the title asks for it (noted by@thehollowedoneon #2697). It also leaves both WDDM's commit charge for D3D12 heaps and the DXGI-backed coherent UMA window unattributed insideother.This PR adds a read-only
uma::existing()accessor, tracks per-device coherent UMA bytes counted by DXGI across allopen_umamodes (driver CUSTOM L0,mixed:GPU_UPLOAD + L0, legacyOpenExistingHeapFromAddress, and shadowed windows without double counting), and reportsD3D12 heapsonCommitplusUMA windowon its DXGI segment.What is in it
crates/xcl/src/gpu/uma.rs: adduma::existing()returning the initializedUmawithout allocating one.crates/xcl/src/hle/d3d12x/real.rs: record per-device coherent UMA(non_local, local)bytes backed by DXGI inopen_uma(0 for shadowed windows whose CPU and GPU allocations are separate) and exposeuma_dxgi_bytes_for(device).crates/xcl/src/hle/d3d12x/memory_report.rs: switchsnapshot()touma::existing(), addD3D12 heaps((local + non_local).saturating_sub(uma_dxgi_shared)) onCommitandUMA windowon its DXGI segment (UMA window (local)whenmixed:placesGPU_UPLOADsegments in local VRAM), plus unit tests and a child-process regression provingsnapshot()does not initialize UMA.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), debug + release.cargo test -p xcl --lib memory_report -- --nocapture --test-threads=1: 5 passed, 0 failed, 0 ignored (0 skipped).cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 2,596 passed, 0 failed, 49 ignored across 41 test targets.SKIPPEDGPU tests (30 total): 21no wave64(NVIDIA wave32 adapter), 4no D3D12 debug layer / Developer Mode(0x887A002D/ missingd3d12SDKLayers.dll), 3per-lane f16/f32 refused (#1426), 2no heap windows.dc7b94e1, 60 sXCL_ACTIVITY=1 XCL_PREPARE=0, NVIDIA driver CUSTOM L0 UMA): at t=60 s,commit otherdropped from9235 MB(main7db2f391) to2799 MB(D3D12 heaps 6812), andnon-local otherdropped from4765 MBto754 MB(UMA window 4095).Regression run
mainbaseline (XCL_PREPARE=0):PR head (
XCL_PREPARE=0):Not tested
non_local.budget == 0),XCL_UMA_DRIVER=mixed:...,XCL_UMA_SHADOW=1, and Wine on live hardware (covered by unit tests only).AI use
#2697/ currentmainUMA paths, wrote the code, unit tests, and PR description, and ran the workspace tests and smoke runs locally; the human contributor (lnqigr) directed the scope and reviewed the diff and results before opening the PR.Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T01:20:47Z.
merge-check
base:
fa204595a4head:
0ba1060ca1merge: clean (trial merge 66558152906181c51030745b97a582dbcea1aa8e, local, not pushed;
git diff --checkclean)build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DXC_DIR = DXC 1.9.2609) -> 2609 passed, 1 failed, 49 ignored; SKIPPED: 26 (21 no wave64 on this 32-lane GPU, 3 per-lane f16/f32 forms refused (#1426 semantics), 2 no heap windows); failing:
hle::d3d12x::list_x::tests::bundle_generations_propagate_and_final_release_runs_outside_lists("final COM Release ran under LISTS"). This PR doesn't touchlist_x, and the test passed 3 of 3 times when rerun alone on the same merge. Its probe isLISTS.try_lock().is_ok(), so any parallel test holding the globalLISTSlock at that moment fails it. All fivememory_report::testsran and passed, including the newheap_charge_and_uma_segment_avoid_double_countingandsnapshot_does_not_initialize_uma(child process) and the extendeddevice_snapshot_has_budget_and_all_owners.review: none blocking; whole diff read (uma.rs, memory_report.rs, real.rs).
snapshot()now reads the UMA region withuma::existing()instead ofuma::get(), so a report no longer creates the region; in a run it already exists, so values don't change.open_umarecords, per device, the coherent window bytes DXGI counts: a non-shadowed CPU-built window goes to non-local in full. A driver-remade window goes to non-local for its write-watched CUSTOM L0 segments and to local for the rest, which in a mixed window are itsGPU_UPLOADsegments;uma_driver::Remadedocuments watched regions as exactly the CUSTOM ones. Shadowed windows are left out. The new "D3D12 heaps" Commit part is local + non-local usage minus that shared amount, saturating and 0 when either segment is unknown. The "UMA window" non-local part goes toKind::Videoon a single-segment adapter. The new parts change theotherremainders the report prints, as intended. That Windows charges process commit for D3D12 local heaps is the PR's model; I didn't verify it independently, but the numbers below are consistent with it.performance: reporting only; one extra mutex read per snapshot. Title run (release build of the merge, scratch/fast-world.py fast profile, 30 s in world; same cache snapshot and harness as a main
fa204595run): exit 0, 0 crashes, 0 removals, world entry 91.1 s (main 90.6 s), peak commit 29,964 MB (main 28,620 MB, +4.7 %; this run compiled more pipelines in the world, and the PR allocates nothing), 91 WARN lines (main 70), no new WARN kinds,failed_pipelines0, no translation errors. All 125 "memory by owner" lines have non-negative remainders. The last one: commit 29,661 (UMA window 5,094, sparse CPU copy 1,561, D3D12 heaps 12,016, other 10,989); video 12,555 (... UMA window (local) 1,792, other 1,831); non-local 4,555 (UMA window 3,302, other 1,253). So DXGI's shared bytes (3,302 + 1,792) equal the 5,094 MB window, and Commit "other" drops from about 21,985 MB on main to 10,989 MB. Both runs show 0 fps in the world because the cache doesn't match the translator identity; timings are noise.verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74, wave32 only, Resizable BAR), AMD Ryzen 9 9950X, Windows 11 build 26200; rustc 1.99.0, debug test profile, release build for the title run, DXC 1.9.2609 via XCL_DXC_DIR. Claude Code, Claude Opus 5.5: merge, build, suite, title run and full-diff review; this report.
Imported from ivall/xcl. Originally posted by throny on 2026-11-29T08:41:42Z.
merge-check claim
head:
0ba1060ca1Imported from ivall/xcl. Originally posted by throny on 2026-11-29T09:01:01Z.
merge-check
base:
d8bd9a38head:
0ba1060ca1merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2620 passed, 0 failed, 49 ignored (27 SKIPPED lines). Base alone at
d8bd9a38: 2618 passed, 0 failed, 49 ignored. The new test starts its own test binary once more as a child for one test; nothing else is spawned.review: no blocking finding. Diagnostics only: the snapshot no longer creates the UMA region, a "D3D12 heaps" commit estimate is added, and the UMA window is listed under the segment it lives in. The split by segment is right for the write-watched, upload and shadowed cases. One assumption is not shown in the code: that Windows charges D3D12 video-memory use to the process's commit; a measurement in the description would settle it.
performance: none for a title (report code).
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).