diff options
| author | WHOISJARDAS <144918410+WHOISJARDAS@users.noreply.github.com> | 2026-11-22 01:34:00 +0000 |
|---|---|---|
| committer | WHOISJARDAS <144918410+WHOISJARDAS@users.noreply.github.com> | 2026-11-22 15:35:13 +0000 |
| commit | bd8fb7c9f544cabd91c1de55274644ba60e9d791 (patch) | |
| tree | 3dbd6d61c1fc283d09b2ac94ad01bcc990bb549f /scripts/run_gpu_tests.py | |
| parent | 4eb6155d3ac4f9d3fadb0d095c4ce13e76783615 (diff) | |
Translator: declare SignedZeroInfNanPreserve so drivers keep NaN, inf and -0
RDNA2 float ops return NaN, +-inf and -0 as computed. Without float controls,
Vulkan lets the driver assume none of them occur, and AMD's compiler does. On
an RX 9070 XT (26.11.2), x != x NaN checks fold to false and -0 products come
back +0. With integer f16 narrowing (#575), NaN results are never stored.
- rdna2spirv.py: every module declares the SignedZeroInfNanPreserve capability
and OpExecutionMode SignedZeroInfNanPreserve 32. The index entry lists the
property it needs (float_controls). --no-float-controls leaves both out.
- vk_pipeline_check: reads float_controls and skips a shader on a device
without shaderSignedZeroInfNanPreserveFloat32.
- GPU test cs_signed_zero_nan (check.py, run_gpu_tests.py): without the mode,
out[4..7] are 0 on AMD; with it, all eight words match.
- tests/test_translate.py: covers the mode, the index entry and the opt-out.
- docs/design.md: a "Float controls" contract row.
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 | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index 025504fb8..28eb466d9 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -876,7 +876,7 @@ def run_suite(a, work: str) -> int: | |||
| 876 | # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. | 876 | # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. |
| 877 | # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. | 877 | # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. |
| 878 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) | 878 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) |
| 879 | elif name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lane_wrap", "cs_movrelsd_2", "cs_w32_permute", "cs_w32_sincos", "cs_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "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", | 879 | 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_exec_const", "cs_w32_mask_imm", "cs_w64_mask_imm", "cs_w32_lds_u8_d16", "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", |
| 880 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", | 880 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", |
| 881 | "cs_dpp_bound", "cs_dpp_w64", | 881 | "cs_dpp_bound", "cs_dpp_w64", |
| 882 | "cs_w64_mask_detect", | 882 | "cs_w64_mask_detect", |
| @@ -924,6 +924,9 @@ def run_suite(a, work: str) -> int: | |||
| 924 | "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], | 924 | "cs_dpp_bank": [0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFD, 0xFFFFFFFC, 7, 7, 7, 7], |
| 925 | "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], | 925 | "cs_dpp_fi": [1, 2, 3, 0x7777, 5, 6, 7, 0x7777], |
| 926 | "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], | 926 | "cs_dpp_w64": [1, 0, 3, 2, 5, 4, 7, 6], |
| 927 | # SHADER-99: -0 and NaN survive (SignedZeroInfNanPreserve, cs_signed_zero_nan.asm); 0 in out[4..7] | ||
| 928 | # without it | ||
| 929 | "cs_signed_zero_nan": [0x80000000, 0x80000000, 0x80008000, 0x00008000, 1, 1, 1, 0x00007C00], | ||
| 927 | "cs_wave64_ballot": [32, 16, 24, 40, 8, 48], | 930 | "cs_wave64_ballot": [32, 16, 24, 40, 8, 48], |
| 928 | "cs_wm_half_ops": [32, 16, 16, 0, 16], | 931 | "cs_wm_half_ops": [32, 16, 16, 0, 16], |
| 929 | "cs_wm_half_cmp": [1, 0, 1, 1], | 932 | "cs_wm_half_cmp": [1, 0, 1, 1], |
| @@ -965,7 +968,7 @@ def run_suite(a, work: str) -> int: | |||
| 965 | } | 968 | } |
| 966 | want = cs_dump_wants[name] | 969 | want = cs_dump_wants[name] |
| 967 | # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / | 970 | # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / |
| 968 | # cs_w32_lds_u8_d16 / cs_w32_sincos / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32 | 971 | # cs_w32_lds_u8_d16 / cs_w32_sincos / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops / cs_signed_zero_nan, the wave32 |
| 969 | # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, | 972 | # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, |
| 970 | # as check.py does, where the device has none | 973 | # as check.py does, where the device has none |
| 971 | # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were | 974 | # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were |
| @@ -974,7 +977,7 @@ def run_suite(a, work: str) -> int: | |||
| 974 | # size 64 without them. | 977 | # size 64 without them. |
| 975 | emulated = w64_emulated() | 978 | emulated = w64_emulated() |
| 976 | partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") | 979 | partial = name in ("cs_w64x_partial", "cs_w64x_partial_scmp") |
| 977 | wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", | 980 | wave64 = name not in ("cs_store", "cs_signed_zero_nan", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", |
| 978 | "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", | 981 | "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", |
| 979 | "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", | 982 | "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", |
| 980 | "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", | 983 | "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", |
| @@ -992,7 +995,7 @@ def run_suite(a, work: str) -> int: | |||
| 992 | else: | 995 | else: |
| 993 | ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, | 996 | ok, detail = judge_cs_dump(rc, msg, want, wave64=wave64, partial=partial, emulated=emulated, |
| 994 | hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16", | 997 | hexwords=name in ("cs_store", "cs_smem_soffset_imm", "cs_w32_lds_u8_d16", |
| 995 | "cs_lds_b64_cmpst")) | 998 | "cs_lds_b64_cmpst", "cs_signed_zero_nan")) |
| 996 | results.append((name, ok, detail)) | 999 | results.append((name, ok, detail)) |
| 997 | elif name == "cs_imgstore": | 1000 | elif name == "cs_imgstore": |
| 998 | rc, msg = run_cmd([vk_store, spv]) | 1001 | rc, msg = run_cmd([vk_store, spv]) |