Skip to content

run_gpu_tests, rdna2spirv: support --assembler python, --no-validate, and --disasm-dir - #6676

Merged
shayderrr merged 1 commit into
ItsNotRexed:mainfrom
sanchaton:feat/run-gpu-tests-python-assembler
Nov 23, 2026
Merged

shayderrr merged 1 commit into
ItsNotRexed:mainfrom
sanchaton:feat/run-gpu-tests-python-assembler

Conversation

@sanchaton

Copy link
Copy Markdown

Item ID: TEST-GPU-PYTHON-ASSEMBLER (claimed in #6414)

Summary

  • ** ools/rdna2spirv.py**: adds --no-validate (and �alidate=True parameter on �ssemble_spirv) so callers running with --assembler python without SPIRV-Tools installed can assemble .spv modules directly via ools/spirv_asm.py without invoking spirv-val.
  • scripts/run_gpu_tests.py:
    • Adds --assembler {auto,spirv-as,python} (default �uto: uses spirv-as if on PATH, else falls back to ools/spirv_asm.py) and passes it to both
      dna2spirv.py and the helper shaders (�s_tri, s_passthru, s_loc1).
    • Adds --no-validate (auto-enabled with a note when --assembler resolves to python and spirv-val is absent on PATH).
    • Adds --disasm-dir to run the pre-disassembled .s fixtures (e.g. ests/semantic/fixtures/disasm) without requiring llvm-mc, filtering to fixtures whose draw partners are also present.
  • docs/testing.md: documents running the pre-disassembled GPU subset with a CI
    untime-windows artifact when neither llvm-mc nor SPIRV-Tools is installed.
  • ** ests/test_run_gpu_tests_python_assembler.py**: unit tests for
    esolve_assembler, spirv_as(..., assembler=python), �ssemble_spirv(..., validate=False),
    dna2spirv.py --assembler python --no-validate, and --disasm-dir error handling.

AI-assisted. Synthetic shaders only, no game files.

Tested

Hardware / Environment: Windows 11, Python 3.14, NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell, driver 617.14), CI
untime-windows artifact from run 45044832456 (no local LLVM or Vulkan SDK / SPIRV-Tools).

  • Real GPU suite (wave32 native):
    python -I scripts/run_gpu_tests.py --build --disasm-dir tests/semantic/fixtures/disasm --assembler python
    • 93 shaders: 93 translated, 93 assembled (spirv-val skipped)
    • 78/93 passed, 15 skipped, 0 failed (cs_w64* skipped on 32-wide compute subgroup).
  • Real GPU suite (LEONIDA_W64_EMULATE=1):
    LEONIDA_W64_EMULATE=1 python -I scripts/run_gpu_tests.py --build --disasm-dir tests/semantic/fixtures/disasm --assembler python
    • 93 shaders: 93 translated, 93 assembled (spirv-val skipped)
    • 93/93 passed, 0 failed (all 45 compute and 48 pixel fixtures passed exact/match).
  • Unit & syntax checks:
    • python -I tests/test_run_gpu_tests_python_assembler.py -v: 5/5 passed
    • Existing est_gpu_.py and est_run_gpu.py suites (10 files): all passed ( est_gpu_blocked_program 7, est_gpu_build_dir 18, est_gpu_test_timeout 8, est_gpu_unsupported_stage 6, est_run_gpu_mandelbrot 2, est_run_gpu_pixel_checks 11, est_run_gpu_readback_size 1, est_run_gpu_tests 49, est_run_gpu_tests_paths 21, est_run_gpu_wavemask 6)
    • python -m compileall -q make_game.py tools tests scripts: exited 0
    • python -I scripts/check_no_game_data.py: exited 0

@Mortify7612

Copy link
Copy Markdown

Tested 16c8af9a merged onto main 1cc6e3c1 (clean) on AMD Radeon RX 9060 XT (RDNA4, GFX1200), RADV Mesa 25.0.7, Debian 12 Linux, with SPIRV-Tools present, so both assemblers could be compared: pass.

run_gpu_tests.py --disasm-dir tests/semantic/fixtures/disasm, same test binaries:

  • --assembler python: 93 translated, 93 valid (spirv-val), 93/93 passed.
  • --assembler spirv-as: 93 translated, 93 valid, 93/93 passed.
  • Output parity over all 96 modules (fixtures plus helper shaders): spirv-dis --raw-id --no-header text identical for 96/96. The binaries differ only in header word 2, the generator: 0 from tools/spirv_asm.py, 0x00070000 (Khronos SPIR-V Tools Assembler) from spirv-as. The ID bound and size are the same. If byte-identical output across the two paths would help (caches, hashes in receipts), the Python assembler could write a generator value too.
  • tests/test_run_gpu_tests_python_assembler.py: 5 passed.

AI-assisted (Claude Code).

@lukacpp

lukacpp commented Nov 23, 2026

Copy link
Copy Markdown

The new assembler selection reaches the main translation and the three inline helper shaders. Two companion builders still bypass it:

  • In mesh-compute mode, the runner calls mesh_compute_vs.build_for_index(spirv_dir). That function resolves both external tools before checking whether the index contains a mesh entry. As written, even a compute-only filter needs spirv-as when LEONIDA_MESH_COMPUTE=1. Runner call · Tool lookup
  • In barycentric fallback mode, the geometry helper directly invokes spirv-as and spirv-val after the runner has selected the Python assembler and --no-validate. This leaves the SDK-free path dependent on both executables whenever a pixel shader needs that helper. Runner call · External commands

Could both builders accept the runner's resolved assembler and validation settings, while preserving their standalone defaults? A regression test could make any external SPIRV-Tools invocation fail and exercise an empty mesh-helper list and a pixel shader that needs the geometry helper.

AI-assisted code review of 16c8af9a.

@memorypressure

Copy link
Copy Markdown

Verified on Linux (CPU-only): merges with current main 1cc6e3c; tests/test_run_gpu_tests_python_assembler.py passes 5/5 under python -I and pytest, and fails 5/5 when copied onto clean main, so the tests genuinely cover the new flags. Both CLIs expose --assembler/--no-validate/--disasm-dir under -I. Heads-up: tools/rdna2spirv.py overlaps #2956/#3544 and docs/testing.md overlaps #4212 — whoever lands second rebakes. Also: the branch reports no CI checks. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@gut0to

gut0to commented Nov 23, 2026

Copy link
Copy Markdown

Independent Windows validation of 16c8af9: pass for the Python-assembler / pre-disassembly path.

Environment: Windows 11, MSVC 19.44.35228, Intel Iris Xe Graphics (Vulkan subgroup 8..32); synthetic fixtures only. No llvm-mc, spirv-as, or spirv-val were installed.

  • Configured and built vk_compute_test, vk_store_test, and vk_harness with the pinned Vulkan headers.
  • python -I tests/test_run_gpu_tests_python_assembler.py: 5/5 passed.
  • python -I tests/test_run_gpu_tests_paths.py: 21/21 passed.
  • python -I tests/test_spirv_asm.py: 15 passed, 1 expected skip.
  • LEONIDA_W64_EMULATE=1 python -I scripts/run_gpu_tests.py --build runtime/build-gpu --disasm-dir tests/semantic/fixtures/disasm --assembler python --filter cs_: 45 shaders translated, 45 assembled with the in-repo Python assembler, 45/45 GPU checks passed. The runner correctly noted and skipped external SPIR-V validation.

This covers the synthetic compute subset; I did not claim graphics-fixture coverage. git diff --check is clean.

AI-assisted.

@jordi-vancuijlenborg-vinci

Copy link
Copy Markdown

Tested 16c8af9a on Windows 11 build 26200 with an NVIDIA GeForce RTX 3080 (driver 621.01, Vulkan 1.4.357, subgroup size 32).

I ran the checked-in disassembly fixtures with LEONIDA_W64_EMULATE=1, once with --assembler python and once with --assembler spirv-as (SPIRV-Tools 2026.4). Each run translated 93/93 fixtures, passed spirv-val on all 93, and passed 93/93 GPU checks. All 48 raw pixel readbacks were byte-identical. The 96 generated module pairs, including three helper shaders, differed only in the SPIR-V header’s generator word. All five focused CLI tests passed. Synthetic fixtures only. AI-assisted.

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

scripts/run_gpu_tests.py gains --assembler {auto,spirv-as,python} (auto uses spirv-as if on PATH, else the pure-Python tools/spirv_asm.py), --no-validate, and --disasm-dir to reuse pre-disassembled fixtures instead of llvm-mc; matching --assembler/--no-validate flags and assemble_spirv() changes land in tools/rdna2spirv.py. Docs and a new test file cover resolution, helper-shader assembly, CLI plumbing and skipped spirv-val.

Why merge

Lets GPU tests run on machines with neither SPIRV-Tools nor llvm-mc, using the same fixture listings as the semantic suite.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary

scripts/run_gpu_tests.py gains --assembler {auto,spirv-as,python} (auto uses spirv-as if on PATH, else the pure-Python tools/spirv_asm.py), --no-validate, and --disasm-dir to reuse pre-disassembled fixtures instead of llvm-mc; matching --assembler/--no-validate flags and assemble_spirv() changes land in tools/rdna2spirv.py. Docs and a new test file cover resolution, helper-shader assembly, CLI plumbing and skipped spirv-val.

Why merge

Lets GPU tests run on machines with neither SPIRV-Tools nor llvm-mc, using the same fixture listings as the semantic suite.

Verdict: Approve

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.

7 participants