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 19:52:33 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 19:52:33 +0100
commit16a98e4bb7d12966d233ec4e6831e13771361192 (patch)
tree6200c91d6e71d1418a504da7a0bcefd6854c8033 /scripts/run_gpu_tests.py
parentf161481d34e5e38dcc2efbf2cf013ca017846a4a (diff)
parent162821017ea3c286c8bec860f3ff94f037912061 (diff)
Merge main into valu-int-misc (#1492)
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 33cce0e02..f43967fb4 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]:
@@ -605,6 +607,7 @@ def main() -> int:
605 "subfolder that has the test programs is found by itself") 607 "subfolder that has the test programs is found by itself")
606 ap.add_argument("--work", default=None) 608 ap.add_argument("--work", default=None)
607 ap.add_argument("--filter", default="") 609 ap.add_argument("--filter", default="")
610 ap.add_argument("--require-pass", action="store_true", help="exit 1 if no GPU test passes")
608 a = ap.parse_args() 611 a = ap.parse_args()
609 # Some test programs run with their working directory in <work>/spirv (vk_texture_test), so a relative path 612 # Some test programs run with their working directory in <work>/spirv (vk_texture_test), so a relative path
610 # given here would point somewhere else for them. 613 # given here would point somewhere else for them.
@@ -829,8 +832,8 @@ def run_suite(a, work: str) -> int:
829 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0], 832 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0],
830 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0], 833 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0],
831 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010], 834 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010],
832 # swizzled MUBUF addressing and ADD_TID_ENABLE (lanes 0 and 1 store; derivation in the .asm header) 835 # swizzled MUBUF addressing (measured natively on gfx1036) and ADD_TID_ENABLE (lanes 0 and 1 store)
833 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED0028, 0, 0xBEEF0000, 836 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED000C, 0, 0xBEEF0000,
834 0xBEEF0001], 837 0xBEEF0001],
835 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 838 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
836 "cs_cvt_pk_u8": CVT_PK_U8_WORDS, 839 "cs_cvt_pk_u8": CVT_PK_U8_WORDS,
@@ -845,6 +848,9 @@ def run_suite(a, work: str) -> int:
845 elif name == "cs_fmt_sint32": 848 elif name == "cs_fmt_sint32":
846 problem = fmt_sint32_test(a.build, spirv_dir, cs_env) 849 problem = fmt_sint32_test(a.build, spirv_dir, cs_env)
847 results.append((name, not problem, problem or "64/64 dumped words exact")) 850 results.append((name, not problem, problem or "64/64 dumped words exact"))
851 elif name == "cs_fmt_int_narrow":
852 problem = fmt_int_narrow_test(a.build, spirv_dir, cs_env)
853 results.append((name, not problem, problem or "136/136 dumped words exact"))
848 elif name == "cs_fmt_xy_xyz": 854 elif name == "cs_fmt_xy_xyz":
849 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) 855 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header)
850 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) 856 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env)
@@ -884,7 +890,7 @@ def run_suite(a, work: str) -> int:
884 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 890 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
885 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 891 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
886 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 892 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
887 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", 893 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",
888 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 894 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
889 "cs_dpp_bound", "cs_dpp_w64", 895 "cs_dpp_bound", "cs_dpp_w64",
890 "cs_w64_mask_detect", 896 "cs_w64_mask_detect",
@@ -893,7 +899,8 @@ def run_suite(a, work: str) -> int:
893 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", 899 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load",
894 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", 900 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent",
895 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", 901 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end",
896 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst"): 902 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst",
903 "cs_mask_vgpr_exec"):
897 cs_dump_wants = { 904 cs_dump_wants = {
898 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], 905 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000],
899 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone 906 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone
@@ -932,6 +939,9 @@ def run_suite(a, work: str) -> int:
932 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], 939 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7],
933 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], 940 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777],
934 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], 941 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6],
942 # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7]
943 # without it
944 "cs_signed_zero_nan": [0x80000000, 0x80000000, 0x80008000, 0x00008000, 1, 1, 1, 0x00007C00],
935 "cs_wave64_ballot": [32, 16, 24, 40, 8, 48], 945 "cs_wave64_ballot": [32, 16, 24, 40, 8, 48],
936 "cs_wm_half_ops": [32, 16, 16, 0, 16], 946 "cs_wm_half_ops": [32, 16, 16, 0, 16],
937 "cs_wm_half_cmp": [1, 0, 1, 1], 947 "cs_wm_half_cmp": [1, 0, 1, 1],
@@ -970,10 +980,14 @@ def run_suite(a, work: str) -> int:
970 # differs per wave (cs_barrier_loop.asm) 980 # differs per wave (cs_barrier_loop.asm)
971 "cs_barrier_early_end": [127, 126, 125, 124, 123, 122, 121, 120], 981 "cs_barrier_early_end": [127, 126, 125, 124, 123, 122, 121, 120],
972 "cs_barrier_loop": [128, 96, 64, 32, 128, 96, 64, 0xEEEEEEEE], 982 "cs_barrier_loop": [128, 96, 64, 32, 128, 96, 64, 0xEEEEEEEE],
983 # SHADER-21 part 2: a mask copied to a VGPR with v_mov_b32 respects EXEC —
984 # inactive lanes keep the old VGPR (cs_mask_vgpr_exec.asm)
985 "cs_mask_vgpr_exec": [0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
986 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF],
973 } 987 }
974 want = cs_dump_wants[name] 988 want = cs_dump_wants[name]
975 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 989 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
976 # 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 990 # 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
977 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, 991 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
978 # as check.py does, where the device has none 992 # as check.py does, where the device has none
979 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 993 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
@@ -982,11 +996,11 @@ def run_suite(a, work: str) -> int:
982 # size 64 without them. 996 # size 64 without them.
983 emulated = w64_emulated() 997 emulated = w64_emulated()
984 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 998 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp")
985 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 999 wave64 = name not in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
986 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 1000 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
987 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 1001 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
988 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", 1002 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos",
989 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", 1003 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec",
990 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 1004 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
991 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 1005 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
992 if partial and not emulated: 1006 if partial and not emulated:
@@ -998,9 +1012,13 @@ def run_suite(a, work: str) -> int:
998 if skip: # e.g. Mesa llvmpipe's 8-wide subgroups: these 32-lane masks can't come out right 1012 if skip: # e.g. Mesa llvmpipe's 8-wide subgroups: these 32-lane masks can't come out right
999 ok, detail = None, str(skip) 1013 ok, detail = None, str(skip)
1000 else: 1014 else:
1015 want = judged_words(name, msg, want) # cs_signed_zero_nan on Apple and llvmpipe (check.py)
1001 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, 1016 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated,
1002 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16", 1017 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16",
1003 "cs_lds_b64_cmpst")) 1018 "cs_lds_b64_cmpst", "cs_signed_zero_nan"))
1019 if ok and None in want:
1020 unjudged = ", ".join(str(i) for i, w in enumerate(want) if w is None)
1021 detail += f" (words {unjudged} not judged on this device: UNJUDGED_WORDS in check.py)"
1004 results.append((name, ok, detail)) 1022 results.append((name, ok, detail))
1005 elif name == "cs_imgstore": 1023 elif name == "cs_imgstore":
1006 rc, msg = run_cmd([vk_store, spv]) 1024 rc, msg = run_cmd([vk_store, spv])
@@ -1028,13 +1046,7 @@ def run_suite(a, work: str) -> int:
1028 mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"], 1046 mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"],
1029 "ps_sample_c_lz_a16": ["dref_a16"]}.get(name, []) 1047 "ps_sample_c_lz_a16": ["dref_a16"]}.get(name, [])
1030 cmd = [tool, *mode, raw] 1048 cmd = [tool, *mode, raw]
1031 try: 1049 rc, msg = run_cmd(cmd, cwd=spirv_dir)
1032 p = subprocess.run(cmd, capture_output=True, text=True, cwd=spirv_dir)
1033 rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
1034 except FileNotFoundError:
1035 rc, msg = 1, f"missing {tool}"
1036 except OSError as e:
1037 rc, msg = 1, start_failure(tool, e)
1038 if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need 1050 if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need
1039 results.append((name, None, unsupported_skip(msg))) 1051 results.append((name, None, unsupported_skip(msg)))
1040 elif name == "ps_texture_sample_d16" and rc == 0: 1052 elif name == "ps_texture_sample_d16" and rc == 0:
@@ -1046,12 +1058,8 @@ def run_suite(a, work: str) -> int:
1046 expected = TEXTURE_CONSTANTS[name] 1058 expected = TEXTURE_CONSTANTS[name]
1047 tool = os.path.join(a.build, "vk_texture_test" + ext) 1059 tool = os.path.join(a.build, "vk_texture_test" + ext)
1048 raw = os.path.join(raw_dir, f"{name}.raw") 1060 raw = os.path.join(raw_dir, f"{name}.raw")
1049 try: 1061 rc, msg = run_cmd([tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "92", "c00000",
1050 p = subprocess.run([tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "92", "c00000", 1062 "14500000", "0"], cwd=spirv_dir)
1051 "14500000", "0"], capture_output=True, text=True, cwd=spirv_dir)
1052 rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
1053 except FileNotFoundError:
1054 rc, msg = 1, f"missing {tool}"
1055 bad = 4096 1063 bad = 4096
1056 if rc == 0 and os.path.isfile(raw): 1064 if rc == 0 and os.path.isfile(raw):
1057 data = Path(raw).read_bytes() 1065 data = Path(raw).read_bytes()
@@ -1098,7 +1106,9 @@ def run_suite(a, work: str) -> int:
1098 raw = os.path.join(raw_dir, f"{name}.raw") 1106 raw = os.path.join(raw_dir, f"{name}.raw")
1099 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1107 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
1100 if name in PIXEL_VERTEX: 1108 if name in PIXEL_VERTEX:
1101 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback 1109 # --bary-fallback alone has no PerVertexKHR inputs, so the f16 halves can't be interpolated; with
1110 # --f16-interp-fallback too (on by itself without fragmentShaderBarycentric) it reads decoded halves.
1111 if name == "ps_interp_f16_high" and bary_fallback() and not f16_interp_fallback():
1102 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1112 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1103 continue 1113 continue
1104 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1114 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -1147,6 +1157,7 @@ def run_suite(a, work: str) -> int:
1147 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3), 1157 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3),
1148 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200), 1158 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200),
1149 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400), 1159 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400),
1160 "ps_sdwa_f16_const": (0xAAAA3800, 0xAAAA1C00, 0xAAAA3E00, 0xAAAA73F0), # measured on gfx1036
1150 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate 1161 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate
1151 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware 1162 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware
1152 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), 1163 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000),
@@ -1246,7 +1257,7 @@ def run_suite(a, work: str) -> int:
1246 raw = os.path.join(raw_dir, f"{name}.raw") 1257 raw = os.path.join(raw_dir, f"{name}.raw")
1247 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS 1258 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS
1248 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv") 1259 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv")
1249 if bary_fallback(): 1260 if bary_fallback() and not f16_interp_fallback():
1250 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1261 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1251 continue 1262 continue
1252 rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env) 1263 rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env)
@@ -1289,7 +1300,12 @@ def run_suite(a, work: str) -> int:
1289 skipped += ok is None 1300 skipped += ok is None
1290 print(f" {tag:4s} {name:<20s} {detail}") 1301 print(f" {tag:4s} {name:<20s} {detail}")
1291 print(f"\n{passed}/{len(results)} passed" + (f", {skipped} skipped" if skipped else "")) 1302 print(f"\n{passed}/{len(results)} passed" + (f", {skipped} skipped" if skipped else ""))
1292 return 0 if passed + skipped == len(results) else 1 1303 if passed + skipped != len(results):
1304 return 1
1305 if getattr(a, "require_pass", False) and not passed:
1306 print("error: --require-pass: no GPU tests passed", file=sys.stderr)
1307 return 1
1308 return 0
1293 1309
1294 1310
1295if __name__ == "__main__": 1311if __name__ == "__main__":