startup: stop probing unmapped guest memory from the texture and no-op paths #2237

Open
Its3rr0rsWRLD wants to merge 2 commits from upstream-pr/2245 into main
Its3rr0rsWRLD commented 2026-11-25 07:29:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Its3rr0rsWRLD on 2026-11-25T07:29:10Z.


What it does

One commit (aa355f63, rebased onto main b079f84c). No intended behaviour change: the same addresses are found readable or unreadable as before; only how that is found changes.

  • xmem: new export x2w_xmem_mapped_bytes(address, bytes, &mapped) (src/xmem_mapped_pages.cpp, src/xmem_shim.def @23, since @17-@22 are now taken on main). It answers from xmem's page registry, without touching memory, how many bytes from address are mapped. It answers only inside xmem's page-mapping reservations. In every other case it gives no answer and the caller probes as before: an address outside those reservations (including the lazy startup blocks, which are not such reservations), a range that runs past its reservation, a range that a "commit at address" may cover (now recorded), or an "unmapped" answer that VirtualQuery does not confirm as MEM_RESERVE, such as a released reservation.
  • d3d12_xs: readable_window asks xmem first. An unmapped answer is returned without touching the page. A mapped prefix is still probed exactly as before. If xmem.dll or the export is missing, it falls back to the old probe.
  • These paths now go through readable_window instead of x2w_local::readable:
    • publish_tiled_texture (slot-70 by-address textures)
    • the no-op argument checks: names_known_iid and hex_text
    • the ExecuteCommandLists shape test in queue_dynamic
  • 30-frame retry cache: a by-address texture address that a probe found unmapped is not probed again for 30 frames, unless a write to it is announced. This applies in publish_tiled_texture and in upload_texture. It is the only timing difference: such a texture can be picked up up to 30 frames later than before.
  • queue_dynamic checks only the first 32 calls of a slot for an IID, like noop_slot and device_noop_slot already do.
  • New line in the 5 s report: x2w-d3d12 readability: unmapped by xmem's page registry N, unreadable probes skipped N.
  • Tests:
    • xmem_mapped_bytes (tests/xmem_mapped_bytes_check.py) checks the export's answers for: outside memory, an unmapped page, a mapped prefix, a range past the reservation, and a released reservation.
    • startup_queue_probe_{reserved,xmem}_{warp,hardware} (tests/startup_queue_probe.cpp) makes 200 calls of queue slot 30 (a slot still left to queue_dynamic) with r9 set to a reserved, unmapped address. Without xmem at most 32 calls may fault (the first calls are still checked). With xmem's reservation, 0 may fault. Every call must return 0.

Why

Every probe that touches an unmapped page raises a first-chance access violation. Under the debug launcher, each one stops the process for a debugger round trip. On the title tested there were about 21k-25k of these per run, mostly before the intro. Almost all came from slot-70 by-address textures whose pages were not mapped yet. Another ~400 came from queue slot 31, which was called every frame with the base of a pool whose mapping had failed. Slot 31 is now handled on main by queue_page_mappings (#2307), so that source no longer reaches queue_dynamic; the test above uses an unknown slot instead. With this change there are only tens per run.

By my testing it takes the time to the intro from ~4000 frames to ~200 frames. That measurement came from a build that also published by-address textures before their pages were mapped, which is a separate change and is not in this PR.

Independent result from @NiiRoZz (comment, on the earlier head e72dc34d): 52,820 first-chance access violations over a ~255 s run without this change, 125 with it.

Tests

Release build (cmake --preset release, Ninja, MSVC), Windows, on the rebased head. unified_buffer_paths* and vm_page_provenance* are excluded from every run (they leak system commit on this machine).

ctest -j 2 --output-on-failure --timeout 300 -R "xmem_mapped_bytes|startup_queue_probe|startup_address|memory_srv|xmem" -E "unified_buffer_paths|vm_page_provenance"
ctest -j 2 --output-on-failure --timeout 300 -R "^startup_" -E "unified_buffer_paths|vm_page_provenance"
Run Result
xmem_mapped_bytes Passed
startup_queue_probe_reserved_warp / _hardware Passed: 32 access violations in 200 calls (allowed 32)
startup_queue_probe_xmem_warp / _hardware Passed: 0 access violations in 200 calls (allowed 0)
targeted set: startup_address*, *memory_srv*, *xmem*, the new tests 97/97 passed
broad ^startup_ 679/679 passed (4 skipped: startup_view_heap_warp, startup_small_texture_4k_addrlib, startup_logical_view_warp, startup_run_sh)

Fail-first. I built d3d12_xs.dll and xmem.dll from unmodified main (b079f84c) and ran the new tests against them:

Against unmodified main Result
startup_queue_probe warp/hardware reserved with main's d3d12_xs.dll 200 access violations in 200 calls, exit 9 (fail)
startup_queue_probe warp/hardware xmem with main's d3d12_xs.dll and the new xmem.dll 200 access violations in 200 calls, exit 9 (fail)
startup_queue_probe warp/hardware xmem with main's xmem.dll exit 21: export missing (fail)
xmem_mapped_bytes_check.py with main's xmem.dll function 'x2w_xmem_mapped_bytes' not found (fail)

There were no failures on this branch, so I did not run a separate broad baseline on unmodified main.

What's left out

  • Publishing a by-address texture whose first page is unmapped (blank until its pages are mapped), instead of refusing it. This was a separate behaviour change in my local branch and is better as its own PR: publish_tiled_texture now has three callers, each with its own outcome handling, and log_partial_tile_view hashes the texels right after publishing, relying on the whole range being readable.
  • Local diagnostics not included: the per-slot no-op call census and the extra [rdx]/[r8] hex logging in queue_dynamic.
  • Unrelated changes from the same local branch not included: DirectStorage spill, the stream-cache cap, the BCPack page-end decode, and the shader lowerings.

Prepared by Claude Opus 5.5 (Claude Code).

🤖 Generated with Claude Code

https://claude.ai/code/session_01X1EBSe6YfE2ivQChRsx1hc

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5487078808 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245). Originally posted by [Its3rr0rsWRLD](https://github.com/Its3rr0rsWRLD) on 2026-11-25T07:29:10Z. --- ## What it does One commit (`aa355f63`, rebased onto `main` b079f84c). No intended behaviour change: the same addresses are found readable or unreadable as before; only how that is found changes. - **xmem: new export `x2w_xmem_mapped_bytes(address, bytes, &mapped)`** (`src/xmem_mapped_pages.cpp`, `src/xmem_shim.def` @23, since @17-@22 are now taken on main). It answers from xmem's page registry, without touching memory, how many bytes from `address` are mapped. It answers only inside xmem's page-mapping reservations. In every other case it gives no answer and the caller probes as before: an address outside those reservations (including the lazy startup blocks, which are not such reservations), a range that runs past its reservation, a range that a "commit at address" may cover (now recorded), or an "unmapped" answer that `VirtualQuery` does not confirm as `MEM_RESERVE`, such as a released reservation. - **d3d12_xs: `readable_window` asks xmem first.** An unmapped answer is returned without touching the page. A mapped prefix is still probed exactly as before. If xmem.dll or the export is missing, it falls back to the old probe. - **These paths now go through `readable_window`** instead of `x2w_local::readable`: - `publish_tiled_texture` (slot-70 by-address textures) - the no-op argument checks: `names_known_iid` and `hex_text` - the ExecuteCommandLists shape test in `queue_dynamic` - **30-frame retry cache:** a by-address texture address that a probe found unmapped is not probed again for 30 frames, unless a write to it is announced. This applies in `publish_tiled_texture` and in `upload_texture`. It is the only timing difference: such a texture can be picked up up to 30 frames later than before. - **`queue_dynamic` checks only the first 32 calls of a slot for an IID**, like `noop_slot` and `device_noop_slot` already do. - **New line in the 5 s report:** `x2w-d3d12 readability: unmapped by xmem's page registry N, unreadable probes skipped N`. - **Tests:** - `xmem_mapped_bytes` (`tests/xmem_mapped_bytes_check.py`) checks the export's answers for: outside memory, an unmapped page, a mapped prefix, a range past the reservation, and a released reservation. - `startup_queue_probe_{reserved,xmem}_{warp,hardware}` (`tests/startup_queue_probe.cpp`) makes 200 calls of queue slot 30 (a slot still left to `queue_dynamic`) with `r9` set to a reserved, unmapped address. Without xmem at most 32 calls may fault (the first calls are still checked). With xmem's reservation, 0 may fault. Every call must return 0. ## Why Every probe that touches an unmapped page raises a first-chance access violation. Under the debug launcher, each one stops the process for a debugger round trip. On the title tested there were about 21k-25k of these per run, mostly before the intro. Almost all came from slot-70 by-address textures whose pages were not mapped yet. Another ~400 came from queue slot 31, which was called every frame with the base of a pool whose mapping had failed. Slot 31 is now handled on main by `queue_page_mappings` (#2307), so that source no longer reaches `queue_dynamic`; the test above uses an unknown slot instead. With this change there are only tens per run. By my testing it takes the time to the intro from ~4000 frames to ~200 frames. That measurement came from a build that also published by-address textures before their pages were mapped, which is a separate change and is not in this PR. Independent result from @NiiRoZz ([comment](https://github.com/R0Y00/Xbox2Windows/pull/2245#issuecomment-7163909555), on the earlier head `e72dc34d`): 52,820 first-chance access violations over a ~255 s run without this change, 125 with it. ## Tests Release build (`cmake --preset release`, Ninja, MSVC), Windows, on the rebased head. `unified_buffer_paths*` and `vm_page_provenance*` are excluded from every run (they leak system commit on this machine). ``` ctest -j 2 --output-on-failure --timeout 300 -R "xmem_mapped_bytes|startup_queue_probe|startup_address|memory_srv|xmem" -E "unified_buffer_paths|vm_page_provenance" ctest -j 2 --output-on-failure --timeout 300 -R "^startup_" -E "unified_buffer_paths|vm_page_provenance" ``` | Run | Result | |---|---| | `xmem_mapped_bytes` | Passed | | `startup_queue_probe_reserved_warp` / `_hardware` | Passed: 32 access violations in 200 calls (allowed 32) | | `startup_queue_probe_xmem_warp` / `_hardware` | Passed: 0 access violations in 200 calls (allowed 0) | | targeted set: `startup_address*`, `*memory_srv*`, `*xmem*`, the new tests | 97/97 passed | | broad `^startup_` | 679/679 passed (4 skipped: `startup_view_heap_warp`, `startup_small_texture_4k_addrlib`, `startup_logical_view_warp`, `startup_run_sh`) | **Fail-first.** I built `d3d12_xs.dll` and `xmem.dll` from unmodified `main` (b079f84c) and ran the new tests against them: | Against unmodified main | Result | |---|---| | `startup_queue_probe warp/hardware reserved` with main's d3d12_xs.dll | 200 access violations in 200 calls, exit 9 (fail) | | `startup_queue_probe warp/hardware xmem` with main's d3d12_xs.dll and the new xmem.dll | 200 access violations in 200 calls, exit 9 (fail) | | `startup_queue_probe warp/hardware xmem` with main's xmem.dll | exit 21: export missing (fail) | | `xmem_mapped_bytes_check.py` with main's xmem.dll | `function 'x2w_xmem_mapped_bytes' not found` (fail) | There were no failures on this branch, so I did not run a separate broad baseline on unmodified main. ## What's left out - **Publishing a by-address texture whose first page is unmapped** (blank until its pages are mapped), instead of refusing it. This was a separate behaviour change in my local branch and is better as its own PR: `publish_tiled_texture` now has three callers, each with its own outcome handling, and `log_partial_tile_view` hashes the texels right after publishing, relying on the whole range being readable. - **Local diagnostics not included:** the per-slot no-op call census and the extra `[rdx]/[r8]` hex logging in `queue_dynamic`. - **Unrelated changes from the same local branch not included:** DirectStorage spill, the stream-cache cap, the BCPack page-end decode, and the shader lowerings. Prepared by Claude Opus 5.5 (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01X1EBSe6YfE2ivQChRsx1hc
NiiRoZz commented 2026-11-25 14:05:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T13:31:50Z.


Local test feedback on head e72dc34d (tested before the current conflict with main; merged into a local instrumented build; one run each, under a debugger-based launcher, not reproducible from the repository):

  • First-chance access violations logged by the launcher over a ~255 s run: 52,820 without this change, 125 with it. Without it, every one of them was at the single probe instruction that reads one byte per 4 KiB page.
  • The 5 s report ended at unmapped by xmem's page registry 34032, unreadable probes skipped 35623.
  • Without the change, the longest by-address SRV calls (2.7-6.3 s) each contained 1,571-10,183 of those faults.
  • Not a clean A/B: the two runs reached different scenes and the shader cache differed, so I am not giving a frame-rate figure. The by-address SRV path stayed CPU-bound with the faults gone; the remaining cost was the linear resource-table lookups, which #2343 addresses separately (no overlap with this diff: it does not touch publish_tiled_texture's readability check).
  • xmem_mapped_bytes, startup_queue_probe_reserved_warp and startup_queue_probe_xmem_warp passed on the merged build (WARP).
  • Not evaluated: the visual effect of the 30-frame retry delay for a texture found unmapped, and the _hardware variants.

AI-assisted (Claude Code); the runs above were made locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7163909555 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#issuecomment-7163909555). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T13:31:50Z. --- Local test feedback on head `e72dc34d` (tested before the current conflict with main; merged into a local instrumented build; one run each, under a debugger-based launcher, not reproducible from the repository): - First-chance access violations logged by the launcher over a ~255 s run: 52,820 without this change, 125 with it. Without it, every one of them was at the single probe instruction that reads one byte per 4 KiB page. - The 5 s report ended at `unmapped by xmem's page registry 34032, unreadable probes skipped 35623`. - Without the change, the longest by-address SRV calls (2.7-6.3 s) each contained 1,571-10,183 of those faults. - Not a clean A/B: the two runs reached different scenes and the shader cache differed, so I am not giving a frame-rate figure. The by-address SRV path stayed CPU-bound with the faults gone; the remaining cost was the linear resource-table lookups, which #2343 addresses separately (no overlap with this diff: it does not touch `publish_tiled_texture`'s readability check). - `xmem_mapped_bytes`, `startup_queue_probe_reserved_warp` and `startup_queue_probe_xmem_warp` passed on the merged build (WARP). - Not evaluated: the visual effect of the 30-frame retry delay for a texture found unmapped, and the `_hardware` variants. AI-assisted (Claude Code); the runs above were made locally.
tedin7 commented 2026-11-25 20:23:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T20:23:01Z.

Review: COMMENTED


Review of head aa355f63 (comment only, code and fixtures; no merge from this side).

Scope: new xmem export x2w_xmem_mapped_bytes, readable_window in d3d12_xs asks it first, four callers moved onto readable_window, a 30-frame retry cache for unmapped by-address textures, and an IID-shape check limited to the first 32 calls per queue slot. Shared runtime plus a main-executable startup path.

What I read and found sound:

  • x2w_xmem_mapped_bytes only answers inside a page-mapping reservation. It returns no answer (caller probes as before) for other addresses, a range past its reservation, a range a recorded "commit at address" may cover, and an "unmapped" answer that VirtualQuery does not confirm as MEM_RESERVE. The fallback is the old behavior, which is the safe direction.
  • A mapped prefix is still probed with probe_readable, so a race between the registry answer and an unmap costs a fault, not a wrong answer.
  • The shape_checks counter in queue_dynamic sits inside template <int N>, so it is per slot, like noop_slot and device_noop_slot. This matches the PR text.
  • Fixtures: startup_queue_probe_{reserved,xmem}_{warp,hardware} has a control (reserved address without xmem: at most 32 faults in 200 calls) and the xmem case (0 faults). That is a reasonable regression test plus negative control for the fault count.

Open points for the merger:

  • The PR claims to move time-to-intro (~4000 to ~200 frames) and cites a run with 52,820 vs 125 first-chance faults on the title. Those are executable results from the author and @NiiRoZz under a debugger-based launcher. We do not have the title, so we cannot reproduce or confirm them. I report only the fixture side.
  • Timing change: a by-address texture can now appear up to 30 frames later than before. It is documented; whoever verifies on the title should check that it does not hide a texture that was visible before.
  • x2w_xmem_mapped_bytes is a new xmem_shim.def ordinal (@23). Main has moved since (52 commits); the ordinal and the CMakeLists.txt hunk need a fresh conflict check against current main.
  • tests/xmem_mapped_bytes_check.py needs the Windows build tree; I did not run it on Linux.

Commands run locally (worktree on this exact head): git diff --stat origin/main...HEAD, targeted rg and sed reads of the diff, git diff --check origin/main...HEAD (clean), python3 tests/bidi_controls_check.py (PASS). I did not run Win2025 for this PR.

Because the PR claims to advance startup on the real title, the merge decision stays with MasterDomino or @R0Y00, who can verify it on the game. The branch is 52 commits behind main and needs an update first.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6064422099 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#pullrequestreview-6064422099). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T20:23:01Z. **Review:** COMMENTED --- Review of head aa355f63 (comment only, code and fixtures; no merge from this side). Scope: new xmem export `x2w_xmem_mapped_bytes`, `readable_window` in d3d12_xs asks it first, four callers moved onto `readable_window`, a 30-frame retry cache for unmapped by-address textures, and an IID-shape check limited to the first 32 calls per queue slot. Shared runtime plus a main-executable startup path. What I read and found sound: - `x2w_xmem_mapped_bytes` only answers inside a page-mapping reservation. It returns no answer (caller probes as before) for other addresses, a range past its reservation, a range a recorded "commit at address" may cover, and an "unmapped" answer that `VirtualQuery` does not confirm as `MEM_RESERVE`. The fallback is the old behavior, which is the safe direction. - A mapped prefix is still probed with `probe_readable`, so a race between the registry answer and an unmap costs a fault, not a wrong answer. - The `shape_checks` counter in `queue_dynamic` sits inside `template <int N>`, so it is per slot, like `noop_slot` and `device_noop_slot`. This matches the PR text. - Fixtures: `startup_queue_probe_{reserved,xmem}_{warp,hardware}` has a control (reserved address without xmem: at most 32 faults in 200 calls) and the xmem case (0 faults). That is a reasonable regression test plus negative control for the fault count. Open points for the merger: - The PR claims to move time-to-intro (~4000 to ~200 frames) and cites a run with 52,820 vs 125 first-chance faults on the title. Those are executable results from the author and @NiiRoZz under a debugger-based launcher. We do not have the title, so we cannot reproduce or confirm them. I report only the fixture side. - Timing change: a by-address texture can now appear up to 30 frames later than before. It is documented; whoever verifies on the title should check that it does not hide a texture that was visible before. - `x2w_xmem_mapped_bytes` is a new `xmem_shim.def` ordinal (@23). Main has moved since (52 commits); the ordinal and the `CMakeLists.txt` hunk need a fresh conflict check against current main. - `tests/xmem_mapped_bytes_check.py` needs the Windows build tree; I did not run it on Linux. Commands run locally (worktree on this exact head): `git diff --stat origin/main...HEAD`, targeted `rg` and `sed` reads of the diff, `git diff --check origin/main...HEAD` (clean), `python3 tests/bidi_controls_check.py` (PASS). I did not run Win2025 for this PR. Because the PR claims to advance startup on the real title, the merge decision stays with MasterDomino or @R0Y00, who can verify it on the game. The branch is 52 commits behind main and needs an update first. AI-assisted; commands listed were executed locally.
upstream-sync changed title from [PR #2245] startup: stop probing unmapped guest memory from the texture and no-op paths (draft, shared for testing) to [PR #2245] startup: stop probing unmapped guest memory from the texture and no-op paths 2026-11-25 21:00:50 +00:00
R0Y00 commented 2026-11-25 22:37:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T22:37:28Z.

Review: CHANGES_REQUESTED


I rebuilt c0e5f06d in Release and ran six tests for mapped bytes, mapped pages, and reserved/XMem queue probes. All passed on WARP and RTX with zero skips. The new early return in publish_tiled_texture still changes what the caller can see: it applies the frame-based unreadable cache to this path and rejects the new SRV before readable_window can see that pages have since been mapped. A guest can probe an unmapped address, map and populate it, and request the view again in the same frame. Previously the second call reached the actual check. Please retain the registry optimization, but keep the second call's result unchanged (for example, skip the timed negative cache in this path). Add a source-built unmapped → map → publish/readback in one frame with an untouched sentinel for the first call. The older executable reports used different cache/scene conditions. Please keep the timing claim scoped to those reports unless there is a matched run at the final candidate.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6065947764 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#pullrequestreview-6065947764). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T22:37:28Z. **Review:** CHANGES_REQUESTED --- I rebuilt `c0e5f06d` in Release and ran six tests for mapped bytes, mapped pages, and reserved/XMem queue probes. All passed on WARP and RTX with zero skips. The new early return in `publish_tiled_texture` still changes what the caller can see: it applies the frame-based unreadable cache to this path and rejects the new SRV before `readable_window` can see that pages have since been mapped. A guest can probe an unmapped address, map and populate it, and request the view again in the same frame. Previously the second call reached the actual check. Please retain the registry optimization, but keep the second call's result unchanged (for example, skip the timed negative cache in this path). Add a source-built unmapped → map → publish/readback in one frame with an untouched sentinel for the first call. The older executable reports used different cache/scene conditions. Please keep the timing claim scoped to those reports unless there is a matched run at the final candidate.
tedin7 commented 2026-11-27 09:36:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T09:36:35Z.


This PR now conflicts with main. Conflicting files:

  • CMakeLists.txt
  • src/startup_stubs/d3d12_xs_device.cpp

Could you merge main into your branch (a merge commit, no force push needed) and resolve these? Thank you.

AI-assisted; commands listed were executed locally. (git merge-tree origin/main <head>)

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7214882727 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#issuecomment-7214882727). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T09:36:35Z. --- This PR now conflicts with `main`. Conflicting files: - `CMakeLists.txt` - `src/startup_stubs/d3d12_xs_device.cpp` Could you merge `main` into your branch (a merge commit, no force push needed) and resolve these? Thank you. AI-assisted; commands listed were executed locally. (`git merge-tree origin/main <head>`)
pigalot commented 2026-11-28 00:55:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-28T00:55:50Z.


I merged main (b1e92256) into this branch as e95f5377, a plain merge commit with no rebase or force-push. It conflicted with main.

Conflicts, each resolved by keeping both sides:

  • CMakeLists.txt: this branch's xmem_mapped_bytes test and main's xmem_physical_write_owner test, both kept.
  • src/xmem_shim.def: main now uses @23–@27 (x2w_xmem_copy_to_destination … x2w_xmem_alias_counts), so x2w_xmem_mapped_bytes moves to @28. tests/xmem_mapped_bytes_check.py binds it by name.
  • src/xmem_mapped_pages.cpp: main's Run struct for runs is kept, followed by this branch's commits map. This branch doesn't read runs.
  • src/startup_stubs/d3d12_xs_device.cpp: both includes are kept, and main's upload_from_title comes before this branch's xmem_mapped_bytes() lookup and readable_window.
  • src/startup_stubs/d3d12_memory_srv.inl publish_tiled_texture: the size test uses main's x2w_startup::max_published_texture_bytes with this branch's !bytes || address < 0x10000. This branch's recently_unreadable / readable_window test then replaces x2w_local::readable as before.

git diff --check origin/main...HEAD is clean, and the net diff against main is this branch's 8 files.

What I ran on e95f5377. I did a full build in dev and release, then ran

ctest --test-dir out/build/<preset> --no-tests=error -j 8 -E '_hardware$|startup_audio' -R '^(xmem_|startup_queue_probe_|startup_address_|startup_memory_srv|startup_single_element_srv|startup_placed_buffer|startup_compute_dispatch_input|startup_tiled)'
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^startup_(queue_probe_.*|address_.*|single_element_srv.*|placed_buffer.*)_hardware$'
  • Release: 107 of 110 pass and 15 of 15 hardware tests pass. xmem_placeholder_split_{control,deployed,partial} return 77 (capability skip) in both presets.
  • Dev: the same, except startup_address_console_{warp,hardware} hit their 180 s timeout under load. Rerun alone, they pass in 32 s and 43 s.

This merge doesn't address R0Y00's earlier changes request on c0e5f06d, which still needs an answer from you. A different reviewer will re-review the merged head.

Environment: AMD Ryzen 7 9800X3D, NVIDIA GeForce RTX 5090 driver 32.0.16.1088, WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7231295469 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#issuecomment-7231295469). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T00:55:50Z. --- I merged `main` (`b1e92256`) into this branch as `e95f5377`, a plain merge commit with no rebase or force-push. It conflicted with `main`. **Conflicts, each resolved by keeping both sides:** - `CMakeLists.txt`: this branch's `xmem_mapped_bytes` test and `main`'s `xmem_physical_write_owner` test, both kept. - `src/xmem_shim.def`: `main` now uses @23–@27 (`x2w_xmem_copy_to_destination` … `x2w_xmem_alias_counts`), so `x2w_xmem_mapped_bytes` moves to **@28**. `tests/xmem_mapped_bytes_check.py` binds it by name. - `src/xmem_mapped_pages.cpp`: `main`'s `Run` struct for `runs` is kept, followed by this branch's `commits` map. This branch doesn't read `runs`. - `src/startup_stubs/d3d12_xs_device.cpp`: both includes are kept, and `main`'s `upload_from_title` comes before this branch's `xmem_mapped_bytes()` lookup and `readable_window`. - `src/startup_stubs/d3d12_memory_srv.inl` `publish_tiled_texture`: the size test uses `main`'s `x2w_startup::max_published_texture_bytes` with this branch's `!bytes || address < 0x10000`. This branch's `recently_unreadable` / `readable_window` test then replaces `x2w_local::readable` as before. `git diff --check origin/main...HEAD` is clean, and the net diff against `main` is this branch's 8 files. **What I ran on `e95f5377`.** I did a full build in `dev` and `release`, then ran ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 8 -E '_hardware$|startup_audio' -R '^(xmem_|startup_queue_probe_|startup_address_|startup_memory_srv|startup_single_element_srv|startup_placed_buffer|startup_compute_dispatch_input|startup_tiled)' ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^startup_(queue_probe_.*|address_.*|single_element_srv.*|placed_buffer.*)_hardware$' ``` - **Release:** 107 of 110 pass and 15 of 15 hardware tests pass. `xmem_placeholder_split_{control,deployed,partial}` return 77 (capability skip) in both presets. - **Dev:** the same, except `startup_address_console_{warp,hardware}` hit their 180 s timeout under load. Rerun alone, they pass in 32 s and 43 s. This merge doesn't address R0Y00's earlier changes request on `c0e5f06d`, which still needs an answer from you. A different reviewer will re-review the merged head. Environment: AMD Ryzen 7 9800X3D, NVIDIA GeForce RTX 5090 driver 32.0.16.1088, WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. This reply was AI-assisted.
JohnConnorNPC commented 2026-11-28 08:05:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T08:05:55Z.


Thanks for keeping this branch current. I reviewed head e95f5377 against current main (1f07b2c1); git merge-tree --write-tree 1f07b2c1 e95f5377 exits 0. The only commit since R0Y00's changes request on c0e5f06d is the merge of main, so that request is still open:

  1. The same-frame case is still refused. publish_tiled_texture still runs if (recently_unreadable(address)) { InterlockedIncrement(&address_probe_skipped); return nullptr; } before readable_window, and nothing in that path lets a later mapping through. A guest that probes an unmapped address, maps it and asks for the view again within 30 frames gets nullptr; before this PR that second call reached the real check. Skipping the timed cache in this path, as R0Y00 suggested, or consulting it only when xmem's registry has no answer, would keep the registry saving without changing the result.
  2. The requested source-built test is missing: unmapped → map → publish/readback in one frame, with an untouched sentinel on the first call. git grep -c recently_unreadable e95f5377 -- tests/ finds nothing.

Also worth fixing:

  • Nothing tests the 30-frame cache in publish_tiled_texture or upload_texture: git grep -cE 'unreadable_retry_frames|address_probe_skipped' e95f5377 -- tests/ finds nothing, and neither new test calls those paths. From reading the code, unreadable_retry_frames = 0 or dropping !announced in upload_texture would leave every test green.
  • The commit-at-address exclusion in x2w_xmem_mapped_bytes (the memory.commits overlap check that returns FALSE) is unpinned. xmem_mapped_bytes_check.py defines WIN_COMMIT but never uses it; its only allocation is virtual_alloc(None, 4 * PAGE_BYTES, WIN_RESERVE, 0, NOACCESS).
  • The body still opens the timing note with "By my testing it takes the time to the intro from ~4000 frames to ~200 frames". As R0Y00 asked, please scope it to the earlier reports (a different local build, not measured on this head) unless there is a matched run on the final candidate.
  • CI is green, but its ctest --preset pr step ran 69 tests and none of the new ones (grep -cE 'xmem_mapped_bytes|startup_queue_probe' on the Windows job log → 0), so the new tests rest on local Windows runs.
  • Hygiene: merge commit e95f5377 has a non-noreply author email, and c0e5f06d carries a Claude-Session: trailer. A squash merge would keep both out of main's history.

Environment: Linux, static review of git objects, git merge-tree and the CI job log. I did no build, WARP or GPU run.

This comment was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7236361365 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#issuecomment-7236361365). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-28T08:05:55Z. --- Thanks for keeping this branch current. I reviewed head `e95f5377` against current `main` (`1f07b2c1`); `git merge-tree --write-tree 1f07b2c1 e95f5377` exits 0. The only commit since R0Y00's changes request on `c0e5f06d` is the merge of `main`, so that request is still open: 1. **The same-frame case is still refused.** `publish_tiled_texture` still runs `if (recently_unreadable(address)) { InterlockedIncrement(&address_probe_skipped); return nullptr; }` before `readable_window`, and nothing in that path lets a later mapping through. A guest that probes an unmapped address, maps it and asks for the view again within 30 frames gets `nullptr`; before this PR that second call reached the real check. Skipping the timed cache in this path, as R0Y00 suggested, or consulting it only when xmem's registry has no answer, would keep the registry saving without changing the result. 2. **The requested source-built test is missing:** unmapped → map → publish/readback in one frame, with an untouched sentinel on the first call. `git grep -c recently_unreadable e95f5377 -- tests/` finds nothing. Also worth fixing: - Nothing tests the 30-frame cache in `publish_tiled_texture` or `upload_texture`: `git grep -cE 'unreadable_retry_frames|address_probe_skipped' e95f5377 -- tests/` finds nothing, and neither new test calls those paths. From reading the code, `unreadable_retry_frames = 0` or dropping `!announced` in `upload_texture` would leave every test green. - The commit-at-address exclusion in `x2w_xmem_mapped_bytes` (the `memory.commits` overlap check that returns `FALSE`) is unpinned. `xmem_mapped_bytes_check.py` defines `WIN_COMMIT` but never uses it; its only allocation is `virtual_alloc(None, 4 * PAGE_BYTES, WIN_RESERVE, 0, NOACCESS)`. - The body still opens the timing note with "By my testing it takes the time to the intro from ~4000 frames to ~200 frames". As R0Y00 asked, please scope it to the earlier reports (a different local build, not measured on this head) unless there is a matched run on the final candidate. - CI is green, but its `ctest --preset pr` step ran 69 tests and none of the new ones (`grep -cE 'xmem_mapped_bytes|startup_queue_probe'` on the Windows job log → `0`), so the new tests rest on local Windows runs. - Hygiene: merge commit `e95f5377` has a non-noreply author email, and `c0e5f06d` carries a `Claude-Session:` trailer. A squash merge would keep both out of `main`'s history. Environment: Linux, static review of git objects, `git merge-tree` and the CI job log. I did no build, WARP or GPU run. This comment was AI-assisted.
JohnConnorNPC commented 2026-11-29 13:05:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T13:05:09Z.


The head is still e95f5377, as it was for my comment of 2026-11-28, so that comment and R0Y00's change request both still apply.

One new point: the branch no longer merges into main. Against af1cab5c, git merge-tree --write-tree origin/main e95f5377 conflicts in src/startup_stubs/d3d12_xs_device.cpp only. In the 5-second report, main added the x2w-d3d12 view content tokens: block (#3377) where this PR adds its x2w-d3d12 readability: line. Keeping both resolves it. Please rebase when you push the requested change.

MUST / SHOULD / NIT
None new. The items in my earlier comment are unchanged.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7256277649 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#issuecomment-7256277649). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-29T13:05:09Z. --- The head is still `e95f5377`, as it was for my comment of 2026-11-28, so that comment and R0Y00's change request both still apply. One new point: the branch no longer merges into main. Against `af1cab5c`, `git merge-tree --write-tree origin/main e95f5377` conflicts in `src/startup_stubs/d3d12_xs_device.cpp` only. In the 5-second report, main added the `x2w-d3d12 view content tokens:` block (#3377) where this PR adds its `x2w-d3d12 readability:` line. Keeping both resolves it. Please rebase when you push the requested change. **MUST / SHOULD / NIT** None new. The items in my earlier comment are unchanged. AI-assisted.
Leyukaka commented 2026-12-01 16:14:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T16:14:54Z.


Taking this over since there has been no activity for 48 h; will hand back if you resume. Your commits stay as they are and keep your authorship; I will rebase onto current main, address the open review points and report the test results here.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7317283379 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#issuecomment-7317283379). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-01T16:14:54Z. --- Taking this over since there has been no activity for 48 h; will hand back if you resume. Your commits stay as they are and keep your authorship; I will rebase onto current `main`, address the open review points and report the test results here.
Leyukaka commented 2026-12-01 17:42:32 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T17:42:32Z.


Continued in #3767 (rebased onto main, review points addressed, local test results in the description). Your commits are kept with your authorship; if you resume, say so there and I will hand it back.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7319725486 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2245#issuecomment-7319725486). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-01T17:42:32Z. --- Continued in #3767 (rebased onto `main`, review points addressed, local test results in the description). Your commits are kept with your authorship; if you resume, say so there and I will hand it back.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2245:upstream-pr/2245'
git switch 'upstream-pr/2245'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2245'
git switch 'upstream-pr/2245'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2245'
git switch 'upstream-pr/2245'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2245'
git switch 'main'
git merge --squash 'upstream-pr/2245'
git switch 'main'
git merge --ff-only 'upstream-pr/2245'
git switch 'main'
git merge 'upstream-pr/2245'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2237
No description provided.