Skip to content

compute: name each input view token a dispatch will not bind (Part of #3224) - #3400

Merged
JohnConnorNPC merged 6 commits into
R0Y00:mainfrom
SimSalabimse:compute-input-view-desktop-buffer
Nov 29, 2026
Merged

JohnConnorNPC merged 6 commits into
R0Y00:mainfrom
SimSalabimse:compute-input-view-desktop-buffer

Conversation

@SimSalabimse

@SimSalabimse SimSalabimse commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Change

Part of #3224. The compute census reported a single "input view is not a desktop buffer" refusal for every input view token that a dispatch does not bind. This PR splits that refusal into named reasons, so a census shows exactly which kind of view stopped the dispatch. It also binds typed and raw buffer views that do have a desktop object.

Two runtime changes came out of the debug-layer runs. Both are needed so the refusal fixture can run without removing the device:

  • A sampler input token is now recorded on a sampler heap. Previously it was created in a CBV/SRV/UAV heap, which faulted with exit 2173.
  • Slot 18 still forwards every shader-resource view. The past-the-end fixture records that view's description without calling CreateShaderResourceView, so the range refusal can run without the desktop removing the device. That range check now runs before the heap-type check.

A byte-window load that asks for identity mapping now refuses a non-identity component mapping before the token table names the view's shape. With that flag off, the token table is unchanged.

The reason order is documented in docs/experiments/compute-input-view-token.md.

Verification

All results below are for commit c4e5785a88b4442fb088e364127d026b86464076. The branch is 5 commits behind main af1cab5ceb7b9ecbe06acf358b5b6477c265de9b (#3389) and still merges cleanly.

Windows test PC (MSVC, --preset dev, -j 1). The command was:

ctest --preset dev --no-tests=error -j 1 -R '^(startup_input_view_token|startup_compute_input_view_token_|startup_compute_dispatch_input_|startup_compute_mtbuf_window_)' -E 'startup_audio_(output|pacing|provider)' --output-on-failure

It passed 17 of 17 with ctest exit 0. startup_compute_mtbuf_window_warp did not run: the WARP adapter reported a 4-lane wave (skip: shader wave32 fixture requires SM 6.6, WaveOps, and a 32-lane wave). startup_compute_mtbuf_window_hardware passed. The seven startup_input_view_token_*_control tests are WILL_FAIL and failed as required.

startup_compute_dispatch_output_warp and _hardware already fail on main, with "an output token does not identify a slot-19 UAV" (see #3224 (comment)). This PR does not touch them, so they were left out of the regex.

Evidence and follow-up

The fixture is hand-built from source words in tests/startup_stream_consumer.cpp and contains no game data. The negative controls in startup_compute_input_view_token_controls fail if a reason is merged or reordered. For example, deleting the width check makes the past-the-end case report the heap sentence instead of the range sentence. The new order of the identity-mapping refusal is not pinned: the swapped token is a buffer view on a valid resource, so that sentence comes out in either order.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Cursor)

@Leyukaka

Copy link
Copy Markdown
Collaborator

Reviewed 4980038d by its diff. The split covers every case a local split of the same refusal found (record out of range; slot 19; slot 18 or 17 with a short description; other slots; slot-18 owner missing, of the wrong kind or without a desktop resource; a non-buffer dimension), with static strings. In the 600 s census on #3224, all 14 shaders at this refusal would read the slot 19 (unordered access) case.

  1. The new reasons are mostly untested. The reference check compares a Python copy and the set of sentences, and the Windows fixtures reach only the unknown, UAV, sampler and texture-token cases. Each of these would pass: the < 40 or < 12 description threshold lowered, || !facts.wrapper dropped, placement == 1 || placement == 2 cut to placement == 1, slot == 20 || slot == 21 cut to slot == 20, facts.wrapper = token_resource in d3d12_draw.inl (a wrong-kind owner then reads "names no resource"). A compiled C++ test of the header's table (as tests/startup_memory_srv_buffer_check.cpp does for memory_srv_buffer.h) would pin each case.
  2. Scope. The device change nulls any past-end buffer SRV at slot 18, graphics included, not only for the fixture; only debug-layer runs are shown. Worth stating in the body.

Minor: "names no resource" and "does not name a resource" are hard to tell apart in a census.

@SimSalabimse

Copy link
Copy Markdown
Contributor Author

Retested bb66d63c on the Windows test PC (MSVC, --preset dev, -j 1): build exit 0, ctest -R "^(startup_input_view_token|startup_compute_input_view_token_|startup_compute_dispatch_input_)" 14/14 passed, exit 0.

Thanks for going through 4980038. The reason table is now a device-free C++ test: every sentence, plus a buffer view and a constant-buffer view that bind. The short-description, wrapper, copied-placement, depth-slot, wrong-kind, and bind controls fail if that guard is dropped. The two resource sentences now say "not a wrapper" and "names an object that is not a resource". Slot 18 forwards every shader-resource view again, graphics included. A past-the-end buffer view there still goes to the desktop and can remove the device. The fixture records that description on its own and does not call slot 18.

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.

Approving bb66d63c. Read by its diff (4980038d..bb66d63c, and the net diff against main 212d4b5f); I did not build or run it.

Point 1. Each weakening from my review now changes a row of the plain startup_input_view_token run (tests/startup_input_view_token_check.cpp):

  • < 40 lowered: short-srv (:134-136) binds instead of the truncated sentence.
  • < 12 lowered: short-cbv (:121-124), same.
  • || !facts.wrapper dropped: wrapper (:149-153) reads "names an object that is not a resource".
  • placement == 2 cut: placement (:165-168) reads "has no desktop resource".
  • slot == 21 cut: depth (:117-119) reads "unrecognized slot".
  • wrong-kind owner: wrong-kind (:155-158) pins facts.resource = owner_is_wrapper && owner_is_resource in the header. The assignment in d3d12_draw.inl is pinned by source text only (startup_compute_input_view_token_check.py:177).

Point 2. Slot 18 is back to main's behaviour: the net diff of d3d12_xs_device.cpp is +14, the fixture export x2w_d3d12_record_uncreated_buffer_srv only. The two resource sentences are now distinct.

Remaining, none blocking:

  • The seven --mutate controls change the expected value, not the code. They fail whenever the table is right, so they show nothing the plain run does not.
  • PR CI does not build or run startup_input_view_token*: the target is not in the pr build preset and the names are not in the pr test filter. CI runs only the Python reference and controls (Linux job). The C++ rows rest on your 14/14 on bb66d63c and on my reading of the table.
  • The PR body still describes the removed slot-18 change ("recorded instead of created") and the 4980038d results (6 of 6).

git merge-tree against 212d4b5f is clean.

Split the shared refusal into the token's record: unknown, sampler,
unordered access, render or depth, truncated views, a non-buffer shader
resource view, a missing resource, and a placed or copied resource with
no desktop backing. A typed or raw buffer view of a desktop resource
still uses the existing range checks. A placed buffer that aliases title
memory is bound, and the fixture reads that path back.

Refs R0Y00#3224
CreateSampler into the compute CBV/SRV/UAV table faults in the desktop
runtime before the dispatch is logged. The fixture now creates the
sampler in a one-entry sampler heap and copies that token into the
input slot, so the census still refuses it as a sampler.

Refs R0Y00#3224
Desktop CreateShaderResourceView removes the device when a buffer view
extends past the resource, so the dispatch never reaches its range
refusal. That view is now recorded and not created. The past-the-end
fixture uses a custom-heap buffer, whose range is checked against the
desktop width.

Refs R0Y00#3224
A recorded buffer view with no title memory was refused because its
heap is not default or upload, before the desktop width was checked.
The width check now comes first. A fitting view of that heap still
uses the heap sentence. The control fails when the width check is removed.

Refs R0Y00#3224
A device-free table covers every refusal and the two views that bind.
The controls fail if a threshold, a slot, or the wrapper check is
dropped. Slot 18 again forwards every shader-resource view. The
past-the-end fixture records its description without that call.

Refs R0Y00#3224
A byte-window load still refuses a non-identity component mapping
before the token's shape is named. Callers that do not ask for that
mapping use the token table as before.

Refs R0Y00#3224
@cursor
cursor Bot force-pushed the compute-input-view-desktop-buffer branch from bb66d63 to c4e5785 Compare November 29, 2026 12:27

@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.

Head c4e5785a, rebased onto main 77d1ba4d. Diff and source reading only, nothing built or run. My approval was on bb66d63c.

git range-diff against bb66d63c: commits 2-4 are unchanged, 1 and 5 differ by rebase context only (main's requires_identity_dst_sel checks now sit in the same function). c4e5785a is new (src/startup_stubs/d3d12_draw.inl, +5/-2).

c4e5785a moves the identity-mapping refusal ahead of input_view_token_refusal (d3d12_draw.inl:2580-2583), for a known slot-18 token of at least 40 bytes. Main also tests the mapping before the owner and the dimension, so every token main refused with an MTBUF sentence gets the same sentence at this head. A slot-17 token still reaches "requires a buffer SRV" (:2585), since the table returns nothing for a constant buffer view of 12 bytes or more. Other tokens get the split sentences, as on bb66d63c.

Missing before I approve this head:

  • No run on c4e5785a. The 14/14 is from bb66d63c, before the rebase. PR CI runs neither startup_input_view_token* nor startup_compute_mtbuf_window_* (not in the pr test filter); the Linux job runs only the Python reference and controls. Please post ctest --preset dev -j 1 -R "^(startup_input_view_token|startup_compute_input_view_token_|startup_compute_dispatch_input_|startup_compute_mtbuf_window_)" on c4e5785a.
  • The order from c4e5785a is not pinned. In tests/startup_compute_mtbuf_window_check.py:128-131 the swapped token is a buffer view on a valid resource (tests/startup_stream_consumer.cpp:432-437), so the table returns nothing and the mapping sentence comes out in either order. A byte-window token with a swapped mapping and a non-buffer dimension would tell the two orders apart.

Still open, not blocking: the PR body describes the removed slot-18 change ("recorded instead of created") and the 4980038d results.

git merge-tree --write-tree onto origin/main 77d1ba4d: clean.

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Review of head c4e5785a against main af1cab5c (git merge-tree --write-tree --name-only origin/main c4e5785a exits 0). Read only, nothing built or run.

Checked:

  • Since bb66d63c, input_view_token.h, startup_input_view_token_check.cpp, startup_compute_input_view_token_check.py and the doc are unchanged. git diff --stat bb66d63c c4e5785a -- <those files> lists none of them. Only the token branch in d3d12_draw.inl was merged with main's MTBUF checks, and c4e5785a was added.
  • c4e5785a keeps main's order for every MTBUF sentence. I agree with the 12:41 reading and won't repeat it.
  • dispatch-input-token is a texture view at slot 18, and it still gets an input view token is not a buffer view of a desktop resource, which tests/startup_compute_dispatch_input_check.py:40 expects.
  • Default path: indirect_table_buffer serves both the in-process route (the default since runtime: default to native shaders and Opus decoding #3449) and the published route, so default runs will show the new sentences. Nothing main binds is refused here, and nothing main refuses is bound. Only the reason text changes. git grep -n 'input view token' origin/main -- tools → no output, so no triage pattern depends on the old sentence.
  • CI at c4e5785a (run 46262337849) passes. The Linux job prints startup_compute_input_view_token reference: 20 shapes, 12 refusal sentences. Windows CI compiles d3d12_draw.inl through startup_stub_consumer → d3d12_xs_shim.

MUST

  1. Held for the run requested at 12:41 (ctest ... -R "^(startup_input_view_token|startup_compute_input_view_token_|startup_compute_dispatch_input_|startup_compute_mtbuf_window_)" on c4e5785a). I don't have a separate finding here. I expect it to pass from the reading above. Once it's posted, this is clean on my side.

SHOULD

  1. The body has two more stale points, besides the slot-18 change and the 4980038d results already noted:
    • "Two runtime changes" lists the sampler-heap change, but that change is a fixture change. dispatch-input-token-sampler in tests/startup_stream_consumer.cpp creates a one-entry D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER heap, and the runtime is not involved.
    • "It also binds typed and raw buffer views that do have a desktop object": main binds these already. The raw/structured/typed element code in the slot-18 branch is unchanged (const bool raw = view.Buffer.Flags == D3D12_BUFFER_SRV_FLAG_RAW && ... is the same on both sides). This PR adds the -typed and -raw fixtures that show it.

AI-assisted.

@SimSalabimse

Copy link
Copy Markdown
Contributor Author

Windows test PC (MSVC, --preset dev, -j 1), at c4e5785a88b4442fb088e364127d026b86464076:

  • ctest --preset dev --no-tests=error -j 1 -R '^(startup_input_view_token|startup_compute_input_view_token_|startup_compute_dispatch_input_|startup_compute_mtbuf_window_)' -E 'startup_audio_(output|pacing|provider)': 17/17 passed, exit 0. startup_compute_mtbuf_window_warp did not run. The WARP adapter reported a 4-lane wave (skip: shader wave32 fixture requires SM 6.6, WaveOps, and a 32-lane wave).

What ran:

  • startup_input_view_token: 12 refusals, buffer and constant-buffer views bind. Its seven WILL_FAIL mutation controls each failed as required (short-srv, short-cbv, wrapper, placement, depth, wrong-kind, bind).
  • startup_compute_dispatch_input_warp and _hardware: all 320 words match, also with the input behind a memory view token; 6 inputs refused, each with its own reason and an untouched output.
  • startup_compute_input_view_token_reference, _controls, _warp and _hardware: 2 buffer views bound, 6 tokens refused. Controls kept the past-range check (past range check removed: refused for heap type, as required).
  • startup_compute_mtbuf_window_controls: MTBUF writable byte-window request refused before DXIL publication.
  • startup_compute_mtbuf_window_hardware: identity readback matched five pairs, seven out-of-range pairs and all guards. Both swaps, a Z/W swap and the CBV token refused, on the published and the in-process route. Cold and warm manifests matched.

The branch is 5 commits behind main af1cab5c (#3389) and still merges cleanly. This run does not pin the new order of the identity-mapping refusal. The swapped token is a buffer view on a valid resource, so that sentence comes out in either order.

AI-Assisted

@JohnConnorNPC

Copy link
Copy Markdown
Collaborator

Re-check of head c4e5785a after the 13:02 Windows run (read only, on Linux; no build or run here). git merge-tree --write-tree origin/main(17b662a2) c4e5785a exits 0, and CI is green at head.

Resolved

  • The requested run on c4e5785a: ctest --preset dev -j 1 -R '^(startup_input_view_token|startup_compute_input_view_token_|startup_compute_dispatch_input_|startup_compute_mtbuf_window_)' ran 17/17 passed, exit 0, including the seven WILL_FAIL mutation controls of startup_input_view_token. startup_compute_mtbuf_window_warp was a capability skip (4-lane WARP wave), not a pass.

Still open, not blocking

  • The identity-mapping order from c4e5785a is still unpinned (the swapped token is a buffer view on a valid resource). This was already raised on 12:41 and acknowledged in the run comment. A token with a swapped mapping and a non-buffer dimension would pin it in a follow-up.
  • The body text from the earlier SHOULD (sampler-heap change and typed/raw binding were already fixture-only or main behaviour).

0 MUST, mergeable, no change request. Merging.

AI-assisted.

@JohnConnorNPC
JohnConnorNPC merged commit 4b0586d 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.

4 participants