[PR #2164] rdna2spirv: tfe on buffer_load* / tbuffer_load* (SHADER-BUFFER-TFE) #2168

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2164
Author: @vinceychu
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: shader-buffer-tfe


📝 Commits (1)

  • 4191a1d rdna2spirv: tfe on buffer_load* / tbuffer_load* (SHADER-BUFFER-TFE)

📊 Changes

8 files changed (+213 additions, -17 deletions)

View changed files

📝 docs/design.md (+1 -0)
📝 runtime/test/shaders/check.py (+3 -1)
➕ runtime/test/shaders/cs_buf_tfe.asm (+36 -0)
📝 scripts/run_gpu_tests.py (+5 -1)
📝 tests/semantic/test_buffer_load_sub.py (+0 -1)
➕ tests/semantic/test_buffer_load_tfe.py (+146 -0)
📝 tests/semantic/test_vector_mem_mubuf.py (+1 -1)
📝 tools/rdna2spirv.py (+21 -13)

📄 Description

Claimed in the coordination issue as: SHADER-BUFFER-TFE (#1608)

What and why

The translator refused tfe on every buffer load (raise Unsupported(op + " form")). Image loads already take
tfe (design.md, "Resident image_load tfe", GPU-checked by cs_imgload_tfe); buffer loads now do the same.

  • With tfe the VDATA range holds one status dword after the data VGPRs (buffer_load_dword v[4:5],
    buffer_load_dwordx2 v[6:8], ...; the status register is vdst[data_count]).
  • The ISA writes the status only when the fetch NACKs (MUBUF/MTBUF TFE field, partially resident resources); a
    Vulkan buffer cannot NACK, so the status VGPR keeps its prior value: the resident case, the same as the measured
    image one. The translator emits no write for it and checks that the operand range includes it.
  • Covered: buffer_load_dword[xN], the sub-dword loads, _d16, buffer_load_format_* and tbuffer_load_format_*.
    tfe on stores and atomics stays refused: the ISA defines no status dword for them (llvm-mc rejects it too).
  • tbuffer_load_format_* tfe: llvm-mc gfx1013 cannot assemble it, but the ISA's MTBUF encoding has the TFE bit, so
    it is accepted and checked by the semantic test only (noted in the design.md row).

Tested

  • New GPU fixture runtime/test/shaders/cs_buf_tfe.asm (registered in check.py and run_gpu_tests.py): seeds
    three status VGPRs, loads with tfe (dword, dwordx2, ushort) and checks the data plus the untouched statuses.
    run_gpu_tests.py --filter cs_buf_tfe: PASS on an RTX 5090 (NVIDIA 595.99.02, Ubuntu 26.04) and on the
    Ryzen 9 9950X's Radeon iGPU (RADV, Mesa 26.0.8)
    , all 7 words as expected.
  • New tests/semantic/test_buffer_load_tfe.py (6 tests, including the MTBUF form and the refused store/atomic).
  • python -I scripts/run_semantic_tests.py tests/semantic: 496 files, 6,339 tests, 0 failed.
  • pytest tests/test_translate.py: 714 passed; the 2 failures are cs_dpp_cmp.asm with LLVM 21, failing on main too
    (#1375).
  • python -m compileall, tests/test_ci_registration.py: clean.

GPUs tested: NVIDIA GeForce RTX 5090 (595.99.02, Ubuntu 26.04.1); AMD Radeon iGPU of the Ryzen 9 9950X (RADV, Mesa 26.0.8)

AI-assisted: yes (Claude Code, with a Devin draft reviewed, rebased and GPU-tested)

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.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP


🔄 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/2164 **Author:** [@vinceychu](https://github.com/vinceychu) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `shader-buffer-tfe` --- ### 📝 Commits (1) - [`4191a1d`](https://github.com/ubiquitarianism/leonida/commit/4191a1d6804300cff5605cc171ec320f4b79fe2d) rdna2spirv: tfe on buffer_load* / tbuffer_load* (SHADER-BUFFER-TFE) ### 📊 Changes **8 files changed** (+213 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+1 -0) 📝 `runtime/test/shaders/check.py` (+3 -1) ➕ `runtime/test/shaders/cs_buf_tfe.asm` (+36 -0) 📝 `scripts/run_gpu_tests.py` (+5 -1) 📝 `tests/semantic/test_buffer_load_sub.py` (+0 -1) ➕ `tests/semantic/test_buffer_load_tfe.py` (+146 -0) 📝 `tests/semantic/test_vector_mem_mubuf.py` (+1 -1) 📝 `tools/rdna2spirv.py` (+21 -13) </details> ### 📄 Description Claimed in the coordination issue as: SHADER-BUFFER-TFE (#1608) ### What and why The translator refused `tfe` on every buffer load (`raise Unsupported(op + " form")`). Image loads already take `tfe` (design.md, "Resident `image_load tfe`", GPU-checked by `cs_imgload_tfe`); buffer loads now do the same. - With `tfe` the VDATA range holds one status dword after the data VGPRs (`buffer_load_dword v[4:5]`, `buffer_load_dwordx2 v[6:8]`, ...; the status register is `vdst[data_count]`). - The ISA writes the status only when the fetch NACKs (MUBUF/MTBUF TFE field, partially resident resources); a Vulkan buffer cannot NACK, so the status VGPR keeps its prior value: the resident case, the same as the measured image one. The translator emits no write for it and checks that the operand range includes it. - Covered: `buffer_load_dword[xN]`, the sub-dword loads, `_d16`, `buffer_load_format_*` and `tbuffer_load_format_*`. `tfe` on stores and atomics stays refused: the ISA defines no status dword for them (llvm-mc rejects it too). - `tbuffer_load_format_* tfe`: llvm-mc gfx1013 cannot assemble it, but the ISA's MTBUF encoding has the TFE bit, so it is accepted and checked by the semantic test only (noted in the design.md row). ### Tested - New GPU fixture `runtime/test/shaders/cs_buf_tfe.asm` (registered in `check.py` and `run_gpu_tests.py`): seeds three status VGPRs, loads with `tfe` (dword, dwordx2, ushort) and checks the data plus the untouched statuses. `run_gpu_tests.py --filter cs_buf_tfe`: **PASS on an RTX 5090 (NVIDIA 595.99.02, Ubuntu 26.04) and on the Ryzen 9 9950X's Radeon iGPU (RADV, Mesa 26.0.8)**, all 7 words as expected. - New `tests/semantic/test_buffer_load_tfe.py` (6 tests, including the MTBUF form and the refused store/atomic). - `python -I scripts/run_semantic_tests.py tests/semantic`: 496 files, 6,339 tests, 0 failed. - `pytest tests/test_translate.py`: 714 passed; the 2 failures are `cs_dpp_cmp.asm` with LLVM 21, failing on main too (#1375). - `python -m compileall`, `tests/test_ci_registration.py`: clean. GPUs tested: NVIDIA GeForce RTX 5090 (595.99.02, Ubuntu 26.04.1); AMD Radeon iGPU of the Ryzen 9 9950X (RADV, Mesa 26.0.8) AI-assisted: yes (Claude Code, with a Devin draft reviewed, rebased and GPU-tested) ### 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RAL8MMXUuNpQAVa1iiyAMP --- <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#2168
No description provided.