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:
authorEmma <47298336+zzEmmazz@users.noreply.github.com>2026-11-22 23:37:05 +0200
committerEmma <47298336+zzEmmazz@users.noreply.github.com>2026-11-22 23:37:05 +0200
commitd4d8c9c3a9b503e698d41b9a08247b9e5cfacc96 (patch)
tree4f2a3f8c6f8fb30f77761dde167aa7787382dd40 /scripts/run_gpu_tests.py
parentf847748cc76bd3777f9c070c4034eb2fc1c04e64 (diff)
run_gpu_tests: a test program that dies puts its exit status in the FAIL line
Nineteen rows show the last output line of a test program that judges itself (cs_wavemask, cs_lds, cs_exec64, cs_bvh, cs_bvh32, the vk_store_test, vk_texture_test and vk_bindless_test rows). A program that died before its verdict had only printed its device or extension line, or nothing, so the row read "FAIL ps_tex" or "FAIL cs_sample_lz_int_d16 device: ..." (#3174). verdict_line() keeps the last line for exit 0 and uses check.py's failure() otherwise: "exit -11: device: ...", "exit 3221225477: no test output". The texture-constant rows no longer report "4096 pixels differ" for a frame that was never read. Pass/fail and the suite's exit code do not change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'scripts/run_gpu_tests.py')
-rw-r--r--scripts/run_gpu_tests.py31
1 files changed, 21 insertions, 10 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index 7cd0e9dbf..86913fdaa 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -36,6 +36,7 @@ from check import judged_words, words_match # dump words not judged on some de
36from 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
37from 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
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 failure # "exit <status>: <last lines>", check.py's detail for a program that exited non-zero
39from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS 40from 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, 41from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip,
41 unpinned_subgroup_skip, vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py 42 unpinned_subgroup_skip, vcmpx_forms_narrow_skip, wave32_lane_skip) # as in check.py
@@ -239,6 +240,14 @@ 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
243def verdict_line(rc: int, msg: str) -> str:
244 """The detail of a row whose test program judges itself and prints its verdict last: that line. A program that
245 exited non-zero gets its exit status in front, as in check.py, so one that died before its verdict (exit -11 on
246 Linux, 3221225477 = 0xC0000005 on Windows) does not read as a FAIL with only its device or extension line, or
247 with no detail at all."""
248 return failure(rc, msg, 1) if rc else msg.splitlines()[-1] if msg else ""
249
250
242def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True, *, 251def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True, *,
243 cwd: str | None = None) -> tuple[int, str]: 252 cwd: str | None = None) -> tuple[int, str]:
244 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT). 253 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT).
@@ -309,7 +318,7 @@ def wavemask_check(vk_compute: str, spv: str, env: dict | None, emulated: bool)
309 return None, "SKIP (no 64-wide compute subgroup on this device)" 318 return None, "SKIP (no 64-wide compute subgroup on this device)"
310 if not emulated and rc == 0 and "compute subgroup size: 64" not in msg.splitlines(): 319 if not emulated and rc == 0 and "compute subgroup size: 64" not in msg.splitlines():
311 return False, "64-wide subgroup was not confirmed (rebuild vk_compute_test)" 320 return False, "64-wide subgroup was not confirmed (rebuild vk_compute_test)"
312 return rc == 0, msg.splitlines()[-1] if msg else "" 321 return rc == 0, verdict_line(rc, msg)
313def dump_words(msg: str) -> list[int] | None: 322def dump_words(msg: str) -> list[int] | None:
314 """The eight words of vk_compute_test's "out[0..7] = ..." line, or None unless it is eight decimal words (as in 323 """The eight words of vk_compute_test's "out[0..7] = ..." line, or None unless it is eight decimal words (as in
315 check.py): trailing text, a missing word or a non-number is a malformed dump, not a result.""" 324 check.py): trailing text, a missing word or a non-number is a malformed dump, not a result."""
@@ -807,13 +816,13 @@ def run_suite(a, work: str) -> int:
807 results.append((name, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" in msg.splitlines(), msg)) 816 results.append((name, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" in msg.splitlines(), msg))
808 elif name == "cs_lds": 817 elif name == "cs_lds":
809 rc, msg = run_cmd([vk_compute, spv, "4", "mirror64"], env=cs_env) 818 rc, msg = run_cmd([vk_compute, spv, "4", "mirror64"], env=cs_env)
810 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 819 results.append((name, rc == 0, verdict_line(rc, msg)))
811 elif name == "cs_exec64": 820 elif name == "cs_exec64":
812 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env) 821 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env)
813 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 822 results.append((name, rc == 0, verdict_line(rc, msg)))
814 elif name in ("cs_bvh", "cs_bvh32"): # the 64-bit and the 32-bit node pointer: one scene, the same words 823 elif name in ("cs_bvh", "cs_bvh32"): # the 64-bit and the 32-bit node pointer: one scene, the same words
815 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env) 824 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env)
816 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 825 results.append((name, rc == 0, verdict_line(rc, msg)))
817 elif name in STORE_WORDS: 826 elif name in STORE_WORDS:
818 # TEST-184: image atomics (cs_imgatomic, cs_imgatomic3d) and image_get_resinfo (cs_resinfo). vk_store_test 827 # TEST-184: image atomics (cs_imgatomic, cs_imgatomic3d) and image_get_resinfo (cs_resinfo). vk_store_test
819 # binds the images and prints the r32 ones after the dispatch; the expected words are check.py's. 828 # binds the images and prints the r32 ones after the dispatch; the expected words are check.py's.
@@ -1055,10 +1064,10 @@ def run_suite(a, work: str) -> int:
1055 results.append((name, ok, detail)) 1064 results.append((name, ok, detail))
1056 elif name == "cs_imgstore": 1065 elif name == "cs_imgstore":
1057 rc, msg = run_cmd([vk_store, spv]) 1066 rc, msg = run_cmd([vk_store, spv])
1058 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 1067 results.append((name, rc == 0, verdict_line(rc, msg)))
1059 elif name in ("cs_imgload", "cs_imgload_d16", "cs_sample_lz_int_d16"): 1068 elif name in ("cs_imgload", "cs_imgload_d16", "cs_sample_lz_int_d16"):
1060 rc, msg = run_cmd([vk_store, spv, "load" if name == "cs_imgload" else "load-d16"]) 1069 rc, msg = run_cmd([vk_store, spv, "load" if name == "cs_imgload" else "load-d16"])
1061 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 1070 results.append((name, rc == 0, verdict_line(rc, msg)))
1062 elif name in MIP_TEST_PASSES: 1071 elif name in MIP_TEST_PASSES:
1063 problem = texture_mip_test(a.build, spirv_dir, name) 1072 problem = texture_mip_test(a.build, spirv_dir, name)
1064 ok = None if isinstance(problem, Skip) else not problem 1073 ok = None if isinstance(problem, Skip) else not problem
@@ -1086,7 +1095,7 @@ def run_suite(a, work: str) -> int:
1086 ok, detail = check_d16_texture(raw) if os.path.isfile(raw) else (False, "missing RGBA32F readback") 1095 ok, detail = check_d16_texture(raw) if os.path.isfile(raw) else (False, "missing RGBA32F readback")
1087 results.append((name, ok, detail)) 1096 results.append((name, ok, detail))
1088 else: 1097 else:
1089 results.append((name, rc == 0 and "PASSED" in msg, msg.splitlines()[-1] if msg else "")) 1098 results.append((name, rc == 0 and "PASSED" in msg, verdict_line(rc, msg)))
1090 elif name in TEXTURE_CONSTANTS: 1099 elif name in TEXTURE_CONSTANTS:
1091 expected = TEXTURE_CONSTANTS[name] 1100 expected = TEXTURE_CONSTANTS[name]
1092 tool = os.path.join(a.build, "vk_texture_test" + ext) 1101 tool = os.path.join(a.build, "vk_texture_test" + ext)
@@ -1100,8 +1109,10 @@ def run_suite(a, work: str) -> int:
1100 if rc == UNSUPPORTED: 1109 if rc == UNSUPPORTED:
1101 results.append((name, None, unsupported_skip(msg))) 1110 results.append((name, None, unsupported_skip(msg)))
1102 else: 1111 else:
1103 results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else 1112 detail = ("4096/4096 pixels exact" if bad == 0 else
1104 f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}")) 1113 f"{bad} pixels differ from {expected}: {verdict_line(0, msg)}")
1114 # After a non-zero exit no frame was compared: the exit status, not a pixel count.
1115 results.append((name, rc == 0 and bad == 0, verdict_line(rc, msg) if rc else detail))
1105 elif name in ("ps_tex", "ps_imgatomic"): 1116 elif name in ("ps_tex", "ps_imgatomic"):
1106 # A texture through the descriptor hash table and the bindless set (ps_tex), or image atomics in a pixel 1117 # A texture through the descriptor hash table and the bindless set (ps_tex), or image atomics in a pixel
1107 # shader through the set's r32ui storage arrays (ps_imgatomic, drawn with vs_ids). vk_bindless_test 1118 # shader through the set's r32ui storage arrays (ps_imgatomic, drawn with vs_ids). vk_bindless_test
@@ -1113,7 +1124,7 @@ def run_suite(a, work: str) -> int:
1113 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device") 1124 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device")
1114 results.append((name, None, f"SKIP ({reason})")) 1125 results.append((name, None, f"SKIP ({reason})"))
1115 else: 1126 else:
1116 results.append((name, rc == 0, lines[-1] if lines else "")) 1127 results.append((name, rc == 0, verdict_line(rc, msg)))
1117 elif name == "ps_ssharp": 1128 elif name == "ps_ssharp":
1118 # The S#/T# mip fields through vulkan_sampler() and the view range (check.py's SAMPLER_CASES). 1129 # The S#/T# mip fields through vulkan_sampler() and the view range (check.py's SAMPLER_CASES).
1119 problem = sampler_test(a.build, spirv_dir) 1130 problem = sampler_test(a.build, spirv_dir)