startup: compute input named by a resource heap record a root constant indexes #2532

Manually merged
github merged 60 commits from gh-pr/2532/head into gh-pr/2532/base 2026-11-27 01:00:07 +00:00
Owner

@⁠NiiRoZz on GitHub · 2026-11-25 20:10 UTC · original
NiiRoZz:startup/compute-dispatch-heap-rootconst → main · +1429 −11 · 14 files · 60 commits · merged 2026-11-26 02:16 UTC

Depends on #2490 (compute dispatch with textures and census; this branch is stacked on it). Refs #2274

What changes

One behaviour: a compute program may take a buffer input from the directly indexed resource heap (root flag 0x400) when the record index is a root constant.

Translator (tools/startup/gfx2hlsl.py) lowers exactly this form:

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

with no write of R and no branch target between the two. D becomes a buffer descriptor and the manifest names it

srv <i> buf heap rootconst <parameter> <word>

Everything else through the heap pointer keeps a refusal that names the form:

form refusal
index read from a buffer (s_buffer_load_* then << 5) s_load of a resource heap record whose index is read from a buffer
other shift, other index, index register written again, branch target in between, unshifted register, m0 ... whose offset is not a root constant shifted left by 5 since the last branch target
eight dwords (an image record) ... of 8 dwords
offset: modifier ... with offset:0x..
high word of the pointer pair not a constant zero ... through a pointer whose high word is not a constant zero
formatted load, store, or a non-buffer kind through such a record refused as before / in the manifest
graphics stages unchanged (s_load with a register offset through ('resheap',))

Dispatch (src/startup_stubs)

  • The list's view heap was not recorded in the general case: slot 32 kept the sampler source and, only for a heap with more logical than physical entries, the heap wrapper. Slot 32 now also records the title memory of the view heap it is given (Pass::title_view_heap, a ViewTable built with resolve_view_table, set and replaced where title_samplers is).
  • srv <i> buf heap rootconst <p> <w> is parsed into the existing slot list. At Dispatch the record address is title_view_heap.record(uint32(word(p, w)) << 5, 16); from there the descriptor is read and bound by the code a table <p> <byte> record uses. No second binding path.
  • A record outside the heap refuses the dispatch with a heap record is outside the list's view heap, before anything is bound, like the other refusals in that loop.

Tests

Commit under test: b6bc3c30 (two commits on f67f80a4, the head of #2490; the second only drops one fixture case and adds a sentence to the docs, and the runtime sources are those of f5c3c857, which the dispatch runs below were built from). Windows 10.0.26300, MSVC 14.44, LLVM 15 llvm-mc.

python -B tests/startup_gfx2hlsl_heap_record_check.py --llvm-mc llvm-mc-15

Result: heap record fixture: 45 instructions reassembled to the recorded words, then PASS (manifest and HLSL exact; 19 refused controls; graphics, manifest and translator-mutation checks). Expected: the same.

  • The manifest and the HLSL from the bindings to the end of main are compared whole.
  • 19 controls each change one thing in the program and must be refused with the reason in the table above.
  • Translator mutation: with the write tracking disabled for one instruction, the "index register written again" control translates; the check requires that, then requires the refusal again with the tracking restored.
cmake --build --preset dev --target startup_stream_consumer
ctest --preset dev --no-tests=error -R "^startup_compute_dispatch_|^startup_gfx2hlsl_heap_record$" -V

Result: 7 of 7 passed, no capability skip.

test adapter driver debug layer result
startup_gfx2hlsl_heap_record none pass
startup_compute_dispatch_warp Microsoft Basic Render Driver 10.0.26100.10068 enabled, no error message pass
startup_compute_dispatch_texture_warp Microsoft Basic Render Driver 10.0.26100.10068 enabled, no error message pass
startup_compute_dispatch_heap_warp (new) Microsoft Basic Render Driver 10.0.26100.10068 enabled, no error message pass
startup_compute_dispatch_hardware NVIDIA GeForce RTX 5090 32.0.16.2135 enabled, no error message pass
startup_compute_dispatch_texture_hardware NVIDIA GeForce RTX 5090 32.0.16.2135 enabled, no error message pass
startup_compute_dispatch_heap_hardware (new) NVIDIA GeForce RTX 5090 32.0.16.2135 enabled, no error message pass

The new dispatch test runs a source-built gfx1013 program (case A of startup_gfx2hlsl_compute_check.py with its input loaded from the heap) through the stand-in's list. The input descriptor is only in heap record 2; records 0 and 1 hold the output's descriptor. All 320 output words are read back from the aliased memory and compared.

Negative controls of the dispatch test:

  • before translation: refused: no translation, every word keeps its sentinel;
  • root constant 0x07ffffff (a record past the heap): one refused: a heap record is outside the list's view heap, the census names that reason, every word keeps its sentinel and the input is unchanged;
  • runtime mutations, each rebuilt and run once on WARP, then reverted: shift by 4 instead of 5, and index ignored. Both failed the test with word=0 got=c5c5c5c5 expected=ea74e376 (288 words differ) and refused: an output buffer is also an input.

Wider groups, same build: ctest --preset dev --no-tests=error -R "^startup_compute_|^startup_stream_|^startup_gfx2hlsl_heap_record$": 63 of 63 passed (61 in one run; the two startup_stream_depth_* tests passed once their executable was built), no capability skip.

Pure-Python checks: every check listed in AGENTS.md plus every tests/startup_gfx2hlsl_*_check.py and tests/startup_translator_check.py, each run with no argument: 152 exit 0, 1 exit 77 (startup_run_sh_check.py, a POSIX launcher check that skips on Windows; not a pass). git diff --check is clean.

Measured and not measured

Measured:

  • the translation and the dispatch of one synthetic program, on WARP and one physical adapter;
  • in a local set of 184 compute programs that hold a register-offset load through the heap pointer: every such load now lowers in 4 programs; 151 programs hold a load whose index is read from a buffer and 57 hold a load with another unmodelled offset (a program can hold both). None of the 184 translates with this change: the 4 stop at other instructions (s_pack_ll_b32_b16 in 3 of them, then v_fma_mix_f32, an SDWA v_cndmask_b32, buffer_store_format_xyzw and others).

Not measured, or a hypothesis:

  • no real program reaches a Dispatch through this path yet, so nothing is claimed about frames or startup;
  • the record offset is a literal byte offset into the title's heap memory, as a table offset is. The fixture writes its descriptors at those bytes itself. A caller that places records by the adapter's descriptor increment on an adapter whose increment is not 32 bytes is not covered (WARP is such an adapter, so its run covers the literal offset only); the same holds for table offsets today;
  • that the heap pointer SGPR follows the root parameters is the translator's existing inference for compute entry registers, not something this change verifies;
  • only a buffer read is modelled through a heap record. Image records (eight dwords), stores and formatted loads stay refused;
  • the translator cache revision is unchanged, so a cache that already holds a .fail for such a request keeps it until the request is translated again.

🤖 Generated with Claude Code

**@⁠NiiRoZz** on GitHub · 2026-11-25 20:10 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2532) `NiiRoZz:startup/compute-dispatch-heap-rootconst` → `main` · +1429 −11 · 14 files · 60 commits · merged 2026-11-26 02:16 UTC Depends on #2490 (compute dispatch with textures and census; this branch is stacked on it). Refs #2274 ## What changes One behaviour: a compute program may take a buffer input from the directly indexed resource heap (root flag 0x400) when the record index is a root constant. **Translator (`tools/startup/gfx2hlsl.py`)** lowers exactly this form: ``` s_lshl_b32 R, <root constant word>, 5 s_load_dwordx4 D, s[H:H+1], R ; s[H] the heap pointer, s[H+1] a constant zero, no offset: modifier ``` with no write of `R` and no branch target between the two. `D` becomes a buffer descriptor and the manifest names it ``` srv <i> buf heap rootconst <parameter> <word> ``` Everything else through the heap pointer keeps a refusal that names the form: | form | refusal | | --- | --- | | index read from a buffer (`s_buffer_load_*` then `<< 5`) | `s_load of a resource heap record whose index is read from a buffer` | | other shift, other index, index register written again, branch target in between, unshifted register, `m0` | `... whose offset is not a root constant shifted left by 5 since the last branch target` | | eight dwords (an image record) | `... of 8 dwords` | | `offset:` modifier | `... with offset:0x..` | | high word of the pointer pair not a constant zero | `... through a pointer whose high word is not a constant zero` | | formatted load, store, or a non-buffer kind through such a record | refused as before / in the manifest | | graphics stages | unchanged (`s_load with a register offset through ('resheap',)`) | **Dispatch (`src/startup_stubs`)** - The list's view heap was not recorded in the general case: slot 32 kept the sampler source and, only for a heap with more logical than physical entries, the heap wrapper. Slot 32 now also records the title memory of the view heap it is given (`Pass::title_view_heap`, a `ViewTable` built with `resolve_view_table`, set and replaced where `title_samplers` is). - `srv <i> buf heap rootconst <p> <w>` is parsed into the existing slot list. At Dispatch the record address is `title_view_heap.record(uint32(word(p, w)) << 5, 16)`; from there the descriptor is read and bound by the code a `table <p> <byte>` record uses. No second binding path. - A record outside the heap refuses the dispatch with `a heap record is outside the list's view heap`, before anything is bound, like the other refusals in that loop. ## Tests Commit under test: `b6bc3c30` (two commits on `f67f80a4`, the head of #2490; the second only drops one fixture case and adds a sentence to the docs, and the runtime sources are those of `f5c3c857`, which the dispatch runs below were built from). Windows 10.0.26300, MSVC 14.44, LLVM 15 `llvm-mc`. ```powershell python -B tests/startup_gfx2hlsl_heap_record_check.py --llvm-mc llvm-mc-15 ``` Result: `heap record fixture: 45 instructions reassembled to the recorded words`, then `PASS (manifest and HLSL exact; 19 refused controls; graphics, manifest and translator-mutation checks)`. Expected: the same. - The manifest and the HLSL from the bindings to the end of `main` are compared whole. - 19 controls each change one thing in the program and must be refused with the reason in the table above. - Translator mutation: with the write tracking disabled for one instruction, the "index register written again" control translates; the check requires that, then requires the refusal again with the tracking restored. ```powershell cmake --build --preset dev --target startup_stream_consumer ctest --preset dev --no-tests=error -R "^startup_compute_dispatch_|^startup_gfx2hlsl_heap_record$" -V ``` Result: 7 of 7 passed, no capability skip. | test | adapter | driver | debug layer | result | | --- | --- | --- | --- | --- | | `startup_gfx2hlsl_heap_record` | none | | | pass | | `startup_compute_dispatch_warp` | Microsoft Basic Render Driver | 10.0.26100.10068 | enabled, no error message | pass | | `startup_compute_dispatch_texture_warp` | Microsoft Basic Render Driver | 10.0.26100.10068 | enabled, no error message | pass | | `startup_compute_dispatch_heap_warp` (new) | Microsoft Basic Render Driver | 10.0.26100.10068 | enabled, no error message | pass | | `startup_compute_dispatch_hardware` | NVIDIA GeForce RTX 5090 | 32.0.16.2135 | enabled, no error message | pass | | `startup_compute_dispatch_texture_hardware` | NVIDIA GeForce RTX 5090 | 32.0.16.2135 | enabled, no error message | pass | | `startup_compute_dispatch_heap_hardware` (new) | NVIDIA GeForce RTX 5090 | 32.0.16.2135 | enabled, no error message | pass | The new dispatch test runs a source-built gfx1013 program (case A of `startup_gfx2hlsl_compute_check.py` with its input loaded from the heap) through the stand-in's list. The input descriptor is only in heap record 2; records 0 and 1 hold the output's descriptor. All 320 output words are read back from the aliased memory and compared. Negative controls of the dispatch test: - before translation: `refused: no translation`, every word keeps its sentinel; - root constant `0x07ffffff` (a record past the heap): one `refused: a heap record is outside the list's view heap`, the census names that reason, every word keeps its sentinel and the input is unchanged; - runtime mutations, each rebuilt and run once on WARP, then reverted: shift by 4 instead of 5, and index ignored. Both failed the test with `word=0 got=c5c5c5c5 expected=ea74e376 (288 words differ)` and `refused: an output buffer is also an input`. Wider groups, same build: `ctest --preset dev --no-tests=error -R "^startup_compute_|^startup_stream_|^startup_gfx2hlsl_heap_record$"`: 63 of 63 passed (61 in one run; the two `startup_stream_depth_*` tests passed once their executable was built), no capability skip. Pure-Python checks: every check listed in `AGENTS.md` plus every `tests/startup_gfx2hlsl_*_check.py` and `tests/startup_translator_check.py`, each run with no argument: 152 exit 0, 1 exit 77 (`startup_run_sh_check.py`, a POSIX launcher check that skips on Windows; not a pass). `git diff --check` is clean. ## Measured and not measured Measured: - the translation and the dispatch of one synthetic program, on WARP and one physical adapter; - in a local set of 184 compute programs that hold a register-offset load through the heap pointer: every such load now lowers in 4 programs; 151 programs hold a load whose index is read from a buffer and 57 hold a load with another unmodelled offset (a program can hold both). None of the 184 translates with this change: the 4 stop at other instructions (`s_pack_ll_b32_b16` in 3 of them, then `v_fma_mix_f32`, an SDWA `v_cndmask_b32`, `buffer_store_format_xyzw` and others). Not measured, or a hypothesis: - no real program reaches a Dispatch through this path yet, so nothing is claimed about frames or startup; - the record offset is a literal byte offset into the title's heap memory, as a table offset is. The fixture writes its descriptors at those bytes itself. A caller that places records by the adapter's descriptor increment on an adapter whose increment is not 32 bytes is not covered (WARP is such an adapter, so its run covers the literal offset only); the same holds for table offsets today; - that the heap pointer SGPR follows the root parameters is the translator's existing inference for compute entry registers, not something this change verifies; - only a buffer read is modelled through a heap record. Image records (eight dwords), stores and formatted loads stay refused; - the translator cache revision is unchanged, so a cache that already holds a `.fail` for such a request keeps it until the request is translated again. 🤖 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]>
# Conflicts:
#	docs/experiments.md
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]>
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]>
# 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]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:00:03 +00:00
github manually merged commit 29ee504b96 into gh-pr/2532/base 2026-11-27 01:00:07 +00:00
Author
Owner

@⁠NiiRoZz on GitHub · 2026-11-25 20:22 UTC · original

The Linux Python job failed at 5bade3c4 on tests/startup_gfx2hlsl_sload_const_offset_check.py, a check that landed on main after this branch was written. It calls the s_load handlers on a stage built without a kind, and the heap record branch read self.kind directly, so the eight-dword case raised AttributeError instead of the refusal.

Fixed in fdba7797 (with current main merged in, no conflict): the branch now reads the kind with getattr(self, 'kind', None), as the other handlers in the file do. No behaviour change for a real stage.

Run at fdba7797, Windows 10.0.26300, Python from out/pe-env:

python -B tests/startup_gfx2hlsl_sload_const_offset_check.py   # s_load constant offset checks: 0 failed
python -B tests/startup_gfx2hlsl_heap_record_check.py          # PASS (manifest and HLSL exact; 19 refused controls; ...)
python -B tests/startup_translator_check.py                    # startup translator checks: 0 failed
python -B tests/startup_gfx2hlsl_<each>_check.py               # every no-argument check exits 0

Not rerun after this commit: the dispatch tests (the runtime sources are unchanged) and the heap record check's --llvm-mc reassembly.

**@⁠NiiRoZz** on GitHub · 2026-11-25 20:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2532#issuecomment-7173563329) The Linux Python job failed at 5bade3c4 on `tests/startup_gfx2hlsl_sload_const_offset_check.py`, a check that landed on `main` after this branch was written. It calls the `s_load` handlers on a stage built without a `kind`, and the heap record branch read `self.kind` directly, so the eight-dword case raised `AttributeError` instead of the refusal. Fixed in fdba7797 (with current `main` merged in, no conflict): the branch now reads the kind with `getattr(self, 'kind', None)`, as the other handlers in the file do. No behaviour change for a real stage. Run at fdba7797, Windows 10.0.26300, Python from `out/pe-env`: ```powershell python -B tests/startup_gfx2hlsl_sload_const_offset_check.py # s_load constant offset checks: 0 failed python -B tests/startup_gfx2hlsl_heap_record_check.py # PASS (manifest and HLSL exact; 19 refused controls; ...) python -B tests/startup_translator_check.py # startup translator checks: 0 failed python -B tests/startup_gfx2hlsl_<each>_check.py # every no-argument check exits 0 ``` Not rerun after this commit: the dispatch tests (the runtime sources are unchanged) and the heap record check's `--llvm-mc` reassembly.
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-25 21:38 UTC · original

Seven mutations of the resource-heap record path, all caught — after I fixed two anchors that had matched the wrong function

The device-free check

python -B tests/startup_gfx2hlsl_heap_record_check.py
    startup_gfx2hlsl_heap_record: PASS (manifest and HLSL exact; 19 refused controls; graphics, manifest and translation …)

The other three checks in this PR (startup_compute_dispatch_check.py, …_heap_check.py, …_texture_check.py) exit 1
with no arguments — they want DXC, an adapter and a dispatch mode, so they are the GPU half and I did not run them. The
19 refused controls in the pure-Python one are the part that matters for the new symbolic matcher anyway.

Mutations

mutation in heap_record / the index tracking caught
the shift int(srcs[1], 0) == 5 → 4 (32-byte record becomes 16-byte) caught
a buffer-sourced index accepted instead of refused caught
an index that is not a rootconst accepted caught
count != 4 guard removed caught
the imm is not None (offset) guard removed caught
the high word must be a constant zero — guard removed caught

Two of these need a note about my own method, because I reported them wrong the first time and then fixed it: my anchors
if count != 4: and if imm is not None: matched the first occurrences in the file — s_load at line 3610 and the
SMEM literal-offset check at 3574 — not the ones inside heap_record at 3634/3636. Those two mutations were edits to
other functions, and "survived" said nothing about this PR. Re-running with the anchors that include the surrounding
what line (which only exists in heap_record) shows both are caught. A single generic if count != 4: is not a
usable anchor in a 6 000-line translator; the message text is what makes it unique.

What the shift guard means

index << 5 is the byte offset of a 32-byte record, and the fixture refuses the 16-byte reading. That is the one number
in this change whose wrongness would be silent: << 5 → << 4 still produces a plausible descriptor, just from the
wrong half of the record. It is caught.

The other half I did not touch

src/startup_stubs/d3d12_compute_dispatch.inl (+399), d3d12_draw.inl (+70), list_compute_root.h, list_dispatch.h,
root_constant_store.h and 229 lines of startup_stream_consumer.cpp are all on the dispatch/GPU side, exercised by
startup_compute_dispatch_{warp,hardware} — which are the three checks that need arguments. If you want a mutation pass
over that half too, say so and I will build the targets and run it the way I did for #2491.

AI-assisted; pure Python for the rows above, Windows 11 build 26300.

**@⁠ChazY11** on GitHub · 2026-11-25 21:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2532#issuecomment-7175344338) ## Seven mutations of the resource-heap record path, all caught — after I fixed two anchors that had matched the wrong function ### The device-free check ```text python -B tests/startup_gfx2hlsl_heap_record_check.py startup_gfx2hlsl_heap_record: PASS (manifest and HLSL exact; 19 refused controls; graphics, manifest and translation …) ``` The other three checks in this PR (`startup_compute_dispatch_check.py`, `…_heap_check.py`, `…_texture_check.py`) exit 1 with no arguments — they want DXC, an adapter and a dispatch mode, so they are the GPU half and I did not run them. The 19 refused controls in the pure-Python one are the part that matters for the new symbolic matcher anyway. ### Mutations | mutation in `heap_record` / the index tracking | caught | |---|---| | the shift `int(srcs[1], 0) == 5` → `4` (32-byte record becomes 16-byte) | **caught** | | a buffer-sourced index accepted instead of refused | **caught** | | an index that is not a `rootconst` accepted | **caught** | | `count != 4` guard removed | **caught** | | the `imm is not None` (offset) guard removed | **caught** | | the high word must be a constant zero — guard removed | **caught** | Two of these need a note about my own method, because I reported them wrong the first time and then fixed it: my anchors `if count != 4:` and `if imm is not None:` matched the **first** occurrences in the file — `s_load` at line 3610 and the SMEM literal-offset check at 3574 — not the ones inside `heap_record` at 3634/3636. Those two mutations were edits to *other* functions, and "survived" said nothing about this PR. Re-running with the anchors that include the surrounding `what` line (which only exists in `heap_record`) shows both are caught. A single generic `if count != 4:` is not a usable anchor in a 6 000-line translator; the message text is what makes it unique. ### What the shift guard means `index << 5` is the byte offset of a 32-byte record, and the fixture refuses the 16-byte reading. That is the one number in this change whose wrongness would be **silent**: `<< 5` → `<< 4` still produces a plausible descriptor, just from the wrong half of the record. It is caught. ### The other half I did not touch `src/startup_stubs/d3d12_compute_dispatch.inl` (+399), `d3d12_draw.inl` (+70), `list_compute_root.h`, `list_dispatch.h`, `root_constant_store.h` and 229 lines of `startup_stream_consumer.cpp` are all on the dispatch/GPU side, exercised by `startup_compute_dispatch_{warp,hardware}` — which are the three checks that need arguments. If you want a mutation pass over that half too, say so and I will build the targets and run it the way I did for #2491. AI-assisted; pure Python for the rows above, Windows 11 build 26300.
Author
Owner

@⁠Makto94 on GitHub · 2026-11-25 22:13 UTC · original

Hardware run at head b306d44e (build exit code 0). The PR is stacked on #2490.

Environment: NVIDIA GeForce RTX 3070 Ti, driver 32.0.16.2101 (NVIDIA 621.01) and Windows 11 Pro build 26300.9974 as reported by the system, dev preset (MSVC). The runs were serial (-j1).

  1. Command: ctest --preset dev --no-tests=error -j1 -V -R '^(startup_compute_dispatch.*|startup_root_constant_store|startup_list_dispatch.*|startup_compute_root|startup_gfx2hlsl_heap_record)$'

Result: 15/15 passed, 0 failed: 3 startup_compute_dispatch*_warp, 3 startup_compute_dispatch*_hardware, and the 9 other tests the diff adds (startup_root_constant_store, startup_list_dispatch and its 5 _control tests, startup_compute_root, startup_gfx2hlsl_heap_record). 0 capability skips (77).

  • startup_compute_dispatch_hardware, startup_compute_dispatch_texture_hardware and startup_compute_dispatch_heap_hardware print adapter=NVIDIA GeForce RTX 3070 Ti driver=32.0.16.2101 and debug layer: enabled, no error message.
  • startup_compute_dispatch: PASS on hardware (all 320 words match after translation and with the same root set again; untouched before translation, without a Dispatch and for 6 refusals)
  • startup_compute_dispatch_texture_hardware: texture output: all 1024 halves match after translation (64 changed) ... and texture input: all 320 words match after translation ...
  • startup_compute_dispatch_heap: PASS on hardware (all 320 words match through heap record 2; untouched before translation and for a record outside the heap)
  • The WARP tests print adapter=Microsoft Basic Render Driver with the same debug-layer line.
  1. Repeat run. A comment on #2470 reported an intermittent process-exit failure in the direct Dispatch case on an RTX 4060 (3 failures in 5 repetitions) and isolated it to the release of the cached desktop PSO. The #2470 thread says the fix (7a8d9c89) is on the branch as c821b4b2; c821b4b2 ("startup: avoid calling the compute driver after process termination begins") is an ancestor of this head. I repeated the hardware tests on a different NVIDIA GPU.

Command: ctest --preset dev --no-tests=error -j1 -V --repeat until-fail:20 -R '^startup_compute_dispatch(_texture|_heap)?_hardware$'

Result: each of the 3 tests passed 20/20 consecutive runs (60 PASS on hardware lines, 100% tests passed, 0 tests failed out of 3). This does not cover the RTX 4060.

This run covers NVIDIA and WARP only. Not covered: any test outside the filters above.

**@⁠Makto94** on GitHub · 2026-11-25 22:13 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2532#issuecomment-7176100834) Hardware run at head `b306d44e` (build exit code 0). The PR is stacked on #2490. Environment: NVIDIA GeForce RTX 3070 Ti, driver 32.0.16.2101 (NVIDIA 621.01) and Windows 11 Pro build 26300.9974 as reported by the system, `dev` preset (MSVC). The runs were serial (`-j1`). 1. Command: `ctest --preset dev --no-tests=error -j1 -V -R '^(startup_compute_dispatch.*|startup_root_constant_store|startup_list_dispatch.*|startup_compute_root|startup_gfx2hlsl_heap_record)$'` Result: 15/15 passed, 0 failed: 3 `startup_compute_dispatch*_warp`, 3 `startup_compute_dispatch*_hardware`, and the 9 other tests the diff adds (`startup_root_constant_store`, `startup_list_dispatch` and its 5 `_control` tests, `startup_compute_root`, `startup_gfx2hlsl_heap_record`). 0 capability skips (77). - `startup_compute_dispatch_hardware`, `startup_compute_dispatch_texture_hardware` and `startup_compute_dispatch_heap_hardware` print `adapter=NVIDIA GeForce RTX 3070 Ti driver=32.0.16.2101` and `debug layer: enabled, no error message`. - `startup_compute_dispatch: PASS on hardware (all 320 words match after translation and with the same root set again; untouched before translation, without a Dispatch and for 6 refusals)` - `startup_compute_dispatch_texture_hardware`: `texture output: all 1024 halves match after translation (64 changed) ...` and `texture input: all 320 words match after translation ...` - `startup_compute_dispatch_heap: PASS on hardware (all 320 words match through heap record 2; untouched before translation and for a record outside the heap)` - The WARP tests print `adapter=Microsoft Basic Render Driver` with the same debug-layer line. 2. Repeat run. A comment on #2470 reported an intermittent process-exit failure in the direct Dispatch case on an RTX 4060 (3 failures in 5 repetitions) and isolated it to the release of the cached desktop PSO. The #2470 thread says the fix (`7a8d9c89`) is on the branch as `c821b4b2`; `c821b4b2` ("startup: avoid calling the compute driver after process termination begins") is an ancestor of this head. I repeated the hardware tests on a different NVIDIA GPU. Command: `ctest --preset dev --no-tests=error -j1 -V --repeat until-fail:20 -R '^startup_compute_dispatch(_texture|_heap)?_hardware$'` Result: each of the 3 tests passed 20/20 consecutive runs (60 `PASS on hardware` lines, `100% tests passed, 0 tests failed out of 3`). This does not cover the RTX 4060. This run covers NVIDIA and WARP only. Not covered: any test outside the filters above.
Author
Owner

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

@⁠NiiRoZz #2532 is now in conflict with main (merge state DIRTY at head 28c44d5f). It is the base of the stack #2580 -> #2585 / #2596 / #2624 / #2625, so none of those can be tested or merged until it is updated.

Could you merge (or rebase onto) current main on this branch? Once the head changes we will re-run the review and the Windows checks on it.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 01:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2532#issuecomment-7179971577) @⁠NiiRoZz #2532 is now in conflict with `main` (merge state DIRTY at head `28c44d5f`). It is the base of the stack #2580 -> #2585 / #2596 / #2624 / #2625, so none of those can be tested or merged until it is updated. Could you merge (or rebase onto) current `main` on this branch? Once the head changes we will re-run the review and the Windows checks on it. AI-assisted; commands listed were executed locally.
Author
Owner

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

@⁠NiiRoZz I merged current main into this branch (merge commit 29ee504b, no rebase, no force). One conflict in src/startup_stubs/d3d12_xs_device.cpp (main added the E_OUTOFMEMORY check after wrap); I kept both: the check first, then the compute request block. No other change to your code. This unblocks the stack #2580, #2585, #2596, #2624, #2625.

Verification:

  • Linux: python3 -B tests/startup_gfx2hlsl_heap_record_check.py, tests/startup_gfx2hlsl_sload_const_offset_check.py, tests/docs_links_check.py, tests/bidi_controls_check.py, git diff --check origin/main...HEAD: all pass.
  • Win2025 (WARP + hardware adapters), dev and release: x2w_pipe.py win2025 2532 --patch <merge diff> --targets startup_stream_consumer,d3d12_xs_shim --regex '^(startup_compute_.*|startup_stream_request_warp|startup_stream_adapter_filter)' gave 131/131 passed in each preset, including startup_compute_dispatch_{warp,hardware}, startup_compute_dispatch_heap_* and startup_compute_dispatch_texture_*.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-26 02:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2532#issuecomment-7180523879) @⁠NiiRoZz I merged current `main` into this branch (merge commit 29ee504b, no rebase, no force). One conflict in `src/startup_stubs/d3d12_xs_device.cpp` (`main` added the `E_OUTOFMEMORY` check after `wrap`); I kept both: the check first, then the compute request block. No other change to your code. This unblocks the stack #2580, #2585, #2596, #2624, #2625. Verification: - Linux: `python3 -B tests/startup_gfx2hlsl_heap_record_check.py`, `tests/startup_gfx2hlsl_sload_const_offset_check.py`, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `git diff --check origin/main...HEAD`: all pass. - Win2025 (WARP + hardware adapters), dev and release: `x2w_pipe.py win2025 2532 --patch <merge diff> --targets startup_stream_consumer,d3d12_xs_shim --regex '^(startup_compute_.*|startup_stream_request_warp|startup_stream_adapter_filter)'` gave 131/131 passed in each preset, including `startup_compute_dispatch_{warp,hardware}`, `startup_compute_dispatch_heap_*` and `startup_compute_dispatch_texture_*`. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.