Repository navigation
D3D12.X: under Wine read a few resident pages of the title's in one read - #3594
Royalflamejlh wants to merge 1 commit into
Conversation
…'s in one read)
|
Review (head a364ed7, diff read, not a merge-check; draft, checks red):
Fine: on Windows behaviour is unchanged; under Wine a guard page, a non-resident page or a page the working-set query cannot answer for still goes region by region, and a page decommitted between the check and the copy is handled by AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
read_committed_into reads the title's bytes with one ReadProcessMemory on Windows. Under Wine that read uses up a guard page in the range (xcl-dev#2844: title_bytes_leave_guard_pages_alone fails with it), so there every read asked VirtualQuery about each region first, even a 32-byte one. In a run in the title's world those queries were the first call site of all, about 17 µs each, mostly for 32-byte descriptor slots. Under Wine 11.21, with no other thread, a VirtualQuery in a 300 MB committed run took 2.5 µs and a working-set question about 1, 4 or 16 pages 0.33, 0.38 and 0.61 µs, both under Wine's virtual-memory lock. Under Wine a range of up to 16 pages that the working set holds as readable (gpu::shader::pages_readable, now crate-visible) is read in one copy_committed_region, which survives a concurrent decommit. A guard page is never in the working set, so a range with one is read region by region as before, and its guard stays. Windows is unchanged. Measured with two other changes (the superseded-target scan reading view heap slots in place, and the memory report reusing its commit sum) on a tree carrying other unmerged work, RTX 4060 Ti, Wine 11.21, 1 run each with the same options, the title in its world: 1.19 -> 3.70 frames a second, and this VirtualQuery call site went from 1,120 ms of thread time a second on average to out of the top list. What each change gives on its own was not measured. The 16 is pages_readable's own limit (SMALL_RANGE_PAGES, now shared): past it that function reads a byte of each page that is not resident, which under Wine would use up a guard page. Test: read the Wine way on any platform, a 32-byte read and a 16-page read of resident memory ask no region (red without the change, on Windows too); a 32-page read reads the same bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a364ed7 to
26f4331
Compare
|
@Foniass thanks; both done at
AI use: Claude Code (Claude Opus 5.5) made the change, ran the tests and drafted this reply. |
|
Follow-up review (head 26f4331, since a364ed7, diff read, not a merge-check; draft, checks red):
New: none. Fine: Windows behaviour is unchanged; under Wine a range over 16 pages, or with a guard, non-resident or unanswerable page, still goes region by region; the fast path copies through AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
Under Wine,
title_textures::read_committed_intoskips its whole-rangeReadProcessMemory(a guard page would be consumed: #2844) and reads region by region, oneVirtualQueryper region, each under Wine's one virtual-memory lock. A read of up to 16 pages that the working set holds as readable is now one working-set question (gpu::shader::pages_readable, madepub(crate)) plus oneReadProcessMemory. A guard page is never in the working set, so a range with one still goes region by region and the guard survives. Windows is unchanged.What is in it
hle/d3d12x/title_textures.rs(read_committed_into): the Wine fast path for up to 16 resident pages; a test that such a read asks no region of the system (2 against 0 without the change).gpu/shader.rs:pages_readablevisible to the crate.Tested
x86_64-pc-windows-gnu, release, head26f433146(Foniass's review points fixed; the results below that namea364ed71bwere taken there):cargo test -p xcl --release --lib -- --test-threads=2 title_textures gpu::shader: 72 passed, 0 failed, 1 ignored in 5 of 11 runs; in the other 6,title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsfailed and threestream_recheck_*tests after it on its poisoned lock.main6bfb5c515fails the same four in 10 of 11 runs of the same command here: it fails whengpu_uploads_of_a_texture_on_two_queues_keep_their_orderruns before it in the same process (passes alone, 3 of 3), not because of this change.XCL_LOOK_STATS=2from another fork): theVirtualQuerycall site inread_committed_intomade 150,000 to 195,000 calls a second; with this change, D3D12.X: read a view heap's slots in place when scanning for superseded targets #3592 and a third change together it was not in the top list and the title ran 3.70 frames a second in its world against 1.19. The gain from this change alone was not measured.Regression run
RTX 5070 Ti 16 GB (driver 621.24), Ryzen 7 9800X3D, Windows 11 Pro 26300, release builds by
scripts/smoke.ps1, the same retail title for 60 s each.main:this PR's head:
Not tested
read_committed_into(known_readable); they change different lines and this one is still taken first with D3D12.X: remember committed source regions instead of asking Windows per submit #3575 in, on our test tree.AI use