Repository navigation
Conversation
Port upstream PR #2437 (by KOLESNiii, commit bb9bea2) onto amd-dev. sync_title_buffers checked every copy's source and scanned indices with gpu::shader::readable. For a range with a non-resident page or over 16 pages, that walked the region with VirtualQuery, stalling the render thread for 1.1-8.8 ms inside draws (#2389 / #2392). Use title_textures::copy_committed_region (ReadProcessMemory, which cannot fault) so freed or protected pages keep what the mirror already holds, and scan indices from the index buffer's mirror once copied (keeping readable() only when an index buffer has no mirror). Includes regression test. Fixes #2392. Part of #2389. Assisted-by: Antigravity (Gemini 4 Neon High)
…#2414, xcl-dev#2415 Integrates per-draw mirror sync fast path (xcl-dev#2437), PresentX compositor hardening (xcl-dev#2418), XAudio2 GetState buffer context fix (xcl-dev#2410), and Wine test fixes (xcl-dev#2414, xcl-dev#2415). Assisted-by: Antigravity (Gemini 4 Neon)
|
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
…#2414, xcl-dev#2415 Integrates per-draw mirror sync fast path (xcl-dev#2437), PresentX compositor hardening (xcl-dev#2418), XAudio2 GetState buffer context fix (xcl-dev#2410), and Wine test fixes (xcl-dev#2414, xcl-dev#2415). Assisted-by: Antigravity (Gemini 4 Neon)
bmjask
left a comment
There was a problem hiding this comment.
No concrete source-level defect found. copy_committed_region preserves prior mirror bytes for inaccessible pages while copying surrounding committed data, and mirrored-index range selection matches what the GPU draws; the focused test is useful. Merge evidence is incomplete: no current Windows build/test, and title validation did not exercise inaccessible sources, whole-buffer copies, instancing, or unmirrored indices. The XCL_ACTIVITY overhead is inherited from stacked #2416 and should be addressed there.
|
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>
bb9bea2 to
c24fbbf
Compare
|
Thanks. On the three points:
(Claude Code, Claude Opus 5.5) |
…outside coherent window) Preserves xcl-dev#871 safe coherent copy under Wine and xcl-dev#2437 pub(super) copy_committed_region. Assisted-by: Antigravity (Gemini 4 Neon)
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
…r sync copies without asking readable() Taken as it is for a test on a title. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> # Conflicts: # crates/xcl/src/hle/d3d12x/list_x.rs # crates/xcl/src/host.rs
Stacked on #2416; only the top commit (
D3D12.X: the per-draw mirror sync copies without asking readable()) belongs here.sync_title_bufferschecked every copy's source, and the indices it scans, withgpu::shader::readable. For a range with a page that is not resident, or over 16 pages, that walks the region withVirtualQuery; the measurement on #2389 saw single calls take 1.1–8.8 ms on the render thread inside a draw. The copy now usestitle_textures::copy_committed_region(ReadProcessMemory, which cannot fault), and the indices are scanned from the index buffer's mirror once copied there.Fixes #2392. Part of #2389.
This differs from the proposal in #2392 (check once per mirror, again after kernelx frees or reprotects memory): kernelx does not see
HeapFree, which releases large heap blocks inside ntdll, so that design still needed a copy that cannot fault, and with one the check had nothing left to protect. No kernelx change.What is in it
crates/xcl/src/hle/d3d12x/list_x.rs: the copy goes throughcopy_committed_region; a page the title freed or protected since keeps what the mirror had (before,readablefailed and none of the range was copied). Indices are read from the mirror; an index buffer without a mirror is still checked withreadable. Two tests:the_mirror_sync_copies_around_a_page_the_title_made_unreadable, andthe_mirror_sync_copies_whole_buffers_around_a_page_the_title_made_unreadablefor the other paths with a vertex page made unreadable (an index buffer without a mirror giving the vertex range, a draw with instances, an unreadable index buffer without a mirror: both copy the whole buffer around the page).crates/xcl/src/hle/d3d12x/title_textures.rs:copy_committed_regionispub(super).Tested
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.
cargo test --workspace -- --test-threads=4onc24fbbf: 1426 passed, 0 failed, 46 ignored; 25 SKIPPED (21no wave64, 3 refused gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 forms, 1no heap windows, as onmain).Both new tests fail without the change ("the first page is copied", "the whole buffer is copied") and pass with it.
Retail game, menus, 120 s (on the earlier head
bb9bea2) with its learned coherent window removed so mirrors are made (a 384 KiB index buffer and a 1.1 MiB vertex buffer at 32.5 s),XCL_ACTIVITYcounters from D3D12.X: XCL_ACTIVITY counts and times the per-draw buffer mirror sync #2416, 43 two-second windows each, mean per 2 s:bb01e85)readable()calls, timereadable()The time
readable()took went to the copy instead: no change on average. The slowreadable()calls of D3D12.X: every draw re-syncs buffer mirrors on the CPU (VirtualQuery, whole-buffer copies, index scan) #2389 (1–9 ms) did not occur in thebb01e85run, so this run does not show the stall going away; what the change removes is the code path that made it.Regression run
main:This PR:
Not tested
AI use
🤖 Generated with Claude Code