anyxboxx-rdna2-ref refuses the half-precision (f16) VOP1/VOP2/VOP3/VOPC instructions that the Python model runs #482
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Luke-Ervin on 2026-11-27T03:54:48Z.
Problem
The Python reference interpreter runs the scalar half-precision vector instructions added since #218 (
emu/rdna2_exec_f16.py,emu/rdna2_exec_cmpf16.py, including #246, #247 and the f16 transcendentals). The Rust port,crates/anyxboxx-rdna2-ref, has none of them: they are only in its mnemonic table, so it refuses every one witherror untranslated.On
mainatb62053f, trying each of these names in each encoding the mnemonic table gives it (VOP1, VOP2, VOP3, VOPC), with plain register operands, wave32:v_add_f16,v_sub_f16,v_subrev_f16,v_mul_f16,v_fma_f16,v_fmac_f16,v_fmamk_f16,v_fmaak_f16,v_min_f16,v_max_f16,v_ldexp_f16,v_ceil_f16,v_floor_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,v_rcp_f16,v_sqrt_f16,v_rsq_f16,v_log_f16,v_exp_f16,v_sin_f16,v_cos_f16) and the 34 f16 compares (v_cmp_*_f16,v_cmpx_*_f16,v_cmp_class_f16,v_cmpx_class_f16).Minimal reproduction (input to
target/release/anyxboxx-rdna2-ref, then the same words throughemu.rdna2_exec):Why nothing caught it:
tests/test_rdna2_ref_parity.pygenerates its random programs from the Python tables it imports (VECTOR,VECTOR_COMPARE, the packed f16 tables…), and the scalar f16 tables are not among them, so these instructions are never compared.docs/rust-full-status.mdstill says "No RDNA 2 instruction family of the interpreter is Python-only any more", from a sweep run on 2026-11-25, before most of the f16 work was merged.#303 ports the HLSL recompiler (a new crate,
anyxboxx-rdna2-hlsl) and does not touchanyxboxx-rdna2-ref, so the two do not overlap.Proposal
Port them to
anyxboxx-rdna2-ref, checked against the Python model the same way as the earlier families (parity tests with fixed and seeded programs, refusals included), and correct the status doc. To keep each review small, in three pull requests:ceil/floor/trunc/rndne/fract/frexp) and the conversions, with their VOP3 modifiers and the same refusals as the Python (SDWA/DPP, unsupportedop_sel/omod).v_cmpxwriting EXEC,v_cmp_class_f16).rcp,sqrt,rsq,log,exp,sin,cos, compared with the Python on all 65,536 inputs of each, since their last bit depends on the host's float functions.Each one adds the new names to the parity generator, so later f16 changes on the Python side get compared automatically.
Questions
rust/full, phase 4 ofdocs/architecture-rust.md)?Found with an AI-assisted differential sweep of the two interpreters (Claude Code); the counts and the reproduction above were checked by running both interpreters on Linux.
Imported from LooperSalty/AnyXboxX. Originally posted by Luke-Ervin on 2026-11-27T20:46:02Z.
Done by @Lewandox's #501, #502, #503 and #505, thank you! They followed the plan above (the three parts plus the #275 follow-up).
Checked on
mainatbebcfb1(after #545): I ran every VOP1, VOP2, VOPC, VOP3 and VOP3P name of the mnemonic table through both interpreters, with register operands and with the inline constant 1.0, in wave32 and wave64. Every half-precision encoding now gives the same result in Python and Rust. Closing.The same sweep found one family still Python-only, and it is not f16: the 16-bit integer VOP3 instructions of
emu/rdna2_exec_int16.py, 26 encodings in all:v_add_nc_u16/i16,v_sub_nc_u16/i16,v_mul_lo_u16, theb16/i16shifts,v_min/v_max/v_min3/v_max3/v_med3inu16andi16, andv_mad_u16/i16;v_mad_u32_u16,v_mad_i32_i16,v_cvt_pk_u16_u32,v_cvt_pk_i16_i32,v_add_nc_i32andv_sub_nc_i32.The Rust runs the packed VOP3P half of that file, but refuses all of these with
error untranslated. Nothing in the parity generator draws them. I'm porting them toanyxboxx-rdna2-refnext, checked against the Python the same way, and will link the PR here.