Skip to content

tests/semantic: run u16 clamp, interp_p1/p2 and cmp_class through the translator; drop fake dot2_f16 - #4123

Open
SweatierKey wants to merge 1 commit into
ItsNotRexed:mainfrom
SweatierKey:test/clear-semantic-debt-four
Open

SweatierKey wants to merge 1 commit into
ItsNotRexed:mainfrom
SweatierKey:test/clear-semantic-debt-four

Conversation

@SweatierKey

Copy link
Copy Markdown
Contributor

Claimed in #4084 (claim).

Clears the four remaining unclaimed DEBT entries in tests/test_semantic_translator_use.py (leaving test_valu_cvt_int_f64.py and test_valu_ldexp_f64.py for #3325 and #3543):

What changed

  • tests/semantic/test_alu_u16_clamp.py: replaced the 59-line Python-only stub with translator-driven tests exercising v_add_nc_u16_e64, v_sub_nc_u16_e64, v_add_u16_e64, v_sub_u16_e64, v_subrev_u16_e64 (clamp vs wrap, op_sel high/low-half preservation), packed v_pk_add_u16 / v_pk_sub_u16 clamp vs wrap, and the negative control (v_mul_lo_u16_e64 ... clamp raises Unsupported, matching docs/design.md).
  • tests/semantic/test_interp_p1_p2_f32.py: replaced the 1,485-line private oracle with translator-driven fragment shaders covering v_interp_p1_f32 + v_interp_p2_f32 across all four channels and multiple attributes (attr0..attr2), v_interp_mov_f32 p0 (Flat decoration), and inactive-lane preservation via support.varyings / support.mrt0_words.
  • tests/semantic/test_valu_cmp_class.py: replaced the 1,373-line private oracle with translator-driven tests covering all 10 IEEE 754 class bits for both v_cmp_class_f32 and v_cmp_class_f64, composite/high-bit masks, VOP3 abs/neg modifiers, and 32-lane v_cmpx_class_f32_e32 / v_cmpx_class_f64_e32 EXEC updates.
  • tests/semantic/test_valu_dot2_f16.py: deleted (1,695-line private oracle for v_dot2_f16_f16 / v_dot2acc_f16_f16, neither of which is a valid GFX10 / gfx1013 opcode — both rejected by llvm-mc -mcpu=gfx1013).
  • tests/test_semantic_translator_use.py: removed all four entries from DEBT.

Tested

Linux (WSL2), Python 3.13.5, spirv-as + spirv-val --target-env vulkan1.2 on PATH, CPU only, no game files:

  • python3 -I tests/semantic/test_alu_u16_clamp.py -v: 6/6 OK (all emitted SPIR-V validated by spirv-val)
  • python3 -I tests/semantic/test_interp_p1_p2_f32.py -v: 3/3 OK (all emitted SPIR-V validated by spirv-val)
  • python3 -I tests/semantic/test_valu_cmp_class.py -v: 5/5 OK (all 20 single-bit class probes + composite/mod/cmpx shaders validated by spirv-val)
  • python3 -I tests/test_semantic_translator_use.py -v: 3/3 OK
  • tests/test_docs_repo_paths.py (2/2), tests/test_docs_links.py (6/6), tests/test_text_write_line_endings.py (3/3), tests/test_text_encoding.py (2/2): all OK.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at cb796d31 on Windows 11:

  • test_alu_u16_clamp.py 6 tests OK; test_interp_p1_p2_f32.py 3 OK; test_valu_cmp_class.py 5 OK; test_valu_dot2_f16.py is removed; test_semantic_translator_use.py 3 OK with those four entries gone from DEBT.
  • The remaining two debt entries are indeed test_valu_cvt_int_f64.py and test_valu_ldexp_f64.py, matching the note.

The four replacements translate the synthetic listings and run the interpreter rather than modelling the answer; the dot2 file had no translator path and is dropped. No blocking issue.

@tupacfan04

Copy link
Copy Markdown
Contributor

Verified at the head on Windows 11 / Python 3.13.0: all three files call support.translate_lines (test_alu_u16_clamp.py:46, test_interp_p1_p2_f32.py:54, test_valu_cmp_class.py:80) with no private oracle left; mutation controls fail as required (u16 clamp 3, interp 2, cmp_class 1). Runs: u16 6/6, interp 3/3, cmp_class 5/5, guard 3/3, compileall clean, merge clean with main and #4127.

The deleted test_valu_dot2_f16.py (1,695 lines / 66 tests) was a duplicate non-translator oracle, and its rejection remains covered by test_alu_dot2_f16.py:922-947.

Coverage notes, both acceptable since these were oracle-only cases rather than previous translator coverage: the modifier tests no longer include the sNaN/zero/denormal extremes (test_valu_cmp_class.py:164-188 vs the old :1221-1235), and the interp source/p1 modifiers are not re-expressed.

Separately, tests/semantic/test_mutations.py fails 2/3 here (anchor at :120, label :70), but identically on main aa2988cc - pre-existing and unrelated.

Approve. AI-assisted review, no game files, no GPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants