Repository navigation
Conversation
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
Once any buffer mirror exists, sync_title_buffers runs on every draw and nothing reported what it costs. With XCL_ACTIVITY=1 it now logs, every 2 s in which it ran: draws synced and those with a mirror, copies (whole buffers), bytes copied, indices scanned for the vertex range, readable() calls (those over 16 pages, which can take the VirtualQuery walk), the time in readable() and its slowest call, and the time in the function. The slowest readable() is not in xcl-dev#2391's list: measuring on xcl-dev#2389 found single calls of 16 pages or fewer taking 1-9 ms, which the other counters average away. The counters cost nothing without XCL_ACTIVITY: host_main turns them on (enable_sync_activity) before it starts the activity thread, and until then sync_title_buffers, sync_readable() and sync_count() check one relaxed bool and take no time stamps and touch no shared counter. No change in behaviour: the old body is sync_mirrors, unchanged apart from the counters, and sync_title_buffers still returns first when no mirror exists. Fixes xcl-dev#2391. Part of xcl-dev#2389. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sync_title_buffers checked every copy's source, and the indices it scans, with gpu::shader::readable. For a range with a page that is not resident, or over 16 pages, that walks the region with VirtualQuery. Measured on xcl-dev#2389, in 18 of 43 two-second windows one such call took 1.1-8.8 ms on the render thread inside a draw. The copy now uses title_textures::copy_committed_region (ReadProcessMemory, which cannot fault), so a page the title freed or protected since keeps what the mirror had. The indices are scanned from the index buffer's mirror once copied there; an index buffer without a mirror is still checked. xcl-dev#2392 proposed checking once per mirror and again after kernelx frees or reprotects memory. kernelx does not see HeapFree, which releases large heap blocks inside ntdll, so that still needed a copy that cannot fault, and with one the check has nothing left to protect. Fixes xcl-dev#2392. Part of xcl-dev#2389. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s differ `sync_title_buffers` copied the drawn range of every mirrored buffer at every draw and scanned every index again. The retail game measured in xcl-dev#2389 rewrites these buffers every frame with the same bytes, so the write-watch sees them written (xcl-dev#2478 found no saving that way) while their content does not change. Each copy now reads the title's bytes into a per-thread scratch buffer (64 KiB chunks, `ReadProcessMemory`) and writes only the 4 KiB pages that differ from the mirror's. A chunk with a page the title freed or protected is copied with `copy_committed_region` as before (xcl-dev#2392). Unchanged pages are no longer written into the mirror, so the sparse look no longer sees them dirty. An indexed draw whose indices are in a mirror keeps the vertex range it scanned, per thread, keyed by (index buffer, bytes, format, first, count, base vertex), and scans again only after any mirror was written (`MIRROR_WRITES`). `XCL_ACTIVITY` reports the bytes written next to the bytes compared. Part of xcl-dev#2393. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0c62a58 to
5f61e93
Compare
|
Tested: current PR head merged onto current
Not tested: retail titles (no title data on this lane, counts only). AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting. |
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
Stacked on #2437 (itself on #2416); only the top commit (
D3D12.X: the per-draw mirror sync writes only mirror pages whose bytes differ) belongs here. It is an alternative to #2478, not on top of it.sync_title_bufferscopies the drawn range of every mirrored buffer at every draw and scans every index again. The title measured in #2389 rewrites these buffers every frame with the same bytes, so the write-watch reports them written (#2478 saved little that way) while their content stays the same. This change compares content instead: a copy writes only the mirror pages whose bytes differ, and an indexed draw reuses the vertex range it scanned while no mirror was written.Part of #2393. Part of #2389.
What is in it
crates/xcl/src/hle/d3d12x/list_x.rs:update_mirrorreads the title's bytes into a per-thread scratch buffer (64 KiB chunks,ReadProcessMemory) and writes only the 4 KiB pages that differ from the mirror. A chunk with a page the title freed or protected falls back tocopy_committed_region(D3D12.X: the per-draw mirror sync checks its source with readable() at every draw #2392). Unchanged pages are no longer written into the mirror, so the sparse look no longer sees them dirty (D3D12.X: buffer mirrors in sparse windows are written each draw and uploaded again #2394).MIRROR_WRITES, coarse but simple). An index buffer without a mirror is scanned at every draw, as before.a_mirror_is_written_only_where_the_title_bytes_differ(with a write-watch on the mirror, and a page made unreadable),a_vertex_range_is_scanned_again_only_after_a_mirror_write,the_mirror_sync_follows_changed_indices.crates/xcl/src/host.rs: theXCL_ACTIVITYmirror line shows the KB written next to the KB compared.Tested
Hardware: NVIDIA RTX 2070 SUPER (driver 32.0.16.2140), AMD Ryzen 5 3600XT, Windows 11 build 26300, Rust 1.100.0. Tests in debug, runs in release.
Suite on
5f61e93:cargo test --workspace -- --test-threads=4: 1429 passed, 0 failed, 46 ignored; 25 SKIPPED (21no wave64, 3 f16/f32 programs refused for wave32 (gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426), 1no heap windows, as onmain).New tests: all three fail with the change undone (every page written; the cached range never rescanned).
Measurement: retail game, menus, 120 s with its learned coherent window removed so the two mirrors are made (at ~31–32 s). One run each, means per 2 s of the
XCL_ACTIVITYlines once the mirrors exist (43–44 windows).bb9bea2)0c62a58)Only the window in which the mirrors were made wrote anything (219 KB); every later window wrote 0 KB and scanned 0 indices. What remains is the read and the compare. Both runs held 60 presents per 2 s, so frames do not show the saving.
Regression run
main:This PR:
That run had the 4095 MB coherent window in place and made no mirrors, so it does not reach the changed path; see Measurement for runs that do.
Not tested
AI use
🤖 Generated with Claude Code