[PR #850] rdna2spirv: 64-bit buffer addresses without Int64, so shaders run without shaderInt64 (SHADER-423) #888

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

📋 Pull Request Information

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

Base: main ← Head: shader/addr-no-int64


📝 Commits (6)

  • 4f2628f rdna2spirv: 64-bit buffer addresses without Int64 (SHADER-423)
  • 6112644 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64
  • da9e749 rdna2spirv: lower_addr64 takes the 48-bit sign extension's shifts by 16
  • 3677e32 Merge remote-tracking branch 'lc/main' into lc/addr-no-int64
  • c621105 rdna2spirv: lower_addr64 takes the swizzled offset's 64-bit multiply and variable left shift
  • 3f78e6d Merge remote-tracking branch 'lc/main' into lc/addr-no-int64

📊 Changes

11 files changed (+489 additions, -13 deletions)

View changed files

📝 docs/design.md (+1 -0)
📝 tests/semantic/spirv_mini_interp.py (+14 -0)
📝 tests/semantic/spirv_wave_interp.py (+9 -0)
➕ tests/semantic/test_addr64_lowering.py (+190 -0)
📝 tests/semantic/test_buffer_atomic_fminmax_and_align.py (+3 -1)
📝 tests/semantic/test_buffer_store_format.py (+3 -1)
📝 tests/semantic/test_loop_ballot_barrier.py (+8 -1)
📝 tests/semantic/test_wave64_emulate_opt.py (+13 -2)
📝 tests/test_rdna2spirv_xdxr_rules.py (+3 -3)
📝 tests/test_translate.py (+3 -1)
📝 tools/rdna2spirv.py (+242 -4)

📄 Description

Claimed in the coordination issue as: SHADER-423 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134292009), carried over from the upstream repository, where it was open with ten independent GPU test reports when the repository went private.

What and why

Translated shaders declared OpCapability Int64 only because of buffer addresses: the translator builds each PhysicalStorageBuffer address as a 64-bit integer (zero-extend, shift by 32, OR, add an offset, convert to pointer). A device without shaderInt64 (Intel) refuses every such module, although the shader's own arithmetic is 32-bit.

lower_addr64 (tools/rdna2spirv.py, run in assemble() on the finished module text) rewrites that address arithmetic into pairs of 32-bit words: adds and subtracts through OpIAddCarry / OpISubBorrow, the shift-by-32 / OR / AND / narrowing / sign-extension / 64-bit bitcast forms the address idiom uses, pair compares, and OpConvertUToPtr of a 64-bit value as OpBitcast of a two-component uint vector to the pointer. A value is either lowered completely or left alone; when nothing 64-bit remains, the Int64 capability is dropped. Shaders that use 64-bit integers as data keep it. --int64-addresses keeps the previous form.

Also in this PR: tests/semantic/test_addr64_lowering.py (7 tests, including negative offsets through global_load), the two test interpreters learn the pair pointer form, six existing tests accept either address form, and the docs/design.md contract row "64-bit addresses without Int64".

Tested

On main d0da7dade, Windows 11 26200, llvm-mc 23.1.6, Vulkan SDK 1.4.363, MSVC 14.44:

  • Touched semantic files: test_addr64_lowering 7, test_buffer_atomic_fminmax_and_align 10, test_buffer_store_format 39, test_loop_ballot_barrier 15, test_wave64_emulate_opt 31, all OK. pytest tests/test_translate.py tests/test_rdna2spirv_xdxr_rules.py: 675 passed.
  • scripts/run_gpu_tests.py, test programs built from this head: 258 of 258 shaders translate and pass spirv-val; 198/249 passed, 49 skipped, 2 failed. The two failures, cs_imgload_tfe and cs_imgload_d16_tfe, fail identically with this main's own translator on the same programs (--filter cs_imgload: 2/4 both ways, same texel values), so they are not from this change.
  • Upstream, the same diff (it applies to this main without conflicts) was run by ten independent testers with no regression against their main: NVIDIA RTX 2060, 4080, 5080, 5090; AMD RX 5700 XT (RDNA1), RX 6800 and a Steam Deck (RDNA2), RX 9070 XT (RDNA4), gfx1036 iGPUs on the Windows driver; Windows, Linux/RADV.
  • Not tested here: an Intel GPU. The change is what makes that possible; I have none.

GPUs tested: NVIDIA RTX 5070 Ti, driver 621.24, Windows 11

AI-assisted: yes (Claude Code); built and tested on the machine above.

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.

🔄 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/850 **Author:** [@c4k3ss](https://github.com/c4k3ss) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `shader/addr-no-int64` --- ### 📝 Commits (6) - [`4f2628f`](https://github.com/ubiquitarianism/leonida/commit/4f2628f83f390e0d25b30bf15718dbbd02852517) rdna2spirv: 64-bit buffer addresses without Int64 (SHADER-423) - [`6112644`](https://github.com/ubiquitarianism/leonida/commit/61126446068a14e1b10be64b042ddb67582f8d77) Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 - [`da9e749`](https://github.com/ubiquitarianism/leonida/commit/da9e7492b207edf29ba96fa156b0d4f9f0105182) rdna2spirv: lower_addr64 takes the 48-bit sign extension's shifts by 16 - [`3677e32`](https://github.com/ubiquitarianism/leonida/commit/3677e3217a2dc2a6c62228a91196c5c911095704) Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 - [`c621105`](https://github.com/ubiquitarianism/leonida/commit/c621105e6f317893a818c385b63d908c51557ed5) rdna2spirv: lower_addr64 takes the swizzled offset's 64-bit multiply and variable left shift - [`3f78e6d`](https://github.com/ubiquitarianism/leonida/commit/3f78e6d022885a4a61b5fb9f37c2c676ce710dde) Merge remote-tracking branch 'lc/main' into lc/addr-no-int64 ### 📊 Changes **11 files changed** (+489 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) 📝 `tests/semantic/spirv_mini_interp.py` (+14 -0) 📝 `tests/semantic/spirv_wave_interp.py` (+9 -0) ➕ `tests/semantic/test_addr64_lowering.py` (+190 -0) 📝 `tests/semantic/test_buffer_atomic_fminmax_and_align.py` (+3 -1) 📝 `tests/semantic/test_buffer_store_format.py` (+3 -1) 📝 `tests/semantic/test_loop_ballot_barrier.py` (+8 -1) 📝 `tests/semantic/test_wave64_emulate_opt.py` (+13 -2) 📝 `tests/test_rdna2spirv_xdxr_rules.py` (+3 -3) 📝 `tests/test_translate.py` (+3 -1) 📝 `tools/rdna2spirv.py` (+242 -4) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-423 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134292009), carried over from the upstream repository, where it was open with ten independent GPU test reports when the repository went private. ### What and why Translated shaders declared `OpCapability Int64` only because of buffer addresses: the translator builds each PhysicalStorageBuffer address as a 64-bit integer (zero-extend, shift by 32, OR, add an offset, convert to pointer). A device without `shaderInt64` (Intel) refuses every such module, although the shader's own arithmetic is 32-bit. `lower_addr64` (`tools/rdna2spirv.py`, run in `assemble()` on the finished module text) rewrites that address arithmetic into pairs of 32-bit words: adds and subtracts through `OpIAddCarry` / `OpISubBorrow`, the shift-by-32 / OR / AND / narrowing / sign-extension / 64-bit bitcast forms the address idiom uses, pair compares, and `OpConvertUToPtr` of a 64-bit value as `OpBitcast` of a two-component `uint` vector to the pointer. A value is either lowered completely or left alone; when nothing 64-bit remains, the `Int64` capability is dropped. Shaders that use 64-bit integers as data keep it. `--int64-addresses` keeps the previous form. Also in this PR: `tests/semantic/test_addr64_lowering.py` (7 tests, including negative offsets through `global_load`), the two test interpreters learn the pair pointer form, six existing tests accept either address form, and the `docs/design.md` contract row "64-bit addresses without `Int64`". ### Tested On `main` `d0da7dade`, Windows 11 26200, llvm-mc 23.1.6, Vulkan SDK 1.4.363, MSVC 14.44: - Touched semantic files: `test_addr64_lowering` 7, `test_buffer_atomic_fminmax_and_align` 10, `test_buffer_store_format` 39, `test_loop_ballot_barrier` 15, `test_wave64_emulate_opt` 31, all OK. `pytest tests/test_translate.py tests/test_rdna2spirv_xdxr_rules.py`: 675 passed. - `scripts/run_gpu_tests.py`, test programs built from this head: 258 of 258 shaders translate and pass `spirv-val`; 198/249 passed, 49 skipped, 2 failed. The two failures, `cs_imgload_tfe` and `cs_imgload_d16_tfe`, fail identically with this `main`'s own translator on the same programs (`--filter cs_imgload`: 2/4 both ways, same texel values), so they are not from this change. - Upstream, the same diff (it applies to this `main` without conflicts) was run by ten independent testers with no regression against their `main`: NVIDIA RTX 2060, 4080, 5080, 5090; AMD RX 5700 XT (RDNA1), RX 6800 and a Steam Deck (RDNA2), RX 9070 XT (RDNA4), gfx1036 iGPUs on the Windows driver; Windows, Linux/RADV. - Not tested here: an Intel GPU. The change is what makes that possible; I have none. GPUs tested: NVIDIA RTX 5070 Ti, driver 621.24, Windows 11 AI-assisted: yes (Claude Code); built and tested on the machine above. ### 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. --- <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#888
No description provided.