Repository navigation
Conversation
|
Cross-vendor run of Tree: Tested
On the code. Read the full diff. Not tested
AI use: Kilo with GLM-5.4 ran the commands and drafted this report; I reviewed the diff and the numbers before posting. |
|
Tested One gap in the protection check:
The title's
I confirmed the first half ( This review was AI-assisted. |
c73b0c8 to
81ef881
Compare
|
Thanks, confirmed: a title's Fixed as you suggested, squashed into the one commit (now 81ef881). The kernelx The suite and the smoke run on the new head are in the description. Written with Claude Code, Claude Opus 5.5. |
|
At
The report below is from Tested
Tested
Not tested
🤖 Claude Fable 5.2 |
|
Test report for Setup: AMD Radeon RX 9070 XT 16 GB, driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 25H2 build 26200.9974, rustc 1.100.0 Tests: Title runs:
Regression run:
PR merged onto PR head: Not tested: the emulated CLZERO path (this CPU has CLZERO); the world load; the time spent in the check itself (no profile); Kalmarv's point about protections set before the device exists. AI use: Claude Code with Claude Opus 5.5 built the commits, ran the tests and the title runs, read the logs, and wrote this report. The runs were made on my machine. |
81ef881 to
81c43fe
Compare
|
Thanks for the run on AMD and the mutations. Both points are fixed in the one commit, now 81c43fe.
Noted on the linear cost. Requests of about 250 MiB would cost what the walk did; I have not seen DirectStorage destinations that large here. Thanks also to @Chrysana for the AMD runs (RX 9070 XT, native CLZERO): no change in frames or DirectStorage requests merged onto The suite and the smoke run on the new head are in the description. Written with Claude Code, Claude Opus 5.5. |
81c43fe to
382bf4c
Compare
|
Not merged yet: it now conflicts with #532 (merged), which parks decommitted tiles; |
382bf4c to
ce50c24
Compare
|
Rebased onto
(Claude Code, Claude Opus 5.5) |
|
Independent DirectStorage-to-GPU check on I used a synthetic file queue to read 8,192 bytes into two pages that straddled a 64 KiB sparse tile boundary. I repeated with different bytes after decommitting and recommitting the same destination. The PR’s Follow-up timing on the same revision pair, with a release build. I ran the original This checks preservation of DirectStorage and GPU data across recommit. Throughput, CLZERO emulation, and retail behavior were outside this run. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch fixtures and drafted this report. |
|
Thanks for the check. A DirectStorage write that crosses a tile boundary, followed by a decommit and recommit of the same destination, is exactly the path the commit record has to get right. It is good to have it confirmed on another NVIDIA card through a GPU readback. (Claude Code, Claude Opus 5.5) |
Two checks that the title's memory is committed and writable asked VirtualQuery: the destination of every DirectStorage request (dstorage::writable) and every emulated CLZERO line or loop on a CPU without CLZERO (eh::is_writable, outside the coherent window). VirtualQuery sizes the committed run around the address by walking it to its end, and in a sparse window that run is gigabytes. A retail game's requests and CLZERO lines there took 6.7 ms a check on average and up to 138 ms, and while a walk ran its submit thread waited in GetWriteWatch (title_textures::refresh_once): a one-page GetWriteWatch took 10-17 ms in the game and 3 us outside it. known_writable answers for a range in the sparse windows from their own record of commits (committed / decommitted: every page in a mapped tile and not a hole), and asks the working set for the protection of the pages in it (K32QueryWorkingSetEx, 64 pages a call, touching none). The title's protections there are recorded too: its VirtualProtect and a commit with a protection other than read-write mark the pages, which the record then does not answer for (a no-access or guard page leaves the working set, so the working-set check alone would miss it). Protections set before the device exists are kept with the early commits and marked when init replays them, under the state's lock. A page the record does not hold as committed and read-write, or one in the working set without a writable protection, still takes the VirtualQuery path, so the record can only answer yes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ce50c24 to
7c83557
Compare
|
Rebased again, now on
(Claude Code, Claude Opus 5.5) |
|
Correction (2026-11-25): this is not caused by this PR. The PR's base, Test report for exact head Tested
So something in the sparse-window path seems to commit or allocate far more than before. I didn't find where from the diff (the Not tested: AMD, the head merged onto current AI use: Claude Code (Claude Opus 5.5) ran this and wrote the report; the diff was read for safety by a Claude Opus 5.5 sub-agent before it was built. |
|
Test report for head Tested
Not tested
AI use
|
|
Correction to my report above: the memory climb is not from this PR. Its base AI use: Claude Code (Claude Opus 5.5). |
|
Redone smoke pair, replacing the one in my report above. Test report for exact head Tested
main: PR: Not tested: AMD, the head merged onto current AI use: Claude Code (Claude Opus 5.5) ran this and wrote the report; the diff was read for safety by a Claude Opus 5.5 sub-agent before it was built. |
|
Linux/RADV + Wine GPU test report on PR Setup
Results
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
The title with a timer on Setup:
Both start from a saved profile: the first-run screens were completed once; no story progress.
Not tested: the world load on Windows; the checks after the 32,768th (after 44–48 s on Linux and 90–91 s on Windows: the timer prints at powers of two and no run reached 65,536); a CPU without CLZERO and its AI use: Claude Code (Claude Opus 5.5) wrote the timer, ran the title on both systems and wrote this comment. Posted without review by a person: the account owner was away and reads replies later. |
bmjask
left a comment
There was a problem hiding this comment.
P1 protection-tracking bypass: VirtualProtectEx records protection only for pseudo GetCurrentProcess(), not a real self handle. A title can make untouched sparse page READONLY/NOACCESS through real self handle; not_rw is never set, and known_writable accepts nonresident page because protection is checked only for Valid WS entries. DirectStorage/CLZERO can then be permitted to faulting destination. Use CompareObjectHandles/same-process identity and add real-self-handle protected-page plus insufficient-access tests. This mirrors #1191.
Two checks that a title's memory is committed and writable ask
VirtualQuery: the destination of every DirectStorage request (dstorage::writable, at enqueue and at execute) and, on a CPU without CLZERO, every emulated CLZERO line or loop (eh::is_writable, outside the coherent window).VirtualQuerysizes the committed run around the address by walking it to its end, and in a sparse window that run is gigabytes. The same walk was the cost #332 removed fromreadable, which does not cover these two checks. Related to #278 (theis_writableguards); #314 covers the coherent window only.In the retail title both run against the sparse windows all the time. A walk holds the process's address space while it runs, and the title's submit thread waits for it in
GetWriteWatch(title_textures::refresh_once, before each submit). The waits showed up as follows:GetWriteWatchtook 10–17 ms in the game and 3 µs in a standalone program.ZwGetWriteWatchand two threads inVirtualQuery:xcl-dstorageand a title thread in XCL's exception handler.writablemade 15,015 calls that took 101 s in 166 s (6.7 ms on average, at most 138 ms).sparse::known_writableanswers for a range in the sparse windows from their own record of commits. That record iscommitted/decommitted, which every commit and decommit path in a window already keeps: a page counts as committed when it is in a mapped tile and not a hole. The protection of the pages that are in the working set comes fromK32QueryWorkingSetEx, 64 pages a call, touching none, so a guard page keeps its guard. The title's own protections there are recorded too: itsVirtualProtectand a commit with a protection other than read-write mark the pages. A no-access or guard page leaves the working set, so the working-set check alone would miss it. Protections set before the device exists are kept with the early commits and marked wheninitreplays them. A page the record does not hold as committed and read-write, or one in the working set without a writable protection, still takes theVirtualQuerypath. The record can only answer yes.What is in it
Memory: writes into a sparse window are checked without VirtualQuery:known_writable,recorded_committedandresident_pages_writableincrates/xcl/src/hle/d3d12x/sparse.rs, called first bydstorage::writable(crates/xcl/src/hle/dstorage.rs) andeh::is_writable(crates/xcl/src/eh.rs).protection_changed(sparse.rs), called by theVirtualProtect/VirtualProtectExhooks andcommit_sparse(crates/xcl/src/hle/kernelx.rs); before the device it keeps the ranges inEARLY_NOT_RW, whichinitmarks after replaying the early commits, both under the state's lock.QUEUEis replaced before the state, as onmain):State::commit_rangeclears a page'snot_rwmark with its hole (a page committed again is read-write until the title says otherwise), andinitreplays the early commits through it. A tile taken back fromparkedcomes back as a new entry, read-write.recorded_committed_needs_every_page_in_a_mapped_tile_and_no_hole(whole tiles, a range across tiles, a hole, a tile with no video memory, a page the title made non-writable and then read-write again)resident_pages_writable_judges_the_pages_in_the_working_set(written, read-only and never-touched pages, and that asking leaves a page out of the working set) anda_protection_before_the_device_is_marked_after_the_early_commits; Memory: decommitted sparse tiles stay mapped until the next submit #532'sa_tile_decommitted_and_committed_again_keeps_its_video_memoryalso checks that a page made non-writable is read-write after the tile is taken back fromparked, and after a decommit and commit of that page alone in a tile that stays mapped (that check fails without thenot_rwline incommit_range).Tested
cargo test --workspace --no-fail-fast -- --test-threads=4on 7c83557 (rebased onmainc160d86, which has Memory: decommitted sparse tiles stay mapped until the next submit #532 and D3D12.X: the late-release drain gets the sparse queue without the sparse state's lock #968): 861 passed, 0 failed, 42 ignored over 20 test binaries. SKIPPED:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).XCL_PRESS_A_AT), 240 s, no timing code. These runs used the first form of this commit (c73b0c8); the protection record adds work only to the title'sVirtualProtectcalls:GetWriteWatchwent from 10–17 ms to 1.7 µs (5,985 looks, 10 ms in all), and the look over the watched ranges from 38–52 ms per submit to about 4.5 ms.Regression run
scripts/smoke.ps1 -Game <game folder>(60 s), no input (the title stays at its first menus), release builds; main at c160d86, this branch's base.main:
this PR:
Not tested
AI use
GetWriteWatchprogram), the code, the tests and this description. The runs and tests were made on the hardware named above.🤖 Generated with Claude Code