fix: shader_disasm prints the v_dot4_i32_i8 op_sel 2 / op_sel_hi 5 words llvm-mc rejects, so the FSR4 FSPX programs translate #281

Manually merged
github merged 1 commit from gh-pr/281/head into gh-pr/281/base 2026-11-26 08:51:51 +00:00
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:58 UTC · original
ubiquitarianism:old-pr/10010 → main · +248 −6 · 4 files · 1 commits · merged 2026-11-25 02:33 UTC

Carried over from old PR 10010 by tedin7 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10010, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
tedin7: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

What

tools/shader_disasm.py prints the v_dot4_i32_i8 ... op_sel:[0,1,0] op_sel_hi:[1,0,1] word (opcode 0x16, op_sel 2, op_sel_hi 5, no clamp, no neg) that llvm-mc rejects. A dword pair llvm-mc refuses with exactly those fields is decoded with the fields at their defaults, then given the fields and its real encoding back. Any other op_sel/op_sel_hi value, clamp or neg stays undecodable. A pair llvm-mc accepted is never touched. docs/fspx.md and a comment in test_alu_dot4_i8.py updated.

Why

The FidelityFX upscaler (FSR4) FSPX programs hold 89 such words in 8 programs (docs/fspx.md). The translator already models the form, but the listing could not carry it, so those programs were refused as a fall-through into undecodable words. This lets those shader programs translate.

Tested (read this part)

  • Local, llvm-mc 19 only: pytest tests/semantic/test_alu_dot4_i8.py tests/semantic/test_fspx_dot4_op_sel_disasm.py: 12 passed, 4 skipped, 23 subtests passed. The 4 skipped are the new test_fspx_dot4_op_sel_disasm.py tests: they need an llvm-mc with the AMDGPU target that decodes v_dot4_i32_i8, and llvm-mc 19 does not.
  • Earlier, before the GPU pod went down: those 4 tests passed 4/4 with llvm-mc 21 on the pod, on an older base. They were NOT re-run after this rebase, because the pod is off and no llvm-mc 21 is available locally.
  • Negative control: with tools/shader_disasm.py at origin/main the new test file cannot even be collected (no run_mc helper); the behaviour tests are the skipped ones, so the control for the decode itself was only seen on the pod.
  • Not run: the 89 real words of the 8 programs (needs the package's DLL).

Rebased cleanly on current main (cherry-pick, no conflicts). Coordination: https://github.com/ProjectLeonida/Leonida/issues/9677

**@⁠Andretuta** on GitHub · 2026-11-24 02:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/281) `ubiquitarianism:old-pr/10010` → `main` · +248 −6 · 4 files · 1 commits · merged 2026-11-25 02:33 UTC > Carried over from **old PR 10010** by `tedin7` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10010`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `tedin7`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ## What `tools/shader_disasm.py` prints the `v_dot4_i32_i8 ... op_sel:[0,1,0] op_sel_hi:[1,0,1]` word (opcode 0x16, op_sel 2, op_sel_hi 5, no clamp, no neg) that llvm-mc rejects. A dword pair llvm-mc refuses with exactly those fields is decoded with the fields at their defaults, then given the fields and its real encoding back. Any other op_sel/op_sel_hi value, clamp or neg stays undecodable. A pair llvm-mc accepted is never touched. docs/fspx.md and a comment in test_alu_dot4_i8.py updated. ## Why The FidelityFX upscaler (FSR4) FSPX programs hold 89 such words in 8 programs (docs/fspx.md). The translator already models the form, but the listing could not carry it, so those programs were refused as a fall-through into undecodable words. This lets those shader programs translate. ## Tested (read this part) - Local, llvm-mc 19 only: `pytest tests/semantic/test_alu_dot4_i8.py tests/semantic/test_fspx_dot4_op_sel_disasm.py`: 12 passed, 4 skipped, 23 subtests passed. The 4 skipped are the new `test_fspx_dot4_op_sel_disasm.py` tests: they need an llvm-mc with the AMDGPU target that decodes `v_dot4_i32_i8`, and llvm-mc 19 does not. - Earlier, before the GPU pod went down: those 4 tests passed 4/4 with llvm-mc 21 on the pod, on an older base. They were NOT re-run after this rebase, because the pod is off and no llvm-mc 21 is available locally. - Negative control: with `tools/shader_disasm.py` at origin/main the new test file cannot even be collected (no `run_mc` helper); the behaviour tests are the skipped ones, so the control for the decode itself was only seen on the pod. - Not run: the 89 real words of the 8 programs (needs the package's DLL). Rebased cleanly on current main (cherry-pick, no conflicts). Coordination: https://github.com/ProjectLeonida/Leonida/issues/9677
The FidelityFX upscaler programs hold 89 such words in 8 programs (docs/fspx.md); the translator already models the form but the listing could not carry it, so the programs were refused as a fall-through into undecodable words.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:51:48 +00:00
github manually merged commit 4e4970956a into gh-pr/281/base 2026-11-26 08:51:51 +00:00
Author
Owner

@⁠SweatierKey on GitHub · 2026-11-24 15:58 UTC · original · approved these changes

Independent verification on origin/main@1504c1af6 (LLVM llvm-mc 23.1.6, LEONIDA_REQUIRE_SPIRV_TOOLS=1):

  • tests/semantic/test_fspx_dot4_op_sel_disasm.py: 4/4 PASS (assembled, patched, disassembled with llvm-mc, translated, and validated; confirms unsupported op_sel, clamp/neg, and non-instruction data stay untouched).
  • tests/semantic/test_alu_dot4_i8.py: 12/12 PASS.
  • scripts/check_no_game_data.py: clean.

AI-assisted: yes

**@⁠SweatierKey** on GitHub · 2026-11-24 15:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/281#pullrequestreview-6042767401) · **approved these changes** Independent verification on `origin/main@1504c1af6` (LLVM `llvm-mc 23.1.6`, `LEONIDA_REQUIRE_SPIRV_TOOLS=1`): - `tests/semantic/test_fspx_dot4_op_sel_disasm.py`: `4/4` PASS (assembled, patched, disassembled with `llvm-mc`, translated, and validated; confirms unsupported `op_sel`, `clamp`/`neg`, and non-instruction data stay untouched). - `tests/semantic/test_alu_dot4_i8.py`: `12/12` PASS. - `scripts/check_no_game_data.py`: clean. AI-assisted: yes
This discussion has been locked. Commenting is limited to contributors.
No description provided.