"""Opt-in Vulkan regression for CNN f16 fragments, including independent concurrent waves. D4R_RUN_GPU_TESTS=1 D4R_EVK=/path/to/evk python3 -m unittest tests.test_cnn_mma_gpu Build evk with: g++ -O2 engine/evk.cpp -lvulkan -o build/evk """ import os from pathlib import Path import subprocess import tempfile import unittest ROOT = Path(__file__).resolve().parents[1] @unittest.skipUnless(os.environ.get('D4R_RUN_GPU_TESTS') == '1', 'opt-in GPU test') class CnnMatrixGpuTests(unittest.TestCase): def test_fragment_mapping_accumulation_and_wave_isolation(self): self.check_fragments(packed=False) def test_packed_fragment_rounding_and_wave_isolation(self): self.check_fragments(packed=True) def check_fragments(self, packed): import numpy as np rng = np.random.default_rng(412) fragments = np.empty((8, 32, 8), dtype='