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

Merged
bobcatchris merged 1 commit from upstream-pr/462 into main 2026-11-24 06:33:08 +00:00
bobcatchris commented 2026-11-24 05:45:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by bobcatchris on 2026-11-24T05:45:16Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5466827455 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/462). Originally posted by [bobcatchris](https://github.com/bobcatchris) on 2026-11-24T05:45:16Z. --- 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.
QemmHD commented 2026-11-24 06:33:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T06:33:06Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7124049769 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/462#issuecomment-7124049769). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T06:33:06Z. --- 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 commented 2026-11-24 07:37:59 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T07:37:59Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7125201236 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/462#issuecomment-7125201236). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-24T07:37:59Z. --- 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).
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!462
No description provided.