Skip to content

startup: name the condition a compute buffer input failed instead of one refusal - #2624

Merged
tedin7 merged 79 commits into
R0Y00:mainfrom
NiiRoZz:startup/compute-dispatch-input-ranges
Nov 26, 2026
Merged

tedin7 merged 79 commits into
R0Y00:mainfrom
NiiRoZz:startup/compute-dispatch-input-ranges

Conversation

@NiiRoZz

@NiiRoZz NiiRoZz commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Depends on #2580 (stacked on #2470 -> #2490 -> #2532 -> #2580). Refs #2274.

What and why

A translated compute Dispatch whose raw buffer input did not resolve was refused with one reason, an input is not a complete GPU-backed buffer range. In one local run that reason covered 18 program keys and 1,143,787 calls, the second largest runtime refusal, and the log could not say which condition failed.

This change only names the condition. indirect_table_buffer takes an optional why out-parameter and sets it on every empty result; the compute Dispatch passes it and uses it as the refusal reason. The draw callers do not pass it; their results are unchanged (the indirect draw fixtures pass, see Tests). Reasons:

  • an input buffer descriptor has zero records
  • an input buffer range is over 16 MiB or not whole dwords
  • an input range crosses the end of a placed buffer
  • an input range crosses the end of its upload allocation
  • an input is in title memory outside any placed buffer
  • an input is in a placed buffer that does not alias title memory
  • an input view token is not a buffer view of a desktop resource
  • an input buffer view has no element size or overflows
  • an input buffer view token names the list's upload memory
  • an input buffer view token's resource does not hold its range
  • an input buffer view token's resource is not on a default or upload heap
  • an input buffer descriptor has a null address
  • an input buffer range is not 16-byte aligned in its resource
  • an input buffer's resource is released
  • an input buffer's resource was not created in the common state
  • an input buffer's resource is on another device
  • an input range is outside its desktop buffer

The first refusal of each key also logs one line with the input index, its table or heap source and the descriptor address (x2w-draw compute <key> first refused input <i> (table|heap <a> <b>), descriptor at <address>). The line does not contain refused: , so the per-call refusal lines and the census format are unchanged.

No form is newly bound. What was bound is still bound and what was refused is still refused.

What the existing log shows (local observation, counts only)

The census keeps the four descriptor words of each key's first refused call:

form (from the words) keys calls
zero records (nonzero base, no stride, word 3 zero) 1 1,057,520
raw descriptor inside a placed buffer that fell back to a separate desktop copy (cause inferred from the creation log: base offset not 64 KiB aligned, or one buffer over several memory pieces) 11 31,649
shader resource view token; failing condition not in the log 6 54,618

Hypotheses this change lets the next run settle:

  • Which of the five inputs of the zero-record key fails, and whether the record is one the title wrote or memory the stand-in never filled. The words are not shaped like the title's other buffer descriptors (word 3 is 0). On the hardware a load from a zero-record descriptor with its bounds check on (OOB_SELECT not 2) reads 0, so a null raw view would read the same. That is not bound here until the run shows where the record comes from.
  • Which condition the six view-token keys fail.
  • The words describe each key's first refused call only. Later calls of the same key are not shown to fail the same way.

#2218 (open, opt-in) owns backing slot 133 buffers the desktop cannot alias and overlaps the second form, so this PR does not add a copy for it. Whether its scope covers these keys is not checked: most of them sit in one buffer created with unordered access.

Tests

New tests/startup_compute_dispatch_input_check.py, registered as startup_compute_dispatch_input_{warp,hardware}. It runs case A through the stand-in's list. The unchanged recording matches all 320 output words. Then five input descriptors are replaced, and each Dispatch is refused with its own reason and one input line, and every output word keeps its sentinel:

  • zero records (synthetic: nonzero base, word 3 zero);
  • 16 bytes past the placed input;
  • memory between the placed buffers;
  • a buffer placed at an offset the desktop cannot alias;
  • the token of a texture view.

There is no new positive read-back because no form is newly bound. The existing dispatch tests, which pass unchanged, are the evidence that nothing changed.

.\tools\dev.ps1
cmake --preset dev
cmake --build --preset dev
ctest --preset dev --no-tests=error -j1 -R "^startup_compute_dispatch_"

Result: 10 of 10 passed, 0 skipped, 0 failed: startup_compute_dispatch, _texture, _heap, _heap_word and the new _input, each on WARP and on hardware. The debug layer was enabled and logged no error message in every run.

  • WARP: Microsoft Basic Render Driver, driver 10.0.26100.10068
  • Hardware: NVIDIA GeForce RTX 5090, driver 32.0.16.2135
  • Windows build 26300

indirect_table_buffer is shared with the indirect draw paths, so those fixtures ran too: ctest --preset dev --no-tests=error -j1 -R "^startup_(indirect_|compute_dispatch_input_)" passed 72 of 72 (WARP and hardware), 0 skipped. tests/docs_links_check.py and tests/bidi_controls_check.py pass.

Unverified

  • The table above is decoded from words of an earlier run. A later local run with this change (other changes present too, so the key set differs) reported as first refusals: view token's resource does not hold its range 4 keys / 1,012,151 calls; placed buffer that does not alias title memory 36 / 719,280; view token not a buffer view of a desktop resource 3 / 67,923; zero records 2 / 9,217; title memory outside any placed buffer 1 / 7,658.
  • Nothing here shows that any title starts or runs.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

tedin7 and others added 30 commits November 24, 2026 19:53
…33 and 35)

Header-only state in list_compute_root.h with a Linux-testable check. Dispatch (slot 14) is not handled here; the state is exposed through ready() and table() for it. Refs R0Y00#870.
Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them.
Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.
…t against the bound root

Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused.
Compute root constants are kept per list next to the graphics ones, in a shared 16 x 8 word store that refuses parameter >= 16 and offset >= 8. A new compute root signature clears them.
Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.
…t against the bound root

Slot 43 clears a parameter's binding when a replacement is rejected, slot 33 clears all bindings, and the compute pipeline records its root so a mismatched pair is refused.
Conflicts in d3d12_xs_device.cpp and docs/experiments.md resolved by keeping both sides: the pipeline root
out-parameter of the stream builder next to the cached-mesh root, the bound root SRV mask next to the recorded
upload SRV addresses, and both table entries and document sections.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Conflicts in d3d12_draw.inl and d3d12_xs_device.cpp resolved by keeping both sides: graphics root constants
go through the shared store and still mark the words a slot 40 call set.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A device slot 67 placeholder keeps the key of its published request. At
list slot 14 the stand-in loads the stage cs manifest and compiled
program for that key and records the dispatch: raw buffer inputs and
outputs from hardware descriptors in the recorded compute tables, entry
values from the recorded compute root constants. Other manifest lines
leave the pipeline untranslated; a dispatch that cannot be bound
completely is refused with one logged reason and records nothing.

startup_compute_dispatch_{warp,hardware} drives a source-built program
through the stand-in list and reads the output back, with controls
before translation, without a Dispatch and for a refused output.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Dispatches that arrive before the offline translation no longer use up
the lines kept for refusals at bind time.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The per-call refusal lines share one small budget, so a run cannot rank
keys by dispatch count. Each key now keeps its Dispatch count, the calls
recorded and the reason and table descriptor of its first refusal; the
periodic totals are followed by the refused dispatches per reason and the
40 keys with the most dispatches. A manifest that exists but cannot be
bound is counted apart from an absent one ("not modelled").

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A `uav <i> tex2d float table <param> <byte> channels 4` manifest line is
bound from the token of the unordered access view the title created in
its descriptor memory. Everything else is refused with its own reason: an
entry that is no such token, a view the desktop did not create, a view
that is not 2D, a format a float4 store cannot target, and a texture
bound to two slots of one dispatch. Programs without entry values, inputs
or outputs load too: the translated root no longer emits an empty range
or drops the table when only outputs exist.

The fixture stores through the stand-in's own list into a 32x8
RGBA16_FLOAT texture and reads it back with CopyTextureRegion.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A `srv <i> tex2d table <param> <byte>` manifest line is bound from the
token of the shader resource view the title created, through the texture
the draw path samples for that resource, uploaded first when the title
filled it in memory. `smp` lines become static samplers of the translated
root. A dispatch is refused, never bound to a null view, when the entry
is no such token, the resource has no desktop texture, the view is not 2D
or names a packed format, or the upload fails. Sampler heaps, comparison
samplers and other texture kinds keep the translation unavailable.

The fixture samples a 1x1 texture into the stored words of the raw buffer
case; without a view the dispatch is refused and the output is untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s test

The device check drains the debug layer; a draw runs it on every 64th call
and the queue's execute drains the rest. A view token whose resource the
caller released is the caller's misuse, as on the draw path.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…puts, print every census key

A texture is refused only when the same call reads and writes it; two
outputs of one texture share the unordered access state. A packed output
view format gets its own refusal reason. The census prints every
dispatched key instead of the first 40, and the wording on refused calls
says what may already be recorded (an input texture upload).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NiiRoZz and others added 11 commits November 25, 2026 23:50
Upstream now records the compute root and tables (slots 33 and 35) and has its own
DllMain with x2w_startup::d3d12_process_terminating, so this branch's flag and DllMain go.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…tch-translated

# Conflicts:
#	docs/experiments.md
… into startup/compute-dispatch-heap-rootconst
…ndex' into startup/compute-dispatch-input-ranges
NiiRoZz and others added 8 commits November 26, 2026 01:05
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Not merging yet: this PR is stacked on #2470 -> #2490, and both are still open. #2532 and #2580 of the chain are merged now.

What I checked (no merge, no push):

Next step: land #2470 and #2490 first, then update this branch with main (keep both sides) and run the review and the Win2025 tests on what is left of the diff.

AI-assisted; commands listed were executed locally.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Review and test receipt for #2624.

Dependency: #2470 and #2490 are in main through #2532 and #2580. After merging origin/main, the diff against main is only this PR's 6 files (CMakeLists.txt, docs/experiments.md, d3d12_compute_dispatch.inl, d3d12_draw.inl, startup_compute_dispatch_input_check.py, startup_stream_consumer.cpp).

Review of the remaining diff:

  • Every empty result of indirect_table_buffer now sets a named reason; the compute Dispatch passes &reason, the draw callers do not, so their results are unchanged.
  • startup_compute_dispatch_input_{warp,hardware} checks five refusal reasons one by one (empty, past, unplaced, copied, token): exact reason text, no output word written, input unchanged, one first refused input line.
  • Merge conflicts with main were resolved keeping both sides (CMake test registration, the consumer test modes).

Verification (Win2025 WARP, patched on the PR head merged with main, --regex '^startup_compute_(dispatch|live_retry)(_[a-z_]+)?_warp$'):

  • dev: 100% tests passed out of 7 (dispatch, dispatch_texture, dispatch_heap, dispatch_heap_word, dispatch_input, dispatch_entry, live_retry).
  • release: 100% tests passed out of 7 (same tests).
  • Linux: python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py pass; git diff --check clean.
  • RTX 3090: not available (pod full / script failed); not a result of this PR.

The live head f483a34 differs from the tested tree only in how the two tests are listed in set_tests_properties.

AI-assisted; commands listed were executed locally.

@tedin7
tedin7 enabled auto-merge (squash) November 26, 2026 06:24
@tedin7
tedin7 merged commit 97265a9 into R0Y00:main Nov 26, 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