Skip to content

startup: implement command-list slot 14 Dispatch (Part of #870) - #1974

Merged
R0Y00 merged 11 commits into
R0Y00:mainfrom
tedin7:x2w-frontier-slot14-dispatch
Nov 26, 2026
Merged

R0Y00 merged 11 commits into
R0Y00:mainfrom
tedin7:x2w-frontier-slot14-dispatch

Conversation

@tedin7

@tedin7 tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Part of #870

What this unblocks: compute passes recorded on a command list (slot 14 Dispatch) reach the desktop list instead of the no-op trap, so a scene that pulls GPU-written arguments from them can run.

Changes:

  • src/startup_stubs/list_dispatch.h: forward-or-refuse decision (list open, direct/compute list, desktop compute pipeline and root bound, each group count <= 65535; zero groups is valid).
  • d3d12_xs_device.cpp: new list_dispatch, registered at slot 14 next to list_draw; refusals are logged (first 16).
  • tests/startup_list_dispatch_check.cpp plus ctest startup_list_dispatch and two WILL_FAIL controls (no-limit, no-state).

Verification:

  • git diff --check: clean.
  • x86_64-w64-mingw32-g++ -std=c++17 -Isrc tests/startup_list_dispatch_check.cpp then run under wine: 11 cases passed; --mutate no-limit: 3 of 11 failed (rc 1); --mutate no-state: 2 of 11 failed (rc 1).
  • Not run: Win2025 Release build of d3d12_xs_device.cpp (needs MSVC, __try); the end-to-end UAV fill/readback fixture on WARP + hardware is still to do. Depends softly on feat: record compute root signature and descriptor tables (list slots 33 and 35) #1803 (compute root).

AI-assisted; commands listed were executed locally.

@R0Y00

R0Y00 commented Nov 24, 2026

Copy link
Copy Markdown
Owner

For the planned end-to-end fixture, please combine the existing compute-root/PSO path with #1975's slots 37/39 and one source-built shader that stores distinguishable root DWORDs into a UAV. Right now #1974 issues desktop Dispatch directly, while #1975 only keeps the DWORDs in Pass.compute_constants. This pair needs a real consumer for those words. Please verify correct and swapped values after a fence, zero groups preserving the sentinel, and a second list recording after Reset with fresh bindings. One shared fixture can cover both PRs. Keep the unit decisions as negative controls.

@tedin7
tedin7 marked this pull request as ready for review November 24, 2026 22:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T22:36:00.136395Z 0e684dc Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0e684dcf87

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/startup_stubs/d3d12_xs_device.cpp Resolved
Comment thread src/startup_stubs/d3d12_xs_device.cpp Resolved
@tedin7

tedin7 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed 6c901b2: Dispatch is refused under a compute root with arguments (slots 35-45 not forwarded yet), plus docs. The shared end-to-end fixture with #1975 (root DWORDs stored into a UAV, swapped values after a fence, zero groups, Reset with fresh bindings) is not done here and needs the root-argument forwarding first. This PR stays at decision-level checks.

AI-assisted; commands listed were executed locally.

@tedin7
tedin7 force-pushed the x2w-frontier-slot14-dispatch branch 2 times, most recently from 937d487 to 078c3dd Compare November 25, 2026 05:58

R0Y00 commented Nov 25, 2026

Copy link
Copy Markdown
Owner

I built the shim in Release with this head (078c3dd8) and #1803 (bb6b9a1a) replayed onto main 2017e1bb. The replay preserves main's desktop slot 33 bind. ctest --preset release -j1 --no-tests=error -R '^startup_(compute_root|list_dispatch)' passed all five cases, including the three Dispatch negative controls.

That combination still has a forwarding gap. #1803 records slot 35 tables, and #1974 refuses roots containing those tables, so the five tests do not reach a desktop UAV write. For the SRV-only path that is permitted, main's slot 43 handler returns early on an invalid upload address or wrong parameter type. It does not record which parameters actually reached the desktop list or invalidate a previous SRV after a rejected replacement. The Dispatch decision would still forward with the same root and pipeline booleans. It also does not check compatibility between the bound root and the compute PSO.

Please cover those cases before forwarding. A source-built shader on the existing slot 86 desktop PSO path can write distinguishing words to a UAV once the bounded bindings are available. Check exact fenced readback, then check the sentinel with a missing or invalid binding and after Reset. Coordinate the slot 35 case with #1803 so its nonzero UAV descriptor offset and wrong or cleared binding exercise the actual Dispatch consumer. The current unit decisions are useful independent controls.

@tedin7

tedin7 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed cd38b2ed. It closes the slot 43 and root/PSO gaps from your comment. Dispatch is now forwarded only when:

  • the compute root has no static samplers and only root SRV parameters;
  • the compute PSO was built against the bound root signature (the stream's root is recorded on the PSO). A mismatch is refused with compute pipeline was built against another root signature;
  • every root SRV the root declares was set since slot 33. Slot 43 now clears a parameter's binding before trying a replacement, so an invalid upload address or misaligned address leaves it unbound. Slot 33 clears all bindings. Otherwise the refusal is a compute root SRV is not bound.

Regression test: startup_list_dispatch_check gains cases for a root/PSO mismatch, an unbound SRV (also with zero groups) and the paired and fully bound forward. It has two new mutation controls, no-pairing and no-bound, which must fail. The docs entry is updated.

Not done here: the slot 35 table forwarding and the shared UAV readback fixture (exact fenced values, sentinel after a rejected binding and after Reset). Those need #1803's descriptor-table forwarding first, so tables and UAV roots are still refused. The unit decisions stay as negative controls.

Verification (Win2025, 3-slot pool, x2w_pipe.py win2025 1974 --force):

  • dev: 27/27 passed, 0 skipped
  • release (/O2): 27/27 passed, 0 skipped
  • includes startup_list_dispatch plus all five _control mutation tests

AI-assisted; commands listed were executed locally.

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.
@tedin7
tedin7 force-pushed the x2w-frontier-slot14-dispatch branch from a75c0ff to 24c5f55 Compare November 25, 2026 10:46
@tedin7

tedin7 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Stage-2 verification of head 24c5f554.

  • Audit: diff, title, body and all 4 commit messages checked. No AI model names, no Co-Authored-By, no references to local probes.
  • PR body is partly stale: it describes only the first commit and says the Win2025 build was not run. The later commits (root-SRV gating, slot 43/33 binding clears, slot86 out-param fix) are not listed. Please refresh it.
  • CI: Linux Python checks, Windows build and test, and gfx1013 fixtures all pass. The /O2 job was skipped.
  • Win2025 (WARP, default 3-slot pool): python3 x2w_pipe.py win2025 1974 --force
    • dev: 100% tests passed out of 28
    • release: 100% tests passed out of 28
    • The first attempt failed with MSVC C1060: compiler is out of heap space on d3d12_xs_device.cpp while three slots compiled in parallel. An identical re-run passed. Treated as VM memory pressure, not a code defect. Worth watching if this file keeps growing.

AI-assisted; commands listed were executed locally.

@MasterDomino

Copy link
Copy Markdown
Collaborator

@tedin7: #1803 has landed (4ce2931d), so this PR is next in the order. It still conflicts with main in src/startup_stubs/d3d12_xs_device.cpp (the build_tables slot entries). Once you've rebased it, or merged main in, I'll verify native slot 14 at the new head with a mutant control.

AI-assisted.

@tedin7

tedin7 commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

@MasterDomino: #1974 is ready for review/merge at head d2c7782f (second in the #1803 -> #1974 -> #1975 order).

What changed since 8a4df523: merged current main (merge commit, no force-push). The only conflict was in build_tables: slot 14 (Dispatch) and main's slot 16 are both kept. CI is green on this head.

Note for review: the forwarded Dispatch is limited to roots with root SRVs only, so it has no observable GPU output yet. A readback test needs the UAV descriptor table consumer that follows in #1975.

Win2025 receipt on this exact head:

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit d2c7782fd510952d2b4b641d16d29d8c70fc7b18:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_list_dispatch_check startup_indirect_dispatch startup_compute_root startup_command_list_slot_names startup_list_resubmit -- -j 2): 23.10s (configure 1.76s)
    • Test (ctest --preset dev -R '^(startup_list_dispatch_check|startup_indirect_dispatch.*|startup_compute_root|startup_stubs|startup_command_list_slot_names|startup_list_resubmit.*)$' --parallel 4 --no-tests=error --output-on-failure): 13/13 passed (0.93s: startup_list_resubmit_untracked_hardware 0.24s, startup_list_resubmit_warp 0.25s, startup_list_resubmit_untracked_warp 0.24s, startup_command_list_slot_names 0.02s, startup_compute_root 0.01s, startup_indirect_dispatch_warp 0.08s, startup_list_resubmit_hardware 0.22s, startup_list_resubmit_nodebug_warp 0.21s, startup_list_resubmit_nodebug_untracked_warp 0.21s, startup_indirect_dispatch_hardware 0.07s, startup_list_resubmit_nodebug_hardware 0.20s, startup_list_resubmit_nodebug_untracked_hardware 0.23s, startup_stubs 0.83s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_list_dispatch_check startup_indirect_dispatch startup_compute_root startup_command_list_slot_names startup_list_resubmit -- -j 2): 53.90s (configure 1.76s)
    • Test (ctest --preset release -R '^(startup_list_dispatch_check|startup_indirect_dispatch.*|startup_compute_root|startup_stubs|startup_command_list_slot_names|startup_list_resubmit.*)$' --parallel 4 --no-tests=error --output-on-failure): 13/13 passed (1.10s: startup_list_resubmit_untracked_warp 0.23s, startup_list_resubmit_untracked_hardware 0.26s, startup_list_resubmit_hardware 0.25s, startup_compute_root 0.01s, startup_command_list_slot_names 0.01s, startup_indirect_dispatch_warp 0.11s, startup_list_resubmit_warp 0.23s, startup_list_resubmit_nodebug_warp 0.24s, startup_list_resubmit_nodebug_untracked_warp 0.22s, startup_indirect_dispatch_hardware 0.09s, startup_list_resubmit_nodebug_hardware 0.22s, startup_list_resubmit_nodebug_untracked_hardware 0.22s, startup_stubs 0.93s)
  • sccache: 1/12 hits; wall 86.6s

AI-assisted; commands listed were executed locally.

@MasterDomino MasterDomino left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the merge with main. I checked out d2c7782f and built it with the dev preset on Windows 11 build 26300 (AMD Radeon RX 9070 XT, driver 32.0.32029.2010; WARP 10.0.26100.9818).

ctest --preset dev --no-tests=error -j 4 -R '^(startup_list_dispatch.*|startup_indirect_.*|startup_compute_root|startup_stubs|startup_command_list_slot_names|startup_list_resubmit.*|desktop_root_signature|cpu_shim_compute.*|d3d12x_compute_list.*)$': 92/92 passed, 0 skipped, with the hardware variants on the RX 9070 XT. The branch merges cleanly onto current main, and CI is green.

The decision and its inputs address @R0Y00's 06:10 points:

  • compute_srv_bound records only root SRVs that reached the desktop list.
  • A rejected or misaligned slot 43 replacement clears its bit, and slot 33 clears all bits.
  • Close resets the Pass before Reset.
  • Roots with tables, static samplers or non-SRV parameters are refused.
  • The PSO's stream root must be the bound root.

The header's unit decisions catch mutations of list_dispatch.h: "always forward", "root arguments ignored" and "zero groups refused" each fail startup_list_dispatch.

Blocking: native slot 14 itself is not verified

These one-line mutants in d3d12_xs_device.cpp each still pass all 92 tests:

mutant result
refusal branch in list_dispatch never taken (always forward) survives
compute_srv_bound not cleared on a slot 33 root change survives
bit not cleared on a rejected slot 43 replacement survives
request.compute_root_has_arguments = false survives
root_matches_pipeline = true (pairing off) survives
list_typed[14] registration removed (slot 14 a no-op) survives, including startup_command_list_slot_names and startup_stubs

No test records command-list slot 14 through the stand-in, so neither the request built in list_dispatch nor the binding state behind it is checked. That falls short of the merge rule's "source-built regression plus a negative control that catches the intended failure" for the forwarding.

With only root-SRV roots forwarded there's no UAV, so this PR can't have a readback. A device-level fixture can still cover the forwarding. On WARP, with the debug layer, it would drive slots 86/25/33/43/14 and assert:

  • one Dispatch(...) refused: <reason> line for each of:
    • an unset root SRV;
    • a rejected or misaligned replacement after a valid one;
    • a root change and back;
    • Close/Reset, then Dispatch without rebinding;
    • a PSO built against another root;
    • a root with a table;
    • an unbound SRV with zero groups.
  • the fully bound case: no refusal and no debug-layer error, then Close and execute to a fence.

The six mutants above should fail against that. The exact fenced UAV readback with the sentinel controls stays with the table/UAV consumer.

Smaller items

  • The Win2025 receipt's -R '^(startup_list_dispatch_check|...)$' doesn't match the registered names (startup_list_dispatch plus its five _control tests), so none of them were in the 13/13.
  • docs/experiments.md and the list_dispatch.h comment say slots 35 and 43 have no handler. Slot 43 is list_compute_upload_srv, and slot 35 has been handled since #1803. The comment above list_dispatch and the test header's list of mutations are out of date too.
  • The PR body still describes only the first commit.
  • Optional: default root_matches_pipeline and root_arguments_bound to false in ListDispatch, so a caller that omits them refuses.

For the combined review: startup_compute_dispatch_* in #2470 only builds slot 67 pipelines, so the native-versus-translated split @R0Y00 wants kept would also need a slot 86 desktop compute PSO case there.

@tedin7, if it helps the landing order, I can write that fixture and send it as a PR against your branch. Just say which you prefer.

AI-assisted; commands listed were executed locally.

startup_list_dispatch_native creates a guest device on a desktop
adapter (WARP or hardware, debug layer on when installed) and drives
command-list slots 86, 25, 33, 43, 148, 14, 9 and 139 of the stand-in.
Each refused case must write exactly one
"x2w-render Dispatch(x, y, z) refused: <reason>" line, with the
expected reason, to X2W_TRAP_LOG:

- a root SRV never set;
- a rejected (foreign address) or misaligned slot 43 replacement after
  a valid one;
- a root changed and changed back without a new slot 43;
- a pipeline built against another root;
- a root with a descriptor table, and a root with a static sampler;
- an unset root SRV with zero groups;
- 65536 groups on X;
- a Dispatch on the closed list;
- a Dispatch after Reset without new bindings.

A forwarded case must write no line. The fixture wraps a
pipeline-statistics query around every slot 14 call on an open list,
recorded on the underlying desktop list: CSInvocations must be 4 per
group when forwarded and 0 when refused. The fully bound call is
recorded alone and read back first, so a slot 14 that records nothing
fails on its count. All three recordings are executed to a fence and
the debug layer must report no error.

The skip_srv control drops slot 43 from the first forwarded case and
must report it as refused. Each of these one-line changes to
d3d12_xs_device.cpp makes the WARP and hardware tests fail: the
refusal branch never taken, compute_srv_bound not cleared by slot 33,
the bit not cleared by a rejected slot 43, compute_root_has_arguments
forced false, root_matches_pipeline forced true, and the slot 14
registration removed.

The docs section now names the device fixture and corrects the
sentence on which compute root-argument slots have handlers.

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

Copy link
Copy Markdown
Collaborator

@tedin7, as offered in my review, the native slot-14 fixture is up as a PR into this branch: tedin7#1. It's one test-only commit on d2c7782f: tests/startup_list_dispatch_native.cpp, its CMake entries and a docs note. Production code is unchanged.

  • What it checks:
    • every refusal reason, each as exactly one log line;
    • forwarding, proven with a pipeline-statistics query (CSInvocations);
    • all three recordings executed to a fence, with no debug-layer error.
  • Negative controls: the six device-side mutants from my review each fail it on WARP and the RX 9070 XT.
  • Runs:
    • ctest --preset dev --no-tests=error -R "^startup_list_dispatch": 9/9, also over 20 repeats;
    • the neighbour filter from my review: 95/95.

If you merge it, or carry the commit over, my change request is resolved at that head. I'll re-review and dismiss it then. Because the fixture is my work, I'd leave the merge of #1974 to @R0Y00 or you.

AI-assisted; commands listed were executed locally.

R0Y00 commented Nov 26, 2026

Copy link
Copy Markdown
Owner

I independently ran the offered native slot 14 fixture at a8275935, Windows 11 build 26200, Release, ctest --preset release --no-tests=error -j 1 -R '^startup_list_dispatch' -V. All 9 passed with no skips. WARP and RTX 4060 Laptop both reported 24 CS invocations for the initial bound Dispatch, 0 for the rejected cases, and 16 after Reset and rebind, with the debug layer enabled. The WARP skip-SRV control observed the named refusal. @tedin7, please integrate the fixture or an equivalent into your branch when resolving the current main conflicts. We can then recheck the exact upstream head and proceed with #1975 in order.

@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

@R0Y00 Cannot run Win2025 tests on d2c7782f yet because this branch has merge conflicts with main; please rebase and tag @tedin7 again.

@MasterDomino
MasterDomino dismissed their stale review November 26, 2026 00:06

Resolved at 221e6c4: the native slot 14 fixture (a827593) is integrated unchanged, and R0Y00 independently ran it 9/9 on WARP and RTX 4060 Laptop.

@MasterDomino

Copy link
Copy Markdown
Collaborator

Thanks, @tedin7. At 221e6c4f the fixture is in unchanged: tests/startup_list_dispatch_native.cpp is byte-identical to a8275935. The list_dispatch.h comment fix is in too, so I've dismissed my change request. @R0Y00 ran the fixture 9/9 on WARP and RTX 4060 Laptop, and the six device-side mutants from my review all fail it on WARP and the RX 9070 XT.

One thing remains before this can land: main moved to 8ecaa8ec, with #2636 merged, and this branch now conflicts in docs/experiments.md only. The code still merges cleanly. Could you merge main again?

Because the fixture is my work, I'll leave the final recheck and the merge of this head to @R0Y00. #1975 follows in order.

AI-assisted; commands listed were executed locally.

@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.

I resolved the documentation conflict by keeping both the slot 14 Dispatch and the explicit-gradient sections. The fast-forward candidate 9c678547 preserves the native fixture and its author. Windows 11 build 26200 Release passed 9/9 with no skips using ctest --preset release --no-tests=error -j 1 -R '^startup_list_dispatch' -V. On WARP and RTX 4060 Laptop with the debug layer enabled, the bound call produced 24 invocations, refused calls produced zero, and Reset followed by rebind produced 16. The WARP skip-SRV control gave the expected refusal. Documentation validation checked 507 links. This verifies source-built native slot 14 forwarding.

@R0Y00
R0Y00 merged commit 4c3fbfb into R0Y00:main Nov 26, 2026
5 checks passed
@tedin7

tedin7 commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

@MasterDomino: #1974 is ready for re-review at head 9c678547 (third-party merge of main by @R0Y00 on top of my 221e6c4f).

What changed since d2c7782f:

  • Merged main (merge commit, no force-push). Only conflict: docs/experiments.md, both sections kept.
  • Carried your fixture over: tests/startup_list_dispatch_native.cpp, its CMake entries and the docs note (commit a8275935, merged as-is). It covers the native slot 14 forwarding and refusal paths you listed, so your change request should be resolved at this head.
  • Fixed the list_dispatch.h header comment: slot 43 (root SRV) is forwarded; the other compute root-argument slots are not.
  • CI is green on this head.

Not changed: the forwarded Dispatch still has no UAV, so the fenced readback stays with the table/UAV consumer in #1975.

Win2025 receipt on this exact head, with the fixture included (22/22 in both presets, incl. startup_list_dispatch_native_warp, _hardware and the skip_srv control):

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 9c67854719fc62c813e9d84489a2b096ef45ade1:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target d3d12_xs_device_obj d3d12_xs_shim startup_list_dispatch_check startup_list_dispatch_native startup_indirect_dispatch startup_compute_root startup_command_list_slot_names startup_list_resubmit -- -j 2): 8.10s (configure 0.00s)
    • Test (ctest --preset dev -R '^(startup_list_dispatch.*|startup_indirect_dispatch.*|startup_compute_root|startup_stubs|startup_command_list_slot_names|startup_list_resubmit.*)$' --parallel 2 --no-tests=error --output-on-failure): 22/22 passed (2.54s: startup_indirect_dispatch_warp 0.16s, startup_indirect_dispatch_hardware 0.12s, startup_compute_root 0.02s, startup_command_list_slot_names 0.03s, startup_list_resubmit_warp 0.40s, startup_list_resubmit_nodebug_warp 0.25s, startup_stubs 1.13s, startup_list_resubmit_nodebug_untracked_warp 0.28s, startup_list_resubmit_untracked_warp 0.29s, startup_list_resubmit_hardware 0.24s, startup_list_resubmit_nodebug_hardware 0.25s, startup_list_resubmit_nodebug_untracked_hardware 0.23s, startup_list_dispatch 0.02s, startup_list_dispatch_no-limit_control 0.02s, startup_list_dispatch_no-state_control 0.02s, startup_list_dispatch_no-root-args_control 0.02s, startup_list_dispatch_no-pairing_control 0.02s, startup_list_dispatch_no-bound_control 0.02s, startup_list_resubmit_untracked_hardware 0.25s, startup_list_dispatch_native_hardware 0.27s, startup_list_dispatch_native_warp 0.31s, startup_list_dispatch_native_skip_srv_warp_control 0.08s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target d3d12_xs_device_obj d3d12_xs_shim startup_list_dispatch_check startup_list_dispatch_native startup_indirect_dispatch startup_compute_root startup_command_list_slot_names startup_list_resubmit -- -j 2): 8.33s (configure 0.00s)
    • Test (ctest --preset release -R '^(startup_list_dispatch.*|startup_indirect_dispatch.*|startup_compute_root|startup_stubs|startup_command_list_slot_names|startup_list_resubmit.*)$' --parallel 2 --no-tests=error --output-on-failure): 22/22 passed (2.58s: startup_indirect_dispatch_warp 0.15s, startup_indirect_dispatch_hardware 0.12s, startup_compute_root 0.02s, startup_command_list_slot_names 0.03s, startup_list_resubmit_warp 0.38s, startup_list_resubmit_nodebug_warp 0.28s, startup_stubs 1.09s, startup_list_resubmit_nodebug_untracked_warp 0.27s, startup_list_resubmit_untracked_warp 0.27s, startup_list_resubmit_hardware 0.30s, startup_list_resubmit_nodebug_hardware 0.31s, startup_list_resubmit_nodebug_untracked_hardware 0.25s, startup_list_dispatch 0.02s, startup_list_dispatch_no-limit_control 0.02s, startup_list_dispatch_no-state_control 0.02s, startup_list_dispatch_no-root-args_control 0.02s, startup_list_resubmit_untracked_hardware 0.25s, startup_list_dispatch_no-pairing_control 0.02s, startup_list_dispatch_no-bound_control 0.02s, startup_list_dispatch_native_warp 0.28s, startup_list_dispatch_native_hardware 0.30s, startup_list_dispatch_native_skip_srv_warp_control 0.09s)
  • sccache: 8/14 hits; wall 27.4s

AI-assisted; commands listed were executed locally.

SimSalabimse added a commit to SimSalabimse/Xbox2Windows that referenced this pull request Nov 26, 2026
… (#17)

* shader: add offset, short-read, and regular-file guards in sgd5_effects with CLI suite (R0Y00#2608)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* startup: count new view records by slot behind an opt-in census (R0Y00#2613)

X2W_D3D12_VIEW_CENSUS=1 counts new distinct view records by device slot
and logs the record vector capacity and hash bucket count before an
insertion that is expected to grow either. Record identity, ids and
descriptor binding do not change.

Refs R0Y00#1199

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>

* startup: lower v_pack_b32_f16 with op_sel and neg/abs in gfx2hlsl (R0Y00#2475)

* startup: lower v_pack_b32_f16 with op_sel and neg/abs in gfx2hlsl

D[15:0] = S0.f16, D[31:16] = S1.f16 (AMD RDNA 2 ISA, VOP3
V_PACK_B32_F16). op_sel[i] selects the high half of source i (LLVM 15:
VOP3_OPSEL); neg and abs act on bit 15 of the selected half, abs first.
The halves are copied as bits, as pixel_aot lowers the same instruction;
no binary16 denormal flush or NaN quieting is modelled (assumed).
Register sources only: an inline float constant on a binary16 operand
is a binary16 value. A destination op_sel bit and clamp are refused.

Test: tests/startup_gfx2hlsl_pack_b32_f16_check.py evaluates the emitted
expression for every op_sel x abs x neg combination over sample register
pairs against a bit reference (2304 cases), plus an SGPR source.
Negative controls: swapped halves and neg-before-abs are caught by the
reference; without the handler the instruction is refused, as on main.

* gfx2hlsl: explain the low/high half reads and the strict op_sel spelling in v_pack_b32_f16 (comments only)

* tests: verify packed binary16 output words on D3D12

---------

Co-authored-by: Royoo <3230853833@qq.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* cpu: lower 16 VEX.256 AVX2 cross-lane extend and dword/qword unpack forms (R0Y00#2614)

* cpu: lower 32/64-bit BMI2 BZHI, MULX, PDEP, and PEXT in cpu_bmi2_bit_aot (R0Y00#2621)

* pe: sort package scan and harden CLI path guards in pe_package_preflight with CLI suite (R0Y00#2609)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* shader: harden rdna_cvt_pk_u8 CLI validation and atomic writes with CLI suite (R0Y00#2619)

* ffx: add upfront path guards and atomic writes to ffx_working_set_delta with CLI suite (R0Y00#2616)

* startup: refuse a lane mask read as data by v_mov_b32 and v_cndmask_b32 (R0Y00#2623)

A lane-mask register (a compare result, vcc_lo, exec_lo, a saved EXEC
copy) holds only the current lane's bit in the one-lane model, while
RDNA 2 reads the whole mask word when the register is a data operand.
v_cndmask_b32 (both data operands) and v_mov_b32 (plain, e64 and SDWA
DWORD) took such a register through u()/u_src and emitted the lane bit.
They now refuse it, after stripping the source modifiers; the lane
select of v_cndmask is unchanged.

Tests that moved a mask with v_mov_b32 first now expect the new refusal,
or read the mask as a lane select instead so they still reach the
refusal they test. The SDWA check that accepted a whole-mask move now
expects a refusal.

AI-assisted.

* tests: reuse the compute pipeline across descriptor-format references (R0Y00#2615)

* tests: run compute store references on a shared renderer device

* tests: compare the descriptor fixture using one device for its reference cases

* tests: use one root signature and compute pipeline for the reference batch

* tests: retain case labels and 320-word diagnostics in the shared compute run

---------

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* runtime: add upfront CLI guards and atomic writes to bink_heap_aot with CLI suite (R0Y00#2627)

* ci: harden coverage_svg validation and atomic writes with CLI suite (R0Y00#2617)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* shader: classify RDNA2 permlane operations as cross-lane (R0Y00#2628)

- Preserve ordinary vector ALU classification and translator refusal.
- Exercise the authored encodings and dashboard categories.

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* d3d12: do not wrap large allocations for unplaced memory SRVs (R0Y00#2611)

An unplaced buffer memory SRV (device slot 70, R0Y00#2395) wrapped the whole
allocation holding the view with OpenExistingHeapFromAddress. A 6 KiB view
in a ~2.15 GiB title startup block wrapped the block; afterwards each
VirtualQuery over it took seconds and DirectStorage requests stalled for
~120 s. Wrap only allocations up to the existing 256 MiB span limit (size
from one region-information call); larger ones take the upload copy.

Co-authored-by: lukaslw-lab <291379150+lukaslw-lab@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* cpu: lower VEX.128/256 AVX horizontal and addsub FP ops in cpu_avx_horiz_fp_aot (R0Y00#2629)

* script: add archive file and ASCII state guards to script_state_probe with CLI suite (R0Y00#2620)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* tests: use a portable negative record offset in the SGD5 CLI fixture (R0Y00#2632)

* shader: lower image_sample_d and document image_sample_c_d refusal in gfx2hlsl (Part of R0Y00#1723) (R0Y00#2082)

* feat: lower image_sample_d to SampleGrad in gfx2hlsl

Part of R0Y00#1723. 2D, 2D array and 3D gradient samples; image_sample_c_d is refused by name (needs SM 6.8).

* test: register startup_image_sample_d in CMake

Part of R0Y00#1723.

* startup: keep the guest LOD cap for image_sample_d and document the form in gfx2hlsl

* test: WARP and hardware readback for image_sample_d against a CPU reference

* tests: build the implicit Sample negative control with two arguments

---------

Co-authored-by: Royoo <3230853833@qq.com>

* tests: add source-built mesh57 loop refusal fixture (R0Y00#2413 T6) (R0Y00#2622)

Prove tip translate_mesh57 refuses a back-edge outside the accepted
group-memory exchanges by the named loop reason, with a mutant that
drops the back-edge and an exact-string oracle.

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* shader: propagate descriptor pointers through s_add_u32/s_addc_u32 in gfx2hlsl (Part of R0Y00#1723) (R0Y00#2069)

* fix: carry descriptor pointers through s_add_u32/s_addc_u32 in gfx2hlsl

A table or root pointer advanced by a literal offset now keeps its source and
byte offset, so a following s_load reads the advanced descriptor. A register
addend on a pointer is refused instead of silently keeping the old pointer.

Part of R0Y00#1723

* shader: refuse descriptor pointer advances across branches and detached s_addc_u32 in gfx2hlsl (Part of R0Y00#1723)

* shader: keep the pointer-advance bookkeeping safe for stages without branch state (Part of R0Y00#1723)

* fix: keep the branch-join refusal for pointer adds in branching shaders

* fix: require the matching high-word add before folding an advanced descriptor pointer

* fix: advance 32-bit table pointers without a high word and judge the high operand by content

* fix: keep descriptor pointer pair open until its matching s_addc_u32

* fix: let the descriptor pointer pair pass translate's SCC check, add WARP readback case

* fix: refuse an untracked-offset pointer as a descriptor, run the pointer check in Linux CI

* fix: refuse a root pointer load whose high word was overwritten

* Revert "fix: refuse a root pointer load whose high word was overwritten"

This reverts commit 0f226c5.

* startup: re-key slot 57 mesh requests in shader_cache_rekey.py (R0Y00#2634)

shader_cache_rekey.py re-keyed graphics, RTV and slot 67 compute requests
and only counted slot 57 mesh requests. mesh57_key hashes the request
files under a versioned prefix, so after a revision that changes it a
kept cache lost every slot 57 request. The tool now recomputes that key
with mesh57_key and copies .ps57, .root and the .m57 ready marker under
the new name, with the rules the other kinds follow: everything read
first, nothing written on a missing or unreadable part, temporary name
then rename, an existing target left alone. Slot 86 is still only
counted.

AI-assisted.

* shader: extract main(argv), bounds checks, and struct/zlib guards in shader_census with CLI suite (R0Y00#2437)

* shader: extract main(argv), bounds checks, and struct/zlib guards in shader_census with CLI suite

* tests: accept Python 3.14+ argparse message in shader_census_cli_check

---------

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* startup: invalidate slot 35 tables when the compute view heap changes (R0Y00#2636)

Track ordinary and oversized compute view heaps separately from the graphics lookup. Keep the table when the same heap is rebound and clear it on changes or unset. Cover the recorder in the CPU checks.

Co-authored-by: chasegrindy <302242206+chasegrindy@users.noreply.github.com>

* tests: run heap-view load references in one batch per compute shader (R0Y00#2635)

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* shader: lower s_bitset0/1_b32 in gfx2hlsl (R0Y00#2023 Item J) (R0Y00#2638)

* shader: lower s_bitset0/1_b32 in gfx2hlsl (R0Y00#2023 Item J)

Port the pixel_aot bit set/clear SOP1 forms so ordinary vertex and pixel
pipelines that only need an in-place scalar bit update stop refusing at
s_bitset1_b32. SCC stays unchanged; lane masks and descriptor SGPRs refuse.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

* test: pin sopk descriptor-refusal mutation to sopk-only raise

s_bitset0/1_b32 reused the plain-scalar sym allow-list line, so the
sopk_accum mutant needle was no longer unique. Match the sopk raise that
formats with `base` instead.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

* startup: implement command-list slot 14 Dispatch (Part of R0Y00#870) (R0Y00#1974)

* feat: record command-list slot 14 Dispatch on the desktop list

Part of R0Y00#870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* tests: drive native slot 14 Dispatch through the stand-in

startup_list_dispatch_native creates a guest device on a desktop
adapter (WARP or hardware, debug layer on when installed) and drives
command-list slots 86, 25, 33, 43, 148, 14, 9 and 139 of the stand-in.
Each refused case must write exactly one
"x2w-render Dispatch(x, y, z) refused: <reason>" line, with the
expected reason, to X2W_TRAP_LOG:

- a root SRV never set;
- a rejected (foreign address) or misaligned slot 43 replacement after
  a valid one;
- a root changed and changed back without a new slot 43;
- a pipeline built against another root;
- a root with a descriptor table, and a root with a static sampler;
- an unset root SRV with zero groups;
- 65536 groups on X;
- a Dispatch on the closed list;
- a Dispatch after Reset without new bindings.

A forwarded case must write no line. The fixture wraps a
pipeline-statistics query around every slot 14 call on an open list,
recorded on the underlying desktop list: CSInvocations must be 4 per
group when forwarded and 0 when refused. The fully bound call is
recorded alone and read back first, so a slot 14 that records nothing
fails on its count. All three recordings are executed to a fence and
the debug layer must report no error.

The skip_srv control drops slot 43 from the first forwarded case and
must report it as refused. Each of these one-line changes to
d3d12_xs_device.cpp makes the WARP and hardware tests fail: the
refusal branch never taken, compute_srv_bound not cleared by slot 33,
the bit not cleared by a rejected slot 43, compute_root_has_arguments
forced false, root_matches_pipeline forced true, and the slot 14
registration removed.

The docs section now names the device fixture and corrects the
sentence on which compute root-argument slots have handlers.

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

* docs: list_dispatch header names slot 43 as forwarded

---------

Co-authored-by: The Void <mrdominogrm@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Royoo <3230853833@qq.com>

* startup: implement command-list slots 37 and 39 root constants and views (Part of R0Y00#870) (R0Y00#1975)

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* fix: track which compute root constant words were set; drop slot 40 claim

* tests: run both PowerShell shells in parallel in startup_run_ps1 (R0Y00#2487)

* shader: preserve proven 32-bit graphics table offsets across forward joins (R0Y00#2507)

* fix: carry descriptor pointers through s_add_u32/s_addc_u32 in gfx2hlsl

A table or root pointer advanced by a literal offset now keeps its source and
byte offset, so a following s_load reads the advanced descriptor. A register
addend on a pointer is refused instead of silently keeping the old pointer.

Part of R0Y00#1723

* shader: refuse descriptor pointer advances across branches and detached s_addc_u32 in gfx2hlsl (Part of R0Y00#1723)

* shader: keep the pointer-advance bookkeeping safe for stages without branch state (Part of R0Y00#1723)

* fix: keep the branch-join refusal for pointer adds in branching shaders

* fix: require the matching high-word add before folding an advanced descriptor pointer

* fix: advance 32-bit table pointers without a high word and judge the high operand by content

* shader: keep 32-bit table offsets at agreeing forward graphics joins

Track a literal table address across copies and forward paths only when the incoming resource and byte offset agree. Exercise the published manifest against two GPU resources and compare all 32 pixels, including the root constant used by the branches.

AI-assisted with Codex (GPT-6.2 Astra, xhigh).

* fix: keep descriptor pointer pair open until its matching s_addc_u32

* tests: cover vertex-table carries and backward edges in pointer propagation

Exercise the two surviving mutations reported on R0Y00#2507 using full source-built programs. AI-assisted with Codex (GPT-6.2 Astra, xhigh).

* fix: let the descriptor pointer pair pass translate's SCC check, add WARP readback case

* fix: refuse an untracked-offset pointer as a descriptor, run the pointer check in Linux CI

* fix: refuse a root pointer load whose high word was overwritten

* Revert "fix: refuse a root pointer load whose high word was overwritten"

This reverts commit 0f226c5.

---------

Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>

* tests: split four long CPU checks into parallel ctest cases (R0Y00#2489)

* tests: split four long CPU checks into parallel ctest cases

* docs: say in the file headers that CTest runs the parts and check runs them all

* fix: let the no-path x87 aggregate modes parse without file arguments

* shader: lower s_abs_i32 in gfx2hlsl (Part of R0Y00#1723) (R0Y00#2640)

* shader: lower s_abs_i32 in gfx2hlsl (R0Y00#1723)

Port the pixel_aot signed absolute SOP1 so ordinary pipelines that only need
|S0| stop refusing. SCC is the nonzero test of the result; INT_MIN stays.
Lane masks and descriptor words are refused. CPU fixture with a negative control.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

* test: pin sopk descriptor-refusal mutation to sopk-only raise

s_bitset0/1_b32 reused the plain-scalar sym allow-list line, so the
sopk_accum mutant needle was no longer unique. Match the sopk raise that
formats with `base` instead.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

* test: add D3D12 WARP dispatch readback for s_abs_i32

Mirror the R0Y00#2639 / pack_absdiff UAV dump pattern. Cover INT_MIN, -1, 0,
a positive word, SCC, and an SCC-dependent branch on the adapter.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

* build: register s_abs_i32 WARP/hardware dispatch ctests

Wire startup_gfx2hlsl_s_abs_dispatch_{warp,hardware} to the new
UAV-readback mode so Windows CI and Sander can run the fixture.

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Co-authored-by: Royoo <3230853833@qq.com>

* startup: accept the slot 57 count exchange entered under a v_cmpx-narrowed EXEC (Part of R0Y00#2413) (R0Y00#2643)

* startup: accept the slot 57 count exchange entered under a v_cmpx-narrowed EXEC

The region before the count exchange may end with s_mov_b64 exec, -1, a
v_cmpx_gt_u32_e32 or v_cmpx_lt_u32_e32 of an SGPR against the proven
thread index, and an s_cbranch_execz to the exchange's first s_barrier.
The skipped block may hold lane-only instructions and scalar ALU whose
results are dead at the exchange: no SGPR it writes is read from the
exchange on, and SCC is rewritten by the exchange's s_cmp_eq_i32 before
any read. Both count-exchange arms replace EXEC before lane-dependent
work, and the HLSL barrier runs for every thread. Branches into the
skipped block, other compare sources, scalar loads and other execz
blocks stay refused.

AI-assisted.

* startup: accept any defined operands in the slot 57 count-entry compare

The entry before the count exchange no longer requires the compare to use
the thread index. The skipped block only leaves lane-predicated VGPR
writes and scalar results that are dead at the exchange, and both exchange
arms replace EXEC, so any per-lane EXEC from v_cmpx_gt_u32_e32 or
v_cmpx_lt_u32_e32 gives the same visible result for a per-lane skip as for
a per-wave skip. Each VGPR operand must be defined for every lane (not an
entry value or left stale by an exchange); SGPRs and constants are taken.

AI-assisted.

* tests: select the hardware adapter for indirect Dispatch readbacks (R0Y00#2652)

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>

* gfx2hlsl: lower the compute buffer store `off` form when its data is proven wave-uniform (R0Y00#2651)

* gfx2hlsl: lower the compute buffer store `off` form when its data is proven wave-uniform

A MUBUF store with neither offen nor idxen gives every lane the same byte
address (soffset plus the immediate), so the active lanes race on one
location. When every data VGPR holds one proven value in all enabled lanes
the order does not matter, and the store lowers like the offen form with no
VGPR term. The proof is the one v_readfirstlane_b32 already uses (entry
block with a known EXEC, or a recomputable expression with no join or EXEC
write since the definition), now shared as Stage.proven_uniform_v.

v_lshrrev_b64 / v_lshlrev_b64 / v_ashrrev_i64 with scalar or literal
sources now mark both destination halves uniform, under the same conditions
Stage.one applies to the 32-bit VALU forms.

Any other `off` store keeps a named refusal: "buffer store off with data not
proven wave-uniform". The atomic `off` form is unchanged.

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

* tests: cover the off store proof past the entry block

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

* tests: dispatch two off-store compute cases and decode the hand-assembled words

Cases O-dword (8 lanes, SGPR soffset plus immediate) and O-shift (32 lanes,
dwordx4 of a 64-bit shift of a scalar pair) store in the off form, so every
lane of a group writes one address. Their expected words are computed from
the instruction semantics, and the dispatch mode compares all 320 words.
The hand-assembled words are decoded with the repository disassembler and
must match their source lines.

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* shader: lower 64-bit scalar bit-count and scan ops in gfx2hlsl (Part of R0Y00#1723) (R0Y00#2072)

* shader: lower s_bcnt0/1, s_ff0/ff1_i32_b64 and s_flbit_i32_b64/i64 in gfx2hlsl (Part of R0Y00#1723)

* docs: document startup scalar bit count and scan lowering (Part of R0Y00#1723)

* test: draw the 64-bit scalar bit scans on the adapter and read them back (R0Y00#1723)

* docs: describe the scalar bit scan draw test and list it in the Linux checks (R0Y00#1723)

* Carry bit-scan words through the float render target

---------

Co-authored-by: Royoo <3230853833@qq.com>

* tests: batch heap-view store references by compute shader (R0Y00#2654)

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* runtime: create committed resources through device slot 76 (R0Y00#2648)

* runtime: create committed resources through device slot 76

Device slot 76 (Xbox order, +0x260) takes the seven arguments of desktop
CreateCommittedResource (heap properties, heap flags, desc, initial
state, clear value, riid, ppv); on main the wrapper trapped on it. A
console package module creates its resources through it.

The slot-127 body becomes create_committed(slot, ...): slot 127 calls it
as before, slot 76 without a protected session or castable formats, so
both share the per-heap initial state, clear-value retry and title
memory. The log line names the slot.

New fixture with a negative control: startup_committed_slot76_warp and
_hardware (a render target with a clear value and default, upload and
readback buffers); the control asks for a 2D texture on an upload heap.

* Require exact rejection in the slot 76 control

---------

Co-authored-by: Royoo <3230853833@qq.com>

* startup: lower abs (|src| and -|src|) on v_cndmask_b32_e64 sources (R0Y00#2439)

Co-authored-by: Royoo <3230853833@qq.com>

* startup: handle vertex fetch with invalid input layout in gfx2hlsl (Part of R0Y00#1723) (R0Y00#2002)

* startup: translate a stream vertex fetch whose pipeline declares an empty input layout

A stream vertex shader that calls the fetch routine was refused whenever the
pipeline had no input layout elements. A layout declared with zero elements is
now published as 'ia1 0'; the translator reads each fetched register as zero
instead of refusing. A stream without a readable layout is still refused.

* docs: describe the empty input layout request (ia1 0) and its zero default

* test: draw readback for an empty declared input layout

* fix: gate zero-element input layout zero-fill behind X2W_STREAM_ZERO_FILL opt-in

* shader: lower gfx1030 comparison sample LOD and bias (R0Y00#1568)

* compute: accept gfx1013 image_atomic_umin on R32_UINT

gfx1013 image atomics covered add, umax and cmpswap only; M200-01 A stops at
unsigned image minimum. Allow umin with the shared gfx1030 InterlockedMin
lowering, keep it unsigned, and extend the gfx1013 fixture (high-bit operand
0x80000011 vs smin). Other ops stay refused.

Refs R0Y00#2618

Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>

* gfx2hlsl: lower the carry of adjacent compute address adds (R0Y00#2658)

Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>

* shader: lower experimental gfx1030 2D sample clamps (R0Y00#1638)

Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>

* startup: return E_OUTOFMEMORY when a D3D12 wrapper cannot be allocated (R0Y00#2656)

* startup: return E_OUTOFMEMORY when a D3D12 wrapper cannot be allocated

wrap() used the _aligned_malloc result without a check, so a failed
allocation under the job commit limit became a write through a null
pointer inside d3d12_xs.dll (seen at the slot 55 derived-pipeline
placeholder). wrap() now returns nullptr when the allocation or the
registry insert fails. Each of its 16 callers releases the desktop
object it created and returns E_OUTOFMEMORY with a null output.

startup_wrap_allocation_warp forces the failure through the
fixture-only export x2w_d3d12_fail_wraps for device creation and slots
8, 14, 16 and 55; the control never arms it and must report the
failure.

Fixes R0Y00#2653

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

* tests: cover the allocator, command list and committed-resource wrap failures

Review follow-up on R0Y00#2653. startup_wrap_allocation now also arms the
failure for device slot 9 (CreateCommandAllocator, the shared
create_slot path), slot 73 (command list) and slot 127 (committed
resource). Each must return E_OUTOFMEMORY with a null output, then
succeed. Removing the slot 73 null check makes the test crash at that
slot.

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

* Preserve the published D3D12 device on wrapper allocation failure

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Royoo <3230853833@qq.com>

* startup: lower one slot 57 scalar load in a pre-exchange execz block (R0Y00#2660)

A pre-exchange s_cbranch_execz block may hold one s_buffer_load_dword
whose result is live after the join, when EXEC there comes from
s_mov_b64 exec, -1 then v_cmpx_gt_u32_e32 of a wave-uniform SGPR bound
against the proven thread index, with no EXEC write or branch target in
between. The guest runs the block for the whole wave when any lane is
active, so the HLSL computes wave_any = (tid & ~63u) < bound at the
compare, branches around the block only when the wave is empty, and
gives the loaded word to every lane of a wave that has an active lane.
An empty wave issues no load and keeps the previous value. Vector writes
in the block stay predicated per lane. Other compares, non-uniform bounds
or offsets, s_load_dword, wider loads and a second live scalar stay
refused.

AI-assisted.

---------

Co-authored-by: Ammar Abdelfattah <a.mmar067a.mmar067@gmail.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: JVProg <100954822+JVProg@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: dnn <55638248+denn0x@users.noreply.github.com>
Co-authored-by: Royoo <3230853833@qq.com>
Co-authored-by: Leyukaka <45659323+Leyukaka@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <lycqay@gmail.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: Chad Hyatt <chad@hyatt.page>
Co-authored-by: lukaslw-lab <lukaslw@gmail.com>
Co-authored-by: lukaslw-lab <291379150+lukaslw-lab@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: SimSalabimse <SimSalabimse@users.noreply.github.com>
Co-authored-by: chasegrindy <szymonkubica.biz@gmail.com>
Co-authored-by: chasegrindy <302242206+chasegrindy@users.noreply.github.com>
Co-authored-by: The Void <mrdominogrm@gmail.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: NiiRoZz <simonin.remi25@gmail.com>
Co-authored-by: pigalot <pigalot@gmail.com>
Co-authored-by: triggered02 <153171514+triggered02@users.noreply.github.com>
Co-authored-by: yjs <1245206726@qq.com>
Co-authored-by: saii <120340942+Not-Saii@users.noreply.github.com>
tedin7 added a commit that referenced this pull request Nov 26, 2026
…t indexes (#2532)

* feat: record the compute root signature and descriptor tables (slots 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 #870.

* feat: record compute descriptor tables (slot 35) and clear them on a root or heap change

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* fix: track which compute root constant words were set; drop slot 40 claim

* Dispatch translated compute programs with raw table buffers

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>

* Log untranslated compute dispatches on their own line budget

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>

* Count compute dispatches per key with their first refusal

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>

* Dispatch translated compute programs that store to 2D textures

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>

* Dispatch translated compute programs that read 2D textures

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>

* Check a compute manifest without entry values at Dispatch

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

* Document texture views and the census of translated compute Dispatch

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

* Check the device on every 64th translated Dispatch and drop a liveness 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>

* Compute dispatch: allow two outputs of one texture, refuse packed outputs, 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>

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

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 <noreply@anthropic.com>

* startup: drop a heap record control whose branch target was inside an instruction

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 <noreply@anthropic.com>

* startup: read the stage kind as the other handlers do in the heap load

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 <noreply@anthropic.com>

* startup: avoid calling the compute driver after process termination begins

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).

* Repair a broken line in the dispatch check

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

* Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input

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

* Drop the repeated compute root reset left by merging two slot 14 snapshots

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 <noreply@anthropic.com>

---------

Co-authored-by: tedin7 <tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 26, 2026
Step (d), first half: gate the compute-dispatch experiment behind X2W_COMPUTE_DISPATCH=1.

Rebased onto a main whose command-list slot 14 Dispatch already exists (R0Y00#1974): main installs slot 14
unconditionally and forwards only when a desktop compute pipeline and root signature are bound and the
root arguments are forwarded (`decide_dispatch` in `src/startup_stubs/list_dispatch.h`, covered by
startup_list_dispatch and startup_list_dispatch_native). That newer code fully supersedes this PR's own
slot 14 handler, so the handler and its gated `list_typed[14]` registration are dropped rather than
duplicated. The gate covers the slot 62 side instead, which is what this PR adds: with
X2W_COMPUTE_DISPATCH=1 a validated `<key>.cs.cso` is loaded and the desktop pipeline records
`own().pipeline_root`, so main's existing gate can match it against the bound compute root signature.
Without the variable nothing is loaded, so production behaviour is unchanged and nothing can dispatch
on the placeholder path.

Still outstanding, and why this is not marked ready: the source-built two-arm readback (invalid
artifact -> zero recorded dispatches, accepted artifact -> nonzero UAV readback). The gate exists so
that fixture can turn the path on explicitly; until it passes, the default is inert.
triggered02 added a commit to triggered02/Xbox2Windows that referenced this pull request Nov 26, 2026
Step (d), first half: gate the compute-dispatch experiment behind X2W_COMPUTE_DISPATCH=1.

Rebased onto a main whose command-list slot 14 Dispatch already exists (R0Y00#1974): main installs slot 14
unconditionally and forwards only when a desktop compute pipeline and root signature are bound and the
root arguments are forwarded (`decide_dispatch` in `src/startup_stubs/list_dispatch.h`, covered by
startup_list_dispatch and startup_list_dispatch_native). That newer code fully supersedes this PR's own
slot 14 handler, so the handler and its gated `list_typed[14]` registration are dropped rather than
duplicated. The gate covers the slot 62 side instead, which is what this PR adds: with
X2W_COMPUTE_DISPATCH=1 a validated `<key>.cs.cso` is loaded and the desktop pipeline records
`own().pipeline_root`, so main's existing gate can match it against the bound compute root signature.
Without the variable nothing is loaded, so production behaviour is unchanged and nothing can dispatch
on the placeholder path.

Still outstanding, and why this is not marked ready: the source-built two-arm readback (invalid
artifact -> zero recorded dispatches, accepted artifact -> nonzero UAV readback). The gate exists so
that fixture can turn the path on explicitly; until it passes, the default is inert.
tedin7 added a commit that referenced this pull request Nov 26, 2026
…buffer (#2580)

* feat: record the compute root signature and descriptor tables (slots 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 #870.

* feat: record compute descriptor tables (slot 35) and clear them on a root or heap change

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* fix: track which compute root constant words were set; drop slot 40 claim

* Dispatch translated compute programs with raw table buffers

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>

* Log untranslated compute dispatches on their own line budget

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>

* Count compute dispatches per key with their first refusal

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>

* Dispatch translated compute programs that store to 2D textures

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>

* Dispatch translated compute programs that read 2D textures

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>

* Check a compute manifest without entry values at Dispatch

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

* Document texture views and the census of translated compute Dispatch

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

* Check the device on every 64th translated Dispatch and drop a liveness 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>

* Compute dispatch: allow two outputs of one texture, refuse packed outputs, 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>

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

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 <noreply@anthropic.com>

* startup: drop a heap record control whose branch target was inside an instruction

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 <noreply@anthropic.com>

* startup: read the stage kind as the other handlers do in the heap load

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 <noreply@anthropic.com>

* startup: avoid calling the compute driver after process termination begins

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).

* Repair a broken line in the dispatch check

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

* Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input

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

* startup: bind a compute heap record whose index is a table buffer word at a dispatch-constant offset

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 <noreply@anthropic.com>

* docs: a compute heap record whose index is read from a table buffer

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

* docs: state the measured first refusals and the heap-record ceiling exactly

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

* Drop the repeated compute root reset left by merging two slot 14 snapshots

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 <noreply@anthropic.com>

* startup: keep the descriptor load tag when checking the index word's table buffer

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

* startup: read the pipe's modified set tolerantly in the heap index word check

Three existing checks build a stage on a bare pipe object without it.

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

---------

Co-authored-by: tedin7 <tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
tedin7 added a commit that referenced this pull request Nov 26, 2026
…mpute Dispatch (#2585)

* feat: record the compute root signature and descriptor tables (slots 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 #870.

* feat: record compute descriptor tables (slot 35) and clear them on a root or heap change

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* fix: track which compute root constant words were set; drop slot 40 claim

* Dispatch translated compute programs with raw table buffers

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>

* Log untranslated compute dispatches on their own line budget

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>

* Count compute dispatches per key with their first refusal

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>

* Dispatch translated compute programs that store to 2D textures

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>

* Dispatch translated compute programs that read 2D textures

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>

* Check a compute manifest without entry values at Dispatch

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

* Document texture views and the census of translated compute Dispatch

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

* Check the device on every 64th translated Dispatch and drop a liveness 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>

* Compute dispatch: allow two outputs of one texture, refuse packed outputs, 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>

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

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 <noreply@anthropic.com>

* startup: drop a heap record control whose branch target was inside an instruction

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 <noreply@anthropic.com>

* startup: read the stage kind as the other handlers do in the heap load

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 <noreply@anthropic.com>

* startup: avoid calling the compute driver after process termination begins

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).

* Repair a broken line in the dispatch check

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

* Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input

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

* startup: bind a compute heap record whose index is a table buffer word at a dispatch-constant offset

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 <noreply@anthropic.com>

* docs: a compute heap record whose index is read from a table buffer

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

* docs: state the measured first refusals and the heap-record ceiling exactly

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

* Drop the repeated compute root reset left by merging two slot 14 snapshots

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 <noreply@anthropic.com>

* startup: keep the descriptor load tag when checking the index word's table buffer

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

* startup: read the pipe's modified set tolerantly in the heap index word check

Three existing checks build a stage on a bare pipe object without it.

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

* startup: bind LOD-clamped static samplers (smpl) in the translated compute Dispatch

The compute manifest reader accepts smpl lines through the draw path's
TranslatedSamplers and create_translated_root. smpc and smpheap now refuse
with their own reasons. The texture fixture gains a 2x1 filtered case whose
wrap, linear sampler reads 0.5 at the left edge, with a clamp control.

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

---------

Co-authored-by: tedin7 <tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: c1 <c1@x.invalid>
tedin7 added a commit that referenced this pull request Nov 26, 2026
…ptor (#2596)

* feat: record the compute root signature and descriptor tables (slots 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 #870.

* feat: record compute descriptor tables (slot 35) and clear them on a root or heap change

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* fix: track which compute root constant words were set; drop slot 40 claim

* Dispatch translated compute programs with raw table buffers

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>

* Log untranslated compute dispatches on their own line budget

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>

* Count compute dispatches per key with their first refusal

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>

* Dispatch translated compute programs that store to 2D textures

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>

* Dispatch translated compute programs that read 2D textures

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>

* Check a compute manifest without entry values at Dispatch

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

* Document texture views and the census of translated compute Dispatch

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

* Check the device on every 64th translated Dispatch and drop a liveness 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>

* Compute dispatch: allow two outputs of one texture, refuse packed outputs, 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>

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

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 <noreply@anthropic.com>

* startup: drop a heap record control whose branch target was inside an instruction

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 <noreply@anthropic.com>

* startup: read the stage kind as the other handlers do in the heap load

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 <noreply@anthropic.com>

* startup: avoid calling the compute driver after process termination begins

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).

* Repair a broken line in the dispatch check

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

* Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input

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

* startup: bind a compute heap record whose index is a table buffer word at a dispatch-constant offset

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 <noreply@anthropic.com>

* docs: a compute heap record whose index is read from a table buffer

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

* docs: state the measured first refusals and the heap-record ceiling exactly

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

* Drop the repeated compute root reset left by merging two slot 14 snapshots

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 <noreply@anthropic.com>

* startup: keep the descriptor load tag when checking the index word's table buffer

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

* startup: read the pipe's modified set tolerantly in the heap index word check

Three existing checks build a stage on a bare pipe object without it.

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

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

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 <noreply@anthropic.com>

* startup: check that compute output strides keep the swizzle bits

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 <noreply@anthropic.com>

---------

Co-authored-by: tedin7 <tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: c1 <c1@x.invalid>
tedin7 added a commit that referenced this pull request Nov 26, 2026
…one refusal (#2624)

* feat: record the compute root signature and descriptor tables (slots 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 #870.

* feat: record compute descriptor tables (slot 35) and clear them on a root or heap change

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* fix: track which compute root constant words were set; drop slot 40 claim

* Dispatch translated compute programs with raw table buffers

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>

* Log untranslated compute dispatches on their own line budget

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>

* Count compute dispatches per key with their first refusal

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>

* Dispatch translated compute programs that store to 2D textures

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>

* Dispatch translated compute programs that read 2D textures

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>

* Check a compute manifest without entry values at Dispatch

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

* Document texture views and the census of translated compute Dispatch

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

* Check the device on every 64th translated Dispatch and drop a liveness 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>

* Compute dispatch: allow two outputs of one texture, refuse packed outputs, 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>

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

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 <noreply@anthropic.com>

* startup: drop a heap record control whose branch target was inside an instruction

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 <noreply@anthropic.com>

* startup: read the stage kind as the other handlers do in the heap load

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 <noreply@anthropic.com>

* startup: avoid calling the compute driver after process termination begins

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).

* Repair a broken line in the dispatch check

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

* Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input

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

* startup: bind a compute heap record whose index is a table buffer word at a dispatch-constant offset

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 <noreply@anthropic.com>

* docs: a compute heap record whose index is read from a table buffer

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

* docs: state the measured first refusals and the heap-record ceiling exactly

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

* Drop the repeated compute root reset left by merging two slot 14 snapshots

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 <noreply@anthropic.com>

* startup: keep the descriptor load tag when checking the index word's table buffer

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

* startup: read the pipe's modified set tolerantly in the heap index word check

Three existing checks build a stage on a bare pipe object without it.

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

* startup: name the condition a compute buffer input failed instead of one refusal

indirect_table_buffer takes an optional out-parameter and names, for every empty result, the condition that
failed: zero records, a range over 16 MiB, one crossing a placed buffer or upload allocation, an address outside
any placed buffer, a placed buffer that does not alias title memory, a view token that is not a buffer view, and
the resource checks. The translated compute Dispatch uses it as its refusal reason in place of "an input is not a
complete GPU-backed buffer range", and logs once per key which input failed and where its descriptor was read.
The draw callers do not ask for the reason; nothing bound or refused changes.

startup_compute_dispatch_input_check.py refuses five replaced input descriptors, each with its own reason and an
untouched output, after the unchanged recording matches all 320 words.

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

* docs: describe the zero-record descriptor by its shape and qualify the #2218 overlap

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

---------

Co-authored-by: tedin7 <tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: c1 <c1@x.invalid>
Co-authored-by: R0Y00 <R0Y00@users.noreply.github.com>
R0Y00 pushed a commit that referenced this pull request Nov 26, 2026
…esource (#2625)

* feat: record the compute root signature and descriptor tables (slots 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 #870.

* feat: record compute descriptor tables (slot 35) and clear them on a root or heap change

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* startup: record SetComputeRoot32BitConstant(s) (list slots 37, 39)

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.

* feat: record command-list slot 14 Dispatch on the desktop list

Part of #870. Forward Dispatch only with a desktop compute pipeline and root
bound and group counts within 65535 per axis; refuse otherwise.

* startup: refuse Dispatch under a compute root with unforwarded arguments, document slot 14

* startup: gate Dispatch on bound compute root SRVs and a pipeline built 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.

* fix: pass pipeline root out-param in slot86 mesh cached pipeline build

* fix: track which compute root constant words were set; drop slot 40 claim

* Dispatch translated compute programs with raw table buffers

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>

* Log untranslated compute dispatches on their own line budget

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>

* Count compute dispatches per key with their first refusal

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>

* Dispatch translated compute programs that store to 2D textures

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>

* Dispatch translated compute programs that read 2D textures

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>

* Check a compute manifest without entry values at Dispatch

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

* Document texture views and the census of translated compute Dispatch

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

* Check the device on every 64th translated Dispatch and drop a liveness 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>

* Compute dispatch: allow two outputs of one texture, refuse packed outputs, 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>

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

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 <noreply@anthropic.com>

* startup: drop a heap record control whose branch target was inside an instruction

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 <noreply@anthropic.com>

* startup: read the stage kind as the other handlers do in the heap load

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 <noreply@anthropic.com>

* startup: avoid calling the compute driver after process termination begins

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).

* Repair a broken line in the dispatch check

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

* Pin four existing texture dispatch refusals: integer view format, manifest version, stage, output also an input

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

* startup: bind a compute heap record whose index is a table buffer word at a dispatch-constant offset

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 <noreply@anthropic.com>

* docs: a compute heap record whose index is read from a table buffer

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

* docs: state the measured first refusals and the heap-record ceiling exactly

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

* Drop the repeated compute root reset left by merging two slot 14 snapshots

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 <noreply@anthropic.com>

* startup: keep the descriptor load tag when checking the index word's table buffer

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

* startup: read the pipe's modified set tolerantly in the heap index word check

Three existing checks build a stage on a bare pipe object without it.

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

* startup: name the condition a compute buffer input failed instead of one refusal

indirect_table_buffer takes an optional out-parameter and names, for every empty result, the condition that
failed: zero records, a range over 16 MiB, one crossing a placed buffer or upload allocation, an address outside
any placed buffer, a placed buffer that does not alias title memory, a view token that is not a buffer view, and
the resource checks. The translated compute Dispatch uses it as its refusal reason in place of "an input is not a
complete GPU-backed buffer range", and logs once per key which input failed and where its descriptor was read.
The draw callers do not ask for the reason; nothing bound or refused changes.

startup_compute_dispatch_input_check.py refuses five replaced input descriptors, each with its own reason and an
untouched output, after the unchanged recording matches all 320 words.

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

* docs: describe the zero-record descriptor by its shape and qualify the #2218 overlap

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

* startup: bind a compute input behind a memory view token in its own resource

A buffer view token whose resource is on a custom heap outside the placement
index (the memory view path places it in the title's own heap) was refused
because the placement lookup of its range finds no owner. Its desktop resource
is that memory, so the view offset is bound there.

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

---------

Co-authored-by: tedin7 <tedin7@users.noreply.github.com>
Co-authored-by: tedin7 <tommasoderosa94@gmail.com>
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Co-authored-by: tedin7 <110300616+tedin7@users.noreply.github.com>
Co-authored-by: RavenCurseBurg <360931527+RavenCurseBurg@users.noreply.github.com>
Co-authored-by: c1 <c1@x.invalid>
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.

3 participants