diff options
| author | SirAmong <ariel.morocho@hotmail.com> | 2026-11-22 08:34:03 -0500 |
|---|---|---|
| committer | SirAmong <ariel.morocho@hotmail.com> | 2026-11-22 08:34:03 -0500 |
| commit | 64d41a89a6efa357e5e2f0d7396d7e1c5ccc914e (patch) | |
| tree | 6adb3ff4dabe107176405f6837be62c5a2ad8633 /scripts | |
| parent | a0acd33d77babe67a28e398b2936a9f735a50f5d (diff) | |
Translator: v_sin/v_cos reduce with x - RoundEven(x), contract row and GPU test (SHADER-88 follow-up to #1283)
#1283 reduced the angle in turns with Fract. For a negative argument Fract is
1 - |x|, which rounds in binary32: sin(-2**-26 turns) became +0 and the
absolute error was up to ~1.7e-7 at -0.1 turns. x - RoundEven(x) is exact in
binary32 for every finite x and keeps the angle in [-pi, pi]. The change is
inside turn_angle (shared by the f32 and f16 forms), with the variable names
of the line that test_mutations.py anchors on kept.
- tests/semantic/test_alu_sincos.py: f32/f16 against sin/cos(2*pi*x) in
double, tiny arguments (fails on main), whole turns of either sign (+0, as
measured on an RX 6800 by shelbykb2), +-0, inf/NaN, modifiers.
- runtime/test/shaders/cs_w32_sincos.asm: wave32 GPU regression guard
(tolerance 1e-3, the driver Sin is only good to 2^-11), registered in
check.py and run_gpu_tests.py.
- docs/design.md: contract row with the RX 6800 measurement and what is not
matched (half/quarter turns, the small-x constant, inf/NaN words).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/run_gpu_tests.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py index abdde3e9f..82fc4a31c 100644 --- a/scripts/run_gpu_tests.py +++ b/scripts/run_gpu_tests.py | |||
| @@ -858,7 +858,7 @@ def run_suite(a, work: str) -> int: | |||
| 858 | # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. | 858 | # Whole-wave mask test, as in check.py: needs a 64-wide subgroup, skipped where the device has none. |
| 859 | # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. | 859 | # With LEONIDA_W64_EMULATE=1 it was translated with --wave64-emulate and runs on any subgroup size. |
| 860 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) | 860 | results.append((name,) + wavemask_check(vk_compute, spv, cs_env, w64_emulated())) |
| 861 | 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_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", | 861 | 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", |
| 862 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", | 862 | "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", "cs_dpp_ops", "cs_dpp_bank", "cs_dpp_fi", |
| 863 | "cs_dpp_bound", "cs_dpp_w64", | 863 | "cs_dpp_bound", "cs_dpp_w64", |
| 864 | "cs_w64_mask_detect", | 864 | "cs_w64_mask_detect", |
| @@ -929,6 +929,7 @@ def run_suite(a, work: str) -> int: | |||
| 929 | "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820], | 929 | "cs_w64x_partial": [40, 40, 528, 0, 0, 532, 539, 524820], |
| 930 | "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave | 930 | "cs_w64x_partial_scmp": [0, 1, 0, 1, 1, 1, 1, 0], # s_cmp mask, -1 in a partial wave |
| 931 | "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 | 931 | "cs_w32_partial_scmp": [0, 1, 1, 0, 1, 1, 1, 1], # the same in a 20-thread wave32 |
| 932 | "cs_w32_sincos": [1, 1, 1, 1, 1, 1], # SHADER-88 (cs_w32_sincos.asm): angles in turns | ||
| 932 | "cs_w64x_sbarrier": [605, 605, 686, 686, 3032, 3013, 3032, 3031], | 933 | "cs_w64x_sbarrier": [605, 605, 686, 686, 3032, 3013, 3032, 3031], |
| 933 | "cs_w64x_load_ballot_load": [43, 74, 75, 42, 42, 18, 41, 32], | 934 | "cs_w64x_load_ballot_load": [43, 74, 75, 42, 42, 18, 41, 32], |
| 934 | "cs_w64x_andn2_exec": [1, 16, 32, 4144, 2052, 3, 8, 1544], # s_andn2_saveexec/wrexec_b64 (.asm header) | 935 | "cs_w64x_andn2_exec": [1, 16, 32, 4144, 2052, 3, 8, 1544], # s_andn2_saveexec/wrexec_b64 (.asm header) |
| @@ -942,7 +943,7 @@ def run_suite(a, work: str) -> int: | |||
| 942 | } | 943 | } |
| 943 | want = cs_dump_wants[name] | 944 | want = cs_dump_wants[name] |
| 944 | # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / | 945 | # Every dump but cs_store / cs_smem_soffset_imm / cs_w32_lane_wrap / cs_movrelsd_2 / cs_w32_permute / |
| 945 | # cs_w32_lds_u8_d16 / cs_w32_int_ext / cs_w32_salu64 / cs_w32_misc_ext / cs_w32_new_ops, the wave32 | 946 | # 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 |
| 946 | # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, | 947 | # cs_wqm_w32 / cs_bpermute32 and the DPP tests is a whole-wave (wave64) mask test: ask for a 64-wide subgroup and skip, |
| 947 | # as check.py does, where the device has none | 948 | # as check.py does, where the device has none |
| 948 | # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were | 949 | # (vk_compute_test exits 77) instead of reporting a failure. With LEONIDA_W64_EMULATE=1 they were |
| @@ -954,7 +955,7 @@ def run_suite(a, work: str) -> int: | |||
| 954 | wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", | 955 | wave64 = name not in ("cs_store", "cs_smem_soffset_imm", "cs_wqm_w32", "cs_w32_lane_wrap", "cs_movrelsd_2", |
| 955 | "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", | 956 | "cs_w32_permute", "cs_barrier_divergent", "cs_barrier_early_end", "cs_barrier_loop", |
| 956 | "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", | 957 | "cs_w32_lds_u8_d16", "cs_w32_int_ext", "cs_w32_salu64", "cs_w32_misc_ext", "cs_w32_new_ops", |
| 957 | "cs_bpermute32", "cs_w32_partial_scmp", | 958 | "cs_bpermute32", "cs_w32_partial_scmp", "cs_w32_sincos", |
| 958 | "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", | 959 | "cs_exec_const", "cs_w32_mask_imm", "cs_dpp", "cs_dpp_row", "cs_dpp_mask", "cs_dpp8", |
| 959 | "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial | 960 | "cs_dpp_ops", "cs_dpp_bound", "cs_dpp_bank", "cs_dpp_fi") and not emulated and not partial |
| 960 | if partial and not emulated: | 961 | if partial and not emulated: |