rdna2spirv: out-of-range s_buffer_load reads safely from heap base without branch (OLD-9916) #650

Closed
leonida/mandy
TanmaySatyam wants to merge 0 commits from fix/old-9916-smem-oob-safe-address into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

TanmaySatyam commented 2026-11-24 10:58:32 +00:00

Claimed in the coordination issue as: OLD-9916

AI-assisted.

What and why

Carries forward old-pr/9916 (draft #184, original author LouisRiverstone / Luiz Neves) onto main (21625bca8), preserving both original author commits and adding one follow-up commit to mark runtime/test/shaders/cs_smem_oob_far.asm for tests/semantic/regen_fixtures.py (main's marker-based discovery):

  1. Preserved commits (Luiz Neves): Makes run-time-bounded s_buffer_load* branchless via OpSelect(in_range, addr, heap_base) so out-of-range dwords read safely from Xbox VA 0 (the always-mapped heap base) and select 0, avoiding llvmpipe hoisting loads out of OpSelectionMerge and segfaulting on >4 GB out-of-range offsets or zero-size descriptors with far bases; adds cs_smem_oob_far.asm and tests/semantic/test_smem_oob_safe_address.py.
  2. Rebase adaptation commit: Adds the ; regen_fixtures: header marker to runtime/test/shaders/cs_smem_oob_far.asm so tests/test_regen_fixtures.py passes on current main.

Testing & Verification

  • GPUs tested: NVIDIA GeForce RTX 5070 (Blackwell, Driver 591.74, Windows 11, Vulkan validation enabled):
    • vk_compute_test cs_smem_oob_far.spv 1 dump → 1 groups x 64: 0 mismatches, out[0..7] = 0 4008636142 0 0 0 4008636142 0 4008636142 (0 validation errors).
  • python -m unittest discover -s tests/semantic -p test_smem_oob_safe_address.py -v (6/6 OK)
  • python -m unittest discover -s tests/semantic -p test_scalar_mem_smem.py (44/44 OK)
  • python -I tests/test_regen_fixtures.py (7/7 OK)
  • python -I tests/test_text_write_line_endings.py (3/3 OK)
  • Clean-room verified: python -I scripts/check_no_game_data.py exited 0 on all modified/added files.
Claimed in the coordination issue as: OLD-9916 AI-assisted. ### What and why Carries forward `old-pr/9916` (draft #184, original author `LouisRiverstone` / Luiz Neves) onto `main` (`21625bca8`), preserving both original author commits and adding one follow-up commit to mark `runtime/test/shaders/cs_smem_oob_far.asm` for `tests/semantic/regen_fixtures.py` (`main`'s marker-based discovery): 1. **Preserved commits (`Luiz Neves`):** Makes run-time-bounded `s_buffer_load*` branchless via `OpSelect(in_range, addr, heap_base)` so out-of-range dwords read safely from Xbox VA 0 (the always-mapped heap base) and select `0`, avoiding llvmpipe hoisting loads out of `OpSelectionMerge` and segfaulting on >4 GB out-of-range offsets or zero-size descriptors with far bases; adds `cs_smem_oob_far.asm` and `tests/semantic/test_smem_oob_safe_address.py`. 2. **Rebase adaptation commit:** Adds the `; regen_fixtures:` header marker to `runtime/test/shaders/cs_smem_oob_far.asm` so `tests/test_regen_fixtures.py` passes on current `main`. ### Testing & Verification - **GPUs tested:** NVIDIA GeForce RTX 5070 (Blackwell, Driver 591.74, Windows 11, Vulkan validation enabled): - `vk_compute_test cs_smem_oob_far.spv 1 dump` → `1 groups x 64: 0 mismatches`, `out[0..7] = 0 4008636142 0 0 0 4008636142 0 4008636142` (0 validation errors). - `python -m unittest discover -s tests/semantic -p test_smem_oob_safe_address.py -v` (6/6 OK) - `python -m unittest discover -s tests/semantic -p test_scalar_mem_smem.py` (44/44 OK) - `python -I tests/test_regen_fixtures.py` (7/7 OK) - `python -I tests/test_text_write_line_endings.py` (3/3 OK) - Clean-room verified: `python -I scripts/check_no_game_data.py` exited 0 on all modified/added files.
trigger337 commented 2026-11-24 11:08:36 +00:00

Hardware verification on AMD Radeon RX 6900 XT (RADV NAVI21, Mesa 26.2.5, Linux CachyOS, Vulkan 1.4.333):

  • Built cs_smem_oob_far.asm with runtime/test/shaders/build.py:
    • Native: vk_compute_test cs_smem_oob_far.spv 1 dump
      device: AMD Radeon RX 6900 XT (RADV NAVI21) (subgroup 32..64)
      1 groups x 64: 0 mismatches
      out[0..7] = 0 4008636142 0 0 0 4008636142 0 4008636142
      
    • Emulated (LEONIDA_W64_EMULATE=1): vk_compute_test cs_smem_oob_far.spv 1 dump
      device: AMD Radeon RX 6900 XT (RADV NAVI21) (subgroup 32..64)
      1 groups x 64: 0 mismatches
      out[0..7] = 0 4008636142 0 0 0 4008636142 0 4008636142
      
  • Semantic tests:
    • python3 -m unittest discover -s tests/semantic -p test_smem_oob_safe_address.py -v: 6/6 passed.
    • python3 -m unittest discover -s tests/semantic -p test_scalar_mem_smem.py: 44/44 passed.
    • python3 -I tests/test_regen_fixtures.py: 7/7 passed.
    • python3 -I tests/test_text_write_line_endings.py: 3/3 passed.
  • Clean-room check: python3 -I scripts/check_no_game_data.py passed on all modified files.

LGTM!

agent: yes
AI-assisted: yes

Hardware verification on AMD Radeon RX 6900 XT (RADV NAVI21, Mesa 26.2.5, Linux CachyOS, Vulkan 1.4.333): * Built `cs_smem_oob_far.asm` with `runtime/test/shaders/build.py`: * Native: `vk_compute_test cs_smem_oob_far.spv 1 dump` ``` device: AMD Radeon RX 6900 XT (RADV NAVI21) (subgroup 32..64) 1 groups x 64: 0 mismatches out[0..7] = 0 4008636142 0 0 0 4008636142 0 4008636142 ``` * Emulated (`LEONIDA_W64_EMULATE=1`): `vk_compute_test cs_smem_oob_far.spv 1 dump` ``` device: AMD Radeon RX 6900 XT (RADV NAVI21) (subgroup 32..64) 1 groups x 64: 0 mismatches out[0..7] = 0 4008636142 0 0 0 4008636142 0 4008636142 ``` * Semantic tests: * `python3 -m unittest discover -s tests/semantic -p test_smem_oob_safe_address.py -v`: 6/6 passed. * `python3 -m unittest discover -s tests/semantic -p test_scalar_mem_smem.py`: 44/44 passed. * `python3 -I tests/test_regen_fixtures.py`: 7/7 passed. * `python3 -I tests/test_text_write_line_endings.py`: 3/3 passed. * Clean-room check: `python3 -I scripts/check_no_game_data.py` passed on all modified files. LGTM! agent: yes AI-assisted: yes
MoonEyes commented 2026-11-28 02:57:40 +00:00

Hi @TanmaySatyam, thanks for this pull request. It currently conflicts with main (conflicting file(s): docs/design.md, scripts/run_gpu_tests.py), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

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

Hi @TanmaySatyam, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `docs/design.md`, `scripts/run_gpu_tests.py`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 reviewed 2026-12-01 11:52:24 +00:00
aslan2142 left a comment
No description provided.
Reviewed against current `main`: this branch conflicts with `main` (in `docs/design.md` and `scripts/run_gpu_tests.py`) and has failing CI. Please rebase onto current `main` so CI runs cleanly. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 16:31:07 +00:00

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No description provided.