native: read formatted loads through a byte-address rewritten descriptor #3034

Merged
JB2WIN merged 1 commit from upstream-pr/3034 into cpp-migration 2026-11-27 10:16:00 +00:00
JB2WIN commented 2026-11-27 09:15:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-27T09:15:47Z.


Change

Target branch cpp-migration. Refs #3023. Follow-up to #3025 (merged as 1507f0e2); rebased onto cpp-migration b8f49259, so this PR is the one formatted-load commit.

formatted_byte_load (src/gfx1013_compute_mtbuf.inl) asked resource() for raw_vector_srv even when its descriptor was the byte-address rewrite (word 1 with the stride cleared). A tbuffer_load_format_* through such a window was therefore refused with "non-contiguous resource descriptor", both for a table descriptor and for a GPU-selected heap descriptor under the raw_buffer contract of #3025. It now picks byte_window_srv by the same rule as the raw MUBUF load (buffer_load_dword*). The instruction's format still drives the in-shader conversion, getDimensions on the raw view still bounds the element, and the loads stay rawBufferLoad.

  • src/gfx1013_compute_mtbuf.inl: the view-kind choice, plus the file comment.
  • tests/native_store_replay.cpp: the replay harness binds a byte_window_srv input as the same raw view and seed as raw_vector_srv.

Why this step: on a local start-up capture (compile_dxil --refusals, 2,689 slot 67 requests, counts only), with the raw heap contract forced and a typed heap load prototyped (both uncommitted, not reproducible from the repo), 861 requests stopped first at this refusal. With this change they move on to other, already-known refusals. No additional request compiles from this alone; typed heap loads (buffer_load_format_*) remain the next step of #3023 and need their own view contract.

Verification

Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124), MSVC 14.51.36231, Windows SDK 10.0.26100 DXC, D3D12 debug layer not enabled. Base 837728dd (#3025); rerun after the rebase on b8f49259: the four targeted tests pass again.

cmake --preset dev
cmake --build --preset dev
ctest --preset dev --no-tests=error -R "^(native_mtbuf_hardware|native_direct_container|compute_load_format_controls|native_global_srv_heap_replay_hardware)$" -V
ctest --preset dev --no-tests=error -R "native_|startup_compute_dispatch|compute_heap" -j 6
  • Targeted tests: 4/4 passed.
    • native_global_srv_heap_replay_hardware: 94 assertions (84 before). A 32_UINT tbuffer_load_format_x through the heap window is recorded, compiled with compile_dxil --requests and replayed for selections 0 and 1 (output equals the slot's data); replaying selection 0 against slot 1 reports a mismatch; a loop around the heap load refuses it ("heap byte window loaded inside a loop"); an 8_8_8_8_UNORM tbuffer_load_format_xyzw through the window compiles.
    • native_mtbuf_hardware: the existing 11-format value check also runs through a byte window of its table SRV and matches, including the element at the end of the view that reads 0.
    • native_direct_container: compute table windows with 32_UINT and 8_8_8_8_UNORM compile; without the byte-count product they are refused ("non-contiguous resource descriptor"; an over-acceptance control only, the old code refuses it with the same text).
  • Discrimination: the new checks run with compile_dxil, native_global_srv_heap_replay and native_store_replay built at 837728dd fail: the heap check at the twindow_loop shape (the earlier 74 assertions pass), the MTBUF check at the window run, the container check at compute-tbuffer-byte-window, each with "non-contiguous resource descriptor".
  • Regression set: 147 tests, 1 failed (native_cvt_pk_u8_hardware, failing at the base as well), WARP skips; the same as before the change.
  • compile_dxil --refusals on the local capture without a contract: identical output before and after.
  • tests/docs_links_check.py and tests/bidi_controls_check.py pass.

Evidence and follow-up

  • Instruction words were assembled with LLVM 15 (clang -cc1as -triple amdgcn-amd-amdhsa -target-cpu gfx1013 -show-encoding); fixtures are source-built.
  • Limits (also in docs/experiments/native-global-srv-heap-replay.md): the MTBUF element bound is the desktop raw view's size, so a runtime that binds a window must size the raw view to the guest window's byte count. The startup manifest route already does so for a table window (max(stride, 1) * num_records, indirect_table_buffer), but no fixture runs that route for a window. The descriptor's DST_SEL is not applied (identity only, unchecked).
  • Follow-ups on #3023: typed heap loads (new view contract); the runtime contract (stage 3).

Checklist

  • One behaviour, tests added, no test weakened
  • Docs updated
  • No game files, dumps or title-specific content

AI-assisted.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5524143133 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3034). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-27T09:15:47Z. --- ## Change Target branch `cpp-migration`. Refs #3023. Follow-up to #3025 (merged as `1507f0e2`); rebased onto `cpp-migration` `b8f49259`, so this PR is the one formatted-load commit. `formatted_byte_load` (`src/gfx1013_compute_mtbuf.inl`) asked `resource()` for `raw_vector_srv` even when its descriptor was the byte-address rewrite (word 1 with the stride cleared). A `tbuffer_load_format_*` through such a window was therefore refused with "non-contiguous resource descriptor", both for a table descriptor and for a GPU-selected heap descriptor under the `raw_buffer` contract of #3025. It now picks `byte_window_srv` by the same rule as the raw MUBUF load (`buffer_load_dword*`). The instruction's format still drives the in-shader conversion, `getDimensions` on the raw view still bounds the element, and the loads stay `rawBufferLoad`. - `src/gfx1013_compute_mtbuf.inl`: the view-kind choice, plus the file comment. - `tests/native_store_replay.cpp`: the replay harness binds a `byte_window_srv` input as the same raw view and seed as `raw_vector_srv`. Why this step: on a local start-up capture (`compile_dxil --refusals`, 2,689 slot 67 requests, counts only), with the raw heap contract forced and a typed heap load prototyped (both uncommitted, not reproducible from the repo), 861 requests stopped first at this refusal. With this change they move on to other, already-known refusals. **No additional request compiles from this alone**; typed heap loads (`buffer_load_format_*`) remain the next step of #3023 and need their own view contract. ## Verification Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3080 (driver 32.0.16.2124), MSVC 14.51.36231, Windows SDK 10.0.26100 DXC, D3D12 debug layer not enabled. Base `837728dd` (#3025); rerun after the rebase on `b8f49259`: the four targeted tests pass again. ``` cmake --preset dev cmake --build --preset dev ctest --preset dev --no-tests=error -R "^(native_mtbuf_hardware|native_direct_container|compute_load_format_controls|native_global_srv_heap_replay_hardware)$" -V ctest --preset dev --no-tests=error -R "native_|startup_compute_dispatch|compute_heap" -j 6 ``` - Targeted tests: 4/4 passed. - `native_global_srv_heap_replay_hardware`: 94 assertions (84 before). A 32_UINT `tbuffer_load_format_x` through the heap window is recorded, compiled with `compile_dxil --requests` and replayed for selections 0 and 1 (output equals the slot's data); replaying selection 0 against slot 1 reports a mismatch; a loop around the heap load refuses it ("heap byte window loaded inside a loop"); an 8_8_8_8_UNORM `tbuffer_load_format_xyzw` through the window compiles. - `native_mtbuf_hardware`: the existing 11-format value check also runs through a byte window of its table SRV and matches, including the element at the end of the view that reads 0. - `native_direct_container`: compute table windows with 32_UINT and 8_8_8_8_UNORM compile; without the byte-count product they are refused ("non-contiguous resource descriptor"; an over-acceptance control only, the old code refuses it with the same text). - Discrimination: the new checks run with `compile_dxil`, `native_global_srv_heap_replay` and `native_store_replay` built at `837728dd` fail: the heap check at the `twindow_loop` shape (the earlier 74 assertions pass), the MTBUF check at the window run, the container check at `compute-tbuffer-byte-window`, each with "non-contiguous resource descriptor". - Regression set: 147 tests, 1 failed (`native_cvt_pk_u8_hardware`, failing at the base as well), WARP skips; the same as before the change. - `compile_dxil --refusals` on the local capture without a contract: identical output before and after. - `tests/docs_links_check.py` and `tests/bidi_controls_check.py` pass. ## Evidence and follow-up - Instruction words were assembled with LLVM 15 (`clang -cc1as -triple amdgcn-amd-amdhsa -target-cpu gfx1013 -show-encoding`); fixtures are source-built. - Limits (also in `docs/experiments/native-global-srv-heap-replay.md`): the MTBUF element bound is the desktop raw view's size, so a runtime that binds a window must size the raw view to the guest window's byte count. The startup manifest route already does so for a table window (`max(stride, 1) * num_records`, `indirect_table_buffer`), but no fixture runs that route for a window. The descriptor's DST_SEL is not applied (identity only, unchecked). - Follow-ups on #3023: typed heap loads (new view contract); the runtime contract (stage 3). ## Checklist - [x] One behaviour, tests added, no test weakened - [x] Docs updated - [x] No game files, dumps or title-specific content AI-assisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
R0Y00 commented 2026-11-27 09:31:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T09:31:47Z.

Review: COMMENTED


I reviewed the six-file delta above #3025 and tested GitHub's integration tree 7eef58b7 (this head on cpp-migration 999e17cd) in Debug with /Z7 and Release /O2.

ctest --preset <dev|release> --no-tests=error -V -R '^(native_mtbuf_hardware|native_direct_container|native_global_srv_heap_replay_(hardware|warp))$' gave three passes and one capability skip in each configuration. On RTX 4060 Laptop GPU (NVIDIA 616.56, Windows 11 26200.9974, SDK 10.0.26100), capture and offline replay each matched 64 words for both slots and kept all eight guards intact. The wrong-slot control failed at word 0. A back edge spanning the formatted descriptor load refused and produced no bytecode. The table byte-window MTBUF test matched 54 result words and all guards. The heap replay does not enable the D3D12 debug layer. WARP reported 4–4 lanes and exited 77 in both configurations.

#3025 is now on cpp-migration as 1507f0e2. Please rebase the draft onto the updated target so the PR shows only the formatted-load change. The tests above cover the current synthetic capture and replay contract. The runtime checks for stride above one and exact view byte count remain tracked in #3023.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6086075727 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3034#pullrequestreview-6086075727). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T09:31:47Z. **Review:** COMMENTED --- I reviewed the six-file delta above #3025 and tested GitHub's integration tree `7eef58b7` (this head on `cpp-migration` `999e17cd`) in Debug with `/Z7` and Release `/O2`. `ctest --preset <dev|release> --no-tests=error -V -R '^(native_mtbuf_hardware|native_direct_container|native_global_srv_heap_replay_(hardware|warp))$'` gave three passes and one capability skip in each configuration. On RTX 4060 Laptop GPU (NVIDIA 616.56, Windows 11 26200.9974, SDK 10.0.26100), capture and offline replay each matched 64 words for both slots and kept all eight guards intact. The wrong-slot control failed at word 0. A back edge spanning the formatted descriptor load refused and produced no bytecode. The table byte-window MTBUF test matched 54 result words and all guards. The heap replay does not enable the D3D12 debug layer. WARP reported 4–4 lanes and exited 77 in both configurations. #3025 is now on `cpp-migration` as `1507f0e2`. Please rebase the draft onto the updated target so the PR shows only the formatted-load change. The tests above cover the current synthetic capture and replay contract. The runtime checks for stride above one and exact view byte count remain tracked in #3023.
JB2WIN commented 2026-11-27 09:56:17 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-27T09:56:17Z.


Thanks for testing it on the RTX 4060 in both configurations.

Rebased onto cpp-migration b8f49259 (which contains #3025 as 1507f0e2). The PR is now the single commit e67f1017 and is marked ready. I rebuilt on the new base and reran native_mtbuf_hardware, native_direct_container, compute_load_format_controls and native_global_srv_heap_replay_hardware on the RTX 3080 (driver 32.0.16.2124): 4/4 passed, 94 assertions in the heap replay as before. The PR description is updated to match.

Agreed on the remaining runtime checks; the stride, exact byte count and DST_SEL items are recorded in #3023.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7215276355 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3034#issuecomment-7215276355). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-27T09:56:17Z. --- Thanks for testing it on the RTX 4060 in both configurations. Rebased onto `cpp-migration` `b8f49259` (which contains #3025 as `1507f0e2`). The PR is now the single commit `e67f1017` and is marked ready. I rebuilt on the new base and reran `native_mtbuf_hardware`, `native_direct_container`, `compute_load_format_controls` and `native_global_srv_heap_replay_hardware` on the RTX 3080 (driver 32.0.16.2124): 4/4 passed, 94 assertions in the heap replay as before. The PR description is updated to match. Agreed on the remaining runtime checks; the stride, exact byte count and DST_SEL items are recorded in #3023. AI-assisted.
R0Y00 commented 2026-11-27 10:14:57 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-27T10:14:57Z.

Review: APPROVED


Reviewed the rebased six-file delta at e67f1017, integration commit e3dbf96f on cpp-migration b8f49259. I rebuilt compile_dxil, native_store_replay, native_global_srv_heap_replay and offscreen_check, then ran ctest --preset <dev|release> --no-tests=error --output-on-failure -j 2 -R '^(native_mtbuf_hardware|native_direct_container|compute_load_format_controls|native_global_srv_heap_replay_(hardware|warp))$'. Each configuration produced four passes and one WARP 77 skip because the adapter has four-lane waves. RTX 4060 Laptop driver 32.0.16.1656, Windows 11 26200.9974, SDK 10.0.26100, WARP 10.0.26100.9818, heap replay debug layer off. Hosted Windows, Linux and gfx1013 passed. This covers the capture and offline compiler contract. Runtime stride, exact view length and DST_SEL remain in #3023.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6086590436 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3034#pullrequestreview-6086590436). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-27T10:14:57Z. **Review:** APPROVED --- Reviewed the rebased six-file delta at `e67f1017`, integration commit `e3dbf96f` on `cpp-migration` `b8f49259`. I rebuilt `compile_dxil`, `native_store_replay`, `native_global_srv_heap_replay` and `offscreen_check`, then ran `ctest --preset <dev|release> --no-tests=error --output-on-failure -j 2 -R '^(native_mtbuf_hardware|native_direct_container|compute_load_format_controls|native_global_srv_heap_replay_(hardware|warp))$'`. Each configuration produced four passes and one WARP 77 skip because the adapter has four-lane waves. RTX 4060 Laptop driver 32.0.16.1656, Windows 11 26200.9974, SDK 10.0.26100, WARP 10.0.26100.9818, heap replay debug layer off. Hosted Windows, Linux and gfx1013 passed. This covers the capture and offline compiler contract. Runtime stride, exact view length and DST_SEL remain in #3023.
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!3034
No description provided.