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 17:22:43 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 17:22:43 +0100
commit3d1dbf1cef8b9240cce69b2bcdba0c09ea0f1d5e (patch)
tree5d84c2e541aa31bcf23d9921dde7e9cb92b2ac59 /scripts/run_gpu_tests.py
parent2560485f76c45779ec93a2a6dc001c93211f7b3f (diff)
parent4eb6155d3ac4f9d3fadb0d095c4ce13e76783615 (diff)
Merge main into test/coverage-gaps (#1299)
Conflicts: runtime/test/shaders/check.py, scripts/run_gpu_tests.py AI-assisted.
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py44
1 files changed, 32 insertions, 12 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 73974b7b9..7a508688e 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_sint32_test, fmt_xy_xyz_test 28from check import Skip, clip_test, fmt_1010102_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, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, 31from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES,
@@ -38,7 +38,7 @@ from check import gpu_test_timeout, timed_out # per-program time limit (LEONID
38from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS 38from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS
39from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, 39from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_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, interp_f16_high_problem, ij_computed_problem # pixel producers and checks 41from check import PIXEL_VERTEX, interp_f16_high_problem, ij_computed_problem, mandelbrot_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 43from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide
44 44
@@ -115,7 +115,7 @@ def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None:
115 continue 115 continue
116 if ln.startswith("\t"): 116 if ln.startswith("\t"):
117 lines.append(ln) 117 lines.append(ln)
118 with open(s_path, "w", encoding="utf-8") as f: 118 with open(s_path, "w", encoding="utf-8", newline="\n") as f:
119 f.write("\n".join(lines) + "\n") 119 f.write("\n".join(lines) + "\n")
120 120
121 121
@@ -549,13 +549,15 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool,
549OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test", 549OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test",
550 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test", 550 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test",
551 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test", 551 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test",
552 "ps_m3_post": "d3d12_m3_frame_test"} 552 "ps_m3_post": "d3d12_m3_frame_test",
553 "cs_m4_fill": "d3d12_m4_compute_test", "cs_m4_indirect": "d3d12_m4_compute_test",
554 "cs_buf_typed": "d3d12_buffer_uav_test", "cs_buf_counter": "d3d12_buffer_uav_test"}
553 555
554 556
555# Shaders a selected test draws with, built even when the filter leaves them out (#192). 557# Shaders a selected test draws with, built even when the filter leaves them out (#192).
556DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", 558DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm",
557 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", 559 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm",
558 **{name: "vs_ids.asm" for name in TEXTURE_CONSTANTS}, "ps_ssharp": "vs_ids.asm", 560 **{name: "vs_ids.asm" for name in TEXTURE_CONSTANTS}, "ps_ssharp": "vs_ids.asm", "ps_imgatomic": "vs_ids.asm",
559 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", 561 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm",
560 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", 562 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm",
561 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm", 563 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm",
@@ -846,6 +848,10 @@ def run_suite(a, work: str) -> int:
846 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) 848 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header)
847 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) 849 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env)
848 results.append((name, not problem, problem or "128/128 dumped words exact")) 850 results.append((name, not problem, problem or "128/128 dumped words exact"))
851 elif name == "cs_tbuffer_store":
852 # tbuffer_store_format_*: the instruction's format, words measured natively on a Radeon 680M (the .asm header)
853 problem = tbuffer_store_test(a.build, spirv_dir, cs_env)
854 results.append((name, not problem, problem or "128/128 dumped words exact"))
849 elif name == "cs_global_neg_offset": 855 elif name == "cs_global_neg_offset":
850 # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte 856 # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte
851 # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement. 857 # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement.
@@ -886,7 +892,7 @@ def run_suite(a, work: str) -> int:
886 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", 892 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load",
887 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", 893 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent",
888 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", 894 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end",
889 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_w32_andn2_exec"): 895 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst", "cs_w32_andn2_exec"):
890 cs_dump_wants = { 896 cs_dump_wants = {
891 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], 897 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000],
892 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone 898 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone
@@ -908,6 +914,9 @@ def run_suite(a, work: str) -> int:
908 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE], 914 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE],
909 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header) 915 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header)
910 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], 916 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234],
917 # ds_cmpst_b32 and the b64 2-address forms (cs_lds_b64_cmpst.asm header)
918 "cs_lds_b64_cmpst": [0x11110001, 0x22220002, 0x33330003, 0x44440004,
919 0xCCCC000C, 0x44440004, 0xBBBB000B, 0x3579BADC],
911 # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant 920 # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant
912 "cs_exec_const": [16, 8, 2, 16, 0, 16], 921 "cs_exec_const": [16, 8, 2, 16, 0, 16],
913 # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers) 922 # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers)
@@ -977,7 +986,8 @@ def run_suite(a, work: str) -> int:
977 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 986 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
978 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 987 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
979 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", 988 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos",
980 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 989 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm",
990 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
981 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_w32_andn2_exec") and not emulated and not partial 991 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_w32_andn2_exec") and not emulated and not partial
982 if partial and not emulated: 992 if partial and not emulated:
983 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") 993 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64")
@@ -989,7 +999,8 @@ def run_suite(a, work: str) -> int:
989 ok, detail = None, str(skip) 999 ok, detail = None, str(skip)
990 else: 1000 else:
991 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, 1001 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated,
992 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16")) 1002 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16",
1003 "cs_lds_b64_cmpst"))
993 results.append((name, ok, detail)) 1004 results.append((name, ok, detail))
994 elif name == "cs_imgstore": 1005 elif name == "cs_imgstore":
995 rc, msg = run_cmd([vk_store, spv]) 1006 rc, msg = run_cmd([vk_store, spv])
@@ -1050,10 +1061,12 @@ def run_suite(a, work: str) -> int:
1050 else: 1061 else:
1051 results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else 1062 results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else
1052 f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}")) 1063 f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}"))
1053 elif name == "ps_tex": 1064 elif name in ("ps_tex", "ps_imgatomic"):
1054 # A texture through the descriptor hash table and the bindless set. vk_bindless_test compares the 1065 # A texture through the descriptor hash table and the bindless set (ps_tex), or image atomics in a pixel
1055 # pixels itself, and exits 77 where the device lacks a feature the set or the shader needs. 1066 # shader through the set's r32ui storage arrays (ps_imgatomic, drawn with vs_ids). vk_bindless_test
1056 rc, msg = run_cmd([vk_bindless, vs_tri, spv]) 1067 # compares the result itself, and exits 77 where the device lacks a feature the set or shader needs.
1068 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_imgatomic" else vs_tri
1069 rc, msg = run_cmd([vk_bindless, vs, spv])
1057 lines = msg.splitlines() 1070 lines = msg.splitlines()
1058 if rc == 77: 1071 if rc == 77:
1059 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device") 1072 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device")
@@ -1118,6 +1131,8 @@ def run_suite(a, work: str) -> int:
1118 "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header) 1131 "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header)
1119 "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000), 1132 "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000),
1120 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), 1133 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203),
1134 "ps_scc_logic32": (0x0fff0fff, 0x000f000f, 0xf00ff00f, 0x36),
1135 "ps_scc_logic64": (0x0fff0fff, 0xff000000, 0xff0000ff, 0x16),
1121 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), 1136 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000),
1122 "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64 1137 "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64
1123 # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers) 1138 # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers)
@@ -1178,6 +1193,11 @@ def run_suite(a, work: str) -> int:
1178 with open(raw, "rb") as source: 1193 with open(raw, "rb") as source:
1179 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read()))) 1194 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read())))
1180 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6" 1195 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6"
1196 elif name == "ps_mandelbrot":
1197 with open(raw, "rb") as source:
1198 px = list(struct.iter_unpack("<4I", source.read()))
1199 problem = mandelbrot_problem(px)
1200 ok, detail = not problem, problem or f"{len(px)}/{len(px)} iteration counts match the float32 model"
1181 else: 1201 else:
1182 ok, detail = False, "no checker defined" 1202 ok, detail = False, "no checker defined"
1183 results.append((name, ok, detail)) 1203 results.append((name, ok, detail))