[arch-commits] Commit in beignet/trunk (PKGBUILD llvm10.patch llvm8.patch llvm9.patch)
Evangelos Foutras
foutrelis at archlinux.org
Thu Apr 16 01:02:56 UTC 2020
Date: Thursday, April 16, 2020 @ 01:02:53
Author: foutrelis
Revision: 615085
upgpkg: beignet 1.3.2+12+gfc5f430c-4: LLVM 10 rebuild
Also replace LLVM 8/9 patches with ones from Debian which include a fix.
Added:
beignet/trunk/llvm10.patch
Modified:
beignet/trunk/PKGBUILD
beignet/trunk/llvm8.patch
beignet/trunk/llvm9.patch
--------------+
PKGBUILD | 20 ++-
llvm10.patch | 358 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
llvm8.patch | 63 ++++++----
llvm9.patch | 115 +++---------------
4 files changed, 433 insertions(+), 123 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2020-04-16 00:54:41 UTC (rev 615084)
+++ PKGBUILD 2020-04-16 01:02:53 UTC (rev 615085)
@@ -5,7 +5,7 @@
pkgname=beignet
pkgver=1.3.2+12+gfc5f430c
-pkgrel=3
+pkgrel=4
pkgdesc="An open source OpenCL implementation for Intel IvyBridge & Haswell iGPUs"
arch=(x86_64)
url="https://01.org/${pkgname}"
@@ -17,10 +17,12 @@
_commit=fc5f430cb7b7a8f694d86acbb038bd5b38ec389c # master as of 2018-08-20
source=("git+https://anongit.freedesktop.org/git/beignet.git#commit=$_commit"
'llvm8.patch'
- 'llvm9.patch')
+ 'llvm9.patch'
+ 'llvm10.patch')
sha256sums=('SKIP'
- 'f16b13a3263b5042081094cd20c9e09c20a3a6d6e1dd796f460e4f447cfbb598'
- '2a0229629ad228b54fdb930d18a94c6879024a41b43ed5265c758bf508cd4bc6')
+ 'd24e4d8a1a791dc02c91117f900143789dd6f01eaa89292ad67c4fb4eaf84328'
+ '5913a93fe6ef77b91480bb6d27c7875673294c0a8a924b2ac66756d0d3577908'
+ '2eb9b0801e24f4e537033b41a6bc462e4082f6216d62933240ca3010020ea779')
prepare() {
mkdir -p build
@@ -30,9 +32,13 @@
# (conflicts with the implemention in Clang 8)
git revert -n 9b7ca443cf7b 9cb7ff4c285d
- # Patches from FreeBSD to build with newer LLVM
- patch -Np0 -i ../llvm8.patch
- patch -Np0 -i ../llvm9.patch
+ # Patches from FreeBSD + Debian to build with newer LLVM
+ patch -Np1 -i ../llvm8.patch
+ patch -Np1 -i ../llvm9.patch
+
+ # https://lists.freedesktop.org/archives/beignet/2020-January/009251.html
+ # https://github.com/intel/opencl-clang/commit/77ae1114c7bf79d724f5129461
+ patch -Np1 -i ../llvm10.patch
}
build() {
Added: llvm10.patch
===================================================================
--- llvm10.patch (rev 0)
+++ llvm10.patch 2020-04-16 01:02:53 UTC (rev 615085)
@@ -0,0 +1,358 @@
+diff -upr beignet.orig/backend/src/backend/program.cpp beignet/backend/src/backend/program.cpp
+--- beignet.orig/backend/src/backend/program.cpp 2020-04-16 03:44:21.153955099 +0300
++++ beignet/backend/src/backend/program.cpp 2020-04-16 03:47:50.369205839 +0300
+@@ -694,9 +694,14 @@ namespace gbe {
+ #endif
+ );
+
++ llvm::cl::ResetAllOptionOccurrences();
+ clang::CompilerInvocation::CreateFromArgs(*CI,
++#if LLVM_VERSION_MAJOR < 10
+ &args[0],
+ &args[0] + args.size(),
++#else
++ clang::ArrayRef<const char*>(args),
++#endif
+ Diags);
+ // Create the compiler instance
+ clang::CompilerInstance Clang;
+@@ -1242,8 +1247,12 @@ EXTEND_QUOTE:
+ // Create the compiler invocation
+ std::unique_ptr<clang::CompilerInvocation> CI(new clang::CompilerInvocation);
+ return clang::CompilerInvocation::CreateFromArgs(*CI,
++#if LLVM_VERSION_MAJOR < 10
+ &args[0],
+ &args[0] + args.size(),
++#else
++ clang::ArrayRef<const char*>(args),
++#endif
+ Diags);
+ }
+ #endif
+Only in beignet/backend/src/backend: program.cpp.orig
+Only in beignet.orig/backend/src: CMakeLists.txt.orig
+diff -upr beignet.orig/backend/src/llvm/llvm_gen_backend.cpp beignet/backend/src/llvm/llvm_gen_backend.cpp
+--- beignet.orig/backend/src/llvm/llvm_gen_backend.cpp 2020-04-16 03:44:21.783970632 +0300
++++ beignet/backend/src/llvm/llvm_gen_backend.cpp 2020-04-16 03:45:04.141685867 +0300
+@@ -575,11 +575,13 @@ namespace gbe
+ has_errors(false),
+ legacyMode(true)
+ {
++#if LLVM_VERSION_MAJOR < 10
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 37
+ initializeLoopInfoWrapperPassPass(*PassRegistry::getPassRegistry());
+ #else
+ initializeLoopInfoPass(*PassRegistry::getPassRegistry());
+ #endif
++#endif
+ pass = PASS_EMIT_REGISTERS;
+ }
+
+diff -upr beignet.orig/backend/src/llvm/llvm_gen_backend.hpp beignet/backend/src/llvm/llvm_gen_backend.hpp
+--- beignet.orig/backend/src/llvm/llvm_gen_backend.hpp 2020-04-16 03:44:21.177289008 +0300
++++ beignet/backend/src/llvm/llvm_gen_backend.hpp 2020-04-16 03:45:04.135019035 +0300
+@@ -130,10 +130,10 @@ namespace gbe
+ llvm::FunctionPass *createGenPass(ir::Unit &unit);
+
+ /*! Remove the GEP instructions */
+- llvm::BasicBlockPass *createRemoveGEPPass(const ir::Unit &unit);
++ llvm::FunctionPass *createRemoveGEPPass(const ir::Unit &unit);
+
+ /*! Merge load/store if possible */
+- llvm::BasicBlockPass *createLoadStoreOptimizationPass();
++ llvm::FunctionPass *createLoadStoreOptimizationPass();
+
+ /*! Scalarize all vector op instructions */
+ llvm::FunctionPass* createScalarizePass();
+@@ -141,7 +141,7 @@ namespace gbe
+ llvm::ModulePass* createBarrierNodupPass(bool);
+
+ /*! Convert the Intrinsic call to gen function */
+- llvm::BasicBlockPass *createIntrinsicLoweringPass();
++ llvm::FunctionPass *createIntrinsicLoweringPass();
+
+ /*! Passer the printf function call. */
+ llvm::FunctionPass* createPrintfParserPass(ir::Unit &unit);
+diff -upr beignet.orig/backend/src/llvm/llvm_intrinsic_lowering.cpp beignet/backend/src/llvm/llvm_intrinsic_lowering.cpp
+--- beignet.orig/backend/src/llvm/llvm_intrinsic_lowering.cpp 2020-04-16 03:44:21.783970632 +0300
++++ beignet/backend/src/llvm/llvm_intrinsic_lowering.cpp 2020-04-16 03:45:04.135019035 +0300
+@@ -29,12 +29,12 @@
+ using namespace llvm;
+
+ namespace gbe {
+- class InstrinsicLowering : public BasicBlockPass
++ class InstrinsicLowering : public FunctionPass
+ {
+ public:
+ static char ID;
+ InstrinsicLowering() :
+- BasicBlockPass(ID) {}
++ FunctionPass(ID) {}
+
+ void getAnalysisUsage(AnalysisUsage &AU) const {
+
+@@ -93,9 +93,9 @@ namespace gbe {
+ CI->eraseFromParent();
+ return NewCI;
+ }
+- virtual bool runOnBasicBlock(BasicBlock &BB)
++ virtual bool runOnFunction(Function &F)
+ {
+- bool changedBlock = false;
++ for (BasicBlock &BB : F) {
+ Module *M = BB.getParent()->getParent();
+
+ DataLayout TD(M);
+@@ -159,13 +159,14 @@ namespace gbe {
+ }
+ }
+ }
+- return changedBlock;
++ }
++ return true;
+ }
+ };
+
+ char InstrinsicLowering::ID = 0;
+
+- BasicBlockPass *createIntrinsicLoweringPass() {
++ FunctionPass *createIntrinsicLoweringPass() {
+ return new InstrinsicLowering();
+ }
+ } // end namespace
+diff -upr beignet.orig/backend/src/llvm/llvm_loadstore_optimization.cpp beignet/backend/src/llvm/llvm_loadstore_optimization.cpp
+--- beignet.orig/backend/src/llvm/llvm_loadstore_optimization.cpp 2020-04-16 03:44:21.177289008 +0300
++++ beignet/backend/src/llvm/llvm_loadstore_optimization.cpp 2020-04-16 03:45:38.645879307 +0300
+@@ -26,13 +26,13 @@
+
+ using namespace llvm;
+ namespace gbe {
+- class GenLoadStoreOptimization : public BasicBlockPass {
++ class GenLoadStoreOptimization : public FunctionPass {
+
+ public:
+ static char ID;
+ ScalarEvolution *SE;
+ const DataLayout *TD;
+- GenLoadStoreOptimization() : BasicBlockPass(ID) {}
++ GenLoadStoreOptimization() : FunctionPass(ID) {}
+
+ void getAnalysisUsage(AnalysisUsage &AU) const {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
+@@ -45,7 +45,9 @@ namespace gbe {
+ AU.setPreservesCFG();
+ }
+
+- virtual bool runOnBasicBlock(BasicBlock &BB) {
++ virtual bool runOnFunction(Function &F) {
++ bool changedAnyBlock = false;
++ for (BasicBlock &BB : F) {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 38
+ SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
+ #else
+@@ -59,7 +61,9 @@ namespace gbe {
+ #else
+ TD = getAnalysisIfAvailable<DataLayout>();
+ #endif
+- return optimizeLoadStore(BB);
++ changedAnyBlock = optimizeLoadStore(BB) | changedAnyBlock;
++ }
++ return changedAnyBlock;
+ }
+ Type *getValueType(Value *insn);
+ Value *getPointerOperand(Value *I);
+@@ -159,7 +163,11 @@ namespace gbe {
+ values.push_back(merged[i]);
+ }
+ LoadInst *ld = cast<LoadInst>(first);
++#if LLVM_VERSION_MAJOR < 10
+ unsigned align = ld->getAlignment();
++#else
++ MaybeAlign align = ld->getAlign();
++#endif
+ unsigned addrSpace = ld->getPointerAddressSpace();
+ // insert before first load
+ Builder.SetInsertPoint(ld);
+@@ -352,7 +360,11 @@ namespace gbe {
+
+ unsigned addrSpace = st->getPointerAddressSpace();
+
++#if LLVM_VERSION_MAJOR < 10
+ unsigned align = st->getAlignment();
++#else
++ MaybeAlign align = st->getAlign();
++#endif
+ // insert before the last store
+ Builder.SetInsertPoint(last);
+
+@@ -466,7 +478,7 @@ namespace gbe {
+ return changed;
+ }
+
+- BasicBlockPass *createLoadStoreOptimizationPass() {
++ FunctionPass *createLoadStoreOptimizationPass() {
+ return new GenLoadStoreOptimization();
+ }
+ };
+Only in beignet/backend/src/llvm: llvm_loadstore_optimization.cpp.orig
+Only in beignet/backend/src/llvm: llvm_loadstore_optimization.cpp.rej
+diff -upr beignet.orig/backend/src/llvm/llvm_passes.cpp beignet/backend/src/llvm/llvm_passes.cpp
+--- beignet.orig/backend/src/llvm/llvm_passes.cpp 2020-04-16 03:44:21.177289008 +0300
++++ beignet/backend/src/llvm/llvm_passes.cpp 2020-04-16 03:45:04.135019035 +0300
+@@ -37,7 +37,7 @@
+ #include "sys/map.hpp"
+
+ using namespace llvm;
+-
++template class cfg::Update<BasicBlock *>;
+ namespace gbe
+ {
+ bool isKernelFunction(const llvm::Function &F) {
+@@ -219,13 +219,13 @@ namespace gbe
+ return offset;
+ }
+
+- class GenRemoveGEPPasss : public BasicBlockPass
++ class GenRemoveGEPPasss : public FunctionPass
+ {
+
+ public:
+ static char ID;
+ GenRemoveGEPPasss(const ir::Unit &unit) :
+- BasicBlockPass(ID),
++ FunctionPass(ID),
+ unit(unit) {}
+ const ir::Unit &unit;
+ void getAnalysisUsage(AnalysisUsage &AU) const {
+@@ -242,16 +242,18 @@ namespace gbe
+
+ bool simplifyGEPInstructions(GetElementPtrInst* GEPInst);
+
+- virtual bool runOnBasicBlock(BasicBlock &BB)
++ virtual bool runOnFunction(Function &F)
+ {
+- bool changedBlock = false;
++ bool changedAnyBlock = false;
++ for (BasicBlock &BB : F) {
+ iplist<Instruction>::iterator I = BB.getInstList().begin();
+ for (auto nextI = I, E = --BB.getInstList().end(); I != E; I = nextI) {
+ iplist<Instruction>::iterator I = nextI++;
+ if(GetElementPtrInst* gep = dyn_cast<GetElementPtrInst>(&*I))
+- changedBlock = (simplifyGEPInstructions(gep) || changedBlock);
++ changedAnyBlock = (simplifyGEPInstructions(gep) | changedAnyBlock);
+ }
+- return changedBlock;
++ }
++ return changedAnyBlock;
+ }
+ };
+
+@@ -367,7 +369,7 @@ namespace gbe
+ return true;
+ }
+
+- BasicBlockPass *createRemoveGEPPass(const ir::Unit &unit) {
++ FunctionPass *createRemoveGEPPass(const ir::Unit &unit) {
+ return new GenRemoveGEPPasss(unit);
+ }
+ } /* namespace gbe */
+diff -upr beignet.orig/backend/src/llvm/llvm_sampler_fix.cpp beignet/backend/src/llvm/llvm_sampler_fix.cpp
+--- beignet.orig/backend/src/llvm/llvm_sampler_fix.cpp 2020-04-16 03:44:21.783970632 +0300
++++ beignet/backend/src/llvm/llvm_sampler_fix.cpp 2020-04-16 03:45:04.138352451 +0300
+@@ -33,11 +33,13 @@ namespace gbe {
+ class SamplerFix : public FunctionPass {
+ public:
+ SamplerFix() : FunctionPass(ID) {
++#if LLVM_VERSION_MAJOR < 10
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+ initializeDominatorTreeWrapperPassPass(*PassRegistry::getPassRegistry());
+ #else
+ initializeDominatorTreePass(*PassRegistry::getPassRegistry());
+ #endif
++#endif
+ }
+
+ bool visitCallInst(CallInst *I) {
+diff -upr beignet.orig/backend/src/llvm/llvm_scalarize.cpp beignet/backend/src/llvm/llvm_scalarize.cpp
+--- beignet.orig/backend/src/llvm/llvm_scalarize.cpp 2020-04-16 03:44:21.670634504 +0300
++++ beignet/backend/src/llvm/llvm_scalarize.cpp 2020-04-16 03:45:04.141685867 +0300
+@@ -96,11 +96,13 @@ namespace gbe {
+
+ Scalarize() : FunctionPass(ID)
+ {
++#if LLVM_VERSION_MAJOR < 10
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 35
+ initializeDominatorTreeWrapperPassPass(*PassRegistry::getPassRegistry());
+ #else
+ initializeDominatorTreePass(*PassRegistry::getPassRegistry());
+ #endif
++#endif
+ }
+
+ virtual bool runOnFunction(Function&);
+diff -upr beignet.orig/CMake/FindLLVM.cmake beignet/CMake/FindLLVM.cmake
+--- beignet.orig/CMake/FindLLVM.cmake 2020-04-16 03:44:21.137288022 +0300
++++ beignet/CMake/FindLLVM.cmake 2020-04-16 03:46:38.104039602 +0300
+@@ -104,30 +104,16 @@ string(REGEX REPLACE " *\n" "" LLVM_SYST
+ endif (LLVM_SYSTEM_LIBS_ORIG)
+ endif (LLVM_VERSION_NODOT VERSION_GREATER 34)
+
++#something harmless because whitespace at start is an error
++set(CLANG_LIBRARIES "-ldl")
+ macro(add_one_lib name)
+ FIND_LIBRARY(CLANG_LIB
+ NAMES ${name}
+ PATHS ${LLVM_LIBRARY_DIR} NO_DEFAULT_PATH)
+- set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_LIB})
++ set(CLANG_LIBRARIES "${CLANG_LIBRARIES} ${CLANG_LIB}")
++ message(STATUS "clanglibs name ${name} this ${CLANG_LIB} all ${CLANG_LIBRARIES} ")
+ unset(CLANG_LIB CACHE)
+ endmacro()
+
+ #Assume clang lib path same as llvm lib path
+-add_one_lib("clangCodeGen")
+-add_one_lib("clangFrontend")
+-add_one_lib("clangSerialization")
+-add_one_lib("clangDriver")
+-add_one_lib("clangSema")
+-add_one_lib("clangStaticAnalyzerFrontend")
+-add_one_lib("clangStaticAnalyzerCheckers")
+-add_one_lib("clangStaticAnalyzerCore")
+-add_one_lib("clangAnalysis")
+-add_one_lib("clangEdit")
+-if (LLVM_VERSION_NODOT VERSION_GREATER 80)
+-add_one_lib("clangASTMatchers")
+-endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
+-add_one_lib("clangAST")
+-add_one_lib("clangParse")
+-add_one_lib("clangSema")
+-add_one_lib("clangLex")
+-add_one_lib("clangBasic")
++add_one_lib("clang-cpp")
+Only in beignet/CMake: FindLLVM.cmake.orig
+diff -upr beignet.orig/CMakeLists.txt beignet/CMakeLists.txt
+--- beignet.orig/CMakeLists.txt 2020-04-16 03:44:21.137288022 +0300
++++ beignet/CMakeLists.txt 2020-04-16 03:45:04.131685618 +0300
+@@ -80,7 +80,7 @@ elseif (COMPILER STREQUAL "CLANG")
+ elseif (COMPILER STREQUAL "ICC")
+ set (CMAKE_C_CXX_FLAGS "${CMAKE_C_CXX_FLAGS} -wd2928 -Wall -fPIC -fstrict-aliasing -fp-model fast -msse4.1 -Wl,-E")
+ endif ()
+-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -std=c++0x -Wno-invalid-offsetof")
++set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -Wno-invalid-offsetof")
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS}")
+ set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DGBE_DEBUG=1")
+ set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
+diff -upr beignet.orig/utests/CMakeLists.txt beignet/utests/CMakeLists.txt
+--- beignet.orig/utests/CMakeLists.txt 2020-04-16 03:44:21.220623410 +0300
++++ beignet/utests/CMakeLists.txt 2020-04-16 03:45:04.131685618 +0300
+@@ -26,8 +26,8 @@ if (NOT NOT_BUILD_STAND_ALONE_UTEST)
+ # Threads
+ Find_Package(Threads)
+
+- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -std=c++0x -Wno-invalid-offsetof")
+- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS}")
++ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_CXX_FLAGS} -Wno-invalid-offsetof -ffloat-store -fno-strict-aliasing")
++ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_CXX_FLAGS} -ffloat-store -fno-strict-aliasing") #compiler_{degrees,radians,function_argument2} use equality comparison of floats, compiler_long_bitcast uses aliasing
+ set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DGBE_DEBUG=1")
+ set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DGBE_DEBUG=1")
+ set (CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DGBE_DEBUG=0")
Modified: llvm8.patch
===================================================================
--- llvm8.patch 2020-04-16 00:54:41 UTC (rev 615084)
+++ llvm8.patch 2020-04-16 01:02:53 UTC (rev 615085)
@@ -1,36 +1,20 @@
-From 75c152599a7c1739e6dadcdb9b377acf7e44d9cf Mon Sep 17 00:00:00 2001
-From: Jan Beich <jbeich at FreeBSD.org>
-Date: Wed, 30 Jan 2019 12:42:34 +0000
-Subject: [PATCH] lang/beignet: unbreak with llvm80
+Description: Fix build with LLVM/Clang 8
-Regressed by https://github.com/llvm/llvm-project/commit/721d95713a9e
+Origin: (partly) FreeBSD https://svnweb.freebsd.org/ports/head/lang/beignet/files/patch-llvm8?view=markup
+Author: Jan Beich, Rebecca N. Palmer
-unable to load /usr/local/lib/beignet//libgbeinterp.so which is part of the driver, please check!
-ld-elf.so.1: /usr/local/lib/beignet//libgbeinterp.so: Undefined symbol "_ZN4llvm24DisableABIBreakingChecksE"
-
-Regressed by https://github.com/llvm/llvm-project/commit/4a2d58e16acc
-
-backend/src/llvm/llvm_gen_backend.cpp:3076:5: error:
- unknown type name 'TerminatorInst'
- TerminatorInst *term = bb->getTerminator();
- ^
-backend/src/llvm/llvm_gen_backend.cpp:3083:5: error:
- unknown type name 'TerminatorInst'
- TerminatorInst *term = bb->getTerminator();
- ^
-
---- backend/src/CMakeLists.txt.orig 2017-09-22 08:05:22 UTC
-+++ backend/src/CMakeLists.txt
+--- a/backend/src/CMakeLists.txt
++++ b/backend/src/CMakeLists.txt
@@ -168,6 +168,7 @@ add_dependencies(gbe beignet_bitcode)
endif (NOT (USE_STANDALONE_GBE_COMPILER STREQUAL "true"))
add_library(gbeinterp SHARED gbe_bin_interpreter.cpp)
-+target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS})
++target_link_libraries(gbeinterp ${LLVM_MODULE_LIBS} ${LLVM_SYSTEM_LIBS})
if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
find_library(TERMINFO NAMES tinfo ncurses)
---- backend/src/llvm/llvm_gen_backend.cpp.orig 2017-10-24 06:04:48 UTC
-+++ backend/src/llvm/llvm_gen_backend.cpp
+--- a/backend/src/llvm/llvm_gen_backend.cpp
++++ b/backend/src/llvm/llvm_gen_backend.cpp
@@ -3073,14 +3073,22 @@ namespace gbe
@@ -54,3 +38,34 @@
unsigned childNo = term->getNumSuccessors();
BasicBlock *child = NULL;
if(index < childNo) {
+--- a/backend/src/backend/gen_register.hpp
++++ b/backend/src/backend/gen_register.hpp
+@@ -225,6 +225,7 @@ namespace gbe
+ uint32_t width,
+ uint32_t hstride)
+ {
++ this->value.reg = 0;//avoid subgroup crash
+ this->type = type;
+ this->file = file;
+ this->nr = nr;
+--- a/backend/src/libocl/tmpl/ocl_integer.tmpl.cl
++++ b/backend/src/libocl/tmpl/ocl_integer.tmpl.cl
+@@ -216,13 +216,14 @@ OVERLOADABLE ulong mad_sat(ulong a, ulon
+ return __gen_ocl_mad_sat(a, b, c);
+ }
+
+-OVERLOADABLE uchar __rotate_left(uchar x, uchar y) { return (x << y) | (x >> (8 - y)); }
++// the 'volatile' is to make the LLVM optimizer leave these alone, as it would convert them to intrinsics (fshl/fshr) that we don't implement
++OVERLOADABLE uchar __rotate_left(uchar x, uchar y) { volatile uchar z; z = (x << y); return z | (x >> (8 - y)); }
+ OVERLOADABLE char __rotate_left(char x, char y) { return __rotate_left((uchar)x, (uchar)y); }
+-OVERLOADABLE ushort __rotate_left(ushort x, ushort y) { return (x << y) | (x >> (16 - y)); }
++OVERLOADABLE ushort __rotate_left(ushort x, ushort y) { volatile ushort z; z = (x << y); return z | (x >> (16 - y)); }
+ OVERLOADABLE short __rotate_left(short x, short y) { return __rotate_left((ushort)x, (ushort)y); }
+-OVERLOADABLE uint __rotate_left(uint x, uint y) { return (x << y) | (x >> (32 - y)); }
++OVERLOADABLE uint __rotate_left(uint x, uint y) { volatile uint z; z = (x << y); return z | (x >> (32 - y)); }
+ OVERLOADABLE int __rotate_left(int x, int y) { return __rotate_left((uint)x, (uint)y); }
+-OVERLOADABLE ulong __rotate_left(ulong x, ulong y) { return (x << y) | (x >> (64 - y)); }
++OVERLOADABLE ulong __rotate_left(ulong x, ulong y) { volatile ulong z; z = (x << y); return z | (x >> (64 - y)); }
+ OVERLOADABLE long __rotate_left(long x, long y) { return __rotate_left((ulong)x, (ulong)y); }
+ #define DEF(type, m) OVERLOADABLE type rotate(type x, type y) { return __rotate_left(x, (type)(y & m)); }
+ DEF(char, 7)
Modified: llvm9.patch
===================================================================
--- llvm9.patch 2020-04-16 00:54:41 UTC (rev 615084)
+++ llvm9.patch 2020-04-16 01:02:53 UTC (rev 615085)
@@ -1,91 +1,22 @@
-Regressed by https://github.com/llvm/llvm-project/commit/2e97d2aa1bd3
+Description: Fix build with LLVM/Clang 9
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::addMatcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&, clang::ast_matchers::MatchFinder::MatchCallback*)
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchCallback::~MatchCallback()
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::match(clang::ast_type_traits::DynTypedNode const&, clang::ASTContext&)
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::MatchFinder(clang::ast_matchers::MatchFinder::MatchFinderOptions)
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::MatchFinder::~MatchFinder()
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxMethodDecl
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxRecordDecl
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unaryOperator
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructExpr
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxConstructorDecl
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::cxxOperatorCallExpr
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::expr
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::allOf
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::anyOf
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::eachOf
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::unless
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::varDecl
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::callExpr
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::castExpr
-ld: error: backend/src/libgbe.so: undefined reference to clang::ast_matchers::internal::hasAnyNameFunc(llvm::ArrayRef<llvm::StringRef const*>)
-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
-c++: error: linker command failed with exit code 1 (use -v to see invocation)
+Origin: (mostly) FreeBSD https://svnweb.freebsd.org/ports/head/lang/beignet/files/patch-llvm9?view=markup
+Author: Jan Beich, Rebecca N. Palmer
-Regressed by https://github.com/llvm/llvm-project/commit/13680223b9d8
-
-backend/src/llvm/llvm_intrinsic_lowering.cpp:80:19: error:
- no viable conversion from 'llvm::FunctionCallee' to 'llvm::Constant *'
- Constant* FCache = M->getOrInsertFunction(NewFn,
- ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-backend/src/llvm/llvm_sampler_fix.cpp:85:18: error:
- no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
- ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
- ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-backend/src/llvm/llvm_sampler_fix.cpp:127:18: error:
- no viable conversion from 'llvm::FunctionCallee' to 'llvm::Value *'
- ...Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
- ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-backend/src/llvm/llvm_profiling.cpp:166:27: error: no
- matching function for call to 'cast'
- builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
- ^~~~~~~~~~~~~~~~~~~~
-backend/src/llvm/llvm_device_enqueue.cpp:401:52: error:
- no matching function for call to 'cast'
- CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
- ^~~~~~~~~~~~~~~~~~~~
-/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
- = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
-inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
- ^
-/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
- '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
- llvm::FunctionCallee]
-cast(const Y &Val) {
-^
-/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
- 'Y *' against 'llvm::FunctionCallee'
-inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
- ^
-/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
- 'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
-cast(std::unique_ptr<Y> &&Val) {
-^
-backend/src/llvm/llvm_profiling.cpp:188:25: error: no
- matching function for call to 'cast'
- builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
- ^~~~~~~~~~~~~~~~~~~~
-/usr/local/llvm90/include/llvm/Support/Casting.h:256:44: note: candidate function [with X = llvm::Function, Y
- = llvm::FunctionCallee] not viable: expects an l-value for 1st argument
-inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
- ^
-/usr/local/llvm90/include/llvm/Support/Casting.h:249:1: note: candidate template ignored: requirement
- '!is_simple_type<llvm::FunctionCallee>::value' was not satisfied [with X = llvm::Function, Y =
- llvm::FunctionCallee]
-cast(const Y &Val) {
-^
-/usr/local/llvm90/include/llvm/Support/Casting.h:263:46: note: candidate template ignored: could not match
- 'Y *' against 'llvm::FunctionCallee'
-inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
- ^
-/usr/local/llvm90/include/llvm/Support/Casting.h:271:1: note: candidate template ignored: could not match
- 'unique_ptr<type-parameter-0-1, default_delete<type-parameter-0-1> >' against 'llvm::FunctionCallee'
-cast(std::unique_ptr<Y> &&Val) {
-^
-
---- backend/src/llvm/llvm_intrinsic_lowering.cpp.orig 2017-10-24 06:04:48 UTC
-+++ backend/src/llvm/llvm_intrinsic_lowering.cpp
+--- a/CMake/FindLLVM.cmake
++++ b/CMake/FindLLVM.cmake
+@@ -126,6 +126,9 @@ macro(add_one_lib name)
+ add_one_lib("clangStaticAnalyzerCore")
+ add_one_lib("clangAnalysis")
+ add_one_lib("clangEdit")
++if (LLVM_VERSION_NODOT VERSION_GREATER 80)
++add_one_lib("clangASTMatchers")
++endif (LLVM_VERSION_NODOT VERSION_GREATER 80)
+ add_one_lib("clangAST")
+ add_one_lib("clangParse")
+ add_one_lib("clangSema")
+--- a/backend/src/llvm/llvm_intrinsic_lowering.cpp
++++ b/backend/src/llvm/llvm_intrinsic_lowering.cpp
@@ -77,7 +77,11 @@ namespace gbe {
std::vector<Type *> ParamTys;
for (Value** I = ArgBegin; I != ArgEnd; ++I)
@@ -98,8 +29,8 @@
FunctionType::get(RetTy, ParamTys, false));
IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
---- backend/src/llvm/llvm_sampler_fix.cpp.orig 2017-10-24 06:04:48 UTC
-+++ backend/src/llvm/llvm_sampler_fix.cpp
+--- a/backend/src/llvm/llvm_sampler_fix.cpp
++++ b/backend/src/llvm/llvm_sampler_fix.cpp
@@ -82,7 +82,11 @@ namespace gbe {
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
Module *M = I->getParent()->getParent()->getParent();
@@ -124,8 +55,8 @@
#else
Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
#endif
---- backend/src/llvm/llvm_profiling.cpp.orig 2017-10-24 06:04:48 UTC
-+++ backend/src/llvm/llvm_profiling.cpp
+--- a/backend/src/llvm/llvm_profiling.cpp
++++ b/backend/src/llvm/llvm_profiling.cpp
@@ -163,10 +163,18 @@ namespace gbe
// __gen_ocl_store_timestamp(int nth, int type);
Value *Args[2] = {ConstantInt::get(intTy, pointNum++), ConstantInt::get(intTy, profilingType)};
@@ -164,8 +95,8 @@
ArrayRef<Value*>(Args2));
#else
builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
---- backend/src/llvm/llvm_device_enqueue.cpp.orig 2017-10-24 06:04:48 UTC
-+++ backend/src/llvm/llvm_device_enqueue.cpp
+--- a/backend/src/llvm/llvm_device_enqueue.cpp
++++ b/backend/src/llvm/llvm_device_enqueue.cpp
@@ -398,8 +398,13 @@ namespace gbe {
std::vector<Type *> ParamTys;
for (Value** iter = args.begin(); iter != args.end(); ++iter)
More information about the arch-commits
mailing list