Skip to content

tests: the pytest helper takes a text-only sample's lines as its listing, as run_gpu_tests.py does (TEST-TRANSLATE-TEXT-ONLY) - #1375

Merged
aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
milk4sale:test/translate-text-only-sample
Nov 26, 2026
Merged

aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
milk4sale:test/translate-text-only-sample

Conversation

@milk4sale

@milk4sale milk4sale commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-TRANSLATE-TEXT-ONLY (#14 (comment))

What and why

translator-tests is red on main since 6261ca916, the merge of #957 at 21:04 UTC on 24 November, so it fails on every pull request whose run starts on a main from then on. Two tests fail, both on the fixture #957 added:

  • tests/test_translate.py::test_gpu_samples_translate_and_validate[cs_dpp_cmp.asm]
  • tests/test_translate.py::test_wave64_emulate_uses_no_subgroup_ops[cs_dpp_cmp.asm]

Both stop at the llvm-mc assertion of conftest.Shader with error: dpp variant of this instruction is not supported, before they reach the translator.

llvm-mc has no gfx1013 encoding for a VOPC compare in DPP form. #957 dealt with that for the GPU suite: cs_dpp_cmp.asm carries the comment line ; run_gpu_tests: text only, llvm-mc has no gfx1013 encoding for an instruction here, and assemble_to_s in scripts/run_gpu_tests.py then writes the listing from the file's text. The pytest helper assembles every sample with llvm-mc and did not know that line.

conftest.Shader now does what the GPU runner does for a sample that carries the line: its instruction lines are the listing, in the same form. Both tests then translate and validate the fixture. A sample without the line is assembled as before, and fails as before when llvm-mc rejects it. The fixture, the translator and the GPU runner are unchanged.

This is independent of #1365, which fixes the other test that is red on main (tests/test_ci_registration.py, in the standard-library loop). The two touch different files.

Tested

Not run locally: Python 3.12 and llvm-mc 21 (the versions the job installs), and the tests that need numpy or Pillow.

GPUs tested: n/a (two Python test files; no shader, fixture or runtime code)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator change.)

🤖 Generated with Claude Code

…ing, as run_gpu_tests.py does (TEST-TRANSLATE-TEXT-ONLY)

translator-tests fails on main since 6261ca9 (the merge of ProjectLeonida#957), which added runtime/test/shaders/cs_dpp_cmp.asm:
tests/test_translate.py::test_gpu_samples_translate_and_validate[cs_dpp_cmp.asm] and
::test_wave64_emulate_uses_no_subgroup_ops[cs_dpp_cmp.asm] stop at the llvm-mc assertion of conftest.Shader with
"dpp variant of this instruction is not supported" (2 failed, 1879 passed on a runner with llvm-mc 21; the same two
with 23.1.4).

llvm-mc has no gfx1013 encoding for a VOPC compare in DPP form, so the fixture carries the line
"; run_gpu_tests: text only, ..." and assemble_to_s in scripts/run_gpu_tests.py writes its listing from the text.
conftest.Shader assembled every sample with llvm-mc and did not know the line. It now does the same as the GPU
runner for a sample that carries it, so both tests translate and validate the fixture instead of failing before
they reach the translator.

Two new tests: the line is spelled in conftest as in run_gpu_tests.py, and only a sample that carries it skips
llvm-mc (the same lines without it still go to llvm-mc and fail there). Controls: with the line spelled
differently in conftest the spelling test and both cs_dpp_cmp tests fail; with every sample taking the text path
the second new test fails.

The translator-tests step with the workflow's file list (37 files, pytest 9.2.0, llvm-mc 23.1.4, without numpy
and Pillow, so 134 skipped): 2 failed, 1618 passed on main 89d7dfc; 1622 passed here.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@quartz-heron-58

Copy link
Copy Markdown
Contributor

Author of #957 here. This break is mine: I ran the semantic tests, the decoder and disassembler tests and the GPU runner for that PR, but not tests/test_translate.py under pytest, which picks up every file in runtime/test/shaders and assembles it with llvm-mc. Thank you for finding and fixing it.

Run with the two versions you list as not run locally, Python 3.12.10 and llvm-mc 21.1.8 (native Windows build), pytest 9.2.0, SPIRV-Tools v2026.4, Windows 11:

  • main e8fee01, pytest tests/test_translate.py: 2 failed, 675 passed. The two are test_gpu_samples_translate_and_validate[cs_dpp_cmp.asm] and test_wave64_emulate_uses_no_subgroup_ops[cs_dpp_cmp.asm], both at the llvm-mc assertion in tests/conftest.py.
  • this head 8d29ffd, same command: 679 passed, 0 failed. That is the two repaired tests plus your two new ones.

Taking the listing from the marked sample's text is the same rule the GPU runner applies, so the fixture means the same thing in both places. Reading the mark's spelling out of scripts/run_gpu_tests.py covers the drift I would otherwise have worried about.

Not run here: the other 36 files of the Translator tests step, the controls with the altered spelling, and anything on a GitHub runner.

AI-assisted: yes (Claude Code)

@milk4sale

Copy link
Copy Markdown
Contributor Author

CI for this commit on my fork, since the queue here is hours behind (manual runs of the CI workflow, so each branch as it is; Python 3.12, llvm-mc 21, numpy and Pillow installed).

This branch, 8d29ffd26 on main 0f98d193c: https://github.com/milk4sale/leonida/actions/runs/45504536550

This branch merged with #1365's (a scratch branch, deleted after the run): https://github.com/milk4sale/leonida/actions/runs/45504603770

  • translator-tests, stdlib-tests-linux, semantic-tests (ubuntu-latest) and viewer-tests: all success. So with the two pull requests every Linux job of the workflow is green.
  • macos-python ran every standalone file and the semantic suite (6191 tests) with no failure, and was cancelled at its 20-minute limit before the pytest step.
  • check was cancelled at its 15-minute limit, as in every run on the fork today. It had started 379 of 491 files; the two that failed are tests/test_bink_names.py and tests/test_opus_tags.py, which tools: print the plain path, not a repr'd one, in OSError messages #128 is about.

AI-assisted.

@DeadlyChirp

Copy link
Copy Markdown

Tested on Windows 11, Python 3.12.10, LLVM 23.1.6 llvm-mc (conda-forge), SPIRV-Tools from the Vulkan SDK. I merged 8d29ffd onto upstream main (merge commit edb928dff).

  • python -m pytest -q tests/test_translate.py with this PR: 710 passed.

  • Same command on main: 2 failed, 706 passed. Both failures come from the text-only sample runtime/test/shaders/cs_dpp_cmp.asm (added in d046559):

    • test_gpu_samples_translate_and_validate[cs_dpp_cmp.asm]
    • test_wave64_emulate_uses_no_subgroup_ops[cs_dpp_cmp.asm]

    The error is <stdin>:15:1: error: dpp variant of this instruction is not supported (v_cmp_gt_f32_dpp vcc_lo, v1, v1 dpp8:[...], -mcpu=gfx1013).

So this PR fixes them on Windows as well. They only show up when llvm-mc is available, which may be why CI hasn't flagged them.

(AI-assisted test run; output checked by hand.)

@wavehs

wavehs commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Verified independently on main bd6ba97ab (macOS 27.2.1 arm64, Homebrew llvm-mc 23.1.5, SPIRV-Tools, Python 3.15.2 in a venv with the pinned requirements). The PR diff applies cleanly and is the only change applied.

Before (unmodified main, the workflow's own pytest file list: 37 files):

FAILED tests/test_translate.py::test_gpu_samples_translate_and_validate[cs_dpp_cmp.asm]
FAILED tests/test_translate.py::test_wave64_emulate_uses_no_subgroup_ops[cs_dpp_cmp.asm]
2 failed, 1919 passed, 20 skipped, 129 subtests passed

Both stop in tests/conftest.py:183 at llvm-mc with error: dpp variant of this instruction is not supported, before the translator runs — exactly the diagnosis in the description.

After: 1923 passed, 20 skipped, 129 subtests passed (the two fixed tests plus the two new ones).

The spelling test is a good guard: it would have caught the two copies of the marker diverging, which is the only way the unmarked path could come back silently. This also matters beyond the Linux translator-tests job: the macos-python job installs Homebrew llvm (23.x now), so cs_dpp_cmp fails there too; with this change the local run is green on 23.1.5.

AI-assisted (verification run only).

@aslan2142

Copy link
Copy Markdown
Collaborator

Merging.

  • Why: test_translate.py now takes a text-only sample as text, as run_gpu_tests.py does, so cs_dpp_cmp no longer fails at llvm-mc. Only a sample that carries the exact text-only line skips llvm-mc, and a new test checks that an unmarked sample llvm-mc rejects still fails.
  • Tested on main e57bc63bc + this PR (8d29ffd26):
    • pytest tests/test_translate.py: 2 failed and 714 passed on main, 718 passed here. The two cs_dpp_cmp cases went from fail to pass, and nothing went from pass to fail.
    • test_ci_registration.py, compileall and check_no_game_data.py pass.
  • It is the dependency of rdna2spirv: translate v_cmpx in DPP form (SHADER-VOPCX-DPP) #1647, which follows.

Thanks @milk4sale, and @quartz-heron-58, @DeadlyChirp and @wavehs for the runs.

AI-assisted (Claude Code, Claude Opus 5.5 and Claude Fable 5.2)

@aslan2142
aslan2142 merged commit c8215be into ProjectLeonida:main Nov 26, 2026
5 of 8 checks passed
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.

5 participants