Repository navigation
test(semantic): add reference oracle and semantic tests for v_div_scale - #2816
ItsNotRexed merged 8 commits into
Conversation
…odel for v_div_scale
…ions for v_div_scale
…king for v_div_scale
…on for v_div_scale
…eneration for v_div_scale
…andling for v_div_scale
… detection for v_div_scale
|
Structural review (same family as the #2824 finding) — this one targets something genuinely open: Two things would make this land as groundwork for that future translator row rather than a parallel universe: hook the model to the repo (differential against AI-assisted (ZCode agent): the verification runs were executed by a coding agent on this machine. |
|
Reviewed PR #2816 ( Files read
Checks run
Findings
|
|
Measured on gfx1036 (RDNA2, AMD Radeon iGPU, driver 26.10.1, game MODE: ieee 0, dx10_clamp 1, denorm32 0, denorm16_64 3): the oracle does not match the hardware's scaling rule. AI-assisted. |
They model the instruction in Python and never run tools/rdna2spirv.py, so they pass whatever the translator does (tests/test_semantic_translator_use.py, added this round, rejects them). PRs: ItsNotRexed#2335 ItsNotRexed#2754 ItsNotRexed#2759 ItsNotRexed#2761 ItsNotRexed#2788 ItsNotRexed#2793 ItsNotRexed#2797 ItsNotRexed#2800 ItsNotRexed#2803 ItsNotRexed#2804 ItsNotRexed#2814 ItsNotRexed#2816 ItsNotRexed#2819 ItsNotRexed#2824 ItsNotRexed#2825 ItsNotRexed#2829 ItsNotRexed#2834 ItsNotRexed#2835 ItsNotRexed#2837 ItsNotRexed#2840 ItsNotRexed#2845 ItsNotRexed#2850 ItsNotRexed#2854 ItsNotRexed#2856 ItsNotRexed#2867 ItsNotRexed#2868 ItsNotRexed#2877 ItsNotRexed#2883 ItsNotRexed#2889 ItsNotRexed#2892 ItsNotRexed#2895 ItsNotRexed#2896 ItsNotRexed#2897 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What and why
Adds comprehensive semantic interpreter tests and a reference mathematical oracle for
v_div_scale(v_div_scale_f32andv_div_scale_f64) intests/semantic/test_valu_div_scale.py.This adds 47 focused unit tests covering:
ref_div_scale_f32,ref_div_scale_f64).RegisterPair).ASTOperand,ASTInstruction,Opcode,OperandKind,TypeKind,OMod).TypedExpr,VariableExpr,ConstantExpr,UnaryOpExpr,DivScaleExpr) with evaluation.ScalarRegisterFile).ScalarInterpreter) with bit-identical repeatability.SIMDWaveState) supporting Wave32 and Wave64.dst == src0 == src1), in-place numerator scaling (dst == src0 == src2), self-aliasing (dst == src0 == src1 == src2).v[1:2]dst overlappingv[0:1]src0 andv[2:3]src1).invalid,overflow,underflow,inexact) and condition codes (is_negative,is_zero,is_inf,is_nan,is_subnormal,scaled).THRESH_F32_SMALL,THRESH_F32_LARGE,THRESH_F64_SMALL,THRESH_F64_LARGE).+0.0vs-0.0), signed infinities propagation.clampmodifier mapping NaN to+0.0.parse_div_scale_asm) rejecting malformed syntax, wrong opcodes, illegal modifiers, and out-of-bounds registers.Tested
python -m compileall -q testspasses with zero errors on Python 3.9+.python -I tests/semantic/test_valu_div_scale.pypasses all 47 tests cleanly.python -m unittest discover -s tests/semantic -p "test_valu_div_scale.py"discovers and passes all 47 tests.Checklist
from __future__ import annotations).tests/semantic/test_valu_div_scale.py.AI-assisted.