Repository navigation
Conversation
The two merges that added v_cmp(x)_class_f64 left two dispatch arms for the same instructions in the one elif chain: the earlier one routed them to Gen.cmp_class, so Gen.cmp_class_f64 never ran and its operand checks (a neg on the mask word, a three-operand v_cmpx with an SGPR destination) were dead. tests/semantic/test_cmp_class_f64.py caught it: two forms that must be Unsupported translated instead. Route the f32/f16 forms to cmp_class only and drop the now-dead f64 arm there; docs/design.md's f16 row stops claiming the f64 forms.
python -m unittest discover -s tests/semantic on 03b09a0: 7456 tests, 36 failures, 2 errors (macOS 27.2.1, Apple M3 Pro, CPython 3.15.2). - test_mutations: the v_mul_legacy_f32 zero-override anchor predates the flush-in/flush-out rewrite; move it onto the current block. - test_alu_vop3_mods_hw / test_alu_sdwa_hw: the measured rows hold the NaN sign gfx1036 produced (-qNaN), which an arm64 host's float ops do not reproduce (+qNaN), so seven 27 + 2 rows failed only there. Compare each 16-bit half of a measured word with any NaN equal to any NaN, as the files' headers already call the NaN sign a known difference. - test_loop_ballot_barrier: --wave64-emulate now emits the structured plan (inline_all, structured_hybrid) and outlines the x_round setup into %x_pre_*_fn helpers, so the fixture's interpreter follows OpFunctionCall (as spirv_mini_interp does) and the test pins the plan it exercises. After: 7456 tests OK (1 skipped, 1 expected failure).
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 0efe34c1 on Windows 11: test_cmp_class_f64.py 6 OK, test_alu_cmp_class_f16_f64.py 4 OK, test_valu_cmp_class.py 47 OK; compileall and git diff --check clean.
v_cmp_class_f64 is back on its own branch, and the semantic suite fixes (support helper, SDWA/VOP3 hardware cases, loop-ballot barrier) keep the affected tests green. No blocking issue.
whattheflop
left a comment
There was a problem hiding this comment.
AI-assisted Windows CPU review at 0efe34c1. The new same_measured_word() can accept a wrong scalar result because both measured tables use its binary16-half rule for full integer and f32 outputs too.
- The measured
v_and_b32_sdwaWORD_0 row expects0x0000ffff.same_measured_word(0x00007c01, 0x0000ffff)returnsTrue, treating the two different integers as half NaNs. - An actual
v_cvt_f32_u32_sdwarow expects0x477fff00(65535.0).same_measured_word(0x477f7c01, 0x477fff00)also returnsTrue, although both are different finite f32 values.
All current SDWA and VOP3 rows matched exactly in the Windows uv CPython 3.12.13 run. These examples show a regression the new assertions would miss. Could the comparison take the row's result format, keeping integers and preserved bits exact, comparing scalar f32 NaNs at 32-bit width, and limiting the half-NaN rule to actual f16 outputs? The intended scalar sign-only pair 0x7fc00000/0xffc00000 can still match.
|
Tested
AI-assisted (Devin). |
|
Focused Windows rerun at |
|
Tested 0efe34c merged with main d0835dd (merge, no conflicts) on Linux (WSL2) Python 3.12.16: pass.
|
|
Tested
Code read: the AI-assisted. |
|
Tested Full
Tested and written by Claude (Claude Code), posting from @theswiss24's account. |
|
Updated with
Verified that both SDWA and VOP3 measured tables continue to pass cleanly. AI-assisted. |
|
Tested
No game data. AI-assisted. |
whattheflop
left a comment
There was a problem hiding this comment.
Retested 0f7a1d07 on Windows with uv CPython 3.12.13. Both original false accepts now correctly fail (integer 0x00007c01 vs 0x0000ffff, finite f32 0x477f7c01 vs 0x477fff00), the scalar NaN sign pair matches, and both measured suites pass.
One actual preserved-half row is still relaxed. In the v_fma_mixlo_f16 case initialized by v_mov_b32 v4, v3, the measured word is 0xff800505. The high half is preserved. Passing 0x7e010505 still returns true because both high halves look like f16 NaNs. The low f16 result is the part that should use the NaN rule in that row. Could the comparator take a mask for the written half or have the call site compare preserved bits first? Separately, scalar f32 now accepts different NaN payloads too, so the description should say whether payload equivalence is intended. AI-assisted, CPU fixtures only.
Kam471
left a comment
There was a problem hiding this comment.
Overlap: #3883 ("re-anchor the v_mul_legacy_f32 mutation after the flush change") updates the same two MUTATIONS entries in tests/semantic/test_mutations.py as this PR, with nearly identical new anchor text, and the two branches conflict there (git merge-tree --write-tree refs/remotes/pr/3883 refs/remotes/pr/4527 -> conflict in tests/semantic/test_mutations.py).
This PR also carries the other fixes that make the suite green, so one of the two should probably close; #3883 is the narrower, earlier one, this PR the broader. Flagged on #3883 too.
|
@Kam471 @wavehs — following your overlap note on #3883: I've closed #3883, so this is no longer a three-way conflict. Please keep the |
Fixes the red
tests/semanticonmain03b09a08:python -m unittest discover -s tests/semanticreported 7456 tests, 36 failures + 2 errors, and reports 7456 tests OK (1 skipped, 1 expected failure) after this branch.Claim: #4421 (comment)
The translator bug (not just a stale test)
tools/rdna2spirv.py:7438b8ffand685d16edeach added thev_cmp_class_f64/v_cmpx_class_f64dispatch to_insn, in the sameelifchain. The earlier arm routed them toGen.cmp_class, so the laterGen.cmp_class_f64was unreachable and its operand checks were dead code:v_cmp_class_f64_e64 s4, v[0:1], -v2(anegon the mask word, which is a 32-bit integer) translated;v_cmpx_class_f64_e64 s4, v[0:1], 0x1(three operands with an SGPR destination;v_cmpxnarrows EXEC) translated.Both must raise
Unsupported, andtests/semantic/test_cmp_class_f64.py::test_rejected_formssays so. The f32/f16 arm now lists only those,cmp_class_f64handles f64, and the f64 arm insidecmp_classis removed.docs/design.md'sv_cmp_class_f16row no longer claims the f64 forms (thecmp_class_f64row below it already describes them).The stale tests
test_mutations.py: thev_mul_legacy_f32anchor was written before that block gained the flush-in/flush-out rewrite, so the mutation could not be applied at all (mutation anchor must occur exactly once). Moved onto the current block; the mutation is unchanged (the zero-times-anything override is dropped).test_loop_ballot_barrier.py:--wave64-emulatenow emits the structured plan (inline_allfor one wave,structured_hybridfor the 128-thread case) and outlines the x_round setup into%x_pre_*_fnhelpers. The fixture's own workgroup interpreter now parses every function and followsOpFunctionCall/OpReturnValue(the same modelspirv_mini_interpuses, capped at 16 frames), and the test pins the plan it exercises instead of the oldemulated wave64 roundslabel.The arm64-only difference
test_alu_vop3_mods_hw.py(27 rows) andtest_alu_sdwa_hw.py(2 rows) compare words gfx1036 returned bit for bit. A NaN's sign is host arithmetic's: arm64 gives+qNaNwhere the measured rows have-qNaN, so those rows passed on x86 and failed on macOS.support.same_measured_wordcompares each 16-bit half of a measured word bit for bit, with the one exception the file headers already document: a NaN equals a NaN of either sign. Nothing else is relaxed, and the mutation tests still fail if the translator stops producing the measured value.Testing
No GPU, no game files, synthetic inputs only. macOS 27.2.1 (26B131), Apple M3 Pro, CPython 3.15.2:
python -m unittest discover -s tests/semantic: before 36 failures + 2 errors, after 7456 tests OK (1 skipped, 1 expected failure);python -I tests/semantic/test_mutations.py3/3,test_cmp_class_f64.py6/6,test_loop_ballot_barrier.py15/15,test_wave64_emulate_opt.py22/22,test_alu_cmp_class_f16_f64.py4/4,test_valu_int16.py16/16,test_alu_vop3_mods_hw.py2/2,test_alu_sdwa_hw.py2/2;python -m compileall -q make_game.py tools tests,python -I make_game.py --help,python -I tests/semantic/regen_fixtures.py --check(exit 0): clean.The translator change removes a dead path, so no fixture output moves (
regen_fixtures.py --checkagrees). AI-assisted.