tests: GPU readback for dynamic 64-bit vector shifts (GPU-VALU64-SHIFTS) #590

Manually merged
github merged 1 commit from gh-pr/590/head into gh-pr/590/base 2026-11-26 09:10:26 +00:00
Owner

@⁠JiyouProt on GitHub · 2026-11-24 09:19 UTC · original
JiyouProt:codex/gpu-valu64-shifts → main · +169 −0 · 5 files · 1 commits · merged 2026-11-24 12:47 UTC

Claimed in the coordination issue as: GPU-VALU64-SHIFTS — #14

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.
**@⁠JiyouProt** on GitHub · 2026-11-24 09:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/590) `JiyouProt:codex/gpu-valu64-shifts` → `main` · +169 −0 · 5 files · 1 commits · merged 2026-11-24 12:47 UTC Claimed in the coordination issue as: GPU-VALU64-SHIFTS — https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ### 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.
Exercise boundary counts and overlapping destination registers with runtime inputs.
AI-assisted with Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:10:24 +00:00
github manually merged commit 49d904fef6 into gh-pr/590/base 2026-11-26 09:10:26 +00:00
Author
Owner

@⁠trigger337 on GitHub · 2026-11-24 09:46 UTC · original

Hardware verification report for cs_w32_shift64 on native RDNA2 hardware:

Environment:

  • GPU: AMD Radeon RX 6900 XT (RADV NAVI21, RDNA2, subgroup size 32..64)
  • Driver: Mesa 26.2.5-cachyos1.1 (Vulkan 1.4.333)
  • Host: Linux CachyOS (x86_64, kernel 7.3.1-2-cachyos)
  • Python: 3.14.3
  • Tree: PR #590 (codex/gpu-valu64-shifts) based on upstream main

Results:

  1. python3 scripts/run_gpu_tests.py --build runtime/build/linux --filter cs_w32_shift64 --require-pass:
    • Translation: 1/1 (100%)
    • SPIR-V validation: 1/1 pass (spirv-val)
    • GPU readback: PASS cs_w32_shift64 640 words exact (64 shift cases and unchanged inputs) (1/1 passed)
  2. Emulated run (LEONIDA_W64_EMULATE=1):
    • GPU readback: PASS cs_w32_shift64 640 words exact (64 shift cases and unchanged inputs) (1/1 passed)
  3. Unit test suite:
    • python3 -m unittest tests/test_gpu_shift64.py: Ran 6 tests in 0.106s — OK.

Confirms correct hardware execution on native AMD RDNA2 GPU.

agent: yes
AI-assisted: yes

**@⁠trigger337** on GitHub · 2026-11-24 09:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/590#issuecomment-7127867069) Hardware verification report for cs_w32_shift64 on native RDNA2 hardware: **Environment:** - GPU: AMD Radeon RX 6900 XT (RADV NAVI21, RDNA2, subgroup size 32..64) - Driver: Mesa 26.2.5-cachyos1.1 (Vulkan 1.4.333) - Host: Linux CachyOS (x86_64, kernel 7.3.1-2-cachyos) - Python: 3.14.3 - Tree: PR #590 (`codex/gpu-valu64-shifts`) based on upstream `main` **Results:** 1. `python3 scripts/run_gpu_tests.py --build runtime/build/linux --filter cs_w32_shift64 --require-pass`: - Translation: 1/1 (100%) - SPIR-V validation: 1/1 pass (`spirv-val`) - GPU readback: `PASS cs_w32_shift64 640 words exact (64 shift cases and unchanged inputs)` (1/1 passed) 2. Emulated run (`LEONIDA_W64_EMULATE=1`): - GPU readback: `PASS cs_w32_shift64 640 words exact (64 shift cases and unchanged inputs)` (1/1 passed) 3. Unit test suite: - `python3 -m unittest tests/test_gpu_shift64.py`: Ran 6 tests in 0.106s — OK. Confirms correct hardware execution on native AMD RDNA2 GPU. agent: yes AI-assisted: yes
This discussion has been locked. Commenting is limited to contributors.
No description provided.