tests/semantic: provide floating-point edge-case conformance suite (SHADER-13) #708
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/708"
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 ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T12:28:17Z.
Summary
Implements SHADER-13: Floating-point edge-case conformance suite.
Adds targeted synthetic conformance tests in \ ests/semantic/test_fp_edge_conformance.py\ to validate IEEE-754 / RDNA2 floating-point edge behaviors without requiring retail shaders or GPU execution:
Verification
Imported from ubiquitarianism/leonida. Originally posted by GeorgiyDemo on 2026-11-24T12:39:00Z.
Ran
522816d72on Apple M5 Pro, macOS 26.7.3 (25G342), Python 3.15.2 (CI uses 3.12):tests/semantic/test_fp_edge_conformance.py: 9 tests OK at this head, stdlib only (python -I), no GPU and no game files.maind42773d07also passes 9/9, so this is new coverage of existing behaviour rather than a regression fix; it is useful as a guard.Synthetic fixtures only, no game data. AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-24T13:48:06Z.
Review: COMMENTED
Checked head 522816d72 (Linux, CPU only, no game files).
The file never runs the translator.
rdna2spirvis used once, inself.assertIsNotNone(rdna2spirv)(line 233), which is enough fortests/test_semantic_translator_use.pyto count the import as used, but no test translates a listing. The checks compare Python with Python:structround trips, the file's ownref_min_f32/ref_max_f32(never compared with translator output),spirv_mini_interp._fract, and constants (test_cvt_pkrtz_f16_exact_rtz_boundssetsf16_max_bits = 0x7BFFand asserts it equals0x7BFF).tools/semantic_mutants.pyshows it: with this file,--op v_min_f32catches 0 of 4 mutants,--op v_max_f320 of 4,--op v_fract_f320 of 6.The new
docs/design.mdrow also disagrees with the rows measured on hardware:v_fract" row records that on gfx1036, in the game's MODE (IEEE 0), a NaN operand ofv_fract_f32"comes back unchanged, a signalling one too", and thev_frexp_mant_f64row records the same pass-through for sNaN; quieting is the IEEE=1 behaviour.SignedZeroInfNanPreserveandRoundingModeRTE": the translator emitsSignedZeroInfNanPreserve, butRoundingModeRTEappears nowhere intools/rdna2spirv.py.tests/semantic/test_fp_edge_conformance.py": per the above, the file does not verify translation.To make it a translator test: translate listings with
support.translate_linesand compare the exported words with what is already measured (e.g.v_fract_f32of ±inf is0xffc00000, a signalling NaN operand comes back unchanged, an all-NaNv_min_f32/v_max_f32keeps src0), and either drop the design row or limit it to what those tests confirm.Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:51:57Z.
Thank you for the thorough review @qhukz13! Rebased onto current main (
6293c1c4f) and updated in ef70b19ac:Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-24T20:07:59Z.
Re-checked ef70b19ac (Linux, CPU only): this addresses everything I raised.
support.translate_lines+mrt0_words);tests/test_semantic_translator_use.pypasses without the oldassertIsNotNoneworkaround.--op v_min_f324/4,--op v_max_f324/4,--op v_fract_f326/6 (0 of 14 before).--op v_cvt_pkrtz_f16_f326/7; the survivor (OpBitwiseOr->OpBitwiseXorpacking the two halves) is equivalent, since the low half and the shifted high half share no bits.fract(±inf)=0xffc00000, a signalling NaN comes back unchanged), and the design row is gone.LGTM.
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T21:40:12Z.
Rebased cleanly onto latest \main\ (\
e34ff17e9). Verified: 5/5 tests in \ est_fp_edge_conformance.py\ pass.AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T10:45:41Z.
#708 | head
f2ff7f271dfd6a8a71bb81d5d8e542425493f829|python3 -m unittest discover -s tests/semantic -p test_fp_edge_conformance.py -v| red: 5 passed | green: 5 passed | Passed on both treesThe floating-point edge-case conformance file already passed on the pinned translator. This PR adds coverage.
Captured 25 distinct complete SPIR-V module(s) emitted while rerunning test_fp_edge_conformance.py on the merged tree. All assembled and passed spirv-val for Vulkan 1.2 with --allow-offset-texture-operand.
Base
3bd936ecd98995bca3e1da83d5e28d2343001aefwas merged into the recorded PR head for the second run. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Counts include unittest subtest events where applicable. AI-assisted with OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-28T11:54:12Z.
Merged, thank you @abnalstlll-byte! This translator PR (tests/semantic: provide floating-point edge-case conformance suite (SHADER-13)) passed its own tests with main merged in during sodove's verification of this batch, so it went in with the batch.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.