feat: half precision (f16) in the RDNA 2 interpreter (25 encodings) #218
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!218
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/218/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@IxMxAMAR on GitHub · 2026-11-25 16:22 UTC · original
IxMxAMAR:feat/rdna2-f16→main· +414 −27 · 14 files · 6 commits · merged 2026-11-25 18:32 UTCChange
Replaces #163, which was closed during the 25 November triage because it conflicted with
mainafter #199 and #151. It is rebased onmain(ab55a2a). The code is the same apart from the conflict resolution: the f16 group is wired in next to the instruction groups #151 added, and it shares no instruction name with them.The RDNA 2 reference interpreter runs 25 more f16 encodings (1,060 → 1,085 of 1,490):
v_add,v_sub,v_subrev,v_mul,v_fmac,v_fmamk,v_fmaak,v_max,v_minandv_ldexp_f16, in VOP2 and VOP3;v_fma_f16, in VOP3;v_cvt_f16_f32andv_cvt_f32_f16, in VOP1 and VOP3.They live in a new module,
emu/rdna2_exec_f16.py, with a few lines inrdna2_exec.pyandrdna2_exec_vop3.py.gfx10 semantics:
op_selpicks the half read from each source and the half written.Anything not backed by a source is refused with
Untranslated, naming the instruction and the reason:v_cvt_f32_f16;op_selon a constant or a 32-bit source;v_ldexp_f16;README, in all 9 languages:
mainruns 1,060 today, although its README still says 1,046.1200+, since this PR takes the suite to 1,223 tests.The HLSL recompiler is not changed here; its translation follows in the next PR.
Linked issue: Refs #115
Verification
test_readme_sync.py::test_claimed_count_matches_suitepasses in the full run (1,223 tests →1200+).test_rdna2_f16.py31/31, plus 65,536 extra FMA cases checked against exact integer arithmetic (comments on #165 and #112).Oracle and test data
The semantics follow AMD's public "RDNA 2 Instruction Set Architecture"; the 16-bit writes of gfx10 follow LLVM (
zeroesHigh16BitsOfDest) and Mesa ACO.The 31 tests in
tests/test_rdna2_f16.pybuild their own programs, with expected values worked out by hand, and the 9 inline float constants are compared with those of the f32 path. Without this change,emu.rdna2_exec_f16does not exist and every f16 program raisesUntranslatedon its instruction. The refusal tests also require the reason in the message.Checklist
Untranslated).test_readme_sync.pychecks it).Made with AI assistance.