[PR #590] [MERGED] tests: GPU readback for dynamic 64-bit vector shifts (GPU-VALU64-SHIFTS) #631

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

📋 Pull Request Information

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

Base: main ← Head: codex/gpu-valu64-shifts


📝 Commits (1)

  • 49d904f tests: GPU readback for dynamic 64-bit vector shifts (GPU-VALU64-SHIFTS)

📊 Changes

5 files changed (+169 additions, -0 deletions)

View changed files

📝 docs/testing.md (+11 -0)
📝 runtime/test/shaders/check.py (+28 -0)
➕ runtime/test/shaders/cs_w32_shift64.asm (+29 -0)
📝 scripts/run_gpu_tests.py (+5 -0)
➕ tests/test_gpu_shift64.py (+96 -0)

📄 Description

Claimed in the coordination issue as: GPU-VALU64-SHIFTS — https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7126974854

What and why

The existing 64-bit vector-shift rules have CPU semantic coverage but no dedicated GPU fixture. Add cs_w32_shift64: 64 memory-fed cases cross eight boundary values with counts 0, 1, 31, 32, 33, 63, 64 and 65. It exercises v_lshlrev_b64, v_lshrrev_b64 and v_ashrrev_i64, with destinations overlapping the count register, one source word, or the entire source pair.

Both GPU runners compare all 640 heap words against a Python integer oracle: 384 result words and 256 unchanged input words. Runtime-loaded inputs prevent constant folding. The private heap input is cleaned up after each run. Six CPU tests cover boundary answers, late-result/input corruption, missing/truncated readbacks, unsupported Int64 and filtered-runner pass/fail/skip verdicts. Document the fixture and its ISA reference in docs/testing.md. No translator behavior changes.

Tested

Windows 11 26H2 build 26300.9974, Python 3.14.3, based on current main 7430f59b2755418f5db1682446a4ccef10d455b1. Harness rebuilt from this tree using LLVM-MinGW Clang 23.1.6, CMake 4.4.5 and Ninja 1.13.2; llvm-mc 23.1.6 and SPIRV-Tools v2026.4.

  • run_gpu_tests.py --filter cs_w32_shift64 --require-pass: 1/1 translated, 1/1 spirv-val valid, 640/640 words exact.
  • Separate build.py build plus check.py readback helper: 1/1 translated and validated, 640/640 exact.
  • GPU negative controls: pre-masking counts with 31 fails at word 66; replacing arithmetic right shift with logical right shift fails at word 251. Both mutated shaders still translate and validate; original fixture restored.
  • New CPU tests: 6 passed. Existing test_run_gpu*.py suites: 111 tests, 110 passed and 1 skipped. LF writer checks: 3 passed.
  • Full semantic suite: 465 files, 6,108 tests, 0 files failed (545 s, 8 jobs).
  • compileall, make_game.py --help, no-game-data scan of all five changed files and git diff --check: passed.

GPUs tested: NVIDIA GeForce RTX 3080 Ti, NVIDIA 616.92, Windows 11. This is a wave32 test of 64-bit values; native RDNA2 hardware was not tested. Devices without shader Int64 support skip the fixture. No game files used.

AI-assisted: yes, with Codex.

Checklist

  • Based on current main; GitHub reports Able to merge.
  • One topic.
  • No game data, keys or decryption, including logs and fixtures.
  • Existing translation behavior only; fixture and reference documented in docs/testing.md.

🔄 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/590 **Author:** [@JiyouProt](https://github.com/JiyouProt) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `codex/gpu-valu64-shifts` --- ### 📝 Commits (1) - [`49d904f`](https://github.com/ubiquitarianism/leonida/commit/49d904fef62f5cbde9796d688d378df6d62b124a) tests: GPU readback for dynamic 64-bit vector shifts (GPU-VALU64-SHIFTS) ### 📊 Changes **5 files changed** (+169 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/testing.md` (+11 -0) 📝 `runtime/test/shaders/check.py` (+28 -0) ➕ `runtime/test/shaders/cs_w32_shift64.asm` (+29 -0) 📝 `scripts/run_gpu_tests.py` (+5 -0) ➕ `tests/test_gpu_shift64.py` (+96 -0) </details> ### 📄 Description Claimed in the coordination issue as: GPU-VALU64-SHIFTS — https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7126974854 ### What and why The existing 64-bit vector-shift rules have CPU semantic coverage but no dedicated GPU fixture. Add `cs_w32_shift64`: 64 memory-fed cases cross eight boundary values with counts 0, 1, 31, 32, 33, 63, 64 and 65. It exercises `v_lshlrev_b64`, `v_lshrrev_b64` and `v_ashrrev_i64`, with destinations overlapping the count register, one source word, or the entire source pair. Both GPU runners compare all 640 heap words against a Python integer oracle: 384 result words and 256 unchanged input words. Runtime-loaded inputs prevent constant folding. The private heap input is cleaned up after each run. Six CPU tests cover boundary answers, late-result/input corruption, missing/truncated readbacks, unsupported Int64 and filtered-runner pass/fail/skip verdicts. Document the fixture and its ISA reference in `docs/testing.md`. No translator behavior changes. ### Tested Windows 11 26H2 build 26300.9974, Python 3.14.3, based on current main `7430f59b2755418f5db1682446a4ccef10d455b1`. Harness rebuilt from this tree using LLVM-MinGW Clang 23.1.6, CMake 4.4.5 and Ninja 1.13.2; llvm-mc 23.1.6 and SPIRV-Tools v2026.4. - `run_gpu_tests.py --filter cs_w32_shift64 --require-pass`: 1/1 translated, 1/1 spirv-val valid, 640/640 words exact. - Separate `build.py` build plus `check.py` readback helper: 1/1 translated and validated, 640/640 exact. - GPU negative controls: pre-masking counts with 31 fails at word 66; replacing arithmetic right shift with logical right shift fails at word 251. Both mutated shaders still translate and validate; original fixture restored. - New CPU tests: 6 passed. Existing `test_run_gpu*.py` suites: 111 tests, 110 passed and 1 skipped. LF writer checks: 3 passed. - Full semantic suite: **465 files, 6,108 tests, 0 files failed** (545 s, 8 jobs). - compileall, `make_game.py --help`, no-game-data scan of all five changed files and `git diff --check`: passed. GPUs tested: NVIDIA GeForce RTX 3080 Ti, NVIDIA 616.92, Windows 11. This is a wave32 test of 64-bit values; native RDNA2 hardware was not tested. Devices without shader Int64 support skip the fixture. No game files used. AI-assisted: yes, with Codex. ### Checklist - [x] Based on current main; GitHub reports Able to merge. - [x] One topic. - [x] No game data, keys or decryption, including logs and fixtures. - [x] Existing translation behavior only; fixture and reference documented in docs/testing.md. --- <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:31 +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#631
No description provided.