Skip to content

tests/semantic: re-anchor the v_mul_legacy_f32 mutation after the flush change - #3883

Open
ray3242 wants to merge 1 commit into
ItsNotRexed:mainfrom
ray3242:devin/1795385647-mutation-legacy-anchor
Open

ray3242 wants to merge 1 commit into
ItsNotRexed:mainfrom
ray3242:devin/1795385647-mutation-legacy-anchor

Conversation

@ray3242

@ray3242 ray3242 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new TEST item, the v_mul_legacy_f32 mutation anchor (claim).

What and why

On main 4c52ce27, tests/semantic/test_mutations.py fails 2 subtests: test_each_mutation_is_caught and test_anchors_match_crlf_translator_copies, for "v_mul_legacy_f32 drops zero-times-anything guard". Each anchor must occur exactly once in tools/rdna2spirv.py. This one still quoted the v_mul_legacy_f32 body from before c82fbe3 ("Shader: flush legacy f32 multiply operands and results in default MODE", the change in #3318). That commit now flushes both operands and the product, so the anchor no longer occurs. The suite reports the mismatch loudly, as designed, but the mutation check for the legacy zero rule no longer runs.

This re-anchors it on the current body. The mutant is still the same: the OpSelect that forces +0 when either operand is zero becomes an OpCopyObject of the flushed product. The translator is unchanged.

Tested

  • python -m unittest discover -s tests/semantic -p test_mutations.py: 3/3 OK, including the baseline copy, the CRLF-copy anchors, and every mutant (this one fails test_ps_legacy_mul). On main it gives the 2 failures above.
  • The new anchor occurs exactly once in tools/rdna2spirv.py, and the mutated text not at all.
  • python -m compileall -q tests passes.
  • CPU only; no GPU needed or used, no game files.

AI-assisted (Devin).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No new translator rule (test-only change).

…d legacy multiply

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@Vonsek

Vonsek commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Second check on Windows at 3b65883, also checked against the translator on main aa2988c. The previous anchor matched zero times on both. The new anchor matched once, and the replacement was absent before the mutation.

The existing test_ps_legacy_mul passed on each unmodified copy. Replacing only the zero guard made that same test fail on both copies: x, y and z returned NaNs where the test expected +0. The CRLF scratch copies also retained their line endings and compiled after the replacement. This was a focused check of the single changed mutation with the CPU interpreter.

AI-assisted.

@tupacfan04

Copy link
Copy Markdown
Contributor

Tested at the head (3b658838, base 4c52ce27) on Windows 11 / Python 3.13.0: tests/semantic/test_mutations.py 3/3 (160 s, including the 13 mutant subtests and the CRLF-copy anchor test), tests/semantic/test_valu_mul_legacy_denorm.py 4/4, compileall -q tests clean. Merge with current main (aa2988cc, not an ancestor) is clean, and all 13 anchors still occur exactly once there.

The anchor targeting is right: the new anchor occurs exactly once in tools/rdna2spirv.py:7552-7562 and the mutated text zero times, on both the PR and main; the mutant still only swaps the OpSelect that forces +0 for an OpCopyObject of the flushed product, and the translator is identical between base and head. With the mutant applied, test_each_mutation_is_caught passes and asserts test_ps_legacy_mul among the failures, so detection is real.

Negative control: restoring only the test file from the parent reproduces the claim exactly - 2 failures (v_mul_legacy_f32 subtest and test_anchors_match_crlf_translator_copies) from apply_mutation:120 ("anchor must occur exactly once") - while test_baseline_copy_passes still passes.

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

@Tom1419-git

Copy link
Copy Markdown

Tested 3b65883 on macOS 26, Apple Silicon (arm64), CPython 3.15.2, CPU only, no GPU or game data: pass. Checked out the PR head and ran python3 -m unittest discover -s tests/semantic -p test_mutations.py: 3 tests, OK. The test failed on main (aa2988c) on the same machine before this change. First ARM64 host check for this PR.

AI-assisted (Claude Code).

@dcastell1

dcastell1 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Code read + CPU tests, 3b65883: pass — python -m unittest discover -s tests/semantic -p 'test_mutations.py' → OK on this branch, with the SDK (spirv-as/spirv-val 2026.4) on PATH.

Full-suite context from the same branch: Ran 7456 tests; what still fails is the other red files of #4084, not this one.

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

Verified at 3b65883 on a clean checkout (Windows, Python 3.12, CPU only):

  • python -I tests/semantic/test_mutations.py — 3/3 OK (121 s; main aa2988c: FAILED, failures=2, matching the finding).
  • The PR's own diff is test-only (tests/semantic/test_mutations.py, +10/−6): the anchor now quotes the post-#3318 flushed body, and the mutant is the same drop-the-zero-override (OpSelect … %f0 → OpCopyObject), adapted to the flushed product.
  • Cross-checked against the current main, not just the PR's 4c52ce27 base: all three anchor lines occur exactly once in aa2988c's tools/rdna2spirv.py, so the re-anchor does not drift again on merge.
  • python -m compileall -q on the file: clean. The passing test_anchors_match_crlf_translator_copies is itself the once-only check.

Unblocks 2 of the 9 red semantic tests on main. Approving.

AI-assisted.

@theswiss24

Copy link
Copy Markdown

Tested 3b658838 on Windows 11 (26300), Python 3.14.2, CPU only: pass, both on its own and merged onto main aa2988cc (clean merge, 92454799).

  • On main aa2988cc, test_mutations gives 2 failures: test_each_mutation_is_caught and test_anchors_match_crlf_translator_copies, both with mutation anchor must occur exactly once for v_mul_legacy_f32 drops zero-times-anything guard.
  • On this branch and on the merge, python -I -m unittest discover -s tests/semantic -p test_mutations.py ran 3 tests: OK.

No game files.

AI-assisted (Claude Code).

NolanCotter added a commit to NolanCotter/Leonida that referenced this pull request Nov 23, 2026
The flushed-block re-anchor arrived on this branch alongside the queue
layout work, but it duplicates open PR ItsNotRexed#3883 which owns the same
anchor. Restore the file to upstream state so the two pull requests do
not collide on this hunk; the mutation guard is unchanged either way.
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.

7 participants