compute: name each input view token a dispatch will not bind (Part of #3224) #3400
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3400"
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 SimSalabimse on 2026-11-28T21:40:06Z.
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:
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 mainaf1cab5ceb7b9ecbe06acf358b5b6477c265de9b(#3389) and still merges cleanly.Windows test PC (MSVC,
--preset dev,-j 1). The command was:It passed 17 of 17 with ctest exit 0.
startup_compute_mtbuf_window_warpdid 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_hardwarepassed. The sevenstartup_input_view_token_*_controltests areWILL_FAILand failed as required.startup_compute_dispatch_output_warpand_hardwarealready fail on main, with "an output token does not identify a slot-19 UAV" (see https://github.com/R0Y00/Xbox2Windows/issues/3224#issuecomment-7244145927). 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.cppand contains no game data. The negative controls instartup_compute_input_view_token_controlsfail 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: theswappedtoken is a buffer view on a valid resource, so that sentence comes out in either order.Checklist
AI-assisted (Cursor)
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T22:27:45Z.
Reviewed
4980038dby 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.referencecheck 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< 40or< 12description threshold lowered,|| !facts.wrapperdropped,placement == 1 || placement == 2cut toplacement == 1,slot == 20 || slot == 21cut toslot == 20,facts.wrapper = token_resourceind3d12_draw.inl(a wrong-kind owner then reads "names no resource"). A compiled C++ test of the header's table (astests/startup_memory_srv_buffer_check.cppdoes formemory_srv_buffer.h) would pin each case.Minor: "names no resource" and "does not name a resource" are hard to tell apart in a census.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-28T22:54:20Z.
Retested
bb66d63con 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
4980038d. 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
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T01:24:37Z.
Review: APPROVED
Approving
bb66d63c. Read by its diff (4980038d..bb66d63c, and the net diff against main212d4b5f); I did not build or run it.Point 1. Each weakening from my review now changes a row of the plain
startup_input_view_tokenrun (tests/startup_input_view_token_check.cpp):< 40lowered:short-srv(:134-136) binds instead of the truncated sentence.< 12lowered:short-cbv(:121-124), same.|| !facts.wrapperdropped:wrapper(:149-153) reads "names an object that is not a resource".placement == 2cut:placement(:165-168) reads "has no desktop resource".slot == 21cut:depth(:117-119) reads "unrecognized slot".wrong-kind(:155-158) pinsfacts.resource = owner_is_wrapper && owner_is_resourcein the header. The assignment ind3d12_draw.inlis 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.cppis +14, the fixture exportx2w_d3d12_record_uncreated_buffer_srvonly. The two resource sentences are now distinct.Remaining, none blocking:
--mutatecontrols change the expected value, not the code. They fail whenever the table is right, so they show nothing the plain run does not.startup_input_view_token*: the target is not in theprbuild preset and the names are not in theprtest filter. CI runs only the Python reference and controls (Linux job). The C++ rows rest on your 14/14 onbb66d63cand on my reading of the table.4980038dresults (6 of 6).git merge-treeagainst212d4b5fis clean.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T12:41:24Z.
Review: COMMENTED
Head
c4e5785a, rebased onto main77d1ba4d. Diff and source reading only, nothing built or run. My approval was onbb66d63c.git range-diffagainstbb66d63c: commits 2-4 are unchanged, 1 and 5 differ by rebase context only (main'srequires_identity_dst_selchecks now sit in the same function).c4e5785ais new (src/startup_stubs/d3d12_draw.inl, +5/-2).c4e5785amoves the identity-mapping refusal ahead ofinput_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 onbb66d63c.Missing before I approve this head:
c4e5785a. The 14/14 is frombb66d63c, before the rebase. PR CI runs neitherstartup_input_view_token*norstartup_compute_mtbuf_window_*(not in theprtest filter); the Linux job runs only the Python reference and controls. Please postctest --preset dev -j 1 -R "^(startup_input_view_token|startup_compute_input_view_token_|startup_compute_dispatch_input_|startup_compute_mtbuf_window_)"onc4e5785a.c4e5785ais not pinned. Intests/startup_compute_mtbuf_window_check.py:128-131theswappedtoken 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
4980038dresults.git merge-tree --write-treeontoorigin/main77d1ba4d: clean.Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T12:55:24Z.
Review of head
c4e5785aagainstmainaf1cab5c(git merge-tree --write-tree --name-only origin/main c4e5785aexits 0). Read only, nothing built or run.Checked:
bb66d63c,input_view_token.h,startup_input_view_token_check.cpp,startup_compute_input_view_token_check.pyand the doc are unchanged.git diff --stat bb66d63c c4e5785a -- <those files>lists none of them. Only the token branch ind3d12_draw.inlwas merged withmain's MTBUF checks, andc4e5785awas added.c4e5785akeepsmain's order for every MTBUF sentence. I agree with the 12:41 reading and won't repeat it.dispatch-input-tokenis a texture view at slot 18, and it still getsan input view token is not a buffer view of a desktop resource, whichtests/startup_compute_dispatch_input_check.py:40expects.indirect_table_bufferserves both the in-process route (the default since #3449) and the published route, so default runs will show the new sentences. Nothingmainbinds is refused here, and nothingmainrefuses 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.c4e5785a(run 46262337849) passes. The Linux job printsstartup_compute_input_view_token reference: 20 shapes, 12 refusal sentences. Windows CI compilesd3d12_draw.inlthroughstartup_stub_consumer→d3d12_xs_shim.MUST
ctest ... -R "^(startup_input_view_token|startup_compute_input_view_token_|startup_compute_dispatch_input_|startup_compute_mtbuf_window_)"onc4e5785a). 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
4980038dresults already noted:dispatch-input-token-samplerintests/startup_stream_consumer.cppcreates a one-entryD3D12_DESCRIPTOR_HEAP_TYPE_SAMPLERheap, and the runtime is not involved.mainbinds 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-typedand-rawfixtures that show it.AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-29T13:02:49Z.
Windows test PC (MSVC,
--preset dev,-j 1), atc4e5785a88b4442fb088e364127d026b86464076: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_warpdid 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 sevenWILL_FAILmutation controls each failed as required (short-srv,short-cbv,wrapper,placement,depth,wrong-kind,bind).startup_compute_dispatch_input_warpand_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,_warpand_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. Theswappedtoken is a buffer view on a valid resource, so that sentence comes out in either order.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T13:35:41Z.
Re-check of head
c4e5785aafter the 13:02 Windows run (read only, on Linux; no build or run here).git merge-tree --write-tree origin/main(17b662a2) c4e5785aexits 0, and CI is green at head.Resolved
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 sevenWILL_FAILmutation controls ofstartup_input_view_token.startup_compute_mtbuf_window_warpwas a capability skip (4-lane WARP wave), not a pass.Still open, not blocking
c4e5785ais still unpinned (theswappedtoken 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.mainbehaviour).0 MUST, mergeable, no change request. Merging.
AI-assisted.