D3D12.X: count the resources XCL makes for itself, by where it makes them #2750
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2750
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2750"
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?
@joeypercia on GitHub · 2026-11-26 10:06 UTC · original
joeypercia:d3d12x-memory-census→main· +518 −11 · 12 files · 2 commits · openStacked 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 #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 #2697's.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, which fails the same way onmainon this iGPU (#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 #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
@luckyteagirl on GitHub · 2026-11-26 10:09 UTC · original · reviewed
On
51f3149,resource_census::trackclassifies every UPLOAD/READBACK resource asNonLocalfromheap.Typealone. 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 fromnon_local.usage, so on an integrated GPU it overstates the localotherremainder and can report a negative or nonexistent non-local remainder. The new GPU test hardcodes UPLOAD asNonLocal, encoding the same assumption. XCL's existinguma_segmenthelper 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.
@joeypercia on GitHub · 2026-11-26 10:13 UTC · original
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 (
memory_report::census_kind). The unit test checks both, plus a video-memory part staying in video memory. It's ined8707c8; the suite and smoke rerun follow. (Claude Code, Claude Opus 5.5)@thehollowedone on GitHub · 2026-11-26 10:18 UTC · original
Independent Windows/NVIDIA test of #2750 head
ed8707c, stacked on #2697f7e4869. I reran after the author's UMA attribution update; earlier results on51f3149are not used for this report.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.
cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib memory_report -- --nocapture --test-threads=1: 2 passed, 0 failed, 0 ignored. The native snapshot test selected the real RTX 3080 Ti.cargo test --offline --locked -p xcl --lib resource_census -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored. The lifetime test selected the real RTX 3080 Ti and covered creation, a cloned reference, and final release.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --quiet: 1,438 passed, 0 failed, 47 ignored across 37 test executables. The output also printed 25 GPUSKIPPEDnotices; those paths are not counted as GPU coverage.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.
@luckyteagirl on GitHub · 2026-11-26 10:56 UTC · original
I reran the resource-census and memory-report tests at clean head
fc3a1ef986c44e22cf744d358eb49b2a9ddd076d, after the D3D12 heap commit-accounting update.Tested
Windows 11 Home build 26200, Ryzen 9 5980HX, AMD driver
30.0.13002.13003, Rust 1.99.0 MSVC, debug test profile. Separate test processes usedXCL_REQUIRE_GPU=1and the explicitXCL_ADAPTERnames below.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.
@Decodere on GitHub · 2026-11-26 12:10 UTC · original
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2750 at
44a7e6fe3431b16e26e8f199d958f86648a6bc2c(stacked on PR #269750cfb321be8277482566d31f7a29f97c3f2ef4e7; merge-baseorigin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7). Measurements and targeted test results only; not a full source review.Setup
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200rustc 1.100.0 (0ef1bc386 2026-11-09), DXC1.9.2609.5, release builds, warm DXIL/pipeline caches, quiet machine (zero concurrent builds/tests during timed runs)title: 29640639viascripts/smoke.ps1 -Seconds 60(XCL_NETWORK=0 XCL_ACTIVITY=1, default flags, no input)Targeted RTX 4060 release unit tests (
44a7e6fe)cargo test --release -p xcl --lib hle::d3d12x::resource_census:: -- --nocapture: 1 passed, 0 failed, 0 ignored (0.38 s,a_tracked_resource_counts_until_it_is_destroyedran live on RTX 4060,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::memory_report:: -- --nocapture: 2 passed, 0 failed, 0 ignored (0.37 s,a_snapshot_on_the_device_has_its_budget_and_ownersran live on RTX 4060,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::sparse:: -- --test-threads=4: 17 passed, 0 failed, 1 ignored (0.35 s,early_commit_timingignored,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::title_textures:: -- --test-threads=4: 19 passed, 0 failed, 0 ignored (0.79 s,0skipped, exit0).Live 8 GB RTX 4060 accounting under
XCL_ACTIVITY=1(60 s,44a7e6fe)scripts/smoke.ps1compatibility:29legacymemory: <N> MB committed by the processlines,29memory by owner (MB):lines (0/29negativeothervalues), and28memory: XCL's own resources (alive):census lines (starting at4.0 s).scripts/smoke.ps1parsedpeak commit: 13980 MBcleanly.memory by owner (MB):lines (first, peak VRAM, final):XCL's own resources (alive):census lines (first & final):29samples across2.0 s .. 59.2 s, MB):2.0 s)59.2 s)UMA windowsparse CPU copyD3D12 heapsother87.9%of end budget)target pagestarget pools freearenassparse tilessparse pools freesparse pools retiredcommitted texturesother29.9%of budget)UMA windowsparse stagingsparse zero bufferupload stagingotherKey findings on
44a7e6fe(RTX 4060 8 GB)othercut from64.8%to17.0%: AddingD3D12 heaps(6,670 MB,47.7%of commit) brings attributed process commit to 83.0% (11,603 / 13,979 MB, integer>> 20rounding diff1..2 MBacross all29samples; compare9,081 MB/64.8%unattributedotheron PR #26978c9433feon the same host/title).90.2%:resource_censusbreaks outsparse staging(64 MB),upload staging(32 MB), andsparse zero buffer(1 MB) cleanly alongsideUMA window(4,095 MB), matching theXCL's own resources (alive):census line (1 of 3 made, 32 MBforupload staging) 1:1 and keepingnon-local otherstrictly positive (43..457 MB, rounding diff1 MBacross all29samples).86.3%attributed (5,281 / 6,116 MB,other = 832 MB, rounding diff0..4 MB), peak6,176 / 6,959 MB(88.7%of concurrent DXGI local budget,0/29over-budget samples).Paired 60 s RTX 4060 smoke (
b49be183vs44a7e6fe)Merge-base
origin/main(b49be183):PR #2750 head (
44a7e6fe):Limits of coverage
44a7e6fe(only targetedresource_census::,memory_report::,sparse::, andtitle_textures::release tests plus paired quiet 60 s smoke).RTX 4060) only — UMA / L0=LOCALiGPU classification (census_kindwhennon_localis absent/zero) and VRAM oversubscription were not exercised on this host.sparse staging,sparse zero buffer, andupload stagingappeared inXCL's own resources (alive):; other census categories (dispatch_chainscratch, compositor targets, readback/copy staging) stayed0in this window.AI use
Ran the targeted release unit tests, paired quiet 60 s smoke runs, and log aggregation with assistance from Google Antigravity (Gemini 4 Neon); all numbers and verbatim lines were extracted directly from
cargo test,xcl.log, andscripts/smoke.ps1outputs.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.