startup: name a committed buffer behind a refused input view token #3433

Manually merged
github merged 2 commits from github-bot/gh-3431 into main 2026-11-29 09:04:52 +00:00 AGit
Owner

@⁠JB2WIN on GitHub · 2026-11-29 02:11 UTC · original
JB2WIN:native/input-token-committed-buffer → main · +50 −3 · 4 files · 2 commits · merged 2026-11-29 09:00 UTC

Part of #3226, step 1 of my claim there (issuecomment-7244582760).

"an input buffer view token's resource does not hold its range" was the top runtime refusal in a 1,049 s local start-up run on main 61ba40d1: 3 keys, 1,717,437 dispatches (counts only). It covered several cases. This splits it by what the placement index holds at the token's address. Nothing that was refused before is accepted now.

Reason When
… names a committed buffer the token's resource was never placed. It is a committed buffer whose title memory came from the title's __XMemAllocationHooks__, and committed buffers are never in the placement index.
… buffer is placed on another device it was placed, but on another device than the list's
… placed buffer is not indexed at its range it was placed on the list's device, but nothing is indexed there (for example a retired placement)
… resource does not hold its range (unchanged) another placed buffer holds the range, or the resource has no record

The committed case is my guess for that top refusal: title_resource_memory gives committed buffers title memory, but only placed buffers enter the index. A run with this split will show whether the guess holds before anything is bound.

Test

startup_compute_dispatch_input_check.py gets a sixth control, dispatch-input-committed-token: a raw view token of a committed buffer. To give that buffer title memory, startup_stream_consumer exports an __XMemAllocationHooks__ table. Its alloc returns memory only while that mode creates its buffer. Every other mode still gets no title memory, though the stand-in now logs its (null) hook calls.

Windows 11 26200, RTX 3080 (32.0.16.2124), WARP, dev preset:

  • startup_compute_dispatch_input_{warp,hardware}: pass.
  • With the d3d12_draw.inl change reverted, both fail: the committed control gets the old text.
  • startup_compute|startup_stream|startup_slot67|native_compute regression, run before the review fix below (after it, the two input checks were rerun and pass): everything passes except the four tests that also fail on main without this change (startup_compute_dispatch_output_*, startup_compute_half_buffer_uav_controls/_hardware; see #3355).

A read-only review flagged that a resource without a record, and one placed on another device, would have been misnamed. Both now have their own branch.

AI-assisted.

🤖 Generated with Claude Code

**@⁠JB2WIN** on GitHub · 2026-11-29 02:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3431) `JB2WIN:native/input-token-committed-buffer` → `main` · +50 −3 · 4 files · 2 commits · merged 2026-11-29 09:00 UTC Part of #3226, step 1 of my claim there (issuecomment-7244582760). "an input buffer view token's resource does not hold its range" was the top runtime refusal in a 1,049 s local start-up run on `main` 61ba40d1: 3 keys, 1,717,437 dispatches (counts only). It covered several cases. This splits it by what the placement index holds at the token's address. Nothing that was refused before is accepted now. | Reason | When | |---|---| | `… names a committed buffer` | the token's resource was never placed. It is a committed buffer whose title memory came from the title's `__XMemAllocationHooks__`, and committed buffers are never in the placement index. | | `… buffer is placed on another device` | it was placed, but on another device than the list's | | `… placed buffer is not indexed at its range` | it was placed on the list's device, but nothing is indexed there (for example a retired placement) | | `… resource does not hold its range` (unchanged) | another placed buffer holds the range, or the resource has no record | The committed case is my guess for that top refusal: `title_resource_memory` gives committed buffers title memory, but only placed buffers enter the index. A run with this split will show whether the guess holds before anything is bound. ## Test `startup_compute_dispatch_input_check.py` gets a sixth control, `dispatch-input-committed-token`: a raw view token of a committed buffer. To give that buffer title memory, `startup_stream_consumer` exports an `__XMemAllocationHooks__` table. Its alloc returns memory only while that mode creates its buffer. Every other mode still gets no title memory, though the stand-in now logs its (null) hook calls. Windows 11 26200, RTX 3080 (32.0.16.2124), WARP, dev preset: - `startup_compute_dispatch_input_{warp,hardware}`: pass. - With the `d3d12_draw.inl` change reverted, both fail: the committed control gets the old text. - `startup_compute|startup_stream|startup_slot67|native_compute` regression, run before the review fix below (after it, the two input checks were rerun and pass): everything passes except the four tests that also fail on `main` without this change (`startup_compute_dispatch_output_*`, `startup_compute_half_buffer_uav_controls/_hardware`; see #3355). A read-only review flagged that a resource without a record, and one placed on another device, would have been misnamed. Both now have their own branch. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
"an input buffer view token's resource does not hold its range" covered three
cases. Split it by what the placement index found at the token's address:

- no owner and the token's resource was never placed (a committed buffer:
  title memory from the XMem hook, never in the placement index):
  "an input buffer view token names a committed buffer"
- no owner, but the resource was placed:
  "an input buffer view token's placed buffer is not indexed at its range"
- another placed buffer: the old text, unchanged.

Nothing that was refused is accepted now. The consumer exports
__XMemAllocationHooks__ whose alloc returns memory only while
dispatch-input-committed-token creates its buffer, so every other mode keeps
committed resources without title memory as before.

Refs #3224.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 02:16:38 +00:00
Review of #3431 (Leyukaka): the check is broader than the docs said.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 02:49 UTC · original · approved these changes

Approve on 19bf3cab.

All four branches inside if (owner && owner != placed.owner) (src/startup_stubs/d3d12_draw.inl:2598-2610) return refuse(...), so nothing refused before is accepted. The split matches where placement_device is set: only the placed-buffer record sets it (d3d12_xs_device.cpp:5761), note_resource leaves it null (d3d12_capture.inl:345-351), placed_buffer_range skips other devices (d3d12_capture.inl:386), and retire_placement erases the index entry and resets placement but keeps placement_device.

The new control is not vacuous. If the exported __XMemAllocationHooks__ were not found, the committed buffer would get no guest memory, the token's address would stay 0, the if (address) block holding line 2598 would be skipped, and the exact-reason assert would fail.

Not covered:

  • No control reaches ... buffer is placed on another device or ... placed buffer is not indexed at its range, and no test asserts the unchanged ... does not hold its range. These one-line mutations survive: 2605 info->placement_device != device -> false; 2607 condition -> false; 2603 !placed.owner && info && !info->placement_device -> !placed.owner.
  • names a committed buffer tests only "has a record, never placed", so it also fires for other never-placed resources with guest memory that are not on a custom heap, not only ones fed by __XMemAllocationHooks__. Records of that kind are also made by the slot 133 committed fallback (d3d12_xs_device.cpp:5834-5835) and the upload-backed memory SRV backing (d3d12_memory_srv.inl:430,444). Whether a slot 18 buffer view names those in practice is not checked. The docs sentence is narrower than the check.
  • CI run 46214655915 passes on this head but does not run the new control. The pull_request job runs cmake --build --preset pr and ctest --preset pr (.github/workflows/windows.yml:490,493). startup_stream_consumer is not among the pr build targets (CMakePresets.json:28-37), and the pr filter (CMakePresets.json:51) does not match startup_compute_dispatch_input_*.

Basis: diff read in full against main 212d4b5f; nothing built or run. git merge-tree with main is clean. It is also clean with #3411 (30de88b6) and #3417 (e232e475), which touch the same function and consumer file.

**@⁠Leyukaka** on GitHub · 2026-11-29 02:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3431#pullrequestreview-6101134530) · **approved these changes** Approve on 19bf3cab. All four branches inside `if (owner && owner != placed.owner)` (`src/startup_stubs/d3d12_draw.inl:2598-2610`) return `refuse(...)`, so nothing refused before is accepted. The split matches where `placement_device` is set: only the placed-buffer record sets it (`d3d12_xs_device.cpp:5761`), `note_resource` leaves it null (`d3d12_capture.inl:345-351`), `placed_buffer_range` skips other devices (`d3d12_capture.inl:386`), and `retire_placement` erases the index entry and resets `placement` but keeps `placement_device`. The new control is not vacuous. If the exported `__XMemAllocationHooks__` were not found, the committed buffer would get no guest memory, the token's address would stay 0, the `if (address)` block holding line 2598 would be skipped, and the exact-reason assert would fail. Not covered: - No control reaches `... buffer is placed on another device` or `... placed buffer is not indexed at its range`, and no test asserts the unchanged `... does not hold its range`. These one-line mutations survive: 2605 `info->placement_device != device` -> `false`; 2607 condition -> `false`; 2603 `!placed.owner && info && !info->placement_device` -> `!placed.owner`. - `names a committed buffer` tests only "has a record, never placed", so it also fires for other never-placed resources with guest memory that are not on a custom heap, not only ones fed by `__XMemAllocationHooks__`. Records of that kind are also made by the slot 133 committed fallback (`d3d12_xs_device.cpp:5834-5835`) and the upload-backed memory SRV backing (`d3d12_memory_srv.inl:430,444`). Whether a slot 18 buffer view names those in practice is not checked. The docs sentence is narrower than the check. - CI run 46214655915 passes on this head but does not run the new control. The pull_request job runs `cmake --build --preset pr` and `ctest --preset pr` (`.github/workflows/windows.yml:490,493`). `startup_stream_consumer` is not among the `pr` build targets (`CMakePresets.json:28-37`), and the `pr` filter (`CMakePresets.json:51`) does not match `startup_compute_dispatch_input_*`. Basis: diff read in full against main 212d4b5f; nothing built or run. `git merge-tree` with main is clean. It is also clean with #3411 (30de88b6) and #3417 (e232e475), which touch the same function and consumer file.
Author
Owner

@⁠JB2WIN on GitHub · 2026-11-29 02:49 UTC · original

Thanks. Docs fixed in the follow-up commit: the committed-buffer reason covers every never-placed record with title memory (slot 133 committed fallback, memory SRV backing), and the control only covers the __XMemAllocationHooks__ case. Controls for the other-device and not-indexed branches need a second device or a retired placement in the consumer. I would add them in a separate change if you want them.

AI-assisted.

**@⁠JB2WIN** on GitHub · 2026-11-29 02:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3431#issuecomment-7249671892) Thanks. Docs fixed in the follow-up commit: the committed-buffer reason covers every never-placed record with title memory (slot 133 committed fallback, memory SRV backing), and the control only covers the `__XMemAllocationHooks__` case. Controls for the other-device and not-indexed branches need a second device or a retired placement in the consumer. I would add them in a separate change if you want them. AI-assisted.
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 03:29 UTC · original · approved these changes

Approve 938fa72a. The only change since 19bf3cab is the docs/experiments.md line for an input buffer view token names a committed buffer: it now describes any record that was never placed, names the slot 133 committed fallback and the upload-backed memory SRV backing, and says the control covers the __XMemAllocationHooks__ case only. That matches what the check at src/startup_stubs/d3d12_draw.inl:2598-2610 tests. The other points in the previous review are unchanged.

Controls for the other-device and not-indexed branches in a separate change are fine; they do not block this one.

**@⁠Leyukaka** on GitHub · 2026-11-29 03:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3431#pullrequestreview-6101242982) · **approved these changes** Approve `938fa72a`. The only change since `19bf3cab` is the `docs/experiments.md` line for `an input buffer view token names a committed buffer`: it now describes any record that was never placed, names the slot 133 committed fallback and the upload-backed memory SRV backing, and says the control covers the `__XMemAllocationHooks__` case only. That matches what the check at `src/startup_stubs/d3d12_draw.inl:2598-2610` tests. The other points in the previous review are unchanged. Controls for the other-device and not-indexed branches in a separate change are fine; they do not block this one.
github manually merged commit a1648d3d85 into main 2026-11-29 09:04:52 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.