diff options
| author | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 13:02:26 +0100 |
|---|---|---|
| committer | Vonsek <45567075+Vonsek@users.noreply.github.com> | 2026-11-22 13:02:26 +0100 |
| commit | f94fc77ac203af022144f167b4f434c7337abb47 (patch) | |
| tree | f9dba47b6ef23ea1a7b14786426e7b9c64a0803e /scripts/run_gpu_tests.py | |
| parent | 8ccf429a56bf62ae231d0aa06e043c17bb8a83e2 (diff) | |
| parent | bb2e18421dac527374eb837c88b5063c5d96f81f (diff) | |
Merge main into test/ssharp-mip-fields (#319)
Conflicts were list/registration hunks in runtime/CMakeLists.txt, check.py, run_gpu_tests.py and tests/test_shader_checks.py; kept main's side and re-added vk_sampler_test, ps_ssharp and the TOTAL count.
AI-assisted (Claude Code).
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.py | 177 |
1 files changed, 141 insertions, 36 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index 9693b6ac2..bf60955f1 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -25,7 +25,7 @@ sys.path.insert(0, os.path.join(ROOT, "tools")) | |||
| 25 | import mc_command # noqa: E402 | 25 | import mc_command # noqa: E402 |
| 26 | sys.path.insert(0, SHADER_DIR) | 26 | sys.path.insert(0, SHADER_DIR) |
| 27 | from build import CLIP_CASES, clip_container, shader_source | 27 | from build import CLIP_CASES, clip_container, shader_source |
| 28 | from check import Skip, clip_test, fmt_1010102_test | 28 | from check import Skip, clip_test, fmt_1010102_test, fmt_xy_xyz_test |
| 29 | from compute_fixture import compute_header | 29 | from compute_fixture import compute_header |
| 30 | from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test) | 30 | from check import SAMPLER_CASES, sampler_test # ps_ssharp: the S#/T# mip fields (vk_sampler_test) |
| 31 | from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, | 31 | from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PROGRAMS, TEXTURE_MIP_DEPENDENCIES, |
| @@ -34,7 +34,10 @@ from check import (CMPX_CLASS_WORDS, CVT_F32_SAT_CASES, GRADIENT_TESTS, TEST_PRO | |||
| 34 | from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py | 34 | from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py |
| 35 | from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 | 35 | from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 |
| 36 | from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) | 36 | from check import gpu_test_timeout, timed_out # per-program time limit (LEONIDA_GPU_TEST_TIMEOUT) |
| 37 | from check import WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, narrow_subgroup_skip, wave32_lane_skip # as in check.py | 37 | from check import MESH_COMPUTE, mesh_env # LEONIDA_MESH_COMPUTE=1: mesh shaders as compute + a generated VS |
| 38 | from check import (WAVE32_LANE_DUMPS, WAVE32_LANE_ENV, bitmask_perm_narrow_skip, narrow_subgroup_skip, | ||
| 39 | wave32_lane_skip) # as in check.py | ||
| 40 | from check import PIXEL_VERTEX, interp_f16_high_problem # ps_interp_f16_high's producers and check | ||
| 38 | 41 | ||
| 39 | 42 | ||
| 40 | def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: | 43 | def make_dxbc(chunks: list[tuple[bytes, bytes]]) -> bytes: |
| @@ -78,7 +81,8 @@ def make_ms_psv0(threads_x: int, maxv: int, maxp: int, topology: int = 2, group_ | |||
| 78 | 81 | ||
| 79 | def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: | 82 | def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: |
| 80 | """Assemble raw RDNA2 .asm with llvm-mc -show-encoding into .s format for rdna2spirv.py.""" | 83 | """Assemble raw RDNA2 .asm with llvm-mc -show-encoding into .s format for rdna2spirv.py.""" |
| 81 | raw = open(asm_path, encoding="utf-8").read() | 84 | with open(asm_path, encoding="utf-8") as source: |
| 85 | raw = source.read() | ||
| 82 | cmd = mc_command.mc_command(llvm_mc) + ["-triple=amdgcn--amdpal", "-mcpu=gfx1013"] | 86 | cmd = mc_command.mc_command(llvm_mc) + ["-triple=amdgcn--amdpal", "-mcpu=gfx1013"] |
| 83 | for ln in raw.splitlines(): | 87 | for ln in raw.splitlines(): |
| 84 | s = ln.strip() | 88 | s = ln.strip() |
| @@ -93,8 +97,9 @@ def assemble_to_s(llvm_mc: str, asm_path: str, s_path: str, name: str) -> None: | |||
| 93 | if name in CLIP_CASES: | 97 | if name in CLIP_CASES: |
| 94 | cmd.append(f"-defsym=PARAM_SLOT={CLIP_CASES[name]}") | 98 | cmd.append(f"-defsym=PARAM_SLOT={CLIP_CASES[name]}") |
| 95 | cmd.append("-show-encoding") | 99 | cmd.append("-show-encoding") |
| 96 | p = subprocess.run( | 100 | p = mc_command.run( # a missing llvm-mc: a short message naming LLVM_MC/--llvm-mc, not a traceback |
| 97 | cmd, | 101 | cmd, |
| 102 | flag="--llvm-mc", | ||
| 98 | input=raw, | 103 | input=raw, |
| 99 | capture_output=True, | 104 | capture_output=True, |
| 100 | text=True, | 105 | text=True, |
| @@ -208,14 +213,16 @@ def make_fs_passthru(loc: int) -> str: | |||
| 208 | 213 | ||
| 209 | 214 | ||
| 210 | def read_raw_rgba32f(path: str) -> list[tuple[float, float, float, float]]: | 215 | def read_raw_rgba32f(path: str) -> list[tuple[float, float, float, float]]: |
| 211 | data = open(path, "rb").read() | 216 | with open(path, "rb") as source: |
| 212 | n = len(data) // 16 | 217 | data = source.read() |
| 218 | n = len(data) // 16 if len(data) % 16 == 0 else 0 # a partial pixel means a malformed readback: no frame | ||
| 213 | return [struct.unpack_from("<4f", data, 16 * i) for i in range(n)] | 219 | return [struct.unpack_from("<4f", data, 16 * i) for i in range(n)] |
| 214 | 220 | ||
| 215 | 221 | ||
| 216 | def read_raw_u32(path: str) -> list[tuple[int, int, int, int]]: | 222 | def read_raw_u32(path: str) -> list[tuple[int, int, int, int]]: |
| 217 | data = open(path, "rb").read() | 223 | with open(path, "rb") as source: |
| 218 | n = len(data) // 16 | 224 | data = source.read() |
| 225 | n = len(data) // 16 if len(data) % 16 == 0 else 0 # a partial pixel means a malformed readback: no frame | ||
| 219 | return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)] | 226 | return [struct.unpack_from("<4I", data, 16 * i) for i in range(n)] |
| 220 | 227 | ||
| 221 | 228 | ||
| @@ -321,8 +328,12 @@ def check_bary(raw_path: str) -> tuple[bool, str]: | |||
| 321 | return (bad == 0), (first if bad else "4096/4096 pixels exact") | 328 | return (bad == 0), (first if bad else "4096/4096 pixels exact") |
| 322 | 329 | ||
| 323 | 330 | ||
| 324 | def check_bitmask_perm(raw_path: str) -> tuple[bool, str]: | 331 | def check_bitmask_perm(raw_path: str, msg: str = "") -> tuple[bool | None, str]: |
| 325 | px = read_raw_u32(raw_path) | 332 | px = read_raw_u32(raw_path) |
| 333 | if skip := bitmask_perm_narrow_skip(msg, px): | ||
| 334 | return None, str(skip) | ||
| 335 | if problem := frame_problem(px): | ||
| 336 | return False, problem | ||
| 326 | bad = 0 | 337 | bad = 0 |
| 327 | first = "" | 338 | first = "" |
| 328 | judged = 0 | 339 | judged = 0 |
| @@ -342,6 +353,13 @@ def check_bitmask_perm(raw_path: str) -> tuple[bool, str]: | |||
| 342 | # Pixel shaders that read memory: vk_harness puts this V# in s[0:3] and seeds the heap it points at, as | 353 | # Pixel shaders that read memory: vk_harness puts this V# in s[0:3] and seeds the heap it points at, as |
| 343 | # tests/semantic/test_value_semantics.py does for the interpreter (same table as check.py). | 354 | # tests/semantic/test_value_semantics.py does for the interpreter (same table as check.py). |
| 344 | PIXEL_ENV = {"ps_vcc_x2": {"VKH_SGPRS": "0x1000,0,16,0", "VKH_HEAP": "0x1000=0x11223344,0x1004=0x55667788"}, | 355 | PIXEL_ENV = {"ps_vcc_x2": {"VKH_SGPRS": "0x1000,0,16,0", "VKH_HEAP": "0x1000=0x11223344,0x1004=0x55667788"}, |
| 356 | # the 14 v_cmpx forms: f32 and 64-bit operands from memory (derivations in the .asm header) | ||
| 357 | "ps_vcmpx_forms": {"VKH_SGPRS": "0x1000,0,96,0", | ||
| 358 | "VKH_HEAP": "0x1000=0x7fc10001,0x1004=0x3f800000,0x1008=0x40000000,0x100c=0x80000000," | ||
| 359 | "0x1010=0,0x1014=0xff800000,0x1018=0,0x101c=0,0x1020=0x80000000,0x1024=0," | ||
| 360 | "0x1028=0x1,0x102c=0,0x1030=0x7,0x1034=0x80000000,0x1038=0x7,0x103c=0," | ||
| 361 | "0x1040=0x1,0x1044=0x5,0x1048=0x80000000,0x104c=0x5,0x1050=0x7,0x1054=0x5," | ||
| 362 | "0x1058=0x7,0x105c=0x5"}, | ||
| 345 | # float NaN / fract rows measured on RDNA2 hardware (see the .asm headers) | 363 | # float NaN / fract rows measured on RDNA2 hardware (see the .asm headers) |
| 346 | "ps_fnan_med3": {"VKH_SGPRS": "0x1000,0,32,0", | 364 | "ps_fnan_med3": {"VKH_SGPRS": "0x1000,0,32,0", |
| 347 | "VKH_HEAP": "0x1000=0x7fc10001,0x1004=0x40e00000,0x1008=0x40a00000," | 365 | "VKH_HEAP": "0x1000=0x7fc10001,0x1004=0x40e00000,0x1008=0x40a00000," |
| @@ -352,8 +370,13 @@ PIXEL_ENV = {"ps_vcc_x2": {"VKH_SGPRS": "0x1000,0,16,0", "VKH_HEAP": "0x1000=0x1 | |||
| 352 | 370 | ||
| 353 | def check_flat(raw_path: str) -> tuple[bool, str]: | 371 | def check_flat(raw_path: str) -> tuple[bool, str]: |
| 354 | """ps_flat with vs_ids: the integer IDs come from the first (provoking) vertex, the UVs still interpolate.""" | 372 | """ps_flat with vs_ids: the integer IDs come from the first (provoking) vertex, the UVs still interpolate.""" |
| 355 | data = open(raw_path, "rb").read() | 373 | with open(raw_path, "rb") as source: |
| 374 | data = source.read() | ||
| 375 | if len(data) != 64 * 64 * 16: | ||
| 376 | return False, f"expected a 64x64 frame, got {len(data)} bytes" | ||
| 356 | px = list(struct.iter_unpack("<2I2f", data)) | 377 | px = list(struct.iter_unpack("<2I2f", data)) |
| 378 | if problem := frame_problem(px): | ||
| 379 | return False, problem | ||
| 357 | w = int(len(px) ** 0.5) | 380 | w = int(len(px) ** 0.5) |
| 358 | wrong = sum((a, b) != (0x101, 0x102) for a, b, _, _ in px) | 381 | wrong = sum((a, b) != (0x101, 0x102) for a, b, _, _ in px) |
| 359 | err = max(max(abs(u - (i % w + 0.5) / w), abs(v - (i // w + 0.5) / w)) for i, (_, _, u, v) in enumerate(px)) | 382 | err = max(max(abs(u - (i % w + 0.5) / w), abs(v - (i // w + 0.5) / w)) for i, (_, _, u, v) in enumerate(px)) |
| @@ -380,6 +403,9 @@ def check_uniform_branch(raw_path: str) -> tuple[bool, str]: | |||
| 380 | """ps_uniform_branch / ps_scc_mask32: s5 = 8 wherever the lane's own bit is set; a lane with bit 0 gets 8 when | 403 | """ps_uniform_branch / ps_scc_mask32: s5 = 8 wherever the lane's own bit is set; a lane with bit 0 gets 8 when |
| 381 | another lane of its wave has the bit (the wave-wide vote), else 7. All three kinds must occur, as in check.py: | 404 | another lane of its wave has the bit (the wave-wide vote), else 7. All three kinds must occur, as in check.py: |
| 382 | without a (8, bit 0) pixel the vote is not shown, and a translator that decides per lane would pass.""" | 405 | without a (8, bit 0) pixel the vote is not shown, and a translator that decides per lane would pass.""" |
| 406 | # Only z (the barycentric i) is judged as a float; a NaN i passes both range tests below. | ||
| 407 | if problem := frame_problem([p[2:3] for p in px]): | ||
| 408 | return False, problem | ||
| 383 | bad = 0 | 409 | bad = 0 |
| 384 | n8 = 0 | 410 | n8 = 0 |
| 385 | n7 = 0 | 411 | n7 = 0 |
| @@ -413,6 +439,24 @@ def check_uniform_branch(raw_path: str) -> tuple[bool, str]: | |||
| 413 | return (n8 - n80 > 0 and n7 > 0), detail | 439 | return (n8 - n80 > 0 and n7 > 0), detail |
| 414 | 440 | ||
| 415 | 441 | ||
| 442 | def check_d16_texture(raw_path: str) -> tuple[bool, str]: | ||
| 443 | """Point-sample the 8x8 UNORM gradient and round each component to binary16 before widening.""" | ||
| 444 | data = Path(raw_path).read_bytes() | ||
| 445 | if len(data) != 64 * 64 * 16: | ||
| 446 | return False, f"expected a 64x64 RGBA32F frame, got {len(data)} bytes" | ||
| 447 | levels = [struct.unpack("<e", struct.pack("<e", i * 32 / 255.0))[0] for i in range(8)] | ||
| 448 | bad = 0 | ||
| 449 | first = "" | ||
| 450 | for i, pixel in enumerate(struct.iter_unpack("<4f", data)): | ||
| 451 | x, y = i % 64, i // 64 | ||
| 452 | expected = (levels[x // 8], levels[y // 8], levels[4], 1.0) | ||
| 453 | if pixel != expected: | ||
| 454 | if not bad: | ||
| 455 | first = f"at ({x},{y}): got {pixel}, want {expected}" | ||
| 456 | bad += 1 | ||
| 457 | return (False, f"{bad}/4096 mismatches; {first}") if bad else (True, "4096/4096 RGBA pixels exact") | ||
| 458 | |||
| 459 | |||
| 416 | def check_grad(raw_path: str, want_b: float, want_a: float) -> tuple[bool, str]: | 460 | def check_grad(raw_path: str, want_b: float, want_a: float) -> tuple[bool, str]: |
| 417 | px = read_raw_rgba32f(raw_path) | 461 | px = read_raw_rgba32f(raw_path) |
| 418 | if problem := frame_problem(px): | 462 | if problem := frame_problem(px): |
| @@ -433,8 +477,8 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool, | |||
| 433 | """Check 64x64 output with ClipDistance[0] = NDC x: left half (x < 32) clipped to clear (-1), | 477 | """Check 64x64 output with ClipDistance[0] = NDC x: left half (x < 32) clipped to clear (-1), |
| 434 | right half (x >= 32) covered (2048/4096 pixels) with the gradient.""" | 478 | right half (x >= 32) covered (2048/4096 pixels) with the gradient.""" |
| 435 | px = read_raw_rgba32f(raw_path) | 479 | px = read_raw_rgba32f(raw_path) |
| 436 | if len(px) != 64 * 64: | 480 | if problem := frame_problem(px): |
| 437 | return False, f"expected 4096 pixels, got {len(px)}" | 481 | return False, problem |
| 438 | covered = 0 | 482 | covered = 0 |
| 439 | bad = 0 | 483 | bad = 0 |
| 440 | first = "" | 484 | first = "" |
| @@ -464,7 +508,9 @@ def check_clip_half(raw_path: str, want_b: float, want_a: float) -> tuple[bool, | |||
| 464 | DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", | 508 | DRAWN_WITH = {GATHER_LOD_TEST: "vs_ids.asm", "ps_flat": "vs_ids.asm", "ps_texture_sample": "vs_ids.asm", "ps_cube_sample": "vs_ids.asm", |
| 465 | "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", | 509 | "ps_texture_sample_d16": "vs_ids.asm", "ps_sample_c_lz": "vs_ids.asm", "ps_sample_c_lz_a16": "vs_ids.asm", |
| 466 | "ps_gather_wrap": "vs_ids.asm", "ps_ssharp": "vs_ids.asm", | 510 | "ps_gather_wrap": "vs_ids.asm", "ps_ssharp": "vs_ids.asm", |
| 467 | **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_ops.asm"} | 511 | **{name: "vs_ids.asm" for name in GRADIENT_TESTS}, "vs_clip": "ps_clip_color.asm", |
| 512 | "ps_interp_f16_high": "vs_f16_pack.asm", "ms_f16_pack": "ps_interp_f16_high.asm", | ||
| 513 | "ps_interp_f32_mods": "vs_interp_consts.asm", "ps_interp_mov_mods": "vs_interp_consts.asm"} | ||
| 468 | 514 | ||
| 469 | 515 | ||
| 470 | def with_draw_shaders(asm_files: list[str]) -> list[str]: | 516 | def with_draw_shaders(asm_files: list[str]) -> list[str]: |
| @@ -573,7 +619,7 @@ def run_suite(a, work: str) -> int: | |||
| 573 | (b"ISG1", make_sig_chunk([(1, 3, 0, 0xF, 0xF), (0, 3, 1, 0xF, 0xF)])), | 619 | (b"ISG1", make_sig_chunk([(1, 3, 0, 0xF, 0xF), (0, 3, 1, 0xF, 0xF)])), |
| 574 | (b"OSG1", make_sig_chunk([(1, 3, 0, 0xF, 0xF), (0, 3, 1, 0xF, 0xF)])), | 620 | (b"OSG1", make_sig_chunk([(1, 3, 0, 0xF, 0xF), (0, 3, 1, 0xF, 0xF)])), |
| 575 | ]) | 621 | ]) |
| 576 | elif name in ("ms_tri", "ms_w64x_ballot", "ms_wave_info_s3"): | 622 | elif name in ("ms_tri", "ms_w64x_ballot", "ms_wave_info_s3", "ms_f16_pack"): |
| 577 | dxbc = make_dxbc([(b"PSV0", make_ms_psv0(128, 64, 64, 2))]) | 623 | dxbc = make_dxbc([(b"PSV0", make_ms_psv0(128, 64, 64, 2))]) |
| 578 | elif name == "ms_v5_workgroup": | 624 | elif name == "ms_v5_workgroup": |
| 579 | dxbc = make_dxbc([(b"PSV0", make_ms_psv0(32, 3, 1, group_shared=128))]) | 625 | dxbc = make_dxbc([(b"PSV0", make_ms_psv0(32, 3, 1, group_shared=128))]) |
| @@ -608,6 +654,10 @@ def run_suite(a, work: str) -> int: | |||
| 608 | cmd.append("--bary-fallback") | 654 | cmd.append("--bary-fallback") |
| 609 | if TEXOFF_FALLBACK: # image_sample*_o: offset folded into the coordinate, no VK_KHR_maintenance8 | 655 | if TEXOFF_FALLBACK: # image_sample*_o: offset folded into the coordinate, no VK_KHR_maintenance8 |
| 610 | cmd.append("--texel-offset-fallback") | 656 | cmd.append("--texel-offset-fallback") |
| 657 | if MESH_COMPUTE: # mesh shaders as compute writing to a buffer, drawn by tools/mesh_compute_vs.py | ||
| 658 | cmd.append("--mesh-compute") | ||
| 659 | if os.environ.get("LEONIDA_FMA") in ("glsl", "khr"): # fused multiply-add: GLSL Fma or OpFmaKHR (docs/design.md) | ||
| 660 | cmd += ["--fma", os.environ["LEONIDA_FMA"]] | ||
| 611 | rc, out = run_cmd(cmd, gpu=False) | 661 | rc, out = run_cmd(cmd, gpu=False) |
| 612 | print("=== rdna2spirv.py ===") | 662 | print("=== rdna2spirv.py ===") |
| 613 | print(out) | 663 | print(out) |
| @@ -618,6 +668,11 @@ def run_suite(a, work: str) -> int: | |||
| 618 | for gs in bary_fallback_gs.build_for_index(spirv_dir): | 668 | for gs in bary_fallback_gs.build_for_index(spirv_dir): |
| 619 | print("bary fallback GS:", os.path.basename(gs)) | 669 | print("bary fallback GS:", os.path.basename(gs)) |
| 620 | 670 | ||
| 671 | if MESH_COMPUTE: | ||
| 672 | import mesh_compute_vs | ||
| 673 | for vs_spv in mesh_compute_vs.build_for_index(spirv_dir): | ||
| 674 | print("mesh compute VS:", os.path.basename(vs_spv)) | ||
| 675 | |||
| 621 | # 3. Build helper SPIR-V shaders | 676 | # 3. Build helper SPIR-V shaders |
| 622 | vs_tri = os.path.join(spirv_dir, "vs_tri.spv") | 677 | vs_tri = os.path.join(spirv_dir, "vs_tri.spv") |
| 623 | fs_passthru = os.path.join(spirv_dir, "fs_passthru.spv") | 678 | fs_passthru = os.path.join(spirv_dir, "fs_passthru.spv") |
| @@ -629,7 +684,8 @@ def run_suite(a, work: str) -> int: | |||
| 629 | index = {} | 684 | index = {} |
| 630 | idx_path = os.path.join(spirv_dir, "index.json") | 685 | idx_path = os.path.join(spirv_dir, "index.json") |
| 631 | if os.path.isfile(idx_path): | 686 | if os.path.isfile(idx_path): |
| 632 | index = json.load(open(idx_path, encoding="utf-8")) | 687 | with open(idx_path, encoding="utf-8") as source: |
| 688 | index = json.load(source) | ||
| 633 | 689 | ||
| 634 | ext = ".exe" if os.name == "nt" else "" | 690 | ext = ".exe" if os.name == "nt" else "" |
| 635 | vk_compute = os.path.join(a.build, "vk_compute_test" + ext) | 691 | vk_compute = os.path.join(a.build, "vk_compute_test" + ext) |
| @@ -690,6 +746,10 @@ def run_suite(a, work: str) -> int: | |||
| 690 | elif name == "cs_fmt_1010102": | 746 | elif name == "cs_fmt_1010102": |
| 691 | problem = fmt_1010102_test(a.build, spirv_dir, cs_env) | 747 | problem = fmt_1010102_test(a.build, spirv_dir, cs_env) |
| 692 | results.append((name, not problem, problem or "64/64 dumped words exact")) | 748 | results.append((name, not problem, problem or "64/64 dumped words exact")) |
| 749 | elif name == "cs_fmt_xy_xyz": | ||
| 750 | # TEST-185: xy/xyz format loads and stores, words measured natively on a Radeon 680M (the .asm header) | ||
| 751 | problem = fmt_xy_xyz_test(a.build, spirv_dir, cs_env) | ||
| 752 | results.append((name, not problem, problem or "128/128 dumped words exact")) | ||
| 693 | elif name == "cs_global_neg_offset": | 753 | elif name == "cs_global_neg_offset": |
| 694 | # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte | 754 | # Negative global_load/global_store offsets (cs_global_neg_offset.asm): 40 groups give a 0x2800-byte |
| 695 | # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement. | 755 | # heap holding both the right addresses and the 4096-lower ones. One thread, no wave64 requirement. |
| @@ -721,17 +781,18 @@ def run_suite(a, work: str) -> int: | |||
| 721 | # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. | 781 | # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. |
| 722 | # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. | 782 | # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. |
| 723 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) | 783 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) |
| 724 | elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_exec_const", "cs_w32_lds_u8_d16", "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", | 784 | elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "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", |
| 725 | 785 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", | |
| 786 | "cs_dpp_bound", "cs_dpp_w64", | ||
| 726 | "cs_w64_mask_detect", | 787 | "cs_w64_mask_detect", |
| 727 | "cs_w64x_readlane", "cs_w64x_writelane", "cs_w64x_readfirstlane", "cs_w64x_bpermute", "cs_w64x_permute", | 788 | "cs_w64x_readlane", "cs_w64x_writelane", "cs_w64x_readfirstlane", "cs_w64x_bpermute", "cs_w64x_permute", |
| 728 | "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw", | 789 | "cs_w64x_branch", "cs_w64x_ballot", "cs_w64x_wg128_branches", "cs_w64x_lds_raw", |
| 729 | "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", | 790 | "cs_w64x_lds_war", "cs_w64x_partial", "cs_w64x_sbarrier", "cs_w64x_load_ballot_load", |
| 730 | "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", | 791 | "cs_w64x_mask_reuse", "cs_w64x_mask_reuse2", "cs_w64x_chain_barrier", "cs_barrier_divergent", |
| 731 | "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", | 792 | "cs_bpermute32", "cs_w64x_partial_scmp", "cs_w32_partial_scmp", "cs_barrier_early_end", |
| 732 | "cs_barrier_loop"): | 793 | "cs_barrier_loop", "cs_w64x_andn2_exec"): |
| 733 | cs_dump_wants = { | 794 | cs_dump_wants = { |
| 734 | "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800], | 795 | "cs_store": [0x400080FF, 0xE00003FF, 0x3C004000, 0xEEEEEEEE, 0x40003C00, 0xBC003800, 0x40FF8000, 0x3FF00000], |
| 735 | # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone | 796 | # base + soffset + imm (cs_smem_soffset_imm.asm); out[4..7] are seeds the shader leaves alone |
| 736 | "cs_smem_soffset_imm": [0x5EED0024, 0x5EED0028, 0x5EED002C, 0x5EED0030, | 797 | "cs_smem_soffset_imm": [0x5EED0024, 0x5EED0028, 0x5EED002C, 0x5EED0030, |
| 737 | 0x5EED0010, 0x5EED0014, 0x5EED0018, 0x5EED001C], | 798 | 0x5EED0010, 0x5EED0014, 0x5EED0018, 0x5EED001C], |
| @@ -745,6 +806,18 @@ def run_suite(a, work: str) -> int: | |||
| 745 | "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], | 806 | "cs_w32_lds_u8_d16": [0xBEEF00FF, 0x00FF1234, 0xBEEFFF80, 0xFF801234, 0xBEEF007F, 0x007F1234, 0xBEEF0080, 0xFFFF1234], |
| 746 | # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant | 807 | # constant EXEC masks (cs_exec_const.asm): each lane takes its own bit of the constant |
| 747 | "cs_exec_const": [16, 8, 2, 16, 0, 16], | 808 | "cs_exec_const": [16, 8, 2, 16, 0, 16], |
| 809 | # constant lane masks: lane L takes bit L (cs_w32_mask_imm.asm / cs_w64_mask_imm.asm headers) | ||
| 810 | "cs_w32_mask_imm": [2056, 20, 2, 6152, 2050, 4112, 258, 32], | ||
| 811 | "cs_w64_mask_imm": [2056, 1084, 828, 2052, 319, 2104, 516, 2064], | ||
| 812 | "cs_dpp": [1, 0, 3, 2, 5, 4, 7, 6], | ||
| 813 | "cs_dpp_row": [0, 0, 1, 2, 3, 4, 5, 6], | ||
| 814 | "cs_dpp_mask": [1, 0, 3, 2, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE, 0xEEEEEEEE], | ||
| 815 | "cs_dpp8": [7, 6, 5, 4, 3, 2, 1, 0], | ||
| 816 | "cs_dpp_ops": [100, 10, 11, 12, 13, 14, 15, 16], | ||
| 817 | "cs_dpp_bound": [10, 10, 11, 12, 13, 14, 15, 16], | ||
| 818 | "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], | ||
| 819 | "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], | ||
| 820 | "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], | ||
| 748 | "cs_wave64_ballot": [32, 16, 24, 40, 8, 48], | 821 | "cs_wave64_ballot": [32, 16, 24, 40, 8, 48], |
| 749 | "cs_wm_half_ops": [32, 16, 16, 0, 16], | 822 | "cs_wm_half_ops": [32, 16, 16, 0, 16], |
| 750 | "cs_wm_half_cmp": [1, 0, 1, 1], | 823 | "cs_wm_half_cmp": [1, 0, 1, 1], |
| @@ -773,6 +846,7 @@ def run_suite(a, work: str) -> int: | |||
| 773 | "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 | 846 | "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 |
| 774 | "cs_w64x_sbarrier": [605, 605, 686, 686, 3032, 3013, 3032, 3031], | 847 | "cs_w64x_sbarrier": [605, 605, 686, 686, 3032, 3013, 3032, 3031], |
| 775 | "cs_w64x_load_ballot_load": [43, 74, 75, 42, 42, 18, 41, 32], | 848 | "cs_w64x_load_ballot_load": [43, 74, 75, 42, 42, 18, 41, 32], |
| 849 | "cs_w64x_andn2_exec": [1, 16, 32, 4144, 2052, 3, 8, 1544], # s_andn2_saveexec/wrexec_b64 (.asm header) | ||
| 776 | "cs_bpermute32": [0, 50, 162, 99, 36, 218, 183, 15], # wave32: needs 32 lanes | 850 | "cs_bpermute32": [0, 50, 162, 99, 36, 218, 183, 15], # wave32: needs 32 lanes |
| 777 | # SHADER-91: s_barrier sites in different wave-uniform branches meet (cs_barrier_divergent.asm) | 851 | # SHADER-91: s_barrier sites in different wave-uniform branches meet (cs_barrier_divergent.asm) |
| 778 | "cs_barrier_divergent": [127, 126, 125, 124, 123, 122, 121, 120], | 852 | "cs_barrier_divergent": [127, 126, 125, 124, 123, 122, 121, 120], |
| @@ -783,10 +857,10 @@ def run_suite(a, work: str) -> int: | |||
| 783 | } | 857 | } |
| 784 | want = cs_dump_wants[name] | 858 | want = cs_dump_wants[name] |
| 785 | # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / | 859 | # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / |
| 786 | # cs_w32_lds_u8_d16 and the wave32 cs_wqm_w32 / cs_bpermute32 is a whole-wave (wave64) mask test: | 860 | # cs_w32_lds_u8_d16, the wave32 cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) |
| 787 | # ask for a 64-wide subgroup and skip, as check.py does, where the device has none (vk_compute_test | 861 | # mask test: ask for a 64-wide subgroup and skip, as check.py does, where the device has none |
| 788 | # exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were translated with | 862 | # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were |
| 789 | # --wave64-emulate and run on any subgroup size. | 863 | # translated with --wave64-emulate and run on any subgroup size. |
| 790 | # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for | 864 | # cs_w64x_partial and cs_w64x_partial_scmp (40-thread groups) can't have full subgroups: they ask for |
| 791 | # size 64 without them. | 865 | # size 64 without them. |
| 792 | emulated = w64_emulated() | 866 | emulated = w64_emulated() |
| @@ -794,8 +868,8 @@ def run_suite(a, work: str) -> int: | |||
| 794 | wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", | 868 | wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", |
| 795 | "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", | 869 | "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", |
| 796 | "cs_w32_lds_u8_d16", "cs_bpermute32", "cs_w32_partial_scmp", | 870 | "cs_w32_lds_u8_d16", "cs_bpermute32", "cs_w32_partial_scmp", |
| 797 | "cs_exec_const") and not emulated and not partial | 871 | "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", |
| 798 | 872 | "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial | |
| 799 | if partial and not emulated: | 873 | if partial and not emulated: |
| 800 | cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") | 874 | cs_env = dict(os.environ, VKC_SUBGROUP_SIZE="64") |
| 801 | if name in WAVE32_LANE_DUMPS: # 32 lanes even without index.json, as check.py requests (#774) | 875 | if name in WAVE32_LANE_DUMPS: # 32 lanes even without index.json, as check.py requests (#774) |
| @@ -812,7 +886,7 @@ def run_suite(a, work: str) -> int: | |||
| 812 | rc, msg = run_cmd([vk_store, spv]) | 886 | rc, msg = run_cmd([vk_store, spv]) |
| 813 | results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) | 887 | results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) |
| 814 | elif name in ("cs_imgload", "cs_imgload_d16"): | 888 | elif name in ("cs_imgload", "cs_imgload_d16"): |
| 815 | rc, msg = run_cmd([vk_store, spv, "load"]) | 889 | rc, msg = run_cmd([vk_store, spv, "load-d16" if name == "cs_imgload_d16" else "load"]) |
| 816 | results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) | 890 | results.append((name, rc == 0, msg.splitlines()[-1] if msg else "")) |
| 817 | elif name in MIP_TEST_PASSES: | 891 | elif name in MIP_TEST_PASSES: |
| 818 | problem = texture_mip_test(a.build, spirv_dir, name) | 892 | problem = texture_mip_test(a.build, spirv_dir, name) |
| @@ -828,6 +902,7 @@ def run_suite(a, work: str) -> int: | |||
| 828 | tool = os.path.join(a.build, "vk_texture_test" + ext) | 902 | tool = os.path.join(a.build, "vk_texture_test" + ext) |
| 829 | raw = os.path.join(raw_dir, f"{name}.raw") | 903 | raw = os.path.join(raw_dir, f"{name}.raw") |
| 830 | if name == "ps_texture_sample_d16": | 904 | if name == "ps_texture_sample_d16": |
| 905 | Path(raw).unlink(missing_ok=True) | ||
| 831 | cmd = [tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "0", "0", "0", "0"] | 906 | cmd = [tool, os.path.join(spirv_dir, "vs_ids.spv"), spv, raw, "0", "0", "0", "0", "0"] |
| 832 | else: | 907 | else: |
| 833 | mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"], | 908 | mode = {"ps_cube_sample": ["cube"], "ps_sample_c_lz": ["dref"], |
| @@ -842,13 +917,9 @@ def run_suite(a, work: str) -> int: | |||
| 842 | rc, msg = 1, start_failure(tool, e) | 917 | rc, msg = 1, start_failure(tool, e) |
| 843 | if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need | 918 | if rc == UNSUPPORTED: # e.g. fewer push constant bytes than the texture tests need |
| 844 | results.append((name, None, unsupported_skip(msg))) | 919 | results.append((name, None, unsupported_skip(msg))) |
| 845 | elif name == "ps_texture_sample_d16" and rc == 0 and os.path.isfile(raw): | 920 | elif name == "ps_texture_sample_d16" and rc == 0: |
| 846 | with open(raw, "rb") as f: | 921 | ok, detail = check_d16_texture(raw) if os.path.isfile(raw) else (False, "missing RGBA32F readback") |
| 847 | f.seek((32 * 64 + 32) * 16) | 922 | results.append((name, ok, detail)) |
| 848 | r, g, b, alpha = struct.unpack("<4f", f.read(16)) | ||
| 849 | exp_b = struct.unpack("<e", struct.pack("<e", 128.0 / 255.0))[0] | ||
| 850 | ok = abs(r - exp_b) <= 0.05 and abs(g - exp_b) <= 0.05 and abs(b - exp_b) == 0.0 and alpha == 1.0 | ||
| 851 | results.append((name, ok, f"center(32,32)=({r:.6f}, {g:.6f}, {b:.6f}, {alpha:.1f})")) | ||
| 852 | else: | 923 | else: |
| 853 | results.append((name, rc == 0 and "PASSED" in msg, msg.splitlines()[-1] if msg else "")) | 924 | results.append((name, rc == 0 and "PASSED" in msg, msg.splitlines()[-1] if msg else "")) |
| 854 | elif name == "ps_gather_wrap": | 925 | elif name == "ps_gather_wrap": |
| @@ -902,6 +973,11 @@ def run_suite(a, work: str) -> int: | |||
| 902 | elif name.startswith("ps_"): | 973 | elif name.startswith("ps_"): |
| 903 | raw = os.path.join(raw_dir, f"{name}.raw") | 974 | raw = os.path.join(raw_dir, f"{name}.raw") |
| 904 | vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids | 975 | vs = os.path.join(spirv_dir, "vs_ids.spv") if name == "ps_flat" else vs_tri # check.py draws ps_flat with vs_ids |
| 976 | if name in PIXEL_VERTEX: | ||
| 977 | if bary_fallback() and name == "ps_interp_f16_high": # no PerVertexKHR inputs under --bary-fallback | ||
| 978 | results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) | ||
| 979 | continue | ||
| 980 | vs = os.path.join(spirv_dir, PIXEL_VERTEX[name] + ".spv") | ||
| 905 | env = dict(gfx_env or os.environ, **PIXEL_ENV[name]) if name in PIXEL_ENV else gfx_env | 981 | env = dict(gfx_env or os.environ, **PIXEL_ENV[name]) if name in PIXEL_ENV else gfx_env |
| 906 | bary_gs = os.path.join(spirv_dir, f"{name}.bary_gs.spv") | 982 | bary_gs = os.path.join(spirv_dir, f"{name}.bary_gs.spv") |
| 907 | if bary_fallback() and os.path.isfile(bary_gs): # --bary-fallback PS: barycentrics from this GS | 983 | if bary_fallback() and os.path.isfile(bary_gs): # --bary-fallback PS: barycentrics from this GS |
| @@ -914,6 +990,7 @@ def run_suite(a, work: str) -> int: | |||
| 914 | results.append((name, False, msg)) | 990 | results.append((name, False, msg)) |
| 915 | continue | 991 | continue |
| 916 | const_wants = { | 992 | const_wants = { |
| 993 | "ps_clip_color": (0x3E800000, 0x3F000000, 0x3F400000, 0x3F800000), | ||
| 917 | "ps_ops": (0x48804300, 5, 7, 0xFFFFFFFC), | 994 | "ps_ops": (0x48804300, 5, 7, 0xFFFFFFFC), |
| 918 | "ps_ops2": (0xABCD4400, 0x46001234, 0xFFFFFFFA, 7), | 995 | "ps_ops2": (0xABCD4400, 0x46001234, 0xFFFFFFFA, 7), |
| 919 | "ps_ops3": (0xFFFFFFFA, 0x44660066, 0x44AABBCC, 16), | 996 | "ps_ops3": (0xFFFFFFFA, 0x44660066, 0x44AABBCC, 16), |
| @@ -927,6 +1004,7 @@ def run_suite(a, work: str) -> int: | |||
| 927 | "ps_ops8": (0x80000000, 0xFFFFFFFF, 0x000F100E, 0x0F0F0F1F), | 1004 | "ps_ops8": (0x80000000, 0xFFFFFFFF, 0x000F100E, 0x0F0F0F1F), |
| 928 | "ps_f32_mods": (0xC0256A01, 0x3F800000, 0x41E00000, 0x3FC00000), | 1005 | "ps_f32_mods": (0xC0256A01, 0x3F800000, 0x41E00000, 0x3FC00000), |
| 929 | "ps_vcc_x2": (0x11223344, 0x55667788, 0, 0), | 1006 | "ps_vcc_x2": (0x11223344, 0x55667788, 0, 0), |
| 1007 | "ps_vcmpx_forms": (0xF05B2A48, 0xF05E8A12, 0xB174BE18, 0x15550000), # 14 v_cmpx forms (.asm header) | ||
| 930 | "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000), | 1008 | "ps_med3_mods": (0x3F800000, 0x40400000, 0x40C00000, 0x3F400000), |
| 931 | "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), | 1009 | "ps_scc_minmax": (0x00030205, 0x00030207, 0x00030209, 0x00030203), |
| 932 | "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), | 1010 | "ps_fma_literal": (0x41B80000, 0x41800000, 0x40E00000, 0x41A40000), |
| @@ -944,6 +1022,13 @@ def run_suite(a, work: str) -> int: | |||
| 944 | "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate | 1022 | "ps_sff_imm": (2, 1, 20, 16), # SHADER-46: s_ff0/s_ff1 of an immediate |
| 945 | "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware | 1023 | "ps_fnan_med3": (0x40A00000, 0xC0200000, 0xC0200000, 0x40600000), # measured on RDNA2 hardware |
| 946 | "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), | 1024 | "ps_fnan_fract": (0x3F7FFFFF, 0x00003BFF, 0xC0200000, 0xC0200000), |
| 1025 | # TEST-175: docs/design.md rules that were checked on the CPU only (derivations in the .asm headers) | ||
| 1026 | "ps_cmp_nlg": (0x40000037, 0x40000007, 0x40000001, 0x3F800000), | ||
| 1027 | "ps_cvt_off": (0xBF000000, 0x3EE00000, 0xBE800000, 0x3F800000), | ||
| 1028 | "ps_fmac_f16_mods": (0xAAAA3C00, 0xAAAA3E00, 0xAAAA0000, 0xAAAA4000), | ||
| 1029 | "ps_vop3_const_mods": (0xC0000000, 0xBF800000, 0x3F800000, 0xAAAABC00), | ||
| 1030 | "ps_interp_f32_mods": (0x3F800000, 0x00000000, 0x3F400000, 0x3F800000), # drawn with vs_interp_consts | ||
| 1031 | "ps_interp_mov_mods": (0x3F800000, 0x3FC00000, 0x40000000, 0x3F400000), | ||
| 947 | } | 1032 | } |
| 948 | if name in const_wants: | 1033 | if name in const_wants: |
| 949 | ok, detail = check_pixel_const(raw, const_wants[name]) | 1034 | ok, detail = check_pixel_const(raw, const_wants[name]) |
| @@ -954,13 +1039,17 @@ def run_suite(a, work: str) -> int: | |||
| 954 | if m and int(m.group(1)) < 32: | 1039 | if m and int(m.group(1)) < 32: |
| 955 | ok, detail = None, f"SKIP (subgroup {m.group(1)} is narrower than 32 lanes)" | 1040 | ok, detail = None, f"SKIP (subgroup {m.group(1)} is narrower than 32 lanes)" |
| 956 | else: | 1041 | else: |
| 957 | ok, detail = check_bitmask_perm(raw) | 1042 | ok, detail = check_bitmask_perm(raw, msg) |
| 958 | elif name in ("ps_uniform_branch", "ps_scc_mask32"): # same expected pattern (see the .asm headers) | 1043 | elif name in ("ps_uniform_branch", "ps_scc_mask32"): # same expected pattern (see the .asm headers) |
| 959 | ok, detail = check_uniform_branch(raw) | 1044 | ok, detail = check_uniform_branch(raw) |
| 960 | elif name == "ps_wqm": | 1045 | elif name == "ps_wqm": |
| 961 | ok, detail = check_wqm(raw) | 1046 | ok, detail = check_wqm(raw) |
| 962 | elif name == "ps_flat": | 1047 | elif name == "ps_flat": |
| 963 | ok, detail = check_flat(raw) | 1048 | ok, detail = check_flat(raw) |
| 1049 | elif name == "ps_interp_f16_high": | ||
| 1050 | with open(raw, "rb") as source: | ||
| 1051 | problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read()))) | ||
| 1052 | ok, detail = not problem, problem or "f16 low/high halves and f32 control within 2e-3" | ||
| 964 | else: | 1053 | else: |
| 965 | ok, detail = False, "no checker defined" | 1054 | ok, detail = False, "no checker defined" |
| 966 | results.append((name, ok, detail)) | 1055 | results.append((name, ok, detail)) |
| @@ -985,7 +1074,7 @@ def run_suite(a, work: str) -> int: | |||
| 985 | problem or "24/24 workgroup coordinates exact (2 x 3 x 4)")) | 1074 | problem or "24/24 workgroup coordinates exact (2 x 3 x 4)")) |
| 986 | elif name in ("ms_tri", "ms_w64x_ballot", "ms_wave_info_s3"): | 1075 | elif name in ("ms_tri", "ms_w64x_ballot", "ms_wave_info_s3"): |
| 987 | raw = os.path.join(raw_dir, f"{name}.raw") | 1076 | raw = os.path.join(raw_dir, f"{name}.raw") |
| 988 | env = dict(gfx_env or os.environ, VKH_MESH="1") | 1077 | env = mesh_env(spirv_dir, name, gfx_env) |
| 989 | rc, msg = run_cmd([vk_harness, spv, fs_passthru, raw], env=env) | 1078 | rc, msg = run_cmd([vk_harness, spv, fs_passthru, raw], env=env) |
| 990 | # ms_w64x_ballot needs exact wave64 (a 64-wide subgroup, or --wave64-emulate): skip it elsewhere, as | 1079 | # ms_w64x_ballot needs exact wave64 (a 64-wide subgroup, or --wave64-emulate): skip it elsewhere, as |
| 991 | # the wave64 compute dumps are. | 1080 | # the wave64 compute dumps are. |
| @@ -1000,9 +1089,25 @@ def run_suite(a, work: str) -> int: | |||
| 1000 | else: | 1089 | else: |
| 1001 | ok, detail = check_grad(raw, 0.5, 1.0) | 1090 | ok, detail = check_grad(raw, 0.5, 1.0) |
| 1002 | results.append((name, ok, detail)) | 1091 | results.append((name, ok, detail)) |
| 1003 | elif name == "ms_clip": | 1092 | elif name == "ms_f16_pack": # mesh producer of packed f16 params, drawn with ps_interp_f16_high |
| 1004 | raw = os.path.join(raw_dir, f"{name}.raw") | 1093 | raw = os.path.join(raw_dir, f"{name}.raw") |
| 1005 | env = dict(gfx_env or os.environ, VKH_MESH="1") | 1094 | env = dict(gfx_env or os.environ, VKH_MESH="1") |
| 1095 | fs = os.path.join(spirv_dir, "ps_interp_f16_high.spv") | ||
| 1096 | if bary_fallback(): | ||
| 1097 | results.append((name, None, "SKIP (per-vertex f16 interpolants need barycentrics)")) | ||
| 1098 | continue | ||
| 1099 | rc, msg = run_cmd([vk_harness, spv, fs, raw], env=env) | ||
| 1100 | if rc == UNSUPPORTED: | ||
| 1101 | results.append((name, None, unsupported_skip(msg))) | ||
| 1102 | elif rc != 0: | ||
| 1103 | results.append((name, False, msg)) | ||
| 1104 | else: | ||
| 1105 | with open(raw, "rb") as source: | ||
| 1106 | problem = interp_f16_high_problem(list(struct.iter_unpack("<4I", source.read()))) | ||
| 1107 | results.append((name, not problem, problem or "f16 low/high halves and f32 control within 2e-3")) | ||
| 1108 | elif name == "ms_clip": | ||
| 1109 | raw = os.path.join(raw_dir, f"{name}.raw") | ||
| 1110 | env = mesh_env(spirv_dir, name, gfx_env) | ||
| 1006 | rc, msg = run_cmd([vk_harness, spv, fs_passthru, raw], env=env) | 1111 | rc, msg = run_cmd([vk_harness, spv, fs_passthru, raw], env=env) |
| 1007 | if rc == UNSUPPORTED: | 1112 | if rc == UNSUPPORTED: |
| 1008 | results.append((name, None, unsupported_skip(msg))) | 1113 | results.append((name, None, unsupported_skip(msg))) |