feat: execute and recompile RDNA 2 SDWA, DPP16, and DPP8 forms (#21) #118

Manually merged
github merged 3 commits from gh-pr/118/head into gh-pr/118/base 2026-11-26 05:32:26 +00:00
Owner

@⁠Lewandox on GitHub · 2026-11-24 00:09 UTC · original
Lewandox:feat/rdna2-sdwa-dpp-exec-hlsl → main · +657 −11 · 13 files · 3 commits · merged 2026-11-24 10:14 UTC

Implements full execution and HLSL recompilation for RDNA 2 SDWA (0xF9), DPP16 (0xFA), and DPP8 / DPP8_FI (0xE9/0xEA) forms across VOP1, VOP2, and VOPC instructions (part of #21).

Changes

  • PrototypeScarlett/emu/rdna2_exec_ext.py: reference interpreter semantics per AMD RDNA 2 ISA sections 6.5 (SDWA) and 6.6 (DPP):
    • SDWA: src0_sel / src1_sel (BYTE_0..3, WORD_0..1, DWORD), scalar-vs-VGPR source flags, integer sext, float abs/neg/omod/clamp, dst_sel + dst_unused (UNUSED_PAD, UNUSED_SEXT, UNUSED_PRESERVE), and VOPC custom sdst.
    • DPP16: all gfx10 dpp_ctrl modes (quad_perm, row_shl, row_shr, row_ror, row_mirror, row_half_mirror, row_share, row_xmask), row_mask, bank_mask, bound_ctrl, fi, and float abs/neg modifiers.
    • DPP8 / DPP8_FI: 8 × 3-bit lane selectors with EXEC-respecting fi=0 and force-inactive fi=1.
  • PrototypeScarlett/emu/rdna2_hlsl_ext.py: matching HLSL emission for SDWA, DPP16, and DPP8 (using ReadLane for cross-lane reads and bitwise field ops for SDWA).
  • PrototypeScarlett/emu/rdna2_exec.py & PrototypeScarlett/emu/rdna2_hlsl.py: dispatch 0xF9, 0xFA, 0xE9, 0xEA extension forms to rdna2_exec_ext and rdna2_hlsl_ext.
  • tests/test_rdna2_sdwa_dpp_exec.py: covers SDWA extraction/sext/placement/float mods/VOPC custom sdst, DPP16 quad/row ops/masks/bound_ctrl, DPP8/fi under divergent EXEC, HLSL translation, and GPU/WARP comparison against the interpreter.
  • README.md and docs/i18n/README.*.md: updated test count (555 -> 562).

Local verification

  • .venv\Scripts\python.exe -m pytest tests/test_rdna2_sdwa_dpp_exec.py tests/test_rdna2_sdwa_dpp.py tests/test_rdna2_exec.py tests/test_rdna2_hlsl.py tests/test_readme_sync.py -v: 52 passed, 6 skipped (dxc/anyxboxx_gpu_run.exe not installed locally; Windows CI runs the GPU/WARP tests).
  • .venv\Scripts\python.exe -m ruff check --select W605,F,E9 PrototypeScarlett tests tools: All checks passed!

No game, console, or SDK files used. AI-assisted contribution.

**@⁠Lewandox** on GitHub · 2026-11-24 00:09 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/118) `Lewandox:feat/rdna2-sdwa-dpp-exec-hlsl` → `main` · +657 −11 · 13 files · 3 commits · merged 2026-11-24 10:14 UTC Implements full execution and HLSL recompilation for RDNA 2 **SDWA** (`0xF9`), **DPP16** (`0xFA`), and **DPP8 / DPP8_FI** (`0xE9`/`0xEA`) forms across `VOP1`, `VOP2`, and `VOPC` instructions (part of #21). ### Changes - **`PrototypeScarlett/emu/rdna2_exec_ext.py`**: reference interpreter semantics per AMD RDNA 2 ISA sections 6.5 (SDWA) and 6.6 (DPP): - **SDWA**: `src0_sel` / `src1_sel` (`BYTE_0..3`, `WORD_0..1`, `DWORD`), scalar-vs-VGPR source flags, integer `sext`, float `abs`/`neg`/`omod`/`clamp`, `dst_sel` + `dst_unused` (`UNUSED_PAD`, `UNUSED_SEXT`, `UNUSED_PRESERVE`), and `VOPC` custom `sdst`. - **DPP16**: all gfx10 `dpp_ctrl` modes (`quad_perm`, `row_shl`, `row_shr`, `row_ror`, `row_mirror`, `row_half_mirror`, `row_share`, `row_xmask`), `row_mask`, `bank_mask`, `bound_ctrl`, `fi`, and float `abs`/`neg` modifiers. - **DPP8 / DPP8_FI**: 8 × 3-bit lane selectors with `EXEC`-respecting `fi=0` and force-inactive `fi=1`. - **`PrototypeScarlett/emu/rdna2_hlsl_ext.py`**: matching HLSL emission for SDWA, DPP16, and DPP8 (using `ReadLane` for cross-lane reads and bitwise field ops for SDWA). - **`PrototypeScarlett/emu/rdna2_exec.py`** & **`PrototypeScarlett/emu/rdna2_hlsl.py`**: dispatch `0xF9`, `0xFA`, `0xE9`, `0xEA` extension forms to `rdna2_exec_ext` and `rdna2_hlsl_ext`. - **`tests/test_rdna2_sdwa_dpp_exec.py`**: covers SDWA extraction/sext/placement/float mods/VOPC custom `sdst`, DPP16 quad/row ops/masks/`bound_ctrl`, DPP8/`fi` under divergent `EXEC`, HLSL translation, and GPU/WARP comparison against the interpreter. - **`README.md` and `docs/i18n/README.*.md`**: updated test count (555 -> 562). ### Local verification - `.venv\Scripts\python.exe -m pytest tests/test_rdna2_sdwa_dpp_exec.py tests/test_rdna2_sdwa_dpp.py tests/test_rdna2_exec.py tests/test_rdna2_hlsl.py tests/test_readme_sync.py -v`: **52 passed, 6 skipped** (`dxc`/`anyxboxx_gpu_run.exe` not installed locally; Windows CI runs the GPU/WARP tests). - `.venv\Scripts\python.exe -m ruff check --select W605,F,E9 PrototypeScarlett tests tools`: **All checks passed!** No game, console, or SDK files used. AI-assisted contribution.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:32:25 +00:00
github manually merged commit 38ece692a9 into gh-pr/118/base 2026-11-26 05:32:26 +00:00
Author
Owner

@⁠Lewandox on GitHub · 2026-11-24 08:55 UTC · original

Addressed all review points in \201678c:

  • Replaced _is_float_op\ with _operand_float_flags\ (separate \src_is_f32\ / \dst_is_f32\ derived from operand types, so \ _cvt_f32_i32\ applies integer SDWA \sext\ and float \omod/\clamp, while \ _cvt_i32_f32/\ _cvt_f16_f32\ don't misapply float output mods).
  • SDWA \clamp\ on integer ops now raises \Untranslated\ / \Untranslatable\ naming the instruction.
  • Added \ est_sdwa_integer_clamp_raises_and_cvt_sext_works\ and @⁠gpu\ \ est_sdwa_cvt_f32_i32_sext_negative_byte_matches_gpu.
    (Note: our fork branch didn't rebase the workflow commit in \main\ due to OAuth \workflow\ scope; happy to update README count to 562 once rebased or during merge.)
**@⁠Lewandox** on GitHub · 2026-11-24 08:55 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/118#issuecomment-7126732477) Addressed all review points in \201678c\: - Replaced \_is_float_op\ with \_operand_float_flags\ (separate \src_is_f32\ / \dst_is_f32\ derived from operand types, so \ _cvt_f32_i32\ applies integer SDWA \sext\ and float \omod\/\clamp\, while \ _cvt_i32_f32\/\ _cvt_f16_f32\ don't misapply float output mods). - SDWA \clamp\ on integer ops now raises \Untranslated\ / \Untranslatable\ naming the instruction. - Added \ est_sdwa_integer_clamp_raises_and_cvt_sext_works\ and \@⁠gpu\ \ est_sdwa_cvt_f32_i32_sext_negative_byte_matches_gpu\. (Note: our fork branch didn't rebase the workflow commit in \main\ due to OAuth \workflow\ scope; happy to update README count to 562 once rebased or during merge.)
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-24 08:31 UTC · original · requested changes

Tests pass here (7/7, GPU included), and VOPC in DPP raises Untranslated with the instruction name, good. One correctness issue to fix:

  • _is_float_op in rdna2_exec_ext.py / rdna2_hlsl_ext.py uses "_f32" in name. That treats integer-source conversions (v_cvt_f32_u32, v_cvt_f32_i32, v_cvt_f32_ubyte*) and f16-result ones (v_cvt_f16_f32) as float ops: abs/neg get applied to integer sources, the SDWA sign extension is skipped for v_cvt_f32_i32, and omod/clamp are applied where they should not be. The source and destination types need to come from the operand types (as rdna2_shapes does), not from a substring of the name.
  • SDWA clamp on an integer op is silently ignored; per rule 3 it should either be implemented or raise Untranslated.

Please add a test for v_cvt_f32_i32 with SDWA sext and a negative byte, checked against the GPU. CI is blocked by the deleted Leonida submodule until #120 is merged; the README test count will need a rebase anyway.

🤖 Generated with Claude Code

**@⁠LooperSalty** on GitHub · 2026-11-24 08:31 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/118#pullrequestreview-6035948374) · **requested changes** Tests pass here (7/7, GPU included), and VOPC in DPP raises `Untranslated` with the instruction name, good. One correctness issue to fix: - `_is_float_op` in `rdna2_exec_ext.py` / `rdna2_hlsl_ext.py` uses `"_f32" in name`. That treats integer-source conversions (`v_cvt_f32_u32`, `v_cvt_f32_i32`, `v_cvt_f32_ubyte*`) and f16-result ones (`v_cvt_f16_f32`) as float ops: abs/neg get applied to integer sources, the SDWA sign extension is skipped for `v_cvt_f32_i32`, and omod/clamp are applied where they should not be. The source and destination types need to come from the operand types (as `rdna2_shapes` does), not from a substring of the name. - SDWA `clamp` on an integer op is silently ignored; per rule 3 it should either be implemented or raise `Untranslated`. Please add a test for `v_cvt_f32_i32` with SDWA `sext` and a negative byte, checked against the GPU. CI is blocked by the deleted Leonida submodule until #120 is merged; the README test count will need a rebase anyway. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This discussion has been locked. Commenting is limited to contributors.
No description provided.