rdna2spirv: mesh shader compressed exports unpack f16 pairs instead of failing (OLD-9921) #1203

Merged
leonida/mandy
ambroseautomation merged 4 commits from carry/old-9921-ms-compressed-exports into main 2026-11-25 03:16:53 +00:00

Pull request successfully merged and closed

ambroseautomation commented 2026-11-24 20:11:41 +00:00

Claimed in the coordination issue as: OLD-9921 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142940137)

Depends on: #1197

What and why

Carries forward old-pr/9921 (draft #189, original commit author tedin7 preserved; indexed in #17), rebased cleanly onto current main.

Fixes mesh shader compressed exports (exp pos1/param ... compr) in tools/rdna2spirv.py so they unpack their f16 pairs instead of raising Unsupported("mesh compressed export"):

  • Extracts shared Gen.export_comps(a, ins) from Gen.export and reuses it in Gen.mesh_export for pos1+, pos0, and param* exports, unpacking each f16 pair register via OpExtInst %v2float %glsl UnpackHalf2x16 and preserving off slots as None.
  • Adds 4 unit tests in tests/test_translate.py: test_ms_compressed_pos1_clip_export_unpacks_f16_pairs, test_ms_compressed_pos1_clip_export_off_register_writes_nothing, test_ms_compressed_param_export_unpacks_f16_pairs, and test_ms_uncompressed_exports_do_not_unpack_halves.

Tested

  • Executed all 4 new tests/test_translate.py functions directly via rdna2spirv.translate and verified SPIR-V binary assembly via spirv_asm.assemble (no llvm-mc/spirv-val installed on host): 4/4 PASS.
  • python -I scripts/run_semantic_tests.py tests/semantic: 470 files, 6,168 tests, 0 files failed.
  • python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/test_translate.py: exit 0 (no game data).

GPUs tested: n/a (CPU SPIR-V interpreter semantic suite + in-process spirv_asm assembly on Windows 11 Pro 64-bit, Python 3.12.10)

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. (extends existing compressed export f16 unpacking to mesh stage)
Claimed in the coordination issue as: OLD-9921 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142940137) Depends on: #1197 ### What and why Carries forward `old-pr/9921` (draft #189, original commit author `tedin7` preserved; indexed in #17), rebased cleanly onto current `main`. Fixes mesh shader compressed exports (`exp pos1/param ... compr`) in `tools/rdna2spirv.py` so they unpack their f16 pairs instead of raising `Unsupported("mesh compressed export")`: - Extracts shared `Gen.export_comps(a, ins)` from `Gen.export` and reuses it in `Gen.mesh_export` for `pos1+`, `pos0`, and `param*` exports, unpacking each f16 pair register via `OpExtInst %v2float %glsl UnpackHalf2x16` and preserving `off` slots as `None`. - Adds 4 unit tests in `tests/test_translate.py`: `test_ms_compressed_pos1_clip_export_unpacks_f16_pairs`, `test_ms_compressed_pos1_clip_export_off_register_writes_nothing`, `test_ms_compressed_param_export_unpacks_f16_pairs`, and `test_ms_uncompressed_exports_do_not_unpack_halves`. ### Tested - Executed all 4 new `tests/test_translate.py` functions directly via `rdna2spirv.translate` and verified SPIR-V binary assembly via `spirv_asm.assemble` (no `llvm-mc`/`spirv-val` installed on host): 4/4 PASS. - `python -I scripts/run_semantic_tests.py tests/semantic`: 470 files, 6,168 tests, 0 files failed. - `python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/test_translate.py`: exit 0 (no game data). GPUs tested: n/a (CPU SPIR-V interpreter semantic suite + in-process `spirv_asm` assembly on Windows 11 Pro 64-bit, Python 3.12.10) AI-assisted: yes ### 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. (extends existing compressed export f16 unpacking to mesh stage)
aslan2142 commented 2026-11-25 03:16:55 +00:00

Merged, after #1197 as the description asked. Thanks.

  • Claim: OLD-9921, valid, before this PR; the only claim for the item.
  • Added before merging:
    • the contract row for the rule, in the "Mesh shaders" row of docs/design.md;
    • two merges of main. The second resolves the one conflict with #1197 in mesh_export by keeping both: #1197's misc-vector return for pos1 first, then the compressed components.
  • On the maintainer's own shader corpus (counts only): none of the 9,282 mesh shaders uses a compressed export, so the game's translation does not change.
  • tests/test_translate.py on the merge: 705 pass; the 2 failures (cs_dpp_cmp.asm) are the same on main.
  • Checked on main 1cfc29af7 + 275cb0145: the semantic suite passes (487 files, 6,279 tests, 0 files failed); test_translate (pytest; 2 failing as on main) pass; the 14 docs and writer tests pass; check_no_game_data.py is clean on the 3 changed files.

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

Merged, after #1197 as the description asked. Thanks. - **Claim:** `OLD-9921`, valid, before this PR; the only claim for the item. - **Added before merging:** - the contract row for the rule, in the "Mesh shaders" row of `docs/design.md`; - two merges of `main`. The second resolves the one conflict with #1197 in `mesh_export` by keeping both: #1197's misc-vector return for `pos1` first, then the compressed components. - **On the maintainer's own shader corpus (counts only):** none of the 9,282 mesh shaders uses a compressed export, so the game's translation does not change. - **`tests/test_translate.py` on the merge:** 705 pass; the 2 failures (`cs_dpp_cmp.asm`) are the same on `main`. - **Checked on `main` `1cfc29af7` + `275cb0145`:** the semantic suite passes (487 files, 6,279 tests, 0 files failed); `test_translate (pytest; 2 failing as on main)` pass; the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 3 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.