[arch-commits] Commit in beignet/repos (5 files)

Evangelos Foutras foutrelis at archlinux.org
Thu Apr 16 01:03:07 UTC 2020


    Date: Thursday, April 16, 2020 @ 01:03:06
  Author: foutrelis
Revision: 615086

archrelease: copy trunk to community-staging-x86_64

Added:
  beignet/repos/community-staging-x86_64/
  beignet/repos/community-staging-x86_64/PKGBUILD
    (from rev 615085, beignet/trunk/PKGBUILD)
  beignet/repos/community-staging-x86_64/llvm10.patch
    (from rev 615085, beignet/trunk/llvm10.patch)
  beignet/repos/community-staging-x86_64/llvm8.patch
    (from rev 615085, beignet/trunk/llvm8.patch)
  beignet/repos/community-staging-x86_64/llvm9.patch
    (from rev 615085, beignet/trunk/llvm9.patch)

--------------+
 PKGBUILD     |   59 +++++++++
 llvm10.patch |  358 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 llvm8.patch  |   71 +++++++++++
 llvm9.patch  |  113 +++++++++++++++++
 4 files changed, 601 insertions(+)

Copied: beignet/repos/community-staging-x86_64/PKGBUILD (from rev 615085, beignet/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2020-04-16 01:03:06 UTC (rev 615086)
@@ -0,0 +1,59 @@
+# Maintainer: Bruno Pagani <archange at archlinux.org>
+# Contributor: Antoine Lubineau <antoine at lubignon.info>
+# Contributor: Leopold Bloom <blinxwang at gmail.com>
+# Contributor: Michal Krenek (a.k.a. Mikos) <m.krenek at gmail.com>
+
+pkgname=beignet
+pkgver=1.3.2+12+gfc5f430c
+pkgrel=4
+pkgdesc="An open source OpenCL implementation for Intel IvyBridge & Haswell iGPUs"
+arch=(x86_64)
+url="https://01.org/${pkgname}"
+license=(LGPL)
+depends=(glu llvm-libs clang mesa opencl-headers)
+makedepends=(git llvm cmake python ocl-icd)
+provides=(opencl-intel opencl-driver)
+conflicts=(opencl-intel)
+_commit=fc5f430cb7b7a8f694d86acbb038bd5b38ec389c  # master as of 2018-08-20
+source=("git+https://anongit.freedesktop.org/git/beignet.git#commit=$_commit"
+        'llvm8.patch'
+        'llvm9.patch'
+        'llvm10.patch')
+sha256sums=('SKIP'
+            'd24e4d8a1a791dc02c91117f900143789dd6f01eaa89292ad67c4fb4eaf84328'
+            '5913a93fe6ef77b91480bb6d27c7875673294c0a8a924b2ac66756d0d3577908'
+            '2eb9b0801e24f4e537033b41a6bc462e4082f6216d62933240ca3010020ea779')
+
+prepare() {
+    mkdir -p build
+    cd ${pkgname}
+
+    # Remove implementation of cl_intel_device_side_avc_motion_estimation
+    # (conflicts with the implemention in Clang 8)
+    git revert -n 9b7ca443cf7b 9cb7ff4c285d
+
+    # 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() {
+    cd build
+    cmake ../${pkgname} \
+        -DCMAKE_INSTALL_PREFIX=/usr \
+        -DCMAKE_INSTALL_LIBDIR=/usr/lib \
+        -DCMAKE_BUILD_TYPE=RELEASE
+    make
+}
+
+package() {
+    cd build
+    make DESTDIR="${pkgdir}" install
+    # Remove headers already provided by 'opencl-headers'
+    cd "${pkgdir}/usr/include/CL"
+    rm cl.h cl_egl.h cl_ext.h cl_gl.h cl_gl_ext.h cl_platform.h opencl.h
+}

Copied: beignet/repos/community-staging-x86_64/llvm10.patch (from rev 615085, beignet/trunk/llvm10.patch)
===================================================================
--- community-staging-x86_64/llvm10.patch	                        (rev 0)
+++ community-staging-x86_64/llvm10.patch	2020-04-16 01:03:06 UTC (rev 615086)
@@ -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")

Copied: beignet/repos/community-staging-x86_64/llvm8.patch (from rev 615085, beignet/trunk/llvm8.patch)
===================================================================
--- community-staging-x86_64/llvm8.patch	                        (rev 0)
+++ community-staging-x86_64/llvm8.patch	2020-04-16 01:03:06 UTC (rev 615086)
@@ -0,0 +1,71 @@
+Description: Fix build with LLVM/Clang 8
+
+Origin: (partly) FreeBSD https://svnweb.freebsd.org/ports/head/lang/beignet/files/patch-llvm8?view=markup
+Author: Jan Beich, Rebecca N. Palmer
+
+--- 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} ${LLVM_SYSTEM_LIBS})
+ 
+ if (LLVM_VERSION_NODOT VERSION_EQUAL 34)
+   find_library(TERMINFO NAMES tinfo ncurses)
+--- a/backend/src/llvm/llvm_gen_backend.cpp
++++ b/backend/src/llvm/llvm_gen_backend.cpp
+@@ -3073,14 +3073,22 @@ namespace gbe
+ 
+ 
+   static unsigned getChildNo(BasicBlock *bb) {
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     return term->getNumSuccessors();
+   }
+ 
+   // return NULL if index out-range of children number
+   static BasicBlock *getChildPossible(BasicBlock *bb, unsigned index) {
+ 
++#if LLVM_VERSION_MAJOR < 8
+     TerminatorInst *term = bb->getTerminator();
++#else
++    Instruction *term = bb->getTerminator();
++#endif
+     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)

Copied: beignet/repos/community-staging-x86_64/llvm9.patch (from rev 615085, beignet/trunk/llvm9.patch)
===================================================================
--- community-staging-x86_64/llvm9.patch	                        (rev 0)
+++ community-staging-x86_64/llvm9.patch	2020-04-16 01:03:06 UTC (rev 615086)
@@ -0,0 +1,113 @@
+Description: Fix build with LLVM/Clang 9
+
+Origin: (mostly) FreeBSD https://svnweb.freebsd.org/ports/head/lang/beignet/files/patch-llvm9?view=markup
+Author: Jan Beich, Rebecca N. Palmer
+
+--- 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)
+           ParamTys.push_back((*I)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++        FunctionCallee FCache = M->getOrInsertFunction(NewFn,
++#else
+         Constant* FCache = M->getOrInsertFunction(NewFn,
++#endif
+                                         FunctionType::get(RetTy, ParamTys, false));
+ 
+         IRBuilder<> Builder(CI->getParent(), BasicBlock::iterator(CI));
+--- 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();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+@@ -124,7 +128,11 @@ namespace gbe {
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 40
+           Module *M = I->getParent()->getParent()->getParent();
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++          FunctionCallee samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType());
++#endif
+ #else
+           Value* samplerCvt = M->getOrInsertFunction("__gen_ocl_sampler_to_int", i32Ty, I->getOperand(0)->getType(), nullptr);
+ #endif
+--- 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)};
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++      builder->CreateCall(module->getOrInsertFunction(
++#else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+               "__gen_ocl_calc_timestamp", Type::getVoidTy(module->getContext()),
+               IntegerType::getInt32Ty(module->getContext()),
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              IntegerType::getInt32Ty(module->getContext())),
++#else
+               IntegerType::getInt32Ty(module->getContext()))),
++#endif
+               ArrayRef<Value*>(Args));
+ #else
+       builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+@@ -185,10 +193,18 @@ namespace gbe
+     Value *Args2[2] = {profilingBuf, ConstantInt::get(intTy, profilingType)};
+ 
+ #if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 50
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++    builder->CreateCall(module->getOrInsertFunction(
++#else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
++#endif
+             "__gen_ocl_store_profiling", Type::getVoidTy(module->getContext()),
+             ptrTy,
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++            IntegerType::getInt32Ty(module->getContext())),
++#else
+             IntegerType::getInt32Ty(module->getContext()))),
++#endif
+             ArrayRef<Value*>(Args2));
+ #else
+     builder->CreateCall(cast<llvm::Function>(module->getOrInsertFunction(
+--- 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)
+                 ParamTys.push_back((*iter)->getType());
++#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
++              CallInst* newCI = builder.CreateCall(mod->getOrInsertFunction(
++                              "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false)), args);
++#else
+               CallInst* newCI = builder.CreateCall(cast<llvm::Function>(mod->getOrInsertFunction(
+                               "__gen_enqueue_kernel_slm", FunctionType::get(intTy, ParamTys, false))), args);
++#endif
+               CI->replaceAllUsesWith(newCI);
+               deadInsnSet.insert(CI);
+             }



More information about the arch-commits mailing list