Repository navigation
D3D12.X: report.json keeps the memory by owner at its peak and at the end - #2776
Open
joeypercia wants to merge 3 commits into
Open
joeypercia wants to merge 3 commits into
joeypercia wants to merge 3 commits into
Conversation
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)
…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)
… end The XCL_ACTIVITY line by owner was only in the log, so comparing runs meant reading logs (xcl-dev#2688, workstream 1: an end-of-run table). The activity thread keeps each snapshot it logs (memory_report::note): the last one, and the one where video memory in use was highest. report.json gets them as memory_by_owner (MB: totals, budgets, XCL's parts and the rest of each total, with the second of the run). The report takes what was kept and makes no DXGI call, which a crash report may make from any thread. Without XCL_ACTIVITY there is no table. Part of xcl-dev#2688. Stacked on xcl-dev#2750. Assisted-by: Claude Code (Claude Opus 5.5)
|
Independent verification of PR #2776 at Tested
Regression run main ( PR ( Not tested
AI use
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #2750 (itself on #2697); only the top commit belongs here.
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.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; and that the table keeps the last snapshot and the one with the most video memory.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:{ "seconds": 279.7938144, "commit_mb": 35641, "video_mb": 14438, "video_budget_mb": 10534, "non_local_mb": 5743, "non_local_budget_mb": 15162, "parts": [ [ "UMA window", "commit", 4095 ], [ "sparse CPU copy", "commit", 2538 ], [ "D3D12 heaps", "commit", 16085 ], [ "target pages", "video", 6859 ], [ "target pools free", "video", 116 ], [ "arenas", "video", 401 ], [ "sparse tiles", "video", 2581 ], [ "sparse pools free", "video", 170 ], [ "sparse pools retired", "video", 0 ], [ "committed textures", "video", 415 ], [ "UMA window", "non-local", 4095 ], [ "dispatch chain scratch", "video", 391 ], [ "sparse readback", "non-local", 16 ], [ "sparse staging", "non-local", 64 ], [ "sparse zero buffer", "non-local", 1 ] ], "other_mb": { "commit": 12921, "non-local": 1566, "video": 3500 } }(
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=4ond485694b: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).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 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