Repository navigation
D3D12.X: count the resources XCL makes for itself, by where it makes them - #2750
joeypercia wants to merge 2 commits into
Conversation
luckyteagirl
left a comment
There was a problem hiding this comment.
On 51f3149, resource_census::track classifies every UPLOAD/READBACK resource as NonLocal from heap.Type alone. That is wrong for an integrated UMA adapter: Microsoft maps L0 to DXGI LOCAL on UMA, and UPLOAD and READBACK both use L0 there. The new snapshot subtracts these bytes from non_local.usage, so on an integrated GPU it overstates the local other remainder and can report a negative or nonexistent non-local remainder. The new GPU test hardcodes UPLOAD as NonLocal, encoding the same assumption. XCL's existing uma_segment helper already treats an absent non-local segment differently.
Could classification use the resource device's architecture (and the chosen memory pool for custom heaps), so L0 counts as local on UMA and non-local on discrete? Please cover both architectures in a small classifier test and make the GPU assertion follow the actual adapter. This is exact-head source review using the D3D12 memory-pool contract; I did not run the new census test on both adapter types.
|
Thanks, right. A census part in an upload or readback heap now goes where #2697 already puts the coherent window. On an adapter with a non-local budget it's non-local; on an integrated GPU, which has one segment, it's local ( |
51f3149 to
ed8707c
Compare
|
Independent Windows/NVIDIA test of #2750 head Windows 11 build 26300, RTX 3080 Ti (12 GB, NVIDIA driver 621.35), rustc 1.99.1 MSVC. A clean exact-head checkout was used.
Not tested here: an integrated/UMA adapter, a paired retail smoke run, world-load memory growth, or FPS impact. The tests establish the current head's behavior on this discrete adapter; they do not resolve the frame/commit difference in the author's 60-second smoke blocks. AI use: Codex (GPT-6.2 Sol) ran the tests and drafted this report. |
ed8707c to
b6d75e3
Compare
b6d75e3 to
fc3a1ef
Compare
|
I reran the resource-census and memory-report tests at clean head Tested Windows 11 Home build 26200, Ryzen 9 5980HX, AMD driver cargo test --locked -p xcl --lib -j 1 hle::d3d12x::resource_census::tests -- --test-threads=1 --nocapture
cargo test --locked -p xcl --lib -j 1 hle::d3d12x::memory_report::tests -- --test-threads=1 --nocapture
All four commands exited 0, with 0 failures, 0 ignored, and no skip markers. The census fixture checks resource lifetime. The report tests cover synthetic segment and heap-charge cases plus whether a live snapshot includes budgets and expected owners. Not tested No title, full workspace suite, or measured per-heap process commit delta. The tests do not establish the accuracy of every runtime memory attribution. AI use OpenAI Codex (GPT-6.2 Sol) ran the tests, checked the exact revision and backend logs, and drafted this report. |
What the video memory in use is made of could not be told from the XCL_ACTIVITY memory line: it gives no budget, and three of XCL's owners (xcl-dev#2688, workstream 1). memory_report::snapshot() takes the process's commit, and DXGI's local and non-local usage with their budgets, and XCL's parts of each: - commit: the UMA coherent window, and the CPU copy of mapped sparse tiles (a title page in a sparse window is committed on the CPU too); - video memory: target pages and the free part of their pools, arenas, mapped sparse tiles, free sparse pools, retired sparse pools (counted now: sparse::retired_bytes), and title textures that are committed resources of their own (title_textures::committed_bytes, console size). What each total holds besides them is its own part, "other". XCL_ACTIVITY logs it as a line of its own after the memory line, which stays as it was (scripts/smoke.ps1 and the integration branches' tools read it). Part of xcl-dev#2688. Assisted-by: Claude Code (Claude Opus 5.5)
fc3a1ef to
50cfb32
Compare
…them XCL's buffers sized per list or per submit (copy scratch, fill patterns, readbacks, upload staging, ...) were not in the memory line, so memory that grows with the title's submits could not be told apart from the title's own (xcl-dev#2688, workstream 1). resource_census::track gives a resource XCL made a small COM object as private data; D3D12 releases it with the resource, which takes it off its place's count. The eleven places XCL makes committed resources at run time are tracked. Each place's bytes are a part of the memory line, and a line of its own gives how many of each are alive and made. Part of xcl-dev#2688. Stacked on xcl-dev#2697. Assisted-by: Claude Code (Claude Opus 5.5)
Stacked on #2697; only the top commit belongs here.
Counts the D3D12 resources XCL makes for itself, by the place it makes them: how many are alive, how many were made, and their bytes. #2697's memory line then shows each place as a part, and a line of its own lists the counts. Growth that follows the title's submits shows up as one place whose count keeps climbing. That's what @GreemSC's measurements on #2688 needed to tell XCL's own buffers apart from the title's. Part of #2688 (workstream 1, part 2 of the plan there).
What is in it (one commit)
crates/xcl/src/hle/d3d12x/resource_census.rs(new):track(res, site)counts a resource XCL made and gives it a small COM object (IUnknown, a hand-made vtable as innull.rs) as private data (SetPrivateDataInterface).GetResourceAllocationInfo. A resource in an upload or readback heap is in system memory, andmemory_report::census_kindputs it where D3D12.X: a memory line by owner, against DXGI's budget #2697 puts the coherent window: non-local on a card, local on an integrated GPU with one segment (luckyteagirl's review). Everything else counts as video memory.tracked(Option<ID3D12Resource>, site)wraps a creation's result.tracked:list_x.rs: copy scratch, fill pattern, timestamp readback, predication;bind.rs: ExecuteIndirect argument order;present.rs: frame dump readback;real/dispatch_chain.rs: dispatch chain scratch;sparse.rs: staging, zero buffer, readback;gpu/texture.rs: upload staging.memory_report.rs: each place's bytes are a part of the line by owner, so they come out of "other".census_line()givesmemory: XCL's own resources (alive): <place> <alive> of <made> made, <MB> MB; …, logged after it underXCL_ACTIVITY.a_tracked_resource_counts_until_it_is_destroyed:madestays.Without the private data (
SetPrivateDataInterfaceleft out) it fails at its first count.Tested
XCL_ADAPTER=Radeon. Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11. Debug builds for the tests, release for the runs.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on44a7e6fe:hle::d3d12x::frame::tests::origin_events_issue_tokens_and_flips_have_statistics("4 origins at 60 Hz took 216 ms"): a timing test that ran while a title run of mine used the same GPU. Alone it passes 3 of 3 on this head and on D3D12.X: a memory line by owner, against DXGI's budget #2697's.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, which fails the same way onmainon this iGPU (DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #2115).... ok), not skipped.Regression run
RTX 4070 Ti (driver 621.40), release builds, 60 s each,
scripts/smoke.ps1 -Game <folder> -Title retail-titleon the newer retail title, with the same settings. Both ran with the NVIDIA shader-heap profile (#2590, 1 GiB) installed on this machine.mainb49be183(the base of #2697 and of this) and this PR's head (no uncommitted changes):main:
PR:
Not tested
nvidia-devrun; the lines will go on [OFFICIAL] Swarm: RAM and VRAM use down, towards stable 30 FPS on AMD and NVIDIA #2688.vram,sparsepools: already parts of the line), and the title's own resources (not XCL's to count).GetResourceAllocationInforeturningUINT64_MAX) count as 0.AI use