upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs/testing.md
diff options
context:
space:
mode:
authoraslan2142 <jan.trencansky@protonmail.com>2026-11-25 00:19:03 +0100
committerGitHub <noreply@github.com>2026-11-25 00:19:03 +0100
commit3a73ce11ad3bdec1cc99134a3df3fb0bd2a412e9 (patch)
treea20158a32824b9c4bcf20fcb9eacbac5e156dadb /docs/testing.md
parent16ff59721bb7302f8ab30bb67291266f613624b8 (diff)
parent69935f84ee8d670626594c3c5e4a171b2e20fcf0 (diff)
Merge pull request #1034 from milk4sale/gpu-test/round-f64
tests: GPU readback for the binary64 roundings, v_trunc_f64, v_ceil_f64, v_rndne_f64 and v_floor_f64 (GPU-ROUND-F64)
Diffstat (limited to 'docs/testing.md')
-rw-r--r--docs/testing.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/testing.md b/docs/testing.md
index 305fae1bc..79af9551c 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -411,6 +411,43 @@ canonicalization at word 206, a NaN test that ignores the low dword at word 28,
411dword at word 70, the raw result written to an inactive lane's VCC at word 2, `v_cmpx_` replacing EXEC at word 3, 411dword at word 70, the raw result written to an inactive lane's VCC at word 2, `v_cmpx_` replacing EXEC at word 3,
412`abs` ignored and `nlt` lowered as the negation of `le` at word 0. 412`abs` ignored and `nlt` lowered as the negation of `le` at word 0.
413 413
414`cs_w32_round_f64` checks `v_trunc_f64`, `v_ceil_f64`, `v_rndne_f64` and `v_floor_f64`, which the translator gives
415to the driver's double-precision `Trunc`, `Ceil`, `RoundEven` and `Floor` (`shaderFloat64`). 64 inputs are loaded at
416run time: signed zeros, the smallest subnormals and normals, values around 0.5 and 1 (the largest value below 0.5
417among them), ties from 0.5 to 5.5 and at 2^31 + 0.5, 2^51 + 0.5 and 2^52 - 0.5, integers from 2^52 to 2^63, 1e300,
418the largest finite value, the infinities, and quiet and signalling NaNs. Each thread stores the four roundings,
419`v_trunc_f64` with a `neg` source, `v_ceil_f64` with an `abs` source, a `v_floor_f64` whose destination pair overlaps
420its source pair, and a `v_rndne_f64` run with the odd threads turned off, whose destination must keep the pair it
421held. The expected words come from Python (`round_f64` in `check.py`: exact IEEE-754, the result keeping its
422source's sign), and `tests/test_gpu_round_f64.py` checks that oracle against exact rational rounding. Two kinds of
423input are judged by what Vulkan lets a driver do, not by RDNA2: a NaN may come back as another NaN, and a subnormal
424may be read as a zero of its sign, because the module does not declare `DenormPreserve` for 64 bits. All 1152 heap
425words are judged, the 128 unchanged input words included. Run it alone with
426`python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_round_f64 --require-pass`.
427It needs `shaderFloat64`; a device without it reports a skip.
428
429Measured: on an RTX 4070 Ti (NVIDIA 620.70.06, Linux) 497 of the 512 results are RDNA2's, and the other 15 are those
430of the two signalling NaNs, which come back quiet with sign and payload kept (`0x7ff0000000000001` gives
431`0x7ff8000000000001`). On llvmpipe (Mesa 26.2.6, LLVM 23.1.4) five more differ: the two smallest subnormals are read
432as zero, so `v_ceil_f64` of the positive one gives +0 instead of 1 and `v_floor_f64` of the negative one -0 instead
433of -1. Rules broken one at a time each failed the test on both devices: `rndne` lowered as `floor(x + 0.5)` (word
43420, the sign of -0), `trunc` or `ceil` lowered as `Floor`, the `neg` or the `abs` source modifier ignored (words 8 and
43526), the low result word taken from the high one (word 8), and the fixture without its `v_cmpx` (word 30). Replacing
436`RoundEven` by GLSL `Round` changed nothing on either device: both send a tie to the even integer.
437
438llvmpipe gave those results on a CPU with AVX-512. On one without it, `Trunc` and `RoundEven` of a double go through
439the code llvmpipe has for a float, because its double vectors are twice its native width (512 bits at the usual 256)
440and it only has the exact rounding for a width the CPU has an extension for. There a magnitude above 2^24 comes back
441unchanged (`v_trunc_f64` of 123456789.0625 is 123456789.0625) and `RoundEven` of a smaller one can give the other
442neighbouring integer (1 for 1.5, 0 for the value just above 0.5): 48 of the 512 results, the same 48 with Mesa
44325.2.8 (LLVM 20.1.2) on a CI runner and with Mesa 26.2.6 under `GALLIUM_OVERRIDE_CPU_CAPS=avx`, which is how to see
444it on a CPU that has AVX-512. `Floor` and `Ceil` are exact on that path. The CI's runners differ in this, so the
445unchanged fixture passed or failed there by the machine it got. On llvmpipe the judge therefore lets `v_trunc_f64`
446and `v_rndne_f64` return what that path can give, the source itself above 2^24 and either neighbouring integer
447from 0.5 up to it, and nothing else (`ROUND_F64_FLOAT_PATH` in `check.py`); `v_floor_f64`, `v_ceil_f64`, the kept
448pair and the inputs stay exact there, and no other device gets the allowance. `LP_NATIVE_VECTOR_WIDTH=128` makes
449llvmpipe exact on a CPU with AVX.
450
414## Wave64 pixel, vertex and geometry shaders (`w64_graphics.py`) 451## Wave64 pixel, vertex and geometry shaders (`w64_graphics.py`)
415 452
416Graphics stages have no emulation: on a 32-wide subgroup a wave64 VS, PS or GS runs as two 32-lane halves, and the 453Graphics stages have no emulation: on a 32-wide subgroup a wave64 VS, PS or GS runs as two 32-lane halves, and the