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 14:04:59 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 14:04:59 +0100
commitfa34cc023aaf77e3a89c2848e600b47b1837addf (patch)
tree112ea8115fdf4e2afcb2e0e35bbbbfd3cbda24e9 /scripts/run_gpu_tests.py
parent3c6380c22e5274dd541b529fd004ac0096f4f26c (diff)
parenta0acd33d77babe67a28e398b2936a9f735a50f5d (diff)
Merge remote-tracking branch 'upstream/main' into codex/array-image-query-size
# Conflicts: # tests/test_shader_checks.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 1bb157957..51ba14fb8 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
41 42
42 43
43def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: 44def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes:
@@ -533,6 +534,15 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool,
533 return ok, detail 534 return ok, detail
534 535
535 536
537# Fixtures run by another harness, which needs what these tools do not have (a D3D12 device, the layer's root
538# arguments and code base). They are still assembled and translated here, so a translator regression shows, but no
539# checker runs them: the test program that owns them judges them.
540OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test",
541 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test",
542 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test",
543 "ps_m3_post": "d3d12_m3_frame_test"}
544
545
536# Shaders a selected test draws with, built even when the filter leaves them out (#192). 546# Shaders a selected test draws with, built even when the filter leaves them out (#192).
537DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", 547DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm",
538 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", 548 "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm",
@@ -540,6 +550,7 @@ DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_textur
540 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", 550 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm",
541 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", 551 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm",
542 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm"} 552 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm"}
553DRAWN_WITH.update({name: "vs_ids.asm" for name in GET_LOD_TESTS})
543 554
544 555
545def with_draw_shaders(asm_files: list[str]) -> list[str]: 556def with_draw_shaders(asm_files: list[str]) -> list[str]:
@@ -761,11 +772,29 @@ def run_suite(a, work: str) -> int:
761 elif name == "cs_exec64": 772 elif name == "cs_exec64":
762 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env) 773 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env)
763 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 774 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
764 elif name == "cs_bvh": 775 elif name in ("cs_bvh", "cs_bvh32"): # the 64-bit and the 32-bit node pointer: one scene, the same words
765 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env) 776 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env)
766 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 777 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
778 elif name in STORE_WORDS:
779 # TEST-184: image atomics (cs_imgatomic, cs_imgatomic3d) and image_get_resinfo (cs_resinfo). vk_store_test
780 # binds the images and prints the r32 ones after the dispatch; the expected words are check.py's.
781 rc, msg = run_cmd([vk_store, spv, "words"])
782 if rc == UNSUPPORTED:
783 results.append((name, None, unsupported_skip(msg)))
784 elif rc != 0:
785 results.append((name, False, msg))
786 else:
787 problem = store_words_problem(msg, name)
788 results.append((name, not problem, problem or "all 64 words of the uint image, the sint image and "
789 "the volume exact"))
790 elif name in GET_LOD_TESTS:
791 # TEST-184: image_get_lod on vk_texture_test's two-mip texture (two sampler LOD ranges) and on its 2D array.
792 problem = get_lod_test(a.build, spirv_dir, name)
793 ok = None if isinstance(problem, Skip) else not problem
794 results.append((name, ok, problem or f"4096 pixels in each of {len(GET_LOD_TESTS[name])} draw(s): the "
795 "clamped and the calculated LOD within 1/16"))
767 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", 796 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",
768 "cs_cmpx_class_f32"): 797 "cs_buf_swizzle", "cs_cmpx_class_f32"):
769 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds 798 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds
770 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement. 799 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement.
771 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either. 800 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either.
@@ -782,6 +811,9 @@ def run_suite(a, work: str) -> int:
782 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0], 811 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0],
783 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0], 812 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0],
784 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010], 813 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010],
814 # swizzled MUBUF addressing and ADD_TID_ENABLE (lanes 0 and 1 store; derivation in the .asm header)
815 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED0028, 0, 0xBEEF0000,
816 0xBEEF0001],
785 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 817 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
786 }[name] 818 }[name]
787 words = dump_words(msg) 819 words = dump_words(msg)
@@ -826,7 +858,7 @@ def run_suite(a, work: str) -> int:
826 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 858 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
827 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 859 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
828 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 860 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
829 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", 861 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",
830 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 862 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
831 "cs_dpp_bound", "cs_dpp_w64", 863 "cs_dpp_bound", "cs_dpp_w64",
832 "cs_w64_mask_detect", 864 "cs_w64_mask_detect",
@@ -850,6 +882,10 @@ def run_suite(a, work: str) -> int:
850 # integer ops with CPU-only checks until now (cs_w32_int_ext.asm) 882 # integer ops with CPU-only checks until now (cs_w32_int_ext.asm)
851 "cs_w32_int_ext": [1, 27, 1, 0x33332222, 0xC0000000, 0x4000, 18, 0x20304050], 883 "cs_w32_int_ext": [1, 27, 1, 0x33332222, 0xC0000000, 0x4000, 18, 0x20304050],
852 # 64-bit scalar data ops and v_mad_u64_u32 (cs_w32_salu64.asm) 884 # 64-bit scalar data ops and v_mad_u64_u32 (cs_w32_salu64.asm)
885 # more ops with CPU-only checks until now (cs_w32_misc_ext.asm)
886 # ops merged on 2026-11-22 with CPU-only checks (cs_w32_new_ops.asm)
887 "cs_w32_new_ops": [0x55, 0x8001, 0xC0000000, 0x80014000, 0x4000FFFF, 0x77, 0x99, 0x1234],
888 "cs_w32_misc_ext": [0x0FFF0FFF, 0xE2C4A688, 0x0007FFFF, 0x7FFF8000, 0xFFFE0002, 0xFFFF0005, 0x509, 0xCAFEF00D],
853 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE], 889 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE],
854 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header) 890 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header)
855 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], 891 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234],
@@ -906,8 +942,9 @@ def run_suite(a, work: str) -> int:
906 } 942 }
907 want = cs_dump_wants[name] 943 want = cs_dump_wants[name]
908 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 944 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
909 # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64, the wave32 cs_wqm_w32 / cs_bpermute32 and the DPP 945 # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32
910 # 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 946 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
947 # as check.py does, where the device has none
911 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 948 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
912 # translated with --wave64-emulate and run on any subgroup size. 949 # translated with --wave64-emulate and run on any subgroup size.
913 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for 950 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for
@@ -916,7 +953,8 @@ def run_suite(a, work: str) -> int:
916 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 953 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp")
917 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 954 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
918 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 955 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
919 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_bpermute32", "cs_w32_partial_scmp", 956 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
957 "cs_bpermute32", "cs_w32_partial_scmp",
920 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 958 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
921 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 959 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
922 if partial and not emulated: 960 if partial and not emulated:
@@ -1019,11 +1057,13 @@ def run_suite(a, work: str) -> int:
1019 with open(raw, "rb") as f: 1057 with open(raw, "rb") as f:
1020 problem, covered = texoff_problem(f.read(), msg) 1058 problem, covered = texoff_problem(f.read(), msg)
1021 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})")) 1059 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})"))
1060 elif name in OTHER_HARNESS:
1061 results.append((name, None, f"SKIP (run by {OTHER_HARNESS[name]})"))
1022 elif name.startswith("ps_"): 1062 elif name.startswith("ps_"):
1023 raw = os.path.join(raw_dir, f"{name}.raw") 1063 raw = os.path.join(raw_dir, f"{name}.raw")
1024 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1064 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
1025 if name in PIXEL_VERTEX: 1065 if name in PIXEL_VERTEX:
1026 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback 1066 if bary_fallback() and name in ("ps_interp_f16_high", "ps_ij_computed"): # no PerVertexKHR inputs
1027 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1067 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1028 continue 1068 continue
1029 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1069 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -1083,7 +1123,10 @@ def run_suite(a, work: str) -> int:
1083 "ps_valu16_subrev": (0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800), 1123 "ps_valu16_subrev": (0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800),
1084 } 1124 }
1085 if name in const_wants: 1125 if name in const_wants:
1086 ok, detail = check_pixel_const(raw, const_wants[name]) 1126 if name == "ps_vcmpx_forms" and (skip := vcmpx_forms_narrow_skip(msg)):
1127 ok, detail = None, str(skip)
1128 else:
1129 ok, detail = check_pixel_const(raw, const_wants[name])
1087 elif name == "ps_bary": 1130 elif name == "ps_bary":
1088 ok, detail = check_bary(raw) 1131 ok, detail = check_bary(raw)
1089 elif name == "ps_bitmask_perm": 1132 elif name == "ps_bitmask_perm":
@@ -1102,6 +1145,10 @@ def run_suite(a, work: str) -> int:
1102 with open(raw, "rb") as source: 1145 with open(raw, "rb") as source:
1103 problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read()))) 1146 problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read())))
1104 ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3" 1147 ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3"
1148 elif name == "ps_ij_computed":
1149 with open(raw, "rb") as source:
1150 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read())))
1151 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6"
1105 else: 1152 else:
1106 ok, detail = False, "no checker defined" 1153 ok, detail = False, "no checker defined"
1107 results.append((name, ok, detail)) 1154 results.append((name, ok, detail))