shaders stage: a truncated disassembly listing makes 1 of 26,503 shaders fail translation #2539

Closed
opened 2026-11-28 01:21:09 +00:00 by LGlong1 · 3 comments
LGlong1 commented 2026-11-28 01:21:09 +00:00 (Migrated from github.com)
Contributor

Imported from ubiquitarianism/leonida. Originally posted by LGlong1 on 2026-11-28T01:21:09Z.


Summary

On a fresh full build (--stages shaders,runtime), the shaders stage stops with:

ERROR: shaders: the translation index holds 26502 of the 26503 carved shaders (1 were refused or failed spirv-val, listed in this stage's output): a port built from it would lack them. Fix the translator for that class and translate again

The translating shard's summary shows the reason: 1 branch without encoding. The shader is one whose disassembly listing was truncated at the end of the file, so its last instruction has no encoding comment and the translator refuses it. Re-disassembling the same FSSM gives a complete listing, and translating that passes spirv-val.

Environment

  • Windows 10 22H2 (10.0.19045)
  • AMD RX 6750 GRE 12 GB, Vulkan through the current Adrenalin driver
  • Python 3.12, Visual Studio 2022 + Windows SDK 10.0.26100, Vulkan SDK for spirv-as/spirv-val, ffmpeg
  • LLVM_MC=wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc (Ubuntu LLVM 21.1.8, AMDGPU target present; tested with s_endpgm)
  • commit d442851 (the build was run on this; main has moved since)
  • command: python -I make_game.py --game <copy> --out <out> --work <work> --stages shaders,runtime --jobs 8 --no-tui

What happened

  1. The missing shader is @ped_standard_eye_emissive_CS_RaytracingResolve_f21e9178_Wrapped (compute).
  2. Its listing under <work>/shaders/dxbc/disasm/ is cut short: the file ends in the middle of the final line's encoding comment (the text stops at ; encod), and the listing has no s_endpgm. The repaired listing for the same FSSM is much longer (2,432 lines vs 2,266) and ends with s_endpgm.
  3. Re-running tools/shader_disasm.py on that single .fssm, with the same LLVM_MC, writes a complete listing, and tools/rdna2spirv.py on it translates the shader and passes spirv-val (1/1).
  4. After replacing that one listing, re-disassembling and adding the entry to the translation index, the shaders stage completes (26,503/26,503) and the rest of the build continues.

Notes

  • tools/shader_disasm.py writes to a temporary file and os.replace()s it into place, so a partial file should not normally be published; this happened on a fresh full run (no --skip-existing), with --jobs 8.
  • The shard that produced it reported only the reason count (1 branch without encoding); the affected shader's name was not printed anywhere I could find, so I located it by comparing the carved .dxbc names against the translated index.
  • The build's disassembly validation accepted the truncated listing, which is why the failure surfaced only later, in translation.

Possible fixes

  • When validating disassembly (disassembly_status/disassembly_listings), also check that each listing ends with a complete final line and s_endpgm; re-run shader_disasm.py for the listings that fail the check.
  • Print the failing shader's name with the reason in the shard summary (it would make this class much faster to find).
  • If the truncation can come from a race (two jobs writing the same listing, or a short read of llvm-mc's output), a retry for a listing that fails the completeness check would cover it.

I can test a patch against this copy (the original .dxbc/.fssm are kept locally; I did not attach any game files or generated shader text here).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:6657157338 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/issues/2539). Originally posted by [LGlong1](https://github.com/LGlong1) on 2026-11-28T01:21:09Z. --- ## Summary On a fresh full build (`--stages shaders,runtime`), the `shaders` stage stops with: ``` ERROR: shaders: the translation index holds 26502 of the 26503 carved shaders (1 were refused or failed spirv-val, listed in this stage's output): a port built from it would lack them. Fix the translator for that class and translate again ``` The translating shard's summary shows the reason: `1 branch without encoding`. The shader is one whose **disassembly listing was truncated** at the end of the file, so its last instruction has no encoding comment and the translator refuses it. Re-disassembling the same FSSM gives a complete listing, and translating that passes `spirv-val`. ## Environment - Windows 10 22H2 (10.0.19045) - AMD RX 6750 GRE 12 GB, Vulkan through the current Adrenalin driver - Python 3.12, Visual Studio 2022 + Windows SDK 10.0.26100, Vulkan SDK for `spirv-as`/`spirv-val`, ffmpeg - `LLVM_MC=wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc` (Ubuntu LLVM 21.1.8, AMDGPU target present; tested with `s_endpgm`) - commit `d442851` (the build was run on this; `main` has moved since) - command: `python -I make_game.py --game <copy> --out <out> --work <work> --stages shaders,runtime --jobs 8 --no-tui` ## What happened 1. The missing shader is `@ped_standard_eye_emissive_CS_RaytracingResolve_f21e9178_Wrapped` (compute). 2. Its listing under `<work>/shaders/dxbc/disasm/` is cut short: the file ends in the middle of the final line's encoding comment (the text stops at `; encod`), and the listing has no `s_endpgm`. The repaired listing for the same FSSM is much longer (2,432 lines vs 2,266) and ends with `s_endpgm`. 3. Re-running `tools/shader_disasm.py` on that single `.fssm`, with the same `LLVM_MC`, writes a complete listing, and `tools/rdna2spirv.py` on it translates the shader and passes `spirv-val` (1/1). 4. After replacing that one listing, re-disassembling and adding the entry to the translation index, the `shaders` stage completes (26,503/26,503) and the rest of the build continues. ## Notes - `tools/shader_disasm.py` writes to a temporary file and `os.replace()`s it into place, so a partial file should not normally be published; this happened on a fresh full run (no `--skip-existing`), with `--jobs 8`. - The shard that produced it reported only the reason count (`1 branch without encoding`); the affected shader's name was not printed anywhere I could find, so I located it by comparing the carved `.dxbc` names against the translated index. - The build's disassembly validation accepted the truncated listing, which is why the failure surfaced only later, in translation. ## Possible fixes - When validating disassembly (`disassembly_status`/`disassembly_listings`), also check that each listing ends with a complete final line and `s_endpgm`; re-run `shader_disasm.py` for the listings that fail the check. - Print the failing shader's name with the reason in the shard summary (it would make this class much faster to find). - If the truncation can come from a race (two jobs writing the same listing, or a short read of `llvm-mc`'s output), a retry for a listing that fails the completeness check would cover it. I can test a patch against this copy (the original `.dxbc`/`.fssm` are kept locally; I did not attach any game files or generated shader text here).
LGlong1 commented 2026-11-28 01:29:17 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ubiquitarianism/leonida. Originally posted by LGlong1 on 2026-11-28T01:29:17Z.


Two notes from retesting, in case they save someone time:

  • This is not the same as #2142 (llvm-mc 21.1.8 printing a v_fma_mix literal cut in the text only, closed), but it is the same family of "the text is cut" problem, and the same LLVM version. #1923 (build llvm-mc 23.1.5 by default) may be relevant.
  • I re-ran tools/shader_disasm.py on that single FSSM with the same LLVM 21.1.8 and got a complete listing (2,432 lines, ends with s_endpgm), while the build's run (8 jobs, --unpack-index) had left the truncated one. So the cut may be in the parallel disassembly path or its publish step (#861, #908) rather than in llvm-mc itself; the missing s_endpgm check would catch either way.

I can rerun the same build with llvm-mc 23.1.5 if it would help narrow it down.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7231699979 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/issues/2539#issuecomment-7231699979). Originally posted by [LGlong1](https://github.com/LGlong1) on 2026-11-28T01:29:17Z. --- Two notes from retesting, in case they save someone time: - This is not the same as #2142 (llvm-mc 21.1.8 printing a `v_fma_mix` literal cut in the text only, closed), but it is the same family of "the text is cut" problem, and the same LLVM version. #1923 (build llvm-mc 23.1.5 by default) may be relevant. - I re-ran `tools/shader_disasm.py` on that single FSSM with the **same** LLVM 21.1.8 and got a complete listing (2,432 lines, ends with `s_endpgm`), while the build's run (8 jobs, `--unpack-index`) had left the truncated one. So the cut may be in the parallel disassembly path or its publish step (#861, #908) rather than in llvm-mc itself; the missing `s_endpgm` check would catch either way. I can rerun the same build with llvm-mc 23.1.5 if it would help narrow it down.
KoabraFang commented 2026-11-28 02:10:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ubiquitarianism/leonida. Originally posted by KoabraFang on 2026-11-28T02:10:58Z.


IDK what's going on just wanted to say keep up the work ;) we believe in you

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232187463 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/issues/2539#issuecomment-7232187463). Originally posted by [KoabraFang](https://github.com/KoabraFang) on 2026-11-28T02:10:58Z. --- IDK what's going on just wanted to say keep up the work ;) we believe in you
aslan2142 commented 2026-12-01 17:06:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:06:37Z.


Closing this issue because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the report/contribution! If you believe this issue was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7318768673 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/issues/2539#issuecomment-7318768673). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:06:37Z. --- Closing this issue because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the report/contribution! If you believe this issue was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No labels
No milestone
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.

Reference
ProjectLeonida/mandy#2539
No description provided.