D3D12.X: report.json keeps the memory by owner at its peak and at the end #2766
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2776"
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 joeypercia on 2026-11-26T11:51:26Z.
Stacked on #2750 (itself on #2697); only the top commit belongs here.
Renamed after review (@throny on #2688): the row
target pagesis nowplaced texture pages, andtarget pools freeis nowplaced texture pools free. It isvram::page_bytes().0, the pages of every placed texture on the shared 64 KiB pages, not only render targets. Log lines and JSON quoted below are from before the rename and keep the old names; the quantity is the same.report.jsongets the memory table workstream 1 of #2688 asked for: the snapshot by owner where video memory in use was highest, and the last one of the run, in MB. Runs can be compared from their reports instead of their logs. Part of #2688 (workstream 1, part 2 of the plan there).What is in it (one commit)
crates/xcl/src/hle/d3d12x/memory_report.rs:Recordis a snapshot as the report keeps it, with owned strings so the report can be read back: the second of the run, commit, video and non-local usage with their budgets, XCL's parts as (owner, memory, MB), and the rest of each total.Tableholdslastandpeak_video.notekeeps them, andtable()hands them to the report. The peak is chosen on DXGI'sCurrentUsagein bytes (kept beside it, not written to the report), not on the MB, and a known reading ranks above an unknown one.crates/xcl/src/host.rs: theXCL_ACTIVITYthread takes one snapshot every 2 s. It logs that snapshot's line, as before, and now alsonotes it.crates/xcl/src/report.rs:memory_by_owner(with#[serde(default)]: older reports still read). The report copies what was kept and makes no DXGI call, because a crash report can be written from any thread. WithoutXCL_ACTIVITYthe table is empty.the_table_keeps_the_last_snapshot_and_the_peak_of_video_memory: a record's totals, budgets, parts and rests in MB; a JSON round trip; that the table keeps the last snapshot and the one with the most video memory; that of two readings within one MB it keeps the higher one in bytes, with its own parts; and that a known reading under 1 MB ranks above an earlier unknown one. The last two fail on a ranking by MB.The newer retail title on an RTX 4070 Ti 12 GB (
nvidia-devaf2cecc4with this stack, 1 GiB shader heap). The run ended in a device removal at 282 s, and the table was in the report all the same.peak_video:(
UMA windowappears twice: once in commit, as CPU memory, and once in non-local, where DXGI counts the imported window.)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=4:b5d0c6a5: 1439 passed, 0 failed, 47 ignored; 29SKIPPEDlines, mostly "no wave64".d485694b(before the peak ranking by bytes and the rename): 1438 passed, 1 failed, 47 ignored. The failure isgpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, which fails the same way onmainon this iGPU (#2115).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, 2 GiB) installed on this machine, one after the other.mainb49be183(the base of the stack) and this PR's head (no uncommitted changes):main:
PR:
Not tested
table()usestry_lockand gives an empty table then, rather than waiting.XCL_ACTIVITY: no table, by design (a snapshot costs a DXGI query).AI use
Imported from ivall/xcl. Originally posted by MatyEjsr on 2026-11-26T12:03:19Z.
Updated independent verification of PR #2776 at
c5d9342194c00aef2ca68cab84940e2b3d2f445d(superseding the earlierd485694breport) on an RTX 3090 24 GB.Review follow-up & branch status
c5d93421(crates/xcl/src/hle/d3d12x/memory_report.rs):Tablekeeps#[serde(skip)] peak_video_bytes: Option<u64>,note()compares raw DXGICurrentUsagebytes (ranking known readings aboveNone),the_table_keeps_the_last_snapshot_and_the_peak_of_video_memorycovers both sub-MiB tie-breaking and< 1 MiBvsNone, and livereport.jsonomitspeak_video_bytes.origin/main(8b957bec,merge-baseb49be183); no duplicate PRs in the queue (stacked on #2750 -> #2697; not superseded onorigin/nvidia-devaf2cecc4, though the stack conflicts withorigin/nvidia-devinmod.rs/sparse.rs).Tested
rustc 1.100.0 (0ef1bc386 2026-11-09)(x86_64-pc-windows-msvc), debug (builds + test suite) and release (build + 60 s smoke), DXC1.9.2602.17(21d28f72).cargo build --workspace -j 8andcargo build --release --workspace -j 8: ok (exit 0).--nocapture --test-threads=1):cargo test -p xcl --lib hle::d3d12x::memory_report::tests -- --nocapture --test-threads=1: 3 passed, 0 failed, 0 ignored (0.33s).cargo test -p xcl --lib hle::d3d12x::resource_census::tests -- --nocapture --test-threads=1: 1 passed, 0 failed, 0 ignored (0.30s).cargo test -p xcl --lib report::tests -- --nocapture --test-threads=1: 4 passed, 0 failed, 0 ignored (0.40s; matches 3 inmemory_report::tests+ 1 inreport::tests).cargo test --workspace -j 8 --no-fail-fast -- --nocapture --test-threads=8): 1439 passed, 0 failed, 47 ignored across 37 targets.SKIPPEDchecks on this host (28 total, not counted as GPU coverage):no wave64(21):gpu::dxil::kernel::dispatch_chain_native_wave64_builds_whole, 4 ingpu::recomp::lower::tests, 14 wave64 cases ingpu::recomp::lower_dxil::tests, and 2 ingpu::recomp::tests(gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware).per-lane form: refused(3 sub-cases ingpu::recomp::lower_dxil::tests):f16_programs_on_the_gpu(f16 arithmetic, wave32;f16 packed, wave32) andf32_programs_on_the_gpu(f32 conversions, wave32).no heap windows(1):heap_window_out_of_memory_falls_back_to_the_switch_form(default env).no D3D12 debug layer/no d3d12SDKLayers.dll(3):the title under the debug layer (dred: false),the title under the debug layer (dred: true),uploads_start_from_each_subresources_state.report.jsonverification from the 60 sscripts/smoke.ps1run (XCL_ACTIVITY=1, 29memory by owner (MB):samples):peak_video_bytesis absent from serializedreport.json.memory_by_owner.last(seconds: 58.1652405) matches the final[58.165]log line on every field (commit_mb: 13962,video_mb: 6126,video_budget_mb: 23554,non_local_mb: 4654,non_local_budget_mb: 15298, all 14partstuples, andother_mb: { "commit": 2343, "non-local": 461, "video": 842 }).memory_by_owner.peak_video(seconds: 34.1536177) matches the peak[34.154]log line on every field (commit_mb: 13949,video_mb: 6189,video_budget_mb: 23554,non_local_mb: 4578,non_local_budget_mb: 15298, all 14partstuples, andother_mb: { "commit": 2343, "non-local": 385, "video": 841 }).Regression run
main (merge-base
b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):PR (
c5d9342194c00aef2ca68cab84940e2b3d2f445d):(102.8% of
mainframes, 99.0% ofmainpeak commit; 0 device removals, 0 crashes.)Not tested
commit_mb: nullwhenPrivateUsagereads 0), defaultXCL_ACTIVITY=0omission, and crash-handlerreport.jsonlock-contention fallback (try_lock).AI use
c5d9342194c00aef2ca68cab84940e2b3d2f445d, built debug and release workspaces, ran targeted tests, the 37-target workspace suite, and the 60 s smoke test, verifiedreport.json<->xcl.logparity, and drafted/audited this report.upstream-sync referenced this pull request2026-11-26 13:04:54 +00:00
Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T13:10:43Z.
Independent RTX 4060 (8 GB) / Windows 11 release verification of PR #2776 at
d485694b216101c2d684d3395cfb93679cd39e56(stacked on PR #275044a7e6fe-> PR #269750cfb321; 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 (
d485694b)cargo test --release -p xcl --lib hle::d3d12x::memory_report:: -- --nocapture: 3 passed, 0 failed, 0 ignored (0.38 s,0skipped, exit0), coveringthe_table_keeps_the_last_snapshot_and_the_peak_of_video_memory,the_rest_is_the_total_less_the_parts, and live RTX 4060a_snapshot_on_the_device_has_its_budget_and_owners.cargo test --release -p xcl --lib hle::d3d12x::resource_census:: -- --nocapture: 1 passed, 0 failed, 0 ignored (0.36 s, live RTX 4060,0skipped, exit0).cargo test --release -p xcl --lib report:: -- --nocapture: 4 passed, 0 failed, 0 ignored (0.37 s,report::tests::a_crash_is_kept_while_another_thread_writes_the_report+ 3memory_report::tests,0skipped, exit0).cargo test --release -p xcl --lib hle::d3d12x::sparse:: -- --test-threads=4: 17 passed, 0 failed, 1 ignored (0.40 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.90 s,0skipped, exit0).Live 8 GB RTX 4060
report.jsonmemory_by_ownerverification (60 s,d485694b)report.json<->xcl.logparity across29snapshots:report.jsonserialized bothmemory_by_owner.peak_video(t = 18.037 s) andmemory_by_owner.last(t = 58.062 s), matching the peak-VRAM and finalmemory by owner (MB):log lines on every single field (commit_mb,video_mb,video_budget_mb,non_local_mb,non_local_budget_mb, all14partstuples, and all3other_mbvalues):peak_video(18.037 s)last(58.062 s)commit_mb(UMA/sparse CPU/D3D12 heaps/other)4095/838/6647/2379)4095/838/6670/2365)video_mb/video_budget_mb6,958(88.8%of budget)6,958(87.9%of budget)target pages/target pools free/arenas3543/40/4653540/43/401sparse tiles/pools free/pools retired838/57/0838/57/0committed textures/video other402/829402/832non_local_mb/non_local_budget_mb15,556(29.4%)15,556(29.9%)UMA/sparse staging/zero buf/upload staging/other4095/64/1/32/3734095/64/1/32/457exit: 0x0,1603frames shown,60 60 60steady-state presents per 2 s,0device removals,0crashes,13971 MBpeak commit vsorigin/mainb49be183's14018 MB/1518frames).Paired 60 s RTX 4060 smoke (
b49be183vsd485694b)Merge-base
origin/main(b49be183):PR #2776 head (
d485694b):Limits of coverage
d485694b(only targetedmemory_report::,resource_census::,report::,sparse::, andtitle_textures::release tests plus paired quiet 60 s smoke).XCL_ACTIVITY=1on a discrete 8 GB NVIDIA GPU (RTX 4060) on native Windows 11; defaultXCL_ACTIVITY=0omission behavior, crash-time report writes, and UMA/iGPU systems were not exercised in this smoke.AI use
Ran the targeted release unit tests, paired quiet 60 s smoke runs, and
report.json/xcl.logparity verification with assistance from Google Antigravity (Gemini 4 Neon); all numbers and smoke blocks were extracted directly fromcargo test,report.json,xcl.log, andscripts/smoke.ps1outputs.Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-26T15:13:03Z.
Review: CHANGES_REQUESTED
Please rank peak samples by raw DXGI bytes. The top commit selects
peak_videoafter roundingCurrentUsageto MiB. Sample 104,857,600 bytes, then 104,858,623 bytes with a different owner breakdown. Both display as 100 MiB, so the report can keep the earlier breakdown even though the second usage is higher. An unknown reading can similarly mask a later known reading below 1 MiB.Keep an optional raw-byte value for selection, rank a known sample above unknown, and retain the existing MiB output. Please add both cases to the peak-selection test; distinct whole-MiB fixtures cannot detect this. The issue is in this top commit. Hosted Windows results and the reported hardware checks are useful, but there was no independent NVIDIA execution here because the stack conflicts with
af2cecc4.AI use: Codex (GPT-6) reviewed the pinned changes and verified the reported evidence. Optional temporary Discord for coordinating contributor work, testing, and comparing results.
Imported from ivall/xcl. Originally posted by joeypercia on 2026-11-26T15:37:07Z.
Thanks, both cases were real:
notecomparedvideo_mbafter the shift to MB, andunwrap_or(0)put an unknown reading level with a known one under 1 MB.Fixed in
c5d93421(squashed into the top commit).Tablekeeps the peak'sCurrentUsagein bytes beside it (#[serde(skip)], so the report's MB output is unchanged), andnotereplaces the peak whenOption<u64>bytes are greater, which ranks a known reading above an unknown one. The test now has both of your cases: 100 MiB then 100 MiB + 1,023 B with a different commit (the second is kept, with its own breakdown), and an unknown reading, then 512 KiB, then unknown again (the 512 KiB one is kept). With the old ranking put back, the test fails at the first of them (it keeps the 10 s sample).Reran on the new head, RTX 4070 Ti:
cargo test --workspace --no-fail-fast -- --test-threads=41439 passed, 0 failed, 47 ignored, and a new smoke block in the description (1557 frames, no removal, peak commit 17,397 MB). RDNA2 was not rerun at this head.AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and wrote this reply.
Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-26T15:55:09Z.
Native RTX 5090 and Radeon iGPU report check on updated head
c5d9342194c00aef2ca68cab84940e2b3d2f445d. One clean 52 s release smoke per adapter, workload9cc6a39e, Windows 11 build 26200, Ryzen 7 9800X3D, 32 GB RAM. Both exited0x0with no device removal or crash.peak_videolocal MB / budget at timelastlocal MB at timeOn both adapters, every displayed field in
lastandpeak_video, including parts and remainders, matched its corresponding log snapshot.lastmatched the final sample before the timed exit andpeak_videomatched the highest displayed local usage before that boundary. The 512 MB imported UMA window and 64 MB upload staging were attributed tonon-localon the 5090 andvideoon Radeon.A timing detail for reproducing the comparison: both logs printed one more activity sample after
XCL_RUN_SECONDShad begun the exit. On Radeon that line showed 7,574 MB at 52.043 s, after the report cutoff.host.rswrites the report at the timed exit before ending the title. Using the entire log as the comparison window would count this later sample. The logs display rounded MiB, so this check does not resolve sub-MiB peak ties.scripts/smoke.ps1 -Game <workload> -Seconds 52with explicitXCL_ADAPTER,XCL_NETWORK=0,XCL_ACTIVITY=1,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1,XCL_UMA_SHADOW=1,XCL_COHERENT_HEAPS=sparse:16,XCL_LOOK_SKIP=1,XCL_GFX_PSO_WAIT_MS=150, andXCL_PRESS_AT=16:A,23:A,30:A.AI use — Codex ran both smoke tests and checked the saved report fields against the live logs.
Imported from ivall/xcl. Originally posted by Aniseto on 2026-11-26T16:10:44Z.
Ran the memory-report table test at
c5d93421on 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.
The test passes: it covers the JSON round trip, keeping the last snapshot and the peak by video bytes, and the byte-level tie-break that would fail if the ranking were done in MB. This is a CPU-side report-serialization test; the report copies what was noted and makes no DXGI call. The thread has RTX 5090 + Radeon iGPU and RTX 4060 reports, but no 5070 Ti; this adds a Blackwell desktop datapoint on driver 32.0.16.2124 with DXC 1.9.2609.5.
Not tested: a real
XCL_ACTIVITYrun producing the table, a paired 60 s smoke run, the full workspace suite, release profile, AMD and Intel GPUs, native wave64 hosts, Wine, 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 thehollowedone on 2026-11-26T23:16:12Z.
Independent Windows/NVIDIA check of #2776 at clean head
b5d0c6a5, after the memory-owner rename and peak-ranking fix. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11.cargo test --offline --locked -p xcl --lib hle::d3d12x::memory_report:: -- --test-threads=1: 3 passed, 0 failed, 0 ignored, 0 skipped. This includes a live D3D12 budget/owner snapshot and the byte-ranked peak/JSON test.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4: 1,439 passed, 0 failed, 47 ignored across 37 targets. The log has 25SKIPPEDGPU notices, which are not coverage. The synthetic title e2e test passed.The workspace run used a fresh writable
XCL_DXIL_CACHEundertarget; noXCL_SAMPLE_*variables were set. I did not run a retail title or matched smoke pair, and this test does not measure a memory reduction. It confirms the report's accounting code and broader suite on this NVIDIA setup.AI use: Codex (GPT-6.2 Sol) checked the current head and tests, ran the commands, and drafted this report.
Imported from ivall/xcl. Originally posted by pr1sm-dev on 2026-11-27T11:02:05Z.
@joeypercia, for
nvidia-dev: #2999 carries your three commits there as they are (cherry-picked, your authorship;git range-diffshows context lines only) and adds two rows that exist only on that branch, the two-pass buffers and the GPU-view tiles. On an RTX 3070 8 GB in the world they hold 3,069 and 930 MB of 17,231, which the line had inotherand insparse tiles.If you would rather carry the rows in your own stack, or port it to
nvidia-devyourself, say so and I'll close mine.AI use: Claude Code (Claude Fable 5.2) wrote this comment; posted by the owner.
Imported from ivall/xcl. Originally posted by joeypercia on 2026-11-28T21:03:43Z.
Closing with #2697, which this was stacked on:
mainnow has its own adaptation of the memory report (d3e60ec). The peak/last table for report.json could be rebuilt on top of that; free for anyone to take.Pull request closed