diff options
Diffstat (limited to 'scripts/run_gpu_tests.py')
| -rw-r--r-- | scripts/run_gpu_tests.py | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index 80b380d9e..fef03e9c9 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -37,6 +37,9 @@ 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 shift64_test # dynamic 64-bit vector shifts and overlapping destinations |
| 40 | from check import cmp_f64_test # the 32 binary64 vector compares on memory-fed operands | ||
| 41 | from check import round_f64_test # the four binary64 roundings on memory-fed inputs | ||
| 42 | from check import frexp_ldexp_test # binary32 and binary64 frexp, and v_ldexp_f32, on memory-fed records | ||
| 40 | from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan) | 43 | from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan) |
| 41 | from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py | 44 | from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py |
| 42 | from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 | 45 | from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 |
| @@ -94,10 +97,23 @@ def make_ms_psv0(threads_x: int, maxv: int, maxp: int, topology: int = 2, group_ | |||
| 94 | return struct.pack("<I", len(r)) + bytes(r) | 97 | return struct.pack("<I", len(r)) + bytes(r) |
| 95 | 98 | ||
| 96 | 99 | ||
| 100 | # A comment line a .asm carries when llvm-mc cannot assemble it (cs_dpp_cmp.asm: a VOPC compare in DPP form). | ||
| 101 | TEXT_ONLY_MARK = "; run_gpu_tests: text only, llvm-mc has no gfx1013 encoding for an instruction here" | ||
| 102 | |||
| 103 | |||
| 97 | def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: | 104 | def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: |
| 98 | """Assemble raw RDNA2 .asm with llvm-mc -show-encoding into .s format for rdna2spirv.py.""" | 105 | """Assemble raw RDNA2 .asm with llvm-mc -show-encoding into .s format for rdna2spirv.py.""" |
| 99 | with open(asm_path, encoding="utf-8") as source: | 106 | with open(asm_path, encoding="utf-8") as source: |
| 100 | raw = source.read() | 107 | raw = source.read() |
| 108 | if any(ln.strip() == TEXT_ONLY_MARK for ln in raw.splitlines()): | ||
| 109 | # The source holds an instruction llvm-mc has no gfx1013 encoding for. The translator reads straight-line | ||
| 110 | # code from its text alone (tests/semantic/regen_fixtures.py writes such listings), so the lines go through | ||
| 111 | # as they are. | ||
| 112 | lines = [f"; {name} code 0x0..0x0 (synthetic), gfx1013, 0 invalid words"] | ||
| 113 | lines += ["\t" + ln.strip() for ln in raw.splitlines() if ln.strip() and not ln.lstrip().startswith(";")] | ||
| 114 | with open(s_path, "w", encoding="utf-8", newline="\n") as f: | ||
| 115 | f.write("\n".join(lines) + "\n") | ||
| 116 | return | ||
| 101 | cmd = mc_command.mc_command(llvm_mc) + ["-triple=amdgcn--amdpal", "-mcpu=gfx1013"] | 117 | cmd = mc_command.mc_command(llvm_mc) + ["-triple=amdgcn--amdpal", "-mcpu=gfx1013"] |
| 102 | for ln in raw.splitlines(): | 118 | for ln in raw.splitlines(): |
| 103 | s = ln.strip() | 119 | s = ln.strip() |
| @@ -264,6 +280,8 @@ def read_raw_u32(path: str) -> list[tuple[int, int, int, int]]: | |||
| 264 | return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)] | 280 | return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)] |
| 265 | 281 | ||
| 266 | 282 | ||
| 283 | # cs_div_fmas_f64_rt's operands a = 1 + 2^-30, c = -(1 + 2^-29) as s4..s7 (low word first). | ||
| 284 | DIV_FMAS_F64_SGPRS = "0x00400000,0x3ff00000,0x00800000,0xbff00000" | ||
| 267 | UNSUPPORTED = 77 # vk_harness: the device lacks a stage the test draws with (geometry or mesh shaders) | 285 | UNSUPPORTED = 77 # vk_harness: the device lacks a stage the test draws with (geometry or mesh shaders) |
| 268 | 286 | ||
| 269 | 287 | ||
| @@ -429,8 +447,10 @@ def judge_cs_dump(rc: int, msg: str, want: list[int], *, wave64: bool, partial: | |||
| 429 | return None, "SKIP (no 64-wide compute subgroup on this device)" | 447 | return None, "SKIP (no 64-wide compute subgroup on this device)" |
| 430 | if rc == 0 and wave64 and "compute subgroup size: 64" not in msg.splitlines(): | 448 | if rc == 0 and wave64 and "compute subgroup size: 64" not in msg.splitlines(): |
| 431 | return False, "64-wide subgroup was not confirmed (rebuild vk_compute_test)" | 449 | return False, "64-wide subgroup was not confirmed (rebuild vk_compute_test)" |
| 450 | if rc != 0: | ||
| 451 | return False, f"exit {rc}: {msg or 'no test output'}" | ||
| 432 | words = dump_words(msg) | 452 | words = dump_words(msg) |
| 433 | if rc != 0 or words is None: | 453 | if words is None: |
| 434 | return False, msg | 454 | return False, msg |
| 435 | vals = words[:len(want)] | 455 | vals = words[:len(want)] |
| 436 | return words_match(vals, want), " ".join((hex if hexwords else str)(x) for x in vals) | 456 | return words_match(vals, want), " ".join((hex if hexwords else str)(x) for x in vals) |
| @@ -981,10 +1001,22 @@ def run_suite(a, work: str) -> int: | |||
| 981 | if name in CLIP_CASES: | 1001 | if name in CLIP_CASES: |
| 982 | detail = clip_test(a.build, spirv_dir, name) | 1002 | detail = clip_test(a.build, spirv_dir, name) |
| 983 | results.append((name, None if isinstance(detail, Skip) else not detail, detail or "four pixel masks exact")) | 1003 | results.append((name, None if isinstance(detail, Skip) else not detail, detail or "four pixel masks exact")) |
| 1004 | elif name == "cs_w32_frexp_ldexp": | ||
| 1005 | detail = frexp_ldexp_test(a.build, spirv_dir, cs_env) | ||
| 1006 | results.append((name, None if isinstance(detail, Skip) else not detail, | ||
| 1007 | detail or "768 words exact (64 records, eight results each, and unchanged inputs)")) | ||
| 984 | elif name == "cs_w32_shift64": | 1008 | elif name == "cs_w32_shift64": |
| 985 | detail = shift64_test(a.build, spirv_dir, cs_env) | 1009 | detail = shift64_test(a.build, spirv_dir, cs_env) |
| 986 | results.append((name, None if isinstance(detail, Skip) else not detail, | 1010 | results.append((name, None if isinstance(detail, Skip) else not detail, |
| 987 | detail or "640 words exact (64 shift cases and unchanged inputs)")) | 1011 | detail or "640 words exact (64 shift cases and unchanged inputs)")) |
| 1012 | elif name == "cs_w32_cmp_f64": | ||
| 1013 | detail = cmp_f64_test(a.build, spirv_dir, cs_env) | ||
| 1014 | results.append((name, None if isinstance(detail, Skip) else not detail, | ||
| 1015 | detail or "1536 words exact (256 operand pairs and unchanged inputs)")) | ||
| 1016 | elif name == "cs_w32_round_f64": | ||
| 1017 | detail = round_f64_test(a.build, spirv_dir, cs_env) | ||
| 1018 | results.append((name, None if isinstance(detail, Skip) else not detail, | ||
| 1019 | detail or "1152 words exact (64 inputs, eight roundings each, and unchanged inputs)")) | ||
| 988 | elif name == "cs_workgroup_yz": | 1020 | elif name == "cs_workgroup_yz": |
| 989 | rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env) | 1021 | rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env) |
| 990 | results.append((name,) + compute_result(rc, msg, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" | 1022 | results.append((name,) + compute_result(rc, msg, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" |
| @@ -1102,10 +1134,12 @@ def run_suite(a, work: str) -> int: | |||
| 1102 | ok, detail = judge_cs_dump(rc, msg, [0, 0x40040000], wave64=False, partial=False, emulated=False, | 1134 | ok, detail = judge_cs_dump(rc, msg, [0, 0x40040000], wave64=False, partial=False, emulated=False, |
| 1103 | hexwords=True) | 1135 | hexwords=True) |
| 1104 | results.append((name, ok, detail)) | 1136 | results.append((name, ok, detail)) |
| 1105 | elif name == "cs_div_fmas_f64": | 1137 | elif name in ("cs_div_fmas_f64", "cs_div_fmas_f64_rt"): |
| 1106 | # One-rounding binary64 FMA: strict where the translator emitted OpFmaKHR on doubles (shaderFmaFloat64, | 1138 | # One-rounding binary64 FMA: strict where the translator emitted OpFmaKHR on doubles (shaderFmaFloat64, |
| 1107 | # --fma khr); under the default GLSL Fma the split result (0) is allowed, as cs_fma_fused allows it. | 1139 | # --fma khr); under the default GLSL Fma the split result (0) is allowed, as cs_fma_fused allows it. |
| 1108 | rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=cs_env) | 1140 | # The _rt fixture reads the same operands from s4..s7, so the driver cannot fold the Fma at compile time. |
| 1141 | env = dict(cs_env or os.environ, VKC_SGPRS=DIV_FMAS_F64_SGPRS) if name.endswith("_rt") else cs_env | ||
| 1142 | rc, msg = run_cmd([vk_compute, spv, "1", "dump"], env=env) | ||
| 1109 | if rc == UNSUPPORTED: # no shaderFloat64, or (--fma khr) no shaderFmaFloat64 | 1143 | if rc == UNSUPPORTED: # no shaderFloat64, or (--fma khr) no shaderFmaFloat64 |
| 1110 | results.append((name, None, unsupported_skip(msg))) | 1144 | results.append((name, None, unsupported_skip(msg))) |
| 1111 | else: | 1145 | else: |
| @@ -1115,7 +1149,8 @@ def run_suite(a, work: str) -> int: | |||
| 1115 | ok = rc == 0 and (words == fused or (not strict and words == split)) | 1149 | ok = rc == 0 and (words == fused or (not strict and words == split)) |
| 1116 | detail = " ".join(hex(x) for x in words) if words else msg | 1150 | detail = " ".join(hex(x) for x in words) if words else msg |
| 1117 | if ok and words == split: | 1151 | if ok and words == split: |
| 1118 | detail += " (split: the driver rounds GLSL Fma on doubles twice; --fma khr fixes it)" | 1152 | detail += (" (split: the driver rounded GLSL Fma on doubles twice%s; --fma khr fixes it)" |
| 1153 | % ("" if name.endswith("_rt") else " when folding the constants")) | ||
| 1119 | results.append((name, ok, detail)) | 1154 | results.append((name, ok, detail)) |
| 1120 | elif name == "cs_cvt_f32_sat": | 1155 | elif name == "cs_cvt_f32_sat": |
| 1121 | # #300's saturating float -> int conversions: one dispatch per input word in s4 (VKC_SGPRS). | 1156 | # #300's saturating float -> int conversions: one dispatch per input word in s4 (VKC_SGPRS). |
| @@ -1162,7 +1197,7 @@ def run_suite(a, work: str) -> int: | |||
| 1162 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) | 1197 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) |
| 1163 | 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_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", "cs_w32_permlane_fi", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "cs_w32_lds_subdword", "cs_w32_lds_wide", "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", | 1198 | 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_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", "cs_w32_permlane_fi", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "cs_w32_lds_subdword", "cs_w32_lds_wide", "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", |
| 1164 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", | 1199 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", |
| 1165 | "cs_dpp_bound", "cs_dpp_w64", | 1200 | "cs_dpp_bound", "cs_dpp_cmp", "cs_dpp_w64", |
| 1166 | "cs_w64_mask_detect", | 1201 | "cs_w64_mask_detect", |
| 1167 | "cs_w64x_readlane", "cs_w64x_writelane", "cs_w64x_readfirstlane", "cs_w64x_bpermute", "cs_w64x_permute", | 1202 | "cs_w64x_readlane", "cs_w64x_writelane", "cs_w64x_readfirstlane", "cs_w64x_bpermute", "cs_w64x_permute", |
| 1168 | "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw", | 1203 | "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw", |
| @@ -1223,6 +1258,7 @@ def run_suite(a, work: str) -> int: | |||
| 1223 | "cs_dpp_bound": [10, 10, 11, 12, 13, 14, 15, 16], | 1258 | "cs_dpp_bound": [10, 10, 11, 12, 13, 14, 15, 16], |
| 1224 | "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], | 1259 | "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], |
| 1225 | "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], | 1260 | "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], |
| 1261 | "cs_dpp_cmp": [3, 2, 3, 2, 1, 0, 1, 0], | ||
| 1226 | "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], | 1262 | "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], |
| 1227 | # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7] | 1263 | # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7] |
| 1228 | # without it | 1264 | # without it |
| @@ -1297,7 +1333,7 @@ def run_suite(a, work: str) -> int: | |||
| 1297 | "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_partial_permute", "cs_w32_permlane_fi", "cs_w32_sincos", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", | 1333 | "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_partial_permute", "cs_w32_permlane_fi", "cs_w32_sincos", "cs_w32_buffer_sub16", "cs_w32_buffer_store_sub", "cs_w32_fcmpswap", |
| 1298 | "cs_lds_b64_cmpst", "cs_lds_xchg64_ext", "cs_lds_atomics_ext", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec", | 1334 | "cs_lds_b64_cmpst", "cs_lds_xchg64_ext", "cs_lds_atomics_ext", "cs_exec_const", "cs_w32_mask_imm", "cs_mask_vgpr_exec", |
| 1299 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", | 1335 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", |
| 1300 | "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_w32_andn2_exec", | 1336 | "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi", "cs_dpp_cmp", "cs_w32_andn2_exec", |
| 1301 | "cs_w32_exec_computed") and not emulated and not partial | 1337 | "cs_w32_exec_computed") and not emulated and not partial |
| 1302 | if partial and not emulated: | 1338 | if partial and not emulated: |
| 1303 | cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") | 1339 | cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") |
| @@ -1311,7 +1347,7 @@ def run_suite(a, work: str) -> int: | |||
| 1311 | continue | 1347 | continue |
| 1312 | if rc == 0: | 1348 | if rc == 0: |
| 1313 | skip = wave32_lane_skip(msg) | 1349 | skip = wave32_lane_skip(msg) |
| 1314 | if skip is None and name in WAVE32_PIN_DUMPS: | 1350 | if rc == 0 and skip is None and name in WAVE32_PIN_DUMPS: |
| 1315 | # the device may not be able to run the wave size this fixture was written for (a 64-only device | 1351 | # the device may not be able to run the wave size this fixture was written for (a 64-only device |
| 1316 | # can't pin 32, so cs_barrier_loop's words mean nothing); check.py skips it too | 1352 | # can't pin 32, so cs_barrier_loop's words mean nothing); check.py skips it too |
| 1317 | skip = subgroup_pin_skip(msg, cs_env) | 1353 | skip = subgroup_pin_skip(msg, cs_env) |
| @@ -1330,6 +1366,9 @@ def run_suite(a, work: str) -> int: | |||
| 1330 | elif name == "cs_imgstore": | 1366 | elif name == "cs_imgstore": |
| 1331 | rc, msg = run_cmd([vk_store, spv]) | 1367 | rc, msg = run_cmd([vk_store, spv]) |
| 1332 | results.append((name, *helper_result(rc, msg))) | 1368 | results.append((name, *helper_result(rc, msg))) |
| 1369 | elif name == "cs_imgstore_cube": # GPU-CUBE-STORE: six-layer 2D-array views at bindings 11/12/13 | ||
| 1370 | rc, msg = run_cmd([vk_store, spv, "cube"]) | ||
| 1371 | results.append((name, *helper_result(rc, msg))) | ||
| 1333 | elif name in ("cs_imgload", "cs_imgload_tfe", "cs_imgload_d16", "cs_imgload_d16_tfe", "cs_sample_lz_int_d16"): | 1372 | elif name in ("cs_imgload", "cs_imgload_tfe", "cs_imgload_d16", "cs_imgload_d16_tfe", "cs_sample_lz_int_d16"): |
| 1334 | rc, msg = run_cmd([vk_store, spv, "load" if name in ("cs_imgload", "cs_imgload_tfe") else "load-d16"]) | 1373 | rc, msg = run_cmd([vk_store, spv, "load" if name in ("cs_imgload", "cs_imgload_tfe") else "load-d16"]) |
| 1335 | results.append((name, *helper_result(rc, msg))) | 1374 | results.append((name, *helper_result(rc, msg))) |