Skip to content

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

Merged
JohnConnorNPC merged 2 commits into
R0Y00:mainfrom
JB2WIN:native/input-token-committed-buffer
Nov 29, 2026
Merged

JohnConnorNPC merged 2 commits into
R0Y00:mainfrom
JB2WIN:native/input-token-committed-buffer

Conversation

@JB2WIN

@JB2WIN JB2WIN commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

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 61ba40d: 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 shader: lower direct MTBUF packed half stores #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

"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 R0Y00#3224.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@Leyukaka Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve on 19bf3ca.

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 212d4b5; nothing built or run. git merge-tree with main is clean. It is also clean with #3409 (30de88b) and #3415 (e232e47), which touch the same function and consumer file.

…th title memory

Review of R0Y00#3431 (Leyukaka): the check is broader than the docs said.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JB2WIN

JB2WIN commented Nov 29, 2026

Copy link
Copy Markdown
Contributor Author

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 Leyukaka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JohnConnorNPC
JohnConnorNPC merged commit a1648d3 into R0Y00:main Nov 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants