mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 21:18:38 +00:00
valu_fuzz.py, lds_fuzz.py and crosslane_fuzz.py ask vk_compute_test for
32-lane subgroups (VKC_SUBGROUP_SIZE=32) for wave32 programs, but they
ignored its "compute subgroup size: 32 not available" line. On a device
that can't pin that size (Mesa llvmpipe: 8 lanes) every wave32 program
was judged at the driver's size and its cross-lane results came out as
translator mismatches. On main f85582e with llvmpipe, lds_fuzz --emulate
--programs 400 --seed 5150 gave 215 mismatches, all wave32, and
crosslane_fuzz --wave 32 --no-maskdata gave 68 of 100.
Those wave32 programs are now skips, as check.py's unpinned_subgroup_skip
does for its lane-mask dumps. Programs translated with --wave64-emulate
use no subgroup operations, so they are still compared at any size
(400 of 400 match on llvmpipe). crosslane_fuzz counts the skips in its
summary and exits 2 when every program was skipped, as the other two
fuzzers already do.
The line is parsed by compute_fixture.unpinned_subgroup, shared by the
three fuzzers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
2.1 KiB
Python
47 lines
2.1 KiB
Python
"""Synthetic FSSM compute headers shared by both GPU test runners."""
|
|
import os
|
|
import re
|
|
import struct
|
|
from pathlib import Path
|
|
|
|
|
|
def compute_header(asm_path):
|
|
# Default: four user SGPRs (V#), TGID_X, 512 bytes LDS, 64 threads.
|
|
rsrc2, group = 0x8088, (64, 1, 1)
|
|
for line in Path(asm_path).read_text(encoding="utf-8").splitlines():
|
|
line = line.strip()
|
|
if not line:
|
|
continue
|
|
if not line.startswith(";"):
|
|
break
|
|
size = re.match(r";\s*group:\s*(\d+),(\d+),(\d+)", line)
|
|
if size:
|
|
group = tuple(map(int, size.groups()))
|
|
elif line[1:].lstrip().startswith("rsrc2:"):
|
|
rsrc2 = int(line.split(":", 1)[1].strip(), 0)
|
|
header = bytearray(0x148)
|
|
struct.pack_into("<4I", header, 0x138, rsrc2, *group)
|
|
return header
|
|
|
|
|
|
def unpinned_subgroup(out):
|
|
"""The lane count vk_compute_test was asked for with VKC_SUBGROUP_SIZE and could not pin on this device, or None.
|
|
|
|
vk_compute_test then prints "compute subgroup size: N not available" and runs at whatever size the driver picks
|
|
(#774); Mesa llvmpipe's only size is 8. A wave32 program's words from such a run say nothing about the translator,
|
|
so the fuzzers skip it, as check.py's unpinned_subgroup_skip does for its lane-mask dumps. Output without the line
|
|
(the size was pinned, none was asked for, or an older vk_compute_test) gives None."""
|
|
m = re.search(r"^compute subgroup size: (\d+) not available$", out, re.MULTILINE)
|
|
return int(m.group(1)) if m else None
|
|
|
|
|
|
def find_test_program(build, name):
|
|
"""The folder holding test program `name`: `build` itself (Ninja, Makefiles) or the RelWithDebInfo/Release
|
|
subfolder a Visual Studio build puts it in, as run_gpu_tests.py's find_test_programs looks. None if not built.
|
|
A Debug configuration isn't searched (neither does run_gpu_tests.py): GPU fuzzing wants an optimized harness."""
|
|
exe = name + (".exe" if os.name == "nt" else "")
|
|
for folder in (build, os.path.join(build, "RelWithDebInfo"), os.path.join(build, "Release")):
|
|
if os.path.isfile(os.path.join(folder, exe)):
|
|
return folder
|
|
return None
|