[PR #978] rdna2spirv: sign-extend 32-bit literals in s_ashr_i64, s_bfe_i64, s_flbit_i32_i64 (SHADER-SALU-LITERAL-SEXT) #1017

Open
opened 2026-11-26 20:19:48 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/978
Author: @OlaiFG7
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: worktree-agent-a0eac686e6011802d


📝 Commits (1)

  • baee47d rdna2spirv: sign-extend the 32-bit literal of s_ashr_i64, s_bfe_i64, s_flbit_i32_i64 (SHADER-SALU-LITERAL-SEXT)

📊 Changes

3 files changed (+145 additions, -3 deletions)

View changed files

📝 docs/design.md (+1 -0)
➕ tests/semantic/test_salu_signed_literal64.py (+130 -0)
📝 tools/rdna2spirv.py (+14 -3)

📄 Description

Claimed in the coordination issue as: SHADER-SALU-LITERAL-SEXT (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136924696)

What and why

s_ashr_i64, s_bfe_i64 and s_flbit_i32_i64 now sign-extend a 32-bit SALU literal (Gen.imm64_signed). llvm-mc prints -100 as 0xffffff9c; the translator zero-extended it, so s_flbit_i32_i64 s8, 0xffffff9c gave 32 instead of 57 and s_ashr_i64/s_bfe_i64 gave 0 instead of all-ones. Unsigned ops still zero-extend. Finding by akimfomin in #14.

  • docs/design.md: contract-table row, confirmed by the CPU test and the llvm-mc encoding in the finding; not measured on hardware.
  • tests/semantic/test_salu_signed_literal64.py: hand-written, no game data; fails 3/5 on main, passes 5/5.

Touches the same op families as #212 / #224 (SHADER-930); a rebase conflict should be trivial.

Tested

Semantic suite: 470 files, 6148 tests; only test_sopc_validation and test_unary_f16_validation fail, because spirv-as/spirv-val are not installed here. No GPU run, no corpus count (no game files). Windows 11, CPU only.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly
  • One topic
  • No game data, keys or decryption
  • New translator rule is in the contract table of docs/design.md

🤖 Generated with Claude Code


🔄 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/978 **Author:** [@OlaiFG7](https://github.com/OlaiFG7) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `worktree-agent-a0eac686e6011802d` --- ### 📝 Commits (1) - [`baee47d`](https://github.com/ubiquitarianism/leonida/commit/baee47d7a5075360ff70171c37331fd2fbc64cc0) rdna2spirv: sign-extend the 32-bit literal of s_ashr_i64, s_bfe_i64, s_flbit_i32_i64 (SHADER-SALU-LITERAL-SEXT) ### 📊 Changes **3 files changed** (+145 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) ➕ `tests/semantic/test_salu_signed_literal64.py` (+130 -0) 📝 `tools/rdna2spirv.py` (+14 -3) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-SALU-LITERAL-SEXT (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7136924696) ### What and why `s_ashr_i64`, `s_bfe_i64` and `s_flbit_i32_i64` now sign-extend a 32-bit SALU literal (`Gen.imm64_signed`). llvm-mc prints `-100` as `0xffffff9c`; the translator zero-extended it, so `s_flbit_i32_i64 s8, 0xffffff9c` gave 32 instead of 57 and `s_ashr_i64`/`s_bfe_i64` gave 0 instead of all-ones. Unsigned ops still zero-extend. Finding by akimfomin in #14. - `docs/design.md`: contract-table row, confirmed by the CPU test and the llvm-mc encoding in the finding; not measured on hardware. - `tests/semantic/test_salu_signed_literal64.py`: hand-written, no game data; fails 3/5 on main, passes 5/5. Touches the same op families as #212 / #224 (SHADER-930); a rebase conflict should be trivial. ### Tested Semantic suite: 470 files, 6148 tests; only `test_sopc_validation` and `test_unary_f16_validation` fail, because `spirv-as`/`spirv-val` are not installed here. No GPU run, no corpus count (no game files). Windows 11, CPU only. GPUs tested: n/a AI-assisted: yes ### Checklist - [ ] Based on current `main` and merges cleanly - [x] One topic - [x] No game data, keys or decryption - [x] New translator rule is in the contract table of `docs/design.md` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#1017
No description provided.