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 20:27:12 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 20:27:12 +0100
commit3eb80d77e384a8c51bb58076dc881d7d291f8001 (patch)
treeeb76604305dca9a75845c36bdbbe8fe066051fe1 /scripts/run_gpu_tests.py
parentb87dc1e9af21b11375c29dfa1046232eccbed2db (diff)
parent162821017ea3c286c8bec860f3ff94f037912061 (diff)
Merge main into cov-d16fmt (#2039)
Conflicts: scripts/run_gpu_tests.py tests/semantic/regen_fixtures.py tests/test_shader_checks.py AI-assisted.
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py89
1 files changed, 54 insertions, 35 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 20feab39c..eb2850470 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -1,7 +1,7 @@
1"""Assemble, translate, and run the synthetic RDNA2->SPIR-V GPU test suite on Vulkan. 1"""Assemble, translate, and run the synthetic RDNA2->SPIR-V GPU test suite on Vulkan.
2 2
3Usage: 3Usage:
4 python -I scripts/run_gpu_tests.py [--llvm-mc CMD] [--build DIR] [--work DIR] [--filter SUBSTR] 4 python -I scripts/run_gpu_tests.py [--llvm-mc CMD] [--build DIR] [--work DIR] [--filter SUBSTR] [--require-pass]
5 5
6--llvm-mc (or LLVM_MC) is a path or a whole command, e.g. "wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc". 6--llvm-mc (or LLVM_MC) is a path or a whole command, e.g. "wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc".
7""" 7"""
@@ -25,14 +25,15 @@ 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_d16_xyz_test, fmt_sint32_test, fmt_xy_xyz_test, 28from check import (Skip, clip_test, fmt_1010102_test, fmt_d16_xyz_test, fmt_int_narrow_test, fmt_sint32_test,
29 tbuffer_store_test) 29 fmt_xy_xyz_test, tbuffer_store_test)
30from compute_fixture import compute_header 30from compute_fixture import compute_header
31from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test) 31from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test)
32from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, 32from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, CVT_PK_U8_WORDS, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES,
33 TEXTURE_MIP_TEST, GATHER_LOD_TEST, MIP_TEST_PASSES, TEXTURE_CONSTANTS, USER_SGPRS_ENV, USER_SGPRS_WORDS, Skip, mesh_v5_test, not_found_message, 33 TEXTURE_MIP_TEST, GATHER_LOD_TEST, MIP_TEST_PASSES, TEXTURE_CONSTANTS, USER_SGPRS_ENV, USER_SGPRS_WORDS, Skip, mesh_v5_test, not_found_message,
34 pick_build_dir, start_failure, texture_gradient_a16_test, texture_mip_test) 34 pick_build_dir, start_failure, texture_gradient_a16_test, texture_mip_test)
35from check import SIGNED_MIP_TEST 35from check import SIGNED_MIP_TEST
36from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan)
36from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py 37from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py
37from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 38from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8
38from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) 39from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT)
@@ -239,12 +240,13 @@ def unsupported_skip(msg: str) -> str:
239 return f"SKIP ({m.group(0) if m else 'unsupported device'})" 240 return f"SKIP ({m.group(0) if m else 'unsupported device'})"
240 241
241 242
242def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True) -> tuple[int, str]: 243def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True, *,
244 cwd: str | None = None) -> tuple[int, str]:
243 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT). 245 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT).
244 # gpu=False (the translator over the whole suite) runs without a limit. 246 # gpu=False (the translator over the whole suite) runs without a limit.
245 limit = gpu_test_timeout() if gpu else None 247 limit = gpu_test_timeout() if gpu else None
246 try: 248 try:
247 p = subprocess.run(cmd, capture_output=True, text=True, env=env, timeout=limit) 249 p = subprocess.run(cmd, capture_output=True, text=True, env=env, timeout=limit, cwd=cwd)
248 except subprocess.TimeoutExpired: 250 except subprocess.TimeoutExpired:
249 return 1, timed_out(cmd[0], limit) 251 return 1, timed_out(cmd[0], limit)
250 except OSError as e: # e.g. Smart App Control blocked a fresh build: fail this test, keep running the others 252 except OSError as e: # e.g. Smart App Control blocked a fresh build: fail this test, keep running the others
@@ -326,7 +328,7 @@ def judge_cs_dump(rc: int, msg: str, want: list[int], *, wave64: bool, partial:
326 if rc != 0 or words is None: 328 if rc != 0 or words is None:
327 return False, msg 329 return False, msg
328 vals = words[:len(want)] 330 vals = words[:len(want)]
329 return vals == want, " ".join((hex if hexwords else str)(x) for x in vals) 331 return words_match(vals, want), " ".join((hex if hexwords else str)(x) for x in vals)
330 332
331 333
332def check_pixel_const(raw_path: str, want: tuple[int, int, int, int]) -> tuple[bool, str]: 334def check_pixel_const(raw_path: str, want: tuple[int, int, int, int]) -> tuple[bool, str]:
@@ -542,8 +544,9 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool,
542# checker runs them: the test program that owns them judges them. 544# checker runs them: the test program that owns them judges them.
543OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test", 545OTHER_HARNESS = {"ps_m15": "d3d12_translated_draw_test", "vs_m15": "d3d12_translated_draw_test",
544 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test", 546 "ps_m2": "d3d12_m2_textured_test", "vs_m2": "d3d12_m2_textured_test", "ps_m2_uoff": "d3d12_m2_textured_test",
547 "ps_m2_array": "d3d12_m2_formats_test",
545 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test", 548 "ps_m3": "d3d12_m3_frame_test", "vs_m3": "d3d12_m3_frame_test",
546 "ps_m3_post": "d3d12_m3_frame_test", 549 "ps_m3_post": "d3d12_m3_frame_test", "ps_m3_query": "d3d12_m3_frame_test",
547 "cs_m4_fill": "d3d12_m4_compute_test", "cs_m4_indirect": "d3d12_m4_compute_test", 550 "cs_m4_fill": "d3d12_m4_compute_test", "cs_m4_indirect": "d3d12_m4_compute_test",
548 "cs_buf_typed": "d3d12_buffer_uav_test", "cs_buf_counter": "d3d12_buffer_uav_test"} 551 "cs_buf_typed": "d3d12_buffer_uav_test", "cs_buf_counter": "d3d12_buffer_uav_test"}
549 552
@@ -599,6 +602,7 @@ def main() -> int:
599 "subfolder that has the test programs is found by itself") 602 "subfolder that has the test programs is found by itself")
600 ap.add_argument("--work", default=None) 603 ap.add_argument("--work", default=None)
601 ap.add_argument("--filter", default="") 604 ap.add_argument("--filter", default="")
605 ap.add_argument("--require-pass", action="store_true", help="exit 1 if no GPU test passes")
602 a = ap.parse_args() 606 a = ap.parse_args()
603 # Some test programs run with their working directory in <work>/spirv (vk_texture_test), so a relative path 607 # Some test programs run with their working directory in <work>/spirv (vk_texture_test), so a relative path
604 # given here would point somewhere else for them. 608 # given here would point somewhere else for them.
@@ -806,10 +810,10 @@ def run_suite(a, work: str) -> int:
806 results.append((name, ok, problem or f"4096 pixels in each of {len(GET_LOD_TESTS[name])} draw(s): the " 810 results.append((name, ok, problem or f"4096 pixels in each of {len(GET_LOD_TESTS[name])} draw(s): the "
807 "clamped and the calculated LOD within 1/16")) 811 "clamped and the calculated LOD within 1/16"))
808 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", 812 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",
809 "cs_buf_swizzle", "cs_cmpx_class_f32"): 813 "cs_buf_swizzle", "cs_cmpx_class_f32", "cs_cvt_pk_u8"):
810 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds 814 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds
811 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement. 815 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement.
812 # cs_cmpx_class_f32 is per-lane and needs no particular subgroup width either. 816 # cs_cmpx_class_f32 and cs_cvt_pk_u8 are per-lane and need no particular subgroup width either.
813 # The other four pin the SMEM and raw MUBUF rules measured on an RX 6800 (derivations in each .asm). 817 # The other four pin the SMEM and raw MUBUF rules measured on an RX 6800 (derivations in each .asm).
814 rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=cs_env) 818 rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=cs_env)
815 want = { 819 want = {
@@ -823,10 +827,11 @@ def run_suite(a, work: str) -> int:
823 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0], 827 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0],
824 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0], 828 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0],
825 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010], 829 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010],
826 # swizzled MUBUF addressing and ADD_TID_ENABLE (lanes 0 and 1 store; derivation in the .asm header) 830 # swizzled MUBUF addressing (measured natively on gfx1036) and ADD_TID_ENABLE (lanes 0 and 1 store)
827 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED0028, 0, 0xBEEF0000, 831 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED000C, 0, 0xBEEF0000,
828 0xBEEF0001], 832 0xBEEF0001],
829 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 833 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
834 "cs_cvt_pk_u8": CVT_PK_U8_WORDS,
830 }[name] 835 }[name]
831 words = dump_words(msg) 836 words = dump_words(msg)
832 vals = words[:len(want)] if words else [] 837 vals = words[:len(want)] if words else []
@@ -838,6 +843,9 @@ def run_suite(a, work: str) -> int:
838 elif name == "cs_fmt_sint32": 843 elif name == "cs_fmt_sint32":
839 problem = fmt_sint32_test(a.build, spirv_dir, cs_env) 844 problem = fmt_sint32_test(a.build, spirv_dir, cs_env)
840 results.append((name, not problem, problem or "64/64 dumped words exact")) 845 results.append((name, not problem, problem or "64/64 dumped words exact"))
846 elif name == "cs_fmt_int_narrow":
847 problem = fmt_int_narrow_test(a.build, spirv_dir, cs_env)
848 results.append((name, not problem, problem or "136/136 dumped words exact"))
841 elif name == "cs_fmt_xy_xyz": 849 elif name == "cs_fmt_xy_xyz":
842 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) 850 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header)
843 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) 851 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env)
@@ -845,11 +853,11 @@ def run_suite(a, work: str) -> int:
845 elif name == "cs_tbuffer_store": 853 elif name == "cs_tbuffer_store":
846 # tbuffer_store_format_*: the instruction's format, words measured natively on a Radeon 680M (the .asm header) 854 # tbuffer_store_format_*: the instruction's format, words measured natively on a Radeon 680M (the .asm header)
847 problem = tbuffer_store_test(a.build, spirv_dir, cs_env) 855 problem = tbuffer_store_test(a.build, spirv_dir, cs_env)
848 results.append((name, not problem, problem or "128/128 dumped words exact"))
849 elif name == "cs_fmt_d16_xyz": 856 elif name == "cs_fmt_d16_xyz":
850 # d16_xyz / d16_xy typed-buffer loads and d16_xyz stores (cs_fmt_d16_xyz.asm header) 857 # d16_xyz / d16_xy typed-buffer loads and d16_xyz stores (cs_fmt_d16_xyz.asm header)
851 problem = fmt_d16_xyz_test(a.build, spirv_dir, cs_env) 858 problem = fmt_d16_xyz_test(a.build, spirv_dir, cs_env)
852 results.append((name, not problem, problem or "80/80 dumped words exact")) 859 results.append((name, not problem, problem or "80/80 dumped words exact"))
860 results.append((name, not problem, problem or "128/128 dumped words exact"))
853 elif name == "cs_global_neg_offset": 861 elif name == "cs_global_neg_offset":
854 # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte 862 # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte
855 # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement. 863 # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement.
@@ -881,7 +889,7 @@ def run_suite(a, work: str) -> int:
881 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 889 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
882 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 890 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
883 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 891 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
884 elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_w32_sincos", "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", 892 elif name in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_w32_sincos", "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",
885 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 893 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
886 "cs_dpp_bound", "cs_dpp_w64", 894 "cs_dpp_bound", "cs_dpp_w64",
887 "cs_w64_mask_detect", 895 "cs_w64_mask_detect",
@@ -890,7 +898,8 @@ def run_suite(a, work: str) -> int:
890 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", 898 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load",
891 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", 899 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent",
892 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", 900 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end",
893 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst"): 901 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst",
902 "cs_mask_vgpr_exec"):
894 cs_dump_wants = { 903 cs_dump_wants = {
895 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], 904 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000],
896 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone 905 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone
@@ -929,6 +938,9 @@ def run_suite(a, work: str) -> int:
929 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], 938 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7],
930 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], 939 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777],
931 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], 940 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6],
941 # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7]
942 # without it
943 "cs_signed_zero_nan": [0x80000000, 0x80000000, 0x80008000, 0x00008000, 1, 1, 1, 0x00007C00],
932 "cs_wave64_ballot": [32, 16, 24, 40, 8, 48], 944 "cs_wave64_ballot": [32, 16, 24, 40, 8, 48],
933 "cs_wm_half_ops": [32, 16, 16, 0, 16], 945 "cs_wm_half_ops": [32, 16, 16, 0, 16],
934 "cs_wm_half_cmp": [1, 0, 1, 1], 946 "cs_wm_half_cmp": [1, 0, 1, 1],
@@ -967,10 +979,14 @@ def run_suite(a, work: str) -> int:
967 # differs per wave (cs_barrier_loop.asm) 979 # differs per wave (cs_barrier_loop.asm)
968 "cs_barrier_early_end": [127, 126, 125, 124, 123, 122, 121, 120], 980 "cs_barrier_early_end": [127, 126, 125, 124, 123, 122, 121, 120],
969 "cs_barrier_loop": [128, 96, 64, 32, 128, 96, 64, 0xEEEEEEEE], 981 "cs_barrier_loop": [128, 96, 64, 32, 128, 96, 64, 0xEEEEEEEE],
982 # SHADER-21 part 2: a mask copied to a VGPR with v_mov_b32 respects EXEC —
983 # inactive lanes keep the old VGPR (cs_mask_vgpr_exec.asm)
984 "cs_mask_vgpr_exec": [0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
985 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF],
970 } 986 }
971 want = cs_dump_wants[name] 987 want = cs_dump_wants[name]
972 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 988 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
973 # cs_w32_lds_u8_d16 / cs_w32_sincos / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32 989 # cs_w32_lds_u8_d16 / cs_w32_sincos / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops / cs_signed_zero_nan, the wave32
974 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, 990 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
975 # as check.py does, where the device has none 991 # as check.py does, where the device has none
976 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 992 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
@@ -979,11 +995,11 @@ def run_suite(a, work: str) -> int:
979 # size 64 without them. 995 # size 64 without them.
980 emulated = w64_emulated() 996 emulated = w64_emulated()
981 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 997 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp")
982 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 998 wave64 = name not in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
983 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 999 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
984 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 1000 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
985 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", 1001 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos",
986 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", 1002 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec",
987 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 1003 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
988 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 1004 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
989 if partial and not emulated: 1005 if partial and not emulated:
@@ -995,9 +1011,13 @@ def run_suite(a, work: str) -> int:
995 if skip: # e.g. Mesa llvmpipe's 8-wide subgroups: these 32-lane masks can't come out right 1011 if skip: # e.g. Mesa llvmpipe's 8-wide subgroups: these 32-lane masks can't come out right
996 ok, detail = None, str(skip) 1012 ok, detail = None, str(skip)
997 else: 1013 else:
1014 want = judged_words(name, msg, want) # cs_signed_zero_nan on Apple and llvmpipe (check.py)
998 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, 1015 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated,
999 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16", 1016 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16",
1000 "cs_lds_b64_cmpst")) 1017 "cs_lds_b64_cmpst", "cs_signed_zero_nan"))
1018 if ok and None in want:
1019 unjudged = ", ".join(str(i) for i, w in enumerate(want) if w is None)
1020 detail += f" (words {unjudged} not judged on this device: UNJUDGED_WORDS in check.py)"
1001 results.append((name, ok, detail)) 1021 results.append((name, ok, detail))
1002 elif name == "cs_imgstore": 1022 elif name == "cs_imgstore":
1003 rc, msg = run_cmd([vk_store, spv]) 1023 rc, msg = run_cmd([vk_store, spv])
@@ -1025,13 +1045,7 @@ def run_suite(a, work: str) -> int:
1025 mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"], 1045 mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"],
1026 "ps_sample_c_lz_a16": ["dref_a16"]}.get(name, []) 1046 "ps_sample_c_lz_a16": ["dref_a16"]}.get(name, [])
1027 cmd = [tool, *mode, raw] 1047 cmd = [tool, *mode, raw]
1028 try: 1048 rc, msg = run_cmd(cmd, cwd=spirv_dir)
1029 p = subprocess.run(cmd, capture_output=True, text=True, cwd=spirv_dir)
1030 rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
1031 except FileNotFoundError:
1032 rc, msg = 1, f"missing {tool}"
1033 except OSError as e:
1034 rc, msg = 1, start_failure(tool, e)
1035 if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need 1049 if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need
1036 results.append((name, None, unsupported_skip(msg))) 1050 results.append((name, None, unsupported_skip(msg)))
1037 elif name == "ps_texture_sample_d16" and rc == 0: 1051 elif name == "ps_texture_sample_d16" and rc == 0:
@@ -1043,12 +1057,8 @@ def run_suite(a, work: str) -> int:
1043 expected = TEXTURE_CONSTANTS[name] 1057 expected = TEXTURE_CONSTANTS[name]
1044 tool = os.path.join(a.build, "vk_texture_test" + ext) 1058 tool = os.path.join(a.build, "vk_texture_test" + ext)
1045 raw = os.path.join(raw_dir, f"{name}.raw") 1059 raw = os.path.join(raw_dir, f"{name}.raw")
1046 try: 1060 rc, msg = run_cmd([tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "92", "c00000",
1047 p = subprocess.run([tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "92", "c00000", 1061 "14500000", "0"], cwd=spirv_dir)
1048 "14500000", "0"], capture_output=True, text=True, cwd=spirv_dir)
1049 rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
1050 except FileNotFoundError:
1051 rc, msg = 1, f"missing {tool}"
1052 bad = 4096 1062 bad = 4096
1053 if rc == 0 and os.path.isfile(raw): 1063 if rc == 0 and os.path.isfile(raw):
1054 data = Path(raw).read_bytes() 1064 data = Path(raw).read_bytes()
@@ -1095,7 +1105,9 @@ def run_suite(a, work: str) -> int:
1095 raw = os.path.join(raw_dir, f"{name}.raw") 1105 raw = os.path.join(raw_dir, f"{name}.raw")
1096 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1106 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
1097 if name in PIXEL_VERTEX: 1107 if name in PIXEL_VERTEX:
1098 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback 1108 # --bary-fallback alone has no PerVertexKHR inputs, so the f16 halves can't be interpolated; with
1109 # --f16-interp-fallback too (on by itself without fragmentShaderBarycentric) it reads decoded halves.
1110 if name == "ps_interp_f16_high" and bary_fallback() and not f16_interp_fallback():
1099 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1111 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1100 continue 1112 continue
1101 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1113 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -1132,6 +1144,7 @@ def run_suite(a, work: str) -> int:
1132 "ps_scc_logic64": (0x0fff0fff, 0xff000000, 0xff0000ff, 0x16), 1144 "ps_scc_logic64": (0x0fff0fff, 0xff000000, 0xff0000ff, 0x16),
1133 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), 1145 "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000),
1134 "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64 1146 "ps_f64_mods": (0x40040000, 0x3FF00000, 0x3FE40000, 0x3FF00000), # needs shaderFloat64
1147 "ps_outmods_f16": (0xAAAA3C00, 0xAAAA3E00, 0x7C000000, 0x3C000000),
1135 # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers) 1148 # f16 op_sel / partial writes / inline constants: RDNA2 hardware words (see the .asm headers)
1136 "ps_f16_med3_opsel": (0xAAAA4100, 0xAAAA4200, 0xAAAA3E00, 0x40005555), 1149 "ps_f16_med3_opsel": (0xAAAA4100, 0xAAAA4200, 0xAAAA3E00, 0x40005555),
1137 "ps_f16_med3_mods": (0x41005555, 0x3C005555, 0x41003800, 0xAAAABA00), 1150 "ps_f16_med3_mods": (0x41005555, 0x3C005555, 0x41003800, 0xAAAABA00),
@@ -1143,6 +1156,7 @@ def run_suite(a, work: str) -> int:
1143 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3), 1156 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3),
1144 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200), 1157 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200),
1145 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400), 1158 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400),
1159 "ps_sdwa_f16_const": (0xAAAA3800, 0xAAAA1C00, 0xAAAA3E00, 0xAAAA73F0), # measured on gfx1036
1146 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate 1160 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate
1147 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware 1161 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware
1148 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), 1162 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000),
@@ -1236,7 +1250,7 @@ def run_suite(a, work: str) -> int:
1236 raw = os.path.join(raw_dir, f"{name}.raw") 1250 raw = os.path.join(raw_dir, f"{name}.raw")
1237 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS 1251 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS
1238 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv") 1252 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv")
1239 if bary_fallback(): 1253 if bary_fallback() and not f16_interp_fallback():
1240 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1254 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1241 continue 1255 continue
1242 rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env) 1256 rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env)
@@ -1279,7 +1293,12 @@ def run_suite(a, work: str) -> int:
1279 skipped += ok is None 1293 skipped += ok is None
1280 print(f" {tag:4s} {name:<20s} {detail}") 1294 print(f" {tag:4s} {name:<20s} {detail}")
1281 print(f"\n{passed}/{len(results)} passed" + (f", {skipped} skipped" if skipped else "")) 1295 print(f"\n{passed}/{len(results)} passed" + (f", {skipped} skipped" if skipped else ""))
1282 return 0 if passed + skipped == len(results) else 1 1296 if passed + skipped != len(results):
1297 return 1
1298 if getattr(a, "require_pass", False) and not passed:
1299 print("error: --require-pass: no GPU tests passed", file=sys.stderr)
1300 return 1
1301 return 0
1283 1302
1284 1303
1285if __name__ == "__main__": 1304if __name__ == "__main__":