[PR #1317] [CLOSED] shader_disasm: print v_dot4_i32_i8 op_sel 2 / op_sel_hi 5 words llvm-mc rejects (OLD-10010) #1346

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1317
Author: @ambroseautomation
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: carry/old-10010-fspx-dot4-op-sel


📝 Commits (1)

  • 62237d0 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 (+224 additions, -1 deletions)

View changed files

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

📄 Description

Summary

Coordination item: OLD-10010 (carry-forward of old-pr/10010, preserving original author tedin7).

Problem & Root Cause

llvm-mc rejects v_dot4_i32_i8 VOP3P words encoded with op_sel: 2 ([0,1,0]) and op_sel_hi: 5 ([1,0,1]), which appear in the FidelityFX upscaler's FSPX programs (docs/fspx.md), preventing those programs from disassembling and translating cleanly.

Implementation

  • Adds DOT4_I8_OPCODE, dot4_op_sel_words(), and with_dot4_op_sel() in tools/shader_disasm.py to patch rejected v_dot4_i32_i8 op_sel=2 / op_sel_hi=5 words to defaults (op_sel=0 / op_sel_hi=7) for llvm-mc disassembly and restore op_sel:[0,1,0] op_sel_hi:[1,0,1] and the original encoding bytes on the resulting instruction lines.
  • Preserves main's with_vopc_dpp() fallback pass cleanly alongside with_dot4_op_sel() in disasm().
  • Documents the behavior in docs/fspx.md and adds semantic/disassembly tests in tests/semantic/test_fspx_dot4_op_sel_disasm.py and tests/semantic/test_alu_dot4_i8.py.

Tests Run

Environment: Windows 11 Pro 64-bit, Python 3.12.10, synthetic fixtures only (no game data).

  • python -I -m py_compile tools/shader_disasm.py tests/semantic/test_fspx_dot4_op_sel_disasm.py tests/semantic/test_alu_dot4_i8.py — PASS
  • python -I tests/semantic/test_alu_dot4_i8.py — 12/12 PASS
  • python -I tests/semantic/test_fspx_dot4_op_sel_disasm.py — 4 skipped (no llvm-mc installed on this host); additionally verified shader_disasm.dot4_op_sel_words() and shader_disasm.disasm() fallback path with a mocked run_mc — PASS
  • pytest tests/test_docs_links.py tests/test_text_write_line_endings.py -v — 19/19 PASS
  • python -I scripts/check_no_game_data.py docs/fspx.md tests/semantic/test_alu_dot4_i8.py tests/semantic/test_fspx_dot4_op_sel_disasm.py tools/shader_disasm.py — PASS

Disclosure

AI-assisted: yes (carry-forward, rebase onto current main preserving with_vopc_dpp, and local verification; original implementation by tedin7).


🔄 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/1317 **Author:** [@ambroseautomation](https://github.com/ambroseautomation) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `carry/old-10010-fspx-dot4-op-sel` --- ### 📝 Commits (1) - [`62237d0`](https://github.com/ubiquitarianism/leonida/commit/62237d0e5c09e72849ee17f323e8bb28df82b0ca) 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** (+224 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/fspx.md` (+9 -0) 📝 `tests/semantic/test_alu_dot4_i8.py` (+2 -1) ➕ `tests/semantic/test_fspx_dot4_op_sel_disasm.py` (+157 -0) 📝 `tools/shader_disasm.py` (+56 -0) </details> ### 📄 Description ## Summary Coordination item: `OLD-10010` (carry-forward of `old-pr/10010`, preserving original author `tedin7`). ### Problem & Root Cause `llvm-mc` rejects `v_dot4_i32_i8` VOP3P words encoded with `op_sel: 2` (`[0,1,0]`) and `op_sel_hi: 5` (`[1,0,1]`), which appear in the FidelityFX upscaler's FSPX programs (`docs/fspx.md`), preventing those programs from disassembling and translating cleanly. ### Implementation - Adds `DOT4_I8_OPCODE`, `dot4_op_sel_words()`, and `with_dot4_op_sel()` in `tools/shader_disasm.py` to patch rejected `v_dot4_i32_i8` `op_sel=2 / op_sel_hi=5` words to defaults (`op_sel=0 / op_sel_hi=7`) for `llvm-mc` disassembly and restore `op_sel:[0,1,0] op_sel_hi:[1,0,1]` and the original encoding bytes on the resulting instruction lines. - Preserves `main`'s `with_vopc_dpp()` fallback pass cleanly alongside `with_dot4_op_sel()` in `disasm()`. - Documents the behavior in `docs/fspx.md` and adds semantic/disassembly tests in `tests/semantic/test_fspx_dot4_op_sel_disasm.py` and `tests/semantic/test_alu_dot4_i8.py`. ## Tests Run Environment: Windows 11 Pro 64-bit, Python 3.12.10, synthetic fixtures only (no game data). - `python -I -m py_compile tools/shader_disasm.py tests/semantic/test_fspx_dot4_op_sel_disasm.py tests/semantic/test_alu_dot4_i8.py` — PASS - `python -I tests/semantic/test_alu_dot4_i8.py` — 12/12 PASS - `python -I tests/semantic/test_fspx_dot4_op_sel_disasm.py` — 4 skipped (no `llvm-mc` installed on this host); additionally verified `shader_disasm.dot4_op_sel_words()` and `shader_disasm.disasm()` fallback path with a mocked `run_mc` — PASS - `pytest tests/test_docs_links.py tests/test_text_write_line_endings.py -v` — 19/19 PASS - `python -I scripts/check_no_game_data.py docs/fspx.md tests/semantic/test_alu_dot4_i8.py tests/semantic/test_fspx_dot4_op_sel_disasm.py tools/shader_disasm.py` — PASS ## Disclosure AI-assisted: yes (carry-forward, rebase onto current `main` preserving `with_vopc_dpp`, and local verification; original implementation by tedin7). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:56 +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#1346
No description provided.