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:
authorVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 20:31:52 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 20:31:52 +0100
commit4c3d624bda2707a815d318f65d26ab5865b6deca (patch)
treef70fbef93c7d310adccd73e656742d8bb7c49a75 /scripts/run_gpu_tests.py
parentc921b244abec2ae82f76b4e231e855fd09a41bcf (diff)
parent162821017ea3c286c8bec860f3ff94f037912061 (diff)
Merge main into hw-mad-u32-u16 (#2494)
Conflicts: docs/design.md tests/semantic/test_value_semantics.py AI-assisted.
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py74
1 files changed, 45 insertions, 29 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index b9e99e352..51e145e3f 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -1,7 +1,7 @@
1"""Assemble, translate, and run the synthetic RDNA2->SPIR-V GPU test suite on Vulkan. 1"""Assemble, translate, and run the synthetic RDNA2->SPIR-V GPU test suite on Vulkan.
2 2
3Usage: 3Usage:
4 python -I scripts/run_gpu_tests.py [--llvm-mc CMD] [--build DIR] [--work DIR] [--filter SUBSTR] 4 python -I scripts/run_gpu_tests.py [--llvm-mc CMD] [--build DIR] [--work DIR] [--filter SUBSTR] [--require-pass]
5 5
6--llvm-mc (or LLVM_MC) is a path or a whole command, e.g. "wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc". 6--llvm-mc (or LLVM_MC) is a path or a whole command, e.g. "wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc".
7""" 7"""
@@ -25,13 +25,14 @@ sys.path.insert(0, os.path.join(ROOT, "tools"))
25import mc_command # noqa: E402 25import mc_command # noqa: E402
26sys.path.insert(0, SHADER_DIR) 26sys.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_sint32_test, fmt_xy_xyz_test, tbuffer_store_test 28from check import Skip, clip_test, fmt_1010102_test, fmt_int_narrow_test, fmt_sint32_test, fmt_xy_xyz_test, tbuffer_store_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 SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test)
31from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, CVT_PK_U8_WORDS, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, 31from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, CVT_PK_U8_WORDS, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES,
32 TEXTURE_MIP_TEST, GATHER_LOD_TEST, MIP_TEST_PASSES, TEXTURE_CONSTANTS, USER_SGPRS_ENV, USER_SGPRS_WORDS, Skip, mesh_v5_test, not_found_message, 32 TEXTURE_MIP_TEST, GATHER_LOD_TEST, MIP_TEST_PASSES, TEXTURE_CONSTANTS, USER_SGPRS_ENV, USER_SGPRS_WORDS, Skip, mesh_v5_test, not_found_message,
33 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)
34from check import SIGNED_MIP_TEST 34from check import SIGNED_MIP_TEST
35from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan)
35from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py 36from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py
36from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 37from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8
37from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) 38from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT)
@@ -238,12 +239,13 @@ def unsupported_skip(msg: str) -> str:
238 return f"SKIP ({m.group(0) if m else 'unsupported device'})" 239 return f"SKIP ({m.group(0) if m else 'unsupported device'})"
239 240
240 241
241def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True) -> tuple[int, str]: 242def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True, *,
243 cwd: str | None = None) -> tuple[int, str]:
242 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT). 244 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT).
243 # gpu=False (the translator over the whole suite) runs without a limit. 245 # gpu=False (the translator over the whole suite) runs without a limit.
244 limit = gpu_test_timeout() if gpu else None 246 limit = gpu_test_timeout() if gpu else None
245 try: 247 try:
246 p = subprocess.run(cmd, capture_output=True, text=True, env=env, timeout=limit) 248 p = subprocess.run(cmd, capture_output=True, text=True, env=env, timeout=limit, cwd=cwd)
247 except subprocess.TimeoutExpired: 249 except subprocess.TimeoutExpired:
248 return 1, timed_out(cmd[0], limit) 250 return 1, timed_out(cmd[0], limit)
249 except OSError as e: # e.g. Smart App Control blocked a fresh build: fail this test, keep running the others 251 except OSError as e: # e.g. Smart App Control blocked a fresh build: fail this test, keep running the others
@@ -325,7 +327,7 @@ def judge_cs_dump(rc: int, msg: str, want: list[int], *, wave64: bool, partial:
325 if rc != 0 or words is None: 327 if rc != 0 or words is None:
326 return False, msg 328 return False, msg
327 vals = words[:len(want)] 329 vals = words[:len(want)]
328 return vals == want, " ".join((hex if hexwords else str)(x) for x in vals) 330 return words_match(vals, want), " ".join((hex if hexwords else str)(x) for x in vals)
329 331
330 332
331def check_pixel_const(raw_path: str, want: tuple[int, int, int, int]) -> tuple[bool, str]: 333def check_pixel_const(raw_path: str, want: tuple[int, int, int, int]) -> tuple[bool, str]:
@@ -599,6 +601,7 @@ def main() -> int:
599 "subfolder that has the test programs is found by itself") 601 "subfolder that has the test programs is found by itself")
600 ap.add_argument("--work", default=None) 602 ap.add_argument("--work", default=None)
601 ap.add_argument("--filter", default="") 603 ap.add_argument("--filter", default="")
604 ap.add_argument("--require-pass", action="store_true", help="exit 1 if no GPU test passes")
602 a = ap.parse_args() 605 a = ap.parse_args()
603 # Some test programs run with their working directory in <work>/spirv (vk_texture_test), so a relative path 606 # Some test programs run with their working directory in <work>/spirv (vk_texture_test), so a relative path
604 # given here would point somewhere else for them. 607 # given here would point somewhere else for them.
@@ -823,8 +826,8 @@ def run_suite(a, work: str) -> int:
823 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0], 826 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0],
824 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0], 827 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0],
825 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010], 828 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010],
826 # swizzled MUBUF addressing and ADD_TID_ENABLE (lanes 0 and 1 store; derivation in the .asm header) 829 # swizzled MUBUF addressing (measured natively on gfx1036) and ADD_TID_ENABLE (lanes 0 and 1 store)
827 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED0028, 0, 0xBEEF0000, 830 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED000C, 0, 0xBEEF0000,
828 0xBEEF0001], 831 0xBEEF0001],
829 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 832 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
830 "cs_cvt_pk_u8": CVT_PK_U8_WORDS, 833 "cs_cvt_pk_u8": CVT_PK_U8_WORDS,
@@ -839,6 +842,9 @@ def run_suite(a, work: str) -> int:
839 elif name == "cs_fmt_sint32": 842 elif name == "cs_fmt_sint32":
840 problem = fmt_sint32_test(a.build, spirv_dir, cs_env) 843 problem = fmt_sint32_test(a.build, spirv_dir, cs_env)
841 results.append((name, not problem, problem or "64/64 dumped words exact")) 844 results.append((name, not problem, problem or "64/64 dumped words exact"))
845 elif name == "cs_fmt_int_narrow":
846 problem = fmt_int_narrow_test(a.build, spirv_dir, cs_env)
847 results.append((name, not problem, problem or "136/136 dumped words exact"))
842 elif name == "cs_fmt_xy_xyz": 848 elif name == "cs_fmt_xy_xyz":
843 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) 849 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header)
844 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) 850 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env)
@@ -878,7 +884,7 @@ def run_suite(a, work: str) -> int:
878 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 884 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
879 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 885 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
880 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 886 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
881 elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_w32_sincos", "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", 887 elif name in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_w32_sincos", "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",
882 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 888 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
883 "cs_dpp_bound", "cs_dpp_w64", 889 "cs_dpp_bound", "cs_dpp_w64",
884 "cs_w64_mask_detect", 890 "cs_w64_mask_detect",
@@ -887,7 +893,8 @@ def run_suite(a, work: str) -> int:
887 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", 893 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load",
888 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", 894 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent",
889 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", 895 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end",
890 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst"): 896 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst",
897 "cs_mask_vgpr_exec"):
891 cs_dump_wants = { 898 cs_dump_wants = {
892 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], 899 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000],
893 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone 900 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone
@@ -926,6 +933,9 @@ def run_suite(a, work: str) -> int:
926 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], 933 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7],
927 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], 934 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777],
928 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], 935 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6],
936 # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7]
937 # without it
938 "cs_signed_zero_nan": [0x80000000, 0x80000000, 0x80008000, 0x00008000, 1, 1, 1, 0x00007C00],
929 "cs_wave64_ballot": [32, 16, 24, 40, 8, 48], 939 "cs_wave64_ballot": [32, 16, 24, 40, 8, 48],
930 "cs_wm_half_ops": [32, 16, 16, 0, 16], 940 "cs_wm_half_ops": [32, 16, 16, 0, 16],
931 "cs_wm_half_cmp": [1, 0, 1, 1], 941 "cs_wm_half_cmp": [1, 0, 1, 1],
@@ -964,10 +974,14 @@ def run_suite(a, work: str) -> int:
964 # differs per wave (cs_barrier_loop.asm) 974 # differs per wave (cs_barrier_loop.asm)
965 "cs_barrier_early_end": [127, 126, 125, 124, 123, 122, 121, 120], 975 "cs_barrier_early_end": [127, 126, 125, 124, 123, 122, 121, 120],
966 "cs_barrier_loop": [128, 96, 64, 32, 128, 96, 64, 0xEEEEEEEE], 976 "cs_barrier_loop": [128, 96, 64, 32, 128, 96, 64, 0xEEEEEEEE],
977 # SHADER-21 part 2: a mask copied to a VGPR with v_mov_b32 respects EXEC —
978 # inactive lanes keep the old VGPR (cs_mask_vgpr_exec.asm)
979 "cs_mask_vgpr_exec": [0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
980 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF],
967 } 981 }
968 want = cs_dump_wants[name] 982 want = cs_dump_wants[name]
969 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 983 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
970 # cs_w32_lds_u8_d16 / cs_w32_sincos / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32 984 # cs_w32_lds_u8_d16 / cs_w32_sincos / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops / cs_signed_zero_nan, the wave32
971 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, 985 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
972 # as check.py does, where the device has none 986 # as check.py does, where the device has none
973 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 987 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
@@ -976,11 +990,11 @@ def run_suite(a, work: str) -> int:
976 # size 64 without them. 990 # size 64 without them.
977 emulated = w64_emulated() 991 emulated = w64_emulated()
978 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 992 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp")
979 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 993 wave64 = name not in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
980 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 994 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
981 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 995 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
982 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", 996 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos",
983 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", 997 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec",
984 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 998 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
985 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 999 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
986 if partial and not emulated: 1000 if partial and not emulated:
@@ -992,9 +1006,13 @@ def run_suite(a, work: str) -> int:
992 if skip: # e.g. Mesa llvmpipe's 8-wide subgroups: these 32-lane masks can't come out right 1006 if skip: # e.g. Mesa llvmpipe's 8-wide subgroups: these 32-lane masks can't come out right
993 ok, detail = None, str(skip) 1007 ok, detail = None, str(skip)
994 else: 1008 else:
1009 want = judged_words(name, msg, want) # cs_signed_zero_nan on Apple and llvmpipe (check.py)
995 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, 1010 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated,
996 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16", 1011 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16",
997 "cs_lds_b64_cmpst")) 1012 "cs_lds_b64_cmpst", "cs_signed_zero_nan"))
1013 if ok and None in want:
1014 unjudged = ", ".join(str(i) for i, w in enumerate(want) if w is None)
1015 detail += f" (words {unjudged} not judged on this device: UNJUDGED_WORDS in check.py)"
998 results.append((name, ok, detail)) 1016 results.append((name, ok, detail))
999 elif name == "cs_imgstore": 1017 elif name == "cs_imgstore":
1000 rc, msg = run_cmd([vk_store, spv]) 1018 rc, msg = run_cmd([vk_store, spv])
@@ -1022,13 +1040,7 @@ def run_suite(a, work: str) -> int:
1022 mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"], 1040 mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"],
1023 "ps_sample_c_lz_a16": ["dref_a16"]}.get(name, []) 1041 "ps_sample_c_lz_a16": ["dref_a16"]}.get(name, [])
1024 cmd = [tool, *mode, raw] 1042 cmd = [tool, *mode, raw]
1025 try: 1043 rc, msg = run_cmd(cmd, cwd=spirv_dir)
1026 p = subprocess.run(cmd, capture_output=True, text=True, cwd=spirv_dir)
1027 rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
1028 except FileNotFoundError:
1029 rc, msg = 1, f"missing {tool}"
1030 except OSError as e:
1031 rc, msg = 1, start_failure(tool, e)
1032 if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need 1044 if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need
1033 results.append((name, None, unsupported_skip(msg))) 1045 results.append((name, None, unsupported_skip(msg)))
1034 elif name == "ps_texture_sample_d16" and rc == 0: 1046 elif name == "ps_texture_sample_d16" and rc == 0:
@@ -1040,12 +1052,8 @@ def run_suite(a, work: str) -> int:
1040 expected = TEXTURE_CONSTANTS[name] 1052 expected = TEXTURE_CONSTANTS[name]
1041 tool = os.path.join(a.build, "vk_texture_test" + ext) 1053 tool = os.path.join(a.build, "vk_texture_test" + ext)
1042 raw = os.path.join(raw_dir, f"{name}.raw") 1054 raw = os.path.join(raw_dir, f"{name}.raw")
1043 try: 1055 rc, msg = run_cmd([tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "92", "c00000",
1044 p = subprocess.run([tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "92", "c00000", 1056 "14500000", "0"], cwd=spirv_dir)
1045 "14500000", "0"], capture_output=True, text=True, cwd=spirv_dir)
1046 rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
1047 except FileNotFoundError:
1048 rc, msg = 1, f"missing {tool}"
1049 bad = 4096 1057 bad = 4096
1050 if rc == 0 and os.path.isfile(raw): 1058 if rc == 0 and os.path.isfile(raw):
1051 data = Path(raw).read_bytes() 1059 data = Path(raw).read_bytes()
@@ -1092,7 +1100,9 @@ def run_suite(a, work: str) -> int:
1092 raw = os.path.join(raw_dir, f"{name}.raw") 1100 raw = os.path.join(raw_dir, f"{name}.raw")
1093 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1101 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
1094 if name in PIXEL_VERTEX: 1102 if name in PIXEL_VERTEX:
1095 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback 1103 # --bary-fallback alone has no PerVertexKHR inputs, so the f16 halves can't be interpolated; with
1104 # --f16-interp-fallback too (on by itself without fragmentShaderBarycentric) it reads decoded halves.
1105 if name == "ps_interp_f16_high" and bary_fallback() and not f16_interp_fallback():
1096 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1106 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1097 continue 1107 continue
1098 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1108 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -1141,6 +1151,7 @@ def run_suite(a, work: str) -> int:
1141 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3), 1151 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3),
1142 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200), 1152 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200),
1143 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400), 1153 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400),
1154 "ps_sdwa_f16_const": (0xAAAA3800, 0xAAAA1C00, 0xAAAA3E00, 0xAAAA73F0), # measured on gfx1036
1144 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate 1155 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate
1145 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware 1156 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware
1146 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), 1157 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000),
@@ -1235,7 +1246,7 @@ def run_suite(a, work: str) -> int:
1235 raw = os.path.join(raw_dir, f"{name}.raw") 1246 raw = os.path.join(raw_dir, f"{name}.raw")
1236 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS 1247 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS
1237 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv") 1248 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv")
1238 if bary_fallback(): 1249 if bary_fallback() and not f16_interp_fallback():
1239 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1250 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1240 continue 1251 continue
1241 rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env) 1252 rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env)
@@ -1278,7 +1289,12 @@ def run_suite(a, work: str) -> int:
1278 skipped += ok is None 1289 skipped += ok is None
1279 print(f" {tag:4s} {name:<20s} {detail}") 1290 print(f" {tag:4s} {name:<20s} {detail}")
1280 print(f"\n{passed}/{len(results)} passed" + (f", {skipped} skipped" if skipped else "")) 1291 print(f"\n{passed}/{len(results)} passed" + (f", {skipped} skipped" if skipped else ""))
1281 return 0 if passed + skipped == len(results) else 1 1292 if passed + skipped != len(results):
1293 return 1
1294 if getattr(a, "require_pass", False) and not passed:
1295 print("error: --require-pass: no GPU tests passed", file=sys.stderr)
1296 return 1
1297 return 0
1282 1298
1283 1299
1284if __name__ == "__main__": 1300if __name__ == "__main__":