upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authormilk4sale <53350507+milk4sale@users.noreply.github.com>2026-11-24 11:04:58 -0600
committermilk4sale <53350507+milk4sale@users.noreply.github.com>2026-11-24 11:04:58 -0600
commit355c8c9c2da01a9898df5061d266ca1f5567cdc9 (patch)
treee6a7a48be15c3500c607b2749278f5c0508e19c6 /scripts
parent50407827cd2cb73313c585cdf3d3d40ed7918bae (diff)
tests: GPU readback for the binary64 roundings, v_trunc_f64, v_ceil_f64, v_rndne_f64 and v_floor_f64 (GPU-ROUND-F64)
The translator gives the four ops to the driver's double-precision Trunc, Ceil, RoundEven and Floor, and no fixture in runtime/test/shaders ran them, so what a driver does with ties, the largest value below 0.5, values at and above 2^52, signed zeros, subnormals, infinities and NaNs had never gone through the GPU suite. cs_w32_round_f64 is memory-fed, like cs_w32_shift64 and cs_w32_cmp_f64: check.py seeds 64 inputs and each thread loads one at run time and stores eight results: the four roundings, v_trunc_f64 with a neg source, v_ceil_f64 with an abs source, a v_floor_f64 whose destination pair overlaps its source pair, and a v_rndne_f64 run with the odd threads turned off, whose destination must keep the pair it held. The expected words come from Python floats (exact IEEE-754, the result keeping its source's sign) and are checked against exact rational rounding in tests/test_gpu_round_f64.py. Two kinds of input are judged by what Vulkan lets a driver do, not by RDNA2: a NaN may come back as another NaN, and a subnormal may be read as a zero of its sign, since the module declares no DenormPreserve for 64 bits. That is what the fixture measured: on an RTX 4070 Ti a signalling NaN comes back quiet, and on llvmpipe the smallest subnormals are also read as zero. The row in docs/design.md records both as an approximation. dump_test takes an optional judge for such a readback. No translator or runtime change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/run_gpu_tests.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/run_gpu_tests.py b/scripts/run_gpu_tests.py
index fa69a5f1e..aac6efeee 100644
--- a/scripts/run_gpu_tests.py
+++ b/scripts/run_gpu_tests.py
@@ -38,6 +38,7 @@ from check import cbv_modulate_test
38from check import HEAP_INIT_EXPECTED, heap_init_env # cs_heap_init: vk_compute_test's VKC_HEAP_INIT 38from check import HEAP_INIT_EXPECTED, heap_init_env # cs_heap_init: vk_compute_test's VKC_HEAP_INIT
39from check import shift64_test # dynamic 64-bit vector shifts and overlapping destinations 39from check import shift64_test # dynamic 64-bit vector shifts and overlapping destinations
40from check import cmp_f64_test # the 32 binary64 vector compares on memory-fed operands 40from check import cmp_f64_test # the 32 binary64 vector compares on memory-fed operands
41from check import round_f64_test # the four binary64 roundings on memory-fed inputs
41from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan) 42from check import judged_words, words_match # dump words not judged on some devices (cs_signed_zero_nan)
42from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py 43from check import TEXOFF_ARGS, texoff_problem # ps_texoff's expected words and arguments live in check.py
43from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8 44from check import TEXOFF_FALLBACK, texoff_env # LEONIDA_TEXOFF_FALLBACK=1: texel offsets without maintenance8
@@ -992,6 +993,10 @@ def run_suite(a, work: str) -> int:
992 detail = cmp_f64_test(a.build, spirv_dir, cs_env) 993 detail = cmp_f64_test(a.build, spirv_dir, cs_env)
993 results.append((name, None if isinstance(detail, Skip) else not detail, 994 results.append((name, None if isinstance(detail, Skip) else not detail,
994 detail or "1536 words exact (256 operand pairs and unchanged inputs)")) 995 detail or "1536 words exact (256 operand pairs and unchanged inputs)"))
996 elif name == "cs_w32_round_f64":
997 detail = round_f64_test(a.build, spirv_dir, cs_env)
998 results.append((name, None if isinstance(detail, Skip) else not detail,
999 detail or "1152 words judged (64 inputs, eight roundings each, and unchanged inputs)"))
995 elif name == "cs_workgroup_yz": 1000 elif name == "cs_workgroup_yz":
996 rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env) 1001 rc, msg = run_cmd([vk_compute, spv, "2x3x4", "workgroup_yz"], env=cs_env)
997 results.append((name,) + compute_result(rc, msg, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches" 1002 results.append((name,) + compute_result(rc, msg, rc == 0 and "2x3x4 workgroup Y/Z: 0 mismatches"