2021. 08. 27. 19:08 keltezéssel, Böszörményi Zoltán írta:
2021. 08. 27. 18:57 keltezéssel, Mittal, Anuj írta:
On Fri, 2021-08-27 at 10:11 +0200, Böszörményi Zoltán wrote:
Hi,

sorry for the previous rant. I can see that the temporary
LLVM 12 compat patch is part of current master in IGC.

I have submitted the LLVM 13 fixes against IGC at
https://github.com/intel/intel-graphics-compiler/pull/196
and added the requested legal header in the v2 patch.

Thank you. IGC build passes but it's now causing a segfault while
compiling compute-runtime-native which executes ocloc:

Probably because the opencl-clang version is still 12.0.0,
there's no 13.0.0 recipe and the preferred version sets 12.0.0
for both native and target builds.

It seems it's not that. (I will send the recipe for opencl-clang 13.0.0, 
though.)
The API changes were quite straightforward by looking at
the LLVM changes and its internal usage of the APIs.

However, this kind of changes are somewhat doubtful:

+#if LLVM_VERSION_MAJOR >= 13
+            CloneFunctionInto(pNewFunc, pFunc, VMap, CloneFunctionChangeType::DifferentModule, Returns);
+#else
             CloneFunctionInto(pNewFunc, pFunc, VMap, true, Returns);
+#endif

The boolean parameter was replaced by an enum with 4 possible values
and it's possible that the s/true/GlobalChanges/ is enough.
"DifferentModule" is even stronger, although mostly that one
is used in LLVM-internal usage of CloneFunctionInto() where
"true" was used originally.

I will try this idea.


There's an ocl-open-130 branch in opencl-clang but it seems
https://github.com/intel/opencl-clang/pull/273 will be needed
to compile properly.


cd builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/git/shared/source/built_ins/kernels &&
LD_LIBRARY_PATH=builddir/build/tmp/work/x86_64-linux/intel-compute-
runtime-native/21.33.20678-r0/build/bin builddir/build/tmp/work/x86_64-
linux/intel-compute-runtime-native/21.33.20678-r0/build/bin/ocloc -file
copy_buffer_to_buffer_stateless.builtin_kernel -device glk -cl-intel-
greater-than-4GB-buffer-required -32 -output
bindful_copy_buffer_to_buffer_stateless -out_dir
builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/build/bin/built_ins/x64/gen9 -options -cl-kernel-
arg-info
[0]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-
r0/build/bin/libocloc.so(_ZN16SafetyGuardLinux9sigActionEiP9siginfo_tPv
+0x30) [0x7f2efd0db330]
[1]: builddir/build/tmp/sysroots-uninative/x86_64-
linux/lib/libc.so.6(+0x419d0) [0x7f2efce919d0]
[2]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-native/usr/lib/./libLLVM-
13.so(_ZN4llvm11PointerType3getEPNS_4TypeEj+0xe) [0x7f2ef771a19e]
[3]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2b6745) [0x7f2eefc94745]
[4]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2d927a) [0x7f2eefcb727a]
[5]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2daafd) [0x7f2eefcb8afd]
[6]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2e011a) [0x7f2eefcbe11a]
[7]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2e5437) [0x7f2eefcc3437]
[8]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2e5b36) [0x7f2eefcc3b36]
[9]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2230f7) [0x7f2eefc010f7]
[10]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x223957) [0x7f2eefc01957]
[11]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x227ec3) [0x7f2eefc05ec3]
[12]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2f4086) [0x7f2eefcd2086]
[13]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/recipe-sysroot-
native/usr/lib/libigc.so.1(+0x2f6e23) [0x7f2eefcd4e23]
[14]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-
r0/build/bin/libocloc.so(_ZN3NEO15OfflineCompiler15buildSourceCodeEv+0x
4b9) [0x7f2efd0aa769]
[15]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-
r0/build/bin/libocloc.so(_ZN3NEO15OfflineCompiler5buildEv+0x45)
[0x7f2efd0ad005]
[16]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/build/bin/libocloc.so(+0x88177) [0x7f2efd0db177]
[17]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-
r0/build/bin/libocloc.so(_Z20buildWithSafetyGuardPN3NEO15OfflineCompile
rE+0xa7) [0x7f2efd0db257]
[18]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/build/bin/libocloc.so(oclocInvoke+0x7d0)
[0x7f2efd0981a0]
[19]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/build/bin/ocloc(main+0x23) [0x400813]
[20]: builddir/build/tmp/sysroots-uninative/x86_64-
linux/lib/libc.so.6(+0x2d51b) [0x7f2efce7d51b]
[21]: builddir/build/tmp/sysroots-uninative/x86_64-
linux/lib/libc.so.6(__libc_start_main+0x7c) [0x7f2efce7d5cc]
[22]: builddir/build/tmp/work/x86_64-linux/intel-compute-runtime-
native/21.33.20678-r0/build/bin/ocloc(_start+0x29) [0x400849]

Thanks,

Anuj


Best regards,
Zoltán Böszörményi

2021. 08. 27. 9:49 keltezéssel, Böszörményi Zoltán írta:
Hi,

Is it worth it? I sent a patch for IGC to build with LLVM 12
back in February (which was  reviewed, internally merged,
then reverted) so there's still a patch in meta-intel called
0005-Temporary-LLVM-12-compatiblity-fix.patch to fix building
with LLVM 13.

Anyway, there's an issue I raised against IGC:
https://github.com/intel/intel-graphics-compiler/issues/193

and against the meta-intel mirror at:
https://github.com/YoeDistro/meta-intel/issues/3
and the PR:
https://github.com/YoeDistro/meta-intel/pull/4

Best regards,
Zoltán Böszörményi

2021. 08. 27. 9:36 keltezéssel, Mittal, Anuj írta:


-----Original Message-----
From:
[email protected] <[email protected]
On Behalf
Of zboszor via lists.yoctoproject.org
Sent: Friday, August 27, 2021 03:19 PM
To: [email protected]
Cc: [email protected]
Subject: [meta-intel] [PATCH] intel-graphics-compiler: LLVM 13
fixes

From: Zoltán Böszörményi <[email protected]>

Also add CXXFLAGS=-Wno-error=deprecated-declarations, to turn
some deprecated
LLVM API usage from warnings to errors.

Thank you for the fixes. Can you please raise a PR for igc github
repository so they can
review and add Upstream-Status: Submitted in this patch?

Thanks,

Anuj


Signed-off-by: Zoltán Böszörményi <[email protected]>
---
   .../igc/files/0001-LLVM-13-fixes.patch        | 436
++++++++++++++++++
   .../igc/intel-graphics-compiler_1.0.8365.bb   |   3 +
   2 files changed, 439 insertions(+)
   create mode 100644 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
new file mode 100644
index 00000000..53ea183b
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/files/0001-
LLVM-13-f
+++ ixes.patch
@@ -0,0 +1,436 @@
+From 6247039d9193adf3813375fefc95071e8f5b4097 Mon Sep 17
00:00:00 2001
+From: Buildbot <[email protected]>
+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 <[email protected]>
+---
+ .../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<BasicBlock>(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<BasicBlock>(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/2641a19981e71c887bece92074e
+00d1af3e716c9#diff-dd4bd65dc55d754674d9a945a0d22911
+
++#if LLVM_VERSION_MAJOR >= 13
++  InstructionCost GenIntrinsicsTTIImpl::getUserCost(const User
*U,
++ArrayRef<const Value *> Operands, TTI::TargetCostKind CostKind)
#else
+   int GenIntrinsicsTTIImpl::getUserCost(const User *U,
ArrayRef<const
+ Value *> Operands, TTI::TargetCostKind CostKind)
++#endif
+   {
+       const Function* F = dyn_cast<Function>(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<const Value
++*> Operands,
+ #else
+        int getUserCost(const User *U, ArrayRef<const Value *>
+ 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>(assumeInst))
++ AC->registerAssumption(aI); #else
+ AC->registerAssumption(assumeInst);
++#endif
+                     }
+
+                     assumptionAdded[PN] = 1; diff --git
+a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/
Address
+SpaceAliasAnalysis.cpp
+b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/
Address
+SpaceAliasAnalysis.cpp
+index a2b5927ea..1516e40e8 100644
+---
+a/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/
Address
+SpaceAliasAnalysis.cpp
++++
b/IGC/Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/A
dd
++++ ressSpaceAliasAnalysis.cpp
+@@ -7,6 +7,9 @@ SPDX-License-Identifier: MIT
+============================= end_copyright_notice
+===========================*/
+
+ #include "llvm/Config/llvm-config.h"
++#if LLVM_VERSION_MAJOR >= 13
++#include <llvm/Analysis/AliasAnalysis.h> #endif
+ #include <llvm/Analysis/TargetLibraryInfo.h>
+ #include
"Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/Addres
sSpaceAliasA
nalysis.h"
+ #include "Compiler/CodeGenPublic.h"
+@@ -45,7 +48,11 @@ namespace {
+             PointerType* PtrTy2 =
+dyn_cast<PointerType>(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/PrivateMemor
yResolu
+tion.cpp
+b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemor
yResolu
+tion.cpp
+index 48c7e8637..8b9618284 100644
+---
+a/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemor
yResolu
+tion.cpp
++++
b/IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemory
Re
++++ solution.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<IGCLLVM::Module>
LocalCloneModule(
+             }
+
+             SmallVector<ReturnInst*, 8> 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<preserveNames,
T,
Inserter>::ScalarsToVector(
+     IGC_ASSERT(nullptr != resultType);
+     llvm::Value* result = llvm::UndefValue::get(resultType);
+
+-    for (unsigned i = 0; i <
llvm::cast<llvm::VectorType>(resultType)-
getNumElements(); i++)
++    for (unsigned i = 0; i <
++ llvm::cast<IGCLLVM::FixedVectorType>(resultType)-
getNumElements();
++ i++)
+     {
+         IGC_ASSERT(nullptr != scalars[i]);
+
+IGC_ASSERT(llvm::cast<llvm::VectorType>(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<const
Value *>
++Operands #else
+   int getUserCost(const User *U, ArrayRef<const Value *>
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 <stdexcept>
++#include <limits>
+ #include <algorithm>
+ #include <bitset>
+ #include <cstdint>
+--
+2.31.1
+
diff --git a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-
graphics-
compiler_1.0.8365.bb b/dynamic-layers/clang-layer/recipes-
opencl/igc/intel-graphics-
compiler_1.0.8365.bb
index 153f4bb4..8d557b07 100644
--- a/dynamic-layers/clang-layer/recipes-opencl/igc/intel-
graphics-
compiler_1.0.8365.bb
+++ b/dynamic-layers/clang-layer/recipes-opencl/igc/intel-
graphics-compi
+++ ler_1.0.8365.bb
@@ -14,6 +14,7 @@ SRC_URI = "git://github.com/intel/intel-
graphics-
compiler.git;protocol=https; \
file://0003-Improve-Reproducibility-for-src-package.patch \
     �� file://0004-find-external-llvm-tblgen.patch \
file://0005-Temporary-LLVM-12-compatiblity-fix.patch \
+           file://0001-LLVM-13-fixes.patch \
             "

   SRCREV = "5d5672d6cc0c415dae76648390026f777004bd99"
@@ -25,6 +26,8 @@ S = "${WORKDIR}/git"

   inherit cmake

+CXXFLAGS:append = " -Wno-error=deprecated-declarations"
+
   COMPATIBLE_HOST = '(x86_64).*-linux'
   COMPATIBLE_HOST:libc-musl = "null"

--
2.31.1






-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7240): 
https://lists.yoctoproject.org/g/meta-intel/message/7240
Mute This Topic: https://lists.yoctoproject.org/mt/85180959/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to