tests: correct resident TFE status expectations (SHADER-1266) #892

Manually merged
github merged 2 commits from gh-pr/892/head into gh-pr/892/base 2026-11-26 09:26:40 +00:00
Owner

@⁠moffington on GitHub · 2026-11-24 14:59 UTC · original
moffington:fix/shader-1266-tfe-fixtures → main · +21 −14 · 2 files · 2 commits · merged 2026-11-24 17:15 UTC

Fixes #31.
Claimed in the coordination issue as: SHADER-1266

Summary

  • Updates runtime/test/shaders/cs_imgload_tfe.asm and runtime/test/shaders/cs_imgload_d16_tfe.asm so resident image_load ... tfe checks preservation of each pre-seeded status VGPR rather than expecting 0.
  • Preserves tools/rdna2spirv.py untouched.
  • Seeds distinct values (v8 = 0x3e8, v12 = 0x7d0) before the two image_load ... tfe instructions and independently checks both via (v8 ^ 0x3e8) | (v12 ^ 0x7d0) added into v11, so zeroing or modifying either status VGPR shifts every texel.
  • Native RDNA2 hardware measurements on AMD GFX1036 reported in #98 (48 kernels, 192 lanes, 3 seeds, HIP 60450101, LLVM 23.1.6) showed that a resident image_load ... tfe leaves the status VGPR unchanged (preserving the pre-seeded value), consistent with LLVM SIISelLowering.cpp initializing the TFE/LWE status register prior to the instruction.
  • #291 takes the alternative approach of modifying tools/rdna2spirv.py to write 0 to vdata[data_vgprs] on resident image_load / image_load_mip (the same translator change previously closed in #98). This PR keeps main's current translator semantics intact and updates the two inherited fixtures instead.

Validation (Linux, NVIDIA GeForce RTX 3060, Driver 615.78.08, Vulkan 1.4.351)

  • Native (scripts/run_gpu_tests.py): 258/258 translated and spirv-val valid; 200/249 passed, 49 skipped, 0 failed (cs_imgload_tfe and cs_imgload_d16_tfe both pass with r32 sint (sint view): 0 bad, texel(5,3) = 71, 0 regressions vs. main).
  • Wave64-emulated (LEONIDA_W64_EMULATE=1): 258/258 translated and spirv-val valid; 232/249 passed, 17 skipped, 0 failed (0 regressions vs. main).
  • Negative control: Applying the status-zeroing translator diff to tools/rdna2spirv.py causes run_gpu_tests.py --filter tfe to fail both corrected fixtures (0/2 passed: cs_imgload_tfe and cs_imgload_d16_tfe both FAIL, 64 bad, texel(5,3) = 2111).
  • Hygiene: scripts/check_no_game_data.py passed on both modified .asm files.

Limitations

  • Covers resident image_load ... tfe (32-bit and d16 2D) only; sparse-page NACK (status != 0) and lwe behavior remain outside this measurement.

No game files and nothing online. AI-assisted.

**@⁠moffington** on GitHub · 2026-11-24 14:59 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/892) `moffington:fix/shader-1266-tfe-fixtures` → `main` · +21 −14 · 2 files · 2 commits · merged 2026-11-24 17:15 UTC Fixes #31. Claimed in the coordination issue as: `SHADER-1266` ## Summary - Updates `runtime/test/shaders/cs_imgload_tfe.asm` and `runtime/test/shaders/cs_imgload_d16_tfe.asm` so resident `image_load ... tfe` checks **preservation** of each pre-seeded status VGPR rather than expecting `0`. - Preserves `tools/rdna2spirv.py` untouched. - Seeds distinct values (`v8 = 0x3e8`, `v12 = 0x7d0`) before the two `image_load ... tfe` instructions and independently checks both via `(v8 ^ 0x3e8) | (v12 ^ 0x7d0)` added into `v11`, so zeroing or modifying either status VGPR shifts every texel. ## Context & Related Work - Native RDNA2 hardware measurements on AMD GFX1036 reported in #98 (48 kernels, 192 lanes, 3 seeds, HIP `60450101`, LLVM `23.1.6`) showed that a resident `image_load ... tfe` leaves the status VGPR unchanged (preserving the pre-seeded value), consistent with LLVM `SIISelLowering.cpp` initializing the TFE/LWE status register prior to the instruction. - #291 takes the alternative approach of modifying `tools/rdna2spirv.py` to write `0` to `vdata[data_vgprs]` on resident `image_load` / `image_load_mip` (the same translator change previously closed in #98). This PR keeps `main`'s current translator semantics intact and updates the two inherited fixtures instead. ## Validation (Linux, NVIDIA GeForce RTX 3060, Driver `615.78.08`, Vulkan `1.4.351`) - **Native (`scripts/run_gpu_tests.py`):** `258/258` translated and `spirv-val` valid; **`200/249` passed, `49` skipped, `0` failed** (`cs_imgload_tfe` and `cs_imgload_d16_tfe` both pass with `r32 sint (sint view): 0 bad, texel(5,3) = 71`, `0` regressions vs. `main`). - **Wave64-emulated (`LEONIDA_W64_EMULATE=1`):** `258/258` translated and `spirv-val` valid; **`232/249` passed, `17` skipped, `0` failed** (`0` regressions vs. `main`). - **Negative control:** Applying the status-zeroing translator diff to `tools/rdna2spirv.py` causes `run_gpu_tests.py --filter tfe` to fail both corrected fixtures (`0/2` passed: `cs_imgload_tfe` and `cs_imgload_d16_tfe` both `FAIL`, `64 bad, texel(5,3) = 2111`). - **Hygiene:** `scripts/check_no_game_data.py` passed on both modified `.asm` files. ## Limitations - Covers resident `image_load ... tfe` (32-bit and `d16` 2D) only; sparse-page NACK (`status != 0`) and `lwe` behavior remain outside this measurement. No game files and nothing online. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:26:38 +00:00
github manually merged commit b0224e44fc into gh-pr/892/base 2026-11-26 09:26:40 +00:00
Author
Owner

@⁠SweatierKey on GitHub · 2026-11-24 15:05 UTC · original · approved these changes

Independent A/B hardware verification on NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11, Vulkan 1.4) against origin/main@a28927849:

Built & validated (runtime/test/shaders/build.py + spirv-val --target-env vulkan1.3, both native and LEONIDA_W64_EMULATE=1):

  • cs_imgload_tfe + cs_imgload_d16_tfe: 2 translated, 2 pass spirv-val in both modes.

A/B execution via vk_store_test.exe (load / load-d16):

  • Before (origin/main@a28927849): both cs_imgload_tfe and cs_imgload_d16_tfe fail in native and LEONIDA_W64_EMULATE=1 with r32 sint (sint view): 64 bad, texel(5,3) = 2071 (rc=1).
  • After (8afbba14b): both cs_imgload_tfe and cs_imgload_d16_tfe pass in native and LEONIDA_W64_EMULATE=1 with 0 bad on all 3 views (rgba8 unorm, r32 uint, r32 sint, texel(5,3) = 71, rc=0).
  • scripts/check_no_game_data.py: clean.

Clean minimal fix matching the resident-TFE semantics measured on hardware.

GPUs tested: NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11)
AI-assisted: yes

**@⁠SweatierKey** on GitHub · 2026-11-24 15:05 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/892#pullrequestreview-6041769301) · **approved these changes** Independent A/B hardware verification on **NVIDIA GeForce RTX 5070 Ti** (driver 616.92, Windows 11, Vulkan 1.4) against `origin/main@a28927849`: **Built & validated** (`runtime/test/shaders/build.py` + `spirv-val --target-env vulkan1.3`, both native and `LEONIDA_W64_EMULATE=1`): - `cs_imgload_tfe` + `cs_imgload_d16_tfe`: `2 translated, 2 pass spirv-val` in both modes. **A/B execution via `vk_store_test.exe`** (`load` / `load-d16`): - **Before (`origin/main@a28927849`)**: both `cs_imgload_tfe` and `cs_imgload_d16_tfe` fail in native and `LEONIDA_W64_EMULATE=1` with `r32 sint (sint view): 64 bad, texel(5,3) = 2071` (`rc=1`). - **After (`8afbba14b`)**: both `cs_imgload_tfe` and `cs_imgload_d16_tfe` pass in native and `LEONIDA_W64_EMULATE=1` with `0 bad` on all 3 views (`rgba8 unorm`, `r32 uint`, `r32 sint`, `texel(5,3) = 71`, `rc=0`). - `scripts/check_no_game_data.py`: clean. Clean minimal fix matching the resident-TFE semantics measured on hardware. GPUs tested: NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11) AI-assisted: yes
Author
Owner

@⁠LewisStephens99 on GitHub · 2026-11-24 15:08 UTC · original

Independent verification on NVIDIA RTX A2000 12GB, Windows 11, NVIDIA 32.0.16.2114, Vulkan 1.4.363, LLVM-MC 21.1.8:n- python -I scripts/run_gpu_tests.py --build runtime/build/vulkan-full --work --filter imgload: 4/4 passed (cs_imgload, cs_imgload_d16, cs_imgload_tfe, cs_imgload_d16_tfe), all spirv-val valid.n- tests/test_image_load_typed.py: 23/23 passed.nnNo game files or retail assets used. AI-assisted.

**@⁠LewisStephens99** on GitHub · 2026-11-24 15:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/892#issuecomment-7135537077) Independent verification on NVIDIA RTX A2000 12GB, Windows 11, NVIDIA 32.0.16.2114, Vulkan 1.4.363, LLVM-MC 21.1.8:`n- `python -I scripts/run_gpu_tests.py --build runtime/build/vulkan-full --work <work> --filter imgload`: 4/4 passed (`cs_imgload`, `cs_imgload_d16`, `cs_imgload_tfe`, `cs_imgload_d16_tfe`), all spirv-val valid.`n- `tests/test_image_load_typed.py`: 23/23 passed.`n`nNo game files or retail assets used. AI-assisted.
Author
Owner

@⁠morodirule on GitHub · 2026-11-24 15:50 UTC · original

Independent Linux/RTX 4070 verification of the fixture-only fix (no game files): built cs_imgload_tfe + cs_imgload_d16_tfe from head 8afbba14b with runtime/test/shaders/build.py (2 translated, 2 spirv-val clean) and ran vk_store_test load on NVIDIA GeForce RTX 4070, driver 620.70.06, Vulkan 1.4.357, Arch Linux. Both now report 0 bad in all three views with texel(5,3)=71 (expected 100-(8*3+5)); the old fixtures on this same card failed the r32 sint view with 64 bad / texel(5,3)=2071. This matches the PR premise: resident image_load tfe preserves the seeded status VGPRs (0x3e8/0x7d0) through the current translator. Not claiming; review evidence only.

**@⁠morodirule** on GitHub · 2026-11-24 15:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/892#issuecomment-7136690015) Independent Linux/RTX 4070 verification of the fixture-only fix (no game files): built cs_imgload_tfe + cs_imgload_d16_tfe from head 8afbba14b with runtime/test/shaders/build.py (2 translated, 2 spirv-val clean) and ran vk_store_test load on NVIDIA GeForce RTX 4070, driver 620.70.06, Vulkan 1.4.357, Arch Linux. Both now report 0 bad in all three views with texel(5,3)=71 (expected 100-(8*3+5)); the old fixtures on this same card failed the r32 sint view with 64 bad / texel(5,3)=2071. This matches the PR premise: resident image_load tfe preserves the seeded status VGPRs (0x3e8/0x7d0) through the current translator. Not claiming; review evidence only.
Author
Owner

@⁠thesubtleties on GitHub · 2026-11-24 16:17 UTC · original

Tested 8afbba14b merged onto 1504c1af6, Linux: RTX 3080 (620.73.04) 201/250 native and 233/250 with LEONIDA_W64_EMULATE=1; gfx1036 iGPU (RADV, Mesa 26.3.1) 234/250; 0 failed. Only the two tfe fixtures change from main. Merged with #291 as well, both fail again (2111), so they are mutually exclusive. Compile-only evidence for preservation: RADV emits v_lshrrev_b64 v[2:3], 0, 0 before image_load … tfe, with the old value as an operand, and LLVM llc for gfx1036 zeroes both VGPRs first. This is indirect, and I did not measure the hardware. No game files. AI-assisted (Claude Code).

**@⁠thesubtleties** on GitHub · 2026-11-24 16:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/892#issuecomment-7137426576) Tested `8afbba14b` merged onto `1504c1af6`, Linux: RTX 3080 (620.73.04) 201/250 native and 233/250 with `LEONIDA_W64_EMULATE=1`; gfx1036 iGPU (RADV, Mesa 26.3.1) 234/250; 0 failed. Only the two tfe fixtures change from `main`. Merged with #291 as well, both fail again (2111), so they are mutually exclusive. Compile-only evidence for preservation: RADV emits `v_lshrrev_b64 v[2:3], 0, 0` before `image_load … tfe`, with the old value as an operand, and LLVM `llc` for gfx1036 zeroes both VGPRs first. This is indirect, and I did not measure the hardware. No game files. AI-assisted (Claude Code).
Author
Owner

@⁠syntaxixr on GitHub · 2026-11-24 16:49 UTC · original · edited 2026-11-24 16:58 UTC

Tested 8afbba1 on AMD Radeon RX 6600 (RDNA2, Navi 23 / GFX1032), AMD Windows driver 26.6.4 (32.0.21043.19003), Windows 10 19045, llvm-mc 23.1.6, SPIRV-Tools v2026.4, reusing a runtime build of main 3ed8e50 (this PR only touches the two fixtures):

main 3ed8e50 this PR
run_gpu_tests.py --filter imgload, native cs_imgload_tfe, cs_imgload_d16_tfe FAIL (64 bad, texel(5,3) = 2071) 4/4 PASS, texel(5,3) = 71
same, LEONIDA_W64_EMULATE=1 same two FAIL 4/4 PASS

So AMD's proprietary Windows compiler on native wave64 hardware also preserves the seeded status VGPR on resident reads. Full record in #1017. No game files. AI-assisted.

**@⁠syntaxixr** on GitHub · 2026-11-24 16:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/892#issuecomment-7138260757) · edited 2026-11-24 16:58 UTC Tested `8afbba1` on AMD Radeon RX 6600 (RDNA2, Navi 23 / GFX1032), AMD Windows driver 26.6.4 (32.0.21043.19003), Windows 10 19045, llvm-mc 23.1.6, SPIRV-Tools v2026.4, reusing a runtime build of `main` 3ed8e50 (this PR only touches the two fixtures): | | `main` 3ed8e50 | this PR | |---|---|---| | `run_gpu_tests.py --filter imgload`, native | `cs_imgload_tfe`, `cs_imgload_d16_tfe` FAIL (64 bad, texel(5,3) = 2071) | 4/4 PASS, texel(5,3) = 71 | | same, `LEONIDA_W64_EMULATE=1` | same two FAIL | 4/4 PASS | So AMD's proprietary Windows compiler on native wave64 hardware also preserves the seeded status VGPR on resident reads. Full record in #1017. No game files. AI-assisted.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 17:14 UTC · original

Reviewed and merging. The fixtures were wrong, not the translator: a resident image_load ... tfe keeps the seeded status VGPR.

  • Translated, main vs this PR: run_gpu_tests.py --filter cs_imgload went from 2/4 (both tfe fixtures at 64 bad) to 4/4 (0 bad) on llvmpipe, RADV gfx1036 (Ryzen 9 7950X3D iGPU) and RADV RX 7900 XTX (Mesa 26.3.1, Linux).
  • Native: a raw dispatch on the gfx1036 iGPU left the seeded status VGPR unchanged for d32 and d16, matching the measurement on #98.
  • The check keeps its strength: (v8 ^ 0x3e8) | (v12 ^ 0x7d0) is 0 only when both status VGPRs keep their own seeds, so writing any value to either one still fails.
  • CI: the first run's only failure was the windows link error (WaitOnAddress) that was on main and is fixed by #877. linux-gpu-tools, which runs these fixtures, passed. The branch was updated with main for a fresh run.
  • Follow-ups:
    • #291 (draft) zeroes the status VGPR in the translator, which this measurement contradicts.
    • A docs/design.md row for the image_load tfe status, saying a resident load leaves it unchanged, would keep the zeroing change from coming back.

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

**@⁠aslan2142** on GitHub · 2026-11-24 17:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/892#issuecomment-7138908041) Reviewed and merging. The fixtures were wrong, not the translator: a resident `image_load ... tfe` keeps the seeded status VGPR. - **Translated, `main` vs this PR:** `run_gpu_tests.py --filter cs_imgload` went from 2/4 (both tfe fixtures at `64 bad`) to 4/4 (`0 bad`) on llvmpipe, RADV gfx1036 (Ryzen 9 7950X3D iGPU) and RADV RX 7900 XTX (Mesa 26.3.1, Linux). - **Native:** a raw dispatch on the gfx1036 iGPU left the seeded status VGPR unchanged for d32 and d16, matching the measurement on #98. - **The check keeps its strength:** `(v8 ^ 0x3e8) | (v12 ^ 0x7d0)` is 0 only when both status VGPRs keep their own seeds, so writing any value to either one still fails. - **CI:** the first run's only failure was the `windows` link error (`WaitOnAddress`) that was on `main` and is fixed by #877. `linux-gpu-tools`, which runs these fixtures, passed. The branch was updated with `main` for a fresh run. - **Follow-ups:** - #291 (draft) zeroes the status VGPR in the translator, which this measurement contradicts. - A `docs/design.md` row for the `image_load` `tfe` status, saying a resident load leaves it unchanged, would keep the zeroing change from coming back. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠GeorgiyDemo on GitHub · 2026-11-24 20:20 UTC · original

Tested 8afbba14b on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), binaries from main d0da7dade:

  • main, scripts at main: cs_imgload_tfe and cs_imgload_d16_tfe FAIL with r32 sint (sint view): 64 bad, texel(5,3) = 2071; the other two pass (2/4).
  • This head: 4/4 PASS on MoltenVK 1.4.2 and 4/4 on KosmicKrisp (Mesa 26.3.1), every texel at 71.

Conflict worth settling before merge: #291 (rdna2spirv: zero the tfe/lwe status VGPR on image_load) makes the same two fixtures pass by having the translator write 0 into the status VGPR, while this PR changes the fixtures to expect the resident status to be left unchanged. I ran the two together — #291's translator with these two .asm files — and both fixtures FAIL (2/4) on MoltenVK, so the two PRs encode opposite expectations and only one can land as written. Either the fixtures accept both behaviours or one of the two approaches is dropped.

AI-assisted; synthetic fixtures only, no game data.

**@⁠GeorgiyDemo** on GitHub · 2026-11-24 20:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/892#issuecomment-7143382464) Tested `8afbba14b` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), binaries from `main` `d0da7dade`: - **`main`, scripts at `main`:** `cs_imgload_tfe` and `cs_imgload_d16_tfe` FAIL with `r32 sint (sint view): 64 bad, texel(5,3) = 2071`; the other two pass (2/4). - **This head:** 4/4 PASS on **MoltenVK 1.4.2** and 4/4 on **KosmicKrisp** (Mesa 26.3.1), every texel at 71. **Conflict worth settling before merge:** #291 (`rdna2spirv: zero the tfe/lwe status VGPR on image_load`) makes the same two fixtures pass by having the translator write 0 into the status VGPR, while this PR changes the fixtures to expect the resident status to be left unchanged. I ran the two together — #291's translator with these two `.asm` files — and both fixtures FAIL (2/4) on MoltenVK, so the two PRs encode opposite expectations and only one can land as written. Either the fixtures accept both behaviours or one of the two approaches is dropped. AI-assisted; synthetic fixtures only, no game data.
This discussion has been locked. Commenting is limited to contributors.
No description provided.