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.py44
1 files changed, 32 insertions, 12 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 7209c364c..025504fb8 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
@@ -542,13 +542,15 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool,
542OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test", 542OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test",
543 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test", 543 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test",
544 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test", 544 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test",
545 "ps_m3_post": "d3d12_m3_frame_test"} 545 "ps_m3_post": "d3d12_m3_frame_test",
546 "cs_m4_fill": "d3d12_m4_compute_test", "cs_m4_indirect": "d3d12_m4_compute_test",
547 "cs_buf_typed": "d3d12_buffer_uav_test", "cs_buf_counter": "d3d12_buffer_uav_test"}
546 548
547 549
548# Shaders a selected test draws with, built even when the filter leaves them out (#192). 550# Shaders a selected test draws with, built even when the filter leaves them out (#192).
549DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", 551DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm",
550 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", 552 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm",
551 **{name: "vs_ids.asm" for name in TEXTURE_CONSTANTS}, "ps_ssharp": "vs_ids.asm", 553 **{name: "vs_ids.asm" for name in TEXTURE_CONSTANTS}, "ps_ssharp": "vs_ids.asm", "ps_imgatomic": "vs_ids.asm",
552 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", 554 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm",
553 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", 555 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm",
554 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm", 556 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm",
@@ -839,6 +841,10 @@ def run_suite(a, work: str) -> int:
839 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) 841 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header)
840 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) 842 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env)
841 results.append((name, not problem, problem or "128/128 dumped words exact")) 843 results.append((name, not problem, problem or "128/128 dumped words exact"))
844 elif name == "cs_tbuffer_store":
845 # tbuffer_store_format_*: the instruction's format, words measured natively on a Radeon 680M (the .asm header)
846 problem = tbuffer_store_test(a.build, spirv_dir, cs_env)
847 results.append((name, not problem, problem or "128/128 dumped words exact"))
842 elif name == "cs_global_neg_offset": 848 elif name == "cs_global_neg_offset":
843 # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte 849 # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte
844 # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement. 850 # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement.
@@ -879,7 +885,7 @@ def run_suite(a, work: str) -> int:
879 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", 885 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load",
880 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", 886 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent",
881 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", 887 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end",
882 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64"): 888 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst"):
883 cs_dump_wants = { 889 cs_dump_wants = {
884 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], 890 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000],
885 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone 891 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone
@@ -901,6 +907,9 @@ def run_suite(a, work: str) -> int:
901 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE], 907 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE],
902 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header) 908 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header)
903 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], 909 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234],
910 # ds_cmpst_b32 and the b64 2-address forms (cs_lds_b64_cmpst.asm header)
911 "cs_lds_b64_cmpst": [0x11110001, 0x22220002, 0x33330003, 0x44440004,
912 0xCCCC000C, 0x44440004, 0xBBBB000B, 0x3579BADC],
904 # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant 913 # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant
905 "cs_exec_const": [16, 8, 2, 16, 0, 16], 914 "cs_exec_const": [16, 8, 2, 16, 0, 16],
906 # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers) 915 # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers)
@@ -969,7 +978,8 @@ def run_suite(a, work: str) -> int:
969 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 978 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
970 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 979 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
971 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", 980 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos",
972 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 981 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm",
982 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
973 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 983 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
974 if partial and not emulated: 984 if partial and not emulated:
975 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") 985 cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64")
@@ -981,7 +991,8 @@ def run_suite(a, work: str) -> int:
981 ok, detail = None, str(skip) 991 ok, detail = None, str(skip)
982 else: 992 else:
983 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, 993 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated,
984 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16")) 994 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16",
995 "cs_lds_b64_cmpst"))
985 results.append((name, ok, detail)) 996 results.append((name, ok, detail))
986 elif name == "cs_imgstore": 997 elif name == "cs_imgstore":
987 rc, msg = run_cmd([vk_store, spv]) 998 rc, msg = run_cmd([vk_store, spv])
@@ -1042,10 +1053,12 @@ def run_suite(a, work: str) -> int:
1042 else: 1053 else:
1043 results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else 1054 results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else
1044 f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}")) 1055 f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}"))
1045 elif name == "ps_tex": 1056 elif name in ("ps_tex", "ps_imgatomic"):
1046 # A texture through the descriptor hash table and the bindless set. vk_bindless_test compares the 1057 # A texture through the descriptor hash table and the bindless set (ps_tex), or image atomics in a pixel
1047 # pixels itself, and exits 77 where the device lacks a feature the set or the shader needs. 1058 # shader through the set's r32ui storage arrays (ps_imgatomic, drawn with vs_ids). vk_bindless_test
1048 rc, msg = run_cmd([vk_bindless, vs_tri, spv]) 1059 # compares the result itself, and exits 77 where the device lacks a feature the set or shader needs.
1060 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_imgatomic" else vs_tri
1061 rc, msg = run_cmd([vk_bindless, vs, spv])
1049 lines = msg.splitlines() 1062 lines = msg.splitlines()
1050 if rc == 77: 1063 if rc == 77:
1051 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device") 1064 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device")
@@ -1110,6 +1123,8 @@ def run_suite(a, work: str) -> int:
1110 "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header) 1123 "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header)
1111 "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000), 1124 "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000),
1112 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), 1125 "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203),
1126 "ps_scc_logic32": (0x0fff0fff, 0x000f000f, 0xf00ff00f, 0x36),
1127 "ps_scc_logic64": (0x0fff0fff, 0xff000000, 0xff0000ff, 0x16),
1113 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), 1128 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000),
1114 "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64 1129 "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64
1115 # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers) 1130 # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers)
@@ -1168,6 +1183,11 @@ def run_suite(a, work: str) -> int:
1168 with open(raw, "rb") as source: 1183 with open(raw, "rb") as source:
1169 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read()))) 1184 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read())))
1170 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6" 1185 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6"
1186 elif name == "ps_mandelbrot":
1187 with open(raw, "rb") as source:
1188 px = list(struct.iter_unpack("<4I", source.read()))
1189 problem = mandelbrot_problem(px)
1190 ok, detail = not problem, problem or f"{len(px)}/{len(px)} iteration counts match the float32 model"
1171 else: 1191 else:
1172 ok, detail = False, "no checker defined" 1192 ok, detail = False, "no checker defined"
1173 results.append((name, ok, detail)) 1193 results.append((name, ok, detail))