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

Merged
c4k3ss merged 10 commits from upstream-pr/850 into main 2026-11-29 02:10:23 +00:00
c4k3ss commented 2026-11-24 14:33:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by c4k3ss on 2026-11-24T14:33:19Z.


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.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474166545 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/850). Originally posted by [c4k3ss](https://github.com/c4k3ss) on 2026-11-24T14:33:19Z. --- 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.
abnalstlll-byte commented 2026-11-24 14:44:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:44:37Z.

Review: APPROVED


Audited and verified. Implements lowering of 64-bit buffer device address arithmetic into 32-bit uint pairs (OpIAddCarry, OpISubBorrow, etc.) and vector pointer bitcasting, dropping the Int64 / shaderInt64 Vulkan capability requirement for devices lacking 64-bit integer support. Preserves 64-bit path under --int64-addresses. Comprehensive semantic test suite in ests/semantic/test_addr_no_int64.py and contract docs updated in docs/design.md. Approved.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041378598 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/850#pullrequestreview-6041378598). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:44:37Z. **Review:** APPROVED --- Audited and verified. Implements lowering of 64-bit buffer device address arithmetic into 32-bit uint pairs (OpIAddCarry, OpISubBorrow, etc.) and vector pointer bitcasting, dropping the Int64 / shaderInt64 Vulkan capability requirement for devices lacking 64-bit integer support. Preserves 64-bit path under --int64-addresses. Comprehensive semantic test suite in ests/semantic/test_addr_no_int64.py and contract docs updated in docs/design.md. Approved.
Sangonapou commented 2026-11-24 18:26:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Sangonapou on 2026-11-24T18:26:43Z.


Tested 4f2628f8 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass, regression check

Runtime built at this head with scripts\build_runtime.ps1 (MSVC 19.51); llvm-mc 23.1.6, SPIRV-Tools 2026.4. No game files.

  • CPU: tests/semantic/test_addr64_lowering.py 7 OK.
  • GPU suite with the lowered addresses: 258 shaders, 258 translated, 258 pass spirv-val; native 198/249 passed, 49 skipped; LEONIDA_W64_EMULATE=1 230/249 passed, 17 skipped. The only failures are cs_imgload_tfe / cs_imgload_d16_tfe, which fail the same way on main on this card (#892).

This GPU has shaderInt64, so it shows the 32-bit-pair addresses compute the same results as before on NVIDIA; the case the PR is for (a device without shaderInt64) needs an Intel or similar run.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7140654878 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/850#issuecomment-7140654878). Originally posted by [Sangonapou](https://github.com/Sangonapou) on 2026-11-24T18:26:43Z. --- Tested 4f2628f8 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere, subgroup 32..32), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300): pass, regression check Runtime built at this head with `scripts\build_runtime.ps1` (MSVC 19.51); `llvm-mc` 23.1.6, SPIRV-Tools 2026.4. No game files. - CPU: `tests/semantic/test_addr64_lowering.py` 7 OK. - GPU suite with the lowered addresses: 258 shaders, 258 translated, 258 pass spirv-val; native 198/249 passed, 49 skipped; `LEONIDA_W64_EMULATE=1` 230/249 passed, 17 skipped. The only failures are `cs_imgload_tfe` / `cs_imgload_d16_tfe`, which fail the same way on `main` on this card (#892). This GPU has `shaderInt64`, so it shows the 32-bit-pair addresses compute the same results as before on NVIDIA; the case the PR is for (a device without `shaderInt64`) needs an Intel or similar run.
titoreinaldo commented 2026-11-24 20:34:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by titoreinaldo on 2026-11-24T20:34:43Z.


Intel Arc readback at 4f2628f83f390e0d25b30bf15718dbbd02852517. On Windows 11 Pro 26H2 build 26300.9974, driver 32.0.101.8132, the exact-head vk_compute_test printed Intel(R) Arc(TM) Graphics (subgroup 8..32) on all 12 dispatches. Selected with VK_LOADER_DRIVERS_SELECT=*igvk* and LEONIDA_VK_DEVICE=Intel(R) Arc(TM) Graphics. Built Release with LLVM-MinGW 23.1.6.

Handwritten synthetic case Address-pair default --int64-addresses reference
Per-lane global_load_dword, offsets −252, −4, +12, +276 bytes 4/4 passed, no Int64 capability or type 4/4 passed, Int64 present
Scalar s_load_dword Passed, no Int64 capability or type Passed, Int64 present
Genuine s_lshl_b64 used to compute the address Passed, Int64 retained Passed, Int64 retained

12/12 passed, 0 failed, 0 skipped. Each dispatch compared all 256 readback words with the CPU expectation, including 224 untouched words. All 12 binaries also passed spirv-val --target-env vulkan1.2. For the −4 case, intentionally expecting offset 0 produced differences in all 32 result lanes. The existing seven test_addr64_lowering.py tests passed as well. This Intel driver supports shaderInt64. The five default address-only modules ran with that device feature disabled by the harness.

Reproduce the signed-offset case

Use the PR’s tests/semantic/test_addr64_lowering.py::translate(name, body_lines, lowered=True) helper. Repeat with lowered=False for the legacy module. For each of the four offsets substitute the signed decimal value below. The helper supplies the 32×1×1 workgroup and final s_endpgm.

v_lshlrev_b32 v1, 2, v0
v_add_nc_u32 v2, 512, v1
v_mov_b32 v3, 0
global_load_dword v4, v[2:3], off offset:-4
s_waitcnt vmcnt(0)
buffer_store_dword v4, v1, s[0:3], 0 offen
s_waitcnt vmcnt(0)

Initialize 256 little-endian uint32s with w[i] = (0x6b120000 + i * 0x10203) & 0xffffffff. Assemble and validate the generated text, then dispatch once:

spirv-as --target-env vulkan1.2 case.spvasm -o case.spv
spirv-val --target-env vulkan1.2 case.spv
spirv-dis case.spv
$env:VKC_OUT_WORDS = "256"
$env:VKC_SUBGROUP_SIZE = "32"
$env:VKC_HEAP_INIT = "heap.bin"
$env:VKC_DUMP = "out.bin"
.\vk_compute_test.exe case.spv 1 dump

Read out.bin. Lane t must contain w[128 + offset/4 + t] and words 32–255 must match the input. For the scalar case all 32 lanes read byte address 256. The 64-bit-data control computes 256 as 16 << 4 in an SGPR pair before that scalar load.

AI-assisted with OpenAI Codex. All buffers and shaders were synthetic.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7143761330 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/850#issuecomment-7143761330). Originally posted by [titoreinaldo](https://github.com/titoreinaldo) on 2026-11-24T20:34:43Z. --- Intel Arc readback at `4f2628f83f390e0d25b30bf15718dbbd02852517`. On Windows 11 Pro 26H2 build 26300.9974, driver 32.0.101.8132, the exact-head `vk_compute_test` printed `Intel(R) Arc(TM) Graphics (subgroup 8..32)` on all 12 dispatches. Selected with `VK_LOADER_DRIVERS_SELECT=*igvk*` and `LEONIDA_VK_DEVICE=Intel(R) Arc(TM) Graphics`. Built Release with LLVM-MinGW 23.1.6. | Handwritten synthetic case | Address-pair default | `--int64-addresses` reference | |---|---|---| | Per-lane `global_load_dword`, offsets −252, −4, +12, +276 bytes | 4/4 passed, no Int64 capability or type | 4/4 passed, Int64 present | | Scalar `s_load_dword` | Passed, no Int64 capability or type | Passed, Int64 present | | Genuine `s_lshl_b64` used to compute the address | Passed, Int64 retained | Passed, Int64 retained | 12/12 passed, 0 failed, 0 skipped. Each dispatch compared all 256 readback words with the CPU expectation, including 224 untouched words. All 12 binaries also passed `spirv-val --target-env vulkan1.2`. For the −4 case, intentionally expecting offset 0 produced differences in all 32 result lanes. The existing seven `test_addr64_lowering.py` tests passed as well. This Intel driver supports shaderInt64. The five default address-only modules ran with that device feature disabled by the harness. <details><summary>Reproduce the signed-offset case</summary> Use the PR’s `tests/semantic/test_addr64_lowering.py::translate(name, body_lines, lowered=True)` helper. Repeat with `lowered=False` for the legacy module. For each of the four offsets substitute the signed decimal value below. The helper supplies the 32×1×1 workgroup and final `s_endpgm`. ```asm v_lshlrev_b32 v1, 2, v0 v_add_nc_u32 v2, 512, v1 v_mov_b32 v3, 0 global_load_dword v4, v[2:3], off offset:-4 s_waitcnt vmcnt(0) buffer_store_dword v4, v1, s[0:3], 0 offen s_waitcnt vmcnt(0) ``` Initialize 256 little-endian uint32s with `w[i] = (0x6b120000 + i * 0x10203) & 0xffffffff`. Assemble and validate the generated text, then dispatch once: ```powershell spirv-as --target-env vulkan1.2 case.spvasm -o case.spv spirv-val --target-env vulkan1.2 case.spv spirv-dis case.spv $env:VKC_OUT_WORDS = "256" $env:VKC_SUBGROUP_SIZE = "32" $env:VKC_HEAP_INIT = "heap.bin" $env:VKC_DUMP = "out.bin" .\vk_compute_test.exe case.spv 1 dump ``` Read `out.bin`. Lane `t` must contain `w[128 + offset/4 + t]` and words 32–255 must match the input. For the scalar case all 32 lanes read byte address 256. The 64-bit-data control computes 256 as `16 << 4` in an SGPR pair before that scalar load. </details> AI-assisted with OpenAI Codex. All buffers and shaders were synthetic.
c4k3ss commented 2026-11-25 17:39:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by c4k3ss on 2026-11-25T17:39:52Z.


Rebased by merging main fe1553456 (775 commits since the base); the only conflict was the docs/design.md table row.

Main's Gen.host_addr now sign-extends every 48-bit effective VA (a shift left and an arithmetic shift right by 16, with a 32-bit shift amount). lower_addr64 knew only shifts by 32, so after the merge it refused every module and the lowering did nothing (all 7 semantic tests failed). Commit da9e7492b makes a shift by 1..31 of a (low, high) pair the two words' shifts with the bits that cross between them, with the amount read as a 32-bit or 64-bit constant; shifts by a variable amount or by more than 32 still keep Int64. The contract row and the code comment say so. test_addr64_lowering.py gains a negative 48-bit VA case (bit 47 set, so the read lands below the heap base), compared with the Int64 form in spirv_mini_interp.

Tested on main fe1553456, Windows 11 26200, RTX 5070 Ti (NVIDIA 621.24), llvm-mc 23.1.6, Vulkan SDK 1.4.363:

  • test_addr64_lowering 8 OK; test_rdna2spirv_xdxr_rules 6, test_buffer_atomic_fminmax_and_align 11, test_buffer_store_format 39, test_loop_ballot_barrier 15, test_wave64_emulate_opt 33, all passed.
  • scripts/run_gpu_tests.py with the lowering: 209/264 passed, 54 skipped, 1 failed (cs_imgatomic_ext: 6 of 64 sint words differ, word 32 = 0x0badf00d), runtime and test tools built from this main with scripts/build_runtime.ps1 (MSVC). With this main's own translator on the same build and programs: 209/264, 54 skipped, the same cs_imgatomic_ext failure with the same words. Same failures both ways, so none are from this change.
  • Of the suite's 274 translated programs, 242 need no Int64 with the lowering; 98 did without it before (the rest are 64-bit data ops: cs_w32_salu64, cs_w32_shift64, ps_vcmp_64, the typed-format tests).

AI-assisted (Claude Code); a second tool reviewed the shift formulas for every amount 1..32 against integer arithmetic and validated 192 lowered synthetic modules with spirv-val.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7169824736 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/850#issuecomment-7169824736). Originally posted by [c4k3ss](https://github.com/c4k3ss) on 2026-11-25T17:39:52Z. --- Rebased by merging `main` `fe1553456` (775 commits since the base); the only conflict was the `docs/design.md` table row. Main's `Gen.host_addr` now sign-extends every 48-bit effective VA (a shift left and an arithmetic shift right by 16, with a 32-bit shift amount). `lower_addr64` knew only shifts by 32, so after the merge it refused every module and the lowering did nothing (all 7 semantic tests failed). Commit `da9e7492b` makes a shift by 1..31 of a (low, high) pair the two words' shifts with the bits that cross between them, with the amount read as a 32-bit or 64-bit constant; shifts by a variable amount or by more than 32 still keep `Int64`. The contract row and the code comment say so. `test_addr64_lowering.py` gains a negative 48-bit VA case (bit 47 set, so the read lands below the heap base), compared with the `Int64` form in `spirv_mini_interp`. Tested on `main` `fe1553456`, Windows 11 26200, RTX 5070 Ti (NVIDIA 621.24), llvm-mc 23.1.6, Vulkan SDK 1.4.363: - `test_addr64_lowering` 8 OK; `test_rdna2spirv_xdxr_rules` 6, `test_buffer_atomic_fminmax_and_align` 11, `test_buffer_store_format` 39, `test_loop_ballot_barrier` 15, `test_wave64_emulate_opt` 33, all passed. - `scripts/run_gpu_tests.py` with the lowering: 209/264 passed, 54 skipped, 1 failed (`cs_imgatomic_ext`: 6 of 64 sint words differ, word 32 = 0x0badf00d), runtime and test tools built from this `main` with `scripts/build_runtime.ps1` (MSVC). With this `main`'s own translator on the same build and programs: 209/264, 54 skipped, the same `cs_imgatomic_ext` failure with the same words. Same failures both ways, so none are from this change. - Of the suite's 274 translated programs, 242 need no `Int64` with the lowering; 98 did without it before (the rest are 64-bit data ops: `cs_w32_salu64`, `cs_w32_shift64`, `ps_vcmp_64`, the typed-format tests). AI-assisted (Claude Code); a second tool reviewed the shift formulas for every amount 1..32 against integer arithmetic and validated 192 lowered synthetic modules with spirv-val.
c4k3ss commented 2026-11-26 11:58:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by c4k3ss on 2026-11-26T11:58:21Z.


Merged main a73a57e13 (440 commits since the last merge; the conflict was the same docs/design.md row).

Main's RT-POST-LOAD-GPU-MEMORY (9f98dcc61) put three more 64-bit forms into the buffer address idiom: the full index * stride product (OpIMul %ulong, so an index that lands past 32 bits is out of range), a left shift by the element-size log read from the V# (a 32-bit value, not a constant), and the range compare against 0xFFFFFFFF. The pass refused every such module and the lowering did nothing again. Commit c621105e6: a 64-bit multiply becomes the low words' product with its high word from the four 16-bit half products (plain 32-bit multiplies, which the three test interpreters run; no OpUMulExtended), plus each low word times the other's high word; a left shift by a 32-bit value becomes the shift by k & 31 on both words with the crossing bits, the words moved up once k >= 32. A right shift by a variable amount still keeps Int64. The contract row and the code comment say so.

Tested on main a73a57e13, Windows 11 26200, RTX 5070 Ti (NVIDIA 621.24), llvm-mc 23.1.6, Vulkan SDK 1.4.363:

  • test_addr64_lowering 8 OK; test_rdna2spirv_xdxr_rules 6, test_buffer_atomic_fminmax_and_align 11, test_buffer_store_format 39, test_loop_ballot_barrier 15, test_wave64_emulate_opt 33, all passed.
  • scripts/run_gpu_tests.py with the lowering, runtime and test tools built from this main with scripts/build_runtime.ps1 (MSVC): 211/268 passed, 55 skipped, 2 failed (cs_imgatomic_ext: 6 of 64 sint words differ; cs_texture_uav: "texture view format lacks the required formatless storage image access: 98"). With this main's own translator on the same build and programs: 211/268, 55 skipped, the same two failures with the same words. So neither is from this change.
  • Of the suite's 277 translated programs, 245 need no Int64 with the lowering.

AI-assisted (Claude Code); a second tool checked the multiply and shift lowering against integer arithmetic (20,121 products, 13,504 shifts).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7191400840 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/850#issuecomment-7191400840). Originally posted by [c4k3ss](https://github.com/c4k3ss) on 2026-11-26T11:58:21Z. --- Merged `main` `a73a57e13` (440 commits since the last merge; the conflict was the same `docs/design.md` row). Main's `RT-POST-LOAD-GPU-MEMORY` (`9f98dcc61`) put three more 64-bit forms into the buffer address idiom: the full `index * stride` product (`OpIMul %ulong`, so an index that lands past 32 bits is out of range), a left shift by the element-size log read from the V# (a 32-bit value, not a constant), and the range compare against `0xFFFFFFFF`. The pass refused every such module and the lowering did nothing again. Commit `c621105e6`: a 64-bit multiply becomes the low words' product with its high word from the four 16-bit half products (plain 32-bit multiplies, which the three test interpreters run; no `OpUMulExtended`), plus each low word times the other's high word; a left shift by a 32-bit value becomes the shift by `k & 31` on both words with the crossing bits, the words moved up once `k >= 32`. A right shift by a variable amount still keeps `Int64`. The contract row and the code comment say so. Tested on `main` `a73a57e13`, Windows 11 26200, RTX 5070 Ti (NVIDIA 621.24), llvm-mc 23.1.6, Vulkan SDK 1.4.363: - `test_addr64_lowering` 8 OK; `test_rdna2spirv_xdxr_rules` 6, `test_buffer_atomic_fminmax_and_align` 11, `test_buffer_store_format` 39, `test_loop_ballot_barrier` 15, `test_wave64_emulate_opt` 33, all passed. - `scripts/run_gpu_tests.py` with the lowering, runtime and test tools built from this `main` with `scripts/build_runtime.ps1` (MSVC): 211/268 passed, 55 skipped, 2 failed (`cs_imgatomic_ext`: 6 of 64 sint words differ; `cs_texture_uav`: "texture view format lacks the required formatless storage image access: 98"). With this `main`'s own translator on the same build and programs: 211/268, 55 skipped, the same two failures with the same words. So neither is from this change. - Of the suite's 277 translated programs, 245 need no `Int64` with the lowering. AI-assisted (Claude Code); a second tool checked the multiply and shift lowering against integer arithmetic (20,121 products, 13,504 shifts).
c4k3ss commented 2026-11-28 12:52:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by c4k3ss on 2026-11-28T12:52:30Z.


Merged main 493867366 and again 4ecb05749 (about 1,700 commits since the last merge; one conflict, the global line in rdna2spirv.py, both sides kept).

Five newer main tests looked for the 64-bit forms that lower_addr64 rewrites into (low, high) pairs, or for the module's first constant 16 or 31, which the lowering now declares as its own. Each accepts both forms now, with the counts and negative controls unchanged: test_mesh_compute (the store pointers are OpBitcast of the pair; the slot offset's OpIMul %ulong is the pair's low product), test_salu_chained_const_prop (the fold check skips the lowering's own shifts by 16), test_lds_subword_d16 and test_wave32_lane_select (whichever constant 16 or 31 the instruction uses), test_vsharp_sext48 (the pair form's arithmetic shift right by 16 on the high word, twice).

Tested on main 4ecb05749, Windows 11 26200, llvm-mc 23.1.6: the top-level pytest files 10,055 passed, 390 skipped, and every tests/semantic file passes. The nine test_windows_boot_journal_seed failures on this machine come from scripts/windows-boot/boot.ps1 being removed by the antivirus here; they fail the same way on main. The earlier CI red on 2f26ba981 was these five tests.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7239527705 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/850#issuecomment-7239527705). Originally posted by [c4k3ss](https://github.com/c4k3ss) on 2026-11-28T12:52:30Z. --- Merged `main` `493867366` and again `4ecb05749` (about 1,700 commits since the last merge; one conflict, the `global` line in `rdna2spirv.py`, both sides kept). Five newer `main` tests looked for the 64-bit forms that `lower_addr64` rewrites into (low, high) pairs, or for the module's first constant 16 or 31, which the lowering now declares as its own. Each accepts both forms now, with the counts and negative controls unchanged: `test_mesh_compute` (the store pointers are `OpBitcast` of the pair; the slot offset's `OpIMul %ulong` is the pair's low product), `test_salu_chained_const_prop` (the fold check skips the lowering's own shifts by 16), `test_lds_subword_d16` and `test_wave32_lane_select` (whichever constant 16 or 31 the instruction uses), `test_vsharp_sext48` (the pair form's arithmetic shift right by 16 on the high word, twice). Tested on `main` `4ecb05749`, Windows 11 26200, llvm-mc 23.1.6: the top-level pytest files 10,055 passed, 390 skipped, and every `tests/semantic` file passes. The nine `test_windows_boot_journal_seed` failures on this machine come from `scripts/windows-boot/boot.ps1` being removed by the antivirus here; they fail the same way on `main`. The earlier CI red on `2f26ba981` was these five tests. AI-assisted (Claude Code).
timbot103 commented 2026-11-28 13:23:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T13:23:04Z.

Review: APPROVED


Independently verified d477c94cd merged cleanly onto main (d48a957bb) on Windows 11 across two Vulkan GPUs (zero game files):

  • NVIDIA GeForce RTX 5080 (driver 32.0.16.1664, wave64 emulated)
  • AMD Radeon(TM) Graphics (gfx1036) (driver 32.0.21030.2001, native wave64)

Red on main (d48a957bb) control:

  • tests/semantic/test_addr64_lowering.py fails (8 tests / 13 errors: AttributeError: module 'rdna2spirv' has no attribute 'ADDR_PAIR').

Green on #850 (d477c94cd):

  • scripts/run_semantic_tests.py tests/semantic -p test_addr64_lowering.py: 8/8 passed.
  • Full semantic suite (tests/semantic, 519 files, 6,479 tests): 518/519 files (6,477/6,479 tests) passed; the sole failing file (test_valu_cvt_f16_int16_mods, 2 subtests in v_cvt_u16_f16/v_cvt_i16_f16) reproduces identically on clean main (d48a957bb) — 0 regressions from #850.
  • pytest tests/test_mesh_compute.py tests/test_rdna2spirv_xdxr_rules.py tests/test_translate.py: 757/757 passed.
  • scripts/run_gpu_tests.py --filter cs_buf --require-pass: 4/6 passed, 2 skipped (cs_buf_fmt8, cs_buf_load_sub, cs_buf_swizzle, cs_buf_tail pass; cs_buf_counter and cs_buf_typed skipped as d3d12_buffer_uav_test-only) on both RTX 5080 and AMD Radeon gfx1036.
  • tools/valu_fuzz.py --family mem --wave both --programs 100 --seed 850:
    • RTX 5080 (--emulate): 200/200 match (0 mismatched, 0 skipped, 0 not translated, 0 harness errors).
    • AMD Radeon gfx1036 (native): 200/200 match (0 mismatched, 0 skipped, 0 not translated, 0 harness errors).

LGTM.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6098008412 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/850#pullrequestreview-6098008412). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T13:23:04Z. **Review:** APPROVED --- Independently verified `d477c94cd` merged cleanly onto `main` (`d48a957bb`) on Windows 11 across two Vulkan GPUs (zero game files): - **NVIDIA GeForce RTX 5080** (driver `32.0.16.1664`, wave64 emulated) - **AMD Radeon(TM) Graphics (`gfx1036`)** (driver `32.0.21030.2001`, native wave64) **Red on `main` (`d48a957bb`) control:** - `tests/semantic/test_addr64_lowering.py` fails (`8` tests / `13` errors: `AttributeError: module 'rdna2spirv' has no attribute 'ADDR_PAIR'`). **Green on `#850` (`d477c94cd`):** - `scripts/run_semantic_tests.py tests/semantic -p test_addr64_lowering.py`: **8/8 passed**. - Full semantic suite (`tests/semantic`, 519 files, 6,479 tests): **518/519 files (6,477/6,479 tests) passed**; the sole failing file (`test_valu_cvt_f16_int16_mods`, 2 subtests in `v_cvt_u16_f16`/`v_cvt_i16_f16`) reproduces identically on clean `main` (`d48a957bb`) — **0 regressions from `#850`**. - `pytest tests/test_mesh_compute.py tests/test_rdna2spirv_xdxr_rules.py tests/test_translate.py`: **757/757 passed**. - `scripts/run_gpu_tests.py --filter cs_buf --require-pass`: **4/6 passed, 2 skipped** (`cs_buf_fmt8`, `cs_buf_load_sub`, `cs_buf_swizzle`, `cs_buf_tail` pass; `cs_buf_counter` and `cs_buf_typed` skipped as `d3d12_buffer_uav_test`-only) on **both RTX 5080 and AMD Radeon `gfx1036`**. - `tools/valu_fuzz.py --family mem --wave both --programs 100 --seed 850`: - **RTX 5080 (`--emulate`):** **200/200 match** (`0` mismatched, `0` skipped, `0` not translated, `0` harness errors). - **AMD Radeon `gfx1036` (native):** **200/200 match** (`0` mismatched, `0` skipped, `0` not translated, `0` harness errors). LGTM.
zmasi commented 2026-11-29 01:07:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T01:07:49Z.


Independent verification on Windows 11 (10.0.26200, x64) of d477c94cd5 merged onto current origin/main (aa52446f7d / 21f5baff1d, 0 merge conflicts), tested under both Python 3.12.10 and Python 3.14.5:

  • Red (origin/main + #850 tests/semantic/test_addr64_lowering.py & spirv_mini_interp.py):
    • python -I tests/semantic/test_addr64_lowering.py: FAILED (errors=13) (AttributeError: module 'rdna2spirv' has no attribute 'ADDR_PAIR').
  • Green (d477c94cd5 merged onto origin/main):
    • python -I tests/semantic/test_addr64_lowering.py: Ran 8 tests, OK on both Python 3.12.10 (0.78 s) and Python 3.14.5 (0.74 s).
    • All touched companion semantic and translator suites pass: test_buffer_atomic_fminmax_and_align.py (11/11), test_buffer_store_format.py (39/39), test_lds_subword_d16.py (8/8), test_loop_ballot_barrier.py (15/15), test_salu_chained_const_prop.py (11/11), test_wave64_emulate_opt.py (34/34), test_rdna2spirv_xdxr_rules.py (6/6), pytest tests/semantic/test_vsharp_sext48.py tests/semantic/test_wave32_lane_select.py (3/3), and pytest tests/test_mesh_compute.py tests/test_translate.py (5 passed, 752 skipped, 0 failures).
    • python -I tests/test_docs_design_rows.py: Ran 5 tests, OK; test_docs_cli_flags.py adds 0 issues over origin/main (--int64-addresses matches tools/rdna2spirv.py).
    • Checked lower_addr64's 16-bit half-product 64-bit OpIMul and variable 32-bit OpShiftLeftLogical (k & 31, 31 - (k & 31), k >= 32) formulas across 3,033 boundary operand combinations (0, 1, 0xFFFF, 0x10000, 0x7FFFFFFF, 0x80000000, 0xFFFFFFFE, 0xFFFFFFFF, and all k in 0..63): 0 mismatches and no intermediate 32-bit carry overflow.
  • Hygiene: git diff --check and python -I scripts/check_no_game_data.py across all 16 touched files exited 0.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248579220 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/850#issuecomment-7248579220). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T01:07:49Z. --- Independent verification on Windows 11 (`10.0.26200`, x64) of `d477c94cd5` merged onto current `origin/main` (`aa52446f7d` / `21f5baff1d`, `0` merge conflicts), tested under both `Python 3.12.10` and `Python 3.14.5`: - **Red (`origin/main` + `#850` `tests/semantic/test_addr64_lowering.py` & `spirv_mini_interp.py`)**: - `python -I tests/semantic/test_addr64_lowering.py`: `FAILED (errors=13)` (`AttributeError: module 'rdna2spirv' has no attribute 'ADDR_PAIR'`). - **Green (`d477c94cd5` merged onto `origin/main`)**: - `python -I tests/semantic/test_addr64_lowering.py`: `Ran 8 tests`, `OK` on both `Python 3.12.10` (`0.78 s`) and `Python 3.14.5` (`0.74 s`). - All touched companion semantic and translator suites pass: `test_buffer_atomic_fminmax_and_align.py` (`11/11`), `test_buffer_store_format.py` (`39/39`), `test_lds_subword_d16.py` (`8/8`), `test_loop_ballot_barrier.py` (`15/15`), `test_salu_chained_const_prop.py` (`11/11`), `test_wave64_emulate_opt.py` (`34/34`), `test_rdna2spirv_xdxr_rules.py` (`6/6`), `pytest tests/semantic/test_vsharp_sext48.py tests/semantic/test_wave32_lane_select.py` (`3/3`), and `pytest tests/test_mesh_compute.py tests/test_translate.py` (`5 passed, 752 skipped`, `0` failures). - `python -I tests/test_docs_design_rows.py`: `Ran 5 tests`, `OK`; `test_docs_cli_flags.py` adds `0` issues over `origin/main` (`--int64-addresses` matches `tools/rdna2spirv.py`). - Checked `lower_addr64`'s 16-bit half-product 64-bit `OpIMul` and variable 32-bit `OpShiftLeftLogical` (`k & 31`, `31 - (k & 31)`, `k >= 32`) formulas across `3,033` boundary operand combinations (`0`, `1`, `0xFFFF`, `0x10000`, `0x7FFFFFFF`, `0x80000000`, `0xFFFFFFFE`, `0xFFFFFFFF`, and all `k in 0..63`): `0` mismatches and no intermediate 32-bit carry overflow. - **Hygiene**: `git diff --check` and `python -I scripts/check_no_game_data.py` across all 16 touched files exited `0`. AI-assisted.
OreoFR commented 2026-11-29 01:40:34 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T01:40:34Z.


Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df14 : red FAIL (test_addr64_lowering, ADDR_PAIR missing) / green PASS

  • PR head: d477c94cd
  • Method: red = main 53b77df14 + only this PR's test files; green = main + git merge --no-ff of the PR (clean merge).
  • tests/semantic: new test_addr64_lowering.py: red 8 tests with 13 subtest errors AttributeError: module 'rdna2spirv' has no attribute 'ADDR_PAIR'; green 8 OK. MEASURED 3 runs alone: red 3/3 fail, green 3/3 pass.
  • The other 8 changed semantic files pass on both sides (11, 39, 8, 15, 11, 1, 2, 34 tests).
  • Full suite python -I scripts/run_semantic_tests.py tests/semantic: red 527 files / 6514 tests, 2 files failed (test_addr64_lowering, test_valu_cvt_f16_int16_mods); green 527 / 6514, 1 file failed (test_valu_cvt_f16_int16_mods). Green-only failures: none.
  • test_valu_cvt_f16_int16_mods (test_f16_to_int16_output_modifiers_still_rejected for v_cvt_u16_f16 and v_cvt_i16_f16: "Unsupported not raised") also fails on plain main 53b77df14 and is not touched by this PR (pre-existing on main, last changed in 7de2d4461).
  • tests/test_rdna2spirv_xdxr_rules.py: 6 passed on both sides.
  • With llvm-mc (Homebrew LLVM 23.1.6, amdgcn target) + spirv-as/spirv-val, pytest tests/test_translate.py tests/test_mesh_compute.py: no failures, no skips on either side.
    • test_translate.py: red 729 passed / green 729 passed.
    • test_mesh_compute.py: red 22 passed / green 28 passed. The count differs because red's copy of this file is the PR head's, which predates main's 476f014a2 (pc-tail tests); the merged file (main + PR diff) run against red's source also gives 28 passed. Its new OpBitcast %_ptr_PSB_uint %a64_ / pair-form %mso assertions are disjunctions, so they hold on main's codegen too.
  • Verdict: READY

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7248940841 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/850#issuecomment-7248940841). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T01:40:34Z. --- Verified by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS (case-insensitive), Python 3.12.16, main 53b77df14 : red FAIL (test_addr64_lowering, `ADDR_PAIR` missing) / green PASS - PR head: d477c94cd - Method: red = main 53b77df14 + only this PR's test files; green = main + `git merge --no-ff` of the PR (clean merge). - tests/semantic: new `test_addr64_lowering.py`: red 8 tests with 13 subtest errors `AttributeError: module 'rdna2spirv' has no attribute 'ADDR_PAIR'`; green 8 OK. MEASURED 3 runs alone: red 3/3 fail, green 3/3 pass. - The other 8 changed semantic files pass on both sides (11, 39, 8, 15, 11, 1, 2, 34 tests). - Full suite `python -I scripts/run_semantic_tests.py tests/semantic`: red 527 files / 6514 tests, 2 files failed (`test_addr64_lowering`, `test_valu_cvt_f16_int16_mods`); green 527 / 6514, 1 file failed (`test_valu_cvt_f16_int16_mods`). Green-only failures: none. - `test_valu_cvt_f16_int16_mods` (`test_f16_to_int16_output_modifiers_still_rejected` for v_cvt_u16_f16 and v_cvt_i16_f16: "Unsupported not raised") also fails on plain main 53b77df14 and is not touched by this PR (pre-existing on main, last changed in 7de2d4461). - `tests/test_rdna2spirv_xdxr_rules.py`: 6 passed on both sides. - With llvm-mc (Homebrew LLVM 23.1.6, amdgcn target) + spirv-as/spirv-val, `pytest tests/test_translate.py tests/test_mesh_compute.py`: no failures, no skips on either side. - `test_translate.py`: red 729 passed / green 729 passed. - `test_mesh_compute.py`: red 22 passed / green 28 passed. The count differs because red's copy of this file is the PR head's, which predates main's 476f014a2 (pc-tail tests); the merged file (main + PR diff) run against red's source also gives 28 passed. Its new `OpBitcast %_ptr_PSB_uint %a64_` / pair-form `%mso` assertions are disjunctions, so they hold on main's codegen too. - Verdict: READY AI-assisted: Claude Code (Claude Opus 5.5).
MoonEyes commented 2026-11-29 02:10:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T02:10:26Z.


Merged after OreoFR's red/green check (check) (macOS 27.2.1, Apple M5, Python 3.12) and a local re-check here. Merged after local re-verification: this PR merged onto main 791899f65 without conflict, and its test file(s) (tests/semantic/test_addr64_lowering.py, tests/semantic/test_buffer_atomic_fminmax_and_align.py, tests/semantic/test_buffer_store_format.py, tests/semantic/test_lds_subword_d16.py, tests/semantic/test_loop_ballot_barrier.py, tests/semantic/test_salu_chained_const_prop.py, tests/semantic/test_vsharp_sext48.py, tests/semantic/test_wave32_lane_select.py, tests/semantic/test_wave64_emulate_opt.py, tests/test_mesh_compute.py, tests/test_rdna2spirv_xdxr_rules.py, tests/test_translate.py) pass there. Earlier today the same tests failed on main without the PR (red/green) and a bundle with other open PRs showed no new failures. check_no_game_data.py is clean. Windows 11, Python 3.14; no GPU needed for these tests.

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249256255 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/850#issuecomment-7249256255). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-29T02:10:26Z. --- Merged after **OreoFR**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/850#issuecomment-7248940841)) (macOS 27.2.1, Apple M5, Python 3.12) and a local re-check here. Merged after local re-verification: this PR merged onto `main` 791899f65 without conflict, and its test file(s) (`tests/semantic/test_addr64_lowering.py`, `tests/semantic/test_buffer_atomic_fminmax_and_align.py`, `tests/semantic/test_buffer_store_format.py`, `tests/semantic/test_lds_subword_d16.py`, `tests/semantic/test_loop_ballot_barrier.py`, `tests/semantic/test_salu_chained_const_prop.py`, `tests/semantic/test_vsharp_sext48.py`, `tests/semantic/test_wave32_lane_select.py`, `tests/semantic/test_wave64_emulate_opt.py`, `tests/test_mesh_compute.py`, `tests/test_rdna2spirv_xdxr_rules.py`, `tests/test_translate.py`) pass there. Earlier today the same tests failed on `main` without the PR (red/green) and a bundle with other open PRs showed no new failures. `check_no_game_data.py` is clean. Windows 11, Python 3.14; no GPU needed for these tests. _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
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!850
No description provided.