From 59326c8dff56f0f2bdf5277934e924a33ecdf78e Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Wed, 2 Dec 2026 16:14:48 -0800 Subject: [PATCH] Translator: half computes in 16 bits where only 16-bit DenormPreserve is missing, noting half denormals The planner's ruling (T3). On a device with shaderFloat16, 16-bit RoundingModeRTE and 16-bit SignedZeroInfNanPreserve whose only missing 16-bit control is DenormPreserve, the half operations narrow::half_controls gates take the 16-bit route: a half + - * / sqrt and fused multiply-add on the device's 16-bit instructions, half values held at 16 bits, the controlled pair for a float rounded to half, and a half widened from and narrowed to its bits by the device's conversion. It is the 16-bit floats query's existing form, read from one more of its properties. narrow::controlled_modes declares RoundingModeRTE and SignedZeroInfNanPreserve for 16 bits there and no denormal mode: not DenormPreserve for 16 bits (VUID 06296), nor the 64-bit one the independence for 32 bits only ties to it (VUID 06289 asks for the same denormal mode at 16 and 64 bits). The independence rules decide which devices take it as before, and a device missing any other 16-bit control keeps half in float. MoltenVK on the M3 stays off the route: its denormal modes are not independent at all (denormBehaviorIndependence NONE), where the form would tie float's denormal mode to half's and change how the module's float arithmetic reads denormals, which Metal flushes; and its rounding modes are not independent while it offers no 64-bit RoundingModeRTE, so the 16-bit RoundingModeRTE the form declares cannot be declared at every width as VUID 06292 asks. Every module that declares those controls on such a device (narrow::flushes_half_denormals) records the new static note PrecisionNote::DeviceHalfDenormals, "half denormals may flush to zero where Metal preserves them": the Vulkan spec leaves a 16-bit denormal to the device in an entry declaring no 16-bit denormal mode. No other module records it. The conformance suite holds its code, metal2vulkan-degrade-device-half-denormals, among the native notes beside device-denormals (the device's own denormals, the one form built there); validation allows it unbounded, as it does NativeHalfConversion. Run on lavapipe, whose committed profile has this shape: its half arithmetic moves from float to 16 bits. Turnip on an Adreno GPU before the 8xx series reports the same controls (Mesa 26.3.1, tu_device.cc lines 534, 1038-1048: shaderFloat16, RTE and SignedZeroInfNanPreserve for 16 bits, DenormPreserve for 16 bits false below A8XX, independence ALL): not measured on a tile-based phone GPU; no such device in the lab. No performance claim is made. Tests: engine_native_half's new test (the red commit before this) now also asks for the note on each such module and for none under all three controls or without another one. The tests that held lavapipe as the conversion form now hold it under the controls (engine_native_half's rounding kinds, memory and decode widenings and controlled modes; engine_half_hold's held values and division; engine_arith's 16-bit fma profiles), and the conversion form on lavapipe's description without 16-bit RoundingModeRTE. SEMANTICS_VERSION 2325 (development holds 2323; 2324 is mad's), and ARTIFACT_FORMAT_VERSION 601 -> 602 (the new note's codec member). Golden rows are blessed at the pin. Docs: the precision-note catalogue (docs/API.md, the new entry and the conversion entry's controls), docs/HOWTO.md, the runtime README's shaderFloat16 row and its half fma line, the NativeHalfConversion note's device list, api_signatures. The conformance ledger. The form moves lavapipe, whose float controls lack only 16-bit DenormPreserve, onto the 16-bit route. The conformance replay in the pinned lavapipe image (Mesa 26.2.4, LLVM 23.1.1) then answers 79 of the runtime ledger's llvmpipe rows otherwise: - 47 now match Metal and are dropped: vertex-format-half4 28 and integer-vertex-attributes 16 (the rows said lavapipe folds the unrounded OpFConvert pair, with no 16-bit DenormPreserve to make it Metal's; the pair now rounds under the 16-bit controls), and half-texel-nans-rg11b10f's 3 (nearest-sample, read, widened). - 32 now answer otherwise and are replaced, each with the answer and a reason written from this run's printout (first differing element): - vertex-format-half4, 8 rows (Float..Float4, Half..Half4): only the NaN differs now, Metal 0x7fc00000, the device 0xffc00000; one element per component, where the rows recorded the unrounded values (Float, the largest difference inf) or the kept payload (Half). - half-texel-nans, 18 rows (nearest-sample, read and widened of r16f, rg16f, rgba16f, r32f, rg32f, rgba32f): a 16-bit float texel's NaN now narrows to 0x7e00 (the payload dropped, as read-through-sample already answered; Metal hands back the texel's code); a 32-bit one to 0xfe00 (Metal 0x7e00); the widening answers 0xffc00000 (Metal 0x7fc00000). Six rows count more elements than before (the 16f nearest-sample and read rows: 215 -> 472, 428 -> 940, 852 -> 1874), twelve fewer. - bicubic-texel-classes, 6 rows: fewer elements at every site, each count and largest difference the one the 780M and RTX 5080 rows record; within the bicubic note's bound. None of the 79 is a half denormal. docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py): ledger rows 7932 -> 7885. The image is the pinned one, so the ledger's llvmpipe line does not move. Not replayed, a follow-up: the six bicubic-texel-classes rows of venue "llvmpipe (LLVM 23.1.4, 256 bits)", a lavapipe outside the pinned image; this commit leaves them as they were. Verified: the replay of this tree without the ledger edit, job m3-max-80972 (pinned lavapipe image): exit 1 with row differs 32, now answers otherwise 32, now matches 47; the rows are written from its printout. The same counts in job m3-max-80871 (the pre-rebase fix, against its base, which exits 0). coverage.py --check: as derived. No lab card's translation moves. The golden blesses at development (15898e612e) and at this change, over the committed profiles plus the RX 7900 XTX's vulkaninfo --json capture (job m3-max-80916), compared cell for cell, job m3-max-81006 (macOS, every fixture, 3624 rows): every column but lavapipe, gate-lavapipe and gate-lavapipe-x86_64 (471 cells each) is equal, among them the XTX capture, amd-780m-radv, amd-780m-hawkpoint-radv, intel-irisxe-rplp-anv, intel-irisxe-anv and moltenvk-m3; no profile fingerprint moves (job m3-max-80958, the same over the 1910 rows a Linux host assembles, agrees). Not run on an RTX 3090: its column is owed until the card is back. Gate at this tree, job m3-max-80990: clippy -D warnings plain, under m2v_cpu_icd and under m2v_gpu 0; rustdoc -D warnings 0, and with private items for metal2vulkan 0; the runtime's suite on lavapipe 945 passed, 4 skipped (whole suite); translator and AIR 3415 passed, 37 skipped (the golden hash table, the fixture inventory and the engine printouts excluded: their bless is due at the pin); validation 1319 passed, 3 skipped; conformance 1048 passed. CI's lavapipe steps in the pinned image, job m3-max-81012: device tests 841 passed (843 listed), the conformance replay exit 0 (the 4640 gaps the ledger expects, exactly), public case qualification exit 0. --- .../known-gaps-rt.tsv | 111 ++++-------- .../src/degradation.rs | 5 + crates/metal2vulkan-conformance/src/replay.rs | 5 +- crates/metal2vulkan-runtime/README.md | 6 +- .../src/observation_contract/comparison.rs | 5 +- .../observation_contract/comparison/tests.rs | 1 + crates/metal2vulkan/src/cache/codec.rs | 1 + crates/metal2vulkan/src/cache/mod.rs | 4 +- crates/metal2vulkan/src/cache/tests.rs | 9 + crates/metal2vulkan/src/lower/arith/narrow.rs | 43 ++++- crates/metal2vulkan/src/pipeline/artifact.rs | 33 +++- crates/metal2vulkan/src/pipeline/compile.rs | 6 + crates/metal2vulkan/src/tests/engine_arith.rs | 17 +- .../src/tests/engine_half_hold.rs | 39 +++-- .../src/tests/engine_native_half.rs | 162 +++++++++++++----- crates/metal2vulkan/tests/api_signatures.tsv | 2 + docs/API.md | 20 ++- docs/CONFORMANCE-COVERAGE.md | 71 ++------ docs/HOWTO.md | 5 +- 19 files changed, 320 insertions(+), 225 deletions(-) diff --git a/crates/metal2vulkan-conformance/known-gaps-rt.tsv b/crates/metal2vulkan-conformance/known-gaps-rt.tsv index 3289cae55..e55aa9691 100644 --- a/crates/metal2vulkan-conformance/known-gaps-rt.tsv +++ b/crates/metal2vulkan-conformance/known-gaps-rt.tsv @@ -714,33 +714,30 @@ half-storage-writes-rg16f-write llvmpipe divergent case/stored 4094 elements dif half-storage-writes-rgba16f-held llvmpipe divergent case/stored 8188 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a `half` NaN written to a 16-bit float storage texture an argument buffer holds. Metal stores 0x7e00 at the first differing element; the device stores 0xfe00. Note `device-nan-encoding`. half-storage-writes-rgba16f-read-write llvmpipe divergent case/stored 8188 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a `half` NaN written to a 16-bit float storage texture. Metal stores the canonical 0x7e00; the device's store keeps the NaN's sign (0xfe00). Note `device-nan-encoding`. half-storage-writes-rgba16f-write llvmpipe divergent case/stored 8188 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a `half` NaN written to a 16-bit float storage texture. Metal stores the canonical 0x7e00; the device's store keeps the NaN's sign (0xfe00). Note `device-nan-encoding`. -half-texel-nans-r16f llvmpipe divergent case/words/nearest-sample 215 elements differ (U16), the largest difference 512 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` nearest sample. Metal hands back the texel's own code (0x7c01 at the first differing element); lavapipe's sample keeps the payload and sets the quiet bit (0x7e01). Notes `half-texel-conversion` and `native-half-conversion`. -half-texel-nans-r16f llvmpipe divergent case/words/read 215 elements differ (U16), the largest difference 512 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7c01 at the first differing element); lavapipe's fetch keeps the payload and sets the quiet bit (0x7e01), as nearest-sample does. Notes `half-texel-conversion` and `native-half-conversion`. lavapipe's fetch answers a NaN by descriptor: this site has answered as nearest-sample and, in an earlier whole-set run with the texture at another element of set 1's sampled-texture array, as read-through-sample (0x7e00, the payload dropped). The runtime reads with `OpImageFetch` of a sampled float image, then `OpFConvert` to `half` (Mesa's SPIR-V dump of its modules). +half-texel-nans-r16f llvmpipe divergent case/words/nearest-sample 472 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` nearest sample. Metal hands back the texel's own code (0x7c01 at the first differing element); lavapipe's sample, narrowed to `half` under the 16-bit float controls, answers the quiet NaN of its sign with the payload dropped (0x7e00), as its `read()` of a sample-access texture does. Notes `half-texel-conversion` and `native-half-conversion`. +half-texel-nans-r16f llvmpipe divergent case/words/read 472 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7c01 at the first differing element); lavapipe's fetch, narrowed to `half` under the 16-bit float controls, answers the quiet NaN of its sign with the payload dropped (0x7e00), as its `read()` of a sample-access texture does. Notes `half-texel-conversion` and `native-half-conversion`. half-texel-nans-r16f llvmpipe divergent case/words/read-through-sample 472 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal hands back the texel's own code (0x7c01 at the first differing element); lavapipe's fetch drops the payload, answering the quiet NaN of its sign (0x7e00). Notes `half-texel-conversion` and `native-half-conversion`. -half-texel-nans-r16f llvmpipe divergent case/words/widened 515 elements differ (U32), the largest difference 2151669760 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening keeps the NaN's sign and payload (0x7fc02000 at the first differing element). Notes `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-r32f llvmpipe divergent case/words/nearest-sample 555 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample narrows it with every payload bit set (0x7fff). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-r32f llvmpipe divergent case/words/read 597 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch narrows it with every payload bit set (0x7fff), as nearest-sample does. Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. lavapipe's fetch answers a NaN by descriptor: this site has answered as nearest-sample and, in an earlier whole-set run with the texture at another element of set 1's sampled-texture array, as read-through-sample: the same pattern as half-texel-nans-r16f's `read` row; not dumped for this format. +half-texel-nans-r16f llvmpipe divergent case/words/widened 257 elements differ (U32), the largest difference 2147483648 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening, under the 16-bit float controls, answers 0xffc00000 at the first differing element (the sign bit set). Notes `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-r32f llvmpipe divergent case/words/nearest-sample 256 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample, narrowed to `half` under the 16-bit float controls, answers it with the sign bit set (0xfe00 at the first differing element, as its `read()` of a sample-access texture answers there). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-r32f llvmpipe divergent case/words/read 214 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch, narrowed to `half` under the 16-bit float controls, answers it with the sign bit set (0xfe00 at the first differing element, as its `read()` of a sample-access texture answers there). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. half-texel-nans-r32f llvmpipe divergent case/words/read-through-sample 214 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch narrows it keeping its sign (0xfe00). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-r32f llvmpipe divergent case/words/widened 768 elements differ (U32), the largest difference 2151677951 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening keeps the NaN's sign and payload (0x7f800001 at the first differing element). Notes `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rg11b10f llvmpipe divergent case/words/nearest-sample 1024 elements differ (U16), the largest difference 496 The device's own answer (rule 1): a small float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's decode keeps the payload (0x7e10). Notes `half-texel-conversion` and `native-half-conversion`. -half-texel-nans-rg11b10f llvmpipe divergent case/words/read 1024 elements differ (U16), the largest difference 496 The device's own answer (rule 1): a small float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's decode keeps the payload (0x7e10), as nearest-sample does. Notes `half-texel-conversion` and `native-half-conversion`. lavapipe's fetch answers a NaN by descriptor: this site has answered as nearest-sample and, in an earlier whole-set run with the texture at another element of set 1's sampled-texture array, as read-through-sample: the same pattern as half-texel-nans-r16f's `read` row; not dumped for this format. -half-texel-nans-rg11b10f llvmpipe divergent case/words/widened 1024 elements differ (U32), the largest difference 4063232 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening keeps the NaN's sign and payload (0x7f820000 at the first differing element). Notes `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rg16f llvmpipe divergent case/words/nearest-sample 428 elements differ (U16), the largest difference 512 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` nearest sample. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's sample keeps the payload and sets the quiet bit (0x7f55). Notes `half-texel-conversion` and `native-half-conversion`. -half-texel-nans-rg16f llvmpipe divergent case/words/read 428 elements differ (U16), the largest difference 512 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's fetch keeps the payload and sets the quiet bit (0x7f55), as nearest-sample does. Notes `half-texel-conversion` and `native-half-conversion`. lavapipe's fetch answers a NaN by descriptor: this site has answered as nearest-sample and, in an earlier whole-set run with the texture at another element of set 1's sampled-texture array, as read-through-sample: the same pattern as half-texel-nans-r16f's `read` row; not dumped for this format. +half-texel-nans-r32f llvmpipe divergent case/words/widened 214 elements differ (U32), the largest difference 2147483648 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening, under the 16-bit float controls, answers 0xffc00000 at the first differing element (the sign bit set). Notes `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-rg16f llvmpipe divergent case/words/nearest-sample 940 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` nearest sample. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's sample, narrowed to `half` under the 16-bit float controls, answers the quiet NaN of its sign with the payload dropped (0x7e00), as its `read()` of a sample-access texture does. Notes `half-texel-conversion` and `native-half-conversion`. +half-texel-nans-rg16f llvmpipe divergent case/words/read 940 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's fetch, narrowed to `half` under the 16-bit float controls, answers the quiet NaN of its sign with the payload dropped (0x7e00), as its `read()` of a sample-access texture does. Notes `half-texel-conversion` and `native-half-conversion`. half-texel-nans-rg16f llvmpipe divergent case/words/read-through-sample 940 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's fetch drops the payload, answering the quiet NaN of its sign (0x7e00). Notes `half-texel-conversion` and `native-half-conversion`. -half-texel-nans-rg16f llvmpipe divergent case/words/widened 1026 elements differ (U32), the largest difference 2151669760 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening keeps the NaN's sign and payload (0x7feaa000 at the first differing element). Notes `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rg32f llvmpipe divergent case/words/nearest-sample 1109 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample narrows it with every payload bit set (0x7fff). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rg32f llvmpipe divergent case/words/read 1194 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch narrows it with every payload bit set (0x7fff), as nearest-sample does. Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. lavapipe's fetch answers a NaN by descriptor: this site has answered as nearest-sample and, in an earlier whole-set run with the texture at another element of set 1's sampled-texture array, as read-through-sample: the same pattern as half-texel-nans-r16f's `read` row; not dumped for this format. +half-texel-nans-rg16f llvmpipe divergent case/words/widened 514 elements differ (U32), the largest difference 2147483648 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening, under the 16-bit float controls, answers 0xffc00000 at the first differing element (the sign bit set). Notes `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-rg32f llvmpipe divergent case/words/nearest-sample 511 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample, narrowed to `half` under the 16-bit float controls, answers it with the sign bit set (0xfe00 at the first differing element, as its `read()` of a sample-access texture answers there). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-rg32f llvmpipe divergent case/words/read 426 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch, narrowed to `half` under the 16-bit float controls, answers it with the sign bit set (0xfe00 at the first differing element, as its `read()` of a sample-access texture answers there). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. half-texel-nans-rg32f llvmpipe divergent case/words/read-through-sample 426 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch narrows it keeping its sign (0xfe00). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rg32f llvmpipe divergent case/words/widened 1535 elements differ (U32), the largest difference 2151677951 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening keeps the NaN's sign and payload (0x7fffffff at the first differing element). Notes `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rgba16f llvmpipe divergent case/words/nearest-sample 852 elements differ (U16), the largest difference 512 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` nearest sample. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's sample keeps the payload and sets the quiet bit (0x7f55). Notes `half-texel-conversion` and `native-half-conversion`. -half-texel-nans-rgba16f llvmpipe divergent case/words/read 852 elements differ (U16), the largest difference 512 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's fetch keeps the payload and sets the quiet bit (0x7f55), as nearest-sample does. Notes `half-texel-conversion` and `native-half-conversion`. lavapipe's fetch answers a NaN by descriptor: this site has answered as nearest-sample and, in an earlier whole-set run with the texture at another element of set 1's sampled-texture array, as read-through-sample: the same pattern as half-texel-nans-r16f's `read` row; not dumped for this format. +half-texel-nans-rg32f llvmpipe divergent case/words/widened 426 elements differ (U32), the largest difference 2147483648 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening, under the 16-bit float controls, answers 0xffc00000 at the first differing element (the sign bit set). Notes `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-rgba16f llvmpipe divergent case/words/nearest-sample 1874 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` nearest sample. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's sample, narrowed to `half` under the 16-bit float controls, answers the quiet NaN of its sign with the payload dropped (0x7e00), as its `read()` of a sample-access texture does. Notes `half-texel-conversion` and `native-half-conversion`. +half-texel-nans-rgba16f llvmpipe divergent case/words/read 1874 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's fetch, narrowed to `half` under the 16-bit float controls, answers the quiet NaN of its sign with the payload dropped (0x7e00), as its `read()` of a sample-access texture does. Notes `half-texel-conversion` and `native-half-conversion`. half-texel-nans-rgba16f llvmpipe divergent case/words/read-through-sample 1874 elements differ (U16), the largest difference 511 The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal hands back the texel's own code (0x7d55 at the first differing element); lavapipe's fetch drops the payload, answering the quiet NaN of its sign (0x7e00). Notes `half-texel-conversion` and `native-half-conversion`. -half-texel-nans-rgba16f llvmpipe divergent case/words/widened 2045 elements differ (U32), the largest difference 2151669760 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening keeps the NaN's sign and payload (0x7feaa000 at the first differing element). Notes `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rgba32f llvmpipe divergent case/words/nearest-sample 2217 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample narrows it with every payload bit set (0x7fff). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rgba32f llvmpipe divergent case/words/read 2388 elements differ (U16), the largest difference 33279 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch narrows it with every payload bit set (0x7fff), as nearest-sample does. Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. lavapipe's fetch answers a NaN by descriptor: this site has answered as nearest-sample and, in an earlier whole-set run with the texture at another element of set 1's sampled-texture array, as read-through-sample: the same pattern as half-texel-nans-r16f's `read` row; not dumped for this format. +half-texel-nans-rgba16f llvmpipe divergent case/words/widened 1022 elements differ (U32), the largest difference 2147483648 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening, under the 16-bit float controls, answers 0xffc00000 at the first differing element (the sign bit set). Notes `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-rgba32f llvmpipe divergent case/words/nearest-sample 1022 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample, narrowed to `half` under the 16-bit float controls, answers it with the sign bit set (0xfe00 at the first differing element, as its `read()` of a sample-access texture answers there). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-rgba32f llvmpipe divergent case/words/read 851 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch, narrowed to `half` under the 16-bit float controls, answers it with the sign bit set (0xfe00 at the first differing element, as its `read()` of a sample-access texture answers there). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. half-texel-nans-rgba32f llvmpipe divergent case/words/read-through-sample 851 elements differ (U16), the largest difference 32768 The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal answers the canonical 0x7e00; lavapipe's fetch narrows it keeping its sign (0xfe00). Notes `half-texel-conversion`, `native-half-conversion` and `native-nan-encoding`. -half-texel-nans-rgba32f llvmpipe divergent case/words/widened 3070 elements differ (U32), the largest difference 2151677951 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening keeps the NaN's sign and payload (0x7fffffff at the first differing element). Notes `native-half-conversion` and `native-nan-encoding`. +half-texel-nans-rgba32f llvmpipe divergent case/words/widened 851 elements differ (U32), the largest difference 2147483648 The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the device's widening, under the 16-bit float controls, answers 0xffc00000 at the first differing element (the sign bit set). Notes `native-half-conversion` and `native-nan-encoding`. half-write-nans-r16f llvmpipe divergent case/stored 8 elements differ (U16), the largest difference 512 The device's own answer (rule 1): a written `half` texel's NaN. Metal stores its own code (0x7c01); the device's store sets the quiet bit (0x7e01). Note `device-nan-encoding`. half-write-nans-r32f llvmpipe divergent case/stored 15 elements differ (U32), the largest difference 2151669760 The device's own answer (rule 1): a written `half` texel's NaN. Metal stores the canonical 0x7fc00000; the device's store keeps the NaN's payload (0x7fc02000). Note `device-nan-encoding`. half-write-nans-rg16f llvmpipe divergent case/stored 16 elements differ (U16), the largest difference 512 The device's own answer (rule 1): a written `half` texel's NaN. Metal stores its own code (0x7c01); the device's store sets the quiet bit (0x7e01). Note `device-nan-encoding`. @@ -7611,12 +7608,12 @@ texture-pairs-usage-crossings * divergent case/MTLPixelFormatRGBA8Unorm/Type2D/6 texture-pairs-usage-crossings * divergent case/MTLPixelFormatRGBA8Unorm/Type3D/64x64x8/levels-1/samples-1/slices-1/usage-0x0/private/texture/usage Metal 23 (0x17), ours 0 (0x0) rt has no usage getter; the site reads descriptor().usage, the descriptor as given; rt takes no bits as every usage wherever it acts. texture-pairs-usage-crossings * divergent case/MTLPixelFormatRGBA8Unorm/Type3D/64x64x8/levels-1/samples-1/slices-1/usage-0x8/private/texture/usage Metal 0 (0x0), ours 8 (0x8) rt has no usage getter; the site reads descriptor().usage, the descriptor as given; rt takes no bits as every usage wherever it acts. bicubic-texel-classes * refused case/rgba8unorm-srgb/dispatch Err(Error::Unsupported("texture slot 0, which a function samples through a bicubic filter, bound to a RGBA8UnormSRGB texture, whose bicubic sample is not built")) Known gap (the rt README, Known gaps of textures): a function's bicubic constexpr sample of a texture of 8-bit sRGB codes is `Gap::BicubicTexels`, naming the slot and the format. Metal sums the decoded taps; the runtime holds the texture as an sRGB image and builds no bicubic sample of it. The fix belongs in the bicubic routine's sRGB arm (`lower::sampler::bicubic`), built when a stream binds one. -bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/mixed/sampled 470 elements differ (F32), the largest difference 0.00040435791015625 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. -bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/r8unorm/sampled 70 elements differ (F32), the largest difference 0.000152587890625 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. -bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/rgba16float/sampled 610 elements differ (F32), the largest difference 0.00037384033203125 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. -bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/rgba16unorm/sampled 598 elements differ (F32), the largest difference 0.00021600723266601563 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. -bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/rgba8snorm/sampled 818 elements differ (F32), the largest difference 0.00040435791015625 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. -bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/rgba8unorm/sampled 578 elements differ (F32), the largest difference 0.0002383589744567871 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. +bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/mixed/sampled 384 elements differ (F32), the largest difference 0.00048828125 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. lavapipe computes `half` under the 16-bit float controls (it lacks only 16-bit `DenormPreserve`), and its answer here is the one the 780M and RTX 5080 rows record. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. +bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/r8unorm/sampled 60 elements differ (F32), the largest difference 0.00011444091796875 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. lavapipe computes `half` under the 16-bit float controls (it lacks only 16-bit `DenormPreserve`), and its answer here is the one the 780M and RTX 5080 rows record. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. +bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/rgba16float/sampled 500 elements differ (F32), the largest difference 0.00037384033203125 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. lavapipe computes `half` under the 16-bit float controls (it lacks only 16-bit `DenormPreserve`), and its answer here is the one the 780M and RTX 5080 rows record. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. +bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/rgba16unorm/sampled 496 elements differ (F32), the largest difference 0.000007758848369121552 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. lavapipe computes `half` under the 16-bit float controls (it lacks only 16-bit `DenormPreserve`), and its answer here is the one the 780M and RTX 5080 rows record. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. +bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/rgba8snorm/sampled 756 elements differ (F32), the largest difference 0.00048828125 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. lavapipe computes `half` under the 16-bit float controls (it lacks only 16-bit `DenormPreserve`), and its answer here is the one the 780M and RTX 5080 rows record. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. +bicubic-texel-classes llvmpipe (LLVM 23.1.1, 256 bits) divergent case/rgba8unorm/sampled 494 elements differ (F32), the largest difference 0.000244140625 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. lavapipe computes `half` under the 16-bit float controls (it lacks only 16-bit `DenormPreserve`), and its answer here is the one the 780M and RTX 5080 rows record. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. bicubic-texel-classes llvmpipe (LLVM 23.1.4, 256 bits) divergent case/rgba8unorm/sampled 578 elements differ (F32), the largest difference 0.0002383589744567871 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. bicubic-texel-classes Apple M3 Max divergent case/mixed/sampled 470 elements differ (F32), the largest difference 0.00040435791015625 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. bicubic-texel-classes Apple M3 Max divergent case/r8unorm/sampled 70 elements differ (F32), the largest difference 0.000152587890625 The device's arithmetic under the static note `bicubic-filter-arithmetic` (rule 1), within its stated bound. Metal's results lie on the format's grid: a sixteenth of a code for the 8-bit classes, a whole code for `RGBA16Unorm`, an exact `half` for `RGBA16Float`; at the six `RGBA16Float` samples where the sum is exactly halfway between two halves, Metal rounds away from zero. Ours is the unrounded `f32` sum of the sixteen decoded taps (the 2D routine, `lower::sampler::bicubic::routines`, `Plane`), and a `half` result is the device's narrowing of it. Every class takes Metal's arm, which the case's own tests hold in Metal's recording: `R32Float` the inner bilinear taps, which compare exactly; the clamp into [0, 1] of the unsigned normalized formats and into [-1, 1] of `RGBA8Snorm`; no clamp of `RGBA16Float`. Open: nothing; the difference is within Metal's precision, which rule 1 leaves to the note. @@ -7686,22 +7683,6 @@ primitive-type-restart-indices Iris(R) Xe divergent case/MTLPrimitiveTypeLineStr format-footprints-plain-stragglers * refused case/MTLPixelFormatBGRA4Unorm/TextureBuffer/64x1x1/levels-1/samples-1/slices-1/usage-0x1/shared/size-and-align Err(Error::Unsupported("no texture of BGRA4Unorm is made on this device for the usage")) refused: rt makes no texture buffer of MTLPixelFormatBGRA4Unorm on any venue (Gap::TextureFormat): a texture buffer's one buffer view takes a format the device holds directly whose buffer features hold both the uniform and the storage texel buffer, and neither of the format's Vulkan formats (A4R4G4B4_UNORM_PACK16, A4B4G4R4_UNORM_PACK16) is such a format there. fractional-viewport-coverage llvmpipe divergent case/drawn/texels 344 elements differ (F32), the largest difference 11.25 An accepted difference (docs/API.md section 10, Draws): Metal states only that fragments outside the viewport are clipped (MTLRenderCommandEncoder.h, setViewport:), not which a pixel the viewport's edge crosses is, so a filled primitive reaching past a viewport whose edge crosses a pixel is covered at that edge by the device's own rule. Metal on the Apple M3 Max covers every pixel the viewport overlaps, a pixel it holds only part of included; lavapipe clips the primitive to the viewport and covers a pixel where its sample lies in the clipped primitive. fractional-viewport-coverage Iris(R) Xe divergent case/drawn/texels 480 elements differ (F32), the largest difference 12 A driver bug and an accepted difference at one site, split by pixel: every differing pixel is a far column or far row Metal drew and the Iris left at the clear (the Iris draws each arm's near column and row as Metal does). (1) 240 elements, 60 pixels, the largest difference 12: a driver bug, not an accepted difference. The far column and row of the two arms whose viewport ends 0.7 into a pixel (origin 2.0 or 2.3 within the cell, extent 7.7 or 7.4): each pixel's centre lies inside the viewport, Metal draws it, and so does Vulkan's rule (a pixel is covered where its sample point lies in the clipped primitive, "Basic Polygon Rasterization"). ANV clamps the hardware scissor to the viewport and truncates its far edge to an integer (`update_scissors` in Mesa's `src/intel/vulkan/genX_gfx_state.c`), so that row and column are not drawn: the rt README's known gap (Known gaps of render encoders, the Iris Xe's fractional viewport). (2) 240 elements, 60 pixels, the largest difference 11.25: an accepted difference (docs/API.md section 10, Draws). The far column and row of the arms whose viewport ends 0.25 into a pixel (origin 2.75, extent 6.5) and on a pixel centre (origin 2.5, extent 7.0): each pixel's centre lies outside the viewport or on its far edge. Metal states only that fragments outside the viewport are clipped (MTLRenderCommandEncoder.h, setViewport:), not which a pixel the viewport's edge crosses is, so a filled primitive reaching past a viewport whose edge crosses a pixel is covered at that edge by the device's own rule. Metal on the Apple M3 Max covers every pixel the viewport overlaps, a pixel it holds only part of included; the Iris leaves these pixels undrawn. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/Short/constant/rows 3 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x47000000, the device 0x46fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/Short/per-vertex/rows 3 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x47000000, the device 0x46fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/Short2/constant/rows 6 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/Short2/per-vertex/rows 6 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/Short3/constant/rows 9 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/Short3/per-vertex/rows 9 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/Short4/constant/rows 12 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/Short4/per-vertex/rows 12 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/UShort/constant/rows 5 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/UShort/per-vertex/rows 5 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/UShort2/constant/rows 10 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45004000, the device 0x45003000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/UShort2/per-vertex/rows 10 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45004000, the device 0x45003000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/UShort3/constant/rows 15 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45004000, the device 0x45003000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/UShort3/per-vertex/rows 15 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45004000, the device 0x45003000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/UShort4/constant/rows 20 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45004000, the device 0x45003000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -integer-vertex-attributes llvmpipe divergent case/int_attribute_to_half4/UShort4/per-vertex/rows 20 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x45004000, the device 0x45003000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. integer-vertex-attributes NVIDIA divergent case/int_attribute_to_half4/Short/constant/rows 3 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and back, a round trip NVIDIA's compiler folds into the value it started from, handing it on unrounded where Metal rounds it to nearest even. Metal reads 0x47000000, the device 0x46fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. integer-vertex-attributes NVIDIA divergent case/int_attribute_to_half4/Short/per-vertex/rows 3 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and back, a round trip NVIDIA's compiler folds into the value it started from, handing it on unrounded where Metal rounds it to nearest even. Metal reads 0x47000000, the device 0x46fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. integer-vertex-attributes NVIDIA divergent case/int_attribute_to_half4/Short2/constant/rows 6 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and back, a round trip NVIDIA's compiler folds into the value it started from, handing it on unrounded where Metal rounds it to nearest even. Metal reads 0x45000000, the device 0x45001000 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. @@ -7753,42 +7734,14 @@ vertex-format-float4 Iris(R) Xe divergent case/MTLVertexFormatHalf/rows 2 elemen vertex-format-float4 Iris(R) Xe divergent case/MTLVertexFormatHalf2/rows 4 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a NaN vertex attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Note `device-nan-encoding`. vertex-format-float4 Iris(R) Xe divergent case/MTLVertexFormatHalf3/rows 6 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a NaN vertex attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Note `device-nan-encoding`. vertex-format-float4 Iris(R) Xe divergent case/MTLVertexFormatHalf4/rows 8 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a NaN vertex attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Note `device-nan-encoding`. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatChar2Normalized/rows 16 elements differ (F32), the largest difference 0.00019609928131103516 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3c010000, the device 0x3c010204 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatChar3Normalized/rows 24 elements differ (F32), the largest difference 0.00019609928131103516 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3c810000, the device 0x3c810204 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatChar4Normalized/rows 32 elements differ (F32), the largest difference 0.00019609928131103516 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3c810000, the device 0x3c810204 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatCharNormalized/rows 8 elements differ (F32), the largest difference 0.00019609928131103516 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3c010000, the device 0x3c010204 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloat/rows 7 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x0, the device 0x1 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloat2/rows 14 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x0, the device 0x7fffff at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloat3/rows 21 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x0, the device 0x7fffff at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloat4/rows 28 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x0, the device 0x7fffff at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloatRG11B10/rows 9 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0x7ffe0000 at the first differing element. Note `device-nan-encoding`. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatHalf/rows 2 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0x7fc02000 at the first differing element. Note `device-nan-encoding`. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatHalf2/rows 4 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0x7fc02000 at the first differing element. Note `device-nan-encoding`. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatHalf3/rows 6 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0x7fc02000 at the first differing element. Note `device-nan-encoding`. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatHalf4/rows 8 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0x7fc02000 at the first differing element. Note `device-nan-encoding`. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatInt1010102Normalized/rows 9 elements differ (F32), the largest difference 0.0001576542854309082 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0xbb004000, the device 0xbb004020 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatShort/rows 2 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0xc7000000, the device 0xc6fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatShort2/rows 4 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0xc7000000, the device 0xc6fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatShort2Normalized/rows 16 elements differ (F32), the largest difference 0.0000152587890625 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x38000000, the device 0x38000100 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatShort3/rows 6 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0xc7000000, the device 0xc6fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatShort3Normalized/rows 24 elements differ (F32), the largest difference 0.0000152587890625 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x38800000, the device 0x38800100 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatShort4/rows 8 elements differ (F32), the largest difference 1 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0xc7000000, the device 0xc6fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatShort4Normalized/rows 32 elements differ (F32), the largest difference 0.0000152587890625 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x38800000, the device 0x38800100 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatShortNormalized/rows 8 elements differ (F32), the largest difference 0.0000152587890625 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x38000000, the device 0x38000100 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUChar2Normalized/rows 20 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3eff0000, the device 0x3efeff00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUChar3Normalized/rows 30 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3eff0000, the device 0x3efeff00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUChar4Normalized/rows 40 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3eff0000, the device 0x3efeff00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUChar4Normalized_BGRA/rows 40 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3f48c000, the device 0x3f48c8ca at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUCharNormalized/rows 10 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3b808000, the device 0x3b808081 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUInt1010102Normalized/rows 8 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3f002000, the device 0x3f002008 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUShort/rows 7 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x47000000, the device 0x46fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUShort2/rows 14 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x47000000, the device 0x46fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUShort2Normalized/rows 20 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3f000000, the device 0x3effff00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUShort3/rows 21 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x47000000, the device 0x46fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUShort3Normalized/rows 30 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3f000000, the device 0x3effff00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUShort4/rows 28 elements differ (F32), the largest difference inf The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x47000000, the device 0x46fffe00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUShort4Normalized/rows 40 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x3f000000, the device 0x3effff00 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. -vertex-format-half4 llvmpipe divergent case/MTLVertexFormatUShortNormalized/rows 10 elements differ (F32), the largest difference 0.0001627802848815918 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits and back (lavapipe has no `shaderDenormPreserveFloat16`, so no float controls make the pair Metal's), and lavapipe's compiler folds the pair, handing the value on unrounded where Metal rounds it to nearest even: Metal reads 0x37800000, the device 0x37800080 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. +vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloat/rows 1 element differs (F32): Metal Single 0x7fc00000, ours Single 0xffc00000 The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, not `DenormPreserve`), and a NaN attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Notes `native-half-conversion` and `native-nan-encoding`. +vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloat2/rows 2 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, not `DenormPreserve`), and a NaN attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Notes `native-half-conversion` and `native-nan-encoding`. +vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloat3/rows 3 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, not `DenormPreserve`), and a NaN attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Notes `native-half-conversion` and `native-nan-encoding`. +vertex-format-half4 llvmpipe divergent case/MTLVertexFormatFloat4/rows 4 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, not `DenormPreserve`), and a NaN attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Notes `native-half-conversion` and `native-nan-encoding`. +vertex-format-half4 llvmpipe divergent case/MTLVertexFormatHalf/rows 1 element differs (F32): Metal Single 0x7fc00000, ours Single 0xffc00000 The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, not `DenormPreserve`), and a NaN attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Notes `native-half-conversion` and `native-nan-encoding`. +vertex-format-half4 llvmpipe divergent case/MTLVertexFormatHalf2/rows 2 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, not `DenormPreserve`), and a NaN attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Notes `native-half-conversion` and `native-nan-encoding`. +vertex-format-half4 llvmpipe divergent case/MTLVertexFormatHalf3/rows 3 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, not `DenormPreserve`), and a NaN attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Notes `native-half-conversion` and `native-nan-encoding`. +vertex-format-half4 llvmpipe divergent case/MTLVertexFormatHalf4/rows 4 elements differ (F32), the largest difference NaN The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, not `DenormPreserve`), and a NaN attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00000, the device 0xffc00000 at the first differing element. Notes `native-half-conversion` and `native-nan-encoding`. vertex-format-half4 NVIDIA divergent case/MTLVertexFormatChar2Normalized/rows 16 elements differ (F32), the largest difference 0.00019609928131103516 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and back, a round trip NVIDIA's compiler folds into the value it started from, handing it on unrounded where Metal rounds it to nearest even. Metal reads 0x3c010000, the device 0x3c010204 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. vertex-format-half4 NVIDIA divergent case/MTLVertexFormatChar3Normalized/rows 24 elements differ (F32), the largest difference 0.00019609928131103516 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and back, a round trip NVIDIA's compiler folds into the value it started from, handing it on unrounded where Metal rounds it to nearest even. Metal reads 0x3c810000, the device 0x3c810204 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. vertex-format-half4 NVIDIA divergent case/MTLVertexFormatChar4Normalized/rows 32 elements differ (F32), the largest difference 0.00019609928131103516 The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and back, a round trip NVIDIA's compiler folds into the value it started from, handing it on unrounded where Metal rounds it to nearest even. Metal reads 0x3c810000, the device 0x3c810204 at the first differing element. Note `native-half-conversion`, whose bound is a value not rounded at all. diff --git a/crates/metal2vulkan-conformance/src/degradation.rs b/crates/metal2vulkan-conformance/src/degradation.rs index dd93db3eb..be7dafe9e 100644 --- a/crates/metal2vulkan-conformance/src/degradation.rs +++ b/crates/metal2vulkan-conformance/src/degradation.rs @@ -175,6 +175,8 @@ pub enum Degradation { RestrictedDepthUpload, /// `metal2vulkan-degrade-stencil-output-overlap`. StencilOutputOverlap, + /// `metal2vulkan-degrade-device-half-denormals`. + DeviceHalfDenormals, } impl Degradation { @@ -262,6 +264,7 @@ impl Degradation { Degradation::VertexSimdgroupGrouping, Degradation::RestrictedDepthUpload, Degradation::StencilOutputOverlap, + Degradation::DeviceHalfDenormals, ]; /// The kind's code, `metal2vulkan-degrade-`. @@ -391,6 +394,7 @@ impl Degradation { } Degradation::RestrictedDepthUpload => "metal2vulkan-degrade-restricted-depth-upload", Degradation::StencilOutputOverlap => "metal2vulkan-degrade-stencil-output-overlap", + Degradation::DeviceHalfDenormals => "metal2vulkan-degrade-device-half-denormals", } } @@ -481,6 +485,7 @@ impl Degradation { PrecisionNote::VertexSimdgroupGrouping => Degradation::VertexSimdgroupGrouping, PrecisionNote::RestrictedDepthUpload => Degradation::RestrictedDepthUpload, PrecisionNote::StencilOutputOverlap => Degradation::StencilOutputOverlap, + PrecisionNote::DeviceHalfDenormals => Degradation::DeviceHalfDenormals, } } } diff --git a/crates/metal2vulkan-conformance/src/replay.rs b/crates/metal2vulkan-conformance/src/replay.rs index 63a479431..9b62e3934 100644 --- a/crates/metal2vulkan-conformance/src/replay.rs +++ b/crates/metal2vulkan-conformance/src/replay.rs @@ -452,7 +452,9 @@ pub fn reads_opaque_black_border(spec: &crate::case::SamplerSpec) -> bool { /// - **maths**: the native-maths class (`native-transcendentals`, `native-division`, `native-fma`, /// `native-dot`, `native-mix`, `native-min-max`, `native-nan-encoding`), the device's functions /// and precision bounds (`device-transcendentals`, `device-arithmetic`), the device's denormals -/// and NaN bits (`device-denormals`, `device-nan-encoding`), and the device's compiler's grouping +/// and NaN bits (`device-denormals`, `device-nan-encoding`), the device's half denormals where +/// it computes `half` under the 16-bit float controls without `DenormPreserve` for 16 bits, the +/// one form built there (`device-half-denormals`), and the device's compiler's grouping /// and fusion of the fast-math arithmetic the AIR's flags let it rewrite (`fast-math-rewrites`: /// the module states each operation in the AIR's order and reproduces no grouping of Metal's); /// - **rounding**: the native-half class (`native-half-conversion`, `native-half-quantize`), and @@ -505,6 +507,7 @@ pub const NATIVE_NOTES: &[crate::degradation::Degradation] = { D::DeviceTranscendentals, D::DeviceArithmetic, D::DeviceDenormals, + D::DeviceHalfDenormals, D::DeviceNanEncoding, D::FastMathRewrites, D::NativeHalfConversion, diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 7c7a78668..662b38072 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -4444,8 +4444,8 @@ cache is answered compile-required on both. threads 976 bytes apart in a 64 KiB table, that loop took 207 to 209 µs unrolled against 105 to 113 µs rolled; over 16 KiB and 256 KiB tables the unrolled loop was 7 to 17% faster. - A `half` `fma` on a device that computes `half` in 16 bits under the 16-bit float controls - (`shaderFloat16`, with 16-bit `RoundingModeRTE`, `DenormPreserve` and - `SignedZeroInfNanPreserve`) is the device's 16-bit `Fma` (`PrecisionNote::NativeFma`). Vulkan + (`shaderFloat16`, with 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve`, and + `DenormPreserve` where offered) is the device's 16-bit `Fma` (`PrecisionNote::NativeFma`). Vulkan gives `Fma` the precision of a multiply followed by an add, each rounded, where Metal's rounds once. RADV (Mesa 26.2.6) on an RX 7900 XTX does not round it once: over a chain of 1,024 dependent `half` `fma`s, 1,622,016 lanes ended up to 9 `half` ulp from Metal's. NVIDIA's driver @@ -6301,7 +6301,7 @@ The other six are one feature each: | Optional feature | Structure | Used for | |---|---|---| -| `shaderFloat16` | `VkPhysicalDeviceVulkan12Features` | `half` arithmetic in 16 bits | +| `shaderFloat16` | `VkPhysicalDeviceVulkan12Features` | `half` arithmetic in 16 bits, under the 16-bit float controls `shaderRoundingModeRTEFloat16` and `shaderSignedZeroInfNanPreserveFloat16` (`VkPhysicalDeviceVulkan12Properties`) with `shaderDenormPreserveFloat16` where offered; without it a half denormal may flush to zero (`PrecisionNote::DeviceHalfDenormals`) | | `shaderStorageImageReadWithoutFormat` | `VkPhysicalDeviceFeatures` | reads of read-write textures of any format; where it is false, each format's `VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT` answers | | `shaderBufferInt64Atomics` | `VkPhysicalDeviceVulkan12Features` | 64-bit atomics on buffers | | `shaderSharedInt64Atomics` | `VkPhysicalDeviceVulkan12Features` | 64-bit atomics on threadgroup memory | diff --git a/crates/metal2vulkan-validation/src/observation_contract/comparison.rs b/crates/metal2vulkan-validation/src/observation_contract/comparison.rs index 2df42e968..45f406da5 100644 --- a/crates/metal2vulkan-validation/src/observation_contract/comparison.rs +++ b/crates/metal2vulkan-validation/src/observation_contract/comparison.rs @@ -186,6 +186,8 @@ impl UlpTable { /// Vulkan does not define without `VK_EXT_depth_range_unrestricted`. /// - `StencilOutputOverlap`: unbounded: a sample two fragments of one draw reach stores the OR of /// their stencil outputs where Metal stores the later one, which moves any of its 8 bits. +/// - `DeviceHalfDenormals`: unbounded: a half denormal the device flushes is a zero where Metal +/// keeps it, which a later operation can carry to any value (a quotient, a reciprocal's sign). /// - `CubeGradientFootprint`: unbounded: Apple's approximate length and truncated level against the /// device's can select another level or filter near a boundary, which changes whole texels, not /// lanes. @@ -337,7 +339,8 @@ pub fn allowance(note: PrecisionNote) -> Allowance { | N::DeviceOcclusionCount | N::VertexSimdgroupGrouping | N::RestrictedDepthUpload - | N::StencilOutputOverlap => Allowance::Unbounded, + | N::StencilOutputOverlap + | N::DeviceHalfDenormals => Allowance::Unbounded, } } diff --git a/crates/metal2vulkan-validation/src/observation_contract/comparison/tests.rs b/crates/metal2vulkan-validation/src/observation_contract/comparison/tests.rs index c9f52c323..f2f0f9ae6 100644 --- a/crates/metal2vulkan-validation/src/observation_contract/comparison/tests.rs +++ b/crates/metal2vulkan-validation/src/observation_contract/comparison/tests.rs @@ -91,6 +91,7 @@ fn every_precision_note_has_its_table_row() { (N::VertexSimdgroupGrouping, Allowance::Unbounded), (N::RestrictedDepthUpload, Allowance::Unbounded), (N::StencilOutputOverlap, Allowance::Unbounded), + (N::DeviceHalfDenormals, Allowance::Unbounded), ]; for (note, expected) in rows { assert_eq!(allowance(note), expected, "{note:?}"); diff --git a/crates/metal2vulkan/src/cache/codec.rs b/crates/metal2vulkan/src/cache/codec.rs index 448f5f59b..cc7f4c2ea 100644 --- a/crates/metal2vulkan/src/cache/codec.rs +++ b/crates/metal2vulkan/src/cache/codec.rs @@ -1451,6 +1451,7 @@ codec_enum! { VertexSimdgroupGrouping, RestrictedDepthUpload, StencilOutputOverlap, + DeviceHalfDenormals, } BindingSource { Buffer(f0), Texture(f0), Sampler(f0), CombinedTextureSampler { texture, sampler }, diff --git a/crates/metal2vulkan/src/cache/mod.rs b/crates/metal2vulkan/src/cache/mod.rs index a908696f8..41a0f61d8 100644 --- a/crates/metal2vulkan/src/cache/mod.rs +++ b/crates/metal2vulkan/src/cache/mod.rs @@ -60,7 +60,7 @@ mod tests; /// unchanged version, and its bless records the version. Independent of the crate's version and of /// [`ARTIFACT_FORMAT_VERSION`]. The commit that bumps it says what changed; this comment keeps no /// history. -pub const SEMANTICS_VERSION: u32 = 2324; +pub const SEMANTICS_VERSION: u32 = 2325; /// The byte-layout version of encoded artifacts (`CompiledFunction::to_bytes` and the /// [`PipelineArtifact`] encodings). Every encoded artifact carries it, and a decode under another @@ -70,7 +70,7 @@ pub const SEMANTICS_VERSION: u32 = 2324; /// re-typed in an encoded type, its `codec` body or its `envelope`. A variant removed while its tag /// stays unused needs no bump: an entry holding it fails to decode, which is a miss. The commit that /// bumps it says what changed; this comment keeps no history. -pub const ARTIFACT_FORMAT_VERSION: u32 = 601; +pub const ARTIFACT_FORMAT_VERSION: u32 = 602; /// The version of what this crate gives a runtime for the runs of a compiled pipeline, beside the /// compile: the device a run opens and what it enables, the Vulkan and Metal vocabularies a runtime diff --git a/crates/metal2vulkan/src/cache/tests.rs b/crates/metal2vulkan/src/cache/tests.rs index ce991820e..f9fcaafe9 100644 --- a/crates/metal2vulkan/src/cache/tests.rs +++ b/crates/metal2vulkan/src/cache/tests.rs @@ -732,6 +732,15 @@ fn the_version_596_members_round_trip() { assert_eq!(decode::(&encode(¬e)), Ok(note)); } +/// The member format version 602 appends encodes and decodes as itself: +/// `PrecisionNote::DeviceHalfDenormals`. +#[test] +fn the_version_602_member_round_trips() { + use crate::pipeline::artifact::PrecisionNote; + let note = PrecisionNote::DeviceHalfDenormals; + assert_eq!(decode::(&encode(¬e)), Ok(note)); +} + /// The members format versions 153, 154, 155, 157 and 161 joined from every side encode and /// decode together in one render pipeline: `PrecisionNote::CubeGradientFootprint` and /// `CombinedSampler`, `RuntimeFact::SrgbTexture` and diff --git a/crates/metal2vulkan/src/lower/arith/narrow.rs b/crates/metal2vulkan/src/lower/arith/narrow.rs index 8cf03eab9..3ec51aaf5 100644 --- a/crates/metal2vulkan/src/lower/arith/narrow.rs +++ b/crates/metal2vulkan/src/lower/arith/narrow.rs @@ -7,7 +7,9 @@ //! Vulkan spec (`RoundingModeRTE`, `DenormPreserve` and `SignedZeroInfNanPreserve` for 16 bits, and //! the modes the device's independence ties to them), it is that conversion and its widening, each //! decorated `NoContraction`, in an entry declaring those modes ([`QuantizeForm::Controlled`], -//! [`controlled_modes`], [`quantize_form`]): Metal's rounding by the Vulkan spec, but a driver's +//! [`controlled_modes`], [`quantize_form`]; on a device without `DenormPreserve` for 16 bits, the +//! other two, a half denormal then the device's, [`flushes_half_denormals`], +//! `PrecisionNote::DeviceHalfDenormals`): Metal's rounding by the Vulkan spec, but a driver's //! compiler may fold the pair (NVIDIA's does, even under those controls) or fuse the operation //! computing the value into the narrowing, so the module records //! `PrecisionNote::NativeHalfConversion` on every device, a static note of the rounding. Elsewhere, where the @@ -210,11 +212,23 @@ fn controlled(fb: &mut FunctionBuilder<'_>, wide: Form, x: Value) -> BResult bool { p.fields().leaf.float16 && controlled_modes(p).is_some() } +/// Whether profile `p` computes `half` under the 16-bit float controls ([`half_controls`]) without +/// `DenormPreserve` for 16 bits, which the device does not offer ([`controlled_modes`]): a `half` +/// operation, conversion, widening or narrowing the module runs under those controls is Metal's but +/// for a half denormal, an operand or a result, which the device may flush to the zero of its sign +/// (the Vulkan spec leaves a 16-bit denormal to the device in an entry declaring no denormal mode +/// for 16 bits), where Metal keeps it. Such a module records `PrecisionNote::DeviceHalfDenormals`. +pub fn flushes_half_denormals(p: &DeviceProfile) -> bool { + half_controls(p) && !p.fields().float_controls.f16.denorm_preserve +} + /// The execution modes an entry declares to compute `half` under the 16-bit float controls on /// profile `p` ([`half_controls`], and to round to `half` in [`QuantizeForm::Controlled`]), or /// `None` where the profile lacks one: `RoundingModeRTE`, `DenormPreserve` and @@ -230,17 +244,26 @@ pub fn half_controls(p: &DeviceProfile) -> bool { /// are independent for 32 bits only. A device whose denormal modes are not independent at all /// would have to preserve `float` denormals with them, changing how the module's `float` /// arithmetic reads them (`PrecisionNote::DeviceDenormals`), so the form is not taken there. +/// +/// A device that offers the other two 16-bit controls but not `DenormPreserve` for 16 bits +/// ([`flushes_half_denormals`]) takes the same form, its entry declaring no denormal mode: neither +/// `DenormPreserve` for 16 bits, which it does not offer, nor the one for 64 bits that the +/// independence ties to it (VUID 06289 asks for the same denormal mode at 16 and 64 bits where +/// denormal modes are independent for 32 bits only, and no mode at either is the same). The +/// independence decides which devices take it as above. Any other control missing keeps `half` in +/// `float`. pub fn controlled_modes(p: &DeviceProfile) -> Option> { let fc = p.fields().float_controls; let half = fc.f16; - if !(half.rounding_rte && half.denorm_preserve && half.signed_zero_inf_nan_preserve) { + if !(half.rounding_rte && half.signed_zero_inf_nan_preserve) { return None; } - let mut modes = vec![ - ExecMode::RoundingModeRte { width: 16 }, - ExecMode::DenormPreserve { width: 16 }, - ExecMode::SignedZeroInfNanPreserve { width: 16 }, - ]; + let preserve = half.denorm_preserve; + let mut modes = vec![ExecMode::RoundingModeRte { width: 16 }]; + if preserve { + modes.push(ExecMode::DenormPreserve { width: 16 }); + } + modes.push(ExecMode::SignedZeroInfNanPreserve { width: 16 }); match fc.rounding_independence { Independence::All => {} Independence::Only32Bit if fc.f64.rounding_rte => { @@ -255,7 +278,9 @@ pub fn controlled_modes(p: &DeviceProfile) -> Option> { match fc.denorm_independence { Independence::All => {} Independence::Only32Bit if fc.f64.denorm_preserve => { - modes.push(ExecMode::DenormPreserve { width: 64 }); + if preserve { + modes.push(ExecMode::DenormPreserve { width: 64 }); + } } Independence::Only32Bit | Independence::None => return None, } diff --git a/crates/metal2vulkan/src/pipeline/artifact.rs b/crates/metal2vulkan/src/pipeline/artifact.rs index f0e709218..fe68a176d 100644 --- a/crates/metal2vulkan/src/pipeline/artifact.rs +++ b/crates/metal2vulkan/src/pipeline/artifact.rs @@ -1493,7 +1493,9 @@ pub enum PrecisionNote { /// conversion Metal's (`RoundingModeRTE`, `DenormPreserve` and `SignedZeroInfNanPreserve` for /// 16 bits, under which ANV and RADV round through the conversion exactly and record no /// note): NVIDIA, whose driver folds the conversion's round trip even under those controls, - /// MoltenVK, lavapipe, and any device without them. NVIDIA's modules compute under those controls all the same: a `half` `+`, + /// MoltenVK, and any device without them. Lavapipe, without `DenormPreserve` for 16 bits, + /// computes under the other two ([`PrecisionNote::DeviceHalfDenormals`]), its pair recorded as + /// NVIDIA's is. NVIDIA's modules compute under those controls all the same: a `half` `+`, /// `-`, `*`, `/` and `sqrt` there are the device's 16-bit instructions, whose results take /// no such rounding. Without them Vulkan leaves the conversion's rounding mode and its 16-bit /// denormals to the device. Also recorded under those controls on RADV where the `half` is the @@ -1550,8 +1552,10 @@ pub enum PrecisionNote { /// bits) where they are not the bits it was read from: the device's narrowing of it, an /// `OpFConvert` to 16 bits read as a word with `shaderFloat16`, `GLSL.std.450 PackHalf2x16` /// without it. A module that reads or encodes one records this note too where that widening - /// or narrowing is not under the float controls' `DenormPreserve` for 16 bits (ANV, RADV, - /// NVIDIA), so on every device without `shaderFloat16`: its bound is the last two items', a half denormal read or + /// or narrowing is not under the 16-bit float controls (ANV, RADV and NVIDIA declare them; + /// lavapipe declares them without `DenormPreserve` for 16 bits and records + /// [`PrecisionNote::DeviceHalfDenormals`] instead), so on every device without + /// `shaderFloat16`: its bound is the last two items', a half denormal read or /// encoded as the zero of its sign on a device that flushes 16-bit denormals (the Vulkan spec /// lets a device flush a denormal "obtained via unpacking an integer" without `DenormPreserve` /// for 16 bits, and gives `UnpackHalf2x16` and `PackHalf2x16` implementation-defined @@ -2134,6 +2138,29 @@ pub enum PrecisionNote { /// Validation derives no tolerance from it: a difference stays a mismatch, which the note /// explains. StencilOutputOverlap, + /// Half denormals may flush to zero where Metal preserves them: the module computes `half` + /// under the 16-bit float controls (`RoundingModeRTE` and `SignedZeroInfNanPreserve` for 16 + /// bits) on a device that offers them but not `DenormPreserve` for 16 bits + /// (`shaderDenormPreserveFloat16` false), so its entry declares no denormal mode for 16 bits + /// (`lower::arith::narrow::flushes_half_denormals`). Each `half` operation that takes the + /// 16-bit route there, a `+`, `-`, `*`, `/`, `sqrt` and fused multiply-add on the device's + /// 16-bit instructions, the module's `half` values held at 16 bits, a rounding of a `float` to + /// `half` by the conversion and its widening, and a widening of a `half` from its bits or a + /// narrowing to them, is Metal's but for a half denormal (a magnitude below `2^-14`), operand + /// or result: the Vulkan spec leaves a 16-bit denormal to the device in an entry declaring no + /// denormal mode for 16 bits, so the device may read or answer it as the zero of its sign, + /// where Metal keeps it. Every other `half` is as under the full controls. Recorded by every + /// module that declares those controls on such a device; a device with `DenormPreserve` for 16 + /// bits declares it and records nothing, and a device lacking another of the controls computes + /// `half` in `float` and records its rounding's own note + /// ([`PrecisionNote::NativeHalfConversion`], [`PrecisionNote::NativeHalfQuantize`]). Run on + /// lavapipe (Mesa 26.2.4 in the pinned lavapipe image), whose controls have this shape. Turnip + /// on an Adreno GPU before the 8xx series reports the same controls (Mesa 26.3.1's + /// `tu_device.cc`): not measured on a tile-based phone GPU; no such device in the lab. + /// + /// Validation derives no tolerance from it: a difference stays a mismatch, which the note + /// explains. + DeviceHalfDenormals, } /// Which lowering strategies a module used, with their word costs. diff --git a/crates/metal2vulkan/src/pipeline/compile.rs b/crates/metal2vulkan/src/pipeline/compile.rs index c03d5234f..1cc1408a1 100644 --- a/crates/metal2vulkan/src/pipeline/compile.rs +++ b/crates/metal2vulkan/src/pipeline/compile.rs @@ -3142,6 +3142,11 @@ fn lower_bounded( let modes = crate::lower::arith::narrow::controlled_modes(p).unwrap_or_default(); module.declare_modes(&modes)?; } + // Those controls without `DenormPreserve` for 16 bits, which the device does not offer: each + // `half` they cover is Metal's but a denormal, which the device may flush. Recorded by every + // module that declares them so, and by no other. + let half_denormals = + declares_controls && crate::lower::arith::narrow::flushes_half_denormals(p); // An entry whose tangled instructions all stand where their invocations reach them together // takes its reconvergence mode only where the module holds one in a loop a back edge re-enters // from inside a selection. @@ -3156,6 +3161,7 @@ fn lower_bounded( converts || native_widening || fused, PrecisionNote::NativeHalfConversion, ), + (half_denormals, PrecisionNote::DeviceHalfDenormals), ]; for (recorded, note) in native_half { if recorded && !precision.contains(¬e) { diff --git a/crates/metal2vulkan/src/tests/engine_arith.rs b/crates/metal2vulkan/src/tests/engine_arith.rs index c8b9b7578..8b7f9c7d9 100644 --- a/crates/metal2vulkan/src/tests/engine_arith.rs +++ b/crates/metal2vulkan/src/tests/engine_arith.rs @@ -1629,11 +1629,11 @@ fn fma16_and_marks(words: &[u32]) -> (usize, usize) { /// On `Device::from_queries`' profile (`HalfFma::Native`) a `half` fused multiply-add is the /// device's 16-bit `Fma` wherever the profile computes `half` under the 16-bit float controls -/// (`fma::Route::F16Native`: RADV, ANV and NVIDIA's captures): the module computes it on 16-bit -/// floats with no conversion around it, so no instruction is decorated `NoContraction`, and it -/// records `PrecisionNote::NativeFma`, as the device's -/// `float` `Fma` rounded to `half` does where the profile lacks those controls (lavapipe, which -/// does not keep 16-bit denormals, and vk12-floor, without `shaderFloat16`). The 16-bit `Fma` +/// (`fma::Route::F16Native`: RADV, ANV and NVIDIA's captures, and lavapipe's, under them without +/// 16-bit `DenormPreserve`): the module computes it on 16-bit floats with no conversion around it, +/// so no instruction is decorated `NoContraction`, and it records `PrecisionNote::NativeFma`, as +/// the device's `float` `Fma` rounded to `half` does where the profile lacks those controls (the +/// floor, without `shaderFloat16`). The 16-bit `Fma` /// rounds [`half_fma_kernel`]'s sum once on the interpreter, the `float` one twice. #[test] fn a_half_fused_multiply_add_is_the_devices_16_bit_fma_on_from_queries() { @@ -1689,7 +1689,12 @@ fn a_half_fused_multiply_add_is_the_devices_16_bit_fma_on_from_queries() { } assert_eq!( sixteen, - ["amd-780m-radv", "intel-irisxe-anv", "nvidia-rtx50-linux"], + [ + "amd-780m-radv", + "intel-irisxe-anv", + "nvidia-rtx50-linux", + "lavapipe" + ], "the profiles under the 16-bit float controls" ); } diff --git a/crates/metal2vulkan/src/tests/engine_half_hold.rs b/crates/metal2vulkan/src/tests/engine_half_hold.rs index 35c6c6f28..1cc9ab615 100644 --- a/crates/metal2vulkan/src/tests/engine_half_hold.rs +++ b/crates/metal2vulkan/src/tests/engine_half_hold.rs @@ -380,18 +380,19 @@ fn shape(m: &TypedModule) -> Shape { s } -/// On the Iris Xe and RADV (the 16-bit float controls) the kernel holds its `half` values at 16 -/// bits: its minimum, maximum, clamp, dot product and `mix` are 16-bit instructions, its four -/// inputs' roundings are its only narrowings (none of an exact half), its result's widening is its -/// only widening, its loop-carried sum and its thread array are 16-bit variables, and it records -/// `NativeDot` and `NativeMix` and passes L3. On lavapipe (the conversion alone) none of that is held. -/// Each answers the exact result on the interpreter. +/// On the Iris Xe, RADV and lavapipe (the 16-bit float controls, lavapipe's without +/// `DenormPreserve`) the kernel holds its `half` values at 16 bits: its minimum, maximum, clamp, dot +/// product and `mix` are 16-bit instructions, its four inputs' roundings are its only narrowings +/// (none of an exact half), its result's widening is its only widening, its loop-carried sum and +/// its thread array are 16-bit variables, and it records `NativeDot` and `NativeMix` and passes L3. +/// On lavapipe's description without 16-bit `RoundingModeRTE` (the conversion alone) none of that +/// is held. Each answers the exact result on the interpreter. #[test] fn half_values_are_held_at_16_bits_under_the_float_controls() { let Some(bc) = bitcode() else { return; }; - for stem in ["intel-irisxe-rplp-anv", "amd-780m-radv"] { + for stem in ["intel-irisxe-rplp-anv", "amd-780m-radv", "lavapipe"] { let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); assert_eq!(quantize_form(&p), QuantizeForm::Controlled, "{stem}"); let (m, push) = emitted(&bc, &p); @@ -413,7 +414,7 @@ fn half_values_are_held_at_16_bits_under_the_float_controls() { a.precision ); } - let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); + let p = converted_lavapipe(); assert_eq!(quantize_form(&p), QuantizeForm::Converted); let (m, push) = emitted(&bc, &p); let s = shape(&m); @@ -424,19 +425,31 @@ fn half_values_are_held_at_16_bits_under_the_float_controls() { assert_eq!(interpret(&m, push), RESULT, "lavapipe"); } +/// Lavapipe's profile without 16-bit `RoundingModeRTE`: `shaderFloat16` with no 16-bit float +/// controls, so its `half` rounds through the conversion alone (`QuantizeForm::Converted`). +fn converted_lavapipe() -> DeviceProfile { + let mut desc = crate::pipeline::testing::description("lavapipe").expect("profile"); + desc.float_controls.f16.rounding_rte = false; + crate::device::Device::from_queries(desc, DevicePolicy::RESIDENT_TABLES) + .expect("device") + .profile() + .clone() +} + /// On the Iris Xe and RADV (the 16-bit float controls) a `half` division, on two lanes and on /// one, and a `half` square root are the device's 16-bit `OpFDiv` and `Sqrt`, none at 32 bits and /// no exact half narrowed, and an undefined `float` vector stays one (no widening of its 16-bit /// twin), recording `NativeDivision` and `NativeTranscendentals` and passing L3; a -/// divisor past `2^14` and a denormal one are scaled into Vulkan's range exactly. On lavapipe -/// (the conversion alone) they are the `float` instructions. Each answers the exact results on -/// the interpreter. +/// divisor past `2^14` and a denormal one are scaled into Vulkan's range exactly; so too on +/// lavapipe, under those controls without `DenormPreserve`. On lavapipe's description without +/// 16-bit `RoundingModeRTE` (the conversion alone) they are the `float` instructions. Each answers +/// the exact results on the interpreter. #[test] fn half_division_and_sqrt_are_16_bit_under_the_float_controls() { let Some(bc) = bitcode_of(DIVIDE) else { return; }; - for stem in ["intel-irisxe-rplp-anv", "amd-780m-radv"] { + for stem in ["intel-irisxe-rplp-anv", "amd-780m-radv", "lavapipe"] { let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); assert_eq!(quantize_form(&p), QuantizeForm::Controlled, "{stem}"); let (m, push) = emitted_entry(&bc, "half_divide", &p); @@ -462,7 +475,7 @@ fn half_division_and_sqrt_are_16_bit_under_the_float_controls() { a.precision ); } - let p = profile("lavapipe", DevicePolicy::RESIDENT_TABLES).expect("profile"); + let p = converted_lavapipe(); assert_eq!(quantize_form(&p), QuantizeForm::Converted); let (m, push) = emitted_entry(&bc, "half_divide", &p); let s = shape(&m); diff --git a/crates/metal2vulkan/src/tests/engine_native_half.rs b/crates/metal2vulkan/src/tests/engine_native_half.rs index cd75051bc..1b310fcc9 100644 --- a/crates/metal2vulkan/src/tests/engine_native_half.rs +++ b/crates/metal2vulkan/src/tests/engine_native_half.rs @@ -192,10 +192,11 @@ fn half_rounding_is_the_devices_on_every_profile() { ); } -/// On lavapipe and MoltenVK (`shaderFloat16`, no `DenormPreserve` for 16 bits) each kernel rounds -/// its `half` through the conversion and records `NativeHalfConversion`; on a profile without `shaderFloat16` it quantizes and -/// records `NativeHalfQuantize`; RADV takes the controlled conversion and holds `half` at 16 bits -/// under those controls: its sum, between exact conversions, records nothing, and its narrowing +/// On MoltenVK (`shaderFloat16`, its float controls not independent) each kernel rounds its `half` +/// through the conversion and records `NativeHalfConversion`; on a profile without `shaderFloat16` +/// it quantizes and records `NativeHalfQuantize`; RADV and lavapipe (the 16-bit controls, lavapipe's +/// without `DenormPreserve`) take the controlled conversion and hold `half` at 16 bits under those +/// controls: the sum, between exact conversions, records no rounding note, and the narrowing /// widened back, a conversion pair a driver's compiler may fold, records `NativeHalfConversion`. /// Each passes L3. On the interpreter, /// whose conversion and quantize round to nearest even, the native modules answer Metal's @@ -211,7 +212,7 @@ fn native_half_rounding_records_its_kind() { ]; // Each profile and its note for each of the kernels, in their order. let cases: [(&str, [Option; 2]); 4] = [ - ("lavapipe", [Some(natives[0]); 2]), + ("lavapipe", [None, Some(natives[0])]), ("runtime-floor", [Some(natives[1]); 2]), ("moltenvk-m3", [Some(natives[0]); 2]), ("amd-780m-radv", [None, Some(natives[0])]), @@ -380,11 +381,12 @@ fn decodes(m: &TypedModule) -> (usize, usize) { } /// A `half` read from memory is the device's widening of its bits on every profile, inside a loop -/// and out, with no integer decode: on lavapipe and MoltenVK (the device's conversion, no float -/// controls) the module records `NativeNanEncoding` and `NativeHalfConversion` (a NaN's bits and, -/// where the device flushes 16-bit denormals, a denormal); on NVIDIA, under the float controls (its -/// driver folds only the conversion's round trip, `narrow::half_controls`), `NativeNanEncoding` -/// alone; on the floor (no `shaderFloat16`) it is `UnpackHalf2x16` of each word, recording both +/// and out, with no integer decode: on MoltenVK (the device's conversion, no float controls) the +/// module records `NativeNanEncoding` and `NativeHalfConversion` (a NaN's bits and, where the device +/// flushes 16-bit denormals, a denormal); on NVIDIA, under the float controls (its driver folds only +/// the conversion's round trip, `narrow::half_controls`), `NativeNanEncoding` alone; on lavapipe, +/// under them without `DenormPreserve` for 16 bits, `NativeNanEncoding` and `DeviceHalfDenormals` +/// (a denormal the device may flush); on the floor (no `shaderFloat16`) it is `UnpackHalf2x16` of each word, recording both /// notes. A `half4` widens as one vector (two /// words unpacked and shuffled where the device unpacks). Each module passes L3 and answers the /// `half`s' values on the interpreter (whose widening is exact). @@ -406,15 +408,16 @@ fn a_half_decode_is_the_devices_widening_inside_loops_and_out() { 0, ]; let conversion = PrecisionNote::NativeHalfConversion; - // Each profile, whether its widening is noted `NativeHalfConversion`, and whether it unpacks - // words (no `shaderFloat16`). + // Each profile, whether its widening is noted `NativeHalfConversion`, whether it unpacks words + // (no `shaderFloat16`), and whether it is noted `DeviceHalfDenormals` (the 16-bit float + // controls without `DenormPreserve` for 16 bits). let cases = [ - ("lavapipe", true, false), - ("nvidia-rtx5080-laptop", false, false), - ("moltenvk-m3", true, false), - ("runtime-floor", true, true), + ("lavapipe", false, false, true), + ("nvidia-rtx5080-laptop", false, false, false), + ("moltenvk-m3", true, false, false), + ("runtime-floor", true, true, false), ]; - for (stem, native, unpacks) in cases { + for (stem, native, unpacks, flushes) in cases { let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); for (entry, both) in [("both", true), ("inside", false)] { let what = format!("{entry} on {stem}"); @@ -438,6 +441,12 @@ fn a_half_decode_is_the_devices_widening_inside_loops_and_out() { "{what}: {:?}", a.precision ); + assert_eq!( + a.precision.contains(&PrecisionNote::DeviceHalfDenormals), + flushes, + "{what}: {:?}", + a.precision + ); let res = Resources { buffers: vec![Buffer { slot: Some(ResourceSlot { @@ -527,16 +536,28 @@ fn barred(m: &TypedModule) -> (usize, usize) { (all, barred) } -/// Each rounding through the conversion converts the value itself, on lavapipe and on MoltenVK -/// alike: no `x + -0.0` decorated `NoContraction` stands between the value and the conversion to -/// keep the device's compiler from folding it into the instruction computing the value. +/// Each rounding through the conversion converts the value itself, on MoltenVK and on lavapipe's +/// description without 16-bit `RoundingModeRTE` (both `QuantizeForm::Converted`) alike: no +/// `x + -0.0` decorated `NoContraction` stands between the value and the conversion to keep the +/// device's compiler from folding it into the instruction computing the value. #[test] fn a_native_conversion_converts_the_value_itself() { + use crate::device::Device; let Some(bc) = bitcode() else { return; }; - for stem in ["lavapipe", "moltenvk-m3"] { - let p = profile(stem, DevicePolicy::RESIDENT_TABLES).expect("profile"); + let mut lavapipe = crate::pipeline::testing::description("lavapipe").expect("profile"); + lavapipe.float_controls.f16.rounding_rte = false; + let lavapipe = Device::from_queries(lavapipe, DevicePolicy::RESIDENT_TABLES) + .expect("device") + .profile() + .clone(); + let moltenvk = profile("moltenvk-m3", DevicePolicy::RESIDENT_TABLES).expect("profile"); + for (stem, p) in [ + ("lavapipe without RoundingModeRTE for 16 bits", lavapipe), + ("moltenvk-m3", moltenvk), + ] { + assert_eq!(quantize_form(&p), QuantizeForm::Converted, "{stem}"); for (name, _) in &KERNELS { let what = format!("{name} on {stem}"); let (a, _, kept) = @@ -682,7 +703,9 @@ fn rounding(words: &[u32]) -> Rounding { } /// Where the profile has `shaderFloat16` and the float controls that make a conversion to 16 bits -/// Metal's `half(float)` by the Vulkan spec (every ANV, RADV and RTX 50 series profile), each +/// Metal's `half(float)` by the Vulkan spec (every ANV, RADV and RTX 50 series profile), or those +/// but 16-bit `DenormPreserve` (lavapipe, whose entry then declares no denormal mode, requires no +/// `DenormPreserve` property and records `DeviceHalfDenormals`; its interpreter keeps denormals), each /// kernel rounds its `half` through that conversion and its widening, every one decorated /// `NoContraction`, with no quantize, and computes its `half` sum on the device's 16-bit /// arithmetic, which reads the roundings' 16-bit results themselves and is widened once, exactly @@ -696,8 +719,8 @@ fn rounding(words: &[u32]) -> Rounding { /// note of the rounding on every device, as a driver's compiler may fold the pair or fuse the /// arithmetic computing it into the narrowing, and passes L3. On the interpreter (whose conversion /// rounds to nearest even) it answers Metal's `half(float)`: a tie to even, the largest half below -/// 65520 and infinity from it, a half denormal, a zero's sign, and a sum. MoltenVK, lavapipe, the -/// floor and Pascal's profile keep their forms. +/// 65520 and infinity from it, a half denormal, a zero's sign, and a sum. MoltenVK, the floor and +/// Pascal's profile keep their forms. #[test] fn a_controlled_conversion_rounds_half_where_the_float_controls_allow() { use crate::device::requirements::{FloatControl, FloatWidth}; @@ -736,10 +759,12 @@ fn a_controlled_conversion_rounds_half_where_the_float_controls_allow() { crate::device::profile::Independence::Only32Bit => w != 32, crate::device::profile::Independence::None => true, }; - let tied_dp = match fc.denorm_independence { - crate::device::profile::Independence::All => w == 16, - _ => w != 32, - }; + // No denormal mode at any width where the device lacks 16-bit `DenormPreserve`. + let tied_dp = fc.f16.denorm_preserve + && match fc.denorm_independence { + crate::device::profile::Independence::All => w == 16, + _ => w != 32, + }; assert_eq!(rte, tied_rte, "{stem}: RoundingModeRTE {w}"); assert_eq!(dp, tied_dp, "{stem}: DenormPreserve {w}"); } @@ -775,10 +800,12 @@ fn a_controlled_conversion_rounds_half_where_the_float_controls_allow() { (FloatControl::DenormPreserve, FloatWidth::F16), (FloatControl::SignedZeroInfNanPreserve, FloatWidth::F16), ] { - assert!( + let required = kind != FloatControl::DenormPreserve || fc.f16.denorm_preserve; + assert_eq!( a.requirements .properties .contains(&VkProperty::FloatControl(kind, width)), + required, "{what}: {kind:?} {width:?}" ); } @@ -788,6 +815,12 @@ fn a_controlled_conversion_rounds_half_where_the_float_controls_allow() { "{what}: {:?}", a.precision ); + assert_eq!( + a.precision.contains(&PrecisionNote::DeviceHalfDenormals), + !fc.f16.denorm_preserve, + "{what}: {:?}", + a.precision + ); assert!( !a.precision.contains(&PrecisionNote::NativeHalfQuantize), "{what}" @@ -814,18 +847,14 @@ fn a_controlled_conversion_rounds_half_where_the_float_controls_allow() { "amd-780m-radv", "nvidia-rtx50-linux", "nvidia-rtx5080-laptop", + "lavapipe", ] { assert!( controlled.iter().any(|s| s == stem), "{stem}: {controlled:?}" ); } - for stem in [ - "moltenvk-m3", - "lavapipe", - "runtime-floor", - "nvidia-pascal-linux", - ] { + for stem in ["moltenvk-m3", "runtime-floor", "nvidia-pascal-linux"] { assert!( !controlled.iter().any(|s| s == stem), "{stem}: {controlled:?}" @@ -982,8 +1011,10 @@ fn nvidia_computes_half_on_16_bit_floats_under_the_float_controls() { /// `SignedZeroInfNanPreserve` for 16 bits (and `RoundingModeRTE` for 64 bits where the 780M's /// rounding independence ties it) and no denormal mode at any width, not the 64-bit one the 780M's /// independence would tie to a 16-bit one (VUID 06289), and requires no `DenormPreserve` property. -/// Each passes L3, and on the interpreter rounds each operation to `half`. Any other control -/// missing keeps `half` in `float`, no 16-bit instruction and no 16-bit mode: without 16-bit +/// Each passes L3, and on the interpreter rounds each operation to `half`; each records +/// `PrecisionNote::DeviceHalfDenormals` (a half denormal may flush), which the RTX 50 series +/// profile, under all three controls, does not. Any other control missing keeps `half` in `float`, +/// no 16-bit instruction, no 16-bit mode and no such note: without 16-bit /// `SignedZeroInfNanPreserve`; on MoltenVK on the M3, whose denormal and rounding modes are not /// independent; and where denormal modes are independent for 32 bits only without 64-bit /// `DenormPreserve`. @@ -1057,6 +1088,11 @@ fn half_without_denorm_preserve_computes_in_16_bits_under_the_other_two_controls !r.modes.iter().any(|&(m, _)| m == M::DenormPreserve as u32), "{what}: {r:?}" ); + assert!( + a.precision.contains(&PrecisionNote::DeviceHalfDenormals), + "{what}: {:?}", + a.precision + ); for width in [FloatWidth::F16, FloatWidth::F32, FloatWidth::F64] { assert!( !a.requirements @@ -1116,8 +1152,28 @@ fn half_without_denorm_preserve_computes_in_16_bits_under_the_other_two_controls let r = rounding(&a.module.words); assert_eq!(r.f16_ops, 0, "{what}: {r:?}"); assert!(!r.modes.iter().any(|&(_, w)| w == 16), "{what}: {r:?}"); + assert!( + !a.precision.contains(&PrecisionNote::DeviceHalfDenormals), + "{what}: {:?}", + a.precision + ); } } + // Under all three controls the entry declares 16-bit `DenormPreserve` and records no such note. + let full = profile("nvidia-rtx50-linux", DevicePolicy::RESIDENT_TABLES).expect("profile"); + for (name, _) in &NATIVE { + let a = compile(&bc, name, &full).unwrap_or_else(|e| panic!("{name}: {e:?}")); + let r = rounding(&a.module.words); + assert!( + r.modes.contains(&(M::DenormPreserve as u32, 16)), + "{name}: {r:?}" + ); + assert!( + !a.precision.contains(&PrecisionNote::DeviceHalfDenormals), + "{name}: {:?}", + a.precision + ); + } } /// A kernel that reads a `half` from buffer 0 and stores it widened to `float` after the two @@ -1138,9 +1194,10 @@ fn half_load_module() -> String { /// the device's) and selects no canonical NaN. With `shaderFloat16` the widening is the device's /// conversion (a 16-bit storage unit it reads is read as a 16-bit float itself): under the float /// controls (ANV, RADV, the RTX 50 series) its entry declares them (`narrow::controlled_modes`, so -/// a half denormal widens exactly) and it records no other note; elsewhere (lavapipe and MoltenVK: -/// the device's conversion, no float controls) it records `NativeHalfConversion`, whose bound holds -/// a denormal the device flushes. Without it (Pascal, +/// a half denormal widens exactly) and it records no other note; under them without 16-bit +/// `DenormPreserve` (lavapipe) it records `DeviceHalfDenormals` (a denormal the device may flush); +/// elsewhere (MoltenVK: the device's conversion, no float controls) it records +/// `NativeHalfConversion`, whose bound holds a denormal the device flushes. Without it (Pascal, /// the LunarG baseline, SwiftShader, the floor) the widening is one `UnpackHalf2x16` of the word, /// a 16-bit unit's zero extension where the profile has 16-bit storage, with no 16-bit float type, /// recording `NativeHalfConversion` too. Each passes L3; on the interpreter @@ -1171,13 +1228,24 @@ fn a_half_read_from_memory_is_the_devices_widening_on_every_profile() { } QuantizeForm::Controlled => { assert_eq!((r.widenings, r.unpacks), (1, 0), "{what}: {r:?}"); - for mode in [M::RoundingModeRTE, M::DenormPreserve] { - assert!( - r.modes.contains(&(mode as u32, 16)), - "{what}: {mode:?} {r:?}" - ); - } + // 16-bit `DenormPreserve` where the device offers it; else none, and the note. + let preserves = p.fields().float_controls.f16.denorm_preserve; + assert!( + r.modes.contains(&(M::RoundingModeRTE as u32, 16)), + "{what}: {r:?}" + ); + assert_eq!( + r.modes.contains(&(M::DenormPreserve as u32, 16)), + preserves, + "{what}: {r:?}" + ); assert!(nan && !conversion, "{what}: {:?}", a.precision); + assert_eq!( + a.precision.contains(&PrecisionNote::DeviceHalfDenormals), + !preserves, + "{what}: {:?}", + a.precision + ); } QuantizeForm::Converted => { assert_eq!((r.widenings, r.unpacks), (1, 0), "{what}: {r:?}"); diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index 904dd638c..4d71a449c 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -8578,6 +8578,7 @@ variant metal2vulkan-runtime::PrecisionNote::DeviceDenormals DeviceDenormals variant metal2vulkan-runtime::PrecisionNote::DeviceDepthBias DeviceDepthBias variant metal2vulkan-runtime::PrecisionNote::DeviceFilteredMipmaps DeviceFilteredMipmaps variant metal2vulkan-runtime::PrecisionNote::DeviceFragmentRuns DeviceFragmentRuns +variant metal2vulkan-runtime::PrecisionNote::DeviceHalfDenormals DeviceHalfDenormals variant metal2vulkan-runtime::PrecisionNote::DeviceInterpolation DeviceInterpolation variant metal2vulkan-runtime::PrecisionNote::DeviceInterpolationOffset DeviceInterpolationOffset variant metal2vulkan-runtime::PrecisionNote::DeviceLineRasterization DeviceLineRasterization @@ -9950,6 +9951,7 @@ variant metal2vulkan::pipeline::PrecisionNote::DeviceDenormals DeviceDenormals variant metal2vulkan::pipeline::PrecisionNote::DeviceDepthBias DeviceDepthBias variant metal2vulkan::pipeline::PrecisionNote::DeviceFilteredMipmaps DeviceFilteredMipmaps variant metal2vulkan::pipeline::PrecisionNote::DeviceFragmentRuns DeviceFragmentRuns +variant metal2vulkan::pipeline::PrecisionNote::DeviceHalfDenormals DeviceHalfDenormals variant metal2vulkan::pipeline::PrecisionNote::DeviceInterpolation DeviceInterpolation variant metal2vulkan::pipeline::PrecisionNote::DeviceInterpolationOffset DeviceInterpolationOffset variant metal2vulkan::pipeline::PrecisionNote::DeviceLineRasterization DeviceLineRasterization diff --git a/docs/API.md b/docs/API.md index 303f8ee88..ac84d4ae7 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2366,7 +2366,9 @@ bound. `half` operation's, a function's, a conversion from `float`'s, a texel's) by the device's conversion of the `float` to 16 bits and its widening, on every device with `shaderFloat16`. Without the float controls that make that conversion Metal's `half(float)` (`RoundingModeRTE`, - `DenormPreserve` and `SignedZeroInfNanPreserve` for 16 bits) the conversion is the device's own. + `DenormPreserve` and `SignedZeroInfNanPreserve` for 16 bits; on a device without 16-bit + `DenormPreserve`, the other two, with `metal2vulkan-degrade-device-half-denormals`) the conversion + is the device's own. Under them it is Metal's by the Vulkan spec, but a driver's compiler may fold the conversion's round trip into the value it started from (NVIDIA's does) or fuse the `float` addition, subtraction, multiply or fused multiply-add computing the value into the narrowing and round its @@ -2379,6 +2381,22 @@ bound. controls: the device's conversion without them, and `GLSL.std.450 UnpackHalf2x16` and `PackHalf2x16` on every device without `shaderFloat16`. A half denormal may read or encode as the zero of its sign. +- `metal2vulkan-degrade-device-half-denormals` (precision). `PrecisionNote::DeviceHalfDenormals`: + half denormals may flush to zero where Metal preserves them. The module computes `half` under + the 16-bit float controls on a device that offers `shaderFloat16` with 16-bit `RoundingModeRTE` + and `SignedZeroInfNanPreserve` but not 16-bit `DenormPreserve`, so its entry declares + those two and no denormal mode: a `half` `+`, `-`, `*`, `/`, `sqrt` and fused multiply-add are + the device's 16-bit instructions, its `half` values are held at 16 bits, a `float` rounds to + `half` through the conversion and its widening, and a `half` widens from and narrows to its bits + by the device's conversion, each Metal's but for a half denormal (a magnitude below `2^-14`), + operand or result, which the device may read or answer as the zero of its sign. Recorded by + every module that declares those controls on such a device, and by no other: a device with + 16-bit `DenormPreserve` declares it too and records nothing, and a device lacking another + control computes `half` in `float` (`metal2vulkan-degrade-native-half-conversion`, + `metal2vulkan-degrade-native-half-quantize`). Run on lavapipe (Mesa 26.2.4 in the pinned + lavapipe image), whose controls have this shape. Turnip on an Adreno GPU before the 8xx series + reports the same controls (Mesa 26.3.1's `tu_device.cc`): not measured on a tile-based phone + GPU; no such device in the lab. - `metal2vulkan-degrade-native-half-quantize` (precision). `PrecisionNote::NativeHalfQuantize`: Native half rounding (a quantize): the module rounds a `half` result it computes in `float` (a `half` operation's, a function's, a conversion from `float`'s, a texel's) by the device's diff --git a/docs/CONFORMANCE-COVERAGE.md b/docs/CONFORMANCE-COVERAGE.md index cc001bc24..e2886895a 100644 --- a/docs/CONFORMANCE-COVERAGE.md +++ b/docs/CONFORMANCE-COVERAGE.md @@ -43,7 +43,7 @@ Its limits, measured rather than asserted: | committed recordings | 1339 | | distinct SDK items the Metal leg reaches, of any status | 812 | | of those, reached only where this cannot name the family | 5 | -| ledger rows (a case whose gap is recorded) | 7932 | +| ledger rows (a case whose gap is recorded) | 7885 | | declared crossings of the option space (pairs put to Metal at once) | 26 | | declared crossings that are no pair of it (a boolean or numeric field, or one type in two slots) | 30 | @@ -2811,18 +2811,15 @@ A case whose difference from Metal is recorded rather than compared away. The le | `half-texel-nans-r16f` | The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7c01 a… | | `half-texel-nans-r16f` | The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal hands back the texel's own code (0x7c01… | | `half-texel-nans-r16f` | The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the dev… | -| `half-texel-nans-r32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample narrows it w… | +| `half-texel-nans-r32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample, narrowed to… | | `half-texel-nans-r32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's … | | `half-texel-nans-r32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal answers the canonical 0x7e00; lavapipe'… | | `half-texel-nans-r32f` | The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the dev… | -| `half-texel-nans-rg11b10f` | The device's own answer (rule 1): a small float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's decode keeps the pay… | -| `half-texel-nans-rg11b10f` | The device's own answer (rule 1): a small float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's d… | -| `half-texel-nans-rg11b10f` | The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the dev… | | `half-texel-nans-rg16f` | The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` nearest sample. Metal hands back the texel's own code (0x7d55 at the first differi… | | `half-texel-nans-rg16f` | The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7d55 a… | | `half-texel-nans-rg16f` | The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal hands back the texel's own code (0x7d55… | | `half-texel-nans-rg16f` | The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the dev… | -| `half-texel-nans-rg32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample narrows it w… | +| `half-texel-nans-rg32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample, narrowed to… | | `half-texel-nans-rg32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's … | | `half-texel-nans-rg32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal answers the canonical 0x7e00; lavapipe'… | | `half-texel-nans-rg32f` | The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the dev… | @@ -2830,7 +2827,7 @@ A case whose difference from Metal is recorded rather than compared away. The le | `half-texel-nans-rgba16f` | The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal hands back the texel's own code (0x7d55 a… | | `half-texel-nans-rgba16f` | The device's own answer (rule 1): a 16-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal hands back the texel's own code (0x7d55… | | `half-texel-nans-rgba16f` | The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the dev… | -| `half-texel-nans-rgba32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample narrows it w… | +| `half-texel-nans-rgba32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` nearest sample. Metal answers the canonical 0x7e00; lavapipe's sample, narrowed to… | | `half-texel-nans-rgba32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a read-access texture. Metal answers the canonical 0x7e00; lavapipe's … | | `half-texel-nans-rgba32f` | The device's own answer (rule 1): a 32-bit float texel's NaN through a `half` `read()` of a sample-access texture. Metal answers the canonical 0x7e00; lavapipe'… | | `half-texel-nans-rgba32f` | The device's own answer (rule 1): the shader's `float` widening of the `half` this case read. Metal widens every `half` NaN to its canonical 0x7fc00000; the dev… | @@ -9727,22 +9724,6 @@ A case whose difference from Metal is recorded rather than compared away. The le | `format-footprints-plain-stragglers` | refused: rt makes no texture buffer of MTLPixelFormatBGRA4Unorm on any venue (Gap::TextureFormat): a texture buffer's one buffer view takes a format the device … | | `fractional-viewport-coverage` | An accepted difference (docs/API.md section 10, Draws): Metal states only that fragments outside the viewport are clipped (MTLRenderCommandEncoder.h, setViewpor… | | `fractional-viewport-coverage` | A driver bug and an accepted difference at one site, split by pixel: every differing pixel is a far column or far row Metal drew and the Iris left at the clear … | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | | `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and … | | `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and … | | `integer-vertex-attributes` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and … | @@ -9794,42 +9775,14 @@ A case whose difference from Metal is recorded rather than compared away. The le | `vertex-format-float4` | The device's own answer (rule 1): a NaN vertex attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00… | | `vertex-format-float4` | The device's own answer (rule 1): a NaN vertex attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00… | | `vertex-format-float4` | The device's own answer (rule 1): a NaN vertex attribute reaches the function in the device's encoding, where Metal reads the canonical NaN. Metal reads 0x7fc00… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonica… | -| `vertex-format-half4` | The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonica… | -| `vertex-format-half4` | The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonica… | -| `vertex-format-half4` | The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonica… | -| `vertex-format-half4` | The device's own answer (rule 1): a NaN of a `half` or `RG11B10` vertex attribute widened by the device's fetch keeps its payload where Metal reads the canonica… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | -| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's `OpFConvert` to 16 bits an… | +| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `Roundin… | +| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `Roundin… | +| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `Roundin… | +| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `Roundin… | +| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `Roundin… | +| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `Roundin… | +| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `Roundin… | +| `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is held at 16 bits under the 16-bit float controls (lavapipe offers 16-bit `Roundin… | | `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and … | | `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and … | | `vertex-format-half4` | The device's own answer (rule 1): a vertex function's `half`-typed attribute is the fetched `float` rounded to `half` by the module's conversion to 16 bits and … | diff --git a/docs/HOWTO.md b/docs/HOWTO.md index 7543a2bfe..72f3b3ee3 100644 --- a/docs/HOWTO.md +++ b/docs/HOWTO.md @@ -53,7 +53,10 @@ multiply-add into the conversion of its result and rounds the exact result once. `Device::from_queries` made (`metal2vulkan-runtime`), which reads no driver identity, every device with the float controls takes the pair, NVIDIA's included, and every pipeline that rounds through it records `NativeHalfConversion`, as a driver's compiler may fold the pair or fuse the operation so. -A `half` read from memory or from its bits is the device's widening on every device (an +A device with `shaderFloat16` and the 16-bit `RoundingModeRTE` and `SignedZeroInfNanPreserve` +controls but not the 16-bit `DenormPreserve` (lavapipe) computes `half` the same way under those +two, and every pipeline that declares them there records `DeviceHalfDenormals`: a half denormal +may flush to zero. A `half` read from memory or from its bits is the device's widening on every device (an `OpFConvert` of the bits read as a 16-bit float with `shaderFloat16`, `GLSL.std.450 UnpackHalf2x16` without it), and a `half` stored or reinterpreted as bits, unless they are the bits it was loaded from, the device's narrowing (an `OpFConvert` to 16 bits, `GLSL.std.450