rdna2spirv: restore the dot4 inline op_sel_hi under exact re-anchoring too (SHADER-FSPX-DOT4-EXACT) #1862

Closed
github-bot wants to merge 1 commit from gh-pr/1862/head into gh-pr/1862/base
Owner

@⁠Coderlord on GitHub · 2026-11-25 13:23 UTC · original
Coderlord:fspx-dot4-exact → main · +49 −1 · 2 files · 1 commits · closed without merging

Claimed in the coordination issue as: SHADER-FSPX-DOT4-EXACT (#1608)

What and why

A listing whose undecodable words sit at offsets its llvm-mc messages name is re-anchored exactly
(invalid_at, from #984). That branch of translate tried the v_fma_mix literal restores but not
restore_dot4_inline_sel, which the forward-search branch and check_printed_encodings both try. So a
v_dot4_i32_i8 whose src1 is a replicated inline integer (llvm-mc prints op_sel_hi[1] set where the program's
word has it clear) was marked normalized, and the whole program was refused as "reachable instruction with
normalized encoding".

llvm-mc 23.1.6 names every word it rejects, so two of the 29 FSPX programs of the FidelityFX DLL take that branch and
did not translate. The title then has no pipeline for one of them, and the DLL reads through the missing object
(an access violation at amd_fidelityfx_upscaler_xbox.dll+0x65ff, about 50 s after the first-run setup is
confirmed, native Windows). The fix is one condition: the exact branch tries restore_dot4_inline_sel before the
literal restores, as the other two paths do.

Tested

  • FSPX step (rdna2spirv.py <work>/shaders/fspx/disasm --no-asm --wave64-emulate) with llvm-mc 23.1.6 (conda-forge
    llvm-tools): 27 of 29 translated and passing spirv-val on main 98c2f7777, 29 of 29 with this change.
    The other 6 FSPX programs with rejected words (the dot4 forms #984 recovers) translate either way.
  • python -I tests/test_rdna2spirv_decode.py: 26 tests OK. The new
    test_exact_anchoring_restores_dot4_inline_sel (one rejected word at a known offset after s_endpgm, a dot4
    printed with the default op_sel_hi) passes with the change and fails without it with "reachable instruction with
    normalized encoding".
  • Retail boots on this card (native Windows, ubiq main ed94fbef9 + #1768): without this change the process
    died 50 s after the first-run setup was confirmed, in amd_fidelityfx_upscaler_xbox.dll+0x65ff (a read at
    0x10), right after the runtime logged "no translated compute shader for FSPX" for one of the two programs and
    refused its pipeline (E_INVALIDARG). With the 29 retranslated, the next boot logged no missing FSPX program
    and did not fault in the DLL; it went on to a later, unrelated stop (a lost device about 75 s into the session).

GPUs tested: NVIDIA GeForce RTX 5080, driver 621.24, Windows 11 Pro 26300

AI-assisted: yes (Claude Code)

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. (n/a: an
    existing restore applied in one more branch, no new rule)
**@⁠Coderlord** on GitHub · 2026-11-25 13:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862) `Coderlord:fspx-dot4-exact` → `main` · +49 −1 · 2 files · 1 commits · closed without merging Claimed in the coordination issue as: SHADER-FSPX-DOT4-EXACT (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why A listing whose undecodable words sit at offsets its llvm-mc messages name is re-anchored exactly (`invalid_at`, from #984). That branch of `translate` tried the `v_fma_mix` literal restores but not `restore_dot4_inline_sel`, which the forward-search branch and `check_printed_encodings` both try. So a `v_dot4_i32_i8` whose src1 is a replicated inline integer (llvm-mc prints `op_sel_hi[1]` set where the program's word has it clear) was marked normalized, and the whole program was refused as "reachable instruction with normalized encoding". llvm-mc 23.1.6 names every word it rejects, so two of the 29 FSPX programs of the FidelityFX DLL take that branch and did not translate. The title then has no pipeline for one of them, and the DLL reads through the missing object (an access violation at `amd_fidelityfx_upscaler_xbox.dll+0x65ff`, about 50 s after the first-run setup is confirmed, native Windows). The fix is one condition: the exact branch tries `restore_dot4_inline_sel` before the literal restores, as the other two paths do. ### Tested - FSPX step (`rdna2spirv.py <work>/shaders/fspx/disasm --no-asm --wave64-emulate`) with llvm-mc 23.1.6 (conda-forge `llvm-tools`): **27 of 29** translated and passing spirv-val on `main` 98c2f7777, **29 of 29** with this change. The other 6 FSPX programs with rejected words (the dot4 forms #984 recovers) translate either way. - `python -I tests/test_rdna2spirv_decode.py`: 26 tests OK. The new `test_exact_anchoring_restores_dot4_inline_sel` (one rejected word at a known offset after `s_endpgm`, a dot4 printed with the default op_sel_hi) passes with the change and fails without it with "reachable instruction with normalized encoding". - Retail boots on this card (native Windows, ubiq `main` ed94fbef9 + #1768): without this change the process died 50 s after the first-run setup was confirmed, in `amd_fidelityfx_upscaler_xbox.dll+0x65ff` (a read at 0x10), right after the runtime logged "no translated compute shader for FSPX" for one of the two programs and refused its pipeline (`E_INVALIDARG`). With the 29 retranslated, the next boot logged no missing FSPX program and did not fault in the DLL; it went on to a later, unrelated stop (a lost device about 75 s into the session). GPUs tested: NVIDIA GeForce RTX 5080, driver 621.24, Windows 11 Pro 26300 AI-assisted: yes (Claude Code) ### 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. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: an existing restore applied in one more branch, no new rule)
A listing whose undecodable words sit at offsets its llvm-mc messages name is re-anchored exactly (#984's
invalid_at). That branch tried the v_fma_mix literal restores but not restore_dot4_inline_sel, which the search
branch and check_printed_encodings both try, so a v_dot4_i32_i8 whose src1 is a replicated inline integer (llvm-mc
prints op_sel_hi[1] set where the program's word has it clear) was marked normalized and the program refused as
"reachable instruction with normalized encoding".

llvm-mc 23.1.6 names every rejected word, so two of the 29 FSPX programs of the FidelityFX DLL took that branch and
did not translate (27 of 29). The title then had no pipeline for one of them at the start of the story, and the DLL
read through the missing object (an access violation at amd_fidelityfx_upscaler_xbox.dll+0x65ff, 50 s after the
first-run setup, native Windows, RTX 5080). With the restore the FSPX step translates 29 of 29, all passing
spirv-val.

test_rdna2spirv_decode: a listing with one rejected word at a known offset after s_endpgm and a dot4 printed with the
default op_sel_hi translates (it raised before).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:09:11 +00:00
github-bot closed this pull request 2026-11-26 10:09:11 +00:00
Author
Owner

@⁠potatoe0100 on GitHub · 2026-11-25 13:58 UTC · original

Tested merged onto main 384abe5b (Linux, Python 3.13): tests/test_rdna2spirv_decode.py passes, and the whole tests/semantic suite gives 489 files, 6288 tests, with only test_int32_to_f64 failing (Ubuntu's spirv-opt segfaults, same on main). The new call matches the two existing restore_dot4_inline_sel call sites, and the helper only accepts the case it describes (v_dot4_i32_i8, inline-integer src1, printed bytes equal to the stored ones plus op_sel_hi bit 28), so I don't see it widening anything else.

AI-assisted (Claude).

**@⁠potatoe0100** on GitHub · 2026-11-25 13:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7164555386) Tested merged onto `main` 384abe5b (Linux, Python 3.13): `tests/test_rdna2spirv_decode.py` passes, and the whole `tests/semantic` suite gives 489 files, 6288 tests, with only `test_int32_to_f64` failing (Ubuntu's `spirv-opt` segfaults, same on `main`). The new call matches the two existing `restore_dot4_inline_sel` call sites, and the helper only accepts the case it describes (v_dot4_i32_i8, inline-integer src1, printed bytes equal to the stored ones plus op_sel_hi bit 28), so I don't see it widening anything else. AI-assisted (Claude).
Author
Owner

@⁠Snooozs on GitHub · 2026-11-25 14:21 UTC · original

Confirmed on a second machine, tools of main 71a769d7d with and without this change, FSPX step run on its own (fspx_unpack.py --disasm, then rdna2spirv.py --no-asm --wave64-emulate), Windows 10 Pro 19045, Python 3.12.10:

llvm-mc main with #1862
23.1.6 27 of 29, 27 pass spirv-val 29 of 29, 29 pass spirv-val
21.1.8 22 of 29 (2 normalized, 5 fall-through) 24 of 29 (5 fall-through)
  • With 23.1.6 the 27 programs that already translated are byte-identical with and without the change.
  • All 29 are also byte-identical to a set I made earlier with another local fix (the shader_disasm op_sel listing of old #281), so the two routes agree.
  • That earlier set is what removed the amd_fidelityfx_upscaler_xbox.dll+0x65ff fault in my retail boots (RTX 5060 Ti, NVIDIA 621.01): the boot with 27 of 29 stopped there at 152 s, the next one with 29 of 29 went past it and stopped later at the world-start device loss. I have not booted with this branch itself.
  • With llvm-mc 21.1.8 the 5 "fall-through into undecodable words" programs remain, which is outside this change; 23.1.6 decodes them.

Counts only, no game data. AI-assisted (Claude Code).

**@⁠Snooozs** on GitHub · 2026-11-25 14:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7165142630) Confirmed on a second machine, tools of `main` 71a769d7d with and without this change, FSPX step run on its own (`fspx_unpack.py --disasm`, then `rdna2spirv.py --no-asm --wave64-emulate`), Windows 10 Pro 19045, Python 3.12.10: | llvm-mc | `main` | with #1862 | |---|---|---| | 23.1.6 | 27 of 29, 27 pass spirv-val | **29 of 29, 29 pass spirv-val** | | 21.1.8 | 22 of 29 (2 normalized, 5 fall-through) | 24 of 29 (5 fall-through) | - With 23.1.6 the 27 programs that already translated are byte-identical with and without the change. - All 29 are also byte-identical to a set I made earlier with another local fix (the `shader_disasm` op_sel listing of old #281), so the two routes agree. - That earlier set is what removed the `amd_fidelityfx_upscaler_xbox.dll+0x65ff` fault in my retail boots (RTX 5060 Ti, NVIDIA 621.01): the boot with 27 of 29 stopped there at 152 s, the next one with 29 of 29 went past it and stopped later at the world-start device loss. I have not booted with this branch itself. - With llvm-mc 21.1.8 the 5 "fall-through into undecodable words" programs remain, which is outside this change; 23.1.6 decodes them. Counts only, no game data. AI-assisted (Claude Code).
Author
Owner

@⁠BubsMcgee on GitHub · 2026-11-25 15:12 UTC · original

Tested on RTX 3080 Ti / Windows 11 / NVIDIA 616.64: this takes the FidelityFX FSPX set from 27 to 29 (rdna2spirv.py <fspx>/disasm --out <spirv>/fspx --no-asm --wave64-emulate), 29/29 pass spirv-val. On a retail boot with the 29, no translated compute shader for FSPX and the amd_fidelityfx_upscaler_xbox.dll+0x65ff AV are gone; the run stays at session d to t=195 s and the next stop is the known world-start device loss (#1537/#1602, lib_cs_01725/01726/01728). AI-assisted.

**@⁠BubsMcgee** on GitHub · 2026-11-25 15:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7166466123) Tested on RTX 3080 Ti / Windows 11 / NVIDIA 616.64: this takes the FidelityFX FSPX set from 27 to 29 (`rdna2spirv.py <fspx>/disasm --out <spirv>/fspx --no-asm --wave64-emulate`), 29/29 pass `spirv-val`. On a retail boot with the 29, `no translated compute shader for FSPX` and the `amd_fidelityfx_upscaler_xbox.dll+0x65ff` AV are gone; the run stays at session `d` to t=195 s and the next stop is the known world-start device loss (#1537/#1602, `lib_cs_01725/01726/01728`). AI-assisted.
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-25 15:32 UTC · original

Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

python -m pytest -q tests/test_rdna2spirv_decode.py:

  • PR: 26 passed, 102 subtests passed. main: 25 passed, 102 subtests passed. The new test passes on Windows.

(AI-assisted test run; output checked by hand.)

**@⁠DeadlyChirp** on GitHub · 2026-11-25 15:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7166995151) Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. `python -m pytest -q tests/test_rdna2spirv_decode.py`: - PR: 26 passed, 102 subtests passed. main: 25 passed, 102 subtests passed. The new test passes on Windows. (AI-assisted test run; output checked by hand.)
Author
Owner

@⁠BubsMcgee on GitHub · 2026-11-25 18:08 UTC · original

Independent check on this PR — RTX 3080 Ti (616.64), Windows 11, LLVM 23.1.5 (the repo's documented llvm-mc; MSYS2).

  • I fetched this head (e88177e53) from refs/pull/1862/head and ran the translator on the port's FSPX set: 29 of 29 translated, 29 pass spirv-val. On plain main b9320a118 the same .s/blobs give 27. The two programs include the register-S1 form (amd_fidelityfx_upscaler_xbox_03: S1 is VGPR 10, stored op_sel_hi[1]=0, printed 1), so this PR closes them on 23.1.5 too — not only the inline-S1 one it names. That S1-range check is what the two open siblings (#1301's limit and #1662, whose test says a register S1 is still refused) leave in place; #1495's generalized restore covers the same forms.
  • Boot with the 29-program FSPX (240 s, #1592's fspx_gfx stack, LEONIDA_LOCAL_DIAGNOSTICS=0): the FSR4 DLL creates all 29 compute PSOs ("compute PSO created via ACO ('ACCC')"), with no DeserializeComputePipelineStateX FAILED, no CreateModel assertion, no +0x65ff access violation. Session d, 4,904 presents, 40/40 non-black, run reaches t=216 s.
  • Tests: the new exact-anchor test passes; test_alu_dot4_i8.py 15/15 with a hand-built VGPR-S1 case (the stored selector reads S1's low half: 56, not 70; clean and exact paths); run_semantic_tests.py: 490 files, 6,293 tests, 0 failed (278 s, 16 jobs).

The next stop is not this PR: after ~216 s, VK_ERROR_DEVICE_LOST on pipeline-library compute (library/lib_cs_02996), the 0x380 / 63,632-page XMem pool window with no GPU mapping (QemmHD's finding in #1608), then a title breakpoint. Snooozs' run 2 in #1608 has the same order (29/29 → device lost). This PR is the FSR4 unlock; the pool-window mapping (RT-GPU-WINDOW-SPARSE / title-memory) is the next one.

AI-assisted.

**@⁠BubsMcgee** on GitHub · 2026-11-25 18:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7170501594) Independent check on this PR — RTX 3080 Ti (616.64), Windows 11, **LLVM 23.1.5** (the repo's documented llvm-mc; MSYS2). - I fetched this head (e88177e53) from `refs/pull/1862/head` and ran the translator on the port's FSPX set: **29 of 29** translated, 29 pass `spirv-val`. On plain main b9320a118 the same `.s`/blobs give 27. The two programs include the **register-S1** form (`amd_fidelityfx_upscaler_xbox_03`: S1 is VGPR 10, stored `op_sel_hi[1]=0`, printed 1), so this PR closes them on 23.1.5 too — not only the inline-S1 one it names. That S1-range check is what the two open siblings (#1301's limit and #1662, whose test says a register S1 is still refused) leave in place; #1495's generalized restore covers the same forms. - Boot with the 29-program FSPX (240 s, #1592's `fspx_gfx` stack, `LEONIDA_LOCAL_DIAGNOSTICS=0`): the FSR4 DLL creates **all 29** compute PSOs ("compute PSO created via ACO ('ACCC')"), with no `DeserializeComputePipelineStateX FAILED`, no `CreateModel` assertion, no `+0x65ff` access violation. Session `d`, 4,904 presents, 40/40 non-black, run reaches t=216 s. - Tests: the new exact-anchor test passes; `test_alu_dot4_i8.py` 15/15 with a hand-built VGPR-S1 case (the stored selector reads S1's low half: 56, not 70; clean and exact paths); `run_semantic_tests.py`: 490 files, 6,293 tests, 0 failed (278 s, 16 jobs). The next stop is not this PR: after ~216 s, `VK_ERROR_DEVICE_LOST` on pipeline-library compute (`library/lib_cs_02996`), the 0x380 / 63,632-page XMem pool window with no GPU mapping (QemmHD's finding in #1608), then a title breakpoint. Snooozs' run 2 in #1608 has the same order (29/29 → device lost). This PR is the FSR4 unlock; the pool-window mapping (RT-GPU-WINDOW-SPARSE / title-memory) is the next one. AI-assisted.
Author
Owner

@⁠Tyrannys on GitHub · 2026-11-25 20:15 UTC · original

Heads-up for review: this overlaps #1662 (SHADER-DOT4-SEL-EXACT-ANCHOR, claimed in #1608 at 07:3x today, opened 07:29). Both add the same repair: restore_dot4_inline_sel tried in the exact re-anchor path before the word is marked normalized. #1662 also adds a semantic fixture (tests/semantic/test_reanchor_dot4_inline_sel.py, which fails on main and passes with the fix) and extends the contract row in docs/design.md; this PR adds a unit test in tests/test_rdna2spirv_decode.py. Only one of the two should land, so a maintainer only has to review one. If your test covers a case #1662's doesn't, I'm happy to take it into #1662 with credit, or to close #1662 if this one is preferred.

AI-assisted (Claude Code).

**@⁠Tyrannys** on GitHub · 2026-11-25 20:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7173411341) Heads-up for review: this overlaps #1662 (SHADER-DOT4-SEL-EXACT-ANCHOR, claimed in #1608 at 07:3x today, opened 07:29). Both add the same repair: `restore_dot4_inline_sel` tried in the exact re-anchor path before the word is marked normalized. #1662 also adds a semantic fixture (`tests/semantic/test_reanchor_dot4_inline_sel.py`, which fails on `main` and passes with the fix) and extends the contract row in `docs/design.md`; this PR adds a unit test in `tests/test_rdna2spirv_decode.py`. Only one of the two should land, so a maintainer only has to review one. If your test covers a case #1662's doesn't, I'm happy to take it into #1662 with credit, or to close #1662 if this one is preferred. AI-assisted (Claude Code).
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-25 21:02 UTC · original

Small addition for llvm-mc 21.1.8 users (Windows 11, llvm-mc 21.1.8 under WSL): the 22 -> 24 reported above for 21.1.8 was on an older main. On current main (db1a22d29) 21.1.8 gives 27 of 29, and main with this PR merged gives 29 of 29 (all pass spirv-val; the 27 that already translated are byte-identical). The PR head alone (e88177e53, based on 384abe5b0) still gives 24 of 29 with 21.1.8, so with that llvm-mc test it merged into main.

  • Mutation: with the added not restore_dot4_inline_sel(ins, window, enc) condition replaced by True, the PR's new test in tests/test_rdna2spirv_decode.py fails (1 failed, 25 passed), so the test covers the change.

Counts only, no game data.

AI-assisted: yes (Claude Code ran the translation and the tests)

**@⁠MoonEyes** on GitHub · 2026-11-25 21:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7174535552) Small addition for llvm-mc 21.1.8 users (Windows 11, llvm-mc 21.1.8 under WSL): the 22 -> 24 reported above for 21.1.8 was on an older main. On current main (`db1a22d29`) 21.1.8 gives 27 of 29, and **main with this PR merged gives 29 of 29** (all pass `spirv-val`; the 27 that already translated are byte-identical). The PR head alone (`e88177e53`, based on `384abe5b0`) still gives 24 of 29 with 21.1.8, so with that llvm-mc test it merged into main. - Mutation: with the added `not restore_dot4_inline_sel(ins, window, enc)` condition replaced by `True`, the PR's new test in `tests/test_rdna2spirv_decode.py` fails (1 failed, 25 passed), so the test covers the change. Counts only, no game data. AI-assisted: yes (Claude Code ran the translation and the tests)
Author
Owner

@⁠Coderlord on GitHub · 2026-11-25 23:17 UTC · original

Note: #2138 (RT-BOOT-COMBINED, open) carries #1495's restore_dot4_op_sel, which replaces restore_dot4_inline_sel and is already tried in the exact re-anchoring branch. On #2138's head the 29 FSPX programs translate 29 of 29 with llvm-mc 23.1.6 (RTX 5080, Windows 11), and this PR's new test test_exact_anchoring_restores_dot4_inline_sel passes there without this PR's code change. So if #2138 lands first, this PR reduces to that regression test, and I'm happy to close it or trim it to the test, whichever you prefer.

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

**@⁠Coderlord** on GitHub · 2026-11-25 23:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7177376259) Note: #2138 (RT-BOOT-COMBINED, open) carries #1495's `restore_dot4_op_sel`, which replaces `restore_dot4_inline_sel` and is already tried in the exact re-anchoring branch. On #2138's head the 29 FSPX programs translate 29 of 29 with llvm-mc 23.1.6 (RTX 5080, Windows 11), and this PR's new test `test_exact_anchoring_restores_dot4_inline_sel` passes there without this PR's code change. So if #2138 lands first, this PR reduces to that regression test, and I'm happy to close it or trim it to the test, whichever you prefer. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 01:57 UTC · original

Thanks for this! Closing as a duplicate of #1662, merged as 88b290fcb: it adds the same restore_dot4_inline_sel repair to the exact re-anchor's window check, so the FSPX v_dot4_i32_i8 with a replicated inline integer is no longer refused there.

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

**@⁠aslan2142** on GitHub · 2026-11-26 01:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1862#issuecomment-7180323406) Thanks for this! Closing as a duplicate of #1662, merged as `88b290fcb`: it adds the same `restore_dot4_inline_sel` repair to the exact re-anchor's window check, so the FSPX `v_dot4_i32_i8` with a replicated inline integer is no longer refused there. AI-assisted (Claude Code, Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.