From: Boris Zanin Date: Thu, 11 Apr 2019 08:07:12 +0000 (+0200) Subject: Add float 16 calculation into FMA tests X-Git-Tag: upstream/1.3.5~2002^2~4^2~2^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d93451b02e69dd1a09dd49ce805efc01a2a0ee7;p=platform%2Fupstream%2FVK-GL-CTS.git 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) --- diff --git a/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp b/external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp index a0a6799..0aa6021 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));