startup: compute entry values from the words of a bound buffer descriptor #2596

Manually merged
github merged 81 commits from gh-pr/2596/head into gh-pr/2596/base 2026-11-27 01:05:50 +00:00
Owner

@⁠NiiRoZz on GitHub · 2026-11-25 22:17 UTC · original
NiiRoZz:startup/compute-dispatch-entry-values → main · +240 −29 · 6 files · 81 commits · merged 2026-11-26 06:15 UTC

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

The branch also merges current main: the compute buffer_store_format_d16_x lowering of #2478 is what emits the output entry values, and the fixture uses its program.

What changed

A translated compute program's manifest can take entry values from the descriptor that a buffer input or output is bound from:

  • formatted loads (buffer_load_format_*): the input's stride and word 3 (udsrc <i> stride <srv>, udsrc <i> descword3 <srv>);
  • formatted stores (buffer_store_format_d16_x on main, buffer_store_format_xyzw in #2530): the output's word 3, the upper half of word 1 and the record count (uav_descword3, uav_stride, uav_numrecords).

Before this change, slot 14 (Dispatch) bound only root-constant entry values. Any other udsrc line left the pipeline untranslated with an entry value that is not a root constant. Now:

  • Each value comes from the descriptor words the same call binds the view from, captured in the existing binding loop. There is no second read of the descriptor.
  • The input stride is the one the draw path's indirect_table_buffer already returns, from a hardware descriptor or from the title's buffer view for a token.
  • The input's word 3 goes through the draw path's formatted-buffer check. That check's per-descriptor body becomes formatted_buffer_word3() in d3d12_draw.inl, and draws and Dispatch now both call it. A token's word is built from its view. A FORMAT the program does not decode refuses the dispatch with a formatted input has no word 3 the program decodes.
  • The output words are passed unmasked. The translated store helper checks the swizzle bits of word 1 itself.
  • A descriptor that is not bound refuses as before, with one reason, and nothing is recorded.
  • An entry value naming a texture slot leaves the pipeline untranslated (an entry value names a descriptor that is not a buffer input or output).
  • Every other source keeps a named refusal, now an entry value that is not a root constant or a buffer descriptor word.

The test consumer gains two optional inputs: X2W_TEST_DISPATCH_IN (input words) and X2W_TEST_DISPATCH_FIELDS (stride, record count and word 3 of both table descriptors). Existing modes are unchanged.

Tests

New tests/startup_compute_dispatch_entry_check.py, registered for WARP and hardware like its neighbours. It dispatches two source-built gfx1013 programs through the stand-in's list and reads the 320 output words back from the aliased memory:

  1. Formatted load (case L of startup_gfx2hlsl_compute_check.py). Stride 6 with word 3 of L-uint, then of L-unorm on the same translation, each match that case's 320 words. A FORMAT the program does not decode is refused with one reason and leaves every word at its sentinel.
  2. buffer_store_format_d16_x (case F of startup_compute_store_d16_x_check.py). Four output descriptors give four different expectations: 32_FLOAT with stride 8 and 12 records, 16_FLOAT with the same, 32_FLOAT with stride 12 and 7 records, and SWIZZLE_ENABLE set in word 1 (translated; the program stores nothing).

Before translation, both programs are refused with no translation.

Controls per entry-value kind:

  • descword3: an undecoded FORMAT is refused; the L-uint and L-unorm words give different read-backs on one translation.
  • stride: implicit only. An ignored or zero stride reads one record in every lane and the L runs fail. No separate mutation was run.
  • uav_descword3: two formats give different read-backs.
  • uav_stride: returning a constant 8 fails the stride-12 run (12 words differ). Masking it to 14 bits, as the draw path does, fails the swizzle run (12 words differ).
  • uav_numrecords: cannot be isolated, because the bound range is sized from the same word. Only a value of zero would show.
.\tools\dev.ps1
cmake --preset dev
cmake --build --preset dev --target startup_stream_consumer
ctest --preset dev --no-tests=error -j1 -R "^startup_compute_dispatch_"
ctest --preset dev --no-tests=error -j1 -R "^startup_formatted_view_draw_"
python -B tests/startup_translator_check.py
python -B tests/startup_gfx2hlsl_compute_check.py
python -B tests/startup_compute_store_d16_x_check.py
python -B tests/docs_links_check.py

Results:

  • ^startup_compute_dispatch_: 10/10 passed (WARP and hardware for all five fixtures), no skips. The new fixture was rerun on both adapters after the swizzle run was added: 2/2 passed.
  • ^startup_formatted_view_draw_: 2/2 passed. This covers the shared word-3 check on the draw side.
  • The four Python checks exit 0.

Environment:

  • WARP: Microsoft Basic Render Driver 10.0.26100.10068.
  • Hardware: NVIDIA GeForce RTX 5090, driver 32.0.16.2135.
  • Windows build 26300.
  • D3D12 debug layer enabled, with no error message in either run.

Measured and hypothesis

Measured: the fixtures above, on two synthetic programs.

Local census, counts only: 29 compute programs had this manifest line as their first refusal, about 1.4 million Dispatch calls in one run. Under the new classifier:

  • 27 pass the manifest loader, about 1.39 million calls, and each has a compiled program. 17 of them, about 0.6 million calls, also need the store of #2530 to translate on main. Every formatted store in the 27 passes a zero soffset.
  • 2 stop at a 1D or a 3D texture input.

Not measured: which bind-time reason the 27 meet next. That needs a run.

Unverified

  • A descriptor word 3 that the translated store helper does not model makes the store a silent no-op inside the program, not a refusal at Dispatch.
  • Input strides from a buffer-view token are covered by the draw path's tests, not by this fixture.
  • A structured store with a nonzero soffset can land past stride * records bytes, outside the bound range, and would be dropped silently. None of the 27 programs does this, and no fixture covers it. The same holds for formatted loads with an soffset.

🤖 Generated with Claude Code

**@⁠NiiRoZz** on GitHub · 2026-11-25 22:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2596) `NiiRoZz:startup/compute-dispatch-entry-values` → `main` · +240 −29 · 6 files · 81 commits · merged 2026-11-26 06:15 UTC Depends on #2580 (stack #2470 -> #2490 -> #2532 -> #2580). Refs #2274. The branch also merges current `main`: the compute `buffer_store_format_d16_x` lowering of #2478 is what emits the output entry values, and the fixture uses its program. ## What changed A translated compute program's manifest can take entry values from the descriptor that a buffer input or output is bound from: - formatted loads (`buffer_load_format_*`): the input's stride and word 3 (`udsrc <i> stride <srv>`, `udsrc <i> descword3 <srv>`); - formatted stores (`buffer_store_format_d16_x` on main, `buffer_store_format_xyzw` in #2530): the output's word 3, the upper half of word 1 and the record count (`uav_descword3`, `uav_stride`, `uav_numrecords`). Before this change, slot 14 (Dispatch) bound only root-constant entry values. Any other `udsrc` line left the pipeline untranslated with `an entry value that is not a root constant`. Now: - Each value comes from the descriptor words the same call binds the view from, captured in the existing binding loop. There is no second read of the descriptor. - The input stride is the one the draw path's `indirect_table_buffer` already returns, from a hardware descriptor or from the title's buffer view for a token. - The input's word 3 goes through the draw path's formatted-buffer check. That check's per-descriptor body becomes `formatted_buffer_word3()` in `d3d12_draw.inl`, and draws and Dispatch now both call it. A token's word is built from its view. A FORMAT the program does not decode refuses the dispatch with `a formatted input has no word 3 the program decodes`. - The output words are passed unmasked. The translated store helper checks the swizzle bits of word 1 itself. - A descriptor that is not bound refuses as before, with one reason, and nothing is recorded. - An entry value naming a texture slot leaves the pipeline untranslated (`an entry value names a descriptor that is not a buffer input or output`). - Every other source keeps a named refusal, now `an entry value that is not a root constant or a buffer descriptor word`. The test consumer gains two optional inputs: `X2W_TEST_DISPATCH_IN` (input words) and `X2W_TEST_DISPATCH_FIELDS` (stride, record count and word 3 of both table descriptors). Existing modes are unchanged. ## Tests New `tests/startup_compute_dispatch_entry_check.py`, registered for WARP and hardware like its neighbours. It dispatches two source-built gfx1013 programs through the stand-in's list and reads the 320 output words back from the aliased memory: 1. **Formatted load (case L of `startup_gfx2hlsl_compute_check.py`).** Stride 6 with word 3 of L-uint, then of L-unorm on the same translation, each match that case's 320 words. A FORMAT the program does not decode is refused with one reason and leaves every word at its sentinel. 2. **`buffer_store_format_d16_x` (case F of `startup_compute_store_d16_x_check.py`).** Four output descriptors give four different expectations: 32_FLOAT with stride 8 and 12 records, 16_FLOAT with the same, 32_FLOAT with stride 12 and 7 records, and SWIZZLE_ENABLE set in word 1 (translated; the program stores nothing). Before translation, both programs are refused with `no translation`. Controls per entry-value kind: - `descword3`: an undecoded FORMAT is refused; the L-uint and L-unorm words give different read-backs on one translation. - `stride`: implicit only. An ignored or zero stride reads one record in every lane and the L runs fail. No separate mutation was run. - `uav_descword3`: two formats give different read-backs. - `uav_stride`: returning a constant 8 fails the stride-12 run (12 words differ). Masking it to 14 bits, as the draw path does, fails the swizzle run (12 words differ). - `uav_numrecords`: cannot be isolated, because the bound range is sized from the same word. Only a value of zero would show. ```powershell .\tools\dev.ps1 cmake --preset dev cmake --build --preset dev --target startup_stream_consumer ctest --preset dev --no-tests=error -j1 -R "^startup_compute_dispatch_" ctest --preset dev --no-tests=error -j1 -R "^startup_formatted_view_draw_" python -B tests/startup_translator_check.py python -B tests/startup_gfx2hlsl_compute_check.py python -B tests/startup_compute_store_d16_x_check.py python -B tests/docs_links_check.py ``` Results: - `^startup_compute_dispatch_`: 10/10 passed (WARP and hardware for all five fixtures), no skips. The new fixture was rerun on both adapters after the swizzle run was added: 2/2 passed. - `^startup_formatted_view_draw_`: 2/2 passed. This covers the shared word-3 check on the draw side. - The four Python checks exit 0. Environment: - WARP: Microsoft Basic Render Driver 10.0.26100.10068. - Hardware: NVIDIA GeForce RTX 5090, driver 32.0.16.2135. - Windows build 26300. - D3D12 debug layer enabled, with no error message in either run. ## Measured and hypothesis **Measured:** the fixtures above, on two synthetic programs. **Local census, counts only:** 29 compute programs had this manifest line as their first refusal, about 1.4 million Dispatch calls in one run. Under the new classifier: - 27 pass the manifest loader, about 1.39 million calls, and each has a compiled program. 17 of them, about 0.6 million calls, also need the store of #2530 to translate on main. Every formatted store in the 27 passes a zero `soffset`. - 2 stop at a 1D or a 3D texture input. **Not measured:** which bind-time reason the 27 meet next. That needs a run. ## Unverified - A descriptor word 3 that the translated store helper does not model makes the store a silent no-op inside the program, not a refusal at Dispatch. - Input strides from a buffer-view token are covered by the draw path's tests, not by this fixture. - A structured store with a nonzero `soffset` can land past `stride * records` bytes, outside the bound range, and would be dropped silently. None of the 27 programs does this, and no fixture covers it. The same holds for formatted loads with an `soffset`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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 #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 #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.
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 #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
gfx2hlsl.py lowers one form of a register-offset load through the directly
indexed resource heap pointer of a compute root signature:

    s_lshl_b32 R, <root constant word>, 5
    s_load_dwordx4 D, s[H:H+1], R      ; s[H+1] a constant zero, no offset:

with no write of R and no branch target in between. D is a buffer descriptor
and the manifest names it `srv <i> buf heap rootconst <parameter> <word>`.
Every other form keeps a refusal that names it, including an index read from
a buffer.

The stand-in records the title memory of the list's view heap on every slot 32
call (it kept only the sampler heap and, for oversized heaps, the wrapper) and
a Dispatch reads the 16-byte descriptor at byte `word << 5` of that memory,
then binds it through the path a table record takes. A record outside the heap
refuses the dispatch and binds nothing.

Checks: tests/startup_gfx2hlsl_heap_record_check.py (manifest and HLSL exact,
19 refused controls, one translator mutation, LLVM 15 reassembly) and
tests/startup_compute_dispatch_heap_check.py on WARP and a physical adapter.

Refs #2274

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The second positive case of startup_gfx2hlsl_heap_record_check.py branched to
the second dword of the two-dword heap load. The case with a branch target
before the shift already covers the form outside the entry block. The
experiments entry now says that WARP's descriptor increment is not 32 bytes.

Refs #2274

Co-Authored-By: Claude Fable 5.2 <[email protected]>
A check added on main calls op_s_load_dwordx8 on a stage built without a
kind; the heap record branch read self.kind directly.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Slot 40 keeps the graphics words of main. The dispatch refuses an entry value no slot 37 or 39 call
wrote since the compute root was set. Controls: both slots feed the readback, missing word, root
changed, same root, list reset, wrong root, one buffer as input and output.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The slot 67 cache owns desktop COM objects until module teardown. During process termination, the driver can already be shut down when static destructors run. Keep normal reference release on explicit unload and skip driver calls only during process termination.

AI-assisted with Codex (GPT-6.2 Astra, xhigh).
sampled_state gives pixel-shader (and depth-read) states, which a compute list rejects at Close.
dispatch-sampled-compute records the sampling fixture on a compute list and queue. The smp manifest
line no longer scans two fields into one variable.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A compute program that reads its heap record index with s_buffer_load from an unmodified table buffer, at a
literal byte offset or at a root constant word times a literal plus a literal (dword-aligned), then shifts it
left by 5 for the heap s_load, is translated: the manifest names the word as
`srv <i> buf heap word table <param> <byte> at <offset> [rootconst <param> <word> times <scale>]`. At Dispatch
the runtime reads that word from the recording's upload memory, where no GPU command writes, and binds the
record it indexes. A word outside the buffer or outside upload memory refuses the dispatch with one reason.
Every other index source keeps the buffer refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	docs/experiments.md
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
list_compute_root cleared compute_srv_bound and recomputed
compute_root_has_arguments twice; the second copy came from the second
#1974 snapshot merge and changed nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	docs/experiments.md
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Three existing checks build a stage on a bare pipe object without it.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A translated compute program's manifest may take entry values from the descriptor a buffer input or output is bound from: the input's stride and word 3 (formatted loads) and the output's word 3, the upper half of word 1 and the record count (formatted stores). Dispatch now takes each from the descriptor words the same call binds the view from; word 3 of an input goes through the draw path's formatted-buffer check, now shared. A FORMAT the program does not decode refuses with one reason; any other source keeps a named refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A store run with SWIZZLE_ENABLE set in the output descriptor must translate and store nothing; masking the stride entry value to 14 bits makes it fail. The docs state the soffset bound the fixture does not cover.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
# Conflicts:
#	docs/experiments.md
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:05:47 +00:00
github manually merged commit 70d95a1d43 into gh-pr/2596/base 2026-11-27 01:05:50 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 22:21 UTC · original · reviewed

Not merging for now: this PR says it depends on #2580 (stack #2470 -> #2490 -> #2532 -> #2580), and all four are still open. The branch also carries 55 commits and touches .github/workflows/windows.yml and AGENTS.md, so it needs a fresh review once the stack lands and the branch is rebased on main.

No code review was done on head 2efebc4c. This comment only records that the merge is blocked by the dependency chain. It also changes the startup compute path, so a source-built regression test plus a negative control will be needed at that point.

AI-assisted; commands listed were executed locally. Commands: gh pr view, python3 merge_check.py 2596.

**@⁠tedin7** on GitHub · 2026-11-25 22:21 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2596#pullrequestreview-6065800486) · **reviewed** Not merging for now: this PR says it depends on #2580 (stack #2470 -> #2490 -> #2532 -> #2580), and all four are still open. The branch also carries 55 commits and touches `.github/workflows/windows.yml` and `AGENTS.md`, so it needs a fresh review once the stack lands and the branch is rebased on main. No code review was done on head 2efebc4c. This comment only records that the merge is blocked by the dependency chain. It also changes the startup compute path, so a source-built regression test plus a negative control will be needed at that point. AI-assisted; commands listed were executed locally. Commands: `gh pr view`, `python3 merge_check.py 2596`.
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-25 23:05 UTC · original

Measured here: 4/4 pass on WARP and the physical GPU, and three mutations of the entry-value extraction are all caught

What I ran

cmake --build --preset dev --target startup_stream_consumer    → exit 0
cmake --build --preset dev --target offscreen_check            → exit 0

ctest --preset dev -R 'compute_dispatch_(entry|heap_word)'
    1005 startup_compute_dispatch_heap_word_warp .......  Passed   2.87 s
    1006 startup_compute_dispatch_entry_warp ...........  Passed   4.30 s
    1012 startup_compute_dispatch_heap_word_hardware ...  Passed   5.46 s
    1013 startup_compute_dispatch_entry_hardware .......  Passed   8.82 s
    100% tests passed, 0 failed out of 4

The two device-free checks also pass unchanged:

startup_gfx2hlsl_heap_record_check.py  → PASS (19 refused controls)
startup_gfx2hlsl_heap_word_check.py    → PASS (6 more forms; 10 refused controls)

So the headline claim — an entry value named from the words of a resource heap record, bound at dispatch — is measured on
both backends, not just asserted.

Three mutations of the entry-value extraction (d3d12_compute_dispatch.inl:338)

mutation caught
input_word3 reads word[2] instead of word[3] caught
output_stride stops shifting (view.words[1] >> 16 → view.words[1]) caught
the formatted-input refusal removed (if (formatted_buffer_word3(…)) → if (false)) caught

The first two are the ones that would be silent in production: input_word3 copies the four descriptor words and hands
word[3] to the program as a constant, and output_stride takes words[1] >> 16 deliberately unmasked (the comment
says the program checks the swizzle bits itself). Off by one word, or unmasked, and the dispatch binds a plausible wrong
number with nothing to show for it — both are caught.

The third is the refusal side: a formatted buffer has no word 3 the program can decode, so it must be refused by name.
Removing the refusal changes the classification, and the entry check notices.

A correction about my own run, because it changes what the first result meant

My first pass used cmake --build --preset dev --target startup_compute_dispatch_entry and reported three survivors —
but the build failed (build=False) every time, because startup_compute_dispatch_entry is the ctest case name, not a
CMake target. ctest then ran the stale binary and passed, so those three rows were measuring the unmutated code. ctest -N -V shows the real command: startup_compute_dispatch_entry_check.py <startup_stream_consumer.exe> <dxc> warp. Re-run
against the correct target, all three are caught as shown above.

I have hit this same trap before in this repository with mesh_xmem, startup_address_srv and
startup_list_copy_texture_warp; the rule that works is "ctest -N -V first, mutate second".

AI-assisted; Windows 11 build 26300, WARP plus the installed physical GPU (Intel Arc 140T, driver 32.0.101.8132), MSVC x64
via the Build Tools dev shell, DXC 10.0.26100.0. Each mutation rebuilt startup_stream_consumer, ran both entry cases,
reverted and rebuilt; final state 2/2 green.

**@⁠ChazY11** on GitHub · 2026-11-25 23:05 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2596#issuecomment-7177127572) ## Measured here: 4/4 pass on WARP **and** the physical GPU, and three mutations of the entry-value extraction are all caught ### What I ran ```text cmake --build --preset dev --target startup_stream_consumer → exit 0 cmake --build --preset dev --target offscreen_check → exit 0 ctest --preset dev -R 'compute_dispatch_(entry|heap_word)' 1005 startup_compute_dispatch_heap_word_warp ....... Passed 2.87 s 1006 startup_compute_dispatch_entry_warp ........... Passed 4.30 s 1012 startup_compute_dispatch_heap_word_hardware ... Passed 5.46 s 1013 startup_compute_dispatch_entry_hardware ....... Passed 8.82 s 100% tests passed, 0 failed out of 4 ``` The two device-free checks also pass unchanged: ```text startup_gfx2hlsl_heap_record_check.py → PASS (19 refused controls) startup_gfx2hlsl_heap_word_check.py → PASS (6 more forms; 10 refused controls) ``` So the headline claim — an entry value named from the words of a resource heap record, bound at dispatch — is measured on both backends, not just asserted. ### Three mutations of the entry-value extraction (`d3d12_compute_dispatch.inl:338`) | mutation | caught | |---|---| | `input_word3` reads `word[2]` instead of `word[3]` | **caught** | | `output_stride` stops shifting (`view.words[1] >> 16` → `view.words[1]`) | **caught** | | the formatted-input refusal removed (`if (formatted_buffer_word3(…))` → `if (false)`) | **caught** | The first two are the ones that would be silent in production: `input_word3` copies the four descriptor words and hands `word[3]` to the program as a constant, and `output_stride` takes `words[1] >> 16` deliberately **unmasked** (the comment says the program checks the swizzle bits itself). Off by one word, or unmasked, and the dispatch binds a plausible wrong number with nothing to show for it — both are caught. The third is the refusal side: a formatted buffer has no word 3 the program can decode, so it must be refused by name. Removing the refusal changes the *classification*, and the entry check notices. ### A correction about my own run, because it changes what the first result meant My first pass used `cmake --build --preset dev --target startup_compute_dispatch_entry` and reported **three survivors** — but the build failed (`build=False`) every time, because `startup_compute_dispatch_entry` is the **ctest case name**, not a CMake target. ctest then ran the *stale* binary and passed, so those three rows were measuring the unmutated code. `ctest -N -V` shows the real command: `startup_compute_dispatch_entry_check.py <startup_stream_consumer.exe> <dxc> warp`. Re-run against the correct target, all three are caught as shown above. I have hit this same trap before in this repository with `mesh_xmem`, `startup_address_srv` and `startup_list_copy_texture_warp`; the rule that works is "`ctest -N -V` first, mutate second". AI-assisted; Windows 11 build 26300, WARP plus the installed physical GPU (Intel Arc 140T, driver 32.0.101.8132), MSVC x64 via the Build Tools dev shell, DXC 10.0.26100.0. Each mutation rebuilt `startup_stream_consumer`, ran both entry cases, reverted and rebuilt; final state 2/2 green.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-26 06:06 UTC · original

Merged main into this branch (the branch still carried the commits of #2580, which main now has as one squash, so the conflicts were duplicates; I applied only this PR's own changes on top of main: CMakeLists.txt, docs/experiments.md, d3d12_compute_dispatch.inl, d3d12_draw.inl, startup_compute_dispatch_entry_check.py, startup_stream_consumer.cpp). No AGENTS.md or gfx2hlsl.py change remains in the diff.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) on this content (original head b6665da6 plus the merge as a patch):

  • Dev (--preset dev): ctest -R '^(startup_compute_dispatch_entry_warp|startup_compute_dispatch_warp|startup_compute_dispatch_texture_warp|startup_compute_dispatch_heap_warp|startup_compute_dispatch_heap_word_warp|startup_compute_live_retry_warp)$' -> 100% tests passed out of 6
  • Release (--preset release): same regex -> 100% tests passed out of 6
  • Tests that ran by name: startup_compute_dispatch_entry_warp (new), startup_compute_dispatch_warp, startup_compute_dispatch_texture_warp, startup_compute_dispatch_heap_warp, startup_compute_dispatch_heap_word_warp, startup_compute_live_retry_warp.
  • RTX 3090: not available (pod full).

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 06:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2596#issuecomment-7184104091) Merged main into this branch (the branch still carried the commits of #2580, which main now has as one squash, so the conflicts were duplicates; I applied only this PR's own changes on top of main: `CMakeLists.txt`, `docs/experiments.md`, `d3d12_compute_dispatch.inl`, `d3d12_draw.inl`, `startup_compute_dispatch_entry_check.py`, `startup_stream_consumer.cpp`). No `AGENTS.md` or `gfx2hlsl.py` change remains in the diff. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) on this content (original head `b6665da6` plus the merge as a patch): - Dev (`--preset dev`): `ctest -R '^(startup_compute_dispatch_entry_warp|startup_compute_dispatch_warp|startup_compute_dispatch_texture_warp|startup_compute_dispatch_heap_warp|startup_compute_dispatch_heap_word_warp|startup_compute_live_retry_warp)$'` -> 100% tests passed out of 6 - Release (`--preset release`): same regex -> 100% tests passed out of 6 - Tests that ran by name: `startup_compute_dispatch_entry_warp` (new), `startup_compute_dispatch_warp`, `startup_compute_dispatch_texture_warp`, `startup_compute_dispatch_heap_warp`, `startup_compute_dispatch_heap_word_warp`, `startup_compute_live_retry_warp`. - RTX 3090: not available (pod full). AI-assisted; commands listed were executed locally.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-26 06:15 UTC · original

I checked that your 70d95a1d merge has the identical Git tree as my independent conflict resolution, so I left your branch as-is. A fresh Windows 11 build 26200 Release build of startup_stream_consumer ran ctest --preset release --no-tests=error -j 1 -R '^startup_compute_dispatch_(entry|heap_word)_(warp|hardware)$' -V. All four tests passed on in-box WARP and RTX 4060 Laptop, with no skips. Each entry test matched six descriptor-word dispatches and kept output untouched for the refused formatted-input case. Both adjacent tests matched all 320 words and retained the three refusal controls.

**@⁠R0Y00** on GitHub · 2026-11-26 06:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2596#issuecomment-7184249877) I checked that your 70d95a1d merge has the identical Git tree as my independent conflict resolution, so I left your branch as-is. A fresh Windows 11 build 26200 Release build of startup_stream_consumer ran ctest --preset release --no-tests=error -j 1 -R '^startup_compute_dispatch_(entry|heap_word)_(warp|hardware)$' -V. All four tests passed on in-box WARP and RTX 4060 Laptop, with no skips. Each entry test matched six descriptor-word dispatches and kept output untouched for the refused formatted-input case. Both adjacent tests matched all 320 words and retained the three refusal controls.
Author
Owner

@⁠MasterDomino on GitHub · 2026-11-26 06:25 UTC · original

@⁠NiiRoZz: since this merge (c8b7b973), tests/startup_vertex_fetch_formats_check.py stops at its source gate: AssertionError: formatted_buffer_supported(. The parent c458bba9 runs the check cleanly. That makes startup_vertex_fetch_formats_controls, _warp and _hardware fail on main.

The cause: this PR moved the formatted_buffer_supported( check out of the draw preflight in d3d12_draw.inl into the shared formatted-buffer helper, but the check's runtime_gate still looks for that text in the draw preflight (startup_vertex_fetch_formats_check.py:415 and :428). It's a stale text gate, not a runtime bug. Pointing the gate at the shared helper, or at its call site, should fix it.

Found while reviewing #2006, whose format-50 readback can't be re-confirmed on a merge with main until this is fixed.

AI-assisted; commands listed were executed locally.

**@⁠MasterDomino** on GitHub · 2026-11-26 06:25 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2596#issuecomment-7184410955) @⁠NiiRoZz: since this merge (`c8b7b973`), `tests/startup_vertex_fetch_formats_check.py` stops at its source gate: `AssertionError: formatted_buffer_supported(`. The parent `c458bba9` runs the check cleanly. That makes `startup_vertex_fetch_formats_controls`, `_warp` and `_hardware` fail on `main`. The cause: this PR moved the `formatted_buffer_supported(` check out of the draw preflight in `d3d12_draw.inl` into the shared formatted-buffer helper, but the check's `runtime_gate` still looks for that text in the draw preflight (`startup_vertex_fetch_formats_check.py:415` and `:428`). It's a stale text gate, not a runtime bug. Pointing the gate at the shared helper, or at its call site, should fix it. Found while reviewing #2006, whose format-50 readback can't be re-confirmed on a merge with `main` until this is fixed. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.