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 21:57:04 +0100
committerVonsek <45567075+Vonsek@users.noreply.github.com>2026-11-22 21:57:04 +0100
commit8e28bd70bf6c2aa73382315ba37a6423a785d19d (patch)
tree3e762759b8422c8e6fc3038fe6427f42800b9876 /scripts/run_gpu_tests.py
parent37c29f6c822299bd5999f1f8d9ce78661a0d1675 (diff)
parentf847748cc76bd3777f9c070c4034eb2fc1c04e64 (diff)
Merge main into gpu-far-branch (#2697)
docs/design.md runtime/test/shaders/check.py scripts/run_gpu_tests.py AI-assisted.
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py145
1 files changed, 111 insertions, 34 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index a26bda040..ae62e6698 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,19 +25,20 @@ 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, tbuffer_store_test 28from check import Skip, clip_test, fmt_1010102_test, fmt_int_narrow_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, CVT_PK_U8_WORDS, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, 31from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, CVT_PK_U8_WORDS, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES,
32 TEXTURE_MIP_TEST, GATHER_LOD_TEST, MIP_TEST_PASSES, TEXTURE_CONSTANTS, USER_SGPRS_ENV, USER_SGPRS_WORDS, Skip, mesh_v5_test, not_found_message, 32 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 pick_build_dir, start_failure, texture_gradient_a16_test, texture_mip_test) 33 pick_build_dir, start_failure, texture_gradient_a16_test, texture_mip_test)
34from check import SIGNED_MIP_TEST 34from check import SIGNED_MIP_TEST
35from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan)
35from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py 36from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py
36from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 37from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8
37from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) 38from 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 39from 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, 40from 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 41 unpinned_subgroup_skip, vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py
41from check import PIXEL_VERTEX, interp_f16_high_problem, ij_computed_problem, mandelbrot_problem # pixel producers and checks 42from 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 43from 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 44from check import wide_pixel_skip # ps_w64x_readlane: judged only where the fragment stage was required 64-wide
@@ -238,12 +239,13 @@ def unsupported_skip(msg: str) -> str:
238 return f"SKIP ({m.group(0) if m else 'unsupported device'})" 239 return f"SKIP ({m.group(0) if m else 'unsupported device'})"
239 240
240 241
241def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True) -> tuple[int, str]: 242def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True, *,
243 cwd: str | None = None) -> tuple[int, str]:
242 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT). 244 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT).
243 # gpu=False (the translator over the whole suite) runs without a limit. 245 # gpu=False (the translator over the whole suite) runs without a limit.
244 limit = gpu_test_timeout() if gpu else None 246 limit = gpu_test_timeout() if gpu else None
245 try: 247 try:
246 p = subprocess.run(cmd, capture_output=True, text=True, env=env, timeout=limit) 248 p = subprocess.run(cmd, capture_output=True, text=True, env=env, timeout=limit, cwd=cwd)
247 except subprocess.TimeoutExpired: 249 except subprocess.TimeoutExpired:
248 return 1, timed_out(cmd[0], limit) 250 return 1, timed_out(cmd[0], limit)
249 except OSError as e: # e.g. Smart App Control blocked a fresh build: fail this test, keep running the others 251 except OSError as e: # e.g. Smart App Control blocked a fresh build: fail this test, keep running the others
@@ -292,6 +294,11 @@ def w64_emulated() -> bool:
292 # subgroup, matching check.py (W64_EMULATED). Accepts "1"/"true"/"yes"/"on" and tolerates 294 # subgroup, matching check.py (W64_EMULATED). Accepts "1"/"true"/"yes"/"on" and tolerates
293 # the trailing space cmd.exe's `set VAR=1 &` leaves in the value. 295 # the trailing space cmd.exe's `set VAR=1 &` leaves in the value.
294 return (os.environ.get("LEONIDA_W64_EMULATE") or "").strip().lower() in ("1", "true", "yes", "on") 296 return (os.environ.get("LEONIDA_W64_EMULATE") or "").strip().lower() in ("1", "true", "yes", "on")
297def pc_tail_ubo() -> bool:
298 # LEONIDA_PC_TAIL_UBO=1: translate with --pc-tail-ubo (s0..s31 in 128 push-constant bytes, the tail in a uniform
299 # block at set 1), for devices whose maxPushConstantsSize is 128. The test programs read the same variable
300 # (runtime/test/vk_pc_tail.h) and bind the block; same accepted values as LEONIDA_W64_EMULATE.
301 return (os.environ.get("LEONIDA_PC_TAIL_UBO") or "").strip().lower() in ("1", "true", "yes", "on")
295def wavemask_check(vk_compute: str, spv: str, env: dict | None, emulated: bool) -> tuple[bool | None, str]: 302def wavemask_check(vk_compute: str, spv: str, env: dict | None, emulated: bool) -> tuple[bool | None, str]:
296 """cs_wavemask, as in check.py: (passed, detail), passed None for a skip. The native build needs a 64-wide 303 """cs_wavemask, as in check.py: (passed, detail), passed None for a skip. The native build needs a 64-wide
297 subgroup and skips where the device has none; with LEONIDA_W64_EMULATE=1 it was translated with 304 subgroup and skips where the device has none; with LEONIDA_W64_EMULATE=1 it was translated with
@@ -310,6 +317,22 @@ def dump_words(msg: str) -> list[int] | None:
310 return [int(x) for x in m.group(1).split()] if m else None 317 return [int(x) for x in m.group(1).split()] if m else None
311 318
312 319
320def subgroup_pin_skip(msg: str, cs_env: dict | None) -> Skip | None:
321 """A Skip when the runner asked for a subgroup size (VKC_SUBGROUP_SIZE) and vk_compute_test says this device
322 cannot pin it, so the dispatched words are not the ones the fixture was written for. Only for the dumps in
323 WAVE32_PIN_DUMPS: everything else the runner judges at the device's own width, which is how cs_store and the
324 cs_w32_* fixtures keep being tested on a 64-only device (check.py is conservative and skips all of them)."""
325 if cs_env and "VKC_SUBGROUP_SIZE" in cs_env:
326 return unpinned_subgroup_skip(msg)
327 return None
328
329
330# Dumps whose expected words depend on the wave width but are not lane-mask dumps (those are WAVE32_LANE_DUMPS):
331# cs_barrier_loop's trip count is 4 waves of 32, so at 64 lanes it writes a different pattern and the words would
332# report a failure that is really an unpinnable wave size (GCN3/GCN4 expose 64..64 only).
333WAVE32_PIN_DUMPS = ("cs_barrier_loop",)
334
335
313def judge_cs_dump(rc: int, msg: str, want: list[int], *, wave64: bool, partial: bool, emulated: bool, 336def judge_cs_dump(rc: int, msg: str, want: list[int], *, wave64: bool, partial: bool, emulated: bool,
314 hexwords: bool = False) -> tuple[bool | None, str]: 337 hexwords: bool = False) -> tuple[bool | None, str]:
315 """Judge one vk_compute_test "dump" run: (True, words), (False, why), or (None, why) when the device can't run it. 338 """Judge one vk_compute_test "dump" run: (True, words), (False, why), or (None, why) when the device can't run it.
@@ -325,7 +348,7 @@ def judge_cs_dump(rc: int, msg: str, want: list[int], *, wave64: bool, partial:
325 if rc != 0 or words is None: 348 if rc != 0 or words is None:
326 return False, msg 349 return False, msg
327 vals = words[:len(want)] 350 vals = words[:len(want)]
328 return vals == want, " ".join((hex if hexwords else str)(x) for x in vals) 351 return words_match(vals, want), " ".join((hex if hexwords else str)(x) for x in vals)
329 352
330 353
331def check_pixel_const(raw_path: str, want: tuple[int, int, int, int]) -> tuple[bool, str]: 354def check_pixel_const(raw_path: str, want: tuple[int, int, int, int]) -> tuple[bool, str]:
@@ -555,7 +578,8 @@ DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_textur
555 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", 578 **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm",
556 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", 579 "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm",
557 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm", 580 "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm",
558 SIGNED_MIP_TEST: "vs_ids.asm"} 581 SIGNED_MIP_TEST: "vs_ids.asm",
582 "vs_base_ids": "ps_flat.asm"}
559DRAWN_WITH.update({name: "vs_ids.asm" for name in GET_LOD_TESTS}) 583DRAWN_WITH.update({name: "vs_ids.asm" for name in GET_LOD_TESTS})
560 584
561 585
@@ -599,6 +623,7 @@ def main() -> int:
599 "subfolder that has the test programs is found by itself") 623 "subfolder that has the test programs is found by itself")
600 ap.add_argument("--work", default=None) 624 ap.add_argument("--work", default=None)
601 ap.add_argument("--filter", default="") 625 ap.add_argument("--filter", default="")
626 ap.add_argument("--require-pass", action="store_true", help="exit 1 if no GPU test passes")
602 a = ap.parse_args() 627 a = ap.parse_args()
603 # Some test programs run with their working directory in <work>/spirv (vk_texture_test), so a relative path 628 # 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. 629 # given here would point somewhere else for them.
@@ -718,6 +743,8 @@ def run_suite(a, work: str) -> int:
718 cmd.append("--texel-offset-fallback") 743 cmd.append("--texel-offset-fallback")
719 if MESH_COMPUTE: # mesh shaders as compute writing to a buffer, drawn by tools/mesh_compute_vs.py 744 if MESH_COMPUTE: # mesh shaders as compute writing to a buffer, drawn by tools/mesh_compute_vs.py
720 cmd.append("--mesh-compute") 745 cmd.append("--mesh-compute")
746 if pc_tail_ubo(): # 128 push-constant bytes; heap base and code base from a uniform block at set 1
747 cmd.append("--pc-tail-ubo")
721 if os.environ.get("LEONIDA_FMA") in ("glsl", "khr"): # fused multiply-add: GLSL Fma or OpFmaKHR (docs/design.md) 748 if os.environ.get("LEONIDA_FMA") in ("glsl", "khr"): # fused multiply-add: GLSL Fma or OpFmaKHR (docs/design.md)
722 cmd += ["--fma", os.environ["LEONIDA_FMA"]] 749 cmd += ["--fma", os.environ["LEONIDA_FMA"]]
723 rc, out = run_cmd(cmd, gpu=False) 750 rc, out = run_cmd(cmd, gpu=False)
@@ -806,7 +833,7 @@ 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 " 833 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")) 834 "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", 835 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", "cs_cvt_pk_u8"): 836 "cs_buf_swizzle", "cs_cmpx_class_f32", "cs_cvt_pk_u8", "cs_buf_load_sub", "cs_buf_fmt8"):
810 # num_records bounds check (cs_bounds.asm): the out-of-bounds store is dropped and the out-of-bounds 837 # 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. 838 # load reads 0, so thread 0's four output words are fixed. One thread, no wave64 requirement.
812 # cs_cmpx_class_f32 and cs_cvt_pk_u8 are per-lane and need no particular subgroup width either. 839 # cs_cmpx_class_f32 and cs_cvt_pk_u8 are per-lane and need no particular subgroup width either.
@@ -823,11 +850,14 @@ def run_suite(a, work: str) -> int:
823 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0], 850 "cs_buf_tail": [0, 0x5EED000C, 0x5EED0008, 0x5EED000C, 0, 0, 0x5EED0010, 0],
824 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0], 851 "cs_oob_select": [0x5EED000C, 0, 0x5EED0014, 0, 0x5EED0018, 0xEEEEEEEE, 0, 0],
825 "cs_oob_tail": [0, 0, 0x5EED0010, 0, 0xBEEF0000, 0xEEEEEEEE, 0, 0x5EED0010], 852 "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) 853 # 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, 854 "cs_buf_swizzle": [0x5EED0024, 0x5EED0044, 0x5EED004C, 0x5EED0008, 0x5EED000C, 0, 0xBEEF0000,
828 0xBEEF0001], 855 0xBEEF0001],
829 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 856 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
830 "cs_cvt_pk_u8": CVT_PK_U8_WORDS, 857 "cs_cvt_pk_u8": CVT_PK_U8_WORDS,
858 # TEST-510: sub-dword MUBUF loads (RAW end check by element size) and GFX10_FORMAT_8_UINT
859 "cs_buf_load_sub": [0x80, 0xFFFFFF80, 0x1FF, 0xFFFF807F, 0xAB01, 0xCD, 0, 0],
860 "cs_buf_fmt8": [0x7F, 0x80, 0xFF, 0x01, 0, 0, 0xFF, 1],
831 }[name] 861 }[name]
832 words = dump_words(msg) 862 words = dump_words(msg)
833 vals = words[:len(want)] if words else [] 863 vals = words[:len(want)] if words else []
@@ -839,6 +869,9 @@ def run_suite(a, work: str) -> int:
839 elif name == "cs_fmt_sint32": 869 elif name == "cs_fmt_sint32":
840 problem = fmt_sint32_test(a.build, spirv_dir, cs_env) 870 problem = fmt_sint32_test(a.build, spirv_dir, cs_env)
841 results.append((name, not problem, problem or "64/64 dumped words exact")) 871 results.append((name, not problem, problem or "64/64 dumped words exact"))
872 elif name == "cs_fmt_int_narrow":
873 problem = fmt_int_narrow_test(a.build, spirv_dir, cs_env)
874 results.append((name, not problem, problem or "136/136 dumped words exact"))
842 elif name == "cs_fmt_xy_xyz": 875 elif name == "cs_fmt_xy_xyz":
843 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) 876 # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header)
844 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) 877 problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env)
@@ -861,6 +894,14 @@ def run_suite(a, work: str) -> int:
861 vals = words[:len(USER_SGPRS_WORDS)] if words else [] 894 vals = words[:len(USER_SGPRS_WORDS)] if words else []
862 results.append((name, rc == 0 and vals == USER_SGPRS_WORDS, 895 results.append((name, rc == 0 and vals == USER_SGPRS_WORDS,
863 " ".join(hex(x) for x in vals) if vals else msg)) 896 " ".join(hex(x) for x in vals) if vals else msg))
897 elif name == "cs_f64_add":
898 rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=cs_env)
899 if rc == 77:
900 results.append((name, None, "SKIP (no shaderFloat64 on this device)"))
901 else:
902 ok, detail = judge_cs_dump(rc, msg, [0, 0x40040000], wave64=False, partial=False, emulated=False,
903 hexwords=True)
904 results.append((name, ok, detail))
864 elif name == "cs_cvt_f32_sat": 905 elif name == "cs_cvt_f32_sat":
865 # #300's saturating float -> int conversions: one dispatch per input word in s4 (VKC_SGPRS). 906 # #300's saturating float -> int conversions: one dispatch per input word in s4 (VKC_SGPRS).
866 wrong = [] 907 wrong = []
@@ -878,7 +919,7 @@ def run_suite(a, work: str) -> int:
878 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. 919 # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none.
879 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. 920 # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size.
880 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) 921 results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated()))
881 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", 922 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",
882 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", 923 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi",
883 "cs_dpp_bound", "cs_dpp_w64", 924 "cs_dpp_bound", "cs_dpp_w64",
884 "cs_w64_mask_detect", 925 "cs_w64_mask_detect",
@@ -887,7 +928,8 @@ def run_suite(a, work: str) -> int:
887 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", 928 "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load",
888 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", 929 "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent",
889 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", 930 "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end",
890 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst"): 931 "cs_barrier_loop", "cs_w64x_andn2_exec", "cs_w64x_saveexec_b64", "cs_lds_b64_cmpst",
932 "cs_mask_vgpr_exec"):
891 cs_dump_wants = { 933 cs_dump_wants = {
892 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], 934 "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000],
893 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone 935 # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone
@@ -926,6 +968,9 @@ def run_suite(a, work: str) -> int:
926 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], 968 "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7],
927 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], 969 "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777],
928 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], 970 "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6],
971 # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7]
972 # without it
973 "cs_signed_zero_nan": [0x80000000, 0x80000000, 0x80008000, 0x00008000, 1, 1, 1, 0x00007C00],
929 "cs_wave64_ballot": [32, 16, 24, 40, 8, 48], 974 "cs_wave64_ballot": [32, 16, 24, 40, 8, 48],
930 "cs_wm_half_ops": [32, 16, 16, 0, 16], 975 "cs_wm_half_ops": [32, 16, 16, 0, 16],
931 "cs_wm_half_cmp": [1, 0, 1, 1], 976 "cs_wm_half_cmp": [1, 0, 1, 1],
@@ -964,10 +1009,14 @@ def run_suite(a, work: str) -> int:
964 # differs per wave (cs_barrier_loop.asm) 1009 # differs per wave (cs_barrier_loop.asm)
965 "cs_barrier_early_end": [127, 126, 125, 124, 123, 122, 121, 120], 1010 "cs_barrier_early_end": [127, 126, 125, 124, 123, 122, 121, 120],
966 "cs_barrier_loop": [128, 96, 64, 32, 128, 96, 64, 0xEEEEEEEE], 1011 "cs_barrier_loop": [128, 96, 64, 32, 128, 96, 64, 0xEEEEEEEE],
1012 # SHADER-21 part 2: a mask copied to a VGPR with v_mov_b32 respects EXEC —
1013 # inactive lanes keep the old VGPR (cs_mask_vgpr_exec.asm)
1014 "cs_mask_vgpr_exec": [0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
1015 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF],
967 } 1016 }
968 want = cs_dump_wants[name] 1017 want = cs_dump_wants[name]
969 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / 1018 # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute /
970 # 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 1019 # 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
971 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, 1020 # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip,
972 # as check.py does, where the device has none 1021 # as check.py does, where the device has none
973 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were 1022 # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were
@@ -976,11 +1025,11 @@ def run_suite(a, work: str) -> int:
976 # size 64 without them. 1025 # size 64 without them.
977 emulated = w64_emulated() 1026 emulated = w64_emulated()
978 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") 1027 partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp")
979 wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", 1028 wave64 = name not in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2",
980 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", 1029 "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop",
981 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", 1030 "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops",
982 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", 1031 "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos",
983 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", 1032 "cs_lds_b64_cmpst", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec",
984 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", 1033 "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8",
985 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial 1034 "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial
986 if partial and not emulated: 1035 if partial and not emulated:
@@ -989,12 +1038,20 @@ def run_suite(a, work: str) -> int:
989 cs_env = dict(os.environ, **WAVE32_LANE_ENV) 1038 cs_env = dict(os.environ, **WAVE32_LANE_ENV)
990 rc, msg = run_cmd([vk_compute, spv, "1", "dump"] + (["--require-wave64"] if wave64 else []), env=cs_env) 1039 rc, msg = run_cmd([vk_compute, spv, "1", "dump"] + (["--require-wave64"] if wave64 else []), env=cs_env)
991 skip = wave32_lane_skip(msg) if name in WAVE32_LANE_DUMPS else None 1040 skip = wave32_lane_skip(msg) if name in WAVE32_LANE_DUMPS else None
1041 if skip is None and name in WAVE32_PIN_DUMPS:
1042 # the device may not be able to run the wave size this fixture was written for (a 64-only device
1043 # can't pin 32, so cs_barrier_loop's words mean nothing); check.py skips it too
1044 skip = subgroup_pin_skip(msg, cs_env)
992 if skip: # e.g. Mesa llvmpipe's 8-wide subgroups: these 32-lane masks can't come out right 1045 if skip: # e.g. Mesa llvmpipe's 8-wide subgroups: these 32-lane masks can't come out right
993 ok, detail = None, str(skip) 1046 ok, detail = None, str(skip)
994 else: 1047 else:
1048 want = judged_words(name, msg, want) # cs_signed_zero_nan on Apple and llvmpipe (check.py)
995 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, 1049 ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated,
996 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16", 1050 hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16",
997 "cs_lds_b64_cmpst")) 1051 "cs_lds_b64_cmpst", "cs_signed_zero_nan"))
1052 if ok and None in want:
1053 unjudged = ", ".join(str(i) for i, w in enumerate(want) if w is None)
1054 detail += f" (words {unjudged} not judged on this device: UNJUDGED_WORDS in check.py)"
998 results.append((name, ok, detail)) 1055 results.append((name, ok, detail))
999 elif name == "cs_imgstore": 1056 elif name == "cs_imgstore":
1000 rc, msg = run_cmd([vk_store, spv]) 1057 rc, msg = run_cmd([vk_store, spv])
@@ -1022,13 +1079,7 @@ def run_suite(a, work: str) -> int:
1022 mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"], 1079 mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"],
1023 "ps_sample_c_lz_a16": ["dref_a16"]}.get(name, []) 1080 "ps_sample_c_lz_a16": ["dref_a16"]}.get(name, [])
1024 cmd = [tool, *mode, raw] 1081 cmd = [tool, *mode, raw]
1025 try: 1082 rc, msg = run_cmd(cmd, cwd=spirv_dir)
1026 p = subprocess.run(cmd, capture_output=True, text=True, cwd=spirv_dir)
1027 rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
1028 except FileNotFoundError:
1029 rc, msg = 1, f"missing {tool}"
1030 except OSError as e:
1031 rc, msg = 1, start_failure(tool, e)
1032 if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need 1083 if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need
1033 results.append((name, None, unsupported_skip(msg))) 1084 results.append((name, None, unsupported_skip(msg)))
1034 elif name == "ps_texture_sample_d16" and rc == 0: 1085 elif name == "ps_texture_sample_d16" and rc == 0:
@@ -1040,12 +1091,8 @@ def run_suite(a, work: str) -> int:
1040 expected = TEXTURE_CONSTANTS[name] 1091 expected = TEXTURE_CONSTANTS[name]
1041 tool = os.path.join(a.build, "vk_texture_test" + ext) 1092 tool = os.path.join(a.build, "vk_texture_test" + ext)
1042 raw = os.path.join(raw_dir, f"{name}.raw") 1093 raw = os.path.join(raw_dir, f"{name}.raw")
1043 try: 1094 rc, msg = run_cmd([tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "92", "c00000",
1044 p = subprocess.run([tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "92", "c00000", 1095 "14500000", "0"], cwd=spirv_dir)
1045 "14500000", "0"], capture_output=True, text=True, cwd=spirv_dir)
1046 rc, msg = p.returncode, (p.stdout + "\n" + p.stderr).strip()
1047 except FileNotFoundError:
1048 rc, msg = 1, f"missing {tool}"
1049 bad = 4096 1096 bad = 4096
1050 if rc == 0 and os.path.isfile(raw): 1097 if rc == 0 and os.path.isfile(raw):
1051 data = Path(raw).read_bytes() 1098 data = Path(raw).read_bytes()
@@ -1072,7 +1119,7 @@ def run_suite(a, work: str) -> int:
1072 problem = sampler_test(a.build, spirv_dir) 1119 problem = sampler_test(a.build, spirv_dir)
1073 results.append((name, None if isinstance(problem, Skip) else not problem, 1120 results.append((name, None if isinstance(problem, Skip) else not problem,
1074 problem or f"{len(SAMPLER_CASES)} S#/T# cases, 4096 pixels each exact")) 1121 problem or f"{len(SAMPLER_CASES)} S#/T# cases, 4096 pixels each exact"))
1075 elif name in ("ps_texoff", "ps_texoff_implicit"): 1122 elif name in ("ps_texoff", "ps_texoff_implicit", "ps_texoff_forms"):
1076 # Texel offsets: needs vk_texture_test's texture, sampler and descriptor table (vk_harness binds none), 1123 # Texel offsets: needs vk_texture_test's texture, sampler and descriptor table (vk_harness binds none),
1077 # and VK_KHR_maintenance8 for the non-constant Offset; the tool exits 77 without it. 1124 # and VK_KHR_maintenance8 for the non-constant Offset; the tool exits 77 without it.
1078 raw = os.path.join(raw_dir, f"{name}.raw") 1125 raw = os.path.join(raw_dir, f"{name}.raw")
@@ -1084,7 +1131,7 @@ def run_suite(a, work: str) -> int:
1084 results.append((name, False, msg)) 1131 results.append((name, False, msg))
1085 else: 1132 else:
1086 with open(raw, "rb") as f: 1133 with open(raw, "rb") as f:
1087 problem, covered = texoff_problem(f.read(), msg) 1134 problem, covered = texoff_problem(f.read(), msg, name=name)
1088 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})")) 1135 results.append((name, not problem, problem or f"4096/4096 pixels exact ({covered})"))
1089 elif name in OTHER_HARNESS: 1136 elif name in OTHER_HARNESS:
1090 results.append((name, None, f"SKIP (run by {OTHER_HARNESS[name]})")) 1137 results.append((name, None, f"SKIP (run by {OTHER_HARNESS[name]})"))
@@ -1092,7 +1139,9 @@ def run_suite(a, work: str) -> int:
1092 raw = os.path.join(raw_dir, f"{name}.raw") 1139 raw = os.path.join(raw_dir, f"{name}.raw")
1093 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids 1140 vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids
1094 if name in PIXEL_VERTEX: 1141 if name in PIXEL_VERTEX:
1095 if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback 1142 # --bary-fallback alone has no PerVertexKHR inputs, so the f16 halves can't be interpolated; with
1143 # --f16-interp-fallback too (on by itself without fragmentShaderBarycentric) it reads decoded halves.
1144 if name == "ps_interp_f16_high" and bary_fallback() and not f16_interp_fallback():
1096 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1145 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1097 continue 1146 continue
1098 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") 1147 vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv")
@@ -1115,6 +1164,7 @@ def run_suite(a, work: str) -> int:
1115 "ps_ops4": (0x34000010, 0x00120800, 0xBEEF0000, 0x12343C00), 1164 "ps_ops4": (0x34000010, 0x00120800, 0xBEEF0000, 0x12343C00),
1116 "ps_scc": (1, 1, 3, 0x80000000), 1165 "ps_scc": (1, 1, 3, 0x80000000),
1117 "ps_sdwa": (0x000000F1, 0xBFFEFFF2, 0x3C003344, 0xBFF70000), 1166 "ps_sdwa": (0x000000F1, 0xBFFEFFF2, 0x3C003344, 0xBFF70000),
1167 "ps_sdwa_dword_hi": (0x00004000, 0x00000003, 0x00004700, 0x0000C000), # 16-bit SDWA, dst_sel:DWORD
1118 "ps_legacy_mul": (0, 0, 0, 0x40C00000), # same expectation as check.py 1168 "ps_legacy_mul": (0, 0, 0, 0x40C00000), # same expectation as check.py
1119 "ps_ops5": (0x12340010, 0xBEEF0800, 0xAAAAFFFF, 0xDEADBC00), # from the .asm headers 1169 "ps_ops5": (0x12340010, 0xBEEF0800, 0xAAAAFFFF, 0xDEADBC00), # from the .asm headers
1120 "ps_ops6": (0xF800FFFF, 0x01000010, 0x00800800, 0x8000FFF0), 1170 "ps_ops6": (0xF800FFFF, 0x01000010, 0x00800800, 0x8000FFF0),
@@ -1141,12 +1191,17 @@ def run_suite(a, work: str) -> int:
1141 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3), 1191 "ps_f16_const2": (0x42003D00, 0x3D004200, 0xAAAABC00, 3),
1142 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200), 1192 "ps_f16_pack": (0x34003C00, 0x38003400, 0x34000000, 0x44004200),
1143 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400), 1193 "ps_f16_pack_mods": (0x4400B400, 0xC4003400, 0x4400C200, 0xB400B400),
1194 "ps_sdwa_f16_const": (0xAAAA3800, 0xAAAA1C00, 0xAAAA3E00, 0xAAAA73F0), # measured on gfx1036
1144 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate 1195 "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate
1145 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware 1196 "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware
1146 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), 1197 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000),
1147 # TEST-175: docs/design.md rules that were checked on the CPU only (derivations in the .asm headers) 1198 # TEST-175: docs/design.md rules that were checked on the CPU only (derivations in the .asm headers)
1148 "ps_cmp_nlg": (0x40000037, 0x40000007, 0x40000001, 0x3F800000), 1199 "ps_cmp_nlg": (0x40000037, 0x40000007, 0x40000001, 0x3F800000),
1149 "ps_far_branch": (0x00000007, 0x00000013, 0x00000051, 0x0000000B), # far branches (.asm header) 1200 "ps_far_branch": (0x00000007, 0x00000013, 0x00000051, 0x0000000B), # far branches (.asm header)
1201 "ps_vcmp_f16": (0x48A12080, 0x4CE9B1A2, 0x4BA72C98, 0x4FEFBDBA), # 16-bit float v_cmp e32 (.asm header)
1202 "ps_vcmp_f16_e64": (0x44C11100, 0x4CF171C1, 0x47C71D18, 0x4FF77DD9), # same, e64 with swapped operands
1203 "ps_vcmpx_f16": (0x68A12080, 0x6CE9B1A2, 0x6BA72C98, 0x6FEFBDBA), # 16-bit float v_cmpx e32 (.asm header)
1204 "ps_vcmpx_f16_e64": (0x64C11100, 0x6CF171C1, 0x67C71D18, 0x6FF77DD9), # same, e64 with swapped operands
1150 "ps_cvt_off": (0xBF000000, 0x3EE00000, 0xBE800000, 0x3F800000), 1205 "ps_cvt_off": (0xBF000000, 0x3EE00000, 0xBE800000, 0x3F800000),
1151 "ps_fmac_f16_mods": (0xAAAA3C00, 0xAAAA3E00, 0xAAAA0000, 0xAAAA4000), 1206 "ps_fmac_f16_mods": (0xAAAA3C00, 0xAAAA3E00, 0xAAAA0000, 0xAAAA4000),
1152 "ps_vop3_const_mods": (0xC0000000, 0xBF800000, 0x3F800000, 0xAAAABC00), 1207 "ps_vop3_const_mods": (0xC0000000, 0xBF800000, 0x3F800000, 0xAAAABC00),
@@ -1235,7 +1290,7 @@ def run_suite(a, work: str) -> int:
1235 raw = os.path.join(raw_dir, f"{name}.raw") 1290 raw = os.path.join(raw_dir, f"{name}.raw")
1236 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS 1291 env = mesh_env(spirv_dir, name, gfx_env) # VKH_MESH=1, or the --mesh-compute pass and its VS
1237 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv") 1292 fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv")
1238 if bary_fallback(): 1293 if bary_fallback() and not f16_interp_fallback():
1239 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) 1294 results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)"))
1240 continue 1295 continue
1241 rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env) 1296 rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env)
@@ -1258,6 +1313,19 @@ def run_suite(a, work: str) -> int:
1258 else: 1313 else:
1259 ok, detail = check_clip_half(raw, 0.5, 1.0) 1314 ok, detail = check_clip_half(raw, 0.5, 1.0)
1260 results.append((name, ok, detail)) 1315 results.append((name, ok, detail))
1316 elif name == "vs_base_ids":
1317 # Zero-based v0 / v3 (the hardware's VS input VGPRs): drawn with firstVertex 16 and firstInstance 7,
1318 # ps_flat must still see vertex 0 of instance 0 (0x101), as check.py checks.
1319 raw = os.path.join(raw_dir, f"{name}.raw")
1320 env = dict(gfx_env or os.environ, VKH_DRAW="16,7")
1321 rc, msg = run_cmd([vk_harness, spv, os.path.join(spirv_dir, "ps_flat.spv"), raw], env=env)
1322 if rc == UNSUPPORTED:
1323 results.append((name, None, unsupported_skip(msg)))
1324 elif rc != 0:
1325 results.append((name, False, msg))
1326 else:
1327 ok, detail = check_flat(raw)
1328 results.append((name, ok, detail))
1261 1329
1262 if a.filter and not results: # the filter matched only inputs/partners: say so rather than "0/0 passed" 1330 if a.filter and not results: # the filter matched only inputs/partners: say so rather than "0/0 passed"
1263 names = [os.path.splitext(f)[0] for f in asm_files] 1331 names = [os.path.splitext(f)[0] for f in asm_files]
@@ -1278,8 +1346,17 @@ def run_suite(a, work: str) -> int:
1278 skipped += ok is None 1346 skipped += ok is None
1279 print(f" {tag:4s} {name:<20s} {detail}") 1347 print(f" {tag:4s} {name:<20s} {detail}")
1280 print(f"\n{passed}/{len(results)} passed" + (f", {skipped} skipped" if skipped else "")) 1348 print(f"\n{passed}/{len(results)} passed" + (f", {skipped} skipped" if skipped else ""))
1281 return 0 if passed + skipped == len(results) else 1 1349 if passed + skipped != len(results):
1350 return 1
1351 if getattr(a, "require_pass", False) and not passed:
1352 print("error: --require-pass: no GPU tests passed", file=sys.stderr)
1353 return 1
1354 return 0
1282 1355
1283 1356
1284if __name__ == "__main__": 1357if __name__ == "__main__":
1358 try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode
1359 sys.stdout.reconfigure(errors="replace")
1360 except (AttributeError, ValueError, OSError):
1361 pass
1285 sys.exit(main()) 1362 sys.exit(main())