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:
authormilk4sale <53350507+milk4sale@users.noreply.github.com>2026-11-24 11:15:37 -0600
committermilk4sale <53350507+milk4sale@users.noreply.github.com>2026-11-24 11:15:37 -0600
commit26d010b41dc042bc36698f673ad588a1e6d04f07 (patch)
treee1c0ddb2ee6fb475b69d13b614e544103e32a7dc /docs/testing.md
parent355c8c9c2da01a9898df5061d266ca1f5567cdc9 (diff)
rdna2spirv: the binary64 roundings keep a NaN's bits and round a subnormal without the driver (SHADER-ROUND-F64-SPECIALS)
v_trunc_f64, v_ceil_f64, v_rndne_f64 and v_floor_f64 hand their source to the driver's double-precision Trunc, Ceil, RoundEven and Floor. Vulkan lets a driver return any NaN for a NaN operand and, with no DenormPreserve for 64 bits, read a subnormal as zero, and cs_w32_round_f64 measured both: a signalling NaN came back quiet on an RTX 4070 Ti (NVIDIA 620.70.06) and on llvmpipe, and llvmpipe read the smallest subnormals as zero, so v_ceil_f64 of the positive one gave +0. RDNA2 returns a NaN unchanged and keeps subnormals: that ceil is 1. The two kinds of source are now selected with integer ops on the words, after the source modifiers and before the output ones. A NaN's words pass through. A subnormal gives a zero of its sign, or 1 with its sign where the op rounds that sign away from zero (ceil of a positive one, floor of a negative one). Every other source still takes the driver's result. cs_w32_round_f64 now compares all 1152 words exactly, on both devices. tests/semantic/test_f64_round.py runs the four ops under a model of a driver that quiets a NaN and reads a subnormal as zero; without the change that class fails for the signalling NaNs and for ceil and floor of a subnormal. The row in docs/design.md describes the rule and how it was confirmed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'docs/testing.md')
-rw-r--r--docs/testing.md28
1 files changed, 16 insertions, 12 deletions
diff --git a/docs/testing.md b/docs/testing.md
index 4d76e9f2e..b0ae7a170 100644
--- a/docs/testing.md
+++ b/docs/testing.md
@@ -381,21 +381,25 @@ the largest finite value, the infinities, and quiet and signalling NaNs. Each th
381`v_trunc_f64` with a `neg` source, `v_ceil_f64` with an `abs` source, a `v_floor_f64` whose destination pair overlaps 381`v_trunc_f64` with a `neg` source, `v_ceil_f64` with an `abs` source, a `v_floor_f64` whose destination pair overlaps
382its source pair, and a `v_rndne_f64` run with the odd threads turned off, whose destination must keep the pair it 382its source pair, and a `v_rndne_f64` run with the odd threads turned off, whose destination must keep the pair it
383held. The expected words come from Python (`round_f64` in `check.py`: exact IEEE-754, the result keeping its 383held. The expected words come from Python (`round_f64` in `check.py`: exact IEEE-754, the result keeping its
384source's sign), and `tests/test_gpu_round_f64.py` checks that oracle against exact rational rounding. Two kinds of 384source's sign), and `tests/test_gpu_round_f64.py` checks that oracle against exact rational rounding. All 1152 heap
385input are judged by what Vulkan lets a driver do, not by RDNA2: a NaN may come back as another NaN, and a subnormal 385words are compared exactly, the 128 unchanged input words included: a NaN and a subnormal are rounded by the
386may be read as a zero of its sign, because the module does not declare `DenormPreserve` for 64 bits. All 1152 heap 386translated code with integer ops and not by the driver, as the row in [design.md](design.md) says. Run it alone with
387words are judged, the 128 unchanged input words included. Run it alone with
388`python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_round_f64 --require-pass`. 387`python -I scripts/run_gpu_tests.py --build runtime/build --filter cs_w32_round_f64 --require-pass`.
389It needs `shaderFloat64`; a device without it reports a skip. 388It needs `shaderFloat64`; a device without it reports a skip.
390 389
391Measured: on an RTX 4070 Ti (NVIDIA 620.70.06, Linux) 497 of the 512 results are RDNA2's, and the other 15 are those 390Measured: on an RTX 4070 Ti (NVIDIA 620.70.06, Linux) and on llvmpipe (Mesa 26.2.6, LLVM 23.1.4) all 1152 words
392of the two signalling NaNs, which come back quiet with sign and payload kept (`0x7ff0000000000001` gives 391match. While those two kinds of input still went to the driver's function, 15 of the 512 results differed on the
393`0x7ff8000000000001`). On llvmpipe (Mesa 26.2.6, LLVM 23.1.4) five more differ: the two smallest subnormals are read 3924070 Ti, those of the two signalling NaNs, which came back quiet with sign and payload kept (`0x7ff0000000000001`
394as zero, so `v_ceil_f64` of the positive one gives +0 instead of 1 and `v_floor_f64` of the negative one -0 instead 393gave `0x7ff8000000000001`), and five more on llvmpipe, which read the two smallest subnormals as zero (`v_ceil_f64`
395of -1. Rules broken one at a time each failed the test on both devices: `rndne` lowered as `floor(x + 0.5)` (word 394of the positive one gave +0 instead of 1, `v_floor_f64` of the negative one -0 instead of -1). Rules broken one at a
39620, the sign of -0), `trunc` or `ceil` lowered as `Floor`, the `neg` or the `abs` source modifier ignored (words 8 and 395time each failed the test on both devices: a NaN left to the driver (word 784), the NaN and subnormal tests ignoring
39726), the low result word taken from the high one (word 8), and the fixture without its `v_cmpx` (word 30). Replacing 396the low dword, `v_ceil_f64` or `v_floor_f64` lifting the subnormal of the wrong sign (words 34 and 38), a subnormal's
398`RoundEven` by GLSL `Round` changed nothing on either device: both send a tie to the even integer. 397result losing its sign (word 40), a NaN's low word dropped (word 784), `rndne` lowered as `floor(x + 0.5)` (word 20,
398the sign of -0), `trunc` or `ceil` lowered as `Floor`, the `neg` or the `abs` source modifier ignored (words 8 and
39926), the two result words swapped (word 8), and the fixture without its `v_cmpx` (word 30). Two changes are not
400caught everywhere: a subnormal left to the driver fails on llvmpipe (word 34) and passes on the 4070 Ti, which keeps
401binary64 denormals, and `RoundEven` replaced by GLSL `Round` changes nothing on either device, since both send a tie
402to the even integer.
399 403
400## Wave64 pixel, vertex and geometry shaders (`w64_graphics.py`) 404## Wave64 pixel, vertex and geometry shaders (`w64_graphics.py`)
401 405