Skip to content

test(semantic): add translator tests for v_ceil_f32 - #5738

Open
slopgobblercobbler wants to merge 12 commits into
ItsNotRexed:mainfrom
slopgobblercobbler:test/semantic-valu-ceil-f32-suite
Open

slopgobblercobbler wants to merge 12 commits into
ItsNotRexed:mainfrom
slopgobblercobbler:test/semantic-valu-ceil-f32-suite

Conversation

@slopgobblercobbler

Copy link
Copy Markdown
Contributor

What

Adds translator-backed regression tests for v_ceil_f32 in tests/semantic/test_valu_ceil_f32_hw.py.

Covers:

  • Hand-written RDNA2 shader assembly translation through tools/rdna2spirv.py
  • Execution of translated SPIR-V via spirv_mini_interp
  • Reference mathematical verification across standard and edge-case inputs
  • Flushed denormal handling (subnormals flush to zero of same sign)
  • Unchanged NaN and Infinity passthrough (signalling NaNs preserved under IEEE 0)
  • Upward rounding of positive and negative fractions
  • Register aliasing and in-place operand preservation
  • Float condition code comparison (v_cmp_eq_f32) and negative syntax rejection controls

Tested

  • Tested with Python 3.9+ (python -I)
  • python -I tests/test_semantic_translator_use.py (Passes translator reachability check)
  • python -I tests/semantic/test_valu_ceil_f32_hw.py (All tests passed, OK)
  • Standard library Python only (unittest, struct, math)
  • Clean merge against upstream/main
  • Strictly zero game data, binaries, or proprietary keys

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 4308656e on Windows Server 2022, CPython 3.13.12: pass

  • python -I -m unittest discover -s tests/semantic -p "test_valu_ceil_f32_hw.py" -> OK

git diff --check clean; python -m compileall -q exit 0. No game files, no GPU. AI-assisted (Devin).

@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.

Reviewed head 4308656 (base 561b65a).

  • git diff --check clean.
  • python tests/semantic/test_valu_ceil_f32_hw.py -> Ran 14 tests, OK.
  • Independent bit-level oracle; denormal, NaN/Inf, +/-0 cases; AST/E64/chained/aliasing/status coverage; syntax rejection; and a floor-instead-of-ceil mutation test.

Verdict: merge. Minor overlap: #5732's tests/semantic/test_valu_f32_unary.py already samples v_ceil_f32; different file, no conflict.

Address maintainer feedback: expand translator-backed execution coverage
via support.translate_lines and support.mrt0_words so Ceil->Floor mutations
in tools/rdna2spirv.py are caught.

- Drop unused warnings, rdna2spirv, and spirv_mini_interp imports
- Add test_translator_emits_ceil_not_floor asserting OpExtInst Ceil
- Add test_translator_positive_fractional_inputs and negative_fractional_inputs
- Add test_translator_integral_values_unchanged
- Add test_translator_special_values_passthrough and signed_zeros_passthrough
- Add test_translator_mutation_ceil_to_floor_caught verifying floor divergence
- Add test_translator_clamp_modifier and e64 neg modifier tests
- Update test_mutation_detection_floor_instead_of_ceil with translated execution

All 23 tests pass.
@JRamos1993

Copy link
Copy Markdown
Contributor

Tested 9a4bd3fe merged onto main 6d4260da on Windows 11, CPython 3.14.3, CPU only: pass.

  • python -I -m unittest discover -s tests/semantic -p test_valu_ceil_f32_hw.py: 23 tests OK.
  • py_compile on the 1 changed Python file: OK; git diff --check: clean.

No game files. AI-assisted (Claude Code).

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested 0b49d4e0 merged onto main dde82f27 on Windows 11, CPython 3.14.3, CPU only: pass.

  • python -I -m unittest discover -s tests/semantic -p test_valu_ceil_f32_hw.py: 24 tests OK.
  • py_compile on the 1 changed Python file: OK; git diff --check: clean.

No game files. AI-assisted (Claude Code).

@ps1ke

ps1ke commented Nov 23, 2026

Copy link
Copy Markdown

Tested 0b49d4e0f on Linux x86-64 (Arch, Python 3.14), CPU only, no GPU, no game files: pass.

  • python -I -m unittest discover -s tests/semantic -p test_valu_ceil_f32_hw.py: 24 tests OK for v_ceil_f32 (hand-written listings through the translator, output words compared with the Python reference).
  • scripts/check_no_game_data.py on the file: clean. Only the one test file changes.

AI-assisted (Claude Code).

@rideinstead

Copy link
Copy Markdown

TEST validation — Approve

Validated on CPU (no GPU, no game files). All 24 tests pass.

Translator coverage: Yes — hand-written RDNA2 shader assembly translated through tools/rdna2spirv.py, SPIR-V executed via spirv_mini_interp. Translator mutation detection (ceil→floor caught via OpExtInst Ceil assertions).

Validation: Passed on Windows 11 (CPython 3.14.3), Windows Server 2022 (CPython 3.13.12), Linux Arch (CPython 3.14). Reviewer Kam471 gave explicit "Verdict: merge".

Recommendation: Approve / merge.

@sds-228 sds-228 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.

Focused semantic suite passes 24/24 at this head, including the built-in mutation check. Special values, subnormals and signed zeros are covered, and the earlier reviewer's overlap note does not conflict.

AI-assisted (OpenCode).

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

Tested 0b49d4e0 on Linux, CPython 3.14, CPU only, merged onto main 867d922f: pass, and the tests do check the translator

  • python -m unittest discover -s tests/semantic -p test_valu_ceil_f32_hw.py: Ran 24 tests, OK.
  • Mutation check: in the merged tree I mapped v_ceil_f32 to Floor instead of Ceil in the rounding table (one line). Same command: FAILED (failures=21). So a wrong lowering of this instruction turns the file red.

Since several test-only PRs in this family pass even with the instruction's lowering broken (#5642, #5463), this one is worth distinguishing: it is sensitive to the translator's result.

Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; coordination: #8504.

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.

8 participants