"""Semantic test for compute workgroup IDs Y/Z. The contract row "Compute workgroup IDs Y/Z" in docs/design.md is checked only by the GPU fixture ``runtime/test/shaders/cs_workgroup_yz.asm`` (plus an explicit EXEC set, which hardware provides). This test runs the same hand-written listing through tools/rdna2spirv.py and tests/semantic/spirv_mini_interp.py on a 2 x 3 x 4 dispatch: with COMPUTE_PGM_RSRC2 = 0x308 (4 user SGPRs, TGID_Y and TGID_Z enabled, TGID_X disabled) the translator must put WorkgroupId.y in s4 and WorkgroupId.z in s5. The listing clamps Y to 3 and Z to 4, packs the pair into a bin index and increments that bin with a buffer atomic, so the expected counts come from a plain-Python model of the dispatch. No game files, GPU, LLVM or SPIRV-Tools are needed; the listing and FSSM header are synthetic. """ import os import struct import sys import tempfile import unittest import warnings HERE = os.path.dirname(os.path.abspath(__file__)) ROOT = os.path.dirname(os.path.dirname(HERE)) TOOLS_DIR = os.environ.get("LEONIDA_TOOLS_DIR") or os.path.join(ROOT, "tools") sys.dont_write_bytecode = True sys.path.insert(0, TOOLS_DIR) sys.path.insert(0, HERE) import rdna2spirv # noqa: E402 import spirv_mini_interp as si # noqa: E402 STUB_DXBC = b"DXBC" + bytes(24) + struct.pack("