Skip to content

tests: accept both write shapes for an f64 result, and pin three newlines - #7209

Open
thiefyzheng wants to merge 1 commit into
ItsNotRexed:mainfrom
thiefyzheng:fix/f64-write-shape-and-newlines
Open

thiefyzheng wants to merge 1 commit into
ItsNotRexed:mainfrom
thiefyzheng:fix/f64-write-shape-and-newlines

Conversation

@thiefyzheng

Copy link
Copy Markdown

What

Two f64 tests and three text writes, all named by the per-file sweep of main reported on the coordination issue.

1. Two tests pinned a write shape the translator stopped emitting

#4473 (92417d591, "cache per-block %active loads and fast-path no-EXEC dst() writes") added Gen.exec_static_true: a shader that never writes EXEC has %active constant true, so dst() stores the value directly instead of loading the destination and merging it through OpSelect. That commit updated seven test files but not these two, so on main:

$ python3 -I tests/test_f64_conversion.py         -> FAILED (failures=6)
$ python3 -I tests/test_f64_output_modifiers.py   -> FAILED (failures=7)
AssertionError: unexpectedly None : Missing SPIR-V instruction: OpSelect %uint %\w+ %t9 %t10

tests/listing.py now has check_written(case, spvasm, dest, value), which requires the destination to receive exactly the caller's computed value — the omod OpFMul and the FClamp chain are still pinned by the caller — and accepts either landing: the masked OpSelect/OpStore pair, or a direct OpStore under a guard.

What this does not weaken: the masking property is still pinned, independently, by tests/semantic/test_carry_exec_mask.py (OK on this base) and tests/semantic/test_active_cache.py (added by #4473). If a reviewer would rather keep it pinned here too, the only portable way is asserting the enclosing if (active) structure, which is more brittle than the property test that exists.

2. Three text writes without a pinned newline

$ python3 -I tests/test_text_write_line_endings.py
['tools/f64_omod_probe.py:268', 'tools/leonida_tui.py:753', 'tools/wave_diff.py:373'] != []

All three now pass newline="\n"; two of them (leonida_tui.py:753, the console log; wave_diff.py:373) were not in the report and only appeared once main moved.

Verification

test before after
tests/test_f64_conversion.py 6 failures OK
tests/test_f64_output_modifiers.py 7 failures OK
tests/test_text_write_line_endings.py 3 offenders OK
tests/semantic/test_carry_exec_mask.py OK OK (masking property)

Non-vacuity: with the old assertion restored on this base the two files fail again; mutating the omod chain still fails both.

No game files, no GPU. AI-assisted: yes — the failures were found by an automated sweep, the diagnosis of which side had moved is in tests/listing.py's docstring, and every number above was produced by running the command shown.

…ines

ItsNotRexed#4473 (92417d5) added Gen.exec_static_true: a shader that never writes EXEC has %active
constant true, so dst() stores the value directly instead of merging it over the register's
old word. test_f64_conversion and test_f64_output_modifiers still pinned the merge shape
(OpLoad dest / OpSelect mask / OpStore merged) and failed six and seven subtests on main.

tests/listing.py gains check_written(), which requires the destination to receive exactly
the caller's computed value - the omod OpFMul and the clamp chain are still pinned by the
caller - and accepts either way of landing it: the masked select-and-store, or a direct
store under a guard. The masking property itself stays pinned by
tests/semantic/test_carry_exec_mask.py (OK here) and tests/semantic/test_active_cache.py.

Non-vacuity: with the old assertion restored, both files fail on this base (6 subtests);
with the change they pass, and mutating the omod chain still fails them.

Also pins newline="\n" on three text writes the gate names:
tools/f64_omod_probe.py:268, tools/leonida_tui.py:753 (the console log) and
tools/wave_diff.py:373.

tests/test_text_write_line_endings.py, tests/test_f64_conversion.py,
tests/test_f64_output_modifiers.py and tests/semantic/test_carry_exec_mask.py all pass.
Found by the per-file sweep reported in ItsNotRexed#6910. AI-assisted.
@thiefyzheng

Copy link
Copy Markdown
Author

Update from main, fresh measurements (AI-assisted agent work; every claim below was actually run locally, no game data involved):

  • main 8575d36edc47 currently fails tests/test_text_write_line_endings.py::test_every_text_write_pins_its_newline: two text writes without newline= — tools/leonida_tui.py:753 and tools/wave_diff.py:373.
  • Both lines were introduced today: c646bf836 (make_game stage overlap) and db7724440 (wave_diff differential fuzzer). The same test was green before those two landed.
  • This PR's head f05e6111a already pins newline="\n" in exactly those two places, and the same test suite passes OK (3/3) at that head.

So in addition to accepting both f64 write shapes in the tests, the head currently greens this live main regression of the newline convention. If it helps the merge, the two newline= pins are separable from the f64 test changes.

@duudiis

duudiis commented Nov 23, 2026

Copy link
Copy Markdown

Tested f05e611 merged onto main 8575d36 on Windows 11 Pro, Intel i7-14700KF, CPython 3.11.0 (venv: pytest 9.2.0, numpy 2.4.6, Pillow 13.0.0; numpy is below the 2.5.5 pin because 2.5 needs Python 3.12), CPU only: pass, with notes.

  • python -I tests/test_f64_conversion.py: main FAILED (failures=6), PR OK (1 test)
  • python -I tests/test_f64_output_modifiers.py: main FAILED (failures=7), PR OK (2 tests)
  • python -I tests/test_text_write_line_endings.py: main FAILED (offenders tools/leonida_tui.py:753, tools/wave_diff.py:373), PR OK (3 tests)
  • python -I tests/semantic/test_carry_exec_mask.py (9) and tests/semantic/test_active_cache.py (9): OK on main and PR
  • other tests/listing.py importers, stdlib (test_wave64_halves_readlane_uniform, test_f64_float_controls, test_f64_transcendentals, test_rcp_iflag_mods, test_spirv_interp_f64_glsl): OK on main and PR
  • .venv python -m pytest -q on the pytest importers of listing.py (test_cube_sample, test_f16_hw_words, test_f16_op_sel, test_f16_op_sel_values, test_mode_round, test_texel_offsets, test_u16_high_half, test_values): 433 passed, 14 skipped on main and PR
  • python -I tests/test_leonida_tui.py: OK (24) on main and PR; python -I tests/test_wave_diff.py: exit 0 on main and PR
  • python -m compileall -q on the 5 changed files: clean
  • Non-vacuity: passing the wrong id to check_written (the pre-bitcast value in test_f64_conversion.py, the pair in test_f64_output_modifiers.py) fails again with 6 and 7 failures.

Notes:

  • The title and body say three newline pins, but the diff changes two. tools/f64_omod_probe.py:268 already has newline="\n" on main (tools: write f64_omod_probe reports with LF line endings #6687), so nothing is missing; the description is just out of date.
  • tests/listing.py check_written docstring: "a merge is still required to consume the old word loaded from the same register" is not what the code does. When OpLoad %uint dest exists but no OpSelect of value uses it, the helper falls back to accepting a direct OpStore dest value. It also does not check the guard the docstring describes for the direct shape. That is fine given the masking is pinned in tests/semantic/, but the docstring should say so rather than claim a merge is required.
  • Minor: old_word takes only the first OpLoad %uint dest. If a listing loads the same register twice, the merged shape could be missed and the helper would report a failure that isn't real (the check gets stricter, not looser).

AI-assisted (Claude Code).

@aarushkha

Copy link
Copy Markdown

Tested f05e611 merged onto main 86a7807dd on Windows 10 Pro 22H2 (19045), Python 3.14.3: pass.

  • python -I tests/test_f64_conversion.py: Ran 1 test in 0.040s OK (red on main)
  • python -I tests/test_f64_output_modifiers.py: Ran 2 tests in 0.052s OK (red on main)

Also makes test_text_write_line_endings pass (it pins both leonida_tui.py and wave_diff.py), so #7050/#7033/#7188/#7182's newline halves overlap with it.

It merges cleanly together with #7092 #6049 #7120 #6513 #7242 #6254 #7214 #6957 #7309 #4771 #7029 #7094 #7129 #6508 #7152 #7174 #7032 onto main; with all of them applied, the only standalone test still red on Windows is test_first_look_paths (claimed by Racurs156). Summary in #7333.

No GPU or game files needed. AI-assisted (Claude Code); I read the diff before running it.

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