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

Merged
JB2WIN merged 2 commits from upstream-pr/3431 into main 2026-11-29 09:00:31 +00:00
JB2WIN commented 2026-11-29 02:11:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-29T02:11:48Z.


Part of #3224, 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 #3353).

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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5546709893 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3431). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-29T02:11:48Z. --- Part of #3224, 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 #3353). 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)
Leyukaka commented 2026-11-29 02:49:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T02:49:02Z.

Review: APPROVED


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 #3409 (30de88b6) and #3415 (e232e475), which touch the same function and consumer file.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6101134530 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3431#pullrequestreview-6101134530). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T02:49:02Z. **Review:** APPROVED --- 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 #3409 (30de88b6) and #3415 (e232e475), which touch the same function and consumer file.
JB2WIN commented 2026-11-29 02:49:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-29T02:49:41Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7249671892 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3431#issuecomment-7249671892). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-29T02:49:41Z. --- 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.
Leyukaka commented 2026-11-29 03:29:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T03:29:14Z.

Review: APPROVED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6101242982 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3431#pullrequestreview-6101242982). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T03:29:14Z. **Review:** APPROVED --- 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.
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!3431
No description provided.