Files
mandy/tests/test_run_gpu_wavemask.py
DiazE117 6de5bd46b4 run_gpu_tests: run cs_wavemask on any subgroup size with LEONIDA_W64_EMULATE=1
check.py drops --require-wave64 for cs_wavemask when wave64 is emulated; run_gpu_tests.py always passed it,
so on a 32-wide GPU the emulated suite skipped cs_wavemask. The check moves into wavemask_check(), which
asks for a 64-wide subgroup (and confirms it) only for the native build. test_run_gpu_wavemask covers both
paths with a fake vk_compute_test.

NVIDIA GeForce RTX 4070 SUPER (subgroup 32), driver 610.88, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8 in WSL:
LEONIDA_W64_EMULATE=1 run_gpu_tests.py 48/49 (was 47/49; ps_vcc_x2 skips), cs_wavemask 0 mismatches.
Native: 29/49, cs_wavemask still skips. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 16:19:14 -06:00

54 lines
2.0 KiB
Python

"""run_gpu_tests.py's cs_wavemask, with a fake vk_compute_test: it asks for a 64-wide subgroup only for the native
build. With LEONIDA_W64_EMULATE=1 it runs on any subgroup size, as check.py does (W64_EMULATED)."""
from pathlib import Path
import sys
import unittest
from unittest.mock import patch
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "scripts"))
import run_gpu_tests
PASS32 = "device: fake (subgroup 32..32)\n1 groups x 64: 0 mismatches"
class WavemaskCheck(unittest.TestCase):
def run_check(self, emulated, rc, msg):
calls = []
def fake(cmd, env=None):
calls.append(cmd)
return rc, msg
with patch.object(run_gpu_tests, "run_cmd", side_effect=fake):
result = run_gpu_tests.wavemask_check("vk_compute_test", "cs_wavemask.spv", None, emulated)
self.assertEqual(len(calls), 1)
return result, calls[0]
def test_native_build_requires_wave64_and_skips_without_it(self):
result, cmd = self.run_check(False, 77, "device: fake (subgroup 32..32)")
self.assertIn("--require-wave64", cmd)
self.assertIsNone(result[0])
self.assertIn("SKIP", result[1])
def test_native_build_needs_the_subgroup_confirmed(self):
result, _ = self.run_check(False, 0, PASS32)
self.assertIs(result[0], False)
def test_native_build_passes_on_a_64_wide_subgroup(self):
result, _ = self.run_check(False, 0, "compute subgroup size: 64\n1 groups x 64: 0 mismatches")
self.assertIs(result[0], True)
def test_emulated_build_runs_on_a_32_wide_subgroup(self):
result, cmd = self.run_check(True, 0, PASS32)
self.assertNotIn("--require-wave64", cmd)
self.assertEqual(result, (True, "1 groups x 64: 0 mismatches"))
def test_emulated_build_reports_mismatches(self):
result, _ = self.run_check(True, 1, "device: fake (subgroup 32..32)\nlane 40: got 0, want 1")
self.assertIs(result[0], False)
if __name__ == "__main__":
unittest.main()