D3D12.X: XCL_ACTIVITY logs the CPU time of the looks before each submit #1822
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1832"
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 marquezinii on 2026-11-24T21:35:22Z.
Before every title submit, XCL looks for the CPU's writes. It runs
GetWriteWatchover the watched ranges, copies what changed into sparse video memory, and uploads title textures again, all on the title's own submitting thread. On slower CPUs that look is most of the frame: @AlexLopezDevelop's i9-9900K sits at 2–6 fps with it in #582. The only record of it today is thesparse windows timingline, cumulative since the start and logged at power-of-two submit counts. From that line, a report at a few fps cannot tell how much of each second went to the look, or whether pipeline waits or the GPU are to blame instead.With
XCL_ACTIVITY=1, every 2 s now also logs one line about the looks of the last 2 s:The line gives:
sparse::before_execute: lock wait, chunk scan, upload);vram::before_execute.This is meant to settle, from a tester's log, which of #582 / #1034 (the look), #1269 (pipeline compiles) or the GPU holds a slow run. The MB-per-look figure is the one #1034's description and ivall's request on #582 ask for ("ms per look, bytes per look"). Without
XCL_ACTIVITYnothing is logged. The look itself gains twoInstant::now()calls and a sum over the cached ranges (69 ranges a look in #582's numbers).Related and different: #1065 (
XCL_GPU_TIMING) times the wholeExecuteCommandListscall, #899 counts pipeline waits at a bind, and #1766 (XCL_GPU_PROFILE) times console programs on the GPU. None of them splits the look.What is in it
crates/xcl/src/hle/d3d12x/sparse.rs:note_watchalso counts looks and the bytes watched, plusnote_lookfor a whole look;look_counters(), andlook_line()for the log line; a unit test for the line.crates/xcl/src/hle/d3d12x/title_textures.rs:refreshtimes the whole look, andrefresh_oncepasses the bytes of the ranges it watched.crates/xcl/src/host.rs: theXCL_ACTIVITYthread logs the line every 2 s.HANDOFF.md: the line, next to whatXCL_ACTIVITYalready logs.Tested
cargo test --workspace -- --test-threads=4on284a948: 960 passed, 0 failed, 43 ignored. SKIPPED: the wave64 cases oflower/lower_dxilandgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64), the f16 and conversion formslower_dxilrefuses in wave32,heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows),pso_measurement_compiles_an_exact_synthetic_record(cannot disable the driver cache).xcl runwithXCL_ACTIVITY=1: the line above, logged at 4 s, next to itsactivity (2 s)line. The first 2 s logged0 looks.Regression run
Run by @kanade333 on an NVIDIA GeForce RTX 5080, 60 s each, release, retail title on its start screen, copied from their comment as posted.
scripts/smoke.ps1setsXCL_ACTIVITY=1itself, so these runs also exercise the new line.main:
PR:
What the line said in that run, at the start screen (last of 30):
That is about 1 ms a look, nearly all of it the write-watch over 2.2 GB, which agrees with #582's 0.83 ms on the first menus.
Not tested
XCL_ACTIVITYunset (smoke.ps1sets it); the line is only logged with it set.AI use
Imported from ivall/xcl. Originally posted by kanade333 on 2026-11-24T23:39:17Z.
Regression pair on a retail title for this head (
284a948), and what the new line says on its start screen. Both runs pass the same way: no device removal, no crash, 1 649 frames against 1 615 onmain.Tested
main20cf130and this PR's head284a948.scripts\smoke.ps1 -Game <retail title 1.0.2.1> -Seconds 60 -Xcl <that build's xcl.exe>, each from its own worktree,mainfirst and this head right after it. No input, so the title stays on its start screen. The blocks below are the script's output, not edited.Regression run
main:
this PR's head:
The new line. The script sets
XCL_ACTIVITY=1itself, so the head's run printed it 30 times. Its last three:So on this machine, at the start screen, a look takes about 1 ms and nearly all of it is the write watch, which agrees with #582's 0.83 ms.
Not tested
title_textures::refreshin 6 of 8 dumps (my comment on #505), so this line in the world is what I would like to see next.XCL_ACTIVITYunset, as the description asks: the script sets it.AI use: Claude Code (Claude Fable 5.2) built both trees, ran the script and wrote this report. I read it before posting.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T00:50:51Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
Imported from ivall/xcl. Originally posted by marquezinii on 2026-11-25T04:32:04Z.
@kanade333 thank you, that's the smoke pair this needed, plus the first look at the line on a title. I've copied both blocks into Regression run as posted, with credit, and quoted one of the lines. The PR is out of draft now.
Your reading matches mine: about 1 ms a look at the start screen, nearly all of it write-watch over 2.2 GB. Six of eight thread dumps in
title_textures::refreshin the world (your #505 comment) is exactly where I'd like to see what the line says, if you get a world run with it.AI use: Claude Code (Claude Opus 5.5) drafted this reply.
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-25T19:44:31Z.
AMD RX 7800 XT test report
Tested locally by merging PR head
284a948c83b9af874cd05d5f054e7af927de5789onto basemain3f2777019544c0ada2cd294aa792d3c378ff0df8(no push). The base is an ancestor of currentmainand both trees merge cleanly.Hardware and tools: AMD Radeon RX 7800 XT, driver 32.0.31035.1003; Windows 10 Pro; Rust 1.100.0 / Cargo 1.100.0; DXC 1.8.2502.11 (DXIL 1.8.2502.11). Debug test build.
cargo test --workspace --no-fail-fast -- --test-threads=4: 1,356 passed, 2 failed, 46 ignored. There were 7SKIPPEDreports: six GPU cases (wave32/wave64 variants for three unsupported instruction forms) and one heap-window case. The two failures and all 7SKIPPEDreports match the baseline (1,355 passed, 2 failed, 46 ignored).Not tested
AI use
Codex (gpt-6-luna) ran Phase 2 tests and wrote this report (Phase 1 pre-compile / initial baseline run used Claude Code (Claude Sonnet 5.5)).
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:27:51Z.
Review: COMMENTED
P2: diagnostics work runs unconditionally. refresh adds Instant timing/range sums and sparse note_look atomics on every non-BUSY submit; refresh_once/note_watch add more atomics, while XCL_ACTIVITY only gates logging. Users with it unset still pay hot-path timing/atomic overhead. Gate collection behind an activity-enabled fast path, or explicitly measure/document overhead-off. No line-arithmetic correctness defect found.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-26T19:31:47Z.
Follow-up to bmjask's hot-path review on current head
284a948c: I confirmed the new whole-look clock andnote_look, watched-range byte sum, andWATCH[2..3]atomics run on each non-BUSY submit even withXCL_ACTIVITYunset. The olderWATCH[0..1]timing and dirty-page counters also feed the existing sparse timing line, so they need to stay active.The local candidate below caches the process-stable activity switch, times and sums only when it is on, and keeps the older counters in both modes. It adds a regression with private counters so it is safe in the parallel suite. #2144 is stacked on this PR and already has its own cached
timed()flag for additional phases; it can reuse the same flag when rebased.On Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, rustc 1.99.1 MSVC, DXC 1.8.2502.11, with this local diff on
284a948c:cargo build --offline --locked --workspace: passed.cargo test --offline --locked -p xcl --lib hle::d3d12x::title_textures::tests -- --test-threads=4 --nocapture: 13 passed, 0 failed, 0 ignored.cargo test --offline --locked -p xcl --lib hle::d3d12x::sparse::tests -- --test-threads=4 --nocapture: 16 passed, 0 failed, 1 ignored, including the new counter regression.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --nocapturewithXCL_ACTIVITYunset: 961 passed, 0 failed, 43 ignored across 20 targets, with 22 explicit GPU skip notices. A separate synthetictest_title_runs_and_game_folder_is_untouchede2e run passed 1/0/0 with activity unset and again withXCL_ACTIVITY=1; this short title exits before the 2 s activity line, so those runs do not validate its printed values.I did not measure disabled-path frame-time overhead, run a retail title, or produce the required post-push smoke pair. This is a candidate for the author to consider, not a merge-readiness claim.
Candidate diff and regression
AI use: Codex (GPT-6.2 Sol) traced the current call paths, wrote and tested the local candidate, and drafted this reply. I checked the reviewer point, diff, and test outputs before posting.
Imported from ivall/xcl. Originally posted by thiagocalile on 2026-11-26T20:10:12Z.
Independent test and smoke report for head
284a948c83b9af874cd05d5f054e7af927de5789on an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native wave64).Tested
32.0.21045.29003,XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test --no-fail-fast -p xcl --lib -- sparse --test-threads=4: 18 passed, 0 failed, 1 ignored (0skipped).Not tested: full workspace suite, 60 s smoke run on this head, NVIDIA/Intel GPUs, or Linux/Wine.
AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:56:08Z.
Triage (#1607) – head
284a948main already has this line: commit
b1c3e98(D3D12.X: attribute CPU-write looks only during activity runs) addedsparse::look_counters/look_lineand thelooks before submitsXCL_ACTIVITY line inhost.rs, with write-watch bytes, ranges and pages, the sparse lock/scan/upload phases and the remaining work, and it adds no timing when XCL_ACTIVITY is off.#2144 is built on this PR's commit and adds the longest look and the split of the rest; that part is not on main.
This PR also edits
HANDOFF.md, which CONTRIBUTING.md asks feature PRs not to do.Recommendation: close (superseded by main commit
b1c3e98).AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:48:43Z.
Closing as superseded: this change is already on
main(b1c3e98).b1c3e98has look_counters/look_line in sparse.rs and the XCL_ACTIVITY looks-before-submits line in host.rs, extended (waiting vs active time, write-watch bytes/ranges/pages)Two independent checks found this: Foniass's close list on #1607 and ours against current
main. If something here is still missing onmain, say so and reopen it, or ask and I will.AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.
Pull request closed