diff options
Diffstat (limited to 'scripts/run_gpu_tests.py')
| -rw-r--r-- | scripts/run_gpu_tests.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index a075c876a..e8fce4277 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -36,6 +36,7 @@ from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, CVT_PK_U8_WORDS, PK_MUL_ | |||
| 36 | from check import SIGNED_MIP_TEST, UINT_MIP_TEST | 36 | from check import SIGNED_MIP_TEST, UINT_MIP_TEST |
| 37 | from check import cbv_modulate_test | 37 | from check import cbv_modulate_test |
| 38 | from check import HEAP_INIT_EXPECTED, heap_init_env # cs_heap_init: vk_compute_test's VKC_HEAP_INIT | 38 | from check import HEAP_INIT_EXPECTED, heap_init_env # cs_heap_init: vk_compute_test's VKC_HEAP_INIT |
| 39 | from check import shift64_test # dynamic 64-bit vector shifts and overlapping destinations | ||
| 39 | from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan) | 40 | from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan) |
| 40 | from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py | 41 | from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py |
| 41 | from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 | 42 | from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 |
| @@ -149,8 +150,13 @@ def spirv_as(asm_text: str, out_spv: str, assembler: str = "spirv-as") -> None: | |||
| 149 | with open(out_spv, "wb") as f: | 150 | with open(out_spv, "wb") as f: |
| 150 | f.write(spv_bytes) | 151 | f.write(spv_bytes) |
| 151 | return | 152 | return |
| 152 | p = subprocess.run(["spirv-as", "--target-env", "vulkan1.2", "-o", out_spv, "-"], | 153 | try: |
| 153 | input=asm_text, capture_output=True, text=True) | 154 | p = subprocess.run(["spirv-as", "--target-env", "vulkan1.2", "-o", out_spv, "-"], |
| 155 | input=asm_text, capture_output=True, text=True) | ||
| 156 | except FileNotFoundError: | ||
| 157 | raise RuntimeError("spirv-as not found on PATH (use --assembler python to assemble with tools/spirv_asm.py)") from None | ||
| 158 | except OSError as exc: | ||
| 159 | raise RuntimeError(f"spirv-as could not be started: {exc.strerror or exc}") from None | ||
| 154 | if p.returncode != 0: | 160 | if p.returncode != 0: |
| 155 | raise RuntimeError(f"spirv-as failed for {out_spv}:\n{p.stderr}") | 161 | raise RuntimeError(f"spirv-as failed for {out_spv}:\n{p.stderr}") |
| 156 | 162 | ||
| @@ -258,6 +264,8 @@ def read_raw_u32(path: str) -> list[tuple[int, int, int, int]]: | |||
| 258 | return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)] | 264 | return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)] |
| 259 | 265 | ||
| 260 | 266 | ||
| 267 | # cs_div_fmas_f64_rt's operands a = 1 + 2^-30, c = -(1 + 2^-29) as s4..s7 (low word first). | ||
| 268 | DIV_FMAS_F64_SGPRS = "0x00400000,0x3ff00000,0x00800000,0xbff00000" | ||
| 261 | UNSUPPORTED = 77 # vk_harness: the device lacks a stage the test draws with (geometry or mesh shaders) | 269 | UNSUPPORTED = 77 # vk_harness: the device lacks a stage the test draws with (geometry or mesh shaders) |
| 262 | 270 | ||
| 263 | 271 | ||
| @@ -975,6 +983,10 @@ def run_suite(a, work: str) -> int: | |||
| 975 | if name in CLIP_CASES: | 983 | if name in CLIP_CASES: |
| 976 | detail = clip_test(a.build, spirv_dir, name) | 984 | detail = clip_test(a.build, spirv_dir, name) |
| 977 | results.append((name, None if isinstance(detail, Skip) else not detail, detail or "four pixel masks exact")) | 985 | results.append((name, None if isinstance(detail, Skip) else not detail, detail or "four pixel masks exact")) |
| 986 | elif name == "cs_w32_shift64": | ||
| 987 | detail = shift64_test(a.build, spirv_dir, cs_env) | ||
| 988 | results.append((name, None if isinstance(detail, Skip) else not detail, | ||
| 989 | detail or "640 words exact (64 shift cases and unchanged inputs)")) | ||
| 978 | elif name == "cs_workgroup_yz": | 990 | elif name == "cs_workgroup_yz": |
| 979 | rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env) | 991 | rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env) |
| 980 | results.append((name,) + compute_result(rc, msg, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" | 992 | results.append((name,) + compute_result(rc, msg, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" |
| @@ -1092,10 +1104,12 @@ def run_suite(a, work: str) -> int: | |||
| 1092 | ok, detail = judge_cs_dump(rc, msg, [0, 0x40040000], wave64=False, partial=False, emulated=False, | 1104 | ok, detail = judge_cs_dump(rc, msg, [0, 0x40040000], wave64=False, partial=False, emulated=False, |
| 1093 | hexwords=True) | 1105 | hexwords=True) |
| 1094 | results.append((name, ok, detail)) | 1106 | results.append((name, ok, detail)) |
| 1095 | elif name == "cs_div_fmas_f64": | 1107 | elif name in ("cs_div_fmas_f64", "cs_div_fmas_f64_rt"): |
| 1096 | # One-rounding binary64 FMA: strict where the translator emitted OpFmaKHR on doubles (shaderFmaFloat64, | 1108 | # One-rounding binary64 FMA: strict where the translator emitted OpFmaKHR on doubles (shaderFmaFloat64, |
| 1097 | # --fma khr); under the default GLSL Fma the split result (0) is allowed, as cs_fma_fused allows it. | 1109 | # --fma khr); under the default GLSL Fma the split result (0) is allowed, as cs_fma_fused allows it. |
| 1098 | rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=cs_env) | 1110 | # The _rt fixture reads the same operands from s4..s7, so the driver cannot fold the Fma at compile time. |
| 1111 | env = dict(cs_env or os.environ, VKC_SGPRS=DIV_FMAS_F64_SGPRS) if name.endswith("_rt") else cs_env | ||
| 1112 | rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=env) | ||
| 1099 | if rc == UNSUPPORTED: # no shaderFloat64, or (--fma khr) no shaderFmaFloat64 | 1113 | if rc == UNSUPPORTED: # no shaderFloat64, or (--fma khr) no shaderFmaFloat64 |
| 1100 | results.append((name, None, unsupported_skip(msg))) | 1114 | results.append((name, None, unsupported_skip(msg))) |
| 1101 | else: | 1115 | else: |
| @@ -1105,7 +1119,8 @@ def run_suite(a, work: str) -> int: | |||
| 1105 | ok = rc == 0 and (words == fused or (not strict and words == split)) | 1119 | ok = rc == 0 and (words == fused or (not strict and words == split)) |
| 1106 | detail = " ".join(hex(x) for x in words) if words else msg | 1120 | detail = " ".join(hex(x) for x in words) if words else msg |
| 1107 | if ok and words == split: | 1121 | if ok and words == split: |
| 1108 | detail += " (split: the driver rounds GLSL Fma on doubles twice; --fma khr fixes it)" | 1122 | detail += (" (split: the driver rounded GLSL Fma on doubles twice%s; --fma khr fixes it)" |
| 1123 | % ("" if name.endswith("_rt") else " when folding the constants")) | ||
| 1109 | results.append((name, ok, detail)) | 1124 | results.append((name, ok, detail)) |
| 1110 | elif name == "cs_cvt_f32_sat": | 1125 | elif name == "cs_cvt_f32_sat": |
| 1111 | # #300's saturating float -> int conversions: one dispatch per input word in s4 (VKC_SGPRS). | 1126 | # #300's saturating float -> int conversions: one dispatch per input word in s4 (VKC_SGPRS). |
| @@ -1320,6 +1335,9 @@ def run_suite(a, work: str) -> int: | |||
| 1320 | elif name == "cs_imgstore": | 1335 | elif name == "cs_imgstore": |
| 1321 | rc, msg = run_cmd([vk_store, spv]) | 1336 | rc, msg = run_cmd([vk_store, spv]) |
| 1322 | results.append((name, *helper_result(rc, msg))) | 1337 | results.append((name, *helper_result(rc, msg))) |
| 1338 | elif name == "cs_imgstore_cube": # GPU-CUBE-STORE: six-layer 2D-array views at bindings 11/12/13 | ||
| 1339 | rc, msg = run_cmd([vk_store, spv, "cube"]) | ||
| 1340 | results.append((name, *helper_result(rc, msg))) | ||
| 1323 | elif name in ("cs_imgload", "cs_imgload_tfe", "cs_imgload_d16", "cs_imgload_d16_tfe", "cs_sample_lz_int_d16"): | 1341 | elif name in ("cs_imgload", "cs_imgload_tfe", "cs_imgload_d16", "cs_imgload_d16_tfe", "cs_sample_lz_int_d16"): |
| 1324 | rc, msg = run_cmd([vk_store, spv, "load" if name in ("cs_imgload", "cs_imgload_tfe") else "load-d16"]) | 1342 | rc, msg = run_cmd([vk_store, spv, "load" if name in ("cs_imgload", "cs_imgload_tfe") else "load-d16"]) |
| 1325 | results.append((name, *helper_result(rc, msg))) | 1343 | results.append((name, *helper_result(rc, msg))) |