Allow float16 max value for result larger than max
authorPeter Deayton <pdeayton@nvidia.com>
Thu, 15 Nov 2018 18:26:37 +0000 (10:26 -0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 29 Nov 2018 09:24:40 +0000 (04:24 -0500)
Numbers larger than the maximum representable float16 value may round to
infinity for RTE rounding mode, or to the maximum representable value
65504 (0x7bff) for RTZ rounding mode.

Components: Vulkan

VK-GL-CTS issue: 1483

Affects:
dEQP-VK.spirv_assembly.instruction.compute.float16.arithmetic_*
dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic_*

Change-Id: Id53eeb797e522db98bb070894a7c715507a4f05a

external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp

index 9fc51dd..9177957 100644 (file)
@@ -15064,6 +15064,15 @@ bool compareFP16ArithmeticFunc (const std::vector<Resource>& inputs, const vecto
                                                                        reportError = false;
                                                        }
 
+                                                       if (reportError && expected.isInf())
+                                                       {
+                                                               // RTZ rounding mode returns +/-65504 instead of Inf on overflow
+                                                               if (expected.sign() == 1 && outputted.bits() == 0x7bff && iterationEdgeMin[componentNdx] <= std::numeric_limits<double>::max())
+                                                                       reportError = false;
+                                                               else if (expected.sign() == -1 && outputted.bits() == 0xfbff && iterationEdgeMax[componentNdx] >= -std::numeric_limits<double>::max())
+                                                                       reportError = false;
+                                                       }
+
                                                        if (reportError)
                                                        {
                                                                const double    outputtedDouble = outputted.asDouble();