Repository navigation
runtime: the CPU half of Xbox physical pages, with write-fault dirty tracking - #5381
maxxgabriel wants to merge 19 commits into
Conversation
|
AI-assisted independent GPU check of head With
Scope: the local test copies disabled the timing/benchmark blocks (including the paging queued-work timing check); the paging test substituted a bounded four-page scattered-bind check, and the physical test added CPU assertions without changing the GPU upload/readback path. No performance claim, unbounded stress, or end-to-end title integration is covered. The separate Windows CPU mapping/dirty-rearm review is claimed by Hiiva; this is not a full |
Hiiva
left a comment
There was a problem hiding this comment.
Independent Windows CPU review of 22afe9c5daa64ac6709e31a6a9378e47ec52e054.
The standalone probe includes the unmodified runtime/src/xbox_physical.h. Its 41 positive checks pass: aligned aliases share bytes, a first write marks the physical page, take_dirty() protects both views again, another alias write is tracked, invalid/unallocated page indices and oversized batches leave existing mappings unchanged, aligned remap/unmap preserves the other alias, and destruction releases the reservations. A separate ignored copy with only the take_dirty() re-protection call omitted fails the re-protection assertion, so this check exercises the new behavior.
One nonblocking boundary observation at runtime/src/xbox_physical.h:114: map(base + offset, {replacement}) accepts offsets 1, 4096, and 65535 and changes the preceding 64 KiB slot. This occurs with both a fresh placeholder and an existing mapping. The native MapViewOfFile3 controls reject those starts (1132, 487, 1132), preserve the placeholder, and subsequently accept the aligned mapping. The helper's integer slot calculation explains the observed rounding.
I am not treating that comparison as a blocking Xbox or game defect. The helper has no explicit invalid-start rejection promise, its current test callers supply aligned addresses, and the XMem/device wiring is deliberately deferred. Making the aligned-address boundary explicit before adding callers would avoid relying on accidental rounding.
Scope: original synthetic pagefile sections and placeholder reservations only, no game files or GPU execution. This does not replace the PR's GPU coherence/validation test. Windows 11 x64 build 26200, MSVC 19.44.35228, Windows SDK 10.0.26100.0; Vulkan headers 1.4.363.0 were used to compile the header, with no Vulkan calls. AI-assisted: yes.
…gs, lock the queue in bind_sparse_ordered
22afe9c to
df8b3cc
Compare
|
Tested 4b1252c natively on Windows 11 Pro 26200 (MSVC 14.44.35207, Vulkan SDK 1.4.363.0), merged onto
No game files. AI-assisted (Claude Code). |
… or empty arena, and an empty submit
Kam471
left a comment
There was a problem hiding this comment.
Reviewed head 4b1252c5ef.
Stack: contains #5378's tip 6571ec5533 plus 3 commits (correctly rebased; git merge-base --is-ancestor pr/5378 pr/5381 is true).
Build: vcvars64 + Ninja + Vulkan 1.4.363, then
cmake --build build --target vk_xbox_paging_test vk_xbox_physical_test
.\build\vk_xbox_physical_test.exe-> PASS: one page at two VAs; CPU writes P0..P3 visible through arena VA 0x300000000 after one upload; GPU fill -> readback P2 = 0x5a; first write fault 2.51 us; take_dirty 256 pages 0.161 ms; 16 MiB upload 8.34 ms..\build\vk_xbox_paging_test.exe-> PASS (181 calls, 20144 binds), the #5378 suites still green on top.
Inert: xbox_physical.h is included only by xbox_paging.h; no src caller; CMake adds test executables only. Dirty tracking is exercised by the test rather than claimed.
Verdict: LGTM, merge after #5378.
4b1252c to
56541e4
Compare
…64 GiB of sparse address space
…staged readback, and check the device functions
56541e4 to
02392f1
Compare
|
Ran an automated multi-agent review (Claude Code ultrareview) on this PR's current head. It found 17 candidates and refuted most of them; 10 were confirmed. All are graded nit, but only because nothing calls Correctness
Lifetime
Performance
I didn't run anything for these; they come from the review's code read. AI-assisted (Claude Code). |
|
finding for #5381 (D3D-546), from a check of how Leonida keeps CPU and GPU copies of shared pages in sync. It's a design note, not a full review. With per-page dirty tracking,
A test that would catch it:
Possible fixes: track GPU-written ranges per page and either read them back before the upload (merge) or upload only the CPU-dirty byte ranges instead of whole pages. It isn't reachable on |
|
Tested 02392f1 on Intel UHD Graphics 770, driver 32.0.101.7088, with LEONIDA_VK_VALIDATION=1 and the Khronos validation layer inserted by the loader, and on NVIDIA GeForce RTX 4080, driver 617.42, without validation: vk_xbox_physical_test and vk_xbox_paging_test exit 0 and print PASS on both. The UHD 770 run prints "device: Intel(R) UHD Graphics 770 (validation on)" and "validation errors: 0". On the RTX 4080, vk_xbox_physical_test logs "CPU writes to P0..P3 read back through arena VA 0x300000000 after one upload: match" and "GPU fill of arena page -> readback -> CPU view of P2 reads 0x5a". vk_xbox_physical_test prints only PASS on success, so its other checks are not itemised. AI-assisted. |
…over CPU writes, start GPU halves from the CPU half
|
Tested 9b11bcc on Windows 11, AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010: pass
AI-assisted (Claude Code). |
# Conflicts: # runtime/src/vulkan_backend.h
…d address off its alignment (from aidity's aa03123)
|
Updated to c5116ef, merged #5378 in, no force push.
@Etoile-Bleu thanks for the call site write-up, the 64 KiB unit matches. Now that #6919 is merged, I'll make this the gpu half under that store instead of keeping a second one. 49/49 targeted tests pass on my 1660 SUPER (610.88). Full suite is running. |
|
Tested Setup. The head merged alone onto Tests
Retail exe (
Not tested: native Windows/MSVC, a Vulkan validation-layer run, and wiring the exports to this store. #6919, merged after my AI-assisted (Claude Code). cc @shayderrr |
|
Boot-chain measurement for this PR on RDNA4/Windows, alone and combined with #7524. Machine: Windows 11 26300, RX 9070 XT (RDNA4, gfx1201), AMD 32.0.32029.2010 (26.11.2). MSVC 19.44 build, Ninja,
Net: this PR does not move the front on its own — the wall in front of physical pages is still the TLS stop — and the two boot PRs do not compose without a rebase, so the pair that would plausibly clear stop 6 cannot be measured from the current heads. AI-assisted — agent: yes. |
|
Detail on the merge conflict reported above, since it decides whether the pair can be measured at all.
So the two branches rewrite the same four lines with different allocators. Taking this PR's side as-is drops #7524's tracked-alloc guard; taking #7524's side drops the
AI-assisted — agent: yes. |
Claimed in the coordination issue as: D3D-546 (#313)
Depends on: #5378 (this branch includes its commit; the diff of its own is the second commit)
What and why
On the console the CPU and GPU address the same physical page. Here the GPU side has to be device-local, so
runtime/src/xbox_physical.hgives each page two halves and keeps them coherent:PhysicalPageStore): a 64 KiB slot of one pagefile-backed section. Views are placed at the title's VAs over placeholders (VirtualAlloc2withMEM_RESERVE_PLACEHOLDER,MapViewOfFile3withMEM_REPLACE_PLACEHOLDER), so one page can be mapped at several VAs.PhysicalGpu): aPagePoolpage, allocated on first use.take_dirty()write-protects dirty pages again, andrecord_uploadcopies them ahead of the title's commands.record_readbackthenfinish_readback.This is the mechanism
XMemAllocatePhysicalPagesandXMemMapPhysicalPages[Scatter]map onto; they get wired once a call site shows their arguments.Details worth a look:
split()checks that withVirtualQuery.map()and the record calls check the whole call before changing anything, so a bad page index or an exhausted pool leaves nothing half-applied.PhysicalGpuis destroyed.Measured on a GTX 1660 SUPER (median of 8):
take_dirtyof 256 pagesTested
vk_xbox_physical_test(Windows only): PASS, and 0 errors underLEONIDA_VK_VALIDATION=1. Covers a page mapped at two VAs, CPU writes read back through the arena, and a GPU fill read through a CPU view.vk_xbox_paging_test: still PASS.NVIDIA GeForce GTX 1660 SUPER, driver 610.88, Windows 11, MSVC 14.51, Vulkan SDK 1.4.363.1.
Checklist
docs/design.md, with how it was confirmed. (No translator change.)