Skip to content

dstorage: requests into physical pages write the title's pages (RT-DSTORAGE-DEST-PAGES) - #969

Closed
DadaCap wants to merge 1 commit into
ProjectLeonida:mainfrom
DadaCap:dstorage-dest-pages
Closed

DadaCap wants to merge 1 commit into
ProjectLeonida:mainfrom
DadaCap:dstorage-dest-pages

Conversation

@DadaCap

@DadaCap DadaCap commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claim: RT-DSTORAGE-DEST-PAGES (#14 (comment)).

A DirectStorage request with DestinationIsPhysicalPages runs into a staging buffer and its bytes then go to the 64 KiB pages XMemAllocatePhysicalPages gave out (rt::xmem::write_physical_pages), so every address they are mapped at sees them. Until now it answered E_NOTIMPL.

The page array is read when the request runs, not at enqueue. The retail title passes a pointer into its own page table: at enqueue the entries are 0, and they are filled by the time the request runs. Measured on 1.0.2.1 (in my prototype stack): with a copy taken at enqueue nearly every such request named page 0; read late, no request failed in a 240 s run that reaches the loading screen.

The xmem shim is called through a pointer, as dstorage_test does not link it; without it such a request stays E_NOTIMPL. Physical-page sources stay E_NOTIMPL (none has been seen).

Tested

  • dstorage_test: 341 checks, 0 failures (new: the table filled after enqueue, the offset, three pages, a page that is not live, a null and an unreadable array). xmem_test: 220 checks OK (new: writes across pages, into uncommitted ones, bad page numbers). Windows 11, MSVC, Release-with-debug-info, on main.
  • Retail package: only in my prototype stack, not on this branch alone (RTX 5080, driver 621.24, Windows 11).
  • No game data.

AI-assisted (Claude Code, Opus 5.5).

🤖 Generated with Claude Code

…TORAGE-DEST-PAGES)

The page array is read when the request runs: the retail title passes a pointer into its own live page table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Snooozs

Snooozs commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Independent check: dstorage and xmem pass (dstorage_test, xmem_test rebuilt). I checked the page-count arithmetic: DestinationPageOffset is a UINT16 here, so offset + size cannot wrap and the copied page list always covers what write_physical_pages reads. With #968 there is a textual conflict in runtime/shims/xmem.h only (both add a hook at the end of the namespace).

Windows 10 Pro 22H2 (19045), VS 2022 RelWithDebInfo, merged onto main 3295055 without conflicts, targets rebuilt, CPU only, no game files. AI-assisted (Claude Code): I read the whole diff and ran this on that machine.

@DadaCap

DadaCap commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Closing this one: #984 brought another implementation of the same thing to main, and it covers the case this pull request was written for.

  • main's dstorage.cpp resolves a request's physical page numbers in xmem when the request runs (rt::xmem::transfer_physical), not when it is enqueued. That is the point of this branch too: the retail title passes a pointer into its own live page table, whose entries are still 0 at enqueue.
  • This branch now conflicts with main in 5 files (dstorage.cpp, xmem.cpp, xmem.h, dstorage_test.cpp, docs/directstorage.md) and adds nothing main lacks, so a merge would only put a second path beside the first.

The claim RT-DSTORAGE-DEST-PAGES can be dropped from the table. AI-assisted (Claude Code).

@DadaCap DadaCap closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants