BUILD-SPIRV-DEBUGINFO: Support named SPIR-V shader debug instructions #310

Merged
ettehn merged 1 commit from upstream-pr/310 into main 2026-11-24 13:36:50 +00:00
ettehn commented 2026-11-24 03:06:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ettehn on 2026-11-24T03:06:11Z.


Claimed in the coordination issue as: BUILD-SPIRV-DEBUGINFO

Rebased on main after #78 merged. On Windows, the updated head passed 47 SPIR-V assembler tests, 3 line-ending checks, all 6,075 semantic tests, and the no-game-data check.

What and why

Carries forward old upstream PR #4744. Register all 44 names from Khronos NonSemantic.Shader.DebugInfo.100 and use the imported instruction set for both OpExtInst and OpExtInstWithForwardRefsKHR. Without this, the Python assembler tries to parse names such as DebugSource as integers.

Tested

Windows 11 25H2 (build 26200.9974), Ryzen 9 8945HX, Python 3.13.7, Khronos SPIRV-Tools 2026.4. These checks run on the CPU and use no GPU driver.

  • The new synthetic regression failed on main with invalid integer literal 'DebugSource' and passed after the fix. It compares named instructions with numeric opcodes, validates the module with spirv-val --target-env vulkan1.2, and checks binary parity with spirv-as except for the generator word.

  • python -IB -m unittest discover -s tests -p 'test_spirv_asm*.py' — 42 passed. The same command on the local integration with #78 passed 47 tests.

  • python -IB tests/test_text_write_line_endings.py — 3 passed.

  • python -IB scripts/run_semantic_tests.py tests/semantic -j 8 — 6,075 tests across 463 files, zero failing files. The same suite on unpatched main also had zero failing files.

  • python -IB scripts/check_no_game_data.py — passed.

AI-assisted: Yes. OpenAI Codex helped port the patch, run the Windows checks and prepare this PR.

Checklist

  • No game data, keys or decryption.
  • No translator rule change. The patch affects the Python SPIR-V assembler.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465313531 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/310). Originally posted by [ettehn](https://github.com/ettehn) on 2026-11-24T03:06:11Z. --- Claimed in the coordination issue as: [BUILD-SPIRV-DEBUGINFO](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7120674636) Rebased on main after #78 merged. On Windows, the updated head passed 47 SPIR-V assembler tests, 3 line-ending checks, all 6,075 semantic tests, and the no-game-data check. ### What and why Carries forward old upstream PR #4744. Register all 44 names from Khronos `NonSemantic.Shader.DebugInfo.100` and use the imported instruction set for both `OpExtInst` and `OpExtInstWithForwardRefsKHR`. Without this, the Python assembler tries to parse names such as `DebugSource` as integers. ### Tested Windows 11 25H2 (build 26200.9974), Ryzen 9 8945HX, Python 3.13.7, Khronos SPIRV-Tools 2026.4. These checks run on the CPU and use no GPU driver. - The new synthetic regression failed on `main` with `invalid integer literal 'DebugSource'` and passed after the fix. It compares named instructions with numeric opcodes, validates the module with `spirv-val --target-env vulkan1.2`, and checks binary parity with `spirv-as` except for the generator word. - `python -IB -m unittest discover -s tests -p 'test_spirv_asm*.py'` — 42 passed. The same command on the local integration with #78 passed 47 tests. - `python -IB tests/test_text_write_line_endings.py` — 3 passed. - `python -IB scripts/run_semantic_tests.py tests/semantic -j 8` — 6,075 tests across 463 files, zero failing files. The same suite on unpatched `main` also had zero failing files. - `python -IB scripts/check_no_game_data.py` — passed. AI-assisted: Yes. OpenAI Codex helped port the patch, run the Windows checks and prepare this PR. ### Checklist - [x] No game data, keys or decryption. - No translator rule change. The patch affects the Python SPIR-V assembler.
Oliwettoo commented 2026-11-24 10:25:54 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Oliwettoo on 2026-11-24T10:25:54Z.


Looks good. The new NONSEMANTIC_SHADER_DEBUGINFO_100 table matches SPIRV-Headers' extinst.nonsemantic.shader.debuginfo.100.grammar.json exactly (same 44 names, same opcodes, checked by script). OpExtInstWithForwardRefsKHR stays out of the pure-Id fast path because of its literal operand, so routing it through the ext-set lookup is enough. tests/test_spirv_asm.py passes on current main (the spirv-as comparison was skipped here, as there is no SPIRV-Tools on this machine). Ship. AI-assisted review.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7128771951 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/310#issuecomment-7128771951). Originally posted by [Oliwettoo](https://github.com/Oliwettoo) on 2026-11-24T10:25:54Z. --- Looks good. The new `NONSEMANTIC_SHADER_DEBUGINFO_100` table matches SPIRV-Headers' `extinst.nonsemantic.shader.debuginfo.100.grammar.json` exactly (same 44 names, same opcodes, checked by script). `OpExtInstWithForwardRefsKHR` stays out of the pure-Id fast path because of its literal operand, so routing it through the ext-set lookup is enough. `tests/test_spirv_asm.py` passes on current `main` (the spirv-as comparison was skipped here, as there is no SPIRV-Tools on this machine). Ship. AI-assisted review.
QemmHD commented 2026-11-24 13:36:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T13:36:48Z.


Merging.

Why merged: Adds the named NonSemantic.Shader.DebugInfo.100 instruction table so SPIR-V debug instructions disassemble by name. Oliwettoo checked that the table matches SPIRV-Headers' grammar exactly (44 names).

Why it's good: Data table plus tests only. Its tests: 47 passed. No behaviour change for shaders without debug info.

Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bca8 or 51f316092) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c242f (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones).

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7133081115 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/310#issuecomment-7133081115). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T13:36:48Z. --- Merging. **Why merged:** Adds the named NonSemantic.Shader.DebugInfo.100 instruction table so SPIR-V debug instructions disassemble by name. Oliwettoo checked that the table matches SPIRV-Headers' grammar exactly (44 names). **Why it's good:** Data table plus tests only. Its tests: 47 passed. No behaviour change for shaders without debug info. Tested on Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0, alone on main (21625bca8 or 51f316092) and in a cumulative merge of #497, #278, #310, #334, #346, #340, #355, #361, #363, #620 and #577 (which carries #540) on main 2d73c242f (git merge-tree: 0 conflicts against current main). Repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests): 566 passed / 5 skipped / 0 failed on main and on main + batch. compileall OK. Full ctest: 302/304 on main and on main + batch (the same two pre-existing failures, d3d12_execute_indirect_validation and d3d12_depth_resolve, no new ones). AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No reviewers
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!310
No description provided.