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:
authorAlxcBTW <187763517+AlxcBTW@users.noreply.github.com>2026-11-22 14:19:31 +0100
committerAlxcBTW <187763517+AlxcBTW@users.noreply.github.com>2026-11-22 14:19:31 +0100
commit44288b30335c523d4d7a1bb06f935c95fb7e7b05 (patch)
treedb2d2b402b50304d4e4b35543757791a939faff2 /scripts/run_gpu_tests.py
parent420a0654e01d72dbe3f6e4bf6f47b344c3794446 (diff)
parenta0acd33d77babe67a28e398b2936a9f735a50f5d (diff)
Merge remote-tracking branch 'origin/main' into w-pso4
# Conflicts: # runtime/shims/d3d12_vulkan_device.cpp # runtime/test/shaders/check.py # runtime/test/vk_test_device.h # scripts/run_gpu_tests.py
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py67
1 files changed, 57 insertions, 10 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 7a10a69b8..101e74354 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -36,8 +36,9 @@ from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: tex
36from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) 36from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT)
37from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS 37from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS
38from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, 38from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip,
39 wave32_lane_skip) # as in check.py 39 vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py
40from check import PIXEL_VERTEX, interp_f16_high_problem # ps_interp_f16_high's producers and check 40from check import PIXEL_VERTEX, interp_f16_high_problem, ij_computed_problem # pixel producers and checks
41from check import GET_LOD_TESTS, STORE_WORDS, get_lod_test, store_words_problem # TEST-184: image atomics and queries
41from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide 42from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide
42 43
43 44
@@ -534,6 +535,15 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool,
534 return ok, detail 535 return ok, detail
535 536
536 537
538# Fixtures run by another harness, which needs what these tools do not have (a D3D12 device, the layer's root
539# arguments and code base). They are still assembled and translated here, so a translator regression shows, but no
540# checker runs them: the test program that owns them judges them.
541OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test",
542 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test",
543 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test",
544 "ps_m3_post": "d3d12_m3_frame_test"}
545
546
537# Shaders a selected test draws with, built even when the filter leaves them out (#192). 547# Shaders a selected test draws with, built even when the filter leaves them out (#192).
538DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", 548DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm",
539 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", 549 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm",
@@ -541,6 +551,7 @@ DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_textur
541 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", 551 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm",
542 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", 552 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm",
543 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm"} 553 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm"}
554DRAWN_WITH.update({name: "vs_ids.asm" for name in GET_LOD_TESTS})
544 555
545 556
546def with_draw_shaders(asm_files: list[str]) -> list[str]: 557def with_draw_shaders(asm_files: list[str]) -> list[str]:
@@ -762,11 +773,29 @@ def run_suite(a, work: str) -> int:
762 elif name == "cs_exec64": 773 elif name == "cs_exec64":
763 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env) 774 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env)
764 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 775 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
765 elif name == "cs_bvh": 776 elif name in ("cs_bvh", "cs_bvh32"): # the 64-bit and the 32-bit node pointer: one scene, the same words
766 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env) 777 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env)
767 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 778 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
779 elif name in STORE_WORDS:
780 # TEST-184: image atomics (cs_imgatomic, cs_imgatomic3d) and image_get_resinfo (cs_resinfo). vk_store_test
781 # binds the images and prints the r32 ones after the dispatch; the expected words are check.py's.
782 rc, msg = run_cmd([vk_store, spv, "words"])
783 if rc == UNSUPPORTED:
784 results.append((name, None, unsupported_skip(msg)))
785 elif rc != 0:
786 results.append((name, False, msg))
787 else:
788 problem = store_words_problem(msg, name)
789 results.append((name, not problem, problem or "all 64 words of the uint image, the sint image and "
790 "the volume exact"))
791 elif name in GET_LOD_TESTS:
792 # TEST-184: image_get_lod on vk_texture_test's two-mip texture (two sampler LOD ranges) and on its 2D array.
793 problem = get_lod_test(a.build, spirv_dir, name)
794 ok = None if isinstance(problem, Skip) else not problem
795 results.append((name, ok, problem or f"4096 pixels in each of {len(GET_LOD_TESTS[name])} draw(s): the "
796 "clamped and the calculated LOD within 1/16"))
768 elif name in ("cs_bounds", "cs_smem_bounds", "cs_smem_stride_align", "cs_smem_sload_neg", "cs_buf_tail", "cs_oob_select", "cs_oob_tail", 797 elif name in ("cs_bounds", "cs_smem_bounds", "cs_smem_stride_align", "cs_smem_sload_neg", "cs_buf_tail", "cs_oob_select", "cs_oob_tail",
769 "cs_cmpx_class_f32"): 798 "cs_buf_swizzle", "cs_cmpx_class_f32"):
770 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds 799 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds
771 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement. 800 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement.
772 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either. 801 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either.
@@ -783,6 +812,9 @@ def run_suite(a, work: str) -> int:
783 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0], 812 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0],
784 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0], 813 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0],
785 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010], 814 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010],
815 # swizzled MUBUF addressing and ADD_TID_ENABLE (lanes 0 and 1 store; derivation in the .asm header)
816 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED0028, 0, 0xBEEF0000,
817 0xBEEF0001],
786 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 818 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
787 }[name] 819 }[name]
788 words = dump_words(msg) 820 words = dump_words(msg)
@@ -827,7 +859,7 @@ def run_suite(a, work: str) -> int:
827 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 859 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
828 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 860 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
829 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 861 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
830 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_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", 862 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",
831 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 863 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
832 "cs_dpp_bound", "cs_dpp_w64", 864 "cs_dpp_bound", "cs_dpp_w64",
833 "cs_w64_mask_detect", 865 "cs_w64_mask_detect",
@@ -851,6 +883,10 @@ def run_suite(a, work: str) -> int:
851 # integer ops with CPU-only checks until now (cs_w32_int_ext.asm) 883 # integer ops with CPU-only checks until now (cs_w32_int_ext.asm)
852 "cs_w32_int_ext": [1, 27, 1, 0x33332222, 0xC0000000, 0x4000, 18, 0x20304050], 884 "cs_w32_int_ext": [1, 27, 1, 0x33332222, 0xC0000000, 0x4000, 18, 0x20304050],
853 # 64-bit scalar data ops and v_mad_u64_u32 (cs_w32_salu64.asm) 885 # 64-bit scalar data ops and v_mad_u64_u32 (cs_w32_salu64.asm)
886 # more ops with CPU-only checks until now (cs_w32_misc_ext.asm)
887 # ops merged on 2026-11-22 with CPU-only checks (cs_w32_new_ops.asm)
888 "cs_w32_new_ops": [0x55, 0x8001, 0xC0000000, 0x80014000, 0x4000FFFF, 0x77, 0x99, 0x1234],
889 "cs_w32_misc_ext": [0x0FFF0FFF, 0xE2C4A688, 0x0007FFFF, 0x7FFF8000, 0xFFFE0002, 0xFFFF0005, 0x509, 0xCAFEF00D],
854 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE], 890 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE],
855 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header) 891 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header)
856 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], 892 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234],
@@ -907,8 +943,9 @@ def run_suite(a, work: str) -> int:
907 } 943 }
908 want = cs_dump_wants[name] 944 want = cs_dump_wants[name]
909 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 945 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
910 # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64, the wave32 cs_wqm_w32 / cs_bpermute32 and the DPP 946 # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32
911 # tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, as check.py does, where the device has none 947 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
948 # as check.py does, where the device has none
912 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 949 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
913 # translated with --wave64-emulate and run on any subgroup size. 950 # translated with --wave64-emulate and run on any subgroup size.
914 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for 951 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for
@@ -917,7 +954,8 @@ def run_suite(a, work: str) -> int:
917 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 954 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp")
918 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 955 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
919 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 956 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
920 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_bpermute32", "cs_w32_partial_scmp", 957 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
958 "cs_bpermute32", "cs_w32_partial_scmp",
921 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 959 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
922 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 960 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
923 if partial and not emulated: 961 if partial and not emulated:
@@ -1020,11 +1058,13 @@ def run_suite(a, work: str) -> int:
1020 with open(raw, "rb") as f: 1058 with open(raw, "rb") as f:
1021 problem, covered = texoff_problem(f.read(), msg) 1059 problem, covered = texoff_problem(f.read(), msg)
1022 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})")) 1060 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})"))
1061 elif name in OTHER_HARNESS:
1062 results.append((name, None, f"SKIP (run by {OTHER_HARNESS[name]})"))
1023 elif name.startswith("ps_"): 1063 elif name.startswith("ps_"):
1024 raw = os.path.join(raw_dir, f"{name}.raw") 1064 raw = os.path.join(raw_dir, f"{name}.raw")
1025 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1065 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
1026 if name in PIXEL_VERTEX: 1066 if name in PIXEL_VERTEX:
1027 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback 1067 if bary_fallback() and name in ("ps_interp_f16_high", "ps_ij_computed"): # no PerVertexKHR inputs
1028 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1068 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1029 continue 1069 continue
1030 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1070 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -1088,7 +1128,10 @@ def run_suite(a, work: str) -> int:
1088 results.append((name, None, str(skip))) 1128 results.append((name, None, str(skip)))
1089 continue 1129 continue
1090 if name in const_wants: 1130 if name in const_wants:
1091 ok, detail = check_pixel_const(raw, const_wants[name]) 1131 if name == "ps_vcmpx_forms" and (skip := vcmpx_forms_narrow_skip(msg)):
1132 ok, detail = None, str(skip)
1133 else:
1134 ok, detail = check_pixel_const(raw, const_wants[name])
1092 elif name == "ps_bary": 1135 elif name == "ps_bary":
1093 ok, detail = check_bary(raw) 1136 ok, detail = check_bary(raw)
1094 elif name == "ps_bitmask_perm": 1137 elif name == "ps_bitmask_perm":
@@ -1107,6 +1150,10 @@ def run_suite(a, work: str) -> int:
1107 with open(raw, "rb") as source: 1150 with open(raw, "rb") as source:
1108 problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read()))) 1151 problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read())))
1109 ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3" 1152 ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3"
1153 elif name == "ps_ij_computed":
1154 with open(raw, "rb") as source:
1155 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read())))
1156 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6"
1110 else: 1157 else:
1111 ok, detail = False, "no checker defined" 1158 ok, detail = False, "no checker defined"
1112 results.append((name, ok, detail)) 1159 results.append((name, ok, detail))