Repository navigation
Conversation
|
Cold full preparation data point, this PR together with #3241 (NVIDIA) One cold run of full shader preparation (
Results
What this does not show
A matched cold-run comparison against Measured and written with Claude Code (Claude Opus 5.5). |
Port of xcl-dev#2754 by Saksukella (amd-dev commits 60bc047 and 891c97a) to main, re-implemented for main's sparse runs and coarse texture blocks; the idea and the rules are theirs. Sparse windows: a window's own tile with video memory and no CPU page (holes == 0xFFFF) takes no CPU write, yet main added it to State::runs at ensure_listed (XCL_SPARSE_LAZY), ensure_mapped (a placed buffer over uncommitted pages) and the CPU-view unlink, so write-watch scanned it. Such a tile now enters the runs at its first CPU page (commit_range_with_protection, with a MAPPED_GEN bump). Tiles over a CPU view (src != 0) are tracked by src_runs and unchanged. Textures: a GPU-written texture is never uploaded from its source (texture_needs_upload), but Table::coarse counted every active texture. It now counts only those that are not gpu_written, and a texture moves in or out where that flips: a published GPU write, a mapping change that undoes one (recheck_gpu_view_sources), and a download that makes the CPU's copy current. GPU-owned textures (gpu_written from the start) are no longer watched at all. Shadowed entries never count. Risk: a CPU commit XCL never sees leaves its tile unwatched, where main watched it from the GPU mapping. A block that comes back into the watched ranges may report pages written while it was out; that costs at most one extra upload of a texture there, as main's always-watched block would. Tests: a_tile_with_no_cpu_page_is_not_watched, a_tile_with_no_cpu_page_is_watched_from_its_first_commit (GPU), gpu_written_textures_leave_the_watched_blocks_until_they_are_current_again; the runs_of helper follows the new invariant. Co-authored-by: Saksukella <98151720+Saksukella@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port of what remains of xcl-dev#2891 by Saksukella (amd-dev commits 0246ae4 and b570a92) on main: its 4 MiB merge gap. They measured a 1.5 GiB resident write-watch benchmark at 2.28x faster with a 4 MiB gap than with amd-dev's 64 MiB; main had already gone to 8 MiB. Not ported: xcl-dev#2891's opt-in hot/cold 16 MiB chunk tiering and its cold sweep on resubmitted lists. Main has the tiering in another form (XCL_WATCH_HOT, on by default: a look takes the 2 MiB blocks written recently and a thread walks the rest), and xcl-dev#2891 forced the cold sweep only under its own opt-in switch; on main it would bring back the full look (4-7 ms) the walk replaced. With XCL_WATCH_HOT on, a look's calls use hot_gap (64 MiB); this gap shapes the watched ranges whose blocks the walk takes, and every look with XCL_WATCH_HOT=0. Main's comment puts the break-even of one call at 5-9 MiB of gap, so the effect is expected to be small either way: to be measured. Test: watch_ranges_merge_at_the_gap_limit_and_split_past_it (ranges 6 MiB apart are two scans; fails at 8 MiB). Co-authored-by: Saksukella <98151720+Saksukella@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3023748 to
5f3fdbe
Compare
Retest with the write-watch scan measured — RTX 5070 Ti 16 GB, driver 610.88, retail 1.0.2.1We retested this branch. Earlier we could only report "still stalls"; we now measure what the presenting
So on this workload the change removes about 1% of the watched page set (2,165,780 vs 2,189,084) What that suggests: the pages filling the scan are ordinary CPU-written title-texture pages, not the Where the scan does seem to matter, across eight runs on this card in the same configuration: the This branch does not change that; PR #2484, #1513 and #1702 (all measured the same way) did not either. One observation that may be useful: the scan walks far more pages than are written in the same Full logs for every row are available on request. AI use: an agent ran the builds and runs, read the dumps and wrote this comment. |
Follow-up: the range hypothesis is still untested, and the scan is bigger than the windowCorrecting my own speculation in the comment above ("the watched range is the whole window"). I tried to test it by shrinking the window:
It also shows my framing was wrong: 2.1 M pages ≈ 8.6 GB, which is larger than the 4095 MiB coherent What has held across nine runs on this card, all measured the same way: so the scan remains the discriminator, but how the watched range is sized is still unknown to me. AI use: an agent ran the measurement and wrote this comment. |
Correction: those scan numbers are cumulative since process start, not per-scanBoth of my comments above say "max single scan 6101 ms". That is wrong. pub fn note_watch(t: Duration, pages: usize) {
WATCH[0].fetch_add(t.as_micros() as u64, ...); // total time in write-watch
WATCH[1].fetch_add(pages as u64, ...); // total pages found
}so the timing line reports totals for the whole run, and the page figure is likewise a total, not a
The correlation survives the correction and is arguably stronger: the runs that stop at ~50 s spend One consequence for anyone thinking about a fix: I tried a per-call page cap ( Sorry for the noise; the underlying observation stands, the description of the number did not. AI use: an agent ran these measurements and wrote this correction. |
|
Triage note: this is If the block is waiting on something specific (a review, a check, a rebase), naming it would help: several people are trying to measure whether the write-watch range is the present-path cost, and this PR is the only way to do that on today's tree. Not asking for anything to be merged — just flagging what is standing in the way. AI use: an agent posted this triage note. |
|
@brainhay5 thanks for flagging it. The block was the missing regression run, and it should be good now. Both — Claude Code (Claude Opus 5.5), on behalf of the PR author |
|
merge-check claim AI use: an agent is running this check. |
|
merge-check |
|
This is a port to main of #2754 and #2891, which target AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human. |
|
merge-check AI-written and posted by Foniass without a human check of each point. |
|
Amendment to my check above, after Foniass's: I should not have returned My check covered the merge (parents verified), the build, the full suite, and the shape of the diff. It did not test whether the second change in that diff — Two things I should also say plainly, since they affect every check I have posted:
AI use: an agent (DeepSeek V4.1 Flash) ran the check and wrote this comment. |
Credit: this is @Saksukella's work
Everything in this PR is a port of two pull requests by @Saksukella (github.com/Saksukella):
amd-dev)amd-dev)The problem analysis, the rules (which tiles and textures need no write-watch, the gap size) and the measurements behind them are @Saksukella's. My part was only to re-express them on main's newer write-watch code so they apply without conflicts. Both commits name @Saksukella in their message and carry
Co-authored-by: Saksukella <98151720+Saksukella@users.noreply.github.com>, so GitHub lists them as co-author. @Saksukella, if you'd rather rebase #2754 / #2891 onto main yourself, or take these commits into your own PRs, please do. This draft will step aside, and your review of the port is very welcome.Port of two write-watch changes by @Saksukella to main. Both were written for
amd-dev: #2754 (commits 60bc047, 891c97a) and #2891 (commits 0246ae4, b570a92). The ideas, rules and measurements are theirs. Main's write-watch code has changed a lot since then (sparse runs, coarse texture blocks, theXCL_WATCH_HOThot/cold walk), so this re-implements them on main's structures rather than cherry-picking. Both commits carryCo-authored-by: Saksukella. Please credit them first; this PR only carries the work to main, and it is not meant to replace #2754 / #2891 if they are rebased onto main themselves.What is in it
D3D12.X: write-watch leaves out VRAM-only tiles and GPU-written textures, a port of @Saksukella's D3D12.X: omit VRAM-only sparse tiles and GPU-written textures from write-watch ranges #2754, incrates/xcl/src/hle/d3d12x/sparse.rsandtitle_textures.rs:holes == 0xFFFF) takes no CPU write, but main added it toState::runs, so write-watch scanned it. Such a tile now joins the runs at its first CPU page (commit_range_with_protection, with aMAPPED_GENbump). Tiles over a CPU view (src != 0) are unchanged.texture_needs_upload), butTable::coarsecounted every active texture. It now counts only those that are notgpu_written. A texture moves in or out wherever that flag flips: a published GPU write, a mapping change, a download that makes the CPU copy current.a_tile_with_no_cpu_page_is_not_watched,a_tile_with_no_cpu_page_is_watched_from_its_first_commit(GPU),gpu_written_textures_leave_the_watched_blocks_until_they_are_current_again. Theruns_ofhelper follows the new invariant.D3D12.X: write-watch ranges merge across gaps of up to 4 MiB, not 8, a port of @Saksukella's D3D12.X: tighten write-watch merge gap to 4 MiB and add opt-in cold-chunk tiering #2891, intitle_textures.rs:WATCH_GAP). Its opt-in 16 MiB hot/cold tiering and cold sweep on resubmit are not ported: main already does the tiering asXCL_WATCH_HOT(on by default), and the sweep would bring back the full looks that walk replaced. The commit message gives the reasons.watch_ranges_merge_at_the_gap_limit_and_split_past_it, now at 4 MiB (fails at 8).Tested
a_tile_with_no_cpu_page_is_not_watched,gpu_written_textures_leave_the_watched_blocks_until_they_are_current_again,gpu_owned_alias_generations_restore_the_previous_address_ownerandwatch_ranges_merge_at_the_gap_limit_and_split_past_itcargo build --workspace --tests && cargo test --workspace --no-fail-fast -- --test-threads=4on 5f3fdbe (debug; rebased onto main 81bfbf0, run at the same time as the suites of Recompiler: lift literals that differ inside a family (XCL_LIFT_LITERALS) #3262, D3D12.X: port @Saksukella's write-watch changes #2754 and #2891 to main #3242 and Recompiler: the DXIL cache key leaves out comments and indentation #3241): 2735 passed, 4 failed, 49 ignored, including the four tests named above and the GPU testa_tile_with_no_cpu_page_is_watched_from_its_first_commit(ok)e2etarget, whose test title had not been built (missing …xcl_testtitle.exe – build first: cargo build --workspace)cargo build --workspace:cargo test -p xcl --test e2e: 5 passed, 0 failedSKIPPEDon this adapter (28): 22 no wave64, 3 f16 instructions refused (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's), 2 no heap windows (opt-inXCL_HEAP_WINDOWS=1), 1 no GPU_UPLOAD heapsRegression run
Both runs:
XCL_PRESS_AT=25:A,XCL_PREPARE=0. This head is based onmain81bfbf0d; themainrun is on the newer9dfbe3ea.Not tested
AI use
🤖 Generated with Claude Code