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

Merged
JB2WIN merged 1 commit from upstream-pr/3471 into main 2026-11-30 02:37:34 +00:00
JB2WIN commented 2026-11-29 16:25:50 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-29T16:25:50Z.


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

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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5552689432 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3471). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-29T16:25:50Z. --- Refs #3224. Takes the cap part of the output-interval refusal (agreed with @Not-Saii on #3224). 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)
Leyukaka commented 2026-11-29 17:27:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T17:27:00Z.

Review: APPROVED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6103967596 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3471#pullrequestreview-6103967596). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T17:27:00Z. **Review:** APPROVED --- 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.
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!3471
No description provided.