Repository navigation
tests/semantic: run v_pk_add/mul/fma/min/max_f16 through the translator, not a self-built model - #3537
Conversation
…or instead of a self-built model The four files modelled a register file and packed f16 SIMD themselves and never called tools/rdna2spirv.py. Each now translates its cases and runs them on spirv_mini_interp with hand-written expected words, a binary16 reference (tests/semantic/f16_ref.py, shared with the scalar f16 files), op_sel/op_sel_hi/neg_lo/neg_hi/clamp and SGPR sources, and seeded random operands and modifiers.
|
Measured on gfx1036 (RDNA2, driver 26.10.1, raw hw_oracle kernels, one lane, game MODE: IEEE 0, DX10_CLAMP 1, f32 denormals flushed, f16/f64 denormals kept): |
|
Code read of
Ran on Windows 11, Python 3.14: the four files, 6 tests each, OK. AI-assisted code read (Claude). |
|
Reviewed and tested
Review: I read the four rewritten files, AI-assisted (Claude Code); I checked the results. |
sds-228
left a comment
There was a problem hiding this comment.
Code review of f8af82a: no issues found. Packed-op coverage now runs through the translator with per-lane checks, and no contradictory expectations remain. Targeted suites: 24 tests OK; compileall and diff check clean.
AI-assisted (OpenCode).
|
Rewritten packed-f16 tests verified on Linux: merges cleanly into current main, |
AI-assisted.
Claim: batch A of the model-only semantic tests (coordination issue #3381,
claiming: tests/semantic batch A (float)); follow-up of the finding under #3472.What was wrong.
test_valu_pk_{add,mul,fma,minmax}_f16.py(1.3k to 1.8k lines each) built their own SIMD model and never importedsupportorrdna2spirv. Repro of the gap: in thev_pk_*_f16branch oftools/rdna2spirv.pymakev_pk_add_f16subtract,v_pk_fma_f16read src1/src2 swapped,v_pk_min_f16take the max, ignoreneg_hi, or defaultop_sel_hito 0; the old files stay green.Fix. Same shape as #3448/#3457/#3472: every case goes through
support.translate_linesandmrt0_words. Expected dwords are written by hand next to each case (per lane), rechecked lane by lane against a plain-Python binary16 reference (tests/semantic/f16_ref.py, byte-identical to the one in #3519, so whichever lands second merges cleanly; the min/max reference lives in the file). Covers per-lane edge values (signed zeros, ties, overflow, subnormals, inf/NaN by class; min/max NaN suppression and -0 < +0), everyop_sel/op_sel_hicombination, hand-checkedneg_lo/neg_hi/clampcases, SGPR sources, and seeded random operands with random modifiers.v_pk_fma_f16includes the fused (single-rounding) case. The translator agreed with the ISA on every case: no translator change. I left literal/inline-constant sources out on purpose: where the unused half comes from is not settled by the ISA text (see #3368).Tested. Python 3.12.16, Linux (WSL):
python -I -m unittest discover -s tests/semantic -p 'test_valu_pk_*_f16.py'runs 24 tests, all pass;tests/test_ci_registration.pypasses.Negative control. With a mutated copy of
tools/(LEONIDA_TOOLS_DIR):v_pk_add_f16as OpFSub: new add file fails (169 failures), old file OK;v_pk_mul_f16as an add: 183, old OK;v_pk_fma_f16with src1/src2 swapped: 216, old OK;v_pk_min_f16/maxswapped: 223, old OK; defaultop_sel_hi0: 19 to 41 failures per file, old OK;neg_hiread fromneg_lo: 88 (add) and 80 (fma), old OK.