shader: lower v_sat_pk_u8_i16 in the direct compute path #3095

Manually merged
github merged 2 commits from github-bot/gh-3095 into gh-pr/3095/base 2026-11-27 18:07:52 +00:00 AGit
Owner

@⁠R0D4X on GitHub · 2026-11-27 15:03 UTC · original
R0D4X:feat/native-sat-pk-u8-i16 → main · +204 −0 · 4 files · 2 commits · merged 2026-11-27 17:45 UTC

Fixes #3093. Refs #2935.

What this changes

  • Lowers gfx1013 VOP1 (0x62) and VOP3A (0x1e2) v_sat_pk_u8_i16 in src/gfx1013_direct_compute.inl:
    • Sign-extends both 16-bit halves of src0, clamps each to [0, 255], packs them into D[7:0] and D[15:8], and zeroes D[31:16].
    • Refuses clamp, omod, abs, neg, op_sel, SDWA, DPP, and nonzero unused src1/src2 on the VOP3A form.

Tests & docs added

  • tests/native_sat_pk_u8_i16_check.py & tests/cmake/native_sat_pk_u8_i16.cmake: DXIL compile & disassembly controls, six VOP3A modifier/unused-source refusal encodings, and native_store_replay hardware dispatches (dense with 0xABCD0000 preload to verify high-half zeroing, plus sparse EXEC, across 16 patterns x 2 encodings = 2,048 words + 16 guards).
  • docs/experiments/native-sat-pk-u8-i16.md: semantics and reproduction commands.

Verification

Commit: 01460537 on Windows 11 x64 (10.0.26300.9974), MSVC 19.44.35230, Windows SDK & DXC 10.0.26100.0, NVIDIA GeForce RTX 5080 (10de:2c02, driver 32.0.16.2124), SM 6.6 wave32:

  • ctest --preset dev --no-tests=error -R '^native_sat_pk_u8_i16_|^native_cvt_pk16_' -V: 4/4 passed, 0 skipped
    • native_sat_pk_u8_i16_hardware: sparse=False and sparse=True matched 2048 result words and 16 guards.
  • ctest --preset release --no-tests=error -R '^native_sat_pk_u8_i16_|^native_cvt_pk16_': 4/4 passed, 0 skipped
  • Repo checks (docs_links_check.py, bidi_controls_check.py, git diff --check): all passed.

Scope: Covers synthetic v_sat_pk_u8_i16 wave32 compute fixtures through compile_dxil and native_store_replay; does not establish full-title startup or runtime execution.

**@⁠R0D4X** on GitHub · 2026-11-27 15:03 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3095) `R0D4X:feat/native-sat-pk-u8-i16` → `main` · +204 −0 · 4 files · 2 commits · merged 2026-11-27 17:45 UTC Fixes #3093. Refs #2935. ## What this changes - Lowers gfx1013 VOP1 (`0x62`) and VOP3A (`0x1e2`) `v_sat_pk_u8_i16` in `src/gfx1013_direct_compute.inl`: - Sign-extends both 16-bit halves of `src0`, clamps each to `[0, 255]`, packs them into `D[7:0]` and `D[15:8]`, and zeroes `D[31:16]`. - Refuses `clamp`, `omod`, `abs`, `neg`, `op_sel`, SDWA, DPP, and nonzero unused `src1`/`src2` on the VOP3A form. ## Tests & docs added - `tests/native_sat_pk_u8_i16_check.py` & `tests/cmake/native_sat_pk_u8_i16.cmake`: DXIL compile & disassembly controls, six VOP3A modifier/unused-source refusal encodings, and `native_store_replay` hardware dispatches (dense with `0xABCD0000` preload to verify high-half zeroing, plus sparse `EXEC`, across 16 patterns x 2 encodings = 2,048 words + 16 guards). - `docs/experiments/native-sat-pk-u8-i16.md`: semantics and reproduction commands. ## Verification Commit: `01460537` on Windows 11 x64 (`10.0.26300.9974`), MSVC `19.44.35230`, Windows SDK & DXC `10.0.26100.0`, `NVIDIA GeForce RTX 5080` (`10de:2c02`, driver `32.0.16.2124`), SM 6.6 wave32: - `ctest --preset dev --no-tests=error -R '^native_sat_pk_u8_i16_|^native_cvt_pk16_' -V`: 4/4 passed, 0 skipped - `native_sat_pk_u8_i16_hardware`: `sparse=False` and `sparse=True` matched 2048 result words and 16 guards. - `ctest --preset release --no-tests=error -R '^native_sat_pk_u8_i16_|^native_cvt_pk16_'`: 4/4 passed, 0 skipped - Repo checks (`docs_links_check.py`, `bidi_controls_check.py`, `git diff --check`): all passed. *Scope:* Covers synthetic `v_sat_pk_u8_i16` wave32 compute fixtures through `compile_dxil` and `native_store_replay`; does not establish full-title startup or runtime execution.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 15:03:48 +00:00
github-bot changed target branch from main to gh-pr/3095/base 2026-11-27 18:07:50 +00:00
github manually merged commit 7945e57929 into gh-pr/3095/base 2026-11-27 18:07:52 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 17:45 UTC · original · reviewed

Review of 7945e57929 (the change from 01460537, updated with main; the PR's own diff is unchanged).

Code: each signed 16-bit half is sign-extended (shl 16 + ashr 16 for the low half, ashr 16 for the high half), clamped to [0, 255], and packed into D[7:0] and D[15:8] with D[31:16] zero. The VOP3A form refuses op_sel and nonzero src1/src2; clamp, abs and neg are refused by the shared modifier guard, and the controls check all six refusals. The test preloads the destination with 0xABCD0000, so it proves the high half is cleared, and the CPU reference is computed independently of the lowering. No other open PR covers this opcode in the direct compute path (#3033 is the gfx2hlsl path).

Windows results are in the comment below.

Commands: git diff origin/main...pull/3095/head -- src/ tests/ (read), plus the Windows commands listed in the comment.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-27 17:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3095#pullrequestreview-6091699070) · **reviewed** Review of 7945e579294228ee27c11657164a6bc97a59e426 (the change from 01460537, updated with main; the PR's own diff is unchanged). Code: each signed 16-bit half is sign-extended (`shl 16` + `ashr 16` for the low half, `ashr 16` for the high half), clamped to [0, 255], and packed into D[7:0] and D[15:8] with D[31:16] zero. The VOP3A form refuses op_sel and nonzero src1/src2; clamp, abs and neg are refused by the shared modifier guard, and the controls check all six refusals. The test preloads the destination with 0xABCD0000, so it proves the high half is cleared, and the CPU reference is computed independently of the lowering. No other open PR covers this opcode in the direct compute path (#3033 is the gfx2hlsl path). Windows results are in the comment below. Commands: `git diff origin/main...pull/3095/head -- src/ tests/` (read), plus the Windows commands listed in the comment. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 17:45 UTC · original

Windows Server 2025 verification of 7945e579294228ee27c11657164a6bc97a59e426 (D3D12 WARP, MSVC 14.44.35207):

  • dev: cmake --build --preset dev --target compile_dxil native_store_replay; ctest --preset dev -R <native sweep>: 100% tests passed out of 126 (73 passed, 53 hardware legs skipped)
  • release: cmake --build --preset release --target compile_dxil native_store_replay; ctest --preset release -R <native sweep>: 100% tests passed out of 126 (73 passed, 53 skipped)

<native sweep> = every native_* test except native_startup_request_cache_hardware, which fails on WARP-only hosts with or without this PR (wave lane count 32 requested, WARP offers 4; the test comes from #2955). native_sat_pk_u8_i16_controls passed in both presets; the _hardware leg skips on WARP because it needs a physical wave32 adapter.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-27 17:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3095#issuecomment-7224748428) Windows Server 2025 verification of `7945e579294228ee27c11657164a6bc97a59e426` (D3D12 WARP, MSVC 14.44.35207): - dev: `cmake --build --preset dev --target compile_dxil native_store_replay`; `ctest --preset dev -R <native sweep>`: 100% tests passed out of 126 (73 passed, 53 hardware legs skipped) - release: `cmake --build --preset release --target compile_dxil native_store_replay`; `ctest --preset release -R <native sweep>`: 100% tests passed out of 126 (73 passed, 53 skipped) `<native sweep>` = every `native_*` test except `native_startup_request_cache_hardware`, which fails on WARP-only hosts with or without this PR (wave lane count 32 requested, WARP offers 4; the test comes from #2955). `native_sat_pk_u8_i16_controls` passed in both presets; the `_hardware` leg skips on WARP because it needs a physical wave32 adapter. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.