startup: opt-in guarded write of the view token in note_view #3097

Closed
lukaslw-lab wants to merge 8 commits from upstream-pr/3097 into main
lukaslw-lab commented 2026-11-27 15:03:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-27T15:03:51Z.


Change

Fixes #3096 (every view call asks VirtualQuery and xmem's commit mutex before writing its token).

X2W_D3D12_VIEW_TOKEN_GUARDED=1 (opt-in): note_view writes the view token into the title's descriptor memory under an exception guard (write_view_token) instead of after commit_lazy and a VirtualQuery (x2w_local::writable). Unset, the check and the write are as on main.

  • Same outcome for every page: a lazily committed page is committed by xmem's vectored handler on the first touch, as for any other write. A page that refuses the write (no access, read-only, a guard page, an in-page error) leaves the descriptor without a token, as writable returning false did. A guard page has its guard bit set again, as probe_readable does.
  • Only the token write changes; the view record, the shadow slot and the view references are untouched.
  • Why the destination does not fault in practice: it is always inside a registered descriptor range (title_backed is checked first). So this does not go against #2845, which asks to query first for reads of stale pointers, where faults are common.
  • Fixture export x2w_d3d12_view_token_writes(written, refused), and with the switch set a line before the render totals: x2w-render view tokens (X2W_D3D12_VIEW_TOKEN_GUARDED): written N, refused M.
  • Why opt-in: it changes how a view call meets a page it cannot write (an exception instead of a query). Same reasoning as #2949, #2977 and #3028.
  • Docs: switch row in docs/startup-runtime.md; docs/experiments/startup-view-token-guarded.md.
  • Overlap (trial merges against main ca659396): no new conflict with cpp-migration or with any of the open PRs that touch these files.

Verification

Windows 10 22H2, i7-4790K, RTX 3080 Ti (NVIDIA 32.0.16.1047) and WARP; dev and release; commit cff24b08 (main ca659396 merged).

ctest --preset <dev|release> --no-tests=error -j 1 -R '^startup_view_token_' -V
ctest --preset <dev|release> --no-tests=error -j 1 -R '^(startup_view_alloc_.*|startup_resource_retire_.*|startup_descriptor_.*|startup_address_.*|startup_stream_draw.*|startup_table_alias_.*|startup_sampler_heap.*|startup_copied_vertex_srv_.*|startup_root_.*|startup_memory_srv.*|startup_formatted_view.*|startup_logical_view.*|startup_1d_srv.*|startup_single_element.*|startup_slot133_lazy.*)$'
  • New startup_view_token_{unset,set}_{warp,hardware}: 4/4 per preset. Three descriptor heaps over title memory the fixture owns, protected after creation (writable, read-only, guard page). In both modes the writable heap holds both tokens, the read-only heap stays zero, and the guard page keeps its guard bit and stays zero. The export reports unset 0, 0, set 2, 2.
    • Negative controls (local mutations): ignoring the switch fails the guarded path did not write 2 tokens and refuse 2; not setting the guard bit again fails the guard page lost its guard bit.
  • Affected families, switch unset and set: 115/115 with the switch unset and set per preset; capability skips startup_logical_view_warp and startup_root_heap_{warp,hardware} (no debug layer), the same in every run.

Startup run of the main executable (#870), release on main 36d2cbeb, warm shader cache, scripted input, 250 s, the three merged switches in every run, two pairs (second in reverse order):

150–240 s switch unset switch set
mean fps, pair 1 / pair 2 15.5 / 15.1 16.6 / 15.6
time in view calls (threads); µs per call 1.19 / 1.20; 10.4 / 11.2 0.88 / 0.92; 7.0 / 6.7
view calls per second 114k / 107k 126k / 136k
null bindings buffer; device removal 0; none 0; none
null bindings token per 1,000 translated draws 25.7 / 23.5 33.6 / 30.1

A confirmation run with the switch set logged written 16447410, refused 0: the guard refused no write, so the tokens are the ones the default path writes. The token null bindings scale with the draws recorded; runs without this change gave 23–34 per 1,000 translated draws on this machine. Not covered: other adapters, hosts with more cores, Wine.

AI-assisted: the change, tests and this description were written with Claude; I ran the startup comparison.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5528797965 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-27T15:03:51Z. --- ## Change Fixes #3096 (every view call asks `VirtualQuery` and xmem's commit mutex before writing its token). `X2W_D3D12_VIEW_TOKEN_GUARDED=1` (opt-in): `note_view` writes the view token into the title's descriptor memory under an exception guard (`write_view_token`) instead of after `commit_lazy` and a `VirtualQuery` (`x2w_local::writable`). Unset, the check and the write are as on `main`. - Same outcome for every page: a lazily committed page is committed by xmem's vectored handler on the first touch, as for any other write. A page that refuses the write (no access, read-only, a guard page, an in-page error) leaves the descriptor without a token, as `writable` returning false did. A guard page has its guard bit set again, as `probe_readable` does. - Only the token write changes; the view record, the shadow slot and the view references are untouched. - Why the destination does not fault in practice: it is always inside a registered descriptor range (`title_backed` is checked first). So this does not go against #2845, which asks to query first for reads of stale pointers, where faults are common. - Fixture export `x2w_d3d12_view_token_writes(written, refused)`, and with the switch set a line before the render totals: `x2w-render view tokens (X2W_D3D12_VIEW_TOKEN_GUARDED): written N, refused M`. - Why opt-in: it changes how a view call meets a page it cannot write (an exception instead of a query). Same reasoning as #2949, #2977 and #3028. - Docs: switch row in `docs/startup-runtime.md`; `docs/experiments/startup-view-token-guarded.md`. - Overlap (trial merges against `main` `ca659396`): no new conflict with `cpp-migration` or with any of the open PRs that touch these files. ## Verification Windows 10 22H2, i7-4790K, RTX 3080 Ti (NVIDIA 32.0.16.1047) and WARP; dev and release; commit `cff24b08` (`main` `ca659396` merged). ``` ctest --preset <dev|release> --no-tests=error -j 1 -R '^startup_view_token_' -V ctest --preset <dev|release> --no-tests=error -j 1 -R '^(startup_view_alloc_.*|startup_resource_retire_.*|startup_descriptor_.*|startup_address_.*|startup_stream_draw.*|startup_table_alias_.*|startup_sampler_heap.*|startup_copied_vertex_srv_.*|startup_root_.*|startup_memory_srv.*|startup_formatted_view.*|startup_logical_view.*|startup_1d_srv.*|startup_single_element.*|startup_slot133_lazy.*)$' ``` - New `startup_view_token_{unset,set}_{warp,hardware}`: 4/4 per preset. Three descriptor heaps over title memory the fixture owns, protected after creation (writable, read-only, guard page). In both modes the writable heap holds both tokens, the read-only heap stays zero, and the guard page keeps its guard bit and stays zero. The export reports unset `0, 0`, set `2, 2`. - Negative controls (local mutations): ignoring the switch fails `the guarded path did not write 2 tokens and refuse 2`; not setting the guard bit again fails `the guard page lost its guard bit`. - Affected families, switch unset and set: 115/115 with the switch unset and set per preset; capability skips `startup_logical_view_warp` and `startup_root_heap_{warp,hardware}` (no debug layer), the same in every run. Startup run of the main executable (#870), release on `main` `36d2cbeb`, warm shader cache, scripted input, 250 s, the three merged switches in every run, two pairs (second in reverse order): | 150–240 s | switch unset | switch set | |---|---|---| | mean fps, pair 1 / pair 2 | 15.5 / 15.1 | 16.6 / 15.6 | | time in view calls (threads); µs per call | 1.19 / 1.20; 10.4 / 11.2 | 0.88 / 0.92; 7.0 / 6.7 | | view calls per second | 114k / 107k | 126k / 136k | | null bindings `buffer`; device removal | 0; none | 0; none | | null bindings `token` per 1,000 translated draws | 25.7 / 23.5 | 33.6 / 30.1 | A confirmation run with the switch set logged `written 16447410, refused 0`: the guard refused no write, so the tokens are the ones the default path writes. The `token` null bindings scale with the draws recorded; runs without this change gave 23–34 per 1,000 translated draws on this machine. Not covered: other adapters, hosts with more cores, Wine. AI-assisted: the change, tests and this description were written with Claude; I ran the startup comparison. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
R0Y00 commented 2026-11-27 15:23:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T15:23:40Z.

Review: CHANGES_REQUESTED


The guarded path changes page protections and can write a partial token when a 32-byte descriptor spans a page boundary. The registered-range check only bounds the span, and device_heap accepts caller-supplied backing without an alignment check. A handle at the first descriptor of such a heap can therefore cross a page even when its offset inside the heap is aligned.

I compiled the exact write_view_token from cff24b08 in a source-built x64 probe with two committed pages, placing the destination 16 bytes before the boundary. With the right page PAGE_READWRITE | PAGE_GUARD, the helper returned false but set PAGE_GUARD on both pages. With the right page PAGE_READONLY, it returned false after changing the writable prefix. Both happened under /Od and /O2. The original writable range check refused that span before writing. Please route page-crossing tokens through the existing full-span check and add a caller-backed boundary fixture that verifies the writable prefix and both page protections stay unchanged on refusal.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6090305381 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#pullrequestreview-6090305381). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T15:23:40Z. **Review:** CHANGES_REQUESTED --- The guarded path changes page protections and can write a partial token when a 32-byte descriptor spans a page boundary. The registered-range check only bounds the span, and `device_heap` accepts caller-supplied backing without an alignment check. A handle at the first descriptor of such a heap can therefore cross a page even when its offset inside the heap is aligned. I compiled the exact `write_view_token` from `cff24b08` in a source-built x64 probe with two committed pages, placing the destination 16 bytes before the boundary. With the right page `PAGE_READWRITE | PAGE_GUARD`, the helper returned false but set `PAGE_GUARD` on both pages. With the right page `PAGE_READONLY`, it returned false after changing the writable prefix. Both happened under `/Od` and `/O2`. The original `writable` range check refused that span before writing. Please route page-crossing tokens through the existing full-span check and add a caller-backed boundary fixture that verifies the writable prefix and both page protections stay unchanged on refusal.
lukaslw-lab commented 2026-11-27 16:01:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-27T16:01:20Z.


Thanks, confirmed. The fixture had only page-aligned heaps, so it never produced a token that crosses a page.

Fixed in 69befbc8: only a token that lies inside one 4 KiB page takes the guarded write (view_token_in_one_page
in note_view). A token that crosses a page boundary keeps the full-span writable() check, with or without the
switch. Inside one page, a refusal comes on the first byte, so nothing is written and the guard re-arm touches only
that page.

startup_view_token now has two more caller-backed heaps whose base is 16 bytes before a page boundary. The right
page is PAGE_READONLY in one and PAGE_READWRITE | PAGE_GUARD in the other. A slot 18 SRV goes into descriptor 0 of
each. In both modes the 16-byte writable prefix keeps its sentinel bytes, the left page stays PAGE_READWRITE, the
right page keeps its protection, and the right page stays zero.

check (release + dev, WARP + hardware) result
^startup_view_token_ 4/4 per preset
mutant: guard crossing tokens too (old condition) set_warp + set_hardware fail: a crossing heap's writable prefix changed (read-only right page); left page 0x104 = PAGE_READWRITE | PAGE_GUARD (guard right page); unset passes
view-token matrix (same list as before) 115/115 per arm (switch off / on × release / dev); skips startup_logical_view_warp, startup_root_heap_{warp,hardware} as before
  • The guarded counters stay at 2, 2 in set mode, so the crossing tokens did not go through the guard.
  • The startup numbers in the PR were not re-run. A heap whose base is aligned to its stride never gives a crossing
    token, because 4096 is a multiple of 32 and of 16.

Host: Windows 10 22H2 (19045), RTX 3080 Ti, NVIDIA 32.0.16.1047, and WARP.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7222761208 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#issuecomment-7222761208). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-27T16:01:20Z. --- Thanks, confirmed. The fixture had only page-aligned heaps, so it never produced a token that crosses a page. Fixed in `69befbc8`: only a token that lies inside one 4 KiB page takes the guarded write (`view_token_in_one_page` in `note_view`). A token that crosses a page boundary keeps the full-span `writable()` check, with or without the switch. Inside one page, a refusal comes on the first byte, so nothing is written and the guard re-arm touches only that page. `startup_view_token` now has two more caller-backed heaps whose base is 16 bytes before a page boundary. The right page is `PAGE_READONLY` in one and `PAGE_READWRITE | PAGE_GUARD` in the other. A slot 18 SRV goes into descriptor 0 of each. In both modes the 16-byte writable prefix keeps its sentinel bytes, the left page stays `PAGE_READWRITE`, the right page keeps its protection, and the right page stays zero. | check (release + dev, WARP + hardware) | result | |---|---| | `^startup_view_token_` | 4/4 per preset | | mutant: guard crossing tokens too (old condition) | `set_warp` + `set_hardware` fail: `a crossing heap's writable prefix changed` (read-only right page); left page `0x104` = `PAGE_READWRITE \| PAGE_GUARD` (guard right page); `unset` passes | | view-token matrix (same list as before) | 115/115 per arm (switch off / on × release / dev); skips `startup_logical_view_warp`, `startup_root_heap_{warp,hardware}` as before | - The guarded counters stay at `2, 2` in `set` mode, so the crossing tokens did not go through the guard. - The startup numbers in the PR were not re-run. A heap whose base is aligned to its stride never gives a crossing token, because 4096 is a multiple of 32 and of 16. Host: Windows 10 22H2 (19045), RTX 3080 Ti, NVIDIA 32.0.16.1047, and WARP.
pigalot commented 2026-11-27 23:03:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T23:03:58Z.

Review: APPROVED


Independently reviewed 69befbc8 integrated over main 4b0350ea (tree 490df414). The merge is clean and git diff --cached --check origin/main is clean.

R0Y00's page-crossing finding (changes requested on cff24b08). Addressed. note_view now takes the guarded write only when view_token_in_one_page(dest_title, token_bytes) holds. A crossing token keeps the full-span writable() check with or without the switch. Inside one page every byte shares one protection, so a refused write faults before any byte lands. The guard re-arm then touches only that page. startup_view_token adds the two caller-backed heaps whose base is 16 bytes before a page boundary, with the right page PAGE_READONLY in one and PAGE_READWRITE | PAGE_GUARD in the other. The test checks the writable prefix, both protections and the right page's contents.

What I traced. A guard page clears its guard bit on the first touch, so info.Protect in the handler is the base protection, and | PAGE_GUARD restores the original. xmem's vectored handler runs before the __except filter, so a lazily committed page is committed on the first touch as the description says. Without xmem, a reserved page faults and is refused, as commit_lazy plus writable() refuses it on main.

What I ran. I built startup_view_token startup_descriptor_heap_type_check startup_descriptor_increment startup_logical_view_table_check startup_single_element_srv_check startup_view_alloc d3d12_xs_shim startup_stream_consumer offscreen_check in dev and release, then ran:

ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_view_token_'
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_view_alloc_.*|startup_descriptor_.*|startup_table_alias_.*|startup_copied_vertex_srv_.*|startup_formatted_view.*|startup_logical_view.*|startup_single_element.*)$'

I ran the second command once with X2W_D3D12_VIEW_TOKEN_GUARDED unset and once with it set to 1.

  • startup_view_token_{unset,set}_{warp,hardware}: 4/4 per preset, on WARP and on the RTX 5090. Unset reports written 0, refused 0 and set reports written 2, refused 2. The PASS line includes "crossing tokens refused without a write or a protection change".
  • Neighbours: 28 tests in each of the four arms (switch unset and set, Debug and Release /O2). 27 pass, and startup_logical_view_warp reports a capability skip (77) in every arm, as in the description.
  • The test is new, so it is not registered on main.

Mutants in src/startup_stubs/d3d12_capture.inl. Each was applied alone, d3d12_xs_shim startup_view_token rebuilt in dev, startup_view_token_{set,unset}_warp run, and the source restored afterwards (git diff --quiet clean).

Mutant Result
crossing tokens take the guarded write too (the cff24b08 condition) killed: a crossing heap's writable prefix changed
guard bit not set again killed: the guard page lost its guard bit
EXCEPTION_ACCESS_VIOLATION dropped from the filter killed: Exception: SegFault
token not copied killed: the writable heap's first descriptor holds no slot 18 token
view_token_in_one_page tests dest + bytes instead of dest + bytes - 1 survives, equivalent in outcome: a token that ends exactly at a page end takes the full-span check instead of the guarded write

Verdict: approve on 69befbc8. R0Y00's changes request on cff24b08 still stands, so I am not merging.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029; the debug layer is off (X2W_D3D12_DEBUG=0 in the fixture).
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 69befbc8.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6094138749 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#pullrequestreview-6094138749). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T23:03:58Z. **Review:** APPROVED --- Independently reviewed `69befbc8` integrated over `main` `4b0350ea` (tree `490df414`). The merge is clean and `git diff --cached --check origin/main` is clean. **R0Y00's page-crossing finding (changes requested on `cff24b08`).** Addressed. `note_view` now takes the guarded write only when `view_token_in_one_page(dest_title, token_bytes)` holds. A crossing token keeps the full-span `writable()` check with or without the switch. Inside one page every byte shares one protection, so a refused write faults before any byte lands. The guard re-arm then touches only that page. `startup_view_token` adds the two caller-backed heaps whose base is 16 bytes before a page boundary, with the right page `PAGE_READONLY` in one and `PAGE_READWRITE | PAGE_GUARD` in the other. The test checks the writable prefix, both protections and the right page's contents. **What I traced.** A guard page clears its guard bit on the first touch, so `info.Protect` in the handler is the base protection, and `| PAGE_GUARD` restores the original. xmem's vectored handler runs before the `__except` filter, so a lazily committed page is committed on the first touch as the description says. Without xmem, a reserved page faults and is refused, as `commit_lazy` plus `writable()` refuses it on `main`. **What I ran.** I built `startup_view_token startup_descriptor_heap_type_check startup_descriptor_increment startup_logical_view_table_check startup_single_element_srv_check startup_view_alloc d3d12_xs_shim startup_stream_consumer offscreen_check` in `dev` and `release`, then ran: ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_view_token_' ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_view_alloc_.*|startup_descriptor_.*|startup_table_alias_.*|startup_copied_vertex_srv_.*|startup_formatted_view.*|startup_logical_view.*|startup_single_element.*)$' ``` I ran the second command once with `X2W_D3D12_VIEW_TOKEN_GUARDED` unset and once with it set to `1`. - `startup_view_token_{unset,set}_{warp,hardware}`: 4/4 per preset, on WARP and on the RTX 5090. Unset reports `written 0, refused 0` and set reports `written 2, refused 2`. The PASS line includes "crossing tokens refused without a write or a protection change". - Neighbours: 28 tests in each of the four arms (switch unset and set, Debug and Release `/O2`). 27 pass, and `startup_logical_view_warp` reports a capability skip (77) in every arm, as in the description. - The test is new, so it is not registered on `main`. **Mutants** in `src/startup_stubs/d3d12_capture.inl`. Each was applied alone, `d3d12_xs_shim startup_view_token` rebuilt in `dev`, `startup_view_token_{set,unset}_warp` run, and the source restored afterwards (`git diff --quiet` clean). | Mutant | Result | |---|---| | crossing tokens take the guarded write too (the `cff24b08` condition) | killed: `a crossing heap's writable prefix changed` | | guard bit not set again | killed: `the guard page lost its guard bit` | | `EXCEPTION_ACCESS_VIOLATION` dropped from the filter | killed: `Exception: SegFault` | | token not copied | killed: `the writable heap's first descriptor holds no slot 18 token` | | `view_token_in_one_page` tests `dest + bytes` instead of `dest + bytes - 1` | survives, equivalent in outcome: a token that ends exactly at a page end takes the full-span check instead of the guarded write | **Verdict:** approve on `69befbc8`. R0Y00's changes request on `cff24b08` still stands, so I am not merging. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP 10.0.26100.9818, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029; the debug layer is off (`X2W_D3D12_DEBUG=0` in the fixture). CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `69befbc8`. This reply was AI-assisted.
JohnConnorNPC commented 2026-11-28 07:58:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-28T07:58:01Z.


Thanks for the update. I did a static review of head 69befbc8, and it looks ready from our side, pending R0Y00's re-review. R0Y00's changes-requested review (on cff24b08) still stands, so R0Y00 needs to re-review or dismiss it before this can merge. Both requested changes are on the head: crossing tokens take the full-span check again (if (view_token_guarded() && view_token_in_one_page(dest_title, token_bytes)), otherwise writable() and then memcpy), and the caller-backed boundary fixture is in place.

  • Merge: git merge-tree --write-tree origin/main <head> against main c3204a9c is clean (tree 5d2093f4). With the switch unset, note_view keeps main's title_backed → writable → memcpy path.
  • view_token_in_one_page against a page-relative reference model (4 page bases including the top of the 64-bit space, sizes 0–64): cases=152064 mismatches=0.
  • CI: gh pr checks 3097 shows Windows, gfx1013 and Linux pass. ctest --preset pr ran 100% tests passed out of 41, but the pr name filter matches none of the 4 startup_view_token_{unset,set}_{warp,hardware} tests, so CI has not run the new fixture yet.
  • On the merged tree, docs_links_check (Checked 149 Markdown files and 672 links.) and bidi_controls_check both pass. The docs/startup-runtime.md row links the new page.

SHOULD

  1. Nothing tests the "guard bit set again, on that page only" part. The fixture reads only VirtualQuery(memory[guard]) and all_zero(memory[guard], …). A re-arm over info.BaseAddress, info.RegionSize would guard the whole merged 16-page read-write region and still pass every expect (static analysis, not run). An expect that the page after the guard page stays PAGE_READWRITE would cover it.
  2. No fixture covers the lazy-commit sentence ("committed by xmem's vectored handler on the first touch"): the test allocates with MEM_RESERVE | MEM_COMMIT and loads no xmem.dll. Either add a reserved-page case under xmem, or say in the doc that only the startup run measured this.

NIT

  1. The new export sits between the // Fixture probe (startup_view_alloc) comment and struct ViewStoreProbe, so that comment now sits above x2w_d3d12_view_token_writes.
  2. refused 0 shows only that the guard refused nothing, not that "the tokens written match the default path". token nulls per 1,000 draws were also higher with the switch (33.6 / 30.1 vs 25.7 / 23.5), which "scale with the draws recorded" does not explain.
  3. Between the kernel clearing the guard bit and the VirtualProtect re-arm, another thread's write to that page succeeds where writable() would refuse it. With refused 0 this doesn't matter in practice, but "as writable returning false did" doesn't hold under concurrency.

Not run: no build, Wine or GPU. This covers static review, the trial merge, the model and the pure-Python docs checks only.

This comment was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7236274777 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#issuecomment-7236274777). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-28T07:58:01Z. --- Thanks for the update. I did a static review of head 69befbc8, and it looks ready from our side, pending R0Y00's re-review. R0Y00's changes-requested review (on cff24b08) still stands, so R0Y00 needs to re-review or dismiss it before this can merge. Both requested changes are on the head: crossing tokens take the full-span check again (`if (view_token_guarded() && view_token_in_one_page(dest_title, token_bytes))`, otherwise `writable()` and then memcpy), and the caller-backed boundary fixture is in place. - Merge: `git merge-tree --write-tree origin/main <head>` against main c3204a9c is clean (tree 5d2093f4). With the switch unset, `note_view` keeps main's `title_backed` → `writable` → memcpy path. - `view_token_in_one_page` against a page-relative reference model (4 page bases including the top of the 64-bit space, sizes 0–64): `cases=152064 mismatches=0`. - CI: `gh pr checks 3097` shows Windows, gfx1013 and Linux `pass`. `ctest --preset pr` ran `100% tests passed out of 41`, but the `pr` name filter matches none of the 4 `startup_view_token_{unset,set}_{warp,hardware}` tests, so CI has not run the new fixture yet. - On the merged tree, `docs_links_check` (`Checked 149 Markdown files and 672 links.`) and `bidi_controls_check` both pass. The docs/startup-runtime.md row links the new page. #### SHOULD 1. Nothing tests the "guard bit set again, on that page only" part. The fixture reads only `VirtualQuery(memory[guard])` and `all_zero(memory[guard], …)`. A re-arm over `info.BaseAddress, info.RegionSize` would guard the whole merged 16-page read-write region and still pass every expect (static analysis, not run). An expect that the page after the guard page stays `PAGE_READWRITE` would cover it. 2. No fixture covers the lazy-commit sentence ("committed by xmem's vectored handler on the first touch"): the test allocates with `MEM_RESERVE | MEM_COMMIT` and loads no xmem.dll. Either add a reserved-page case under xmem, or say in the doc that only the startup run measured this. #### NIT 3. The new export sits between the `// Fixture probe (startup_view_alloc)` comment and `struct ViewStoreProbe`, so that comment now sits above `x2w_d3d12_view_token_writes`. 4. `refused 0` shows only that the guard refused nothing, not that "the tokens written match the default path". `token` nulls per 1,000 draws were also higher with the switch (33.6 / 30.1 vs 25.7 / 23.5), which "scale with the draws recorded" does not explain. 5. Between the kernel clearing the guard bit and the `VirtualProtect` re-arm, another thread's write to that page succeeds where `writable()` would refuse it. With `refused 0` this doesn't matter in practice, but "as `writable` returning false did" doesn't hold under concurrency. Not run: no build, Wine or GPU. This covers static review, the trial merge, the model and the pure-Python docs checks only. This comment was AI-assisted.
lukaslw-lab commented 2026-11-28 08:44:28 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-28T08:44:28Z.


Thanks, @JohnConnorNPC. All five are in 88c171b1 (with a merge of main 1f07b2c1):

# Change
1 The fixture now requires the page after the guard page to stay PAGE_READWRITE. Your mutant (re-arm over info.BaseAddress, info.RegionSize) fails set_warp and set_hardware with the page after the guard page changed its protection; added to the note's mutant list.
2 The note says only the startup runs exercise lazy commit; the fixture commits up front and loads no xmem.dll.
3 The export moved above the startup_view_alloc comment, which sits on ViewStoreProbe again.
4 Reworded: refused 0 shows no token was lost to a refusal, not that every token matches the default path. The token nulls are given as within the 23–34 spread of runs without the change, but not explained.
5 Caveat added to the note and to the comment on write_view_token: between the guard fault and the re-arm, another thread's write goes through where writable() would refuse.
  • ^startup_view_token_ 4/4 in dev and release; view-token matrix 121/121 in each of release and dev, switch off and on (3 skips as before: startup_logical_view_warp, startup_root_heap_{warp,hardware}).
  • On CI: right, the pr preset's filter doesn't include startup_view_token_*, so the fixture has only run locally (RTX 3080 Ti + WARP). Happy to add it to the preset if you want it there.

AI-assisted (Claude); I ran the tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7236779254 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#issuecomment-7236779254). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-28T08:44:28Z. --- Thanks, @JohnConnorNPC. All five are in `88c171b1` (with a merge of `main` `1f07b2c1`): | # | Change | |---|---| | 1 | The fixture now requires the page after the guard page to stay `PAGE_READWRITE`. Your mutant (re-arm over `info.BaseAddress`, `info.RegionSize`) fails `set_warp` and `set_hardware` with `the page after the guard page changed its protection`; added to the note's mutant list. | | 2 | The note says only the startup runs exercise lazy commit; the fixture commits up front and loads no xmem.dll. | | 3 | The export moved above the `startup_view_alloc` comment, which sits on `ViewStoreProbe` again. | | 4 | Reworded: `refused 0` shows no token was lost to a refusal, not that every token matches the default path. The `token` nulls are given as within the 23–34 spread of runs without the change, but not explained. | | 5 | Caveat added to the note and to the comment on `write_view_token`: between the guard fault and the re-arm, another thread's write goes through where `writable()` would refuse. | - `^startup_view_token_` 4/4 in dev and release; view-token matrix 121/121 in each of release and dev, switch off and on (3 skips as before: `startup_logical_view_warp`, `startup_root_heap_{warp,hardware}`). - On CI: right, the `pr` preset's filter doesn't include `startup_view_token_*`, so the fixture has only run locally (RTX 3080 Ti + WARP). Happy to add it to the preset if you want it there. AI-assisted (Claude); I ran the tests.
pigalot commented 2026-11-28 10:55:16 +00:00 (Migrated from github.com)

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

Review: APPROVED


Retested 88c171b1 integrated over main ec71c290 (tree 21d59e8f). The merge is clean and git diff --cached --check origin/main is clean. This follows my approval on 69befbc8, which had no blocking finding.

What changed since 69befbc8. The author merged main 1f07b2c1 as 39ead69c (no conflict resolution: git show --remerge-diff 39ead69c is empty), then pushed 88c171b1. I read git diff 39ead69c 88c171b1:

  • tests/startup_view_token.cpp: one new expect, that the page after the guard page is still PAGE_READWRITE.
  • src/startup_stubs/d3d12_capture.inl: comment only (the concurrency caveat on write_view_token).
  • src/startup_stubs/d3d12_xs_device.cpp: the export moved above the startup_view_alloc comment; no code change.
  • docs/experiments/startup-view-token-guarded.md: the lazy-commit, concurrency and null-binding wording.

The runtime code is the same as at 69befbc8. note_view and write_view_token are unchanged, and the re-arm is still VirtualProtect(dest, bytes, info.Protect | PAGE_GUARD, &old), which covers one page because the token lies inside one page.

R0Y00's page-crossing finding (changes requested on cff24b08). Still addressed at this head: the crossing-token mutant below fails a crossing heap's writable prefix changed.

JohnConnorNPC's points 1 to 5. Each one is in 88c171b1 as the author describes. For point 1 I ran the mutant he named (re-arm over info.BaseAddress, info.RegionSize): it fails the new expect. With the test file from 69befbc8, the same mutant passes, so the new expect is what catches it. Points 2, 4 and 5 are wording, and the new text matches what the code and the fixture do: the fixture commits its memory up front and loads no xmem.dll, so only the startup runs exercise lazy commit.

What I ran. I built startup_view_token d3d12_xs_shim startup_view_alloc startup_descriptor_heap_type_check startup_descriptor_increment startup_logical_view_table_check startup_single_element_srv_check startup_stream_consumer offscreen_check in dev and release, then ran:

ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_view_token_'
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_view_alloc_.*|startup_descriptor_.*|startup_table_alias_.*|startup_copied_vertex_srv_.*|startup_formatted_view.*|startup_logical_view.*|startup_single_element.*)$'

I ran the second command once with X2W_D3D12_VIEW_TOKEN_GUARDED unset and once with it set to 1.

  • startup_view_token_{unset,set}_{warp,hardware}: 4/4 in Debug and in Release /O2, on WARP and on the RTX 5090. Unset reports written 0, refused 0 and set reports written 2, refused 2.
  • Neighbours: 26 tests in each of the four arms (switch unset and set, Debug and Release). 25 pass, and startup_logical_view_warp reports a capability skip (77) in every arm.

Mutants in src/startup_stubs/d3d12_capture.inl. Each was applied alone, d3d12_xs_shim startup_view_token rebuilt in dev, startup_view_token_{set,unset}_warp run, and the source restored afterwards (git diff --quiet clean).

Killed (10):

Mutant First failure
re-arm over the whole region (info.BaseAddress, info.RegionSize) the page after the guard page changed its protection
re-arm over two pages (bytes + 0x1000) the page after the guard page changed its protection
guard bit not set again the guard page lost its guard bit
crossing tokens take the guarded write too a crossing heap's writable prefix changed
switch ignored the guarded path did not write 2 tokens and refuse 2
switch always on the guarded path ran with the switch unset (unset arm)
token not copied the writable heap's first descriptor holds no slot 18 token
STATUS_GUARD_PAGE_VIOLATION dropped from the filter set_warp fails
EXCEPTION_ACCESS_VIOLATION dropped from the filter set_warp crashes
a refusal counted as written the guarded path did not write 2 tokens and refuse 2

Survives (1), not blocking:

  • EXCEPTION_IN_PAGE_ERROR dropped from the filter. The fixture has no page that raises an in-page error, and I don't see a cheap way to build one.

Equivalent in outcome (1):

  • view_token_in_one_page tests dest + bytes instead of dest + bytes - 1. A token that ends exactly at a page end then takes the full-span check instead of the guarded write; the result is the same.

Nit, not blocking. The header comment in tests/startup_view_token.cpp now has one 196-column line (line 5); the rest of the comment wraps near 120.

Verdict: approve on 88c171b1. R0Y00's changes request on cff24b08 still stands on the PR, so I am not merging.

Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. X2W_TEST_DEBUG_LAYER=1 was set for the hardware runs; the view-token fixture itself sets X2W_D3D12_DEBUG=0.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 88c171b1. As JohnConnorNPC noted, the pr preset's filter does not run startup_view_token_*, so CI has not run the new fixture.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6097330904 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#pullrequestreview-6097330904). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-28T10:55:16Z. **Review:** APPROVED --- Retested `88c171b1` integrated over `main` `ec71c290` (tree `21d59e8f`). The merge is clean and `git diff --cached --check origin/main` is clean. This follows my approval on `69befbc8`, which had no blocking finding. **What changed since `69befbc8`.** The author merged `main` `1f07b2c1` as `39ead69c` (no conflict resolution: `git show --remerge-diff 39ead69c` is empty), then pushed `88c171b1`. I read `git diff 39ead69c 88c171b1`: - `tests/startup_view_token.cpp`: one new expect, that the page after the guard page is still `PAGE_READWRITE`. - `src/startup_stubs/d3d12_capture.inl`: comment only (the concurrency caveat on `write_view_token`). - `src/startup_stubs/d3d12_xs_device.cpp`: the export moved above the `startup_view_alloc` comment; no code change. - `docs/experiments/startup-view-token-guarded.md`: the lazy-commit, concurrency and null-binding wording. The runtime code is the same as at `69befbc8`. `note_view` and `write_view_token` are unchanged, and the re-arm is still `VirtualProtect(dest, bytes, info.Protect | PAGE_GUARD, &old)`, which covers one page because the token lies inside one page. **R0Y00's page-crossing finding (changes requested on `cff24b08`).** Still addressed at this head: the crossing-token mutant below fails `a crossing heap's writable prefix changed`. **JohnConnorNPC's points 1 to 5.** Each one is in `88c171b1` as the author describes. For point 1 I ran the mutant he named (re-arm over `info.BaseAddress`, `info.RegionSize`): it fails the new expect. With the test file from `69befbc8`, the same mutant passes, so the new expect is what catches it. Points 2, 4 and 5 are wording, and the new text matches what the code and the fixture do: the fixture commits its memory up front and loads no xmem.dll, so only the startup runs exercise lazy commit. **What I ran.** I built `startup_view_token d3d12_xs_shim startup_view_alloc startup_descriptor_heap_type_check startup_descriptor_increment startup_logical_view_table_check startup_single_element_srv_check startup_stream_consumer offscreen_check` in `dev` and `release`, then ran: ```powershell ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^startup_view_token_' ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^(startup_view_alloc_.*|startup_descriptor_.*|startup_table_alias_.*|startup_copied_vertex_srv_.*|startup_formatted_view.*|startup_logical_view.*|startup_single_element.*)$' ``` I ran the second command once with `X2W_D3D12_VIEW_TOKEN_GUARDED` unset and once with it set to `1`. - `startup_view_token_{unset,set}_{warp,hardware}`: 4/4 in Debug and in Release `/O2`, on WARP and on the RTX 5090. Unset reports `written 0, refused 0` and set reports `written 2, refused 2`. - Neighbours: 26 tests in each of the four arms (switch unset and set, Debug and Release). 25 pass, and `startup_logical_view_warp` reports a capability skip (77) in every arm. **Mutants** in `src/startup_stubs/d3d12_capture.inl`. Each was applied alone, `d3d12_xs_shim startup_view_token` rebuilt in `dev`, `startup_view_token_{set,unset}_warp` run, and the source restored afterwards (`git diff --quiet` clean). Killed (10): | Mutant | First failure | |---|---| | re-arm over the whole region (`info.BaseAddress`, `info.RegionSize`) | `the page after the guard page changed its protection` | | re-arm over two pages (`bytes + 0x1000`) | `the page after the guard page changed its protection` | | guard bit not set again | `the guard page lost its guard bit` | | crossing tokens take the guarded write too | `a crossing heap's writable prefix changed` | | switch ignored | `the guarded path did not write 2 tokens and refuse 2` | | switch always on | `the guarded path ran with the switch unset` (`unset` arm) | | token not copied | `the writable heap's first descriptor holds no slot 18 token` | | `STATUS_GUARD_PAGE_VIOLATION` dropped from the filter | `set_warp` fails | | `EXCEPTION_ACCESS_VIOLATION` dropped from the filter | `set_warp` crashes | | a refusal counted as written | `the guarded path did not write 2 tokens and refuse 2` | Survives (1), not blocking: - `EXCEPTION_IN_PAGE_ERROR` dropped from the filter. The fixture has no page that raises an in-page error, and I don't see a cheap way to build one. Equivalent in outcome (1): - `view_token_in_one_page` tests `dest + bytes` instead of `dest + bytes - 1`. A token that ends exactly at a page end then takes the full-span check instead of the guarded write; the result is the same. **Nit, not blocking.** The header comment in `tests/startup_view_token.cpp` now has one 196-column line (line 5); the rest of the comment wraps near 120. **Verdict:** approve on `88c171b1`. R0Y00's changes request on `cff24b08` still stands on the PR, so I am not merging. Environment: NVIDIA GeForce RTX 5090 driver 32.0.16.1088 and WARP, Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10. `X2W_TEST_DEBUG_LAYER=1` was set for the hardware runs; the view-token fixture itself sets `X2W_D3D12_DEBUG=0`. CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `88c171b1`. As JohnConnorNPC noted, the `pr` preset's filter does not run `startup_view_token_*`, so CI has not run the new fixture. This reply was AI-assisted.
Leyukaka commented 2026-11-29 00:42:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T00:42:46Z.


@R0Y00 your changes request here is on cff24b08. 69befbc8 has both items: a page-crossing token keeps the full-span writable() check (view_token_in_one_page in note_view), and startup_view_token has two caller-backed heaps that start 16 bytes before a page boundary (read-only and guard right page).

pigalot approved the current head 88c171b1. Could you re-review or dismiss it?

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7248299565 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#issuecomment-7248299565). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T00:42:46Z. --- @R0Y00 your changes request here is on `cff24b08`. `69befbc8` has both items: a page-crossing token keeps the full-span `writable()` check (`view_token_in_one_page` in `note_view`), and `startup_view_token` has two caller-backed heaps that start 16 bytes before a page boundary (read-only and guard right page). pigalot approved the current head `88c171b1`. Could you re-review or dismiss it?
lukaslw-lab commented 2026-11-29 08:45:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-29T08:45:50Z.


Merged main (#3377) in 6e8ee394. Both PRs changed the token write in note_view: the token is now built first
and, for a freeable view, replaced by its content token (#3377), then written by the guarded write or the
writable() fallback as before. Both PRs' helpers kept. The change against main is the reviewed one apart from
token no longer being const.

Release and dev: startup_view_token_* 4/4; slot 17-22 view families 125/125 with the switch unset and set;
startup_view_content* 5/5 with X2W_D3D12_VIEW_TOKEN_GUARDED unset and set.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7253315963 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#issuecomment-7253315963). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-29T08:45:50Z. --- Merged `main` (#3377) in `6e8ee394`. Both PRs changed the token write in `note_view`: the token is now built first and, for a freeable view, replaced by its content token (#3377), then written by the guarded write or the `writable()` fallback as before. Both PRs' helpers kept. The change against `main` is the reviewed one apart from `token` no longer being `const`. Release and dev: `startup_view_token_*` 4/4; slot 17-22 view families 125/125 with the switch unset and set; `startup_view_content*` 5/5 with `X2W_D3D12_VIEW_TOKEN_GUARDED` unset and set.
JohnConnorNPC commented 2026-11-29 13:18:28 +00:00 (Migrated from github.com)

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


I re-checked head 6e8ee394, your merge of main with #3377, against current main (c04e0dd6). git merge-tree --write-tree origin/main 6e8ee394 exits 0. All five points from my last comment are in 88c171b1, and the note_view conflict is resolved correctly.

  • Default path: with X2W_D3D12_VIEW_TOKEN_GUARDED unset, note_view builds the token and, for a freeable view, copies content over it. It returns when dest_title == dest_desktop || !title_backed(...), and otherwise writes only if (x2w_local::writable(...)). That is main's condition, and nothing follows it in note_view. Building the token before the checks has no side effects.
  • The fixture now expects protection(memory[guard] + page) == PAGE_READWRITE, so the whole-region re-arm mutant is pinned. I didn't run it (no Windows here). Your note lists it as failing.
  • Docs and code: the lazy-commit and concurrency caveats and the reworded refused 0 claim are in. The export sits above the startup_view_alloc comment again.
  • CI on 6e8ee394: Windows, gfx1013 and Linux pass (100% tests passed out of 79). git diff --check is clean, and the diff adds no binary files.

No MUST from me.

SHOULD

  1. Please take up your offer to put the fixture in the pr preset. grep -c startup_view_token on the Windows job log is still 0, so only your machine (RTX 3080 Ti + WARP) has run startup_view_token_{unset,set}_warp. Adding the two _warp tests and the startup_view_token target would let CI check the guarded path.

Merge status: R0Y00's CHANGES_REQUESTED review on cff24b08 is still the review decision. Both of its points are in this head. GitHub blocks the merge until that review is re-done or dismissed.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7256440906 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#issuecomment-7256440906). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-29T13:18:28Z. --- I re-checked head `6e8ee394`, your merge of `main` with #3377, against current `main` (`c04e0dd6`). `git merge-tree --write-tree origin/main 6e8ee394` exits 0. All five points from my last comment are in `88c171b1`, and the `note_view` conflict is resolved correctly. - Default path: with `X2W_D3D12_VIEW_TOKEN_GUARDED` unset, `note_view` builds the token and, for a freeable view, copies `content` over it. It returns when `dest_title == dest_desktop || !title_backed(...)`, and otherwise writes only `if (x2w_local::writable(...))`. That is `main`'s condition, and nothing follows it in `note_view`. Building the token before the checks has no side effects. - The fixture now expects `protection(memory[guard] + page) == PAGE_READWRITE`, so the whole-region re-arm mutant is pinned. I didn't run it (no Windows here). Your note lists it as failing. - Docs and code: the lazy-commit and concurrency caveats and the reworded `refused 0` claim are in. The export sits above the `startup_view_alloc` comment again. - CI on `6e8ee394`: Windows, gfx1013 and Linux pass (`100% tests passed out of 79`). `git diff --check` is clean, and the diff adds no binary files. No MUST from me. **SHOULD** 1. Please take up your offer to put the fixture in the `pr` preset. `grep -c startup_view_token` on the Windows job log is still `0`, so only your machine (RTX 3080 Ti + WARP) has run `startup_view_token_{unset,set}_warp`. Adding the two `_warp` tests and the `startup_view_token` target would let CI check the guarded path. Merge status: R0Y00's CHANGES_REQUESTED review on `cff24b08` is still the review decision. Both of its points are in this head. GitHub blocks the merge until that review is re-done or dismissed. AI-assisted.
lukaslw-lab commented 2026-12-01 01:07:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-01T01:07:26Z.


Closing this for now.

  • Not a measured hotspot. On main from 28 Nov, the switch gave +0–3 fps in our startup A/B, within run-to-run noise. The larger cost in that profile was note_lock contention, not the token write itself.
  • The code has moved on. main is 537 commits past this branch's base. d3d12_xs_device.cpp alone has +1,081/−142 lines since then, including the content tokens (#3377) that already changed this same token write. A rebase would need new review and new numbers. That review time is better spent on the P0 work.

If a later profile shows note_view token writes as a cost, the branch stays on my fork (runtime/view-token-guarded-write, head 6e8ee394) and can be reopened. Issue #3096 has the original reasoning.

Thanks to everyone who reviewed it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7297110487 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3097#issuecomment-7297110487). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-12-01T01:07:26Z. --- Closing this for now. - **Not a measured hotspot.** On `main` from 28 Nov, the switch gave +0–3 fps in our startup A/B, within run-to-run noise. The larger cost in that profile was `note_lock` contention, not the token write itself. - **The code has moved on.** `main` is 537 commits past this branch's base. `d3d12_xs_device.cpp` alone has +1,081/−142 lines since then, including the content tokens (#3377) that already changed this same token write. A rebase would need new review and new numbers. That review time is better spent on the P0 work. If a later profile shows `note_view` token writes as a cost, the branch stays on my fork (`runtime/view-token-guarded-write`, head `6e8ee394`) and can be reopened. Issue #3096 has the original reasoning. Thanks to everyone who reviewed it.

Pull request closed

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!3097
No description provided.