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:
authorlines9686-rgb <282495677+lines9686-rgb@users.noreply.github.com>2026-11-22 23:28:03 +0300
committerlines9686-rgb <282495677+lines9686-rgb@users.noreply.github.com>2026-11-22 23:28:03 +0300
commit51a6feece1b8cb1fee7f59d8528b752d1b707182 (patch)
treebc7f1180128c056a53eac96d3e316362e57f3fdb /scripts/run_gpu_tests.py
parent511732b468d243f79330db1b3746c72ee448623e (diff)
parentf847748cc76bd3777f9c070c4034eb2fc1c04e64 (diff)
Merge main into test-windows-nonascii
hw_oracle's vcvars script is fixed on main by #2667 (UTF-8 + chcp 65001), so this branch takes main's runner.py and drops its own 8.3-name version. Two of main's new hw_oracle tests decoded that UTF-8 script as ASCII, which fails when %TEMP% holds a non-ASCII user name; they now decode it as UTF-8. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py71
1 files changed, 66 insertions, 5 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 3a23250fc..7cd0e9dbf 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -38,7 +38,7 @@ from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: tex
38from 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)
39from 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
40from 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,
41 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
42from 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
43from 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
44from 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
@@ -294,6 +294,11 @@ def w64_emulated() -> bool:
294 # 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
295 # 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.
296 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")
297def 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]:
298 """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
299 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
@@ -312,6 +317,22 @@ def dump_words(msg: str) -> list[int] | None:
312 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
313 318
314 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
315def 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,
316 hexwords: bool = False) -> tuple[bool | None, str]: 337 hexwords: bool = False) -> tuple[bool | None, str]:
317 """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.
@@ -557,7 +578,8 @@ DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_textur
557 **{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",
558 "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",
559 "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",
560 SIGNED_MIP_TEST: "vs_ids.asm"} 581 SIGNED_MIP_TEST: "vs_ids.asm",
582 "vs_base_ids": "ps_flat.asm"}
561DRAWN_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})
562 584
563 585
@@ -721,6 +743,8 @@ def run_suite(a, work: str) -> int:
721 cmd.append("--texel-offset-fallback") 743 cmd.append("--texel-offset-fallback")
722 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
723 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")
724 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)
725 cmd += ["--fma", os.environ["LEONIDA_FMA"]] 749 cmd += ["--fma", os.environ["LEONIDA_FMA"]]
726 rc, out = run_cmd(cmd, gpu=False) 750 rc, out = run_cmd(cmd, gpu=False)
@@ -809,7 +833,7 @@ def run_suite(a, work: str) -> int:
809 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 "
810 "clamped and the calculated LOD within 1/16")) 834 "clamped and the calculated LOD within 1/16"))
811 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",
812 "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"):
813 # 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
814 # 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.
815 # 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.
@@ -831,6 +855,9 @@ def run_suite(a, work: str) -> int:
831 0xBEEF0001], 855 0xBEEF0001],
832 "cs_cmpx_class_f32": CMPX_CLASS_WORDS, 856 "cs_cmpx_class_f32": CMPX_CLASS_WORDS,
833 "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],
834 }[name] 861 }[name]
835 words = dump_words(msg) 862 words = dump_words(msg)
836 vals = words[:len(want)] if words else [] 863 vals = words[:len(want)] if words else []
@@ -867,6 +894,14 @@ def run_suite(a, work: str) -> int:
867 vals = words[:len(USER_SGPRS_WORDS)] if words else [] 894 vals = words[:len(USER_SGPRS_WORDS)] if words else []
868 results.append((name, rc == 0 and vals == USER_SGPRS_WORDS, 895 results.append((name, rc == 0 and vals == USER_SGPRS_WORDS,
869 " ".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))
870 elif name == "cs_cvt_f32_sat": 905 elif name == "cs_cvt_f32_sat":
871 # #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).
872 wrong = [] 907 wrong = []
@@ -1003,6 +1038,10 @@ def run_suite(a, work: str) -> int:
1003 cs_env = dict(os.environ, **WAVE32_LANE_ENV) 1038 cs_env = dict(os.environ, **WAVE32_LANE_ENV)
1004 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)
1005 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)
1006 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
1007 ok, detail = None, str(skip) 1046 ok, detail = None, str(skip)
1008 else: 1047 else:
@@ -1080,7 +1119,7 @@ def run_suite(a, work: str) -> int:
1080 problem = sampler_test(a.build, spirv_dir) 1119 problem = sampler_test(a.build, spirv_dir)
1081 results.append((name, None if isinstance(problem, Skip) else not problem, 1120 results.append((name, None if isinstance(problem, Skip) else not problem,
1082 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"))
1083 elif name in ("ps_texoff", "ps_texoff_implicit"): 1122 elif name in ("ps_texoff", "ps_texoff_implicit", "ps_texoff_forms"):
1084 # 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),
1085 # 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.
1086 raw = os.path.join(raw_dir, f"{name}.raw") 1125 raw = os.path.join(raw_dir, f"{name}.raw")
@@ -1092,7 +1131,7 @@ def run_suite(a, work: str) -> int:
1092 results.append((name, False, msg)) 1131 results.append((name, False, msg))
1093 else: 1132 else:
1094 with open(raw, "rb") as f: 1133 with open(raw, "rb") as f:
1095 problem, covered = texoff_problem(f.read(), msg) 1134 problem, covered = texoff_problem(f.read(), msg, name=name)
1096 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})"))
1097 elif name in OTHER_HARNESS: 1136 elif name in OTHER_HARNESS:
1098 results.append((name, None, f"SKIP (run by {OTHER_HARNESS[name]})")) 1137 results.append((name, None, f"SKIP (run by {OTHER_HARNESS[name]})"))
@@ -1125,6 +1164,7 @@ def run_suite(a, work: str) -> int:
1125 "ps_ops4": (0x34000010, 0x00120800, 0xBEEF0000, 0x12343C00), 1164 "ps_ops4": (0x34000010, 0x00120800, 0xBEEF0000, 0x12343C00),
1126 "ps_scc": (1, 1, 3, 0x80000000), 1165 "ps_scc": (1, 1, 3, 0x80000000),
1127 "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
1128 "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
1129 "ps_ops5": (0x12340010, 0xBEEF0800, 0xAAAAFFFF, 0xDEADBC00), # from the .asm headers 1169 "ps_ops5": (0x12340010, 0xBEEF0800, 0xAAAAFFFF, 0xDEADBC00), # from the .asm headers
1130 "ps_ops6": (0xF800FFFF, 0x01000010, 0x00800800, 0x8000FFF0), 1170 "ps_ops6": (0xF800FFFF, 0x01000010, 0x00800800, 0x8000FFF0),
@@ -1157,6 +1197,10 @@ def run_suite(a, work: str) -> int:
1157 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), 1197 "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000),
1158 # 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)
1159 "ps_cmp_nlg": (0x40000037, 0x40000007, 0x40000001, 0x3F800000), 1199 "ps_cmp_nlg": (0x40000037, 0x40000007, 0x40000001, 0x3F800000),
1200 "ps_vcmp_f16": (0x48A12080, 0x4CE9B1A2, 0x4BA72C98, 0x4FEFBDBA), # 16-bit float v_cmp e32 (.asm header)
1201 "ps_vcmp_f16_e64": (0x44C11100, 0x4CF171C1, 0x47C71D18, 0x4FF77DD9), # same, e64 with swapped operands
1202 "ps_vcmpx_f16": (0x68A12080, 0x6CE9B1A2, 0x6BA72C98, 0x6FEFBDBA), # 16-bit float v_cmpx e32 (.asm header)
1203 "ps_vcmpx_f16_e64": (0x64C11100, 0x6CF171C1, 0x67C71D18, 0x6FF77DD9), # same, e64 with swapped operands
1160 "ps_cvt_off": (0xBF000000, 0x3EE00000, 0xBE800000, 0x3F800000), 1204 "ps_cvt_off": (0xBF000000, 0x3EE00000, 0xBE800000, 0x3F800000),
1161 "ps_fmac_f16_mods": (0xAAAA3C00, 0xAAAA3E00, 0xAAAA0000, 0xAAAA4000), 1205 "ps_fmac_f16_mods": (0xAAAA3C00, 0xAAAA3E00, 0xAAAA0000, 0xAAAA4000),
1162 "ps_vop3_const_mods": (0xC0000000, 0xBF800000, 0x3F800000, 0xAAAABC00), 1206 "ps_vop3_const_mods": (0xC0000000, 0xBF800000, 0x3F800000, 0xAAAABC00),
@@ -1268,6 +1312,19 @@ def run_suite(a, work: str) -> int:
1268 else: 1312 else:
1269 ok, detail = check_clip_half(raw, 0.5, 1.0) 1313 ok, detail = check_clip_half(raw, 0.5, 1.0)
1270 results.append((name, ok, detail)) 1314 results.append((name, ok, detail))
1315 elif name == "vs_base_ids":
1316 # Zero-based v0 / v3 (the hardware's VS input VGPRs): drawn with firstVertex 16 and firstInstance 7,
1317 # ps_flat must still see vertex 0 of instance 0 (0x101), as check.py checks.
1318 raw = os.path.join(raw_dir, f"{name}.raw")
1319 env = dict(gfx_env or os.environ, VKH_DRAW="16,7")
1320 rc, msg = run_cmd([vk_harness, spv, os.path.join(spirv_dir, "ps_flat.spv"), raw], env=env)
1321 if rc == UNSUPPORTED:
1322 results.append((name, None, unsupported_skip(msg)))
1323 elif rc != 0:
1324 results.append((name, False, msg))
1325 else:
1326 ok, detail = check_flat(raw)
1327 results.append((name, ok, detail))
1271 1328
1272 if a.filter and not results: # the filter matched only inputs/partners: say so rather than "0/0 passed" 1329 if a.filter and not results: # the filter matched only inputs/partners: say so rather than "0/0 passed"
1273 names = [os.path.splitext(f)[0] for f in asm_files] 1330 names = [os.path.splitext(f)[0] for f in asm_files]
@@ -1297,4 +1354,8 @@ def run_suite(a, work: str) -> int:
1297 1354
1298 1355
1299if __name__ == "__main__": 1356if __name__ == "__main__":
1357 try: # a redirected stdout is strict ANSI code page under -I; write '?' for what it cannot encode
1358 sys.stdout.reconfigure(errors="replace")
1359 except (AttributeError, ValueError, OSError):
1360 pass
1300 sys.exit(main()) 1361 sys.exit(main())