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:
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py40
1 files changed, 30 insertions, 10 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index a1e98d40a..9361c1011 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -25,7 +25,7 @@ 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_xy_xyz_test 28from check import Skip, clip_test, fmt_1010102_test, fmt_sint32_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 SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test)
31from 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,
@@ -40,6 +40,7 @@ from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip,
40 vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py 40 vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py
41from check import PIXEL_VERTEX, VINT_ENV, interp_f16_high_problem, ij_computed_problem # pixel producers and checks 41from check import PIXEL_VERTEX, VINT_ENV, interp_f16_high_problem, ij_computed_problem # pixel producers and checks
42from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries 42from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries
43from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide
43 44
44 45
45def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: 46def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes:
@@ -553,7 +554,7 @@ OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_transl
553# Shaders a selected test draws with, built even when the filter leaves them out (#192). 554# Shaders a selected test draws with, built even when the filter leaves them out (#192).
554DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", 555DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm",
555 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", 556 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm",
556 **{name: "vs_ids.asm" for name in TEXTURE_CONSTANTS}, "ps_ssharp": "vs_ids.asm", 557 **{name: "vs_ids.asm" for name in TEXTURE_CONSTANTS}, "ps_ssharp": "vs_ids.asm", "ps_imgatomic": "vs_ids.asm",
557 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", 558 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm",
558 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", 559 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm",
559 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm", 560 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm",
@@ -761,6 +762,12 @@ def run_suite(a, work: str) -> int:
761 for fname in asm_files: 762 for fname in asm_files:
762 name = os.path.splitext(fname)[0] 763 name = os.path.splitext(fname)[0]
763 spv = os.path.join(spirv_dir, f"{name}.spv") 764 spv = os.path.join(spirv_dir, f"{name}.spv")
765 if name == "ps_ij_computed" and (bary_fallback() or f16_interp_fallback()):
766 # Before the .spv check: without PerVertexKHR inputs the translator refuses a computed I/J pair, so there
767 # is no .spv (the f16 fallback is on by default where PerVertexKHR doesn't compile: MoltenVK).
768 results.append((name, None, "SKIP (computed I/J pairs need PerVertexKHR inputs: "
769 "no --bary-fallback / --f16-interp-fallback)"))
770 continue
764 if not os.path.isfile(spv): 771 if not os.path.isfile(spv):
765 results.append((name, False, "missing .spv (translation failed)")) 772 results.append((name, False, "missing .spv (translation failed)"))
766 continue 773 continue
@@ -831,6 +838,9 @@ def run_suite(a, work: str) -> int:
831 elif name == "cs_fmt_1010102": 838 elif name == "cs_fmt_1010102":
832 problem = fmt_1010102_test(a.build, spirv_dir, cs_env) 839 problem = fmt_1010102_test(a.build, spirv_dir, cs_env)
833 results.append((name, not problem, problem or "64/64 dumped words exact")) 840 results.append((name, not problem, problem or "64/64 dumped words exact"))
841 elif name == "cs_fmt_sint32":
842 problem = fmt_sint32_test(a.build, spirv_dir, cs_env)
843 results.append((name, not problem, problem or "64/64 dumped words exact"))
834 elif name == "cs_fmt_xy_xyz": 844 elif name == "cs_fmt_xy_xyz":
835 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) 845 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header)
836 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) 846 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env)
@@ -866,7 +876,7 @@ def run_suite(a, work: str) -> int:
866 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 876 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
867 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 877 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
868 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 878 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
869 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", 879 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",
870 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 880 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
871 "cs_dpp_bound", "cs_dpp_w64", 881 "cs_dpp_bound", "cs_dpp_w64",
872 "cs_w64_mask_detect", 882 "cs_w64_mask_detect",
@@ -937,6 +947,7 @@ def run_suite(a, work: str) -> int:
937 "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820], 947 "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820],
938 "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave 948 "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave
939 "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 949 "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32
950 "cs_w32_sincos": [1, 1, 1, 1, 1, 1], # SHADER-88 (cs_w32_sincos.asm): angles in turns
940 "cs_w64x_sbarrier": [605, 605, 686, 686, 3032, 3013, 3032, 3031], 951 "cs_w64x_sbarrier": [605, 605, 686, 686, 3032, 3013, 3032, 3031],
941 "cs_w64x_load_ballot_load": [43, 74, 75, 42, 42, 18, 41, 32], 952 "cs_w64x_load_ballot_load": [43, 74, 75, 42, 42, 18, 41, 32],
942 "cs_w64x_andn2_exec": [1, 16, 32, 4144, 2052, 3, 8, 1544], # s_andn2_saveexec/wrexec_b64 (.asm header) 953 "cs_w64x_andn2_exec": [1, 16, 32, 4144, 2052, 3, 8, 1544], # s_andn2_saveexec/wrexec_b64 (.asm header)
@@ -951,7 +962,7 @@ def run_suite(a, work: str) -> int:
951 } 962 }
952 want = cs_dump_wants[name] 963 want = cs_dump_wants[name]
953 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 964 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
954 # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32 965 # 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
955 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, 966 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
956 # as check.py does, where the device has none 967 # as check.py does, where the device has none
957 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 968 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
@@ -963,7 +974,7 @@ def run_suite(a, work: str) -> int:
963 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 974 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
964 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 975 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
965 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 976 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
966 "cs_bpermute32", "cs_w32_partial_scmp", 977 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos",
967 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 978 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
968 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 979 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
969 if partial and not emulated: 980 if partial and not emulated:
@@ -1037,10 +1048,12 @@ def run_suite(a, work: str) -> int:
1037 else: 1048 else:
1038 results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else 1049 results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else
1039 f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}")) 1050 f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}"))
1040 elif name == "ps_tex": 1051 elif name in ("ps_tex", "ps_imgatomic"):
1041 # A texture through the descriptor hash table and the bindless set. vk_bindless_test compares the 1052 # A texture through the descriptor hash table and the bindless set (ps_tex), or image atomics in a pixel
1042 # pixels itself, and exits 77 where the device lacks a feature the set or the shader needs. 1053 # shader through the set's r32ui storage arrays (ps_imgatomic, drawn with vs_ids). vk_bindless_test
1043 rc, msg = run_cmd([vk_bindless, vs_tri, spv]) 1054 # compares the result itself, and exits 77 where the device lacks a feature the set or shader needs.
1055 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_imgatomic" else vs_tri
1056 rc, msg = run_cmd([vk_bindless, vs, spv])
1044 lines = msg.splitlines() 1057 lines = msg.splitlines()
1045 if rc == 77: 1058 if rc == 77:
1046 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device") 1059 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device")
@@ -1072,7 +1085,7 @@ def run_suite(a, work: str) -> int:
1072 raw = os.path.join(raw_dir, f"{name}.raw") 1085 raw = os.path.join(raw_dir, f"{name}.raw")
1073 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1086 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
1074 if name in PIXEL_VERTEX: 1087 if name in PIXEL_VERTEX:
1075 if bary_fallback() and name in ("ps_interp_f16_high", "ps_ij_computed"): # no PerVertexKHR inputs 1088 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback
1076 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1089 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1077 continue 1090 continue
1078 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1091 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -1105,6 +1118,8 @@ def run_suite(a, work: str) -> int:
1105 "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header) 1118 "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header)
1106 "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000), 1119 "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000),
1107 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), 1120 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203),
1121 "ps_scc_logic32": (0x0fff0fff, 0x000f000f, 0xf00ff00f, 0x36),
1122 "ps_scc_logic64": (0x0fff0fff, 0xff000000, 0xff0000ff, 0x16),
1108 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), 1123 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000),
1109 "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64 1124 "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64
1110 # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers) 1125 # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers)
@@ -1117,6 +1132,7 @@ def run_suite(a, work: str) -> int:
1117 "ps_f16_const": (0xAAAA3D00, 0x38005555, 0xAAAA3800, 0x3F000000), 1132 "ps_f16_const": (0xAAAA3D00, 0x38005555, 0xAAAA3800, 0x3F000000),
1118 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3), 1133 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3),
1119 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200), 1134 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200),
1135 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400),
1120 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate 1136 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate
1121 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware 1137 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware
1122 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), 1138 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000),
@@ -1136,7 +1152,11 @@ def run_suite(a, work: str) -> int:
1136 "ps_vint_mul24": (0x13345678, 0xFFFFFFFD, 0x00007FFF, 0x0000FFFF), 1152 "ps_vint_mul24": (0x13345678, 0xFFFFFFFD, 0x00007FFF, 0x0000FFFF),
1137 "ps_vint_minmax": (0x7FFFFFFE, 0x80000001, 0x80000001, 0x7FFFFFFE), 1153 "ps_vint_minmax": (0x7FFFFFFE, 0x80000001, 0x80000001, 0x7FFFFFFE),
1138 "ps_vint_minmax3": (0xF0F0F0F0, 0xAB800000, 0xF0F0F0F0, 0xAB800000), 1154 "ps_vint_minmax3": (0xF0F0F0F0, 0xAB800000, 0xF0F0F0F0, 0xAB800000),
1155 "ps_w64x_readlane": (0x40000079, 0x40000010, 0x40000064, 0x400000BE), # same expectation as check.py
1139 } 1156 }
1157 if skip := wide_pixel_skip(name, msg): # a 64-wide pixel stage the device could not give: nothing to judge
1158 results.append((name, None, str(skip)))
1159 continue
1140 if name in const_wants: 1160 if name in const_wants:
1141 if name == "ps_vcmpx_forms" and (skip := vcmpx_forms_narrow_skip(msg)): 1161 if name == "ps_vcmpx_forms" and (skip := vcmpx_forms_narrow_skip(msg)):
1142 ok, detail = None, str(skip) 1162 ok, detail = None, str(skip)