[PR #134] [CLOSED] Tests: GPU coverage for v_add/sub_nc_i16, 16-bit min3/max3/med3 and v_pk_add_u16/v_pk_mad_i16 #186

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/134
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: old-pr/9864


📝 Commits (1)

  • 6a592eb Tests: GPU coverage for v_add/sub_nc_i16, 16-bit min3/max3/med3 and v_pk_add_u16/v_pk_mad_i16

📊 Changes

4 files changed (+97 additions, -8 deletions)

View changed files

📝 docs/design.md (+3 -3)
📝 runtime/test/shaders/check.py (+5 -2)
➕ runtime/test/shaders/cs_valu16_ext.asm (+83 -0)
📝 scripts/run_gpu_tests.py (+6 -3)

📄 Description

Carried over from old PR 9864 by KoLolX3 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9864, 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.
KoLolX3: 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):

docs/design.md marks three 16-bit VALU rows Not GPU-verified: the instructions were measured on hardware and the translations CPU-checked, but the SPIR-V the translator emits had never run on a GPU. No open PR adds a fixture for them.

This adds runtime/test/shaders/cs_valu16_ext.asm (one lane, laid out like cs_lds_b64_cmpst.asm). Every destination is preset to 0xA5A5A5A5, so the half an op does not write shows up as 0xA5A5:

word op case expected
0 v_add_nc_i16 clamp 0x7FFF + 1 saturates 0xA5A57FFF
1 v_sub_nc_i16 op_sel:[0,0,1] clamp 0x8000 - 1 saturates, into the high half 0x8000A5A5
2 v_add_nc_i16 0x7FFF + 1 wraps without clamp 0xA5A58000
3 v_med3_i16 op_sel:[1,0,0,0] S0's high half (-5), 7, 3 0xA5A50003
4 v_max3_u16 / v_min3_u16 op_sel:[0,0,0,1] (0xFFFB, 7, 3), one result per half 0x0003FFFB
5 v_min3_f16 / v_max3_f16 op_sel:[0,0,0,1] (1.0, qNaN, -2.0): the NaN yields the other operands 0x3C00C000
6 v_pk_add_u16 clamp high half 0xFFF0 + 0x20 saturates, low 5 + 3 0xFFFF0008
7 v_pk_mad_i16 low -1 * 4 + 16, high 2 * 3 + 1 0x0007000C

The words are derived in the .asm header from the rows. The fixture is registered in check.py and scripts/run_gpu_tests.py next to cs_lds_b64_cmpst. The three rows keep their marker and add a "GPU-checked by" note, as the ds_cmpst_b32 row does. The Integer clamp row (u16 clamp) is not touched: this fixture doesn't cover v_add_nc_u16 clamp.

Tested on an AMD Radeon RX 7900 XT (RADV NAVI31, Mesa 26.3.1, subgroup 32..64), Artix Linux, llvm-mc 23.1.5, programs built from this branch's base:

  • cs_valu16_ext passes with all eight words exact, native and with LEONIDA_W64_EMULATE=1.
  • Negative control: expecting word 0 to wrap (0xA5A58000, clamp ignored) makes it FAIL.
  • Full scripts/run_gpu_tests.py suite, native and emulated: no failure except the known ms_wave_info_s3 flake (#6172, fixes in #5855/#5741), which fails intermittently on main on this card.
  • The 50 test files that read check.py, run_gpu_tests.py, design.md or the shader fixtures: the same failure set as a clean worktree of the merge base on this machine (26, environment-only). The branch adds 2 passing tests and 12 subtests.

Resubmitted from #9579 (closed with the other outside PRs on 2026-11-23), rebased onto main 2d53a8055. Related: #9494, #9761 (merged), #9813. Synthetic fixture only, no game files. AI-assisted (Claude Code).

On the rebased branch, the full suite on this card also shows cs_imgload_tfe, cs_imgload_d16_tfe, cs_w32_exec_computed and cs_w64_exec_computed failing; they fail the same way on a clean worktree of main, so they are not this change.


🔄 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/134 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/9864` --- ### 📝 Commits (1) - [`6a592eb`](https://github.com/ubiquitarianism/leonida/commit/6a592eb96edb35468c6939989e1984d34707dfd9) Tests: GPU coverage for v_add/sub_nc_i16, 16-bit min3/max3/med3 and v_pk_add_u16/v_pk_mad_i16 ### 📊 Changes **4 files changed** (+97 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `docs/design.md` (+3 -3) 📝 `runtime/test/shaders/check.py` (+5 -2) ➕ `runtime/test/shaders/cs_valu16_ext.asm` (+83 -0) 📝 `scripts/run_gpu_tests.py` (+6 -3) </details> ### 📄 Description > Carried over from **old PR 9864** by `KoLolX3` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9864`, 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. > `KoLolX3`: 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): `docs/design.md` marks three 16-bit VALU rows **Not GPU-verified**: the instructions were measured on hardware and the translations CPU-checked, but the SPIR-V the translator emits had never run on a GPU. No open PR adds a fixture for them. This adds `runtime/test/shaders/cs_valu16_ext.asm` (one lane, laid out like `cs_lds_b64_cmpst.asm`). Every destination is preset to `0xA5A5A5A5`, so the half an op does not write shows up as `0xA5A5`: | word | op | case | expected | |---|---|---|---| | 0 | `v_add_nc_i16 clamp` | 0x7FFF + 1 saturates | `0xA5A57FFF` | | 1 | `v_sub_nc_i16 op_sel:[0,0,1] clamp` | 0x8000 - 1 saturates, into the high half | `0x8000A5A5` | | 2 | `v_add_nc_i16` | 0x7FFF + 1 wraps without clamp | `0xA5A58000` | | 3 | `v_med3_i16 op_sel:[1,0,0,0]` | S0's high half (-5), 7, 3 | `0xA5A50003` | | 4 | `v_max3_u16` / `v_min3_u16 op_sel:[0,0,0,1]` | (0xFFFB, 7, 3), one result per half | `0x0003FFFB` | | 5 | `v_min3_f16` / `v_max3_f16 op_sel:[0,0,0,1]` | (1.0, qNaN, -2.0): the NaN yields the other operands | `0x3C00C000` | | 6 | `v_pk_add_u16 clamp` | high half 0xFFF0 + 0x20 saturates, low 5 + 3 | `0xFFFF0008` | | 7 | `v_pk_mad_i16` | low -1 * 4 + 16, high 2 * 3 + 1 | `0x0007000C` | The words are derived in the `.asm` header from the rows. The fixture is registered in `check.py` and `scripts/run_gpu_tests.py` next to `cs_lds_b64_cmpst`. The three rows keep their marker and add a "GPU-checked by" note, as the `ds_cmpst_b32` row does. The Integer clamp row (u16 clamp) is not touched: this fixture doesn't cover `v_add_nc_u16 clamp`. Tested on an AMD Radeon RX 7900 XT (RADV NAVI31, Mesa 26.3.1, subgroup 32..64), Artix Linux, llvm-mc 23.1.5, programs built from this branch's base: - `cs_valu16_ext` passes with all eight words exact, native and with `LEONIDA_W64_EMULATE=1`. - Negative control: expecting word 0 to wrap (`0xA5A58000`, clamp ignored) makes it FAIL. - Full `scripts/run_gpu_tests.py` suite, native and emulated: no failure except the known `ms_wave_info_s3` flake (`#6172`, fixes in `#5855`/#5741), which fails intermittently on `main` on this card. - The 50 test files that read `check.py`, `run_gpu_tests.py`, `design.md` or the shader fixtures: the same failure set as a clean worktree of the merge base on this machine (26, environment-only). The branch adds 2 passing tests and 12 subtests. Resubmitted from `#9579` (closed with the other outside PRs on 2026-11-23), rebased onto `main` `2d53a8055`. Related: `#9494`, `#9761` (merged), `#9813`. Synthetic fixture only, no game files. AI-assisted (Claude Code). On the rebased branch, the full suite on this card also shows `cs_imgload_tfe`, `cs_imgload_d16_tfe`, `cs_w32_exec_computed` and `cs_w64_exec_computed` failing; they fail the same way on a clean worktree of `main`, so they are not this change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:04 +01:00
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#186
No description provided.