[PR #309] rdna2spirv: intra-block %vgpr/%sgpr value forwarding (resubmission of #4518) #361

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

📋 Pull Request Information

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

Base: main ← Head: old-pr/10044


📝 Commits (6)

  • c83b919 rdna2spirv: intra-block %vgpr/%sgpr value forwarding
  • f42df3c tests/test_cube_sample: accept active-lane guarded OpSelect in sample_coords()
  • 4f9d84a tests/test_image_load_typed: trace forwarded %vgpr writes in test_a16_offset_gathers_preserve_offset_and_unpack_uv_lod
  • 85de2bf tests: follow forwarded %vgpr stores in sample_c/sample_cl and harden forwarding tests
  • ae264ea tests: match any OpBitcast of matching scale constant when #4473 + #4518 forward constants
  • 5254b20 tests/semantic: follow forwarded %vgpr OpStore in test_image_sample_bias_nonps

📊 Changes

12 files changed (+461 additions, -60 deletions)

View changed files

📝 tests/semantic/test_buffer_oob_select.py (+1 -1)
📝 tests/semantic/test_buffer_swizzle.py (+1 -1)
📝 tests/semantic/test_image_sample_bias_nonps.py (+17 -7)
➕ tests/semantic/test_reg_load_forwarding.py (+294 -0)
📝 tests/semantic/test_sample_c.py (+19 -8)
📝 tests/semantic/test_sample_cl.py (+17 -7)
📝 tests/test_cube_sample.py (+2 -0)
📝 tests/test_f64_transcendentals.py (+8 -5)
📝 tests/test_image_load_typed.py (+18 -6)
📝 tests/test_rcp_iflag_mods.py (+10 -4)
📝 tests/test_translate.py (+30 -13)
📝 tools/rdna2spirv.py (+44 -8)

📄 Description

Carried over from old PR 10044 by SweatierKey in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10044, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
SweatierKey: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Clean resubmission of #4518 (closed during the bulk PR sweep at 22:48Z). Zero overlapping open PRs.

Summary

  • Adds intra-block SSA value forwarding for %vgpr/%sgpr loads in tools/rdna2spirv.py to eliminate redundant OpLoads from local register arrays within basic blocks (cutting cold pipeline compilation overhead).
  • Adds tests/semantic/test_reg_load_forwarding.py and updates affected semantic/translator tests.

Prior independent verifications on #4518 (5254b20ee)

  • Proposed as merge: ready by @pyotrkk during #8919 triage (#4518#issuecomment-7113082763).
  • Independently GPU-checked by @thiefyzheng on RX 7900 XTX (RADV NAVI31, Mesa 25.2.8.2): 222/240 passed, 17 skipped (single FAIL cs_w32_salu64 reproduces identically on plain main, #4518#issuecomment-7116790353).
  • Earlier cold-pipeline measurements on Linux Mesa 26.1.6 RADV by @ligmaSec.

Verification on current origin/main (de4c37383)

  • Clean merge onto origin/main@de4c37383 (git merge-tree --write-tree clean, git diff --check clean, scripts/check_no_game_data.py exit 0).
  • Linux x86-64 (CPython 3.13, stdlib semantic suites): test_reg_load_forwarding.py 7/7 OK, test_buffer_oob_select.py 36/36 OK, test_buffer_swizzle.py 9/9 OK, test_image_sample_bias_nonps.py 5/5 (2 skipped), test_sample_c.py 7/7 (1 skipped), test_sample_cl.py 9/9 (1 skipped).
  • pytest-based suites (test_cube_sample.py, test_translate.py, etc.) and GPU suite: not re-run on this host.

🔄 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/309 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `old-pr/10044` --- ### 📝 Commits (6) - [`c83b919`](https://github.com/ubiquitarianism/leonida/commit/c83b919bc4c6f6a00dc37fdc3ee9680994f8d0e5) rdna2spirv: intra-block %vgpr/%sgpr value forwarding - [`f42df3c`](https://github.com/ubiquitarianism/leonida/commit/f42df3cae535abfebb1e6e58468494125cb9747c) tests/test_cube_sample: accept active-lane guarded OpSelect in sample_coords() - [`4f9d84a`](https://github.com/ubiquitarianism/leonida/commit/4f9d84afa90428f0cabaaee1c74ae8bf8de02d67) tests/test_image_load_typed: trace forwarded %vgpr writes in test_a16_offset_gathers_preserve_offset_and_unpack_uv_lod - [`85de2bf`](https://github.com/ubiquitarianism/leonida/commit/85de2bfc57b75a738d4c318270fd64738aaa424b) tests: follow forwarded %vgpr stores in sample_c/sample_cl and harden forwarding tests - [`ae264ea`](https://github.com/ubiquitarianism/leonida/commit/ae264eaebeaf3cf23a7592afd04cd46975775f08) tests: match any OpBitcast of matching scale constant when #4473 + #4518 forward constants - [`5254b20`](https://github.com/ubiquitarianism/leonida/commit/5254b20ee417ec0c1163343c2ecaab5bf70d1969) tests/semantic: follow forwarded %vgpr OpStore in test_image_sample_bias_nonps ### 📊 Changes **12 files changed** (+461 additions, -60 deletions) <details> <summary>View changed files</summary> 📝 `tests/semantic/test_buffer_oob_select.py` (+1 -1) 📝 `tests/semantic/test_buffer_swizzle.py` (+1 -1) 📝 `tests/semantic/test_image_sample_bias_nonps.py` (+17 -7) ➕ `tests/semantic/test_reg_load_forwarding.py` (+294 -0) 📝 `tests/semantic/test_sample_c.py` (+19 -8) 📝 `tests/semantic/test_sample_cl.py` (+17 -7) 📝 `tests/test_cube_sample.py` (+2 -0) 📝 `tests/test_f64_transcendentals.py` (+8 -5) 📝 `tests/test_image_load_typed.py` (+18 -6) 📝 `tests/test_rcp_iflag_mods.py` (+10 -4) 📝 `tests/test_translate.py` (+30 -13) 📝 `tools/rdna2spirv.py` (+44 -8) </details> ### 📄 Description > Carried over from **old PR 10044** by `SweatierKey` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10044`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `SweatierKey`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): Clean resubmission of `#4518` (closed during the bulk PR sweep at `22:48Z`). Zero overlapping open PRs. ### Summary - Adds intra-block SSA value forwarding for `%vgpr`/`%sgpr` loads in `tools/rdna2spirv.py` to eliminate redundant `OpLoad`s from local register arrays within basic blocks (cutting cold pipeline compilation overhead). - Adds `tests/semantic/test_reg_load_forwarding.py` and updates affected semantic/translator tests. ### Prior independent verifications on `#4518` (`5254b20ee`) - Proposed as `merge: ready` by `@pyotrkk` during `#8919` triage (`#4518`#issuecomment-7113082763). - Independently GPU-checked by `@thiefyzheng` on RX 7900 XTX (RADV NAVI31, Mesa 25.2.8.2): **222/240 passed, 17 skipped** (single FAIL `cs_w32_salu64` reproduces identically on plain `main`, `#4518`#issuecomment-7116790353). - Earlier cold-pipeline measurements on Linux Mesa 26.1.6 RADV by `@ligmaSec`. ### Verification on current `origin/main` (`de4c37383`) - Clean merge onto `origin/main@de4c37383` (`git merge-tree --write-tree` clean, `git diff --check` clean, `scripts/check_no_game_data.py` exit 0). - Linux x86-64 (CPython 3.13, stdlib semantic suites): `test_reg_load_forwarding.py` 7/7 OK, `test_buffer_oob_select.py` 36/36 OK, `test_buffer_swizzle.py` 9/9 OK, `test_image_sample_bias_nonps.py` 5/5 (2 skipped), `test_sample_c.py` 7/7 (1 skipped), `test_sample_cl.py` 9/9 (1 skipped). - pytest-based suites (`test_cube_sample.py`, `test_translate.py`, etc.) and GPU suite: not re-run on this host. --- <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#361
No description provided.