upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/scripts/run_gpu_tests.py
diff options
context:
space:
mode:
authorIAmNotSiob <273832158+IAmNotSiob@users.noreply.github.com>2026-11-22 14:16:49 +0100
committerIAmNotSiob <273832158+IAmNotSiob@users.noreply.github.com>2026-11-22 14:16:49 +0100
commit1955e1b9584cf902bd6284bdc205de457fde1c73 (patch)
tree037caf3b59c8f846d32a8e95d97f4515177209d8 /scripts/run_gpu_tests.py
parent07bd05fa95c2c47be1d1f0b671fb5e484b23a904 (diff)
parenta0acd33d77babe67a28e398b2936a9f735a50f5d (diff)
Merge remote-tracking branch 'origin/main' into r436
# Conflicts: # scripts/run_gpu_tests.py # tests/test_shader_checks.py # tools/rdna2spirv.py
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py180
1 files changed, 154 insertions, 26 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index d5fb01b64..ecf2ca092 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -27,6 +27,7 @@ sys.path.insert(0, SHADER_DIR)
27from build import CLIP_CASES, clip_container, shader_source 27from build import CLIP_CASES, clip_container, shader_source
28from check import Skip, clip_test, fmt_1010102_test, fmt_xy_xyz_test 28from check import Skip, clip_test, fmt_1010102_test, fmt_xy_xyz_test
29from compute_fixture import compute_header 29from compute_fixture import compute_header
30from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test)
30from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, 31from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES,
31 TEXTURE_MIP_TEST, GATHER_LOD_TEST, MIP_TEST_PASSES, GATHER_WRAP, USER_SGPRS_ENV, USER_SGPRS_WORDS, Skip, mesh_v5_test, not_found_message, 32 TEXTURE_MIP_TEST, GATHER_LOD_TEST, MIP_TEST_PASSES, GATHER_WRAP, USER_SGPRS_ENV, USER_SGPRS_WORDS, Skip, mesh_v5_test, not_found_message,
32 pick_build_dir, start_failure, texture_gradient_a16_test, texture_mip_test) 33 pick_build_dir, start_failure, texture_gradient_a16_test, texture_mip_test)
@@ -35,8 +36,9 @@ from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: tex
35from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) 36from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT)
36from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS 37from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS
37from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, 38from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip,
38 wave32_lane_skip) # as in check.py 39 vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py
39from check import PIXEL_VERTEX, interp_f16_high_problem # ps_interp_f16_high's producers and check 40from check import PIXEL_VERTEX, interp_f16_high_problem, ij_computed_problem # pixel producers and checks
41from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries
40 42
41 43
42def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: 44def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes:
@@ -214,14 +216,14 @@ def make_fs_passthru(loc: int) -> str:
214def read_raw_rgba32f(path: str) -> list[tuple[float, float, float, float]]: 216def read_raw_rgba32f(path: str) -> list[tuple[float, float, float, float]]:
215 with open(path, "rb") as source: 217 with open(path, "rb") as source:
216 data = source.read() 218 data = source.read()
217 n = len(data) // 16 219 n = len(data) // 16 if len(data) % 16 == 0 else 0 # a partial pixel means a malformed readback: no frame
218 return [struct.unpack_from("<4f", data, 16 * i) for i in range(n)] 220 return [struct.unpack_from("<4f", data, 16 * i) for i in range(n)]
219 221
220 222
221def read_raw_u32(path: str) -> list[tuple[int, int, int, int]]: 223def read_raw_u32(path: str) -> list[tuple[int, int, int, int]]:
222 with open(path, "rb") as source: 224 with open(path, "rb") as source:
223 data = source.read() 225 data = source.read()
224 n = len(data) // 16 226 n = len(data) // 16 if len(data) % 16 == 0 else 0 # a partial pixel means a malformed readback: no frame
225 return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)] 227 return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)]
226 228
227 229
@@ -254,6 +256,35 @@ def bary_fallback() -> bool:
254 return (os.environ.get("LEONIDA_BARY_FALLBACK") or "").strip().lower() in ("1", "true", "yes", "on") 256 return (os.environ.get("LEONIDA_BARY_FALLBACK") or "").strip().lower() in ("1", "true", "yes", "on")
255 257
256 258
259def f16_interp_fallback() -> bool:
260 """LEONIDA_F16_INTERP_FALLBACK=1 (or 0): translate with --f16-interp-fallback, so ps_interp_f16_high reads the f16
261 halves its producer exports decoded instead of PerVertexKHR inputs. Unset, it is on where the device can't
262 compile PerVertexKHR: tools/vk_subgroup_info.py reports per_vertex_inputs false (MoltenVK)."""
263 v = (os.environ.get("LEONIDA_F16_INTERP_FALLBACK") or "").strip().lower()
264 if v in ("1", "true", "yes", "on"):
265 return True
266 if v in ("0", "false", "no", "off"):
267 return False
268 return _device_per_vertex() is False
269
270
271_PER_VERTEX = []
272
273
274def _device_per_vertex():
275 """per_vertex_inputs from tools/vk_subgroup_info.py for the device the tests run on (cached), or None."""
276 if not _PER_VERTEX:
277 answer = None
278 try:
279 r = subprocess.run([sys.executable, "-I", os.path.join(ROOT, "tools", "vk_subgroup_info.py")],
280 capture_output=True, text=True, timeout=60)
281 answer = json.loads(r.stdout.strip().splitlines()[-1]).get("per_vertex_inputs")
282 except (OSError, ValueError, IndexError, subprocess.SubprocessError):
283 pass
284 _PER_VERTEX.append(answer)
285 return _PER_VERTEX[0]
286
287
257def w64_emulated() -> bool: 288def w64_emulated() -> bool:
258 # Wave64 emulation on: the suite runs every wave64 check without asking for a 64-wide 289 # Wave64 emulation on: the suite runs every wave64 check without asking for a 64-wide
259 # subgroup, matching check.py (W64_EMULATED). Accepts "1"/"true"/"yes"/"on" and tolerates 290 # subgroup, matching check.py (W64_EMULATED). Accepts "1"/"true"/"yes"/"on" and tolerates
@@ -331,6 +362,8 @@ def check_bitmask_perm(raw_path: str, msg: str = "") -> tuple[bool | None, str]:
331 px = read_raw_u32(raw_path) 362 px = read_raw_u32(raw_path)
332 if skip := bitmask_perm_narrow_skip(msg, px): 363 if skip := bitmask_perm_narrow_skip(msg, px):
333 return None, str(skip) 364 return None, str(skip)
365 if problem := frame_problem(px):
366 return False, problem
334 bad = 0 367 bad = 0
335 first = "" 368 first = ""
336 judged = 0 369 judged = 0
@@ -350,6 +383,13 @@ def check_bitmask_perm(raw_path: str, msg: str = "") -> tuple[bool | None, str]:
350# Pixel shaders that read memory: vk_harness puts this V# in s[0:3] and seeds the heap it points at, as 383# Pixel shaders that read memory: vk_harness puts this V# in s[0:3] and seeds the heap it points at, as
351# tests/semantic/test_value_semantics.py does for the interpreter (same table as check.py). 384# tests/semantic/test_value_semantics.py does for the interpreter (same table as check.py).
352PIXEL_ENV = {"ps_vcc_x2": {"VKH_SGPRS": "0x1000,0,16,0", "VKH_HEAP": "0x1000=0x11223344,0x1004=0x55667788"}, 385PIXEL_ENV = {"ps_vcc_x2": {"VKH_SGPRS": "0x1000,0,16,0", "VKH_HEAP": "0x1000=0x11223344,0x1004=0x55667788"},
386 # the 14 v_cmpx forms: f32 and 64-bit operands from memory (derivations in the .asm header)
387 "ps_vcmpx_forms": {"VKH_SGPRS": "0x1000,0,96,0",
388 "VKH_HEAP": "0x1000=0x7fc10001,0x1004=0x3f800000,0x1008=0x40000000,0x100c=0x80000000,"
389 "0x1010=0,0x1014=0xff800000,0x1018=0,0x101c=0,0x1020=0x80000000,0x1024=0,"
390 "0x1028=0x1,0x102c=0,0x1030=0x7,0x1034=0x80000000,0x1038=0x7,0x103c=0,"
391 "0x1040=0x1,0x1044=0x5,0x1048=0x80000000,0x104c=0x5,0x1050=0x7,0x1054=0x5,"
392 "0x1058=0x7,0x105c=0x5"},
353 # float NaN / fract rows measured on RDNA2 hardware (see the .asm headers) 393 # float NaN / fract rows measured on RDNA2 hardware (see the .asm headers)
354 "ps_fnan_med3": {"VKH_SGPRS": "0x1000,0,32,0", 394 "ps_fnan_med3": {"VKH_SGPRS": "0x1000,0,32,0",
355 "VKH_HEAP": "0x1000=0x7fc10001,0x1004=0x40e00000,0x1008=0x40a00000," 395 "VKH_HEAP": "0x1000=0x7fc10001,0x1004=0x40e00000,0x1008=0x40a00000,"
@@ -362,7 +402,11 @@ def check_flat(raw_path: str) -> tuple[bool, str]:
362 """ps_flat with vs_ids: the integer IDs come from the first (provoking) vertex, the UVs still interpolate.""" 402 """ps_flat with vs_ids: the integer IDs come from the first (provoking) vertex, the UVs still interpolate."""
363 with open(raw_path, "rb") as source: 403 with open(raw_path, "rb") as source:
364 data = source.read() 404 data = source.read()
405 if len(data) != 64 * 64 * 16:
406 return False, f"expected a 64x64 frame, got {len(data)} bytes"
365 px = list(struct.iter_unpack("<2I2f", data)) 407 px = list(struct.iter_unpack("<2I2f", data))
408 if problem := frame_problem(px):
409 return False, problem
366 w = int(len(px) ** 0.5) 410 w = int(len(px) ** 0.5)
367 wrong = sum((a, b) != (0x101, 0x102) for a, b, _, _ in px) 411 wrong = sum((a, b) != (0x101, 0x102) for a, b, _, _ in px)
368 err = max(max(abs(u - (i % w + 0.5) / w), abs(v - (i // w + 0.5) / w)) for i, (_, _, u, v) in enumerate(px)) 412 err = max(max(abs(u - (i % w + 0.5) / w), abs(v - (i // w + 0.5) / w)) for i, (_, _, u, v) in enumerate(px))
@@ -389,6 +433,9 @@ def check_uniform_branch(raw_path: str) -> tuple[bool, str]:
389 """ps_uniform_branch / ps_scc_mask32: s5 = 8 wherever the lane's own bit is set; a lane with bit 0 gets 8 when 433 """ps_uniform_branch / ps_scc_mask32: s5 = 8 wherever the lane's own bit is set; a lane with bit 0 gets 8 when
390 another lane of its wave has the bit (the wave-wide vote), else 7. All three kinds must occur, as in check.py: 434 another lane of its wave has the bit (the wave-wide vote), else 7. All three kinds must occur, as in check.py:
391 without a (8, bit 0) pixel the vote is not shown, and a translator that decides per lane would pass.""" 435 without a (8, bit 0) pixel the vote is not shown, and a translator that decides per lane would pass."""
436 # Only z (the barycentric i) is judged as a float; a NaN i passes both range tests below.
437 if problem := frame_problem([p[2:3] for p in px]):
438 return False, problem
392 bad = 0 439 bad = 0
393 n8 = 0 440 n8 = 0
394 n7 = 0 441 n7 = 0
@@ -460,8 +507,8 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool,
460 """Check 64x64 output with ClipDistance[0] = NDC x: left half (x < 32) clipped to clear (-1), 507 """Check 64x64 output with ClipDistance[0] = NDC x: left half (x < 32) clipped to clear (-1),
461 right half (x >= 32) covered (2048/4096 pixels) with the gradient.""" 508 right half (x >= 32) covered (2048/4096 pixels) with the gradient."""
462 px = read_raw_rgba32f(raw_path) 509 px = read_raw_rgba32f(raw_path)
463 if len(px) != 64 * 64: 510 if problem := frame_problem(px):
464 return False, f"expected 4096 pixels, got {len(px)}" 511 return False, problem
465 covered = 0 512 covered = 0
466 bad = 0 513 bad = 0
467 first = "" 514 first = ""
@@ -487,14 +534,24 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool,
487 return ok, detail 534 return ok, detail
488 535
489 536
537# Fixtures run by another harness, which needs what these tools do not have (a D3D12 device, the layer's root
538# arguments and code base). They are still assembled and translated here, so a translator regression shows, but no
539# checker runs them: the test program that owns them judges them.
540OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test",
541 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test",
542 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test",
543 "ps_m3_post": "d3d12_m3_frame_test"}
544
545
490# Shaders a selected test draws with, built even when the filter leaves them out (#192). 546# Shaders a selected test draws with, built even when the filter leaves them out (#192).
491DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", 547DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm",
492 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", 548 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm",
493 "ps_gather_wrap": "vs_ids.asm", 549 "ps_gather_wrap": "vs_ids.asm", "ps_ssharp": "vs_ids.asm",
494 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_ops.asm", 550 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm",
495 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", 551 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm",
496 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm", 552 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm",
497 "vs_base_ids": "ps_flat.asm"} 553 "vs_base_ids": "ps_flat.asm"}
554DRAWN_WITH.update({name: "vs_ids.asm" for name in GET_LOD_TESTS})
498 555
499 556
500def with_draw_shaders(asm_files: list[str]) -> list[str]: 557def with_draw_shaders(asm_files: list[str]) -> list[str]:
@@ -576,8 +633,22 @@ def main() -> int:
576 shutil.rmtree(work, ignore_errors=True) 633 shutil.rmtree(work, ignore_errors=True)
577 634
578 635
636def _w64_graphics_only() -> frozenset:
637 try:
638 import w64_graphics
639 except ImportError:
640 return frozenset()
641 return frozenset(w64_graphics.FIXTURES)
642
643
644W64_GRAPHICS_ONLY = _w64_graphics_only()
645
646
579def run_suite(a, work: str) -> int: 647def run_suite(a, work: str) -> int:
580 asm_files = sorted({f for f in os.listdir(SHADER_DIR) if f.endswith(".asm")} | {n + ".asm" for n in CLIP_CASES}) 648 asm_files = sorted({f for f in os.listdir(SHADER_DIR) if f.endswith(".asm")} | {n + ".asm" for n in CLIP_CASES})
649 # The wave64 pixel fixtures of runtime/test/shaders/w64_graphics.py (tiers A-C, #1541) are checked by that
650 # runner, not here: they need a 64-wide fragment subgroup or the halves-aware lowering it drives.
651 asm_files = [f for f in asm_files if f[:-4] not in W64_GRAPHICS_ONLY]
581 if a.filter: 652 if a.filter:
582 asm_files = [f for f in asm_files if a.filter in f] 653 asm_files = [f for f in asm_files if a.filter in f]
583 if not asm_files: 654 if not asm_files:
@@ -636,10 +707,14 @@ def run_suite(a, work: str) -> int:
636 cmd.append("--wave64-emulate") 707 cmd.append("--wave64-emulate")
637 if bary_fallback(): # raw barycentrics from an interpolated input, fed by a pass-through GS 708 if bary_fallback(): # raw barycentrics from an interpolated input, fed by a pass-through GS
638 cmd.append("--bary-fallback") 709 cmd.append("--bary-fallback")
710 if f16_interp_fallback(): # *_f16 interps from decoded-half inputs, no PerVertexKHR (MoltenVK)
711 cmd.append("--f16-interp-fallback")
639 if TEXOFF_FALLBACK: # image_sample*_o: offset folded into the coordinate, no VK_KHR_maintenance8 712 if TEXOFF_FALLBACK: # image_sample*_o: offset folded into the coordinate, no VK_KHR_maintenance8
640 cmd.append("--texel-offset-fallback") 713 cmd.append("--texel-offset-fallback")
641 if MESH_COMPUTE: # mesh shaders as compute writing to a buffer, drawn by tools/mesh_compute_vs.py 714 if MESH_COMPUTE: # mesh shaders as compute writing to a buffer, drawn by tools/mesh_compute_vs.py
642 cmd.append("--mesh-compute") 715 cmd.append("--mesh-compute")
716 if os.environ.get("LEONIDA_FMA") in ("glsl", "khr"): # fused multiply-add: GLSL Fma or OpFmaKHR (docs/design.md)
717 cmd += ["--fma", os.environ["LEONIDA_FMA"]]
643 rc, out = run_cmd(cmd, gpu=False) 718 rc, out = run_cmd(cmd, gpu=False)
644 print("=== rdna2spirv.py ===") 719 print("=== rdna2spirv.py ===")
645 print(out) 720 print(out)
@@ -698,11 +773,29 @@ def run_suite(a, work: str) -> int:
698 elif name == "cs_exec64": 773 elif name == "cs_exec64":
699 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env) 774 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env)
700 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 775 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
701 elif name == "cs_bvh": 776 elif name in ("cs_bvh", "cs_bvh32"): # the 64-bit and the 32-bit node pointer: one scene, the same words
702 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env) 777 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env)
703 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 778 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
779 elif name in STORE_WORDS:
780 # TEST-184: image atomics (cs_imgatomic, cs_imgatomic3d) and image_get_resinfo (cs_resinfo). vk_store_test
781 # binds the images and prints the r32 ones after the dispatch; the expected words are check.py's.
782 rc, msg = run_cmd([vk_store, spv, "words"])
783 if rc == UNSUPPORTED:
784 results.append((name, None, unsupported_skip(msg)))
785 elif rc != 0:
786 results.append((name, False, msg))
787 else:
788 problem = store_words_problem(msg, name)
789 results.append((name, not problem, problem or "all 64 words of the uint image, the sint image and "
790 "the volume exact"))
791 elif name in GET_LOD_TESTS:
792 # TEST-184: image_get_lod on vk_texture_test's two-mip texture (two sampler LOD ranges) and on its 2D array.
793 problem = get_lod_test(a.build, spirv_dir, name)
794 ok = None if isinstance(problem, Skip) else not problem
795 results.append((name, ok, problem or f"4096 pixels in each of {len(GET_LOD_TESTS[name])} draw(s): the "
796 "clamped and the calculated LOD within 1/16"))
704 elif name in ("cs_bounds", "cs_smem_bounds", "cs_smem_stride_align", "cs_smem_sload_neg", "cs_buf_tail", "cs_oob_select", "cs_oob_tail", 797 elif name in ("cs_bounds", "cs_smem_bounds", "cs_smem_stride_align", "cs_smem_sload_neg", "cs_buf_tail", "cs_oob_select", "cs_oob_tail",
705 "cs_cmpx_class_f32"): 798 "cs_buf_swizzle", "cs_cmpx_class_f32"):
706 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds 799 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds
707 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement. 800 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement.
708 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either. 801 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either.
@@ -719,6 +812,9 @@ def run_suite(a, work: str) -> int:
719 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0], 812 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0],
720 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0], 813 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0],
721 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010], 814 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010],
815 # swizzled MUBUF addressing and ADD_TID_ENABLE (lanes 0 and 1 store; derivation in the .asm header)
816 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED0028, 0, 0xBEEF0000,
817 0xBEEF0001],
722 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 818 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
723 }[name] 819 }[name]
724 words = dump_words(msg) 820 words = dump_words(msg)
@@ -763,7 +859,7 @@ def run_suite(a, work: str) -> int:
763 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 859 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
764 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 860 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
765 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 861 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
766 elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_exec_const", "cs_w32_lds_u8_d16", "cs_wave64_ballot", "cs_wm_half_ops", "cs_wm_half_cmp", "cs_wm_bfm64", "cs_wm_scc_rfl", "cs_wqm_w64", "cs_wqm_w32", "cs_wqm_w64_half", 862 elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", "cs_wave64_ballot", "cs_wm_half_ops", "cs_wm_half_cmp", "cs_wm_bfm64", "cs_wm_scc_rfl", "cs_wqm_w64", "cs_wqm_w32", "cs_wqm_w64_half",
767 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 863 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
768 "cs_dpp_bound", "cs_dpp_w64", 864 "cs_dpp_bound", "cs_dpp_w64",
769 "cs_w64_mask_detect", 865 "cs_w64_mask_detect",
@@ -774,7 +870,7 @@ def run_suite(a, work: str) -> int:
774 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", 870 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end",
775 "cs_barrier_loop", "cs_w64x_andn2_exec"): 871 "cs_barrier_loop", "cs_w64x_andn2_exec"):
776 cs_dump_wants = { 872 cs_dump_wants = {
777 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800], 873 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000],
778 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone 874 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone
779 "cs_smem_soffset_imm": [0x5EED0024, 0x5EED0028, 0x5EED002C, 0x5EED0030, 875 "cs_smem_soffset_imm": [0x5EED0024, 0x5EED0028, 0x5EED002C, 0x5EED0030,
780 0x5EED0010, 0x5EED0014, 0x5EED0018, 0x5EED001C], 876 0x5EED0010, 0x5EED0014, 0x5EED0018, 0x5EED001C],
@@ -784,10 +880,21 @@ def run_suite(a, work: str) -> int:
784 "cs_movrelsd_2": [11, 33, 33, 55, 1717, 77, 1515, 1717], 880 "cs_movrelsd_2": [11, 33, 33, 55, 1717, 77, 1515, 1717],
785 # SHADER-90: ds_permute_b32 (cs_w32_permute.asm): scatter, unwritten lane = 0, EXEC gates the write 881 # SHADER-90: ds_permute_b32 (cs_w32_permute.asm): scatter, unwritten lane = 0, EXEC gates the write
786 "cs_w32_permute": [218, 29, 8, 211, 0, 15, 99, 15], 882 "cs_w32_permute": [218, 29, 8, 211, 0, 15, 99, 15],
883 # integer ops with CPU-only checks until now (cs_w32_int_ext.asm)
884 "cs_w32_int_ext": [1, 27, 1, 0x33332222, 0xC0000000, 0x4000, 18, 0x20304050],
885 # 64-bit scalar data ops and v_mad_u64_u32 (cs_w32_salu64.asm)
886 # more ops with CPU-only checks until now (cs_w32_misc_ext.asm)
887 # ops merged on 2026-11-22 with CPU-only checks (cs_w32_new_ops.asm)
888 "cs_w32_new_ops": [0x55, 0x8001, 0xC0000000, 0x80014000, 0x4000FFFF, 0x77, 0x99, 0x1234],
889 "cs_w32_misc_ext": [0x0FFF0FFF, 0xE2C4A688, 0x0007FFFF, 0x7FFF8000, 0xFFFE0002, 0xFFFF0005, 0x509, 0xCAFEF00D],
890 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE],
787 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header) 891 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header)
788 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], 892 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234],
789 # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant 893 # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant
790 "cs_exec_const": [16, 8, 2, 16, 0, 16], 894 "cs_exec_const": [16, 8, 2, 16, 0, 16],
895 # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers)
896 "cs_w32_mask_imm": [2056, 20, 2, 6152, 2050, 4112, 258, 32],
897 "cs_w64_mask_imm": [2056, 1084, 828, 2052, 319, 2104, 516, 2064],
791 "cs_dpp": [1, 0, 3, 2, 5, 4, 7, 6], 898 "cs_dpp": [1, 0, 3, 2, 5, 4, 7, 6],
792 "cs_dpp_row": [0, 0, 1, 2, 3, 4, 5, 6], 899 "cs_dpp_row": [0, 0, 1, 2, 3, 4, 5, 6],
793 "cs_dpp_mask": [1, 0, 3, 2, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE], 900 "cs_dpp_mask": [1, 0, 3, 2, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE],
@@ -836,8 +943,9 @@ def run_suite(a, work: str) -> int:
836 } 943 }
837 want = cs_dump_wants[name] 944 want = cs_dump_wants[name]
838 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 945 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
839 # cs_w32_lds_u8_d16, the wave32 cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) 946 # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32
840 # mask test: ask for a 64-wide subgroup and skip, as check.py does, where the device has none 947 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
948 # as check.py does, where the device has none
841 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 949 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
842 # translated with --wave64-emulate and run on any subgroup size. 950 # translated with --wave64-emulate and run on any subgroup size.
843 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for 951 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for
@@ -846,8 +954,9 @@ def run_suite(a, work: str) -> int:
846 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 954 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp")
847 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 955 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
848 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 956 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
849 "cs_w32_lds_u8_d16", "cs_bpermute32", "cs_w32_partial_scmp", 957 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
850 "cs_exec_const", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 958 "cs_bpermute32", "cs_w32_partial_scmp",
959 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
851 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 960 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
852 if partial and not emulated: 961 if partial and not emulated:
853 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") 962 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64")
@@ -864,8 +973,8 @@ def run_suite(a, work: str) -> int:
864 elif name == "cs_imgstore": 973 elif name == "cs_imgstore":
865 rc, msg = run_cmd([vk_store, spv]) 974 rc, msg = run_cmd([vk_store, spv])
866 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 975 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
867 elif name in ("cs_imgload", "cs_imgload_d16"): 976 elif name in ("cs_imgload", "cs_imgload_d16", "cs_sample_lz_int_d16"):
868 rc, msg = run_cmd([vk_store, spv, "load"]) 977 rc, msg = run_cmd([vk_store, spv, "load" if name == "cs_imgload" else "load-d16"])
869 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 978 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
870 elif name in MIP_TEST_PASSES: 979 elif name in MIP_TEST_PASSES:
871 problem = texture_mip_test(a.build, spirv_dir, name) 980 problem = texture_mip_test(a.build, spirv_dir, name)
@@ -930,6 +1039,11 @@ def run_suite(a, work: str) -> int:
930 results.append((name, None, f"SKIP ({reason})")) 1039 results.append((name, None, f"SKIP ({reason})"))
931 else: 1040 else:
932 results.append((name, rc == 0, lines[-1] if lines else "")) 1041 results.append((name, rc == 0, lines[-1] if lines else ""))
1042 elif name == "ps_ssharp":
1043 # The S#/T# mip fields through vulkan_sampler() and the view range (check.py's SAMPLER_CASES).
1044 problem = sampler_test(a.build, spirv_dir)
1045 results.append((name, None if isinstance(problem, Skip) else not problem,
1046 problem or f"{len(SAMPLER_CASES)} S#/T# cases, 4096 pixels each exact"))
933 elif name in ("ps_texoff", "ps_texoff_implicit"): 1047 elif name in ("ps_texoff", "ps_texoff_implicit"):
934 # Texel offsets: needs vk_texture_test's texture, sampler and descriptor table (vk_harness binds none), 1048 # Texel offsets: needs vk_texture_test's texture, sampler and descriptor table (vk_harness binds none),
935 # and VK_KHR_maintenance8 for the non-constant Offset; the tool exits 77 without it. 1049 # and VK_KHR_maintenance8 for the non-constant Offset; the tool exits 77 without it.
@@ -944,11 +1058,13 @@ def run_suite(a, work: str) -> int:
944 with open(raw, "rb") as f: 1058 with open(raw, "rb") as f:
945 problem, covered = texoff_problem(f.read(), msg) 1059 problem, covered = texoff_problem(f.read(), msg)
946 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})")) 1060 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})"))
1061 elif name in OTHER_HARNESS:
1062 results.append((name, None, f"SKIP (run by {OTHER_HARNESS[name]})"))
947 elif name.startswith("ps_"): 1063 elif name.startswith("ps_"):
948 raw = os.path.join(raw_dir, f"{name}.raw") 1064 raw = os.path.join(raw_dir, f"{name}.raw")
949 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1065 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
950 if name in PIXEL_VERTEX: 1066 if name in PIXEL_VERTEX:
951 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback 1067 if bary_fallback() and name in ("ps_interp_f16_high", "ps_ij_computed"): # no PerVertexKHR inputs
952 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1068 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
953 continue 1069 continue
954 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1070 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -964,19 +1080,21 @@ def run_suite(a, work: str) -> int:
964 results.append((name, False, msg)) 1080 results.append((name, False, msg))
965 continue 1081 continue
966 const_wants = { 1082 const_wants = {
967 "ps_ops": (0x48804300, 5, 7, 0xFFFFFFFC), 1083 "ps_clip_color": (0x3E800000, 0x3F000000, 0x3F400000, 0x3F800000),
968 "ps_ops2": (0xABCD4400, 0x46001234, 0xFFFFFFFA, 7), 1084 "ps_ops": (0x48804300, 5, 7, 0xBFFFFFFC),
969 "ps_ops3": (0xFFFFFFFA, 0x44660066, 0x44AABBCC, 16), 1085 "ps_ops2": (0xABCD4400, 0x46001234, 0xBFFFFFFA, 7),
1086 "ps_ops3": (0xBFFFFFFA, 0x44660066, 0x44AABBCC, 16),
970 "ps_ops4": (0x34000010, 0x00120800, 0xBEEF0000, 0x12343C00), 1087 "ps_ops4": (0x34000010, 0x00120800, 0xBEEF0000, 0x12343C00),
971 "ps_scc": (1, 1, 3, 0x80000000), 1088 "ps_scc": (1, 1, 3, 0x80000000),
972 "ps_sdwa": (0x000000F1, 0xFFFEFFF2, 0x3C003344, 0xFFF70000), 1089 "ps_sdwa": (0x000000F1, 0xBFFEFFF2, 0x3C003344, 0xBFF70000),
973 "ps_legacy_mul": (0, 0, 0, 0x40C00000), # same expectation as check.py 1090 "ps_legacy_mul": (0, 0, 0, 0x40C00000), # same expectation as check.py
974 "ps_ops5": (0x12340010, 0xBEEF0800, 0xAAAAFFFF, 0xDEADBC00), # from the .asm headers 1091 "ps_ops5": (0x12340010, 0xBEEF0800, 0xAAAAFFFF, 0xDEADBC00), # from the .asm headers
975 "ps_ops6": (0xF800FFFF, 0x01000010, 0x00800800, 0x8000FFF0), 1092 "ps_ops6": (0xF800FFFF, 0x01000010, 0x00800800, 0x8000FFF0),
976 "ps_ops7": (0x00FF8077, 0xFF0000FF, 0x89ABCDEF, 0x00070003), 1093 "ps_ops7": (0x00FF8077, 0xFF0000FF, 0x89ABCDEF, 0x00070003),
977 "ps_ops8": (0x80000000, 0xFFFFFFFF, 0x000F100E, 0x0F0F0F1F), 1094 "ps_ops8": (0x80000000, 0xBFFFFFFF, 0x000F100E, 0x0F0F0F1F),
978 "ps_f32_mods": (0xC0256A01, 0x3F800000, 0x41E00000, 0x3FC00000), 1095 "ps_f32_mods": (0xC0256A01, 0x3F800000, 0x41E00000, 0x3FC00000),
979 "ps_vcc_x2": (0x11223344, 0x55667788, 0, 0), 1096 "ps_vcc_x2": (0x11223344, 0x55667788, 0, 0),
1097 "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header)
980 "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000), 1098 "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000),
981 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), 1099 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203),
982 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), 1100 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000),
@@ -1001,9 +1119,15 @@ def run_suite(a, work: str) -> int:
1001 "ps_vop3_const_mods": (0xC0000000, 0xBF800000, 0x3F800000, 0xAAAABC00), 1119 "ps_vop3_const_mods": (0xC0000000, 0xBF800000, 0x3F800000, 0xAAAABC00),
1002 "ps_interp_f32_mods": (0x3F800000, 0x00000000, 0x3F400000, 0x3F800000), # drawn with vs_interp_consts 1120 "ps_interp_f32_mods": (0x3F800000, 0x00000000, 0x3F400000, 0x3F800000), # drawn with vs_interp_consts
1003 "ps_interp_mov_mods": (0x3F800000, 0x3FC00000, 0x40000000, 0x3F400000), 1121 "ps_interp_mov_mods": (0x3F800000, 0x3FC00000, 0x40000000, 0x3F400000),
1122 # v_mad_u32_u16 / v_mad_i32_i16 and v_subrev_f16, which had CPU checks only (.asm headers)
1123 "ps_valu16_mad": (0x00000002, 0x00030002, 0x00008000, 0x00000004),
1124 "ps_valu16_subrev": (0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800),
1004 } 1125 }
1005 if name in const_wants: 1126 if name in const_wants:
1006 ok, detail = check_pixel_const(raw, const_wants[name]) 1127 if name == "ps_vcmpx_forms" and (skip := vcmpx_forms_narrow_skip(msg)):
1128 ok, detail = None, str(skip)
1129 else:
1130 ok, detail = check_pixel_const(raw, const_wants[name])
1007 elif name == "ps_bary": 1131 elif name == "ps_bary":
1008 ok, detail = check_bary(raw) 1132 ok, detail = check_bary(raw)
1009 elif name == "ps_bitmask_perm": 1133 elif name == "ps_bitmask_perm":
@@ -1022,6 +1146,10 @@ def run_suite(a, work: str) -> int:
1022 with open(raw, "rb") as source: 1146 with open(raw, "rb") as source:
1023 problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read()))) 1147 problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read())))
1024 ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3" 1148 ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3"
1149 elif name == "ps_ij_computed":
1150 with open(raw, "rb") as source:
1151 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read())))
1152 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6"
1025 else: 1153 else:
1026 ok, detail = False, "no checker defined" 1154 ok, detail = False, "no checker defined"
1027 results.append((name, ok, detail)) 1155 results.append((name, ok, detail))
@@ -1063,7 +1191,7 @@ def run_suite(a, work: str) -> int:
1063 results.append((name, ok, detail)) 1191 results.append((name, ok, detail))
1064 elif name == "ms_f16_pack": # mesh producer of packed f16 params, drawn with ps_interp_f16_high 1192 elif name == "ms_f16_pack": # mesh producer of packed f16 params, drawn with ps_interp_f16_high
1065 raw = os.path.join(raw_dir, f"{name}.raw") 1193 raw = os.path.join(raw_dir, f"{name}.raw")
1066 env = dict(gfx_env or os.environ, VKH_MESH="1") 1194 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS
1067 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv") 1195 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv")
1068 if bary_fallback(): 1196 if bary_fallback():
1069 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1197 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))