Skip to content

runtime: name each refused condition of a compute output buffer - #3229

Merged
R0Y00 merged 6 commits into
R0Y00:mainfrom
Not-Saii:startup/compute-output-reasons
Nov 28, 2026
Merged

R0Y00 merged 6 commits into
R0Y00:mainfrom
Not-Saii:startup/compute-output-reasons

Conversation

@Not-Saii

@Not-Saii Not-Saii commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Change

The compute Dispatch refusal an output is not an aliased placed buffer range with unordered access covered several conditions. Each one now has its own reason in the refusal log line and the census. They are checked in this order:

  1. an output buffer descriptor is a view token
  2. an output buffer descriptor has zero records
  3. an output buffer range is over 16 MiB or not whole dwords
  4. an output range crosses the end of a placed buffer
  5. an output is in title memory outside any placed buffer
  6. an output is in a placed buffer that does not alias title memory (a copied placement)
  7. an output buffer's resource was not created in the common state
  8. an output buffer range is not 16-byte aligned in its resource
  9. an output buffer has no unordered access

What is bound and what is refused do not change. The claim listed five conditions; "no placed buffer aliases the address" is split into reasons 2 to 6, because the input-side split showed one such sub-case can dominate. Reason 7 also covers an aliased resource with no recorded information, which no fixture reaches.

Output view tokens are not lowered here. #2961 binds buffer UAV tokens before these checks, so with it reason 1 is not reached. Both PRs edit the same placed line. Whichever lands second drops the token test from that line, and the texture-token case here then refuses with #2961's token reason. The fixture mode is named dispatch-output-texture-token so it does not clash with #2961's dispatch-output-token.

Tests

tests/startup_compute_dispatch_output_check.py (new, registered in tests/cmake/startup_compute_dispatch_output.cmake) dispatches case A through the stand-in's list. The unchanged recording matches all 320 words. Then each of the nine conditions is produced by one change to the output descriptor or its buffer: five new consumer modes, three X2W_TEST_DISPATCH_FIELDS values, and the existing dispatch-swapped. Each case checks its refusal line, the census reason line and that every output word keeps its sentinel. The common-state case also checks that the slot 133 log shows its buffer as aliased.

startup_compute_dispatch_check.py now expects an output buffer has no unordered access for dispatch-swapped.

Test WARP RTX 4090
startup_compute_dispatch pass pass
startup_compute_dispatch_output pass pass
startup_compute_dispatch_input pass not run

The debug layer was enabled and reported no errors.

Negative control: with only the d3d12_compute_dispatch.inl change reverted (local, restored), both tests fail. Run one by one against that build, all nine cases are still refused, each with the old message, and the output stays untouched, so 9/9 per-reason expectations fail. The unchanged dispatch still matches, so the same cases are refused before and after.

A texture view created at heap byte 16, which is not a whole descriptor slot, ends the consumer with exit 2173. The fixture creates the view at byte 64 and copies its token words into the output's entry. I did not investigate that exit; it is existing behavior.

Commands

cmake --build --preset dev --target startup_stream_consumer
ctest --preset dev --no-tests=error -R "^startup_compute_dispatch(_output)?_(warp|hardware)$" -V
ctest --preset dev --no-tests=error -R "^startup_compute_dispatch_input_warp$" -V

tests/docs_links_check.py and tests/bidi_controls_check.py pass.

Environment

Tested at b732c44b on main ad306425; the last commit only adds results to the note. Windows 11 build 26300, MSVC (dev preset, Debug), Windows SDK 10.0.26100, DXC from that SDK. WARP 10.0.26100.9818. NVIDIA GeForce RTX 4090, driver 32.0.16.1088.

Measurement

Counts only, from one local 300 s start-up run of this build (79edac55; translator at ad306425, whose gfx2hlsl.py is unchanged since 2e12dd8e). The census keeps each key's first refusal and counts all of its untranslated dispatches under it, so these are first-refusal buckets, not counts per condition. The 25 keys whose first refusal was the old reason in a run of the parent build (505,473 of 5,490,863 compute dispatches) fall in two buckets here. For 23 keys (141,224 dispatches) the first refusal is a view token, and in each key's first refused dispatch the token names a device slot 19 view. For 2 keys (2,015 dispatches) the first refusal is zero records, with an all-zero descriptor. No key had reasons 3 to 9 as its first refusal; later dispatches were not recorded per condition. A second run with #2961 merged locally translates every dispatch of 12 of the 23 token keys. 10 have as first refusal an entry value that reads the output descriptor, and 1 has its view range as first refusal. Details are in the note and on #3224, and no second implementation PR follows from these counts.

Refs #3224

AI-assisted.

🤖 Generated with Claude Code

Not-Saii and others added 4 commits November 28, 2026 01:57
The refusal "an output is not an aliased placed buffer range with unordered
access" covered nine conditions. Each now has its own reason in the log and
the census: a view token, zero records, a range over 16 MiB or not whole
dwords, a range crossing a placed buffer's end, memory outside any placed
buffer, a copied placement, a resource not created in the common state, an
offset not 16-byte aligned, and no unordered access. What is bound and what
is refused do not change.

tests/startup_compute_dispatch_output_check.py produces each condition on
case A and checks its reason, the census line and an untouched output.
dispatch-swapped now expects "an output buffer has no unordered access".

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Creating the view at heap byte 16, which is not a descriptor of the heap,
ends the consumer; the view is created at byte 64 and its token words copied.

AI-assisted.

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

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

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

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

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed de0303d. Its runtime and test files match the independently tested candidate: Debug and Release /O2 each passed all six dispatch, output and input tests on WARP and RTX 4060 Laptop, with no skips. The runtime split is scoped to diagnostics.

Please correct the claim that a startup run “gives the count of every condition” and the interpretation of the two tables. The census records the first refusal once per key (d3d12_compute_dispatch.inl:609–612) and attributes all untranslated invocations of that key to that bucket (713–717). Later invocations can hit different conditions, and the detailed lines are capped. Please label these as first-refusal buckets and qualify zero rows as “no key had this first refusal.” The synthetic nine-way controls can keep their exact per-case statements because each exercises one condition. The PR can keep its current runtime scope.

The census keeps one first refusal per key and counts all of the key's
untranslated dispatches under it, so the run tables are first-refusal
buckets, not counts per condition.

AI-assisted.

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

Copy link
Copy Markdown
Contributor Author

Thanks, you're right: the census keeps one first refusal per key and counts every untranslated dispatch of that key under it. Fixed in 797954e:

  • The note no longer says a run "gives the count of every condition". It describes the census as first-refusal buckets, and says a later dispatch of a key can fail on another condition and that the per-call lines are capped.
  • Both tables are labelled as first-refusal buckets with untranslated dispatches. The zero row now reads "no key had one of these first refusals".
  • Statements about the token slot and the all-zero descriptor now refer to each key's first refused dispatch.
  • The synthetic per-case statements are unchanged.

I updated the PR body's Measurement section and both counts comments on #3224 the same way. The runtime scope is unchanged.

AI-assisted.

@Not-Saii
Not-Saii requested a review from R0Y00 November 28, 2026 00:52

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The requested census wording is resolved at 797954e. The tables distinguish first-refusal buckets from individual dispatches and now limit observations to the first refused dispatch per key. The diagnostic split and nine source-built controls are unchanged.

Independently tested this head over main 7364e6a, candidate tree 4aab644fee01b27113baf6e3925fdae25c8be3a4. Debug and Release /O2 each passed all six dispatch, input and output tests on WARP and RTX, zero skips. The unchanged reference compares 320 words; each refusal preserves every sentinel. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656, WARP 10.0.26100.9818.

ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^startup_compute_dispatch(_output|_input)?_(warp|hardware)$'

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.

2 participants