Skip to content

build.py: a text-only fixture's lines are its listing, as in run_gpu_tests.py (TEST-BUILD-TEXT-ONLY) - #1444

Open
hugo0024 wants to merge 1 commit into
ProjectLeonida:mainfrom
hugo0024:build-text-only
Open

hugo0024 wants to merge 1 commit into
ProjectLeonida:mainfrom
hugo0024:build-text-only

Conversation

@hugo0024

@hugo0024 hugo0024 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-BUILD-TEXT-ONLY (claim)

Depends on: #822

It does not build on #822; the two conflict. Both add a block right after barycentric_fallback() in runtime/test/shaders/build.py, so whichever merges second needs a rebase that keeps both blocks (Tauwni tested that resolution in a comment on #822).

What and why

Since #957, runtime/test/shaders/build.py with no names builds nothing:

cs_dpp_cmp.asm did not assemble:
<stdin>:15:1: error: dpp variant of this instruction is not supported
v_cmp_gt_f32_dpp vcc_lo, v1, v1 quad_perm:[1,0,3,2] row_mask:0xf bank_mask:0xf bound_ctrl:1

cs_dpp_cmp.asm holds a VOPC compare in DPP form, which llvm-mc has no gfx1013 encoding for. The file says so in a comment line of its own, and scripts/run_gpu_tests.py passes such a source's instruction lines to the translator as they are. build.py still sent it to llvm-mc and stopped before publishing anything, so the two-step form is broken for the whole list: check.py reports 0 of 226 (it has an expected entry for cs_dpp_cmp), and w64_graphics.py finds no module.

  • build.py: a source that carries the marker line is not assembled; text_only_listing() writes the listing assemble_to_s of run_gpu_tests.py writes. Everything else in translate_tests (the compute header, the containers) is as before.
  • tests/test_shader_build_text_only.py: the marker is the same line in both runners, the two write the same listing for every marked fixture, a marked source never reaches llvm-mc, and an unmarked one still does and still stops the build on an assembler error.

run_gpu_tests.py is not touched: it keeps its own TEXT_ONLY_MARK line, which #1375 (the pytest helper, open) also checks for. No file overlaps with #1375.

Tested

Apple M5, MoltenVK 1.4.2, llvm-mc 23.1.6. Before is main 1154976d4, after is this branch on b4b7756e8; LEONIDA_F16_INTERP_FALLBACK=1 for both scripts, as a Mac needs:

Before After
build.py <out> exit 1, 0 modules 288 of 288 translated and valid, 288 modules
check.py 0 of 226 pass, 4 skipped 183 of 226 pass, 41 skipped; cs_dpp_cmp ok
w64_graphics.py 30 of 30 "missing .spv" 0 missing
run_gpu_tests.py 192/256 passed, 63 skipped the same, test for test

Not tested: Windows and Linux, and an LLVM other than 23.1.6. The change does not depend on the assembler: a marked source no longer reaches it.

GPUs tested: Apple M5 (8-core GPU), MoltenVK 1.4.2, macOS 27.2.1 (26B131)

AI-assisted: yes

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.

🤖 Generated with Claude Code

…tests.py (TEST-BUILD-TEXT-ONLY)

cs_dpp_cmp.asm (ProjectLeonida#957) holds a VOPC compare in DPP form, which llvm-mc has
no gfx1013 encoding for. The file says so in a comment line, and
run_gpu_tests.py passes such a source to the translator as text. build.py
still sent it to llvm-mc, so with no names it stopped at "cs_dpp_cmp.asm
did not assemble" before publishing anything: check.py then reported 0
of 226 and w64_graphics.py found no module.

build.py now writes the same listing run_gpu_tests.py writes for a
source that carries the marker line. On an Apple M5 the two-step form
goes from nothing built to 288 of 288 translated and valid, check.py
from 0 to 183 of 226 passing with cs_dpp_cmp ok, and the module is
byte-identical to the one run_gpu_tests.py builds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Tauwni

Tauwni commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Tested on an Apple M3 (MoltenVK 1.4.2, macOS 26.5.1, llvm-mc 23.1.6 from Homebrew), this PR at ae4e7d75d applied on main 626d1281a:

  • On main, runtime/test/shaders/build.py stops at cs_dpp_cmp.asm ("dpp variant of this instruction is not supported") and writes no SPIR-V, so check.py runs nothing.
  • With this PR: 297 shaders, 297 translated, 297 pass spirv-val; check.py 183 of 231 pass, 43 skipped, and cs_dpp_cmp is ok. The five failures are the known Mac ones (cs_fma_fused, ps_ssharp, ps_ij_computed, ps_interp_f16_high) and cs_imgatomic_ext (cs_imgatomic_ext: use the volume T# key vk_store_test now expects (GPU-IMG-ATOMIC-EXT-VOLUME-TAG) #1518).
  • python -I tests/test_shader_build_text_only.py: 8 tests OK.

Full record in #1718. AI-assisted (Claude Code).

@Anzymanz

Copy link
Copy Markdown

Confirmed on an RX 9070 XT (RADV, Mesa 26.2.6, CachyOS, llvm-mc 23.1.5) at main 5e95fa2. On main, build.py exits at cs_dpp_cmp.asm ("dpp variant of this instruction is not supported"), so check.py has no modules and reports 0 of 230. With this branch (and #1518), build.py translates 297/297 and all pass spirv-val, and check.py gives 227 of 231 pass, 4 skipped, both native and LEONIDA_W64_EMULATE=1; cs_dpp_cmp passes. tests/test_shader_build_text_only.py passes. Recorded in #1870. AI-assisted.

@PierreEbele

Copy link
Copy Markdown
Contributor

Reviewed ae4e7d7: build.py now writes a text-only listing (instruction lines, run_gpu_tests.py's exact format) for .asm sources carrying the shared TEXT_ONLY_MARK - cs_dpp_cmp - instead of sending them to llvm-mc, which has no gfx1013 encoding for the DPP-form VOPC compare; unmarked sources are unchanged and assembler errors still stop the build. Ran python -I tests/test_shader_build_text_only.py on the PR tree (8 tests OK; 6 errors against main's build.py), tests/test_shader_build_fallbacks.py on both trees (OK), and a probe on both with a stubbed llvm-mc: main dies with "cs_dpp_cmp.asm did not assemble" before publishing anything, the PR builds it with zero assembler calls and a listing byte-identical to run_gpu_tests.py's for the same fixture. No llvm-mc/spirv-val/GPU on this machine, so the end-to-end totals are unverified; no findings, no game data touched.
AI-assisted review.
Recommendation: Merge

@kevincommits

Copy link
Copy Markdown

Independent run with the real assembler, not stand-ins. Apple M5 Pro, macOS 27.2.1 (26B131), Python 3.14.2, Homebrew LLVM 23.1.6 (llvm-mc with the AMDGPU target), SPIRV-Tools from Homebrew. I merged main at a73a57e13 into the branch locally (822 commits behind, no conflicts). Head tested: ae4e7d75d.

build.py with no names: on main it stops at cs_dpp_cmp and publishes nothing; on this branch it builds all 301 shaders and all 301 pass spirv-val.

Command on both trees: LLVM_MC=/opt/homebrew/opt/llvm/bin/llvm-mc python3 -I runtime/test/shaders/build.py <out>.

tree result files in <out>/spirv
main at a73a57e13 exit 1: <stdin>:17:1: error: dpp variant of this instruction is not supported at v_cmp_gt_f32_dpp vcc_lo, v1, v1 dpp8:[4,5,6,7,0,1,2,3] 0
this branch merged with main 301 shaders: 301 translated, 301 pass spirv-val 604, 20 of them for the dpp fixtures

So the failure in the description reproduces here with a current llvm-mc, and the change removes it.

Not tested: check.py and the GPU runs on the built shaders, and the LEONIDA_* build variants. No game files used. AI-assisted.

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