From 9829752f6acddfcccf35bacad35395a0406953d3 Mon Sep 17 00:00:00 2001 From: Romaric Jodin <89833130+rjodinchr@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:16:21 +0200 Subject: [PATCH] add nocontraction decoration to conversions to floating point (#1382) It will allow to avoid optimization of certain driver breaking the implementation of the libclc. --- lib/SPIRVProducerPass.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/SPIRVProducerPass.cpp b/lib/SPIRVProducerPass.cpp index 2bb3cc38a..0539137ab 100644 --- a/lib/SPIRVProducerPass.cpp +++ b/lib/SPIRVProducerPass.cpp @@ -531,11 +531,13 @@ struct SPIRVProducerPassImpl { bool CalledWithCoherentResource(Argument &Arg); bool NeedDecorationNoContraction(spv::Op op) { - static const SmallVector list_full = {spv::OpFMul, spv::OpFDiv, - spv::OpFNegate, spv::OpFAdd, - spv::OpFSub, spv::OpFRem}; + static const SmallVector list_full = { + spv::OpFMul, spv::OpFDiv, spv::OpFNegate, + spv::OpFAdd, spv::OpFSub, spv::OpFRem, + spv::OpFConvert, spv::OpConvertUToF, spv::OpConvertSToF}; static const SmallVector list_mad_enable = { - spv::OpFDiv, spv::OpFNegate, spv::OpFSub, spv::OpFRem}; + spv::OpFDiv, spv::OpFNegate, spv::OpFSub, spv::OpFRem, + spv::OpFConvert, spv::OpConvertUToF, spv::OpConvertSToF}; auto check_list = [&op](const SmallVector &list) { for (auto opf : list) { if (op == opf)