Repository navigation
D3D12.X: XCL_ACTIVITY logs the CPU time of the looks before each submit - #1832
marquezinii wants to merge 1 commit into
Conversation
Before every title submit XCL looks for the CPU's writes (write-watch over the watched ranges), copies them into sparse video memory and uploads changed title textures, on the title's own thread. On slower CPUs that look is most of the frame (2-6 fps on an i9-9900K in xcl-dev#582), but the only record of it is the cumulative timing line logged at power-of-two submit counts, so a report at a few fps cannot say how much of each second went there. With XCL_ACTIVITY=1 every 2 s now also logs the looks of the last 2 s: how many, their whole time and its share of the 2 s, the write-watch scan with the megabytes it watched a look and the pages it found, the copies into sparse video memory, and the rest. Without XCL_ACTIVITY only counters are added: two Instant::now() calls per look and a sum over the cached ranges.
|
Regression pair on a retail title for this head ( Tested
Regression run main: this PR's head: The new line. The script sets 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
AI use: Claude Code (Claude Fable 5.2) built both trees, ran the script and wrote this report. I read it before posting. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
@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 AI use: Claude Code (Claude Opus 5.5) drafted this reply. |
The `looks before submits` line (xcl-dev#1832) leaves "the rest" of a look as one number. Its parts are timed now: the view-source recheck, the VRAM pages' sync, the recheck of streamed textures outside the write-watch, choosing the textures to upload, and the uploads (MB; the content hash with its read, the detile, the submit with its wait), with what is left as "other". The line also gives the longest look of the period: one slow look is a stall an average hides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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