From 5d93451b02e69dd1a09dd49ce805efc01a2a0ee7 Mon Sep 17 00:00:00 2001 From: Boris Zanin Date: Thu, 11 Apr 2019 10:07:12 +0200 Subject: [PATCH] Add float 16 calculation into FMA tests Add one more calculation flavor into calculation Float16 FMA tests. Updates: * dEQP-VK.spirv_assembly.instruction.compute.float16.arithmetic*.fma * dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic*.fma* Components: Vulkan VK-GL-CTS issue: 1730 Change-Id: Ic3c378a75d23afcafb0f6ce7052351d70d4d30bc (cherry picked from commit 67a010acd731667bcf067652d11ba494f0afff95) --- .../vktSpvAsmInstructionTests.cpp | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp index a0a67994f..0aa6021bd 100644 --- a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp +++ b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp @@ -13429,6 +13429,12 @@ struct fp16SmoothStep : public fp16PerComponent struct fp16Fma : public fp16PerComponent { + fp16Fma() + { + flavorNames.push_back("DoubleCalc"); + flavorNames.push_back("EmulatingFP16"); + } + virtual double getULPs(vector& in) { DE_UNREF(in); @@ -13448,10 +13454,30 @@ struct fp16Fma : public fp16PerComponent const fp16type a (*in[0]); const fp16type b (*in[1]); const fp16type c (*in[2]); - const double ad (a.asDouble()); - const double bd (b.asDouble()); - const double cd (c.asDouble()); - const double result (deMadd(ad, bd, cd)); + double result (0.0); + + if (getFlavor() == 0) + { + const double ad (a.asDouble()); + const double bd (b.asDouble()); + const double cd (c.asDouble()); + + result = deMadd(ad, bd, cd); + } + else if (getFlavor() == 1) + { + const double ad (a.asDouble()); + const double bd (b.asDouble()); + const double cd (c.asDouble()); + const fp16type ab (ad * bd); + const fp16type r (ab.asDouble() + cd); + + result = r.asDouble(); + } + else + { + TCU_THROW(InternalError, "Unknown flavor"); + } out[0] = fp16type(result).bits(); min[0] = getMin(result, getULPs(in)); -- 2.34.1