[PR #676] [MERGED] tests/semantic: skip spirv-as/spirv-val checks when SPIRV-Tools absent (TEST-SOPC-UNARY-SPIRV-TOOLS) #716

Closed
opened 2026-11-26 20:18:49 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/676
Author: @kirigayakazima
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @aslan2142

Base: main ← Head: fix/semantic-optional-spirv-tools


📝 Commits (1)

  • efeb1db tests/semantic: skip spirv-as/spirv-val checks when SPIRV-Tools absent (TEST-SOPC-UNARY-SPIRV-TOOLS)

📊 Changes

2 files changed (+204 additions, -140 deletions)

View changed files

📝 tests/semantic/test_sopc_validation.py (+87 -64)
📝 tests/semantic/test_unary_f16_validation.py (+117 -76)

📄 Description

Claimed in the coordination issue as: TEST-SOPC-UNARY-SPIRV-TOOLS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130256213)

What and why

Replaces the SPIRV-Tools half of conflicting draft #136, following @ItsMrDubey's design suggestion in #136 (comment 7121549964) so translation and spirv_mini_interp coverage always run everywhere instead of silently returning early or failing on tool-less hosts (e.g., Windows semantic-tests leg or local dev PCs):

  • tests/semantic/test_sopc_validation.py:
    • Split _translate_and_validate_cs into _translate_cs and _validate_spirv and extract _positive_control_program().
    • test_all_18_ops_and_valid_scalar_operands_interp runs translation + spirv_mini_interp across all 18 SOPC instructions unconditionally.
    • test_all_18_ops_and_valid_scalar_operands_spirv_val checks spirv-as / spirv-val on PATH: skips cleanly when absent and LEONIDA_REQUIRE_SPIRV_TOOLS != "1", and fails loudly via self.fail(...) when LEONIDA_REQUIRE_SPIRV_TOOLS == "1".
  • tests/semantic/test_unary_f16_validation.py:
    • Separate run_ps translation/interpreter execution from validate_spirv and factor out shared shader builders (_combo_opsel_shaders, _nontrivial_opsel_shader, _inplace_sdwa_shader, _positive_control_lines).
    • Add dedicated test_sin_cos_opsel_spirv_val and test_positive_controls_all_12_ops_spirv_val methods using _require_or_skip_spirv_tools (skip when missing and LEONIDA_REQUIRE_SPIRV_TOOLS != "1", fail loudly when LEONIDA_REQUIRE_SPIRV_TOOLS == "1").
    • Keep all negative validation, positive translation, and spirv_mini_interp checks running unconditionally on every host.

Note: on unmodified main (21625bca) without SPIRV-Tools, both files still failed (1/11 in test_sopc_validation.py; 15 subtests in test_unary_f16_validation.py — also hit in #652's Windows run).

Tested

On Windows 11 x64 (Python 3.14.7, spirv-as/spirv-val not on PATH) at efeb1db11bcd632c01246d783f2987114e6e4811, synthetic fixtures only (no game data):

  • Unset & LEONIDA_REQUIRE_SPIRV_TOOLS=0:
    • python -I tests/semantic/test_sopc_validation.py -v — 12 ran, OK (skipped=1) (test_all_18_ops_and_valid_scalar_operands_interp passed)
    • python -I tests/semantic/test_unary_f16_validation.py -v — 7 ran, OK (skipped=2) (all interpreter/negative/positive-translation checks passed)
    • python -I -m unittest discover -s tests/semantic -p ... — both OK
  • LEONIDA_REQUIRE_SPIRV_TOOLS=1 (verifies strict CI failure):
    • test_sopc_validation.py — FAILED (1/12, AssertionError: spirv-as and spirv-val must be on PATH)
    • test_unary_f16_validation.py — FAILED (2/7, AssertionError: spirv-as / spirv-val not found on PATH)
  • python -I tests/test_ci_registration.py — 15 ran, OK
  • python -I tests/test_text_write_line_endings.py — 3 ran, OK
  • python -I scripts/check_no_game_data.py ... & python -m compileall -q ... — exit 0

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main (21625bca) 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. (n/a — semantic tests only)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/676 **Author:** [@kirigayakazima](https://github.com/kirigayakazima) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `fix/semantic-optional-spirv-tools` --- ### 📝 Commits (1) - [`efeb1db`](https://github.com/ubiquitarianism/leonida/commit/efeb1db11bcd632c01246d783f2987114e6e4811) tests/semantic: skip spirv-as/spirv-val checks when SPIRV-Tools absent (TEST-SOPC-UNARY-SPIRV-TOOLS) ### 📊 Changes **2 files changed** (+204 additions, -140 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_sopc_validation.py` (+87 -64) 📝 `tests/semantic/test_unary_f16_validation.py` (+117 -76) </details> ### 📄 Description Claimed in the coordination issue as: TEST-SOPC-UNARY-SPIRV-TOOLS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7130256213) ### What and why Replaces the SPIRV-Tools half of conflicting draft #136, following @ItsMrDubey's design suggestion in [#136 (comment 7121549964)](https://github.com/ubiquitarianism/leonida/pull/136#issuecomment-7121549964) so translation and `spirv_mini_interp` coverage always run everywhere instead of silently returning early or failing on tool-less hosts (e.g., Windows `semantic-tests` leg or local dev PCs): - `tests/semantic/test_sopc_validation.py`: - Split `_translate_and_validate_cs` into `_translate_cs` and `_validate_spirv` and extract `_positive_control_program()`. - `test_all_18_ops_and_valid_scalar_operands_interp` runs translation + `spirv_mini_interp` across all 18 SOPC instructions unconditionally. - `test_all_18_ops_and_valid_scalar_operands_spirv_val` checks `spirv-as` / `spirv-val` on `PATH`: skips cleanly when absent and `LEONIDA_REQUIRE_SPIRV_TOOLS != "1"`, and fails loudly via `self.fail(...)` when `LEONIDA_REQUIRE_SPIRV_TOOLS == "1"`. - `tests/semantic/test_unary_f16_validation.py`: - Separate `run_ps` translation/interpreter execution from `validate_spirv` and factor out shared shader builders (`_combo_opsel_shaders`, `_nontrivial_opsel_shader`, `_inplace_sdwa_shader`, `_positive_control_lines`). - Add dedicated `test_sin_cos_opsel_spirv_val` and `test_positive_controls_all_12_ops_spirv_val` methods using `_require_or_skip_spirv_tools` (skip when missing and `LEONIDA_REQUIRE_SPIRV_TOOLS != "1"`, fail loudly when `LEONIDA_REQUIRE_SPIRV_TOOLS == "1"`). - Keep all negative validation, positive translation, and `spirv_mini_interp` checks running unconditionally on every host. Note: on unmodified `main` (`21625bca`) without SPIRV-Tools, both files still failed (1/11 in `test_sopc_validation.py`; 15 subtests in `test_unary_f16_validation.py` — also hit in #652's Windows run). ### Tested On Windows 11 x64 (`Python 3.14.7`, `spirv-as`/`spirv-val` not on `PATH`) at `efeb1db11bcd632c01246d783f2987114e6e4811`, synthetic fixtures only (no game data): - Unset & `LEONIDA_REQUIRE_SPIRV_TOOLS=0`: - `python -I tests/semantic/test_sopc_validation.py -v` — **12 ran, OK (skipped=1)** (`test_all_18_ops_and_valid_scalar_operands_interp` passed) - `python -I tests/semantic/test_unary_f16_validation.py -v` — **7 ran, OK (skipped=2)** (all interpreter/negative/positive-translation checks passed) - `python -I -m unittest discover -s tests/semantic -p ...` — both OK - `LEONIDA_REQUIRE_SPIRV_TOOLS=1` (verifies strict CI failure): - `test_sopc_validation.py` — FAILED (1/12, `AssertionError: spirv-as and spirv-val must be on PATH`) - `test_unary_f16_validation.py` — FAILED (2/7, `AssertionError: spirv-as / spirv-val not found on PATH`) - `python -I tests/test_ci_registration.py` — **15 ran, OK** - `python -I tests/test_text_write_line_endings.py` — **3 ran, OK** - `python -I scripts/check_no_game_data.py ...` & `python -m compileall -q ...` — exit 0 GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` (`21625bca`) 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a — semantic tests only) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:49 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#716
No description provided.