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:05:00 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 14:05:00 +0100
commit0a1b235854aa114fe6b88773883bfc0b6aed03da (patch)
tree144e38bd4998e0a90db4a738a0d625f70d0acf43 /scripts/run_gpu_tests.py
parente5f9661dac4575a841c91852b38fc95c70af950f (diff)
parenta0acd33d77babe67a28e398b2936a9f735a50f5d (diff)
Merge remote-tracking branch 'upstream/main' into codex/implicit-typed-mips
# Conflicts: # 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 42ac4c232..5ccd2d40f 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -37,8 +37,9 @@ from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: tex
37from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) 37from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT)
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 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 # ps_interp_f16_high's producers and check 41from check import PIXEL_VERTEX, 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
42 43
43 44
44def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: 45def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes:
@@ -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",
@@ -542,6 +552,7 @@ DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_textur
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",
544 SIGNED_MIP_TEST: "vs_ids.asm"} 554 SIGNED_MIP_TEST: "vs_ids.asm"}
555DRAWN_WITH.update({name: "vs_ids.asm" for name in GET_LOD_TESTS})
545 556
546 557
547def with_draw_shaders(asm_files: list[str]) -> list[str]: 558def with_draw_shaders(asm_files: list[str]) -> list[str]:
@@ -763,11 +774,29 @@ def run_suite(a, work: str) -> int:
763 elif name == "cs_exec64": 774 elif name == "cs_exec64":
764 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env) 775 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env)
765 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 776 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
766 elif name == "cs_bvh": 777 elif name in ("cs_bvh", "cs_bvh32"): # the 64-bit and the 32-bit node pointer: one scene, the same words
767 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env) 778 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env)
768 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 779 results.append((name, rc == 0, msg.splitlines()[-1] if msg else ""))
780 elif name in STORE_WORDS:
781 # TEST-184: image atomics (cs_imgatomic, cs_imgatomic3d) and image_get_resinfo (cs_resinfo). vk_store_test
782 # binds the images and prints the r32 ones after the dispatch; the expected words are check.py's.
783 rc, msg = run_cmd([vk_store, spv, "words"])
784 if rc == UNSUPPORTED:
785 results.append((name, None, unsupported_skip(msg)))
786 elif rc != 0:
787 results.append((name, False, msg))
788 else:
789 problem = store_words_problem(msg, name)
790 results.append((name, not problem, problem or "all 64 words of the uint image, the sint image and "
791 "the volume exact"))
792 elif name in GET_LOD_TESTS:
793 # TEST-184: image_get_lod on vk_texture_test's two-mip texture (two sampler LOD ranges) and on its 2D array.
794 problem = get_lod_test(a.build, spirv_dir, name)
795 ok = None if isinstance(problem, Skip) else not problem
796 results.append((name, ok, problem or f"4096 pixels in each of {len(GET_LOD_TESTS[name])} draw(s): the "
797 "clamped and the calculated LOD within 1/16"))
769 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", 798 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",
770 "cs_cmpx_class_f32"): 799 "cs_buf_swizzle", "cs_cmpx_class_f32"):
771 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds 800 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds
772 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement. 801 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement.
773 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either. 802 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either.
@@ -784,6 +813,9 @@ def run_suite(a, work: str) -> int:
784 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0], 813 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0],
785 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0], 814 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0],
786 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010], 815 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010],
816 # swizzled MUBUF addressing and ADD_TID_ENABLE (lanes 0 and 1 store; derivation in the .asm header)
817 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED0028, 0, 0xBEEF0000,
818 0xBEEF0001],
787 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 819 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
788 }[name] 820 }[name]
789 words = dump_words(msg) 821 words = dump_words(msg)
@@ -828,7 +860,7 @@ def run_suite(a, work: str) -> int:
828 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 860 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
829 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 861 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
830 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 862 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
831 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", 863 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",
832 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 864 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
833 "cs_dpp_bound", "cs_dpp_w64", 865 "cs_dpp_bound", "cs_dpp_w64",
834 "cs_w64_mask_detect", 866 "cs_w64_mask_detect",
@@ -852,6 +884,10 @@ def run_suite(a, work: str) -> int:
852 # integer ops with CPU-only checks until now (cs_w32_int_ext.asm) 884 # integer ops with CPU-only checks until now (cs_w32_int_ext.asm)
853 "cs_w32_int_ext": [1, 27, 1, 0x33332222, 0xC0000000, 0x4000, 18, 0x20304050], 885 "cs_w32_int_ext": [1, 27, 1, 0x33332222, 0xC0000000, 0x4000, 18, 0x20304050],
854 # 64-bit scalar data ops and v_mad_u64_u32 (cs_w32_salu64.asm) 886 # 64-bit scalar data ops and v_mad_u64_u32 (cs_w32_salu64.asm)
887 # more ops with CPU-only checks until now (cs_w32_misc_ext.asm)
888 # ops merged on 2026-11-22 with CPU-only checks (cs_w32_new_ops.asm)
889 "cs_w32_new_ops": [0x55, 0x8001, 0xC0000000, 0x80014000, 0x4000FFFF, 0x77, 0x99, 0x1234],
890 "cs_w32_misc_ext": [0x0FFF0FFF, 0xE2C4A688, 0x0007FFFF, 0x7FFF8000, 0xFFFE0002, 0xFFFF0005, 0x509, 0xCAFEF00D],
855 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE], 891 "cs_w32_salu64": [0x1E6A2C48, 0x1234, 0xFFFFFFFF, 0x100, 47, 48, 0xFFFF8000, 0xFFFFFFFE],
856 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header) 892 # SHADER-85: ds_read_u8/i8_d16[_hi] (cs_w32_lds_u8_d16.asm header)
857 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], 893 "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234],
@@ -908,8 +944,9 @@ def run_suite(a, work: str) -> int:
908 } 944 }
909 want = cs_dump_wants[name] 945 want = cs_dump_wants[name]
910 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 946 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
911 # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64, the wave32 cs_wqm_w32 / cs_bpermute32 and the DPP 947 # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32
912 # 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 948 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
949 # as check.py does, where the device has none
913 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 950 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
914 # translated with --wave64-emulate and run on any subgroup size. 951 # translated with --wave64-emulate and run on any subgroup size.
915 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for 952 # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for
@@ -918,7 +955,8 @@ def run_suite(a, work: str) -> int:
918 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 955 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp")
919 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 956 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
920 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 957 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
921 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_bpermute32", "cs_w32_partial_scmp", 958 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
959 "cs_bpermute32", "cs_w32_partial_scmp",
922 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 960 "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
923 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 961 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
924 if partial and not emulated: 962 if partial and not emulated:
@@ -1021,11 +1059,13 @@ def run_suite(a, work: str) -> int:
1021 with open(raw, "rb") as f: 1059 with open(raw, "rb") as f:
1022 problem, covered = texoff_problem(f.read(), msg) 1060 problem, covered = texoff_problem(f.read(), msg)
1023 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})")) 1061 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})"))
1062 elif name in OTHER_HARNESS:
1063 results.append((name, None, f"SKIP (run by {OTHER_HARNESS[name]})"))
1024 elif name.startswith("ps_"): 1064 elif name.startswith("ps_"):
1025 raw = os.path.join(raw_dir, f"{name}.raw") 1065 raw = os.path.join(raw_dir, f"{name}.raw")
1026 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1066 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
1027 if name in PIXEL_VERTEX: 1067 if name in PIXEL_VERTEX:
1028 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback 1068 if bary_fallback() and name in ("ps_interp_f16_high", "ps_ij_computed"): # no PerVertexKHR inputs
1029 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1069 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1030 continue 1070 continue
1031 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1071 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -1085,7 +1125,10 @@ def run_suite(a, work: str) -> int:
1085 "ps_valu16_subrev": (0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800), 1125 "ps_valu16_subrev": (0xAAAABC00, 0xAAAAC000, 0xAAAA3C00, 0x42003800),
1086 } 1126 }
1087 if name in const_wants: 1127 if name in const_wants:
1088 ok, detail = check_pixel_const(raw, const_wants[name]) 1128 if name == "ps_vcmpx_forms" and (skip := vcmpx_forms_narrow_skip(msg)):
1129 ok, detail = None, str(skip)
1130 else:
1131 ok, detail = check_pixel_const(raw, const_wants[name])
1089 elif name == "ps_bary": 1132 elif name == "ps_bary":
1090 ok, detail = check_bary(raw) 1133 ok, detail = check_bary(raw)
1091 elif name == "ps_bitmask_perm": 1134 elif name == "ps_bitmask_perm":
@@ -1104,6 +1147,10 @@ def run_suite(a, work: str) -> int:
1104 with open(raw, "rb") as source: 1147 with open(raw, "rb") as source:
1105 problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read()))) 1148 problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read())))
1106 ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3" 1149 ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3"
1150 elif name == "ps_ij_computed":
1151 with open(raw, "rb") as source:
1152 problem = ij_computed_problem(list(struct.iter_unpack("<4I", source.read())))
1153 ok, detail = not problem, problem or "computed I/J pair words and v/2 within 1e-6"
1107 else: 1154 else:
1108 ok, detail = False, "no checker defined" 1155 ok, detail = False, "no checker defined"
1109 results.append((name, ok, detail)) 1156 results.append((name, ok, detail))