Accepting request 719902 from home:StefanBruens:branches:science
- Fix build with LTO enabled - Fixup build/runtime dependencies - Correct opencl header lookup OBS-URL: https://build.opensuse.org/request/show/719902 OBS-URL: https://build.opensuse.org/package/show/science/pocl?expand=0&rev=49
This commit is contained in:
parent
e75b135db6
commit
829fed3675
44
fix_resources_path_version_dependency.patch
Normal file
44
fix_resources_path_version_dependency.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
From dd408ae373b06ee46e178401ab28ecb62b9d2f06 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
||||||
|
Date: Mon, 29 Jul 2019 17:01:50 +0200
|
||||||
|
Subject: [PATCH] Determine CLANG resources dir at runtime
|
||||||
|
|
||||||
|
When the resources dir is determined at compile time, it also includes
|
||||||
|
the full version (e.g. /usr/lib64/clang/8.0.0/include/opencl-c.h). If
|
||||||
|
clang gets a minor version update later (e.g. from 8.0.0 to 8.0.1), pocl
|
||||||
|
will still add the obsolete path for the header lookup.
|
||||||
|
|
||||||
|
Determine the path at runtime instead. LLVM 9.0 adds a static method
|
||||||
|
llvm::driver::Driver::GetResourcesPath(...) which can be used, LLVM 8.0
|
||||||
|
and older have to use a dummy Driver instance.
|
||||||
|
|
||||||
|
Fixes #747.
|
||||||
|
---
|
||||||
|
lib/CL/pocl_llvm_build.cc | 11 ++++++++++-
|
||||||
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/CL/pocl_llvm_build.cc b/lib/CL/pocl_llvm_build.cc
|
||||||
|
index f0b897f4..00a6fb26 100644
|
||||||
|
--- a/lib/CL/pocl_llvm_build.cc
|
||||||
|
+++ b/lib/CL/pocl_llvm_build.cc
|
||||||
|
@@ -438,7 +438,16 @@ int pocl_llvm_build_program(cl_program program,
|
||||||
|
po.Includes.push_back(BuiltinRenamesH);
|
||||||
|
#ifndef LLVM_OLDER_THAN_4_0
|
||||||
|
// Use Clang's opencl-c.h header.
|
||||||
|
- po.Includes.push_back(CLANG_RESOURCE_DIR "/include/opencl-c.h");
|
||||||
|
+ {
|
||||||
|
+#if (!defined(LLVM_OLDER_THAN_8_0)) && (!defined(LLVM_8_0))
|
||||||
|
+ std::string ClangResourcesDir = driver::Driver::GetResourcesPath(CLANG);
|
||||||
|
+#else
|
||||||
|
+ DiagnosticsEngine Diags{new DiagnosticIDs, new DiagnosticOptions};
|
||||||
|
+ driver::Driver TheDriver(CLANG, "", Diags);
|
||||||
|
+ std::string ClangResourcesDir = TheDriver.ResourceDir;
|
||||||
|
+#endif
|
||||||
|
+ po.Includes.push_back(ClangResourcesDir + "/include/opencl-c.h");
|
||||||
|
+ }
|
||||||
|
#endif
|
||||||
|
po.Includes.push_back(KernelH);
|
||||||
|
clang::TargetOptions &ta = pocl_build.getTargetOpts();
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
17
pocl.changes
17
pocl.changes
@ -1,3 +1,20 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Jul 28 19:15:03 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
|
||||||
|
|
||||||
|
- Use GCC (default host compiler) for compiling the library itself,
|
||||||
|
and only compile the openCL kernel bytecode with clang, which is the
|
||||||
|
upstream default setup. This also fixes problems where clang chokes
|
||||||
|
on the GCC LTO options.
|
||||||
|
- Drop unused boost_headers, glew, ncurses and uthash devel BuildRequires.
|
||||||
|
- Remove unneeded extra linker flags.
|
||||||
|
- Fix build on ARM, and enable Arch64 (needs explicit CPU specification),
|
||||||
|
supported since pocl 1.1.
|
||||||
|
- Fix failing header lookup when minor libclang version changes
|
||||||
|
(https://github.com/pocl/pocl/issues/747), add
|
||||||
|
fix_resources_path_version_dependency.patch
|
||||||
|
- Require implementation (libpocl2) from the main package which
|
||||||
|
contains the ICD referencing it.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Apr 5 19:56:21 UTC 2019 - Martin Hauke <mardnh@gmx.de>
|
Fri Apr 5 19:56:21 UTC 2019 - Martin Hauke <mardnh@gmx.de>
|
||||||
|
|
||||||
|
46
pocl.spec
46
pocl.spec
@ -30,28 +30,28 @@ Group: Development/Tools/Other
|
|||||||
URL: http://portablecl.org/
|
URL: http://portablecl.org/
|
||||||
Source0: https://github.com/pocl/pocl/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
Source0: https://github.com/pocl/pocl/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||||
Source99: pocl-rpmlintrc
|
Source99: pocl-rpmlintrc
|
||||||
BuildRequires: clang < 9
|
# PATCH-FIX-UPSTREAM - The clang resources path at compile time includes the full version, determine at runtime
|
||||||
BuildRequires: clang-devel < 9
|
Patch0: fix_resources_path_version_dependency.patch
|
||||||
|
BuildRequires: clang
|
||||||
|
BuildConflicts: clang >= 9
|
||||||
|
BuildRequires: clang-devel >= 4
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: libboost_headers-devel
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: libtool
|
|
||||||
BuildRequires: libtool-ltdl-devel
|
BuildRequires: libtool-ltdl-devel
|
||||||
BuildRequires: ncurses-devel
|
|
||||||
BuildRequires: ninja
|
BuildRequires: ninja
|
||||||
BuildRequires: opencl-headers
|
BuildRequires: opencl-headers
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: uthash-devel
|
|
||||||
BuildRequires: pkgconfig(OpenCL)
|
BuildRequires: pkgconfig(OpenCL)
|
||||||
BuildRequires: pkgconfig(glew)
|
|
||||||
BuildRequires: pkgconfig(hwloc)
|
BuildRequires: pkgconfig(hwloc)
|
||||||
Requires: clang < 9
|
# Autoreq does not look into the ICD file
|
||||||
Requires: gcc
|
Requires: libpocl2
|
||||||
Requires: libstdc++-devel
|
%if 0%{?sle_version} == 150000 && 0%{?is_opensuse}
|
||||||
Requires: libut2
|
# Old versions have opencl-c.h in the clang package, not libclang
|
||||||
# Only armv7l is supported
|
Requires: clang5
|
||||||
# PPC support is currently broken, due to path problems
|
%endif
|
||||||
# s390(x) and aarch64 also not supported, so use ExclusiveArch
|
# PPC has limited support/testing from upstream
|
||||||
ExclusiveArch: %{ix86} x86_64 armv7l armv7hl
|
# s390(x) is also not supported, so use ExclusiveArch
|
||||||
|
ExclusiveArch: %{ix86} x86_64 %arm aarch64
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Portable Computing Language (pocl) is an implementation of the OpenCL standard
|
Portable Computing Language (pocl) is an implementation of the OpenCL standard
|
||||||
@ -76,7 +76,7 @@ Portable Computing Language (pocl) is an implementation of the OpenCL standard
|
|||||||
which can be adapted for new targets and devices, both for homogeneous CPU and
|
which can be adapted for new targets and devices, both for homogeneous CPU and
|
||||||
heterogenous GPUs/accelerators.
|
heterogenous GPUs/accelerators.
|
||||||
|
|
||||||
This subpackage contains the share library part of pocl.
|
This subpackage contains the shared library part of pocl.
|
||||||
|
|
||||||
%package devel
|
%package devel
|
||||||
Summary: Development files for the Portable Computing Language
|
Summary: Development files for the Portable Computing Language
|
||||||
@ -94,6 +94,7 @@ This subpackage provides the development files needed for pocl.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%define __builder ninja
|
%define __builder ninja
|
||||||
@ -101,16 +102,17 @@ This subpackage provides the development files needed for pocl.
|
|||||||
-DENABLE_CUDA=0 \
|
-DENABLE_CUDA=0 \
|
||||||
-DENABLE_ICD=ON \
|
-DENABLE_ICD=ON \
|
||||||
-DPOCL_INSTALL_ICD_VENDORDIR=%{_sysconfdir}/OpenCL/vendors \
|
-DPOCL_INSTALL_ICD_VENDORDIR=%{_sysconfdir}/OpenCL/vendors \
|
||||||
-DCMAKE_C_COMPILER=clang \
|
|
||||||
-DCMAKE_CXX_COMPILER=clang++ \
|
|
||||||
%ifarch %{ix86} x86_64
|
%ifarch %{ix86} x86_64
|
||||||
-DKERNELLIB_HOST_CPU_VARIANTS=distro \
|
-DKERNELLIB_HOST_CPU_VARIANTS=distro \
|
||||||
%endif
|
%endif
|
||||||
-DEXTRA_KERNEL_CXX_FLAGS="%{optflags} -std=c++11" \
|
%ifarch %{arm}
|
||||||
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -Wl,-z,now" \
|
-DLLC_HOST_CPU=cortex-a9 \
|
||||||
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,-z,now" \
|
%endif
|
||||||
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,-z,now" \
|
%ifarch aarch64
|
||||||
|
-DLLC_HOST_CPU=cortex-a53 \
|
||||||
|
%endif
|
||||||
-DWITH_LLVM_CONFIG=%{_bindir}/llvm-config
|
-DWITH_LLVM_CONFIG=%{_bindir}/llvm-config
|
||||||
|
|
||||||
%make_jobs
|
%make_jobs
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
Loading…
Reference in New Issue
Block a user