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:
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 ea0fb455f..4a9a79b64 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -38,6 +38,7 @@ from check import judged_words, words_match # dump words not judged on some de
38from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py 38from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py
39from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 39from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8
40from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) 40from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT)
41from check import failure # "exit <status>: <last lines>", check.py's detail for a program that exited non-zero
41from check import run_readback 42from check import run_readback
42from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS 43from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS
43from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, 44from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip,
@@ -245,6 +246,14 @@ def unsupported_skip(msg: str) -> str:
245 return f"SKIP ({m.group(0) if m else 'unsupported device'})" 246 return f"SKIP ({m.group(0) if m else 'unsupported device'})"
246 247
247 248
249def verdict_line(rc: int, msg: str) -> str:
250 """The detail of a row whose test program judges itself and prints its verdict last: that line. A program that
251 exited non-zero gets its exit status in front, as in check.py, so one that died before its verdict (exit -11 on
252 Linux, 3221225477 = 0xC0000005 on Windows) does not read as a FAIL with only its device or extension line, or
253 with no detail at all."""
254 return failure(rc, msg, 1) if rc else msg.splitlines()[-1] if msg else ""
255
256
248def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True, *, 257def run_cmd(cmd: list[str], env: dict | None = None, gpu: bool = True, *,
249 cwd: str | None = None) -> tuple[int, str]: 258 cwd: str | None = None) -> tuple[int, str]:
250 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT). 259 # A hung GPU test program fails its test instead of stalling the suite (check.py, LEONIDA_GPU_TEST_TIMEOUT).
@@ -315,7 +324,7 @@ def wavemask_check(vk_compute: str, spv: str, env: dict | None, emulated: bool)
315 return None, "SKIP (no 64-wide compute subgroup on this device)" 324 return None, "SKIP (no 64-wide compute subgroup on this device)"
316 if not emulated and rc == 0 and "compute subgroup size: 64" not in msg.splitlines(): 325 if not emulated and rc == 0 and "compute subgroup size: 64" not in msg.splitlines():
317 return False, "64-wide subgroup was not confirmed (rebuild vk_compute_test)" 326 return False, "64-wide subgroup was not confirmed (rebuild vk_compute_test)"
318 return rc == 0, msg.splitlines()[-1] if msg else "" 327 return rc == 0, verdict_line(rc, msg)
319def dump_words(msg: str) -> list[int] | None: 328def dump_words(msg: str) -> list[int] | None:
320 """The eight words of vk_compute_test's "out[0..7] = ..." line, or None unless it is eight decimal words (as in 329 """The eight words of vk_compute_test's "out[0..7] = ..." line, or None unless it is eight decimal words (as in
321 check.py): trailing text, a missing word or a non-number is a malformed dump, not a result.""" 330 check.py): trailing text, a missing word or a non-number is a malformed dump, not a result."""
@@ -859,13 +868,13 @@ def run_suite(a, work: str) -> int:
859 results.append((name, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" in msg.splitlines(), msg)) 868 results.append((name, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" in msg.splitlines(), msg))
860 elif name == "cs_lds": 869 elif name == "cs_lds":
861 rc, msg = run_cmd([vk_compute, spv, "4", "mirror64"], env=cs_env) 870 rc, msg = run_cmd([vk_compute, spv, "4", "mirror64"], env=cs_env)
862 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 871 results.append((name, rc == 0, verdict_line(rc, msg)))
863 elif name == "cs_exec64": 872 elif name == "cs_exec64":
864 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env) 873 rc, msg = run_cmd([vk_compute, spv, "1", "exec64"], env=cs_env)
865 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 874 results.append((name, rc == 0, verdict_line(rc, msg)))
866 elif name in ("cs_bvh", "cs_bvh32"): # the 64-bit and the 32-bit node pointer: one scene, the same words 875 elif name in ("cs_bvh", "cs_bvh32"): # the 64-bit and the 32-bit node pointer: one scene, the same words
867 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env) 876 rc, msg = run_cmd([vk_compute, spv, "1", "bvh"], env=cs_env)
868 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 877 results.append((name, rc == 0, verdict_line(rc, msg)))
869 elif name in STORE_WORDS: 878 elif name in STORE_WORDS:
870 # TEST-184: image atomics (cs_imgatomic, cs_imgatomic3d) and image_get_resinfo (cs_resinfo). vk_store_test 879 # TEST-184: image atomics (cs_imgatomic, cs_imgatomic3d) and image_get_resinfo (cs_resinfo). vk_store_test
871 # binds the images and prints the r32 ones after the dispatch; the expected words are check.py's. 880 # binds the images and prints the r32 ones after the dispatch; the expected words are check.py's.
@@ -1144,10 +1153,10 @@ def run_suite(a, work: str) -> int:
1144 results.append((name, ok, detail)) 1153 results.append((name, ok, detail))
1145 elif name == "cs_imgstore": 1154 elif name == "cs_imgstore":
1146 rc, msg = run_cmd([vk_store, spv]) 1155 rc, msg = run_cmd([vk_store, spv])
1147 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 1156 results.append((name, rc == 0, verdict_line(rc, msg)))
1148 elif name in ("cs_imgload", "cs_imgload_d16", "cs_sample_lz_int_d16"): 1157 elif name in ("cs_imgload", "cs_imgload_d16", "cs_sample_lz_int_d16"):
1149 rc, msg = run_cmd([vk_store, spv, "load" if name == "cs_imgload" else "load-d16"]) 1158 rc, msg = run_cmd([vk_store, spv, "load" if name == "cs_imgload" else "load-d16"])
1150 results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) 1159 results.append((name, rc == 0, verdict_line(rc, msg)))
1151 elif name in MIP_TEST_PASSES: 1160 elif name in MIP_TEST_PASSES:
1152 problem = texture_mip_test(a.build, spirv_dir, name) 1161 problem = texture_mip_test(a.build, spirv_dir, name)
1153 ok = None if isinstance(problem, Skip) else not problem 1162 ok = None if isinstance(problem, Skip) else not problem
@@ -1175,7 +1184,7 @@ def run_suite(a, work: str) -> int:
1175 ok, detail = check_d16_texture(raw) 1184 ok, detail = check_d16_texture(raw)
1176 results.append((name, ok, detail)) 1185 results.append((name, ok, detail))
1177 else: 1186 else:
1178 results.append((name, rc == 0 and "PASSED" in msg, msg.splitlines()[-1] if msg else "")) 1187 results.append((name, rc == 0 and "PASSED" in msg, verdict_line(rc, msg)))
1179 elif name in TEXTURE_CONSTANTS: 1188 elif name in TEXTURE_CONSTANTS:
1180 expected = TEXTURE_CONSTANTS[name] 1189 expected = TEXTURE_CONSTANTS[name]
1181 tool = os.path.join(a.build, "vk_texture_test" + ext) 1190 tool = os.path.join(a.build, "vk_texture_test" + ext)
@@ -1189,8 +1198,10 @@ def run_suite(a, work: str) -> int:
1189 if rc == UNSUPPORTED: 1198 if rc == UNSUPPORTED:
1190 results.append((name, None, unsupported_skip(msg))) 1199 results.append((name, None, unsupported_skip(msg)))
1191 else: 1200 else:
1192 results.append((name, rc == 0 and bad == 0, "4096/4096 pixels exact" if bad == 0 else 1201 detail = ("4096/4096 pixels exact" if bad == 0 else
1193 f"{bad} pixels differ from {expected}: {msg.splitlines()[-1] if msg else ''}")) 1202 f"{bad} pixels differ from {expected}: {verdict_line(0, msg)}")
1203 # After a non-zero exit no frame was compared: the exit status, not a pixel count.
1204 results.append((name, rc == 0 and bad == 0, verdict_line(rc, msg) if rc else detail))
1194 elif name in ("ps_tex", "ps_imgatomic"): 1205 elif name in ("ps_tex", "ps_imgatomic"):
1195 # A texture through the descriptor hash table and the bindless set (ps_tex), or image atomics in a pixel 1206 # A texture through the descriptor hash table and the bindless set (ps_tex), or image atomics in a pixel
1196 # shader through the set's r32ui storage arrays (ps_imgatomic, drawn with vs_ids). vk_bindless_test 1207 # shader through the set's r32ui storage arrays (ps_imgatomic, drawn with vs_ids). vk_bindless_test
@@ -1202,7 +1213,7 @@ def run_suite(a, work: str) -> int:
1202 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device") 1213 reason = next((ln for ln in lines if ln.startswith("unsupported:")), "unsupported device")
1203 results.append((name, None, f"SKIP ({reason})")) 1214 results.append((name, None, f"SKIP ({reason})"))
1204 else: 1215 else:
1205 results.append((name, rc == 0, lines[-1] if lines else "")) 1216 results.append((name, rc == 0, verdict_line(rc, msg)))
1206 elif name == "ps_ssharp": 1217 elif name == "ps_ssharp":
1207 # The S#/T# mip fields through vulkan_sampler() and the view range (check.py's SAMPLER_CASES). 1218 # The S#/T# mip fields through vulkan_sampler() and the view range (check.py's SAMPLER_CASES).
1208 problem = sampler_test(a.build, spirv_dir) 1219 problem = sampler_test(a.build, spirv_dir)