D3D12.X: count and report what console code cannot reach in unified memory #956
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!956
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/956/head"
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?
@maximecmb on GitHub · 2026-11-24 09:29 UTC · original
d3d12x-count-empty-buffer-views→main· +126 −19 · 4 files · 1 commits · closed without mergingPart of #505. Diagnostics only: no behaviour change.
Once the coherent window is full, a console buffer XCL cannot place in unified memory becomes a plain PC resource, and every view of it gets an empty descriptor (
num_records 0): a shader reads zeros there and its writes go nowhere. XCL counted these (NON_UMA_BUFFER_VIEWS) but never reported the count, and logged only the first one. So nobody can tell from a run whether the world load of the retail title creates thousands of them – which would fit the stop in #505 (the title stops submitting GPU work with no thread blocked in XCL, then its watchdog ends it) – or none.In a hand-driven run of the retail title on
main077ce40(RTX 5080): the coherent window was full (3998 / 4095 MB) from 43 s on; the world load started at ~44 s; the first#101came at 59.5 s; presents and submits went to 0 at 62 s; the watchdog (+0x23cf683) at 90.4 s. 0 draws or dispatches skipped, 0 failed pipelines, 0Wait64BitValueXtimeouts, no title thread inside XCL or the driver at the crash. The single "buffer view … not in UMA" warning came at 14 s, and the log could say nothing more.What is in it
crates/xcl/src/hle/d3d12x/real.rs:OUTSIDE_UMAcounts, by kind: buffer SRVs / UAVs / CBVs that get an empty V#, texture views XCL cannot shape (empty T#), console buffers that found no room in unified memory (coherent window and, where tried, sparse windows), committed console textures that found no room in the coherent window. The first of each kind is logged (its time shows when it starts).report.jsongets them asd3d12.outside_uma(#[serde(default)], so older reports still read).crates/xcl/src/host.rs: theXCL_ACTIVITYmemory line (every 2 s) adds the coherent window's use and these counts, at its end (scripts/smoke.ps1reads only its start). It reads unified memory throughuma::current(), so reporting doesn't create it.crates/xcl/src/gpu/uma.rs:current(), the title's graphics memory if it exists, without creating it (get()does), as @ettehn found; with a test that it's whatget()made.crates/xcl/src/hle/d3d12x/bind.rs: the "console code so far" line adds them too.real.rs: each kind lands in its own field; a report without the field still reads.Tested
stable-x86_64-pc-windows-msvc, debug, DXC 1.9.2602.173261b74, rebased ontomain6efdabccargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 730 passed, 0 failed, 41 ignoredgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware; noXCL_SAMPLE_*setRegression run
main:This PR:
Not tested
ad2f675were posted on #505 and #697: the empty views sit in the title's 24 GB GPU-view reservation, and no resource ran out of roomAI use
🤖 Generated with Claude Code
@ettehn on GitHub · 2026-11-24 09:39 UTC · original
At
ad2f675, the new two-second activity sampler inhost.rscallsuma::get(), which initializes the global UMA on first access. In a fresh Windows test process I isolated that exact sampling expression:GLOBALwas unset before the sample, but afterward the sample reported 64 MiB used / 512 MiB coherent capacity and the allocator logged 12 GiB of sparse virtual address space. These are allocator/window figures, not physical VRAM consumption.A local
coherent_usage()accessor usingGLOBAL.get().and_then(Option::as_ref)instead returned(0, 0)and left the global unset. After explicit initialization, the same accessor matchedused()andsize(). This keeps enablingXCL_ACTIVITYfrom bringing UMA up just to report its size. No retail files used.Verification assisted by OpenAI Codex (GPT-6.2 Astra).
@dcastell1 on GitHub · 2026-11-24 09:53 UTC · original
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on
main@077ce40(baseline 716 passed, 0 failed, 41 ignored on this box):Two more than the baseline. Note for the record: a first run of this patch, while the machine was also building another project, sat over 11 minutes in three
title_texturestests and had to be stopped; with the box idle the same tree finishes in normal time and passes, so that was the environment, not the change.Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
@maximecmb on GitHub · 2026-11-24 10:25 UTC · original
@ettehn You're right, thank you.
uma::get()isget_or_init, so the new activity line could create the title's graphics memory with default settings, in any process that hadn't made it yet. In a run the windows exist by 0.4 s and the first sample comes at 2 s, but nothing guaranteed that order.Fixed in
3261b74(squashed, rebased ontomain6efdabc):gpu/uma.rs:uma::current(),GLOBAL.get().and_then(Option::as_ref), as you suggested. It doesn't create the memory.host.rs: the activity line uses it. The otheruma::get()calls this PR touches aremain's own (the "console code so far" line, the report) and stay as they are.current()is whatget()made. Whether it creates anything can't be checked in the shared test process, where other tests create the memory first; your isolated check covers that.@dcastell1 thanks for the run. The head has changed since (above), and the regression run will be redone on it.
Tested on
3261b74: RTX 5080 (driver 617.42), Windows 11 26300, Rust 1.100.0 MSVC, debug.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 730 passed, 0 failed, 41 ignored; SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and wrote this reply.
@SlopTart on GitHub · 2026-11-24 10:38 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
ad2f675onto main9aec53d, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 719 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. unreachable-console-code counting tests green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@thehollowedone on GitHub · 2026-11-24 12:37 UTC · original
A focused check on
3261b74found that an intentional null CBV incrementsempty_cbv. D3D12 allows the view description pointer to be null. This can inflate the count or trigger the first warning before any real buffer falls outside unified memory.Tested. Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D, Rust 1.99.1 MSVC, debug. A scratch test called
dev_create_cbv_xon a registered console heap slot.Changing the counter guard to
if !in_uma && !desc.is_null()made the scratch test pass and preserved the descriptor words in all three cases. The two stockoutside_uma_testsalso passed. Both runs usedcargo test --offline --locked -p xcl --lib <filter> -- --test-threads=1.Not tested. How often a retail title creates null CBVs. The fixture checks descriptor creation and counters only.
AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch checks and drafted this report.
@DavidM1911 on GitHub · 2026-11-24 12:41 UTC · original
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti; Rust stable MSVC, debug.
cargo test -p xcl --lib real: 21 passed, 0 failed — includesoutside_uma_tests::each_kind_lands_in_its_own_fieldandan_older_report_without_the_field_reads, covering the new unreachable-in-UMA counters and their report serialization.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
@ettehn on GitHub · 2026-11-24 13:00 UTC · original
Confirmed the
XCL_ACTIVITYfix on3261b74with the same isolated Windows regression probe. In a fresh test process, the sampler expression returned(0, 0)and left the UMA global unset. After explicit initialization, it returned the same used bytes and capacity as the initialized UMA object. One targeted test passed on Windows x64 (RTX 5070 Ti Laptop). OpenAI Codex (GPT-6.2 Sol) assisted with verification.@DavidM1911 on GitHub · 2026-11-26 03:23 UTC · original
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Pull request closed