gpu: bind proven mesh root reads from ordinary XMem pages #2466
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2474"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T17:46:44Z.
Summary
Verification
Built Release with
cmake --build out/build/loose-root --target startup_indirect_draw_indexed xmem_section_lease_check --parallel 3.24/24 passed, with zero skips. Rebuilt the final source and reran the two loose root tests and the single-page lease test, 3/3 passed. Windows 11 26200.9974, Microsoft WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656, D3D12 debug layer enabled.
The source-built shader observed the CPU value written after Close. Misaligned, unmapped, untracked readable, registered-without-writer and stale remapped inputs produced clear pixels. A fresh recording after the remap read the replacement page.
Feature commit:
df1c3e13a45a3c9a63d9e8dfa76e71a41484262d.Maintainer verification
A separate maintainer session reviewed the exact head for flag gating, placement exclusion, lease revalidation and fence retirement, then independently reproduced the three targeted checks with no skips. This was performed under the same repository account.
Two additional local controls used the same Release DLL. With the flag unset, the proved ordinary XMem input left all eight pixels clear on WARP and RTX. With the consumer held behind a fence, releasing its closed recording and remapping the address preserved the original physical slot for the pending GPU read. All eight pixels read the original value, and a fresh recording read the replacement value on both adapters with no D3D12 warnings or errors.
Main branch update
The first full /O2 run passed the loose-root WARP fixture. Its two PE startup failures were on a base that predated #2465. The topic branch now contains that existing fix through a regular merge from main. The net feature diff is unchanged.
On refreshed head
ba2fb6e36301765b8e5dc4335a69c019ec33a111, Release passed both loose-root adapter fixtures, the single-page lease check, the WARP mesh-cache control and both previously failing PE startup tests, 6/6 with no skips.The full Windows /O2 job also passed on that head. A subsequent merge from main preserves both logging triggers in the shared indirect fixture. The feature diff is identical after accounting for the main-side
other_refusal_censustrigger.On
4570fc216461302a937ad061dd64e650d34a6ce0, the command below passed 35/35 in local Release on WARP and RTX, with no skips. It covers the new refusal census and controls alongside the loose-root and dual-lease fixtures and the two PE tests.The PR checks and full Windows /O2 job both passed at
4570fc21. After #2504 merged,9f547e45b09bb0abe01abe3b9382e152482fcb3apreserves its writer/fence tracing and the loose-root lease changes in the same implementation. The same local Release command passed 36/36 with no skips, including the added paired writer trace test and the WARP and RTX loose-root fixtures.Current-head PR checks and Windows /O2 checks.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T18:31:48Z.
Review: COMMENTED
Code review of head
ba2fb6e36301765b8e5dc4335a69c019ec33a111. Comment only; I did not run Windows or the game.Checked in the diff
XMemSectionBuffer(src/startup_stubs/xmem_section_buffer.h) is a move of the oldMeshXMemLeaseopen/teardown code. It adds range checks before the map:first_byteandbytesmust fit insidewindow_bytes,section_offset + window_bytesmust not overflow, andbytes > UINT64_MAX - addressis rejected. Teardown order is unchanged: resource, heap, section handle, then unmap, then release only if the unmap succeeded.X2W_MESH86_LOOSE_XMEM_SRV. It applies only to slot 61 with!placed.owner. Registered-placement inputs keep the old published-writer path.note_mesh_xmem_writenow gates on handoff/indirect only, so the new flag does not turn on write tracking.lease->matches(address)re-check is kept. Theready != leasecheck is skipped only for ownerless (loose) leases, which have no publisher by design.mesh_xmem_loose_views, expired entries pruned undermesh_xmem_mutex).docs/experiments.md) says a raw root descriptor gives no bounds for a larger allocation.loose-rootfor both adapters. The fixture covers: green when the flag is on and the shader is proven, black for a missing proof, a misaligned address, an unmapped page, readable untracked memory, and a registered resource without a publisher. It also covers a CPU write after Close being seen, a stale recording refused after remap, and a fresh recording reading the replacement page. Log lines for the refusals are asserted. The negative control for the stale remap is in the test itself..github, launcher or hook files.Commands run (Linux, in a worktree of the exact head)
git diff --check origin/main...HEAD: cleanpython3 tests/docs_links_check.py: passed (19 files, 466 links)python3 tests/bidi_controls_check.py: passedWindows / CI results, with the SHA each one covers
ba2fb6e3. An earlier 24/24 run was on feature commitdf1c3e13./O2job was skipped.main. I did not update it, so the author's results stay tied to this SHA.Notes for @R0Y00
No blocking findings from the code and test review.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-25T20:03:01Z.
Post-merge audit at
396e7e2e: 6/6 and 2/2 pass, and the writer-trace ordinals have no assertion behind themNot a review request —
#2474is merged. I ran it and mutated it the way I have been mutating open PRs, because thepaired-writer tracing is the kind of feature whose tests can pass while the feature itself is inert.
What passes here
Reproduction note: all six
mesh_xmemcases reportNot Rununtilstartup_indirect_draw_indexedis built — theyreference the target by name, and
ctest -N -Vprints the command with an empty executable before it exists. That is amissing artifact, not a failure; I hit it and checked before reporting.
Three mutations of
src/startup_stubs/mesh_xmem_handoff.inlif (!mesh_xmem_trace_ordinal()) return 0;→if (true) return 0;(tracing never records)value[i] < '0' || value[i] > '9'→false)size >= sizeof(value)→size > sizeof(value))I first ran these against the six
mesh_xmemcases alone, where they are inert by construction — those cases set onlyX2W_MESH86_FIXTURE_XMEM, neverX2W_MESH86_WRITER_TRACE. So I re-ran withstartup_indirect_mesh_cache_*included,which does set the variable:
Even there,
return 0frommesh_xmem_trace_ordinal()changes nothing. The reason is visible in that loop: the tracedrun's stderr is forwarded and its exit code checked, but nothing asserts that a trace line was produced. So the
ordinal values 2/3/4/6 are exercised as "the program still passes with tracing requested", not as "ordinal N records
the paired writer I expect".
That is worth knowing for two reasons:
return 0) is currently invisible to CI. The feature could rot silently.root-srv, no assertion herewould notice.
If the trace output is meant as an operator diagnostic rather than a checked behaviour, saying so in
docs/experiments.mdwould settle it. If it is meant to be checked, the cheap version is one regex per ordinal on thecaptured stderr — the loop already has
result.stderrin hand and already knows which ordinal is supposed to name whichinput.
What the six
mesh_xmemcases do pinThey pass with two backends and with and without the extra wait, and they reference the fixture through
X2W_MESH86_FIXTURE_XMEM=$<TARGET_FILE:xmem_shim>, so the ordering assertions run against a real built shim ratherthan a stub. That half of the PR is well covered — it is only the trace path that nothing constrains.
AI-assisted; Windows 11 build 26300.9974, WARP and the installed physical GPU, targets built individually.