feat(rdna2): implement VOP3P packed f16, v_dot2_f32_f16, v_fma_mix_*, and v_pk_fmac_f16 (1,296/1,490) #302

Manually merged
github merged 1 commit from github-bot/gh-302 into main 2026-11-26 11:31:15 +00:00 AGit
Owner

@⁠Lewandox on GitHub · 2026-11-26 01:53 UTC · original
Lewandox:feat/rdna2-vop3p-pkf16-mix → main · +672 −20 · 10 files · 2 commits · merged 2026-11-26 11:07 UTC

Change

Implements all 9 remaining VOP3P instructions plus v_pk_fmac_f16 (VOP2 0x3C and VOP3 0x13C) in both the RDNA 2 reference interpreter (PrototypeScarlett/emu/rdna2_exec_pkf16.py) and the HLSL recompiler (PrototypeScarlett/emu/rdna2_hlsl_pkf16.py, wired for wave32, wave64, and graphics stages), closing VOP3P coverage at 100% and bringing total RDNA 2 ISA coverage from 1,285/1,490 to 1,296/1,490:

  • Packed f16 arithmetic (VOP3P): v_pk_fma_f16, v_pk_add_f16, v_pk_mul_f16, v_pk_min_f16, v_pk_max_f16 — full op_sel, op_sel_hi, neg_lo, neg_hi, clamp ([0, 1], NaN/negatives -> +0.0), and inline float constant replication across both halves.
  • Packed f16 accumulate (VOP2 & VOP3): v_pk_fmac_f16 (including VOP3 clamp, inline float constant replication, and refusal of unsupported SDWA/DPP or unmeasured VOP3 modifiers).
  • Mixed-precision FMA (VOP3P): v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 — op_sel_hi[i] selects f16 vs. f32 source, op_sel[i] selects f16 half (refused when op_sel_hi[i] == 0), neg_hi[i] = abs, neg_lo[i] = neg, single-rounding f32 FMA (_fma / FmaF32), [0, 1] clamp, and untouched-half preservation on mixlo/mixhi.
  • Packed f16 dot product (VOP3P): v_dot2_f32_f16 — op_sel/op_sel_hi/neg_lo/neg_hi/clamp with refusal of op_sel[2]/neg_hi[2] on the 32-bit f32 accumulator src2.

Verification

Windows 11 (26300), Python 3.12.10:

  • .venv\Scripts\python.exe -m pytest tests/test_rdna2_exec_pkf16.py tests/test_rdna2_hlsl_pkf16.py tests/test_rdna2_exec_dot.py -vv: all non-GPU tests passed (@gpu tests skipped locally because dxc / anyxboxx_gpu_run.exe is not installed on this machine; CI runs the Python suite).
  • .venv\Scripts\python.exe -m pytest -q: 1355 passed, 321 skipped, 0 failed, including test_readme_sync.py.
  • rdna2_exec.coverage(): (1296, 1490) (all VOP3P mnemonics covered).
  • ruff check: clean (verified in CI).

Oracle and test data

  • Semantics follow AMD "RDNA 2" Instruction Set Architecture (November 2020, §6.2.1, §12.7, §12.10, §13.3 table 86) and LLVM VOP3PInstructions.td / AMDGPUBaseInfo.cpp (getInlineEncodingV216, SelectVOP3PMadMixModsImpl).
  • All tests use hand-constructed synthetic RDNA 2 encodings in tests/test_rdna2_exec_pkf16.py and tests/test_rdna2_hlsl_pkf16.py.
  • Failure case: all tests in both new test files fail on main (Untranslated / missing coverage) without this change.

Checklist

  • The PR covers a single reviewable behaviour.
  • A test fails without this change and passes with it.
  • The commands and results of each check are given above.
  • An unimplemented function returns an error (Untranslated), never a fake success.
  • README: checked via test_readme_sync.py (stays within the current test-count hundred).
  • No game, console or SDK file, no key, no dump, no download link.
  • Findings drawn from a title: none.
  • Code taken from another project: none.

AI assistance: Antigravity assisted with implementing the interpreter/HLSL modules, tests, and PR description; verified locally.

**@⁠Lewandox** on GitHub · 2026-11-26 01:53 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/302) `Lewandox:feat/rdna2-vop3p-pkf16-mix` → `main` · +672 −20 · 10 files · 2 commits · merged 2026-11-26 11:07 UTC ## Change Implements all 9 remaining `VOP3P` instructions plus `v_pk_fmac_f16` (`VOP2` `0x3C` and `VOP3` `0x13C`) in both the RDNA 2 reference interpreter (`PrototypeScarlett/emu/rdna2_exec_pkf16.py`) and the HLSL recompiler (`PrototypeScarlett/emu/rdna2_hlsl_pkf16.py`, wired for wave32, wave64, and graphics stages), closing `VOP3P` coverage at **100%** and bringing total RDNA 2 ISA coverage from **1,285/1,490** to **1,296/1,490**: - **Packed f16 arithmetic (`VOP3P`)**: `v_pk_fma_f16`, `v_pk_add_f16`, `v_pk_mul_f16`, `v_pk_min_f16`, `v_pk_max_f16` — full `op_sel`, `op_sel_hi`, `neg_lo`, `neg_hi`, `clamp` (`[0, 1]`, NaN/negatives -> `+0.0`), and inline float constant replication across both halves. - **Packed f16 accumulate (`VOP2` & `VOP3`)**: `v_pk_fmac_f16` (including VOP3 `clamp`, inline float constant replication, and refusal of unsupported SDWA/DPP or unmeasured VOP3 modifiers). - **Mixed-precision FMA (`VOP3P`)**: `v_fma_mix_f32`, `v_fma_mixlo_f16`, `v_fma_mixhi_f16` — `op_sel_hi[i]` selects f16 vs. f32 source, `op_sel[i]` selects f16 half (refused when `op_sel_hi[i] == 0`), `neg_hi[i]` = `abs`, `neg_lo[i]` = `neg`, single-rounding f32 FMA (`_fma` / `FmaF32`), `[0, 1]` clamp, and untouched-half preservation on `mixlo`/`mixhi`. - **Packed f16 dot product (`VOP3P`)**: `v_dot2_f32_f16` — `op_sel`/`op_sel_hi`/`neg_lo`/`neg_hi`/`clamp` with refusal of `op_sel[2]`/`neg_hi[2]` on the 32-bit `f32` accumulator `src2`. ## Verification Windows 11 (26300), Python 3.12.10: - `.venv\Scripts\python.exe -m pytest tests/test_rdna2_exec_pkf16.py tests/test_rdna2_hlsl_pkf16.py tests/test_rdna2_exec_dot.py -vv`: all non-GPU tests passed (`@gpu` tests skipped locally because `dxc` / `anyxboxx_gpu_run.exe` is not installed on this machine; CI runs the Python suite). - `.venv\Scripts\python.exe -m pytest -q`: **1355 passed, 321 skipped, 0 failed**, including `test_readme_sync.py`. - `rdna2_exec.coverage()`: `(1296, 1490)` (all `VOP3P` mnemonics covered). - `ruff` check: clean (verified in CI). ## Oracle and test data - Semantics follow AMD "RDNA 2" Instruction Set Architecture (November 2020, §6.2.1, §12.7, §12.10, §13.3 table 86) and LLVM `VOP3PInstructions.td` / `AMDGPUBaseInfo.cpp` (`getInlineEncodingV216`, `SelectVOP3PMadMixModsImpl`). - All tests use hand-constructed synthetic RDNA 2 encodings in `tests/test_rdna2_exec_pkf16.py` and `tests/test_rdna2_hlsl_pkf16.py`. - Failure case: all tests in both new test files fail on `main` (`Untranslated` / missing coverage) without this change. ## Checklist - [x] The PR covers a single reviewable behaviour. - [x] A test fails without this change and passes with it. - [x] The commands and results of each check are given above. - [x] An unimplemented function returns an error (`Untranslated`), never a fake success. - [x] README: checked via `test_readme_sync.py` (stays within the current test-count hundred). - [x] No game, console or SDK file, no key, no dump, no download link. - [x] Findings drawn from a title: none. - [x] Code taken from another project: none. AI assistance: Antigravity assisted with implementing the interpreter/HLSL modules, tests, and PR description; verified locally.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:42:26 +00:00
github manually merged commit c4d13de69d into main 2026-11-26 11:31:15 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.