[PR #1923] scripts: build llvm-mc 23.1.5 by default, so the pipeline library translates #1931

Open
opened 2026-11-26 21:19:27 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1923
Author: @fiestorra
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: carry/llvm-mc-23-default


📝 Commits (2)

  • 92cdd35 scripts, tools: build llvm-mc 23.1.5 by default, so the pipeline library translates
  • 7362994 docs: LLVM 23 is what the shaders stage needs, and a test pins the script's default

📊 Changes

12 files changed (+73 additions, -32 deletions)

View changed files

📝 README.md (+11 -8)
📝 docs/design.md (+16 -5)
📝 docs/linux.md (+5 -2)
📝 docs/testing.md (+8 -1)
📝 make_game.py (+1 -1)
📝 scripts/build_llvm_mc.ps1 (+7 -1)
📝 tests/test_llvm_source_version.py (+11 -0)
📝 tests/test_make_game_pipeline_preflight.py (+1 -1)
📝 tests/test_make_game_preflight.py (+2 -2)
📝 tests/test_mc_command.py (+3 -3)
📝 tools/mc_command.py (+7 -7)
📝 tools/shader_disasm.py (+1 -1)

📄 Description

Claimed in the coordination issue as: LIBRARY-TRANSLATION-GAP (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7166696189)

What and why

scripts/build_llvm_mc.ps1 built LLVM 21.1.8 by default. That version's gfx1013 decoder cannot decode 840 of the
2,684 compute programs in the pipeline library of 1.0.2.1: their listings carry 79,490 rejected words (and 8,310
exp invalid_target_N lines), the translator refuses all of them as fall-through into undecodable words, and the
shaders stage keeps 1,844 of 2,684. LLVM 21 does translate all 26,503 shaders of shaders.rpf; the pipeline library
is the part it loses.

The same bytes disassembled with LLVM 23.1.5 (the release docs/testing.md and the corpus runs already name) have no
rejected word in those 840, and 839 of them translate and pass spirv-val; the 840th wants s_sethalt, which the
translator does not implement, under either version.

So this changes the helper's default -Version to 23.1.5, the docs that name the minimum version (README.md,
docs/design.md, docs/testing.md, docs/linux.md), and the three user-facing messages that still said 21+:
make_game.py's shaders preflight, shader_disasm.py's probe error and mc_command.py's install hint (the same
text is used when the fixture assembler is missing, but recommending 21+ there sends users to the version that loses
the library). tests/test_make_game_pipeline_preflight.py, tests/test_make_game_preflight.py and
tests/test_mc_command.py asserted those texts and are updated with them.

It is not a decoder workaround: #998 and #1712 patch around LLVM 21 in tools/ and are untouched here; this removes
the cause for anyone who builds llvm-mc with the helper.

Tested

All numbers on main 71a769d7d, -mcpu=gfx1013, --stages cs, 1.0.2.1, with llvm-mc 21.1.8 at
%USERPROFILE%\.leonida\llvm-mc and 23.1.5 at %USERPROFILE%\.leonida\llvm-mc-23 (native Windows builds from the
llvmorg-21.1.8 and llvmorg-23.1.5 tags).

  • The 840 refused programs: 79,490 invalid instruction encoding words and 8,310 exp invalid_target_N with 21.1.8;
    0 and 0 with 23.1.5 (library.json totals: 1,844 of 2,684).
  • Translation of those 840 from the 23.1.5 listings: 839 translated and 839 passed spirv-val (was 0/840). The
    refusal is s_sethalt, the same with the 21.1.8 listing, so it is not a decode difference.
  • The 1,844 that already translated, re-disassembled and re-translated: 1,674 listings differ under 23.1.5 (LLVM
    prints some operands differently; they still carry 1,317 known data words from 1,887) and 1,674 of 1,674 pass,
    the other 170 are byte-identical. So the stage goes from 1,844/2,684 to 2,683/2,684, the last being
    s_sethalt.
  • tests/test_docs_*, tests/test_make_game_preflight.py, tests/test_make_game_pipeline_preflight.py,
    tests/test_mc_command.py, tests/test_shader_disasm.py, tests/test_llvm_source_version.py,
    tests/test_llvm_install_*.py, tests/test_build_llvm_mc_*.py, tests/test_build_percent_path.py: pass.
    python -m compileall and git diff --check: clean. No unit test covers the default tag: it downloads and builds
    LLVM, which CI cannot do.

What this does not prove: the helper itself was not rebuilt here; the 23.1.5 binary measured is a native Windows build
from the llvmorg-23.1.5 tag on this machine (build log ends rc=0). The 26,503-shader corpus was not re-measured
with 23.1.5 in this run (the README's 23.1.5 rerun covers it). Whether s_sethalt can be expressed in SPIR-V is not
investigated. Every module was checked with spirv-val; none was run on a GPU.

GPUs tested: n/a (no GPU test; translation and spirv-val only)

AI-assisted: yes (DeepSeek Harness)

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.

Written with an AI assistant.

Why the version matters beyond the pipeline library

Measured on the retail title afterwards, and it is stronger than the translate count the description uses:

  • With a library translated by LLVM 21.1.8 (28,433 of 29,280 programs translated), a 900 s run of the title logged 849 E_INVALIDARG at device slot 67 (Xbox DeserializeComputePipelineStateX), 847 programs short.
  • With the LLVM 23.1.5 library (29,277 of 29,280), the same run, same machine, same 900 s: 0 failures and 2,689 successful slot-67 calls.

So without this change the shaders stage silently produces a library that is 847 compute programs short, and every pipeline state that uses one of them fails at creation among ~25,000 that succeed. The failures are per-call log lines, which is why they read as noise.

Details, with the counts and the method: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7184770128 and the like-for-like control in the next comment.

The three red jobs in the current run (linux-gpu-tools, macos, windows) are analysed in the thread below and are not from this diff: the linux-gpu-tools compile error is in code identical on main, cs_imgatomic_ext is the fixture owned by #1518, and vk_xdxr_postbuild_readback is a runtime test this branch does not touch.


🔄 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/1923 **Author:** [@fiestorra](https://github.com/fiestorra) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `carry/llvm-mc-23-default` --- ### 📝 Commits (2) - [`92cdd35`](https://github.com/ubiquitarianism/leonida/commit/92cdd35f067a7d68da70a96adc9097822658ca2c) scripts, tools: build llvm-mc 23.1.5 by default, so the pipeline library translates - [`7362994`](https://github.com/ubiquitarianism/leonida/commit/736299450f91ff98a85d3d342111bd08dc8e0692) docs: LLVM 23 is what the shaders stage needs, and a test pins the script's default ### 📊 Changes **12 files changed** (+73 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+11 -8) 📝 `docs/design.md` (+16 -5) 📝 `docs/linux.md` (+5 -2) 📝 `docs/testing.md` (+8 -1) 📝 `make_game.py` (+1 -1) 📝 `scripts/build_llvm_mc.ps1` (+7 -1) 📝 `tests/test_llvm_source_version.py` (+11 -0) 📝 `tests/test_make_game_pipeline_preflight.py` (+1 -1) 📝 `tests/test_make_game_preflight.py` (+2 -2) 📝 `tests/test_mc_command.py` (+3 -3) 📝 `tools/mc_command.py` (+7 -7) 📝 `tools/shader_disasm.py` (+1 -1) </details> ### 📄 Description Claimed in the coordination issue as: LIBRARY-TRANSLATION-GAP (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7166696189) ### What and why `scripts/build_llvm_mc.ps1` built LLVM 21.1.8 by default. That version's `gfx1013` decoder cannot decode 840 of the 2,684 compute programs in the pipeline library of 1.0.2.1: their listings carry 79,490 rejected words (and 8,310 `exp invalid_target_N` lines), the translator refuses all of them as `fall-through into undecodable words`, and the `shaders` stage keeps 1,844 of 2,684. LLVM 21 does translate all 26,503 shaders of `shaders.rpf`; the pipeline library is the part it loses. The same bytes disassembled with LLVM 23.1.5 (the release `docs/testing.md` and the corpus runs already name) have no rejected word in those 840, and 839 of them translate and pass `spirv-val`; the 840th wants `s_sethalt`, which the translator does not implement, under either version. So this changes the helper's default `-Version` to 23.1.5, the docs that name the minimum version (`README.md`, `docs/design.md`, `docs/testing.md`, `docs/linux.md`), and the three user-facing messages that still said 21+: `make_game.py`'s `shaders` preflight, `shader_disasm.py`'s probe error and `mc_command.py`'s install hint (the same text is used when the fixture assembler is missing, but recommending 21+ there sends users to the version that loses the library). `tests/test_make_game_pipeline_preflight.py`, `tests/test_make_game_preflight.py` and `tests/test_mc_command.py` asserted those texts and are updated with them. It is not a decoder workaround: #998 and #1712 patch around LLVM 21 in `tools/` and are untouched here; this removes the cause for anyone who builds `llvm-mc` with the helper. ### Tested All numbers on `main` `71a769d7d`, `-mcpu=gfx1013`, `--stages cs`, 1.0.2.1, with `llvm-mc` 21.1.8 at `%USERPROFILE%\.leonida\llvm-mc` and 23.1.5 at `%USERPROFILE%\.leonida\llvm-mc-23` (native Windows builds from the `llvmorg-21.1.8` and `llvmorg-23.1.5` tags). - The 840 refused programs: 79,490 `invalid instruction encoding` words and 8,310 `exp invalid_target_N` with 21.1.8; 0 and 0 with 23.1.5 (`library.json` totals: 1,844 of 2,684). - Translation of those 840 from the 23.1.5 listings: **839 translated and 839 passed `spirv-val`** (was 0/840). The refusal is `s_sethalt`, the same with the 21.1.8 listing, so it is not a decode difference. - The 1,844 that already translated, re-disassembled and re-translated: 1,674 listings differ under 23.1.5 (LLVM prints some operands differently; they still carry 1,317 known data words from 1,887) and **1,674 of 1,674 pass**, the other 170 are byte-identical. **So the stage goes from 1,844/2,684 to 2,683/2,684**, the last being `s_sethalt`. - `tests/test_docs_*`, `tests/test_make_game_preflight.py`, `tests/test_make_game_pipeline_preflight.py`, `tests/test_mc_command.py`, `tests/test_shader_disasm.py`, `tests/test_llvm_source_version.py`, `tests/test_llvm_install_*.py`, `tests/test_build_llvm_mc_*.py`, `tests/test_build_percent_path.py`: pass. `python -m compileall` and `git diff --check`: clean. No unit test covers the default tag: it downloads and builds LLVM, which CI cannot do. What this does not prove: the helper itself was not rebuilt here; the 23.1.5 binary measured is a native Windows build from the `llvmorg-23.1.5` tag on this machine (build log ends `rc=0`). The 26,503-shader corpus was not re-measured with 23.1.5 in this run (the README's 23.1.5 rerun covers it). Whether `s_sethalt` can be expressed in SPIR-V is not investigated. Every module was checked with `spirv-val`; none was run on a GPU. GPUs tested: n/a (no GPU test; translation and `spirv-val` only) AI-assisted: yes (DeepSeek Harness) ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. Written with an AI assistant. ## Why the version matters beyond the pipeline library Measured on the retail title afterwards, and it is stronger than the translate count the description uses: - With a library translated by **LLVM 21.1.8** (28,433 of 29,280 programs translated), a 900 s run of the title logged **849 `E_INVALIDARG`** at device slot 67 (`Xbox DeserializeComputePipelineStateX`), 847 programs short. - With the **LLVM 23.1.5** library (29,277 of 29,280), the same run, same machine, same 900 s: **0 failures and 2,689 successful slot-67 calls**. So without this change the `shaders` stage silently produces a library that is 847 compute programs short, and every pipeline state that uses one of them fails at creation among ~25,000 that succeed. The failures are per-call log lines, which is why they read as noise. Details, with the counts and the method: https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7184770128 and the like-for-like control in the next comment. The three red jobs in the current run (`linux-gpu-tools`, `macos`, `windows`) are analysed in the thread below and are not from this diff: the `linux-gpu-tools` compile error is in code identical on `main`, `cs_imgatomic_ext` is the fixture owned by #1518, and `vk_xdxr_postbuild_readback` is a runtime test this branch does not touch. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1931
No description provided.