SDWA-LLVM19-ENC: recover native SDWA inline float listings #462

Manually merged
github merged 1 commit from gh-pr/462/head into gh-pr/462/base 2026-11-26 09:01:47 +00:00
Owner

@⁠bobcatchris on GitHub · 2026-11-24 05:45 UTC · original
bobcatchris:sdwa-llvm19 → main · +59 −3 · 3 files · 1 commits · merged 2026-11-24 06:33 UTC

Claimed in the coordination issue as: SDWA-LLVM19-ENC

What and why

LLVM 19 prints an eight-byte integer-to-half SDWA conversion as a twelve-byte instruction with an extra literal dword. check_printed_encodings then rejects ps_sdwa_f16_const at offset 0x190, and the same pattern affects the signed conversion. This recovers the native source operand and instruction width when the native opcode, selector, other bytes and printed literal agree, so the translator accepts the LLVM 19 listing while still rejecting a changed literal or selection field.

Carried from the source-only patch reported by @⁠Sigtryggur-Mani-Gudmundsson:
github.com/Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches@b17a81c3d9/tests/sdwa-inline

Only the SDWA commit from that mailbox is included; the unrelated permlane/null-export commit was dropped. No game data is included.

Tested

  • python -I tests/semantic/test_printed_encoding.py — 8 tests OK (7 on unpatched main; new case exercises the LLVM 19 listing)
  • python -I tests/test_rdna2_decode.py — 16 pass, 1 pre-existing cs_w32_permlane_fi op_sel failure that also fails on unpatched main
  • python -I scripts/run_semantic_tests.py tests/semantic — 465 files, 6105 tests; only test_image_cube_store_glc failed in this environment, also fails on unpatched main
  • python -m compileall -q tools tests — OK
  • git diff --check — clean
  • security sweep of the diff — 0 hits

The source report measured 4096/4096 pixels on an RTX 4070 Ti with LLVM 19.1.7, LLVM 23.1.5 and the Python decoder. I did not repeat that GPU measurement locally.

GPUs tested: n/a locally; source report used NVIDIA GeForce RTX 4070 Ti

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
  • Translator rule covered by a synthetic regression test.
**@⁠bobcatchris** on GitHub · 2026-11-24 05:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/462) `bobcatchris:sdwa-llvm19` → `main` · +59 −3 · 3 files · 1 commits · merged 2026-11-24 06:33 UTC Claimed in the coordination issue as: SDWA-LLVM19-ENC ### What and why LLVM 19 prints an eight-byte integer-to-half SDWA conversion as a twelve-byte instruction with an extra literal dword. `check_printed_encodings` then rejects `ps_sdwa_f16_const` at offset `0x190`, and the same pattern affects the signed conversion. This recovers the native source operand and instruction width when the native opcode, selector, other bytes and printed literal agree, so the translator accepts the LLVM 19 listing while still rejecting a changed literal or selection field. Carried from the source-only patch reported by @⁠Sigtryggur-Mani-Gudmundsson: https://github.com/Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches/tree/b17a81c3d9c0c36cf2da266e6a8a560f1f6e9b8a/tests/sdwa-inline Only the SDWA commit from that mailbox is included; the unrelated permlane/null-export commit was dropped. No game data is included. ### Tested - `python -I tests/semantic/test_printed_encoding.py` — 8 tests OK (7 on unpatched `main`; new case exercises the LLVM 19 listing) - `python -I tests/test_rdna2_decode.py` — 16 pass, 1 pre-existing `cs_w32_permlane_fi` `op_sel` failure that also fails on unpatched `main` - `python -I scripts/run_semantic_tests.py tests/semantic` — 465 files, 6105 tests; only `test_image_cube_store_glc` failed in this environment, also fails on unpatched `main` - `python -m compileall -q tools tests` — OK - `git diff --check` — clean - security sweep of the diff — 0 hits The source report measured 4096/4096 pixels on an RTX 4070 Ti with LLVM 19.1.7, LLVM 23.1.5 and the Python decoder. I did not repeat that GPU measurement locally. GPUs tested: n/a locally; source report used NVIDIA GeForce RTX 4070 Ti AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] Translator rule covered by a synthetic regression test.
LLVM 19 prints an 8-byte integer-to-half SDWA conversion as a 12-byte instruction with an extra literal dword. Recover the native source and byte length when the opcode, selector, other bytes and printed literal agree, and keep following instruction offsets correct.

Carried from the source-only patch by Sigtryggur-Mani-Gudmundsson:
b17a81c3d9/tests/sdwa-inline

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:01:46 +00:00
github manually merged commit c932457840 into gh-pr/462/base 2026-11-26 09:01:47 +00:00
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 06:33 UTC · original

Merging. Why merged: a translator fix with its encoding test.
Why it's good: security-reviewed (translator code and tests only). Tested on Windows 11 merged onto main 8f481cf: the printed-encoding, decode and SDWA tests 87 -> 88 passed (2668 -> 2672 subtests); the full semantic suite (-j 12) 6104 -> 6105 tests with the same 3 failing files on main and with this PR (image_cube_store_glc, sopc_validation, unary_f16_validation), and the one decode-parity failure (llvm-mc 23 op_sel printing) also fails on main, so nothing new breaks.

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

**@⁠QemmHD** on GitHub · 2026-11-24 06:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/462#issuecomment-7124049769) Merging. Why merged: a translator fix with its encoding test. Why it's good: security-reviewed (translator code and tests only). Tested on Windows 11 merged onto main 8f481cf: the printed-encoding, decode and SDWA tests 87 -> 88 passed (2668 -> 2672 subtests); the full semantic suite (-j 12) 6104 -> 6105 tests with the same 3 failing files on main and with this PR (image_cube_store_glc, sopc_validation, unary_f16_validation), and the one decode-parity failure (llvm-mc 23 op_sel printing) also fails on main, so nothing new breaks. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 07:37 UTC · original

Follow-up: merging this broke test_cmake_translator_deps, test_shader_stage_resume and test_runtime_paths on main, because tools/rdna2_decode.py and tools/rdna2_isa_tables.py weren't listed as translator inputs. My pre-merge check missed those three tests. Fixed by #529 (merged); I've added the repo-consistency tests to my pre-merge checks.

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

**@⁠QemmHD** on GitHub · 2026-11-24 07:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/462#issuecomment-7125201236) Follow-up: merging this broke test_cmake_translator_deps, test_shader_stage_resume and test_runtime_paths on main, because tools/rdna2_decode.py and tools/rdna2_isa_tables.py weren't listed as translator inputs. My pre-merge check missed those three tests. Fixed by #529 (merged); I've added the repo-consistency tests to my pre-merge checks. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.