feat(rdna2-ref): run scalar f16 arithmetic, rounding and conversions #501
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/501"
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?
Imported from LooperSalty/AnyXboxX. Originally posted by Lewandox on 2026-11-27T14:18:15Z.
Change
Port the 21 non-transcendental scalar half-precision (
f16) instructions ofemu/rdna2_exec_f16.pytocrates/anyxboxx-rdna2-ref(f16.rs,half.rs) acrossVOP1,VOP2andVOP3:v_add_f16,v_sub_f16,v_subrev_f16,v_mul_f16,v_fmac_f16,v_fmamk_f16,v_fmaak_f16,v_fma_f16,v_min_f16,v_max_f16,v_ldexp_f16.v_floor_f16,v_ceil_f16,v_trunc_f16,v_rndne_f16,v_fract_f16,v_frexp_mant_f16,v_frexp_exp_i16_f16,v_cvt_f16_f32,v_cvt_f32_f16,v_cvt_pkrtz_f16_f32.INLINE_HALVES,op_selsource/destination halves while preserving the untouched VGPR half,abs/negon bit 15 or bit 31,clampto[0, 1]) and shared refusals (SDWA/DPP,omod,clampon word/integer results,op_selonv_fmac_f16or 32-bit sources/destinations,v_fmamk_f16/v_fmaak_f16inVOP3without a literal,abs/negor float inline constants onv_ldexp_f16's integer source,op_selhigh half on constants).random_programintests/test_rdna2_ref_parity.pyand add dedicated parity tests intests/test_rdna2_ref_f16_parity.py.Linked issue: Refs #482 (part 1 of 3)
Verification
(Note: if
upstream/mainhas not yet merged #495/#496 when CI runs,crates/anyxboxx'sbig_pools_come_after_the_tuned_set_and_before_quality_and_overridesis the pre-existing failure onmain.)Oracle and test data
PrototypeScarlett/emu/rdna2_exec_f16.py(AMD RDNA 2 ISA sections 12.7, 12.8, 12.12).tests/test_rdna2_ref_f16_parity.py, including an exhaustive 65,536-input sweep over all binary16 bit patterns for all 8 unary operations (v_floor_f16,v_ceil_f16,v_trunc_f16,v_rndne_f16,v_fract_f16,v_frexp_mant_f16,v_frexp_exp_i16_f16,v_cvt_f32_f16), fixedVOP1/VOP2/VOP3modifier and refusal programs, and 250 seeded multi-instruction programs.tests/test_rdna2_ref_f16_parity.pyfails becauseanyxboxx-rdna2-refrefuses all 21 operations witherror untranslated.Checklist
E_NOTIMPL), never a fake success.test_readme_sync.pychecks it; collected count is 1962, still1900+).AGENTS.mdallows; none used here.emu/rdna2_exec_f16.pyis in this repository).AI assistance: implemented and verified with AI coding assistance.