Repository navigation
Conversation
A write-watch call costs about 3.5 µs however little it covers, while one call over 2 GiB of committed pages takes about 1.3 ms (measured with a small GetWriteWatch benchmark on Windows 11). With ranges merged only across gaps under 1 MiB, the look before each submit made thousands of calls over a retail game's mapped sparse tiles: its intro video had the submitting thread at 42 % in GetWriteWatch (sampled). Ranges under 64 MiB apart are now one scan; the pages in a gap are reported written as well, which the uploads already tolerate (they keep to what they track). The ranges are clipped to the write-watched regions with a binary search per region instead of a pass over every merged range for each region: both lists run to thousands while a game streams its world. Assisted-by: Claude Code (Claude Opus 5.5)
|
I checked the boundary where a merged range produces more dirty pages than the 16,384-entry buffer. A scratch test used XCL’s With the scratch test added, AI use Codex with GPT-6.2 Sol wrote and ran the scratch check and drafted this report. |
Before each submit,
title_textures::refreshasks the write watch which pages the CPU wrote. The watched ranges (title textures and mapped sparse tiles) were merged only across gaps under 1 MiB, so on a retail game that streams its world the look made thousands ofGetWriteWatchcalls before every submit. A call costs about 3.5 µs however little it covers, while one call over 2 GiB of committed pages takes about 1.3 ms (a smallGetWriteWatchbenchmark on this machine), so the calls, not the bytes, were the cost: sampling the title's threads during its intro video put the submitting thread at 42 % inGetWriteWatch(on a local build with other changes, not on main).This merges ranges up to 64 MiB apart into one scan. The pages in a gap are reported as written too, which the uploads already tolerate: they keep to the textures and tiles they track. The merged ranges are also clipped to the write-watched regions with a binary search per region instead of a pass over every merged range for each region; both lists run to thousands while a game streams.
I searched open and closed PRs for "write watch", "WATCH_GAP", "watch_ranges" and "GetWriteWatch calls" first. #486 (skip unchanged uploads) and #440 / #451 / #455 / #458 / #465 (faster detile and upload) work on the uploads after the look; none of them changes the look itself, so this should stack with them.
What is in it
crates/xcl/src/hle/d3d12x/title_textures.rs:WATCH_GAP1 MiB → 64 MiB (with the measurements in its comment);watch_rangesclips withpartition_pointper region;watch_ranges_clip_and_mergechecks the new gap, a merged range over two regions given in either order, and a region between and past the merged ranges.Tested
cargo build --workspacethencargo test --workspace --release -- --test-threads=4on712bbbe: 677 passed, 0 failed, 41 ignored (lib 637 / 0 / 21).gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware(no wave64).scripts/smoke.ps1 -Seconds 60, main and this PR in turns, five pairs (frames shown, main → PR): 469 → 536, 561 → 369, 555 → 524, 547 → 556, 944 → 1517. No device removal or crash in any of the ten runs; the PR's peak commit was at or below main's each time (14,604 – 15,067 MB vs 15,057 – 15,962 MB).Regression run
main:
this PR's head:
Not tested
AI use
GetWriteWatchbenchmark, wrote the change, its test and this description. I ran the tests and the smoke runs on the hardware above.