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:20:04 +0100
committerGitHub <noreply@github.com>2026-11-25 00:20:04 +0100
commite0b08c77d3e168483b3e6f0a0bb093893b4e54d3 (patch)
treedb5d7408c005e472ec356536a557fdf98090234b /docs/testing.md
parent3a73ce11ad3bdec1cc99134a3df3fb0bd2a412e9 (diff)
parent7fb019f2202c91a6f1fe6337d69cacd1028daca7 (diff)
Merge pull request #1047 from milk4sale/shader/round-f64-specials
rdna2spirv: the binary64 roundings keep a NaN's bits and round a subnormal without the driver (SHADER-ROUND-F64-SPECIALS)
Diffstat (limited to 'docs/testing.md')
-rw-r--r--docs/testing.md29
1 files changed, 17 insertions, 12 deletions
diff --git a/docs/testing.md b/docs/testing.md
index 79af9551c..9ed1636d3 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -419,21 +419,26 @@ the largest finite value, the infinities, and quiet and signalling NaNs. Each th
419`v_trunc_f64` with a `neg` source, `v_ceil_f64` with an `abs` source, a `v_floor_f64` whose destination pair overlaps 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 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 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 422source's sign), and `tests/test_gpu_round_f64.py` checks that oracle against exact rational rounding. All 1152 heap
423input are judged by what Vulkan lets a driver do, not by RDNA2: a NaN may come back as another NaN, and a subnormal 423words are compared exactly, the 128 unchanged input words included: a NaN and a subnormal are rounded by the
424may be read as a zero of its sign, because the module does not declare `DenormPreserve` for 64 bits. All 1152 heap 424translated code with integer ops and not by the driver, as the row in [design.md](design.md) says. (llvmpipe gets
425words are judged, the 128 unchanged input words included. Run it alone with 425one allowance, for what it does to `Trunc` and `RoundEven` on some CPUs; see below.) Run it alone with
426`python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_round_f64 --require-pass`. 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. 427It needs `shaderFloat64`; a device without it reports a skip.
428 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 429Measured: on an RTX 4070 Ti (NVIDIA 620.70.06, Linux) and on llvmpipe (Mesa 26.2.6, LLVM 23.1.4) all 1152 words
430of the two signalling NaNs, which come back quiet with sign and payload kept (`0x7ff0000000000001` gives 430match. While those two kinds of input still went to the driver's function, 15 of the 512 results differed on the
431`0x7ff8000000000001`). On llvmpipe (Mesa 26.2.6, LLVM 23.1.4) five more differ: the two smallest subnormals are read 4314070 Ti, those of the two signalling NaNs, which came back quiet with sign and payload kept (`0x7ff0000000000001`
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 432gave `0x7ff8000000000001`), and five more on llvmpipe, which read the two smallest subnormals as zero (`v_ceil_f64`
433of -1. Rules broken one at a time each failed the test on both devices: `rndne` lowered as `floor(x + 0.5)` (word 433of the positive one gave +0 instead of 1, `v_floor_f64` of the negative one -0 instead of -1). Rules broken one at a
43420, the sign of -0), `trunc` or `ceil` lowered as `Floor`, the `neg` or the `abs` source modifier ignored (words 8 and 434time each failed the test on both devices: a NaN left to the driver (word 784), the NaN and subnormal tests ignoring
43526), the low result word taken from the high one (word 8), and the fixture without its `v_cmpx` (word 30). Replacing 435the low dword, `v_ceil_f64` or `v_floor_f64` lifting the subnormal of the wrong sign (words 34 and 38), a subnormal's
436`RoundEven` by GLSL `Round` changed nothing on either device: both send a tie to the even integer. 436result losing its sign (word 40), a NaN's low word dropped (word 784), `rndne` lowered as `floor(x + 0.5)` (word 20,
437the sign of -0), `trunc` or `ceil` lowered as `Floor`, the `neg` or the `abs` source modifier ignored (words 8 and
43826), the two result words swapped (word 8), and the fixture without its `v_cmpx` (word 30). Two changes are not
439caught everywhere: a subnormal left to the driver fails on llvmpipe (word 34) and passes on the 4070 Ti, which keeps
440binary64 denormals, and `RoundEven` replaced by GLSL `Round` changes nothing on either device, since both send a tie
441to the even integer.
437 442
438llvmpipe gave those results on a CPU with AVX-512. On one without it, `Trunc` and `RoundEven` of a double go through 443llvmpipe 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) 444the code llvmpipe has for a float, because its double vectors are twice its native width (512 bits at the usual 256)