shader: lower experimental gfx1030 packed D16 XYZ stores #1450

Merged
stan495 merged 1 commit from upstream-pr/1457 into main 2026-11-24 13:32:40 +00:00
stan495 commented 2026-11-24 11:52:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by stan495 on 2026-11-24T11:52:22Z.


Summary

Add an opt-in lowering for gfx1030 buffer_store_format_d16_xyz with an identity-selector BUF_FMT_16_16_16_16_UINT descriptor. --mubuf-d16-xyz-mode preserve-w declares that the native operation preserves W. The raw UAV lowering replaces XYZ and preserves the high halfword containing W. It requires an indexed, in-range record and exclusive ownership of the affected DWORDs. The default profile still rejects XYZ.

Local checks

Tested 5dfcb3c653cc0c0f126e78cc2eb3cd7fcd1c75ba.

sh tests/gfx1030_mubuf_d16/build.sh gfx1030
sh tests/gfx1030_mubuf_d16/build.sh gfx1100
python3 -B tests/gfx1030_mubuf_d16/check.py --model-only
python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1

LLVM/LLD 15 assembled, linked and disassembled both native targets. The CPU reference controls and the compute-container CLI regression passed. On Windows, cmake --build --preset dev --target offscreen_check passed and the CTest filter listed four cases. docs_links_check.py, form_coverage_check.py and bidi_controls_check.py passed. The native CPU model distinguishes preserved W (8103) from overwritten W (ca5e) at halfword 3 and detects a missing record bound at halfword 256 (8200 expected, 1317 written).

Independent GPU validation requested

Please run the translated DXIL cases on WARP and a physical adapter from a Windows dev build.

cmake --preset dev
cmake --build --preset dev --target offscreen_check
$env:CTEST_PARALLEL_LEVEL = '1'
ctest --preset dev --no-tests=error -R '^compute_store_aot_mubuf_store_format_' -V --output-junit out/mubuf-store-format.xml

The XYZ tests compare all 320 DWORDs at one and two workgroups. The XYZW mutant should first differ at DWORD index 2, expected c5c54567, actual 01234567.

Please also run the original ISA on a Linux HIP device identified as gfx1030 by rocminfo.

sh tests/gfx1030_mubuf_d16/build.sh gfx1030
python3 -B tests/gfx1030_mubuf_d16/check.py --target gfx1030 --device 0

The native fixture checks 448 halfwords at one, two and three workgroups. gfx1100 provides a separate RDNA 3 comparison. Report the tested SHA, adapter, driver, Windows build and D3D12 debug-layer status or Linux kernel and HIP version. Include pass, fail and capability-skip counts and the first mismatch, if any. GPU execution is pending. The candidate has no semantic coverage registration pending native gfx1030 readback.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6581136517 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1457). Originally posted by [stan495](https://github.com/stan495) on 2026-11-24T11:52:22Z. --- ## Summary Add an opt-in lowering for gfx1030 `buffer_store_format_d16_xyz` with an identity-selector `BUF_FMT_16_16_16_16_UINT` descriptor. `--mubuf-d16-xyz-mode preserve-w` declares that the native operation preserves W. The raw UAV lowering replaces XYZ and preserves the high halfword containing W. It requires an indexed, in-range record and exclusive ownership of the affected DWORDs. The default profile still rejects XYZ. ## Local checks Tested `5dfcb3c653cc0c0f126e78cc2eb3cd7fcd1c75ba`. ```sh sh tests/gfx1030_mubuf_d16/build.sh gfx1030 sh tests/gfx1030_mubuf_d16/build.sh gfx1100 python3 -B tests/gfx1030_mubuf_d16/check.py --model-only python3 -B tests/compute_store_check.py binary llvm-mc-15 llvm-objcopy-15 libLLVM-15.so.1 ``` LLVM/LLD 15 assembled, linked and disassembled both native targets. The CPU reference controls and the compute-container CLI regression passed. On Windows, `cmake --build --preset dev --target offscreen_check` passed and the CTest filter listed four cases. `docs_links_check.py`, `form_coverage_check.py` and `bidi_controls_check.py` passed. The native CPU model distinguishes preserved W (`8103`) from overwritten W (`ca5e`) at halfword 3 and detects a missing record bound at halfword 256 (`8200` expected, `1317` written). ## Independent GPU validation requested Please run the translated DXIL cases on WARP and a physical adapter from a Windows dev build. ```powershell cmake --preset dev cmake --build --preset dev --target offscreen_check $env:CTEST_PARALLEL_LEVEL = '1' ctest --preset dev --no-tests=error -R '^compute_store_aot_mubuf_store_format_' -V --output-junit out/mubuf-store-format.xml ``` The XYZ tests compare all 320 DWORDs at one and two workgroups. The XYZW mutant should first differ at DWORD index 2, expected `c5c54567`, actual `01234567`. Please also run the original ISA on a Linux HIP device identified as gfx1030 by `rocminfo`. ```sh sh tests/gfx1030_mubuf_d16/build.sh gfx1030 python3 -B tests/gfx1030_mubuf_d16/check.py --target gfx1030 --device 0 ``` The native fixture checks 448 halfwords at one, two and three workgroups. `gfx1100` provides a separate RDNA 3 comparison. Report the tested SHA, adapter, driver, Windows build and D3D12 debug-layer status or Linux kernel and HIP version. Include pass, fail and capability-skip counts and the first mismatch, if any. GPU execution is pending. The candidate has no semantic coverage registration pending native gfx1030 readback.
tedin7 commented 2026-11-24 13:00:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T12:31:19Z.

Review: COMMENTED


Dual-platform review of PR #1457 at commit 5dfcb3c653cc0c0f126e78cc2eb3cd7fcd1c75ba:

Code & Scope Audit

  • tools/compute_store_aot.py adds opt-in --mubuf-d16-xyz-mode preserve-w, gated on cpu == "gfx1030" and output_format == "BUF_FMT_16_16_16_16_UINT".
  • The default profile continues to reject buffer_store_format_d16_xyz; with preserve-w, the raw UAV lowering reserves the full second DWORD (written_spans covers 8 bytes, offset + 8 <= stride) and preserves its high 16 bits (W) via read/modify/write.
  • Negative controls in tests/compute_store_check.py cover missing preserve-w contract, mismatched output_format, offen, unaligned offset:8, out-of-range VGPR, glc, overlapping buffer_store_short in the preserved DWORD, missing s_waitcnt, and an _xyzw mutant failing at word=2.
  • Minor note: on the m["typed"] branch (tbuffer_store_format_d16_xyz ... format:[BUF_FMT_16_16_16_16_UINT]), format_components = 4 is used without checking mubuf_d16_xyz_mode == "preserve-w" (unlike the formatted branch). Not a blocker for MUBUF scope, though checking packed and components == 3 uniformly would prevent bypassing the opt-in via tbuffer_store_format_d16_xyz.
  • CMakeLists.txt omits FORM_COVERAGE_RECORD on compute_store_aot_mubuf_store_format_xyz_${adapter}, matching the documented pending native gfx1030 readback gate.

Verification

  • Linux (llvm-mc-19, llvm-objcopy-19, libLLVM-19.so, ld.lld-19, llvm-objdump-19):
    • python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so: passed.
    • sh tests/gfx1030_mubuf_d16/build.sh gfx1030 and gfx1100 (with LLVM 19 tools): assembled, linked, and disassembled xyz and xyzw fixtures.
    • python3 -B tests/gfx1030_mubuf_d16/check.py --model-only: passed (wrong-W control at word 3 0x8103 vs 0xca5e, missing-bounds control at word 256 0x8200 vs 0x1317).
    • git diff --check origin/main...HEAD: passed.
    • python3 -B tests/docs_links_check.py: passed (16 Markdown files, 325 links).
    • python3 -B tests/bidi_controls_check.py: passed (1192 files).
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): cmake --build --preset dev --target offscreen_check -- -j 6 (4.38s); ctest --preset dev -R '^compute_store_aot_mubuf_store_format_' --parallel 4 --no-tests=error --output-on-failure: 4/4 passed (4.36s).
    • Release /O2 (--preset release): cmake --build --preset release --target offscreen_check -- -j 6 (1.67s); ctest --preset release -R '^compute_store_aot_mubuf_store_format_' --parallel 4 --no-tests=error --output-on-failure: 4/4 passed (4.41s).
  • Not run: physical D3D12 GPU execution and Linux HIP execution on native gfx1030/gfx1100 hardware (no AMD GPU in this environment).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6039226057 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1457#pullrequestreview-6039226057). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T12:31:19Z. **Review:** COMMENTED --- Dual-platform review of PR #1457 at commit `5dfcb3c653cc0c0f126e78cc2eb3cd7fcd1c75ba`: ### Code & Scope Audit - `tools/compute_store_aot.py` adds opt-in `--mubuf-d16-xyz-mode preserve-w`, gated on `cpu == "gfx1030"` and `output_format == "BUF_FMT_16_16_16_16_UINT"`. - The default profile continues to reject `buffer_store_format_d16_xyz`; with `preserve-w`, the raw UAV lowering reserves the full second DWORD (`written_spans` covers 8 bytes, `offset + 8 <= stride`) and preserves its high 16 bits (`W`) via read/modify/write. - Negative controls in `tests/compute_store_check.py` cover missing `preserve-w` contract, mismatched `output_format`, `offen`, unaligned `offset:8`, out-of-range VGPR, `glc`, overlapping `buffer_store_short` in the preserved DWORD, missing `s_waitcnt`, and an `_xyzw` mutant failing at `word=2`. - Minor note: on the `m["typed"]` branch (`tbuffer_store_format_d16_xyz ... format:[BUF_FMT_16_16_16_16_UINT]`), `format_components = 4` is used without checking `mubuf_d16_xyz_mode == "preserve-w"` (unlike the `formatted` branch). Not a blocker for `MUBUF` scope, though checking `packed and components == 3` uniformly would prevent bypassing the opt-in via `tbuffer_store_format_d16_xyz`. - `CMakeLists.txt` omits `FORM_COVERAGE_RECORD` on `compute_store_aot_mubuf_store_format_xyz_${adapter}`, matching the documented pending native `gfx1030` readback gate. ### Verification - **Linux (`llvm-mc-19`, `llvm-objcopy-19`, `libLLVM-19.so`, `ld.lld-19`, `llvm-objdump-19`)**: - `python3 -B tests/compute_store_check.py binary llvm-mc-19 llvm-objcopy-19 /usr/lib/llvm-19/lib/libLLVM-19.so`: passed. - `sh tests/gfx1030_mubuf_d16/build.sh gfx1030` and `gfx1100` (with LLVM 19 tools): assembled, linked, and disassembled `xyz` and `xyzw` fixtures. - `python3 -B tests/gfx1030_mubuf_d16/check.py --model-only`: passed (wrong-W control at word 3 `0x8103` vs `0xca5e`, missing-bounds control at word 256 `0x8200` vs `0x1317`). - `git diff --check origin/main...HEAD`: passed. - `python3 -B tests/docs_links_check.py`: passed (16 Markdown files, 325 links). - `python3 -B tests/bidi_controls_check.py`: passed (1192 files). - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: `cmake --build --preset dev --target offscreen_check -- -j 6` (`4.38s`); `ctest --preset dev -R '^compute_store_aot_mubuf_store_format_' --parallel 4 --no-tests=error --output-on-failure`: **4/4 passed** (`4.36s`). - **Release `/O2` (`--preset release`)**: `cmake --build --preset release --target offscreen_check -- -j 6` (`1.67s`); `ctest --preset release -R '^compute_store_aot_mubuf_store_format_' --parallel 4 --no-tests=error --output-on-failure`: **4/4 passed** (`4.41s`). - **Not run**: physical D3D12 GPU execution and Linux HIP execution on native `gfx1030`/`gfx1100` hardware (no AMD GPU in this environment).
thepatrickworld commented 2026-11-24 13:00:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-24T12:40:51Z.


Independent GPU validation

Measured 5dfcb3c6 merged onto 2ae8a9e4 (my merge 97f84f2f, tree 027790d6, working tree clean). Nothing below is a code change.

Environment

  • Windows 11 25H2, build 26200.9974
  • DXC 1.9.2602.17 (10.0.26100.0 user-mode)
  • hardware: AMD Radeon RX 9070 XT vendor=1002 device=7550, driver 32.0.32029.2010
  • warp: Microsoft Basic Render Driver vendor=1414 device=008c, driver 10.0.26100.9818
  • preset dev (Debug), debug_layer=unavailable — see the limitation below

Commands

ctest --preset dev --no-tests=error -R "^compute_store_aot_mubuf_store_format_xyz_(hardware|warp)$" -V
ctest --preset dev --no-tests=error -R "^compute_store_aot_mubuf" -V

Observed

Two entries, three runs each: 6 passed, 0 failed, 0 skipped.

compute_store_aot_mubuf_store_format_xyz_hardware   Passed  1.62 / 1.39 / 1.40 s
compute_store_aot_mubuf_store_format_xyz_warp       Passed  1.16 / 1.16 / 1.17 s

On the physical adapter, buffer_store_format_d16_xyz (BUF_FMT_16_16_16_16_UINT):

adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
driver=32.0.32029.2010
groups=1 compared_words=320 mismatches=0
groups=2 compared_words=320 mismatches=0

The W halfword is part of that comparison: the reference writes only the six payload bytes of XYZ into the record and leaves the high halfword at the sentinel, so a lowering that clobbers W would show up as a mismatch at DWORD 2.

The mutant controls in the fixture were caught on both backends — for the _xyz → _xyzw variant it is the exact expected line:

word=2 expected=c5c54567 actual=01234567

and the default-profile rejection of XYZ (mubuf_d16_xyz_mode=None) still holds.

Regression

^compute_store_aot_mubuf: 24 passed, 0 failed, 0 skipped. ctest collects 24 entries on this tree — the compute_store_aot_mubuf_counter* entries from the still-open #1458 are not registered here — and nothing else in the family moved.

Limits

  • One physical adapter, one driver. The debug layer is not installed here (0x887a002d, SDK component missing; the Graphics Tools optional feature is absent and its install is refused from a remote session with 0x80070005), so the run says nothing about D3D12 API validation — only that the readbacks match.
  • The fixture exercises one descriptor shape (BUF_FMT_16_16_16_16_UINT, idxen offset:4, stride 16). Other formats and non-identity selectors are not covered by this run.

AI-assisted; runs executed locally on the adapter above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7131772982 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1457#issuecomment-7131772982). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-24T12:40:51Z. --- ### Independent GPU validation Measured `5dfcb3c6` merged onto `2ae8a9e4` (my merge `97f84f2f`, tree `027790d6`, working tree clean). Nothing below is a code change. **Environment** - Windows 11 25H2, build 26200.9974 - DXC 1.9.2602.17 (`10.0.26100.0` user-mode) - hardware: `AMD Radeon RX 9070 XT vendor=1002 device=7550`, driver `32.0.32029.2010` - warp: `Microsoft Basic Render Driver vendor=1414 device=008c`, driver `10.0.26100.9818` - preset `dev` (Debug), `debug_layer=unavailable` — see the limitation below **Commands** ```powershell ctest --preset dev --no-tests=error -R "^compute_store_aot_mubuf_store_format_xyz_(hardware|warp)$" -V ctest --preset dev --no-tests=error -R "^compute_store_aot_mubuf" -V ``` **Observed** Two entries, three runs each: 6 passed, 0 failed, 0 skipped. ``` compute_store_aot_mubuf_store_format_xyz_hardware Passed 1.62 / 1.39 / 1.40 s compute_store_aot_mubuf_store_format_xyz_warp Passed 1.16 / 1.16 / 1.17 s ``` On the physical adapter, `buffer_store_format_d16_xyz (BUF_FMT_16_16_16_16_UINT)`: ``` adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 driver=32.0.32029.2010 groups=1 compared_words=320 mismatches=0 groups=2 compared_words=320 mismatches=0 ``` The W halfword is part of that comparison: the reference writes only the six payload bytes of XYZ into the record and leaves the high halfword at the sentinel, so a lowering that clobbers W would show up as a mismatch at DWORD 2. The mutant controls in the fixture were caught on both backends — for the `_xyz` → `_xyzw` variant it is the exact expected line: ``` word=2 expected=c5c54567 actual=01234567 ``` and the default-profile rejection of XYZ (`mubuf_d16_xyz_mode=None`) still holds. **Regression** `^compute_store_aot_mubuf`: **24 passed, 0 failed, 0 skipped**. `ctest` collects 24 entries on this tree — the `compute_store_aot_mubuf_counter*` entries from the still-open #1458 are not registered here — and nothing else in the family moved. **Limits** - One physical adapter, one driver. The debug layer is not installed here (`0x887a002d`, SDK component missing; the Graphics Tools optional feature is absent and its install is refused from a remote session with `0x80070005`), so the run says nothing about D3D12 API validation — only that the readbacks match. - The fixture exercises one descriptor shape (`BUF_FMT_16_16_16_16_UINT`, `idxen offset:4`, stride 16). Other formats and non-identity selectors are not covered by this run. _AI-assisted; runs executed locally on the adapter above._
upstream-sync closed this pull request 2026-11-24 14:02:46 +00:00
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!1450
No description provided.