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

Manually merged
github merged 1 commit from github-bot/gh-1375 into main 2026-11-26 18:57:28 +00:00 AGit
Owner

@⁠milk4sale on GitHub · 2026-11-24 22:49 UTC · original
milk4sale:test/translate-text-only-sample → main · +33 −4 · 2 files · 1 commits · merged 2026-11-26 18:53 UTC

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

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

  • The two failing tests pass, and two new ones:
    • test_text_only_mark_is_spelled_as_in_the_gpu_runner reads the line out of scripts/run_gpu_tests.py, so the two copies cannot drift apart unnoticed;
    • test_only_a_marked_sample_skips_llvm_mc gives Shader lines llvm-mc rejects, once with the line (the listing is the text, comment lines dropped) and once without (the llvm-mc assertion still fires).
  • Controls, each in a scratch copy: with the line spelled differently in conftest.py, 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 own file list (37 files): on main 89d7dfcf5, 2 failed, 1618 passed; on this branch, 1622 passed. Run with pytest 9.2.0 on Python 3.14.10, llvm-mc 23.1.4 and SPIRV-Tools v2026.4, in an environment without numpy and Pillow, so 134 tests that need them were skipped in both runs.
  • The same two failures on a GitHub runner with llvm-mc 21 and the pinned requirements, in my fork's CI runs of main 4a50cafc7 and of #1365's branch (main 89d7dfcf5 plus its one commit, which touches neither file): 2 failed, 1879 passed, 14 skipped.
  • Every standalone test file under tests/ with python -I (491 files): 490 pass. The one failure is tests/test_ci_registration.py, red on main since #930 and fixed by #1365, not by this.
  • python -I scripts/check_no_game_data.py tests/conftest.py tests/test_translate.py, python -m compileall and git diff --check.

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

**@⁠milk4sale** on GitHub · 2026-11-24 22:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1375) `milk4sale:test/translate-text-only-sample` → `main` · +33 −4 · 2 files · 1 commits · merged 2026-11-26 18:53 UTC Claimed in the coordination issue as: TEST-TRANSLATE-TEXT-ONLY (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### 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 - The two failing tests pass, and two new ones: - `test_text_only_mark_is_spelled_as_in_the_gpu_runner` reads the line out of `scripts/run_gpu_tests.py`, so the two copies cannot drift apart unnoticed; - `test_only_a_marked_sample_skips_llvm_mc` gives `Shader` lines llvm-mc rejects, once with the line (the listing is the text, comment lines dropped) and once without (the llvm-mc assertion still fires). - Controls, each in a scratch copy: with the line spelled differently in `conftest.py`, 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 own file list (37 files): on `main` `89d7dfcf5`, 2 failed, 1618 passed; on this branch, 1622 passed. Run with pytest 9.2.0 on Python 3.14.10, llvm-mc 23.1.4 and SPIRV-Tools v2026.4, in an environment without numpy and Pillow, so 134 tests that need them were skipped in both runs. - The same two failures on a GitHub runner with llvm-mc 21 and the pinned requirements, in my fork's CI runs of `main` `4a50cafc7` and of #1365's branch (`main` `89d7dfcf5` plus its one commit, which touches neither file): 2 failed, 1879 passed, 14 skipped. - Every standalone test file under `tests/` with `python -I` (491 files): 490 pass. The one failure is `tests/test_ci_registration.py`, red on `main` since #930 and fixed by #1365, not by this. - `python -I scripts/check_no_game_data.py tests/conftest.py tests/test_translate.py`, `python -m compileall` and `git diff --check`. 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 - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] 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](https://claude.com/claude-code)
translator-tests fails on main since 6261ca916 (the merge of #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 89d7dfcf5; 1622 passed here.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:49:18 +00:00
Author
Owner

@⁠quartz-heron-58 on GitHub · 2026-11-24 22:53 UTC · original

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 e8fee01c, 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 8d29ffd2, 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)

**@⁠quartz-heron-58** on GitHub · 2026-11-24 22:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1375#issuecomment-7146755903) 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 e8fee01c, `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 8d29ffd2, 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)
Author
Owner

@⁠milk4sale on GitHub · 2026-11-24 23:11 UTC · original

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

  • translator-tests: success, 1883 passed and 14 skipped. On main the same job gives 2 failed and 1879 passed. That covers what I had not run locally.
  • semantic-tests (ubuntu-latest) and viewer-tests: success.
  • stdlib-tests-linux and macos-python: failure, and the one failing file in each is tests/test_ci_registration.py, red on main since #930. #1365 fixes it.

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 #128 is about.

AI-assisted.

**@⁠milk4sale** on GitHub · 2026-11-24 23:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1375#issuecomment-7147121420) 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 - `translator-tests`: **success**, 1883 passed and 14 skipped. On `main` the same job gives 2 failed and 1879 passed. That covers what I had not run locally. - `semantic-tests (ubuntu-latest)` and `viewer-tests`: success. - `stdlib-tests-linux` and `macos-python`: failure, and the one failing file in each is `tests/test_ci_registration.py`, red on `main` since #930. #1365 fixes it. 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 #128 is about. AI-assisted.
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-25 15:15 UTC · original

Tested on Windows 11, Python 3.12.10, LLVM 23.1.6 llvm-mc (conda-forge), SPIRV-Tools from the Vulkan SDK. I merged 8d29ffd26 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 d04655943):

    • 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.)

**@⁠DeadlyChirp** on GitHub · 2026-11-25 15:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1375#issuecomment-7166544642) Tested on Windows 11, Python 3.12.10, LLVM 23.1.6 `llvm-mc` (conda-forge), SPIRV-Tools from the Vulkan SDK. I merged 8d29ffd26 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 d04655943): - `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.)
Author
Owner

@⁠wavehs on GitHub · 2026-11-26 18:11 UTC · original

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

**@⁠wavehs** on GitHub · 2026-11-26 18:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1375#issuecomment-7200169669) 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).
github manually merged commit c8215be43f into main 2026-11-26 18:57:28 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 18:53 UTC · original

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 #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** on GitHub · 2026-11-26 18:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1375#issuecomment-7200970010) 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 #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)
This discussion has been locked. Commenting is limited to contributors.
No description provided.