[PR #711] [MERGED] OLD-7866: restore old upstream PR 7866 - tests/semantic: buffer_load_short_d16_hi keeps both halves in inactive lanes #752

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/711
Author: @aslan2142
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142

Base: main ← Head: semantic-d16-hi-inactive-lane


📝 Commits (1)

  • cd92de7 tests/semantic: buffer_load_short_d16_hi keeps both halves in inactive lanes

📊 Changes

2 files changed (+95 additions, -0 deletions)

View changed files

➕ tests/semantic/fixtures/cs_buffer_load_d16_hi_exec.asm (+17 -0)
➕ tests/semantic/test_buffer_load_d16_hi_exec.py (+78 -0)

📄 Description

Claimed in the coordination issue as: OLD-7866 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131591797

Restoration of my original pull request, old upstream PR 7866 in ItsNotRexed/Leonida, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 21625bca8c; the commit applied unchanged (two new files, no conflicts, no old numbers in it).

What and why

  • A guard, not a fix: main already gets this right. In Gen.buffer_sub (tools/rdna2spirv.py, the end of the function) the loaded half goes in with OpBitFieldInsert and self.dst writes it to active lanes only.
  • The gap: no test checked an inactive lane for a d16 buffer load. test_buffer_sub_dword.py checks an inactive lane only for a store.
  • The fixture: tests/semantic/fixtures/cs_buffer_load_d16_hi_exec.asm is hand-written, wave32.
    • Every lane puts its own value in v5, then EXEC is cut to 0x5AC3A50F.
    • Each lane runs buffer_load_short_d16_hi into v5, then stores v5 from all lanes.
  • The test: tests/semantic/test_buffer_load_d16_hi_exec.py checks:
    • the 16 active lanes get the loaded word in the high half and keep their low half;
    • the 16 inactive lanes keep both halves;
    • the expected values worked out by hand, and that the fixture matches the file.
  • The contract it pins is the existing docs/design.md row "8/16-bit MUBUF d16 loads and stores": "Inactive lanes neither load nor store". No translator rule changes.

Tested

Linux, Python 3.14.10, CPU only (spirv_mini_interp), hand-written fixtures; no game files.

  • python -m unittest discover -s tests/semantic -p test_buffer_load_d16_hi_exec.py: 3 tests OK on this branch. With only these two files copied onto main the result is the same, since main already behaves this way.
  • Mutation check: with the d16 load's result written to every lane (store_reg in place of self.dst, ignoring EXEC), this test fails in all 16 inactive lanes. test_buffer_sub_dword.py still passes with that change, so this is the only test that catches it.
  • python -I scripts/run_semantic_tests.py tests/semantic:
    • main: 465 files, 6 108 tests, 0 failed;
    • this branch: 466 files, 6 111 tests, 0 failed.
  • python -m compileall -q tools tests, git diff --check and python -I scripts/check_no_game_data.py on both new files: clean.

GPUs tested: n/a

AI-assisted: yes

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. (n/a: no rule changes)

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


🔄 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/711 **Author:** [@aslan2142](https://github.com/aslan2142) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/25/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `semantic-d16-hi-inactive-lane` --- ### 📝 Commits (1) - [`cd92de7`](https://github.com/ubiquitarianism/leonida/commit/cd92de745fa4e385f11b3b21025afad886d32cb3) tests/semantic: buffer_load_short_d16_hi keeps both halves in inactive lanes ### 📊 Changes **2 files changed** (+95 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `tests/semantic/fixtures/cs_buffer_load_d16_hi_exec.asm` (+17 -0) ➕ `tests/semantic/test_buffer_load_d16_hi_exec.py` (+78 -0) </details> ### 📄 Description Claimed in the coordination issue as: OLD-7866 https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7131591797 Restoration of my original pull request, old upstream PR 7866 in `ItsNotRexed/Leonida`, which was closed unmerged when that repository went private on 2026-11-23 (old numbers link nowhere now). Rebased onto main at 21625bca8c675c62f9dbffc318ce6a59d57faf31; the commit applied unchanged (two new files, no conflicts, no old numbers in it). ### What and why - **A guard, not a fix:** `main` already gets this right. In `Gen.buffer_sub` (`tools/rdna2spirv.py`, the end of the function) the loaded half goes in with `OpBitFieldInsert` and `self.dst` writes it to active lanes only. - **The gap:** no test checked an inactive lane for a d16 buffer *load*. `test_buffer_sub_dword.py` checks an inactive lane only for a store. - **The fixture:** `tests/semantic/fixtures/cs_buffer_load_d16_hi_exec.asm` is hand-written, wave32. - Every lane puts its own value in `v5`, then EXEC is cut to `0x5AC3A50F`. - Each lane runs `buffer_load_short_d16_hi` into `v5`, then stores `v5` from all lanes. - **The test:** `tests/semantic/test_buffer_load_d16_hi_exec.py` checks: - the 16 active lanes get the loaded word in the high half and keep their low half; - the 16 inactive lanes keep both halves; - the expected values worked out by hand, and that the fixture matches the file. - The contract it pins is the existing `docs/design.md` row "8/16-bit MUBUF d16 loads and stores": "Inactive lanes neither load nor store". No translator rule changes. ### Tested Linux, Python 3.14.10, CPU only (`spirv_mini_interp`), hand-written fixtures; no game files. - `python -m unittest discover -s tests/semantic -p test_buffer_load_d16_hi_exec.py`: 3 tests OK on this branch. With only these two files copied onto `main` the result is the same, since `main` already behaves this way. - **Mutation check:** with the d16 load's result written to every lane (`store_reg` in place of `self.dst`, ignoring EXEC), this test fails in all 16 inactive lanes. `test_buffer_sub_dword.py` still passes with that change, so this is the only test that catches it. - `python -I scripts/run_semantic_tests.py tests/semantic`: - `main`: 465 files, 6 108 tests, 0 failed; - this branch: 466 files, 6 111 tests, 0 failed. - `python -m compileall -q tools tests`, `git diff --check` and `python -I scripts/check_no_game_data.py` on both new files: clean. GPUs tested: n/a AI-assisted: yes ### 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. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no rule changes) AI-assisted (Claude Code, Claude Opus 5.5). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:56 +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#752
No description provided.