diff --git a/IGC/AdaptorCommon/FastMathConstantHandling.cpp b/IGC/AdaptorCommon/FastMathConstantHandling.cpp deleted file mode 100644 index 485b8844dec5..000000000000 --- a/IGC/AdaptorCommon/FastMathConstantHandling.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/*========================== begin_copyright_notice ============================ - -Copyright (C) 2023 Intel Corporation - -SPDX-License-Identifier: MIT - -============================= end_copyright_notice ===========================*/ - -#include "common/LLVMWarningsPush.hpp" -#include -#include -#include -#include "common/LLVMWarningsPop.hpp" -#include "FastMathConstantHandling.h" -#include "Compiler/IGCPassSupport.h" -#include "common/igc_regkeys.hpp" - -using namespace llvm; -namespace IGC -{ - -class FastMathConstantHandling : public FunctionPass, public InstVisitor -{ -public: - FastMathConstantHandling(); - ~FastMathConstantHandling() {} - static char ID; - bool runOnFunction(Function& F) override; - void visitInstruction(Instruction& I); - virtual llvm::StringRef getPassName() const override { return "Fast Math Constant Handling"; } - - void getAnalysisUsage(AnalysisUsage& AU) const override - { - AU.setPreservesCFG(); - } -}; - -#define PASS_FLAG "FastMathConstantHandling" -#define PASS_DESC "Fast Math Constant Handling" -#define PASS_CFG_ONLY false -#define PASS_ANALYSIS false -IGC_INITIALIZE_PASS_BEGIN(FastMathConstantHandling, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_ANALYSIS) -IGC_INITIALIZE_PASS_END(FastMathConstantHandling, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY, PASS_ANALYSIS) - -char FastMathConstantHandling::ID = 0; - -FastMathConstantHandling::FastMathConstantHandling() - :FunctionPass(ID) -{ - initializeFastMathConstantHandlingPass(*PassRegistry::getPassRegistry()); -} - -// This purpose of this pass is to catch bad fast flag management where we are seeing -// constants that are not matching the fast flags that are set on the instructions - -void FastMathConstantHandling::visitInstruction(Instruction& I) -{ - if (isa(I)) - { - struct BoolSpecialConstants { - bool hasInf = false; - bool hasNan = false; - bool hasNegZero = false; - } BSC; - - for (auto &Op : I.operands()) - { - if (auto* fp_val = dyn_cast(Op)) - { - auto APF = fp_val->getValueAPF(); - BSC.hasInf |= APF.isInfinity(); - BSC.hasNan |= APF.isNaN(); - BSC.hasNegZero |= APF.isNegZero(); - } - } - - if (BSC.hasInf) - I.setHasNoInfs(false); - - if (BSC.hasNan) - I.setHasNoNaNs(false); - - if (BSC.hasNegZero) - I.setHasNoSignedZeros(false); - } -} - -bool FastMathConstantHandling::runOnFunction(Function& F) -{ - if (IGC_IS_FLAG_DISABLED(DisableFastMathConstantHandling)) - { - visit(F); - } - return true; -} - - -FunctionPass* createFastMathConstantHandling() -{ - return new FastMathConstantHandling(); -} - -}//namespace IGC diff --git a/IGC/AdaptorCommon/FastMathConstantHandling.h b/IGC/AdaptorCommon/FastMathConstantHandling.h deleted file mode 100644 index 5f37abba6817..000000000000 --- a/IGC/AdaptorCommon/FastMathConstantHandling.h +++ /dev/null @@ -1,19 +0,0 @@ -/*========================== begin_copyright_notice ============================ - -Copyright (C) 2023 Intel Corporation - -SPDX-License-Identifier: MIT - -============================= end_copyright_notice ===========================*/ - -#pragma once - -#include "common/LLVMWarningsPush.hpp" -#include "llvm/Pass.h" -#include "common/LLVMWarningsPop.hpp" - -namespace IGC -{ - void initializeFastMathConstantHandlingPass(llvm::PassRegistry&); - llvm::FunctionPass* createFastMathConstantHandling(); -} diff --git a/IGC/DriverInterface/CMakeLists.txt b/IGC/DriverInterface/CMakeLists.txt index 021ec5df7aea..0fdaa67762e7 100644 --- a/IGC/DriverInterface/CMakeLists.txt +++ b/IGC/DriverInterface/CMakeLists.txt @@ -20,7 +20,6 @@ set(IGC_BUILD__SRC__DriverInterface "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/TypesLegalizationPass.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/LegalizeFunctionSignatures.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/DivergentBarrierPass.cpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/FastMathConstantHandling.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/LoadBuffer.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/Patch/patch_parser.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/Platform/cmd_media_caps_g8.cpp" @@ -84,7 +83,6 @@ endif(IGC_BUILD__SPIRV_ENABLED) set(IGC_BUILD__HDR__DriverInterface "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/customApi.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/DivergentBarrierPass.h" - "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorCommon/FastMathConstantHandling.h" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/KernelAnnotations.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/CommandStream/SamplerTypes.h" "${CMAKE_CURRENT_SOURCE_DIR}/../AdaptorOCL/OCL/CommandStream/SurfaceTypes.h" diff --git a/IGC/common/igc_flags.h b/IGC/common/igc_flags.h index 6e09b7eeea26..47dd2b661883 100644 --- a/IGC/common/igc_flags.h +++ b/IGC/common/igc_flags.h @@ -759,7 +759,6 @@ DECLARE_IGC_REGKEY(bool, OverrideCsTileLayout, 0, "Override compute wa DECLARE_IGC_REGKEY(DWORD, MemCpyLoweringUnrollThreshold, 12, "Min number of mem instructions that require non-unrolled loop when lowering memcpy", false) DECLARE_IGC_REGKEY(bool, EnableSOAPromotionDisablingHeuristic, false, "Enable heuristic to disable SOA promotion when it may be not beneficial", false) DECLARE_IGC_REGKEY(bool, EnableCSContentCheck, false, "Enable CS content check to force SIMD32", true) -DECLARE_IGC_REGKEY(bool, DisableFastMathConstantHandling, false, "Disable Fast Math Constant Handling", true) DECLARE_IGC_GROUP("Generating precompiled headers") DECLARE_IGC_REGKEY(bool, ApplyConservativeRastWAHeader, true, "Apply WaConservativeRasterization for the platforms enabled", false)