D3D12.X: memory by owner on nvidia-dev: two-pass buffers, GPU-view tiles #2999
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2999"
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 pr1sm-dev on 2026-11-27T10:48:12Z.
The memory line by owner (#2697, #2750, #2776) on
nvidia-dev, with the two owners this branch has andmaindoes not. Part of #2688 (workstream 1).Stacked on #2697, #2750 and #2776: the first three commits are @joeypercia's, cherry-picked onto
nvidia-devwith their authorship (three conflicts, both sides kept;git range-diffagainst the originals shows context lines only). Only the last five commits belong here: 93 added and 5 removed lines. The whole branch is 731 added and 14 removed.What is in it
bind.rs,memory_report.rs: atwo-pass buffersrow, read from the count the buffers' cap keeps (the bytes asked for). Onnvidia-devthese buffers were inother.sparse.rs,texture_upload.rs: two census places,sparse readback jobsandtexture upload jobs(both pooled; made on a pool miss only).sparse.rs,memory_report.rs: aGPU-view tilesrow, taken out ofsparse tiles. A view tile parked since the last submit, or kept withXCL_VIEW_KEEP, still counts with the windows' own.present.rs,memory_report.rs,host.rs: one moreXCL_ACTIVITYline besideother: the swap chain's size (bytes computed, not counted) andpso_async's pipeline builds so far.README.md: theXCL_ACTIVITYentry names the lines.On
nvidia-dev,sparse pools freealso holds the tiles that are cooling or quarantined (pool_bytesleaves them out of the mapped ones here).Tested
71dad56b, debug:cargo test --workspace --offline --no-fail-fast -- --test-threads=4: 1829 passed, 8 failed, 48 ignored; 28SKIPPED(no wave64: 21, per-lane f16 forms refused: 3, no heap windows: 2, no xgameruntime.dll: 2).nvidia-dev3f39671d, same command: 1824 passed, 8 failed, 48 ignored; the same 28SKIPPED. The 8 failures are the same six tests on both:texture_upload'spieces_hold_the_texels_of_their_levelsandgpu_parts_of_a_texture_go_up_and_the_rest_stays,async_compute_pso_registers_real_pso_and_not_standin,console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, andsplit_compute_prefers_the_offline_whole_pipelineandtwo_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, each reported twice. The five more passes are this branch's tests.3292b096reverted, which this card needs to stay in the world, #2867): Series S profile,XCL_UMA_WINDOWS=16 XCL_HEAP_WINDOWS=1 XCL_COHERENT_HEAPS=sparse:1024 XCL_TWO_PASS_MB=3072 XCL_TEXTURE_LEVEL_PAGES=1 XCL_GFX_PSO_WAIT_MS=100 XCL_PREPARE_GRAPHICS=0 XCL_FRAME_DUMP=60, 2 GiB shader heap (#2590), warm caches, 540 s of title time, 421 s of it in the world. The lines at the end:Without the two rows,
otherwould have read 5,607 MB of the 17,231 andsparse tiles6,157. Video memory was level by then (17,170 MB at 480 s).report.jsonhad the same table.Regression run
60 s each, the same settings (Series S profile,
XCL_UMA_WINDOWS=16 XCL_HEAP_WINDOWS=1 XCL_COHERENT_HEAPS=sparse:1024 XCL_TWO_PASS_MB=3072 XCL_PREPARE_GRAPHICS=0), no input: the title's first screens.mainb49be183(the commit #2697 is based on):nvidia-dev3f39671d(the base):This PR's head:
Not tested
XCL_VIEW_KEEP, an fp16 swap chain, a resize.AI use
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-27T11:48:01Z.
Independent desktop NVIDIA RTX 4060 (8 GB) / Windows 11
--releaseverification of PR #2999 at71dad56b13e366dd36a64b14af8defa448a82ed3(8 commits stacked on exact parent andnvidia-devmerge-base3f39671d5239c33100ba25b692d60b6582b779d2:73a39337->2c4a79e3->2f7b2210->fda79731->744c1419->ec24e607->fa74f7d0->71dad56b).Environment
32.0.16.2114(NVIDIA621.14), WDDM 3.2rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5Release build & targeted
--release --libtestsAll runs executed sequentially (
--test-threads=1 --nocapture) on71dad56b13e366dd36a64b14af8defa448a82ed3against the RTX 4060:cargo build --release -p xcl: passed (2m 00s),0new compiler warnings compared to exact parent3f39671d(identical 8 pre-existingxcllib warnings;0warnings inmemory_report.rs,resource_census.rs, or modified hunks).cargo test --release -p xcl --lib hle::d3d12x::memory_report:: -- --test-threads=1 --nocapture: 3/3 runs passed (4 passed; 0 failed; 0 ignored; 0 skipped,0.37s–0.38seach) — includes live RTX 4060 execution ofa_snapshot_on_the_device_has_its_budget_and_ownersplusthe_rest_is_the_total_less_the_parts,the_line_beside_other_has_the_swap_chain_and_the_builds, andthe_table_keeps_the_last_snapshot_and_the_peak_of_video_memory.cargo test --release -p xcl --lib hle::d3d12x::resource_census:: -- --test-threads=1 --nocapture: 3/3 runs passed (1 passed; 0 failed; 0 ignored; 0 skipped,0.37s–0.39seach) — live RTX 4060 execution ofa_tracked_resource_counts_until_it_is_destroyed(verifyingDEFAULTlocal video vsUPLOADnon-local tracking, refcount retention across clones, and live-count drop on destruction while preservingmade).cargo test --release -p xcl --lib hle::d3d12x::sparse:: -- --test-threads=1 --nocapture: 3/3 runs passed (66 passed; 0 failed; 1 ignored[early_commit_timing],0 skipped,4.09s–5.01seach) — covers the newcommitted_bytes()assertions alongside the sparse tile/view test suite.cargo test --release -p xcl --lib hle::d3d12x::title_textures:: -- --test-threads=1 --nocapture: 3/3 runs passed (29 passed; 0 failed; 0 ignored; 0 skipped,1.36s–1.39seach).cargo test --release -p xcl --lib hle::d3d12x::bind:: -- --test-threads=1 --nocapture: 3/3 runs passed (53 passed; 0 failed; 0 ignored; 1 skipped,0.60s–0.61seach;two_pass_binds_set_the_shared_view_heapskipped as expected without opt-inXCL_HEAP_WINDOWS=1).cargo test --release -p xcl --lib report:: -- --test-threads=1 --nocapture: 1/1 run passed (5 passed; 0 failed; 0 ignored; 0 skipped,0.49s; includesreport::tests::a_crash_is_kept_while_another_thread_writes_the_report).Paired quiet 60 s retail smoke (
XCL_PREPARE=0,XCL_NETWORK=0)Both runs used
scripts/smoke.ps1 -Seconds 60 -StartupTimeoutSeconds 180(which setsXCL_ACTIVITY=1) withXCL_PREPARE=0andXCL_NETWORK=0on a quiet machine against the same local retail title (title: 29640639):Exact parent (
3f39671d5239c33100ba25b692d60b6582b779d2):PR #2999 (
71dad56b13e366dd36a64b14af8defa448a82ed3):Both runs finished cleanly in
63 swall time with0device removals,0crashes, steady60 60 60presents per 2 s, and no regression in frame count (1583vs1535) or peak commit (14790vs14725 MB). All 29 legacymemory: N MB committedlines were emitted alongside the new lines and parsed cleanly byscripts/smoke.ps1.Runtime memory-by-owner telemetry &
report.jsonverificationDuring the 60 s
71dad56bsmoke on the RTX 4060 (8 GB),xcl.logemitted29memory by owner (MB)snapshots (t = 2.002 sto58.097 s),28memory: XCL's own resources (alive)census lines (t = 4.003 sto58.097 s), and28memory: not in the rowsbeside lines (t = 4.004 sto58.100 s), with0negativeothervalues across all29snapshots and0over-budget warnings:t = 18.032 s):commit:14694 MB(UMA window 4095,sparse CPU copy 838,D3D12 heaps 6822,other 2937)video memory:6177of a6901 MBbudget (placed texture pages 3546,placed texture pools free 37,arenas 465,sparse tiles 838,GPU-view tiles 0,sparse pools free 57,sparse pools retired 0,committed textures 402,two-pass buffers 0,other 830— ~86.5%accounted by named owners)non-local:4740of a15556 MBbudget (UMA window 4095,sparse staging 64,sparse zero buffer 1,texture upload jobs 195,other 384— ~91.9%accounted)t = 58.097 s):commit:14743 MB(UMA window 4095,sparse CPU copy 838,D3D12 heaps 6835,other 2973)video memory:6116of a6892 MBbudget (placed texture pages 3498,placed texture pools free 86,arenas 401,sparse tiles 838,GPU-view tiles 0,sparse pools free 57,sparse pools retired 0,committed textures 402,two-pass buffers 0,other 832)non-local:4815of a15556 MBbudget (UMA window 4095,sparse staging 64,sparse zero buffer 1,texture upload jobs 195,other 459)t = 58.097 s):memory: XCL's own resources (alive): sparse staging 1 of 1 made, 64 MB; sparse zero buffer 1 of 1 made, 1 MB; texture upload jobs 8 of 8 made, 195 MB(all 3 active sites also routed intonon-localin bothxcl.logandreport.json).t = 58.100 s):memory: not in the rows: swap chain 3 buffers of 3840x2160, about 94 MB; pipeline builds so far: 4324 finished, 0 failed, 56429 pending(up from1759 finished, 0 failed, 42106 pendingatt = 4.004 s).report.json(memory_by_owner): Absent on baseline3f39671d, present and populated on71dad56b. Bothmemory_by_owner.peak_video(seconds: 18.0317998,video_mb: 6177,video_budget_mb: 6901) andmemory_by_owner.last(seconds: 58.0972428,video_mb: 6116,commit_mb: 14743) match the correspondingxcl.loglines exactly, with every segment'sparts + other_mbreconciling to the DXGI/process total within1–2 MBof integer>> 20truncation.Limits of coverage
XCL_PREPARE=0(XCL_NETWORK=0), bypassing startupprepare_for_launchshader precompilation (reusing the existing local DXIL cache).29640639,two-pass buffers,GPU-view tiles, andsparse pools retiredstayed at0 MB, and the remaining 10resource_censussites (upload staging,ExecuteIndirect argument order,copy scratch,fill pattern,timestamp readback,predication,frame dump readback,dispatch chain scratch,sparse readback,sparse readback jobs) were not allocated; those paths were covered only by unit tests / code inspection here rather than non-zero retail smoke traffic.non_local.budget == 0->Kind::Video) and Winecommit unknownhandling were verified via unit tests (the_rest_is_the_total_less_the_parts), not on iGPU or Wine hosts.hle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heapskipped as expected without opt-inXCL_HEAP_WINDOWS=1,hle::d3d12x::sparse::tests::early_commit_timingis#[ignore], and the full workspace test suite / visual screenshot capture were not run.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-27T12:25:45Z.
Tested
71dad56b13e366dd36a64b14af8defa448a82ed3on Intel Arc A770 (16,258 MiB, driver 32.0.101.9175), Ryzen 7 3800X, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, debug. Built the checked-in tests and a separate test-only probe withrustc --testand lockfile-matched cached dependencies after an interrupted Cargo launch.xcl-stock.exe --exact <filter> --test-threads=1 --nocaptureforhle::d3d12x::memory_report::tests::{the_rest_is_the_total_less_the_parts,the_line_beside_other_has_the_swap_chain_and_the_builds,a_snapshot_on_the_device_has_its_budget_and_owners}. Ranxcl-probe.exe --exact hle::d3d12x::bind::probe_two_pass_owner_lifetime_on_arc --test-threads=1 --nocapture. The last stock test and the probe used the Arc mutex withXCL_ADAPTER=A770andXCL_TWO_PASS_MB=64. All four tests passed, with 0 failed, 0 ignored, and 0 skipped. All native children and the GPU wrapper exited 0.two-pass buffersvideo owner and raw live counter both read 0 before allocation, 3,211,264 bytes while live, held for allocator release, and pooled, and 0 after reuse-pool retrieval and final drop. DXGI local usage went from 3,997,696 to 7,208,960 and back to 3,997,696 bytes. Localotherstayed at 3,997,696 bytes. The rendered line and in-memory report record showed 3 MiB while the buffer was held.Not tested
AI use
gpt-6.2-solwith high reasoning effort, ran the controls and synthetic probe, checked the raw outputs, and drafted this report.Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-27T20:12:29Z.
AMD run (listed as untested), with an RTX 3060 in the same PC: the 5 new tests pass on both, and the PR adds no failure.
Tested: head
71dad56applied on its basenvidia-devd1be810, debug, Rust 1.100.0, Windows 11 Pro 26200, Ryzen 7 5800X, card picked withXCL_ADAPTER(log:backend 'real' – AMD Radeon RX 9070 XT/– NVIDIA GeForce RTX 3060).cargo test -p xcl --lib -- hle::d3d12x:: memory_report resource_census report:: --test-threads=4 --nocapture:nvidia-devalone: 554 passed, 2 failed).New and ok on both cards:
a_snapshot_on_the_device_has_its_budget_and_owners,a_tracked_resource_counts_until_it_is_destroyed,the_line_beside_other_has_the_swap_chain_and_the_builds,the_rest_is_the_total_less_the_parts,the_table_keeps_the_last_snapshot_and_the_peak_of_video_memory.The 2 failures are the same with and without the PR, on both cards, so they come from
nvidia-devatd1be810:texture_upload::tests::pieces_hold_the_texels_of_their_levelsandgpu_parts_of_a_texture_go_up_and_the_rest_stays.Not tested: the report's values in a title,
XCL_VIEW_KEEP, an fp16 swap chain, a resize, Intel, Wine.AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T00:27:41Z.
merge-check
base:
ba9d1f9473head:
71dad56b13merge: conflicts in
crates/xcl/src/hle/d3d12x/bind.rsandsparse.rson the currentnvidia-devbase; the base was force-pushed while this check ranbuild: cargo build --workspace -> not run on this conflicted merge
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> not run on this conflicted merge; earlier results on superseded bases are not current-base evidence
review: In
real::uma_imported_bytes, everySomeinUMA_HEAPSis treated as an imported coherent window. WithXCL_UMA_SHADOW=1,open_umainstead retains the CPU window and creates a separateD3D12_HEAP_TYPE_DEFAULTshadow heap, but stores that heap asSometoo.memory_report::snapshotthen subtracts its size from the D3D12 heap charge and attributes the same size to the UMA non-local row. On a discrete GPU, this hides real local video-memory usage and understates the owner split. Count only windows whose GPU heap actually shares the coherent CPU allocation (imported or driver-mapped), and add a shadow-mode regression for the owner/segment totals. The conflicts inbind.rsandsparse.rsalso need a rebase and review of the resolved paths.performance: The new tracker queries each XCL-created resource's allocation and heap properties and attaches a COM lifetime object by default; the snapshot runs on the existing activity interval. I did not measure frame time or a retail run on this head.
verdict: not yet: current-base conflicts and the shadow-heap accounting error need resolution and a fresh build, full suite, and required smoke evidence after the rebase
hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti 12 GiB (621.35), DXC 1.8.2502.11; Codex (GPT-6.2 Sol) traced the merge and accounting paths and ran the superseded-base build and suite.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-28T07:16:01Z.
Ran the memory-report tests at
71dad56bon an NVIDIA Blackwell desktop part:Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, wave32 only, 16 GB) driver 32.0.16.2124, Intel Core i5-12400F, 64 GB RAM, rustc 1.100.0 (0ef1bc386 2026-11-09), MSVC 14.44.35207, DXC 1.9.2609.5, debug build.
All four tests pass, including
the_rest_is_the_total_less_the_parts,the_line_beside_other_has_the_swap_chain_and_the_buildsand the peak/last snapshot table test. They are CPU-side report/serialization tests; no DXGI query or D3D12 device is involved. The thread has NVIDIA runs on RTX 4060 and RTX 3060 but no 5070 Ti, so this adds a third NVIDIA datapoint with driver 32.0.16.2124.Not tested: a real
XCL_ACTIVITYline from a title, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
Imported from ivall/xcl. Originally posted by cj-tomlin on 2026-11-28T22:18:44Z.
@pr1sm-dev, a question before I duplicate anything: this PR now targets
main(retargeted after #3203 mergednvidia-dev), but the head is still71dad56from 27 Nov and conflicts. Do you plan to rebase it ontomain's report (d3e60ec)?I'm on the commit side of
memory by ownerfor #3211 (C), and my runs onmainsupport theD3D12 heapspart this PR carries from #2697 (RTX 3080, within ~150 MB up to 37.9 GB of commit: details).One thing for the rebase:
memory_report::snapshot()onmain, anduma_imported_bytes()here, calluma::get(), which creates the UMA window if it doesn't exist yet, so a report in a process without one (the child process @thehollowedone hit on #2697) maps a 4 GB window just to read its size. A read-only accessor would avoid that.If you're rebasing, I'll leave it to you and test your head; if not, I'd bring just the heaps part,
uma_imported_bytes()and that fix tomainin a small PR, crediting @joeypercia, and leave the two-pass buffers and GPU-view tiles rows to you.AI use: Claude Code (Claude Opus 5.5) drafted this; I checked it.
Imported from ivall/xcl. Originally posted by cj-tomlin on 2026-11-29T09:44:34Z.
@pr1sm-dev no answer yet, so I've opened the small part on
mainas two PRs: #3343 (the report no longer makes the UMA window, @thehollowedone's accessor and regression) and #3344 stacked on it (theD3D12 heapscommit part anduma_imported_bytes()from #2697, crediting @joeypercia). The two-pass buffers and GPU-view tiles rows stay yours. If you rebase this first, I'll close mine.AI use: Claude Code (Claude Opus 5.5) drafted this; I checked it.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T09:18:18Z.
Triage (#1607) – head
71dad56This PR is stacked on #2697, #2750 and #2776, and all three were closed. Main has its own adaptation of #2697 (
d3e60ecb, "report memory by tracked owner", with owners such as "tracked committed sampled textures"). The first three commits here re-add the original 424-linememory_report.rsandresource_census.rs, so the PR conflicts with main. Merged as it is, it would replace main's version.The last five commits (the two-pass buffers and GPU-view tiles rows, the census places for sparse readback jobs and texture upload jobs, and the swap chain and pipeline builds line) are not on main, and no other open PR adds them. They need to be rebuilt on main's
memory_report.rs, without the closed base commits.No problems found in those five commits.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.