[PR #281] [MERGED] 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 #333

Closed
opened 2026-11-26 20:17:32 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/281
Author: @Andretuta
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: old-pr/10010


📝 Commits (1)

  • 4e49709 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

📊 Changes

4 files changed (+248 additions, -6 deletions)

View changed files

📝 docs/fspx.md (+9 -0)
📝 tests/semantic/test_alu_dot4_i8.py (+2 -2)
➕ tests/semantic/test_fspx_dot4_op_sel_disasm.py (+157 -0)
📝 tools/shader_disasm.py (+80 -4)

📄 Description

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


🔄 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/281 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `old-pr/10010` --- ### 📝 Commits (1) - [`4e49709`](https://github.com/ubiquitarianism/leonida/commit/4e4970956afa8f19d11f1c3c92a8f203baf04a87) 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 ### 📊 Changes **4 files changed** (+248 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/fspx.md` (+9 -0) 📝 `tests/semantic/test_alu_dot4_i8.py` (+2 -2) ➕ `tests/semantic/test_fspx_dot4_op_sel_disasm.py` (+157 -0) 📝 `tools/shader_disasm.py` (+80 -4) </details> ### 📄 Description > 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:32 +01:00
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#333
No description provided.