From 8a1fb876b05a6c66e26dd2e42dee6f19bcfbd421 Mon Sep 17 00:00:00 2001 From: Anuj Mittal Date: Tue, 21 Sep 2021 10:22:49 +0800 Subject: intel-graphics-compiler: upgrade 1.0.8365 -> 1.0.8708 Remove patches that are not required now. IGC_BUILD__USE_KHRONOS_SPIRV_TRANSLATOR has been renamed so it wasn't taking effect. Remove the option for now. Signed-off-by: Anuj Mittal --- .../igc/files/0001-LLVM-13-fixes.patch | 437 --------------------- 1 file changed, 437 deletions(-) delete mode 100644 dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch (limited to 'dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch') diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch deleted file mode 100644 index b102af0f..00000000 --- a/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-LLVM-13-fixes.patch +++ /dev/null @@ -1,437 +0,0 @@ -From 6247039d9193adf3813375fefc95071e8f5b4097 Mon Sep 17 00:00:00 2001 -From: Buildbot -Date: Fri, 27 Aug 2021 07:07:04 +0000 -Subject: [PATCH] LLVM 13 fixes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Zoltán Böszörményi -Upstream-Status: Submitted ---- - .../LegalizeFunctionSignatures.cpp | 4 ++++ - IGC/AdaptorOCL/OCL/sp/spp_g8.cpp | 6 ++++- - IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp | 8 +++++++ - IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp | 8 +++++++ - IGC/Compiler/GenTTI.cpp | 4 ++++ - IGC/Compiler/GenTTI.h | 4 ++++ - IGC/Compiler/Optimizer/BuiltInFuncImport.cpp | 4 ++++ - IGC/Compiler/Optimizer/CodeAssumption.cpp | 5 ++++ - .../AddressSpaceAliasAnalysis.cpp | 23 +++++++++++++++++++ - .../PrivateMemory/PrivateMemoryResolution.cpp | 3 +++ - IGC/DebugInfo/DwarfDebug.cpp | 8 +++++++ - IGC/DebugInfo/StreamEmitter.cpp | 14 ++++++++++- - IGC/ElfPackager/main.cpp | 4 ++++ - .../BuiltinsFrontendDefinitions.hpp | 2 +- - .../lib/GenXCodeGen/GenXTargetMachine.h | 4 ++++ - .../include/llvmWrapper/Transforms/Scalar.h | 2 +- - IGC/common/LLVMUtils.cpp | 12 ++++++++++ - visa/iga/IGALibrary/IR/BitSet.hpp | 2 ++ - 18 files changed, 113 insertions(+), 4 deletions(-) - -diff --git a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp -index ee43be301..395f26c91 100644 ---- a/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp -+++ b/IGC/AdaptorCommon/LegalizeFunctionSignatures.cpp -@@ -377,7 +377,11 @@ void LegalizeFunctionSignatures::FixFunctionBody(Module& M) - } - - // Clone the old function body into the new -+#if LLVM_VERSION_MAJOR >= 13 -+ CloneFunctionInto(pNewFunc, pFunc, VMap, CloneFunctionChangeType::DifferentModule, Returns); -+#else - CloneFunctionInto(pNewFunc, pFunc, VMap, true, Returns); -+#endif - - // Merge the BB for when extra instructions were created - BasicBlock* ClonedEntryBB = cast(VMap[&*pFunc->begin()]); -diff --git a/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp b/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp -index 6f7c711bc..8d8c4e50d 100644 ---- a/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp -+++ b/IGC/AdaptorOCL/OCL/sp/spp_g8.cpp -@@ -387,7 +387,11 @@ bool createElfFileName(std::string &name, unsigned int maxNameLen, SIMDMode simd - unsigned int mode = sys::fs::perms::all_read | sys::fs::perms::all_write; - // Every '%' will be replaced with a random character (0-9 or a-f), taking care of multithreaded compilations - if (std::error_code EC = sys::fs::createUniqueFile( -- uniqueLockFileName, uniqueLockFileID, resultUniqueLockFileName, mode)) -+ uniqueLockFileName, uniqueLockFileID, resultUniqueLockFileName, -+#if LLVM_VERSION_MAJOR >= 13 -+ llvm::sys::fs::OF_None, -+#endif -+ mode)) - { - IGC_ASSERT_MESSAGE(false, "A uniquely named file not created"); - retValue = false; -diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp -index 65e672afe..f28136a6a 100644 ---- a/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp -+++ b/IGC/AdaptorOCL/SPIRV/SPIRVReader.cpp -@@ -97,7 +97,11 @@ isOpenCLKernel(SPIRVFunction *BF) { - __attr_unused static void - dumpLLVM(Module *M, const std::string &FName) { - std::error_code EC; -+#if LLVM_VERSION_MAJOR >= 13 -+ raw_fd_ostream FS(FName, EC, sys::fs::OF_None); -+#else - raw_fd_ostream FS(FName, EC, sys::fs::F_None); -+#endif - if (!FS.has_error()) { - FS << *M; - } -@@ -2413,7 +2417,11 @@ SPIRVToLLVM::postProcessFunctionsReturnStruct(Function *F) { - NewArgIt->setName(OldArgIt->getName()); - VMap[&*OldArgIt] = &*NewArgIt; - } -+#if LLVM_VERSION_MAJOR >= 13 -+ CloneFunctionInto(NewF, F, VMap, CloneFunctionChangeType::DifferentModule, Returns); -+#else - CloneFunctionInto(NewF, F, VMap, true, Returns); -+#endif - auto DL = M->getDataLayout(); - const auto ptrSize = DL.getPointerSize(); - -diff --git a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp -index ecb045b88..0a0893e4a 100644 ---- a/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp -+++ b/IGC/AdaptorOCL/SPIRV/SPIRVUtil.cpp -@@ -67,7 +67,11 @@ namespace igc_spv{ - void - saveLLVMModule(Module *M, const std::string &OutputFile) { - std::error_code EC; -+#if LLVM_VERSION_MAJOR >= 13 -+ llvm::ToolOutputFile Out(OutputFile.c_str(), EC, sys::fs::OF_None); -+#else - llvm::ToolOutputFile Out(OutputFile.c_str(), EC, sys::fs::F_None); -+#endif - IGC_ASSERT_EXIT_MESSAGE((!EC), "Failed to open file"); - IGCLLVM::WriteBitcodeToFile(M, Out.os()); - Out.keep(); -@@ -326,7 +330,11 @@ mutateCallInst(Module *M, CallInst *CI, - } - } - -+#if LLVM_VERSION_MAJOR >= 13 -+ CloneFunctionInto(NewF, OldF, VMap, CloneFunctionChangeType::DifferentModule, Returns); -+#else - CloneFunctionInto(NewF, OldF, VMap, true, Returns); -+#endif - - // Merge the basic block with Load instruction with the original entry basic block. - BasicBlock* ClonedEntryBB = cast(VMap[&*OldF->begin()]); -diff --git a/IGC/Compiler/GenTTI.cpp b/IGC/Compiler/GenTTI.cpp -index 8a74ec287..23c9bc6ed 100644 ---- a/IGC/Compiler/GenTTI.cpp -+++ b/IGC/Compiler/GenTTI.cpp -@@ -461,7 +461,11 @@ namespace llvm { - // [LLVM-UPGRADE] moved from getCallCost to getUserCost - // https://github.com/llvm/llvm-project/commit/2641a19981e71c887bece92074e00d1af3e716c9#diff-dd4bd65dc55d754674d9a945a0d22911 - -+#if LLVM_VERSION_MAJOR >= 13 -+ InstructionCost GenIntrinsicsTTIImpl::getUserCost(const User *U, ArrayRef Operands, TTI::TargetCostKind CostKind) -+#else - int GenIntrinsicsTTIImpl::getUserCost(const User *U, ArrayRef Operands, TTI::TargetCostKind CostKind) -+#endif - { - const Function* F = dyn_cast(U); - if(F != nullptr) -diff --git a/IGC/Compiler/GenTTI.h b/IGC/Compiler/GenTTI.h -index bab1a5c4a..0b3bf4541 100644 ---- a/IGC/Compiler/GenTTI.h -+++ b/IGC/Compiler/GenTTI.h -@@ -71,8 +71,12 @@ namespace llvm - , const User * U - #endif - ); -+#else -+#if LLVM_VERSION_MAJOR >= 13 -+ InstructionCost getUserCost(const User *U, ArrayRef Operands, - #else - int getUserCost(const User *U, ArrayRef Operands, -+#endif - TTI::TargetCostKind CostKind); - #endif - -diff --git a/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp b/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp -index e7995ebb4..035bfba85 100644 ---- a/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp -+++ b/IGC/Compiler/Optimizer/BuiltInFuncImport.cpp -@@ -880,7 +880,11 @@ void BIImport::removeFunctionBitcasts(Module& M) - pDstFunc, - funcTobeChanged, - operandMap, -+#if LLVM_VERSION_MAJOR >= 13 -+ CloneFunctionChangeType::LocalChangesOnly, -+#else - false, -+#endif - Returns, - ""); - -diff --git a/IGC/Compiler/Optimizer/CodeAssumption.cpp b/IGC/Compiler/Optimizer/CodeAssumption.cpp -index e7208a5fa..3ee9bddca 100644 ---- a/IGC/Compiler/Optimizer/CodeAssumption.cpp -+++ b/IGC/Compiler/Optimizer/CodeAssumption.cpp -@@ -272,7 +272,12 @@ bool CodeAssumption::addAssumption(Function* F, AssumptionCache* AC) - // Register assumption - if (AC) - { -+#if LLVM_VERSION_MAJOR >= 13 -+ if (auto *aI = dyn_cast(assumeInst)) -+ AC->registerAssumption(aI); -+#else - AC->registerAssumption(assumeInst); -+#endif - } - - assumptionAdded[PN] = 1; -diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp -index a2b5927ea..1516e40e8 100644 ---- a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp -+++ b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.cpp -@@ -7,6 +7,9 @@ SPDX-License-Identifier: MIT - ============================= end_copyright_notice ===========================*/ - - #include "llvm/Config/llvm-config.h" -+#if LLVM_VERSION_MAJOR >= 13 -+#include -+#endif - #include - #include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h" - #include "Compiler/CodeGenPublic.h" -@@ -45,7 +48,11 @@ namespace { - PointerType* PtrTy2 = dyn_cast(LocB.Ptr->getType()); - - if (!PtrTy1 || !PtrTy2) -+#if LLVM_VERSION_MAJOR >= 13 -+ return AliasResult::Kind::NoAlias; -+#else - return NoAlias; -+#endif - - unsigned AS1 = PtrTy1->getAddressSpace(); - unsigned AS2 = PtrTy2->getAddressSpace(); -@@ -62,21 +69,33 @@ namespace { - AS1 != ADDRESS_SPACE_GENERIC && - AS2 != ADDRESS_SPACE_GENERIC && - AS1 != AS2) -+#if LLVM_VERSION_MAJOR >= 13 -+ return AliasResult::Kind::NoAlias; -+#else - return NoAlias; -+#endif - - - // Shared local memory doesn't alias any statefull memory. - if ((AS1 == ADDRESS_SPACE_LOCAL && AS2 > ADDRESS_SPACE_NUM_ADDRESSES) || - (AS1 > ADDRESS_SPACE_NUM_ADDRESSES && AS2 == ADDRESS_SPACE_LOCAL)) - { -+#if LLVM_VERSION_MAJOR >= 13 -+ return AliasResult::Kind::NoAlias; -+#else - return NoAlias; -+#endif - } - - // Private memory doesn't alias any stateful memory - if ((AS1 == ADDRESS_SPACE_PRIVATE && AS2 > ADDRESS_SPACE_NUM_ADDRESSES) || - (AS1 > ADDRESS_SPACE_NUM_ADDRESSES && AS2 == ADDRESS_SPACE_PRIVATE)) - { -+#if LLVM_VERSION_MAJOR >= 13 -+ return AliasResult::Kind::NoAlias; -+#else - return NoAlias; -+#endif - } - - -@@ -108,7 +127,11 @@ namespace { - if ((resourceType[0] != resourceType[1]) || // different resource types - (isDirectAccess[0] && isDirectAccess[1] && resourceIndex[0] != resourceIndex[1])) // direct access to different BTIs - { -+#if LLVM_VERSION_MAJOR >= 13 -+ return AliasResult::Kind::NoAlias; -+#else - return NoAlias; -+#endif - } - } - } -diff --git a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp -index 48c7e8637..8b9618284 100644 ---- a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp -+++ b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp -@@ -17,6 +17,9 @@ SPDX-License-Identifier: MIT - #include "llvmWrapper/IR/DerivedTypes.h" - #include "llvm/Transforms/Utils/Local.h" - #include "llvm/IR/DataLayout.h" -+#if LLVM_VERSION_MAJOR >= 13 -+#include "llvm/IR/DebugInfo.h" -+#endif - #include "llvm/IR/DebugInfoMetadata.h" - #include "llvm/IR/Dominators.h" - #include "common/LLVMWarningsPop.hpp" -diff --git a/IGC/DebugInfo/DwarfDebug.cpp b/IGC/DebugInfo/DwarfDebug.cpp -index f57dd72cb..d984fe86f 100644 ---- a/IGC/DebugInfo/DwarfDebug.cpp -+++ b/IGC/DebugInfo/DwarfDebug.cpp -@@ -857,9 +857,17 @@ CompileUnit* DwarfDebug::constructCompileUnit(DICompileUnit* DIUnit) - { - std::string str; - str = "Intel OpenCL "; -+#if LLVM_VERSION_MAJOR >= 13 -+ str += toString(op1->getValue()->getUniqueInteger(), 10, false); -+#else - str += op1->getValue()->getUniqueInteger().toString(10, false); -+#endif - str += "."; -+#if LLVM_VERSION_MAJOR >= 13 -+ str += toString(op2->getValue()->getUniqueInteger(), 10, false); -+#else - str += op2->getValue()->getUniqueInteger().toString(10, false); -+#endif - - NewCU->addString(Die, dwarf::DW_AT_description, llvm::StringRef(str)); - } -diff --git a/IGC/DebugInfo/StreamEmitter.cpp b/IGC/DebugInfo/StreamEmitter.cpp -index a38a445d5..e9a5b6279 100644 ---- a/IGC/DebugInfo/StreamEmitter.cpp -+++ b/IGC/DebugInfo/StreamEmitter.cpp -@@ -391,11 +391,23 @@ StreamEmitter::StreamEmitter(raw_pwrite_stream& outStream, - - MCRegisterInfo* regInfo = nullptr; - -+ Triple triple = Triple(GetTargetTriple()); -+ -+#if LLVM_VERSION_MAJOR >= 13 -+ // Create new MC context -+ m_pContext = new MCContext(Triple(GetTargetTriple()), -+ (const llvm::MCAsmInfo*)m_pAsmInfo, regInfo, -+ /*MSTI=*/(const llvm::MCSubtargetInfo *)nullptr, m_pSrcMgr); -+ -+ m_pObjFileInfo->initMCObjectFileInfo(*m_pContext, false); -+ -+ m_pContext->setObjectFileInfo(m_pObjFileInfo); -+#else - // Create new MC context - m_pContext = new MCContext((const llvm::MCAsmInfo*)m_pAsmInfo, regInfo, m_pObjFileInfo, m_pSrcMgr); - -- Triple triple = Triple(GetTargetTriple()); - m_pObjFileInfo->InitMCObjectFileInfo(Triple(GetTargetTriple()), false, *m_pContext); -+#endif - - bool is64Bit = GetPointerSize() == 8; - uint8_t osABI = MCELFObjectTargetWriter::getOSABI(triple.getOS()); -diff --git a/IGC/ElfPackager/main.cpp b/IGC/ElfPackager/main.cpp -index 38a5001c1..5f4d87d96 100644 ---- a/IGC/ElfPackager/main.cpp -+++ b/IGC/ElfPackager/main.cpp -@@ -177,7 +177,11 @@ std::unique_ptr LocalCloneModule( - } - - SmallVector Returns; // Ignore returns cloned. -+#if LLVM_VERSION_MAJOR >= 13 -+ CloneFunctionInto(F, &*I, VMap, CloneFunctionChangeType::DifferentModule, Returns); -+#else - CloneFunctionInto(F, &*I, VMap, /*ModuleLevelChanges=*/true, Returns); -+#endif - } - - if (I->hasPersonalityFn()) -diff --git a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp -index b5f66f048..568b42c07 100644 ---- a/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp -+++ b/IGC/LLVM3DBuilder/BuiltinsFrontendDefinitions.hpp -@@ -5028,7 +5028,7 @@ llvm::Value* LLVM3DBuilder::ScalarsToVector( - IGC_ASSERT(nullptr != resultType); - llvm::Value* result = llvm::UndefValue::get(resultType); - -- for (unsigned i = 0; i < llvm::cast(resultType)->getNumElements(); i++) -+ for (unsigned i = 0; i < llvm::cast(resultType)->getNumElements(); i++) - { - IGC_ASSERT(nullptr != scalars[i]); - IGC_ASSERT(llvm::cast(resultType)->getElementType() == scalars[i]->getType()); -diff --git a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h -index f90bc1bc0..8ce06e93f 100644 ---- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h -+++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.h -@@ -97,7 +97,11 @@ public: - bool shouldBuildLookupTables() { return false; } - unsigned getFlatAddressSpace() { return 4; } - -+#if LLVM_VERSION_MAJOR >= 13 -+ InstructionCost getUserCost(const User *U, ArrayRef Operands -+#else - int getUserCost(const User *U, ArrayRef Operands -+#endif - #if LLVM_VERSION_MAJOR >= 11 - , - TTI::TargetCostKind CostKind -diff --git a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h -index 1df041372..022141d15 100644 ---- a/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h -+++ b/IGC/WrapperLLVM/include/llvmWrapper/Transforms/Scalar.h -@@ -26,7 +26,7 @@ namespace IGCLLVM - { - return llvm::createLoopUnrollPass(OptLevel, false, Threshold, Count, AllowPartial, Runtime, UpperBound, AllowPeeling); - } --#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 12 -+#elif LLVM_VERSION_MAJOR >= 9 && LLVM_VERSION_MAJOR <= 13 - inline static llvm::Pass * createLoopUnrollPass( - int OptLevel = 2, int Threshold = -1, int Count = -1, - int AllowPartial = -1, int Runtime = -1, -diff --git a/IGC/common/LLVMUtils.cpp b/IGC/common/LLVMUtils.cpp -index ed2cfc413..ae9df5d63 100644 ---- a/IGC/common/LLVMUtils.cpp -+++ b/IGC/common/LLVMUtils.cpp -@@ -132,7 +132,11 @@ bool IGCPassManager::isInList(const StringRef& N, const StringRef& List) const - size_t endPos = List.find_first_of(Separators, startPos); - size_t len = (endPos != StringRef::npos ? endPos - startPos : endPos); - StringRef Name = List.substr(startPos, len); -+#if LLVM_VERSION_MAJOR >= 13 -+ if (Name.equals_insensitive(N)) -+#else - if (Name.equals_lower(N)) -+#endif - { - return true; - } -@@ -149,7 +153,11 @@ bool IGCPassManager::isPrintBefore(Pass* P) - // or pass command args registered in passInfo. - StringRef passNameList(IGC_GET_REGKEYSTRING(PrintBefore)); - StringRef PN = P->getPassName(); -+#if LLVM_VERSION_MAJOR >= 13 -+ if (passNameList.equals_insensitive("all") || isInList(PN, passNameList)) -+#else - if (passNameList.equals_lower("all") || isInList(PN, passNameList)) -+#endif - return true; - - // further check passInfo -@@ -173,7 +181,11 @@ bool IGCPassManager::isPrintAfter(Pass* P) - // or pass command args registered in passInfo. - StringRef passNameList(IGC_GET_REGKEYSTRING(PrintAfter)); - StringRef PN = P->getPassName(); -+#if LLVM_VERSION_MAJOR >= 13 -+ if (passNameList.equals_insensitive("all") || isInList(PN, passNameList)) -+#else - if (passNameList.equals_lower("all") || isInList(PN, passNameList)) -+#endif - return true; - - // further check passInfo -diff --git a/visa/iga/IGALibrary/IR/BitSet.hpp b/visa/iga/IGALibrary/IR/BitSet.hpp -index 43b0d3f92..c6cdd430a 100644 ---- a/visa/iga/IGALibrary/IR/BitSet.hpp -+++ b/visa/iga/IGALibrary/IR/BitSet.hpp -@@ -12,6 +12,8 @@ SPDX-License-Identifier: MIT - #include "../asserts.hpp" - #include "common/secure_mem.h" - -+#include -+#include - #include - #include - #include --- -2.31.1 - -- cgit v1.2.3-54-g00ecf