runtime: cap slot-19 output UAV intervals at the D3D12 element limit #3473

Manually merged
github merged 1 commit from github-bot/gh-3471 into gh-pr/3471/base 2026-11-30 02:40:24 +00:00 AGit
Owner

@⁠JB2WIN on GitHub · 2026-11-29 16:25 UTC · original
JB2WIN:runtime/output-uav-raw-limit → main · +29 −11 · 3 files · 1 commits · merged 2026-11-30 02:37 UTC

Refs #3226. Takes the cap part of the output-interval refusal (agreed with @⁠Not-Saii on #3226).

A slot-19 output token's buffer is bound in place as a UAV, with no copy. The 16 MiB cap in compute_token_output came from the snapshot copies and has no reason on this path. #2477 made the same change for raw input views. The interval check now refuses only when the title's view has more than 2^27 elements, or the R32 raw UAV made from it (bytes / 4 elements) does. The new reason is an output UAV interval exceeds the D3D12 buffer view element limit.

The limit is counted in elements, not bytes, so a typed view with 2-byte elements cannot pass more than 2^27 elements (found in review).

Census target: an output UAV interval is over 16 MiB (1 shader, 592,749 dispatches in Leyukaka's 600 s run). By default this probably will not move the dispatch count yet. @⁠Not-Saii expects this shader's view to cover a whole 24 MiB copied_buffer placement, which then stops at an output token's backing does not uniquely alias its guest byte interval unless X2W_COPIED_OBJECT_UAV is on. I have not run the title on this branch, so that is untested.

Tests (RTX 3080 and WARP):

  • startup_compute_token_interval_{warp,hardware}: the former 16 MiB + 16 bytes refusal control is now a bound case (offset=0 bytes=16777232 result=bound, no refusal). The two other interval controls still refuse by name. The fixture does not read back the large buffer, so it shows the binding, not the written values.
  • With the src/ change reverted, both token interval tests fail.
  • startup_compute_dispatch_{input,output,native}_* and startup_compute_indexed_atomic_uav_* (which use the same large-buffer mode) pass. native_warp and indexed_atomic_uav_warp skip as on main.
  • Not tested: a view over 2^27 elements. D3D12 rejects it at creation, and with the debug layer on that removes the device.

AI-assisted.

🤖 Generated with Claude Code

**@⁠JB2WIN** on GitHub · 2026-11-29 16:25 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3471) `JB2WIN:runtime/output-uav-raw-limit` → `main` · +29 −11 · 3 files · 1 commits · merged 2026-11-30 02:37 UTC Refs #3226. Takes the cap part of the output-interval refusal (agreed with @⁠Not-Saii on #3226). A slot-19 output token's buffer is bound in place as a UAV, with no copy. The 16 MiB cap in `compute_token_output` came from the snapshot copies and has no reason on this path. #2477 made the same change for raw input views. The interval check now refuses only when the title's view has more than 2^27 elements, or the R32 raw UAV made from it (`bytes / 4` elements) does. The new reason is `an output UAV interval exceeds the D3D12 buffer view element limit`. The limit is counted in elements, not bytes, so a typed view with 2-byte elements cannot pass more than 2^27 elements (found in review). Census target: `an output UAV interval is over 16 MiB` (1 shader, 592,749 dispatches in Leyukaka's 600 s run). By default this probably will not move the dispatch count yet. @⁠Not-Saii expects this shader's view to cover a whole 24 MiB `copied_buffer` placement, which then stops at `an output token's backing does not uniquely alias its guest byte interval` unless `X2W_COPIED_OBJECT_UAV` is on. I have not run the title on this branch, so that is untested. Tests (RTX 3080 and WARP): - `startup_compute_token_interval_{warp,hardware}`: the former 16 MiB + 16 bytes refusal control is now a bound case (`offset=0 bytes=16777232 result=bound`, no refusal). The two other interval controls still refuse by name. The fixture does not read back the large buffer, so it shows the binding, not the written values. - With the `src/` change reverted, both token interval tests fail. - `startup_compute_dispatch_{input,output,native}_*` and `startup_compute_indexed_atomic_uav_*` (which use the same large-buffer mode) pass. `native_warp` and `indexed_atomic_uav_warp` skip as on `main`. - Not tested: a view over 2^27 elements. D3D12 rejects it at creation, and with the debug layer on that removes the device. AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A slot-19 output token's buffer is bound in place, so the 16 MiB cap taken from the snapshot copies does not
apply. Refuse instead when the title's view or the raw UAV made from it has more than 2^27 elements.

Refs #3224

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 16:28:26 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-11-29 17:27 UTC · original · approved these changes

Diff reading only at 54e661b6; nothing built or run.

Checked: the token output is bound in place (views[i] = {token.resource, token.offset, token.bytes, true}, then a raw R32 UAV of bytes / 4 elements or the described view), so no copy is sized by the interval and the 16 MiB snapshot limit does not apply here. The new bound, 2^27 elements (D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP), is D3D12's own buffer view limit, so nothing D3D12 would accept is refused. The other checks and their order are unchanged.

NIT tests/startup_compute_token_interval_check.py:77-81: the large case shows the 16 MiB cap is gone, but nothing reaches the new branch; removing the new if leaves the test green. The docstring gives the reason (D3D12 rejects such a view at creation), so this is fine as is.

**@⁠Leyukaka** on GitHub · 2026-11-29 17:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3471#pullrequestreview-6103967596) · **approved these changes** Diff reading only at 54e661b6; nothing built or run. Checked: the token output is bound in place (`views[i] = {token.resource, token.offset, token.bytes, true}`, then a raw R32 UAV of `bytes / 4` elements or the described view), so no copy is sized by the interval and the 16 MiB snapshot limit does not apply here. The new bound, 2^27 elements (`D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP`), is D3D12's own buffer view limit, so nothing D3D12 would accept is refused. The other checks and their order are unchanged. NIT `tests/startup_compute_token_interval_check.py:77-81`: the large case shows the 16 MiB cap is gone, but nothing reaches the new branch; removing the new `if` leaves the test green. The docstring gives the reason (D3D12 rejects such a view at creation), so this is fine as is.
github-bot changed target branch from main to gh-pr/3471/base 2026-11-30 02:40:23 +00:00
github manually merged commit 54e661b65b into gh-pr/3471/base 2026-11-30 02:40:24 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.