diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 16:08:57 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 16:08:57 -0500 |
| commit | f238f66a97d6ba4e208c41fd2bc7fcdf21f36543 (patch) | |
| tree | d01c7c05e339e3c59221811db71892d1ae426e4c /scripts/run_gpu_tests.py | |
| parent | f3da088e5611be96dd0c356d63dd8b07e37a31df (diff) | |
| parent | ce2cf7578549159ed6bb649c1bcb4f24142a1395 (diff) | |
Merge pull request #186 from imnotdiesel
# Conflicts:
# runtime/test/shaders/build.py
# scripts/run_gpu_tests.py
Diffstat (limited to 'scripts/run_gpu_tests.py')
| -rw-r--r-- | scripts/run_gpu_tests.py | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index a811dea15..cef73011b 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -20,6 +20,8 @@ SHADER_DIR = os.path.join(ROOT, "runtime", "test", "shaders") | |||
| 20 | TRANSLATOR = os.path.join(ROOT, "tools", "rdna2spirv.py") | 20 | TRANSLATOR = os.path.join(ROOT, "tools", "rdna2spirv.py") |
| 21 | sys.path.insert(0, os.path.join(ROOT, "tools")) | 21 | sys.path.insert(0, os.path.join(ROOT, "tools")) |
| 22 | import mc_command # noqa: E402 | 22 | import mc_command # noqa: E402 |
| 23 | sys.path.insert(0, SHADER_DIR) | ||
| 24 | from compute_fixture import compute_header | ||
| 23 | 25 | ||
| 24 | 26 | ||
| 25 | def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: | 27 | def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: |
| @@ -60,27 +62,6 @@ def make_ms_psv0(threads_x: int, maxv: int, maxp: int, topology: int = 2) -> byt | |||
| 60 | return struct.pack("<I", len(r)) + bytes(r) | 62 | return struct.pack("<I", len(r)) + bytes(r) |
| 61 | 63 | ||
| 62 | 64 | ||
| 63 | def make_cs_fssm(rsrc2: int = 0x8088, lx: int = 64, ly: int = 1, lz: int = 1) -> bytes: | ||
| 64 | """Build minimal FSSM header (0x148 bytes) with COMPUTE_PGM_RSRC2 and group size.""" | ||
| 65 | buf = bytearray(0x148) | ||
| 66 | struct.pack_into("<4I", buf, 0x138, rsrc2, lx, ly, lz) | ||
| 67 | return bytes(buf) | ||
| 68 | |||
| 69 | |||
| 70 | def asm_group(asm_path: str) -> tuple[int, int, int]: | ||
| 71 | """Thread-group size from a leading "; group: X,Y,Z" comment in the .asm (default 64,1,1).""" | ||
| 72 | for ln in open(asm_path, encoding="utf-8").read().splitlines(): | ||
| 73 | t = ln.strip() | ||
| 74 | if not t: | ||
| 75 | continue | ||
| 76 | if not t.startswith(";"): | ||
| 77 | break | ||
| 78 | m = re.match(r";\s*group:\s*(\d+),(\d+),(\d+)", t) | ||
| 79 | if m: | ||
| 80 | return int(m.group(1)), int(m.group(2)), int(m.group(3)) | ||
| 81 | return 64, 1, 1 | ||
| 82 | |||
| 83 | |||
| 84 | def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: | 65 | def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: |
| 85 | """Assemble raw RDNA2 .asm with llvm-mc -show-encoding into .s format for rdna2spirv.py.""" | 66 | """Assemble raw RDNA2 .asm with llvm-mc -show-encoding into .s format for rdna2spirv.py.""" |
| 86 | raw = open(asm_path, encoding="utf-8").read() | 67 | raw = open(asm_path, encoding="utf-8").read() |
| @@ -419,7 +400,7 @@ def run_suite(a, work: str) -> int: | |||
| 419 | f.write(dxbc) | 400 | f.write(dxbc) |
| 420 | if name.startswith("cs_"): | 401 | if name.startswith("cs_"): |
| 421 | with open(os.path.join(fssm_dir, f"{name}.fssm"), "wb") as f: | 402 | with open(os.path.join(fssm_dir, f"{name}.fssm"), "wb") as f: |
| 422 | f.write(make_cs_fssm(0x8088, *asm_group(os.path.join(SHADER_DIR, fname)))) | 403 | f.write(compute_header(os.path.join(SHADER_DIR, fname))) |
| 423 | assemble_to_s(a.llvm_mc, os.path.join(SHADER_DIR, fname), os.path.join(disasm_dir, f"{name}.s"), name) | 404 | assemble_to_s(a.llvm_mc, os.path.join(SHADER_DIR, fname), os.path.join(disasm_dir, f"{name}.s"), name) |
| 424 | 405 | ||
| 425 | # 2. Translate all .s -> .spv | 406 | # 2. Translate all .s -> .spv |
| @@ -464,7 +445,10 @@ def run_suite(a, work: str) -> int: | |||
| 464 | cs_env = dict(os.environ, VKC_SUBGROUP_SIZE=str(sg)) if sg else None | 445 | cs_env = dict(os.environ, VKC_SUBGROUP_SIZE=str(sg)) if sg else None |
| 465 | gfx_env = dict(os.environ, VKH_SUBGROUP_SIZE=str(sg)) if sg else None | 446 | gfx_env = dict(os.environ, VKH_SUBGROUP_SIZE=str(sg)) if sg else None |
| 466 | 447 | ||
| 467 | if name == "cs_lds": | 448 | if name == "cs_workgroup_yz": |
| 449 | rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env) | ||
| 450 | results.append((name, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" in msg.splitlines(), msg)) | ||
| 451 | elif name == "cs_lds": | ||
| 468 | rc, msg = run_cmd([vk_compute, spv, "4", "mirror64"], env=cs_env) | 452 | rc, msg = run_cmd([vk_compute, spv, "4", "mirror64"], env=cs_env) |
| 469 | results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) | 453 | results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) |
| 470 | elif name == "cs_exec64": | 454 | elif name == "cs_exec64": |