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

Merged
NiiRoZz merged 79 commits from upstream-pr/2624 into main 2026-11-26 06:25:56 +00:00
NiiRoZz commented 2026-11-25 23:29:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T23:29:54Z.


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

What and why

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

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

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

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

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

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

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

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

Hypotheses this change lets the next run settle:

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

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

Tests

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

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

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

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

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

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

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

Unverified

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

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6615913555 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2624). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T23:29:54Z. --- Depends on #2580 (stacked on #2470 -> #2490 -> #2532 -> #2580). Refs #2274. ## What and why A translated compute Dispatch whose raw buffer input did not resolve was refused with one reason, `an input is not a complete GPU-backed buffer range`. In one local run that reason covered 18 program keys and 1,143,787 calls, the second largest runtime refusal, and the log could not say which condition failed. This change only names the condition. `indirect_table_buffer` takes an optional `why` out-parameter and sets it on every empty result; the compute Dispatch passes it and uses it as the refusal reason. The draw callers do not pass it; their results are unchanged (the indirect draw fixtures pass, see Tests). Reasons: - `an input buffer descriptor has zero records` - `an input buffer range is over 16 MiB or not whole dwords` - `an input range crosses the end of a placed buffer` - `an input range crosses the end of its upload allocation` - `an input is in title memory outside any placed buffer` - `an input is in a placed buffer that does not alias title memory` - `an input view token is not a buffer view of a desktop resource` - `an input buffer view has no element size or overflows` - `an input buffer view token names the list's upload memory` - `an input buffer view token's resource does not hold its range` - `an input buffer view token's resource is not on a default or upload heap` - `an input buffer descriptor has a null address` - `an input buffer range is not 16-byte aligned in its resource` - `an input buffer's resource is released` - `an input buffer's resource was not created in the common state` - `an input buffer's resource is on another device` - `an input range is outside its desktop buffer` The first refusal of each key also logs one line with the input index, its table or heap source and the descriptor address (`x2w-draw compute <key> first refused input <i> (table|heap <a> <b>), descriptor at <address>`). The line does not contain `refused: `, so the per-call refusal lines and the census format are unchanged. No form is newly bound. What was bound is still bound and what was refused is still refused. ## What the existing log shows (local observation, counts only) The census keeps the four descriptor words of each key's first refused call: | form (from the words) | keys | calls | |---|---|---| | zero records (nonzero base, no stride, word 3 zero) | 1 | 1,057,520 | | raw descriptor inside a placed buffer that fell back to a separate desktop copy (cause inferred from the creation log: base offset not 64 KiB aligned, or one buffer over several memory pieces) | 11 | 31,649 | | shader resource view token; failing condition not in the log | 6 | 54,618 | Hypotheses this change lets the next run settle: - Which of the five inputs of the zero-record key fails, and whether the record is one the title wrote or memory the stand-in never filled. The words are not shaped like the title's other buffer descriptors (word 3 is 0). On the hardware a load from a zero-record descriptor with its bounds check on (OOB_SELECT not 2) reads 0, so a null raw view would read the same. That is not bound here until the run shows where the record comes from. - Which condition the six view-token keys fail. - The words describe each key's first refused call only. Later calls of the same key are not shown to fail the same way. #2218 (open, opt-in) owns backing slot 133 buffers the desktop cannot alias and overlaps the second form, so this PR does not add a copy for it. Whether its scope covers these keys is not checked: most of them sit in one buffer created with unordered access. ## Tests New `tests/startup_compute_dispatch_input_check.py`, registered as `startup_compute_dispatch_input_{warp,hardware}`. It runs case A through the stand-in's list. The unchanged recording matches all 320 output words. Then five input descriptors are replaced, and each Dispatch is refused with its own reason and one input line, and every output word keeps its sentinel: - zero records (synthetic: nonzero base, word 3 zero); - 16 bytes past the placed input; - memory between the placed buffers; - a buffer placed at an offset the desktop cannot alias; - the token of a texture view. There is no new positive read-back because no form is newly bound. The existing dispatch tests, which pass unchanged, are the evidence that nothing changed. ```powershell .\tools\dev.ps1 cmake --preset dev cmake --build --preset dev ctest --preset dev --no-tests=error -j1 -R "^startup_compute_dispatch_" ``` Result: 10 of 10 passed, 0 skipped, 0 failed: `startup_compute_dispatch`, `_texture`, `_heap`, `_heap_word` and the new `_input`, each on WARP and on hardware. The debug layer was enabled and logged no error message in every run. - WARP: Microsoft Basic Render Driver, driver 10.0.26100.10068 - Hardware: NVIDIA GeForce RTX 5090, driver 32.0.16.2135 - Windows build 26300 `indirect_table_buffer` is shared with the indirect draw paths, so those fixtures ran too: `ctest --preset dev --no-tests=error -j1 -R "^startup_(indirect_|compute_dispatch_input_)"` passed 72 of 72 (WARP and hardware), 0 skipped. `tests/docs_links_check.py` and `tests/bidi_controls_check.py` pass. ## Unverified - The table above is decoded from words of an earlier run. A later local run with this change (other changes present too, so the key set differs) reported as first refusals: view token's resource does not hold its range 4 keys / 1,012,151 calls; placed buffer that does not alias title memory 36 / 719,280; view token not a buffer view of a desktop resource 3 / 67,923; zero records 2 / 9,217; title memory outside any placed buffer 1 / 7,658. - Nothing here shows that any title starts or runs. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tedin7 commented 2026-11-26 06:02:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T05:56:04Z.


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

What I checked (no merge, no push):

  • gh pr view 2624: state OPEN, mergeable CONFLICTING, 124 commits behind main, 75 commits on the branch (the open #2470 and #2490 parts are inside it).
  • python3 merge_check.py 2624: conflict plus no Win2025 receipt on this head.

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

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7183937348 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2624#issuecomment-7183937348). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T05:56:04Z. --- Not merging yet: this PR is stacked on #2470 -> #2490, and both are still open. #2532 and #2580 of the chain are merged now. What I checked (no merge, no push): - `gh pr view 2624`: state OPEN, mergeable CONFLICTING, 124 commits behind main, 75 commits on the branch (the open #2470 and #2490 parts are inside it). - `python3 merge_check.py 2624`: conflict plus no Win2025 receipt on this head. Next step: land #2470 and #2490 first, then update this branch with main (keep both sides) and run the review and the Win2025 tests on what is left of the diff. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 07:00:11 +00:00
tedin7 commented 2026-11-26 07:00:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T06:24:50Z.


Review and test receipt for #2624.

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

Review of the remaining diff:

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

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

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

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

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7184404722 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2624#issuecomment-7184404722). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T06:24:50Z. --- Review and test receipt for #2624. Dependency: #2470 and #2490 are in main through #2532 and #2580. After merging origin/main, the diff against main is only this PR's 6 files (CMakeLists.txt, docs/experiments.md, d3d12_compute_dispatch.inl, d3d12_draw.inl, startup_compute_dispatch_input_check.py, startup_stream_consumer.cpp). Review of the remaining diff: - Every empty result of `indirect_table_buffer` now sets a named reason; the compute Dispatch passes `&reason`, the draw callers do not, so their results are unchanged. - `startup_compute_dispatch_input_{warp,hardware}` checks five refusal reasons one by one (empty, past, unplaced, copied, token): exact reason text, no output word written, input unchanged, one `first refused input` line. - Merge conflicts with main were resolved keeping both sides (CMake test registration, the consumer test modes). Verification (Win2025 WARP, patched on the PR head merged with main, `--regex '^startup_compute_(dispatch|live_retry)(_[a-z_]+)?_warp$'`): - dev: 100% tests passed out of 7 (dispatch, dispatch_texture, dispatch_heap, dispatch_heap_word, dispatch_input, dispatch_entry, live_retry). - release: 100% tests passed out of 7 (same tests). - Linux: `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py` pass; `git diff --check` clean. - RTX 3090: not available (pod full / script failed); not a result of this PR. The live head f483a34e differs from the tested tree only in how the two tests are listed in `set_tests_properties`. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!2616
No description provided.