Skip to content

tests: the f64 output-modifier checks assert the stores the translator emits (#4473) - #8292

Open
evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/2-f64mod-tests
Open

evilclanker9000 wants to merge 2 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/2-f64mod-tests

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

Item: EGEN-F64MOD-TESTS-STALE (claimed in #8186)

Two translator data-flow checks are red on main because #4473 replaced the per-store
OpSelect %uint %active <word> <old> with a guarded active run (and with no mask at all when nothing in the
program writes EXEC). Neither file runs in CI (.github/workflows/ci.yml runs unittest discover -s tests/semantic), so the breakage went unnoticed.

  • tests/test_f64_conversion.py: the listing writes no EXEC, so every lane is active and v_cvt_f32_f64
    stores the converted word unconditionally. Assert that store.
  • tests/test_f64_output_modifiers.py: the same for the two words of v_add_f64 v[4:5], ....

The values these tests guard are unchanged: the modifier chain (OpFConvert/OpFAdd -> OpFMul ->
FClamp -> OpBitcast -> store) still has to produce the fixture's words, and the SPIR-V interpreter
(tests/spirv_interp.py) returns 0x3ff4000000000000 for the plain v_add_f64 case and the matching word
for each of mul:2, mul:4, div:2, clamp, clamp div:2 and mul:4 clamp.

Tested on upstream/main dde82f2 (before) and on this branch (after), Windows, Python 3.12:

$ python -I tests/test_f64_conversion.py
FFFFFF
FAILED (failures=6)

$ python -I tests/test_f64_output_modifiers.py
FFFFFFF.
FAILED (failures=7)

# with this branch
$ python -I tests/test_f64_conversion.py
Ran 1 test in 0.045s
OK

$ python -I tests/test_f64_output_modifiers.py
Ran 2 tests in 0.068s
OK

Also ran python -I scripts/check_no_game_data.py tests/test_f64_conversion.py tests/test_f64_output_modifiers.py (exit 0) and python -m compileall -q on both files (exit 0).

Notes:

  • I did not change the translator: the emitted SPIR-V is correct for both listings; only the instruction
    shape the two tests regexed for is older than rdna2spirv: cache per-block %active loads and fast-path no-EXEC dst() writes #4473.
  • The masked form is moved, not lost: prefixing the same listing with s_mov_b32 exec_lo, s0 puts the
    writes in an OpSelectionMerge/OpBranchConditional run guarded by %active, with the same
    OpStore %reg_v3 <word> inside it, so a program that writes EXEC still gets its masked write.
  • The v_add_f64 values are already checked in CI by tests/semantic/test_valu_add_f64.py; this PR only
    restores the instruction-level checks that were red.

GPU and driver: none needed.
AI-assisted.

…tor emits it

ItsNotRexed#4473 replaced the per-store OpSelect %active <word> <old> with an active run (or no mask at all when nothing writes EXEC), so this file has been red on main: python -I tests/test_f64_conversion.py is FAILED (failures=6) at dde82f2. The listing writes no EXEC, so the converted word is stored unconditionally; assert that store instead.
…tor emits

Same stale shape as the conversion check: with nothing in the listing writing EXEC both words of v[4:5] are stored as computed, so the masked OpSelect the test looked for is gone and the file is red on main (FAILED (failures=7) at dde82f2). The seven modifier cases still have to produce the words the fixture comment lists; the interpreter gives 0x3ff4000000000000 for the plain case and the matching mul:2/mul:4/div:2/clamp words.
@molodayamama

Copy link
Copy Markdown

Verified commit 8ad55227fed5315184dc432864ec01a4b8a0645a. Windows CPU-only verification: both f64 output-modifier tests and the f64 conversion test passed. The checks cover the appropriate result stores from the translator and the fixture expectation. The hardware fixture was not run on this machine.

AI-assisted verification.

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

AI-assisted.

Independently verified 8ad55227 on Windows 11 (Python 3.14.8, CPU-only, no game data):

  • Clean merge check against upstream/main (dde82f27): git merge-tree --write-tree exit 0, git diff --check exit 0, python -I -m compileall -q tests/test_f64_conversion.py tests/test_f64_output_modifiers.py exit 0.
  • Confirmed both suites currently fail on upstream/main (dde82f27) due to the exec_static_true direct-store path from #4473 (tests/test_f64_conversion.py: 6 failures; tests/test_f64_output_modifiers.py: 7 failures).
  • On HEAD 8ad55227: python -I tests/test_f64_conversion.py 1/1 OK, python -I tests/test_f64_output_modifiers.py 2/2 OK.
  • Diff review: assertions now verify OpStore {dest} {word} directly while keeping all conversion/modifier/NoContraction checks intact.

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

The store assertion itself is correct: neither listing writes EXEC, so exec_static_true is set and dst() direct-stores OpStore {dest} {word} (tools/rdna2spirv.py:16480, :1559-1560, :439-446); the conversion uses %reg_v3, the f64 add %reg_v4/%reg_v5, and the modifier chain is unchanged. Three issues remain:

  1. Duplicate of open PRs. #6474 changes the same two files with the same OpStore {dest} {word} assertions, is open/mergeable, has independent Windows/Linux runs and a negative control that turns off exec_static_true. #7528 is broader (adds tests/f64_store_shape.py and runs every case with a data-dependent EXEC write). #7209 also fixes both files with a helper accepting either write shape; #6994/#7365 were closed for the same fix. This PR adds no unique behavior over #6474 and no EXEC-path coverage over #7528; coordinate rather than adding a fifth independent fix.

  2. Only the no-EXEC branch is tested. All cases use listings that write no EXEC. The body's s_mov_b32 exec_lo, s0 prefix — which puts the writes under OpSelectionMerge/OpBranchConditional — is not in any test. A regression that direct-stores when EXEC is written, or drops the active-run guard, would still pass. #7528’s PREFIXES covers exactly that.

  3. The CI premise is wrong. ci.yml’s check, stdlib-tests-linux and macos-python jobs run every tests/test_*.py with if __name__ == "__main__"; both files have one (tests/test_f64_conversion.py:57, tests/test_f64_output_modifiers.py:96) and no pytest marker, so they do run in all three. The semantic job is only one of several. Correct the stated reason.

The no-EXEC assertion is non-vacuous and the expected registers are right. Synthetic only; no game files. AI-assisted (OpenCode).

@slint6614-dev

Copy link
Copy Markdown
Contributor

Checked at 8ad55227f (Linux, Python 3): tests/test_f64_conversion.py 1 test OK, tests/test_f64_output_modifiers.py 2 tests OK. With main's (67d8773) versions of these tests, test_f64_conversion fails 6 times, so this PR does turn that file green on main. The PR changes only tests, so there's no separate negative control for the translator side.

@cryptocxeq cryptocxeq left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Independent CPU test review of 8ad55227fed5315184dc432864ec01a4b8a0645a, patch applied to main snapshot 32a50c949e882ae539f2d54be93fadd50ce76cae.

The fixtures do not write EXEC, so the translator's statically-active path stores the computed word directly. The revised assertions still trace FClamp/scale and bitcasts to the exact value stored into the target VGPR; they remove the obsolete masked-select expectation rather than removing the store/value check. The f64 NoContraction checks remain.

Windows / CPython 3.11.15: test_f64_conversion.py runs 1 test and test_f64_output_modifiers.py runs 2, all pass. Before the patch the same files fail with 6 and 7 subcase failures respectively, looking for the obsolete load/select pattern. These are emitted-SPIR-V shape checks; a readback fault does not exercise them and no numerical/GPU verification is claimed. No blocking issue found in the updated assertions.

No game files or external shader tools. Claim: #8504 (comment)
AI-assisted (OpenAI Codex).

@garuspl

garuspl commented Nov 23, 2026

Copy link
Copy Markdown

Tested 8ad5522 on Windows 11 (CPU only, no GPU needed): pass

Windows 11 Pro, Python 3.14.7, no GPU or game files involved; pytest/numpy/Pillow pinned from tests/requirements.txt in a fresh venv. Method: PR head merged onto main d9aa42a, the PR's test files run with python -m pytest before and after the merge, plus python -m compileall -q on the changed files (clean).

  • tests/test_f64_conversion.py: main 6 failed, 1 passed; with the PR 1 passed, 6 subtests passed.
  • tests/test_f64_output_modifiers.py: main 7 failed, 2 passed; with the PR 2 passed, 7 subtests passed.

AI-assisted (Claude Code, Claude Opus 5.5).

@KoertLichtendonk

Copy link
Copy Markdown
Contributor

Coordinator note: this looks like the same change as #6474 by @BBareth (opened 14:23 UTC, still open). Please compare the two and either close this one or say here what it adds. The maintainer decides which one is merged.

@Atomic258

Copy link
Copy Markdown
Contributor

Tested 8ad55227 on Windows Server 2022, CPython 3.13.12: pass

  • python -I tests/test_f64_conversion.py -> OK
  • python -I tests/test_f64_output_modifiers.py -> OK

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

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.

9 participants