summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRanieri Althoff2020-01-23 05:28:29 -0300
committerRanieri Althoff2020-01-23 05:30:27 -0300
commitf65dd3f6e16f73461c4944d15a55bcb3a41dd9e9 (patch)
tree2a0c0917457706afefcc436c797fa2ed2a883bc9
parentb8a1a32f68d73efcef3f46029df4e7a1d80ca203 (diff)
downloadaur-f65dd3f6e16f73461c4944d15a55bcb3a41dd9e9.tar.gz
v3.0.0
- v3.0.0 finally! Split into rocm-opencl-runtime (OpenCL libs) and rocm-device-libs (LLVM bitcode) for smaller packages
-rw-r--r--.SRCINFO28
-rw-r--r--PKGBUILD139
-rw-r--r--change-install-location.patch137
3 files changed, 235 insertions, 69 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 5e7eaafdc1d..e02ab6c56d0 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = rocm-opencl-runtime
pkgdesc = ROCm OpenCLâ„¢ Compatible Runtime
- pkgver = 2.10.0
- pkgrel = 2
+ pkgver = 3.0.0
+ pkgrel = 1
url = https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime
arch = x86_64
license = MIT
@@ -9,27 +9,29 @@ pkgbase = rocm-opencl-runtime
makedepends = cmake
makedepends = ninja
makedepends = git
- depends = rocr-runtime>=2.10.0
+ depends = rocr-runtime>=3.0.0
depends = opencl-icd-loader
- provides = rocm-opencl-runtime
+ provides = rocm-device-libs
provides = opencl-driver
conflicts = rocm-opencl-git
- source = rocm-opencl-runtime::git+https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime#tag=roc-2.10.0
- source = rocm-opencl-driver::git+https://github.com/RadeonOpenCompute/ROCm-OpenCL-Driver#tag=roc-2.10.0
- source = llvm-ocl-2.10.0.tar.gz::https://github.com/RadeonOpenCompute/llvm/archive/roc-ocl-2.10.0.tar.gz
- source = clang-2.10.0.tar.gz::https://github.com/RadeonOpenCompute/clang/archive/roc-2.10.0.tar.gz
- source = lld-ocl-2.10.0.tar.gz::https://github.com/RadeonOpenCompute/lld/archive/roc-ocl-2.10.0.tar.gz
- source = rocm-device-libs::git+https://github.com/RadeonOpenCompute/ROCm-Device-Libs#tag=roc-ocl-2.10.0
+ source = rocm-opencl-runtime::git+https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime#tag=roc-3.0.0
+ source = llvm-roc-ocl-3.0.0.tar.gz::https://github.com/RadeonOpenCompute/llvm-project/archive/roc-ocl-3.0.0.tar.gz
+ source = rocm-device-libs::git+https://github.com/RadeonOpenCompute/ROCm-Device-Libs#tag=roc-ocl-3.0.0
+ source = rocm-comgr::git+https://github.com/RadeonOpenCompute/ROCm-CompilerSupport#tag=roc-3.0.0
+ source = rocm-cmake::git+https://github.com/RadeonOpenCompute/rocm-cmake#tag=roc-3.0.0
source = opencl-icd-loader::git+https://github.com/KhronosGroup/OpenCL-ICD-Loader#commit=978b4b3a29a3aebc86ce9315d5c5963e88722d03
+ source = change-install-location.patch
source = fix_rocm_opencl_build_order.patch
sha256sums = SKIP
+ sha256sums = 7715db8fd6322bdda4a75a9220cb6c747ca7e93e94ff158d7689d10f984efa45
sha256sums = SKIP
- sha256sums = c46ec3568b754a7aced6139bcc254d39ddb89016b282c467ae1b5536d8021540
- sha256sums = acdebf229a2120ad0ccdc48a6b0e863a6a4d89f46bb62e7296f2f16bbc4a04a7
- sha256sums = 105cedd4a31a6d6ad51043c384129a7705f9a5f65414e60a07c9193411b756f0
sha256sums = SKIP
sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = f90a725a14dd972c86a6919e776e7a3a9dc1792031a9ba89d26a4068975034e6
sha256sums = 0f735299810e9e22cd57f5b96a7628a0f399d445a1f3bacefd8b890e84ca372f
+pkgname = rocm-device-libs
+
pkgname = rocm-opencl-runtime
diff --git a/PKGBUILD b/PKGBUILD
index 11e6238e0e5..769cc651597 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,100 +1,127 @@
# Maintainer: Ranieri Althoff <ranisalt+aur at gmail dot com>
-_opencl_icd_loader_commit="978b4b3a29a3aebc86ce9315d5c5963e88722d03"
-pkgname=rocm-opencl-runtime
-pkgver=2.10.0
-pkgrel=2
+_opencl_icd_loader_commit='978b4b3a29a3aebc86ce9315d5c5963e88722d03'
+
+pkgbase=rocm-opencl-runtime
+pkgname=(rocm-device-libs rocm-opencl-runtime)
+pkgver=3.0.0
+pkgrel=1
pkgdesc='ROCm OpenCLâ„¢ Compatible Runtime'
arch=('x86_64')
url='https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime'
license=('MIT')
depends=("rocr-runtime>=${pkgver}" 'opencl-icd-loader')
makedepends=(mesa cmake ninja git)
-provides=("${pkgname}" 'opencl-driver')
+provides=("$pkgname" 'opencl-driver')
conflicts=('rocm-opencl-git')
source=(
- "rocm-opencl-runtime::git+https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime#tag=roc-${pkgver}"
- "rocm-opencl-driver::git+https://github.com/RadeonOpenCompute/ROCm-OpenCL-Driver#tag=roc-${pkgver}"
- "llvm-ocl-${pkgver}.tar.gz::https://github.com/RadeonOpenCompute/llvm/archive/roc-ocl-${pkgver}.tar.gz"
- "clang-${pkgver}.tar.gz::https://github.com/RadeonOpenCompute/clang/archive/roc-${pkgver}.tar.gz"
- "lld-ocl-${pkgver}.tar.gz::https://github.com/RadeonOpenCompute/lld/archive/roc-ocl-${pkgver}.tar.gz"
- "rocm-device-libs::git+https://github.com/RadeonOpenCompute/ROCm-Device-Libs#tag=roc-ocl-${pkgver}"
+ "rocm-opencl-runtime::git+https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime#tag=roc-$pkgver"
+ "llvm-roc-ocl-$pkgver.tar.gz::https://github.com/RadeonOpenCompute/llvm-project/archive/roc-ocl-$pkgver.tar.gz"
+ "rocm-device-libs::git+https://github.com/RadeonOpenCompute/ROCm-Device-Libs#tag=roc-ocl-$pkgver"
+ "rocm-comgr::git+https://github.com/RadeonOpenCompute/ROCm-CompilerSupport#tag=roc-$pkgver"
+ "rocm-cmake::git+https://github.com/RadeonOpenCompute/rocm-cmake#tag=roc-$pkgver"
"opencl-icd-loader::git+https://github.com/KhronosGroup/OpenCL-ICD-Loader#commit=${_opencl_icd_loader_commit}"
+ 'change-install-location.patch'
'fix_rocm_opencl_build_order.patch'
)
sha256sums=('SKIP'
+ '7715db8fd6322bdda4a75a9220cb6c747ca7e93e94ff158d7689d10f984efa45'
+ 'SKIP'
'SKIP'
- 'c46ec3568b754a7aced6139bcc254d39ddb89016b282c467ae1b5536d8021540'
- 'acdebf229a2120ad0ccdc48a6b0e863a6a4d89f46bb62e7296f2f16bbc4a04a7'
- '105cedd4a31a6d6ad51043c384129a7705f9a5f65414e60a07c9193411b756f0'
'SKIP'
'SKIP'
+ 'f90a725a14dd972c86a6919e776e7a3a9dc1792031a9ba89d26a4068975034e6'
'0f735299810e9e22cd57f5b96a7628a0f399d445a1f3bacefd8b890e84ca372f')
prepare() {
- # emulate repo opencl.xml layout
- cd "$srcdir"
-
- ln -s "$srcdir/rocm-opencl-runtime" opencl
-
- mkdir -p "$srcdir/opencl/compiler"
- ln -s "$srcdir/rocm-opencl-driver" opencl/compiler/driver
- ln -s "$srcdir/llvm-roc-ocl-$pkgver" opencl/compiler/llvm
+ cd "$srcdir/rocm-opencl-runtime"
- mkdir -p "$srcdir/opencl/compiler/llvm/tools"
- ln -s "$srcdir/clang-roc-$pkgver" opencl/compiler/llvm/tools/clang
- ln -s "$srcdir/lld-roc-ocl-$pkgver" opencl/compiler/llvm/tools/lld
-
- mkdir -p "$srcdir/opencl/library"
- ln -s "$srcdir/rocm-device-libs" opencl/library/amdgcn
-
- mkdir -p "$srcdir/opencl/api/opencl/khronos"
- ln -s "$srcdir/opencl-icd-loader" opencl/api/opencl/khronos/icd
+ mkdir -p api/opencl/khronos
+ ln -s "$srcdir/opencl-icd-loader" api/opencl/khronos/icd
+ patch -Np1 -i "$srcdir/change-install-location.patch"
# Fix build missing dependency
# https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/issues/64#issuecomment-473502685
- cd "$srcdir/opencl"
- patch -Np1 -i "${srcdir}/fix_rocm_opencl_build_order.patch"
+ patch -Np1 -i "$srcdir/fix_rocm_opencl_build_order.patch"
}
build() {
- mkdir -p "$srcdir/build"
- cd "$srcdir/build"
-
- if check_buildoption "ccache" "y"; then
- CMAKE_FLAGS="-DROCM_CCACHE_BUILD=ON"
- fi
-
- cmake $CMAKE_FLAGS \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=/opt/rocm/opencl \
- -DCLANG_ENABLE_STATIC_ANALYZER=ON \
- -G Ninja \
- "$srcdir/opencl"
+ CMAKE_FLAGS='-DCMAKE_BUILD_TYPE=Release'
# building LLVM/Clang requires ~1.5G per unit
THREADS=$(( ($(getconf _PHYS_PAGES) * $(getconf PAGESIZE)) / 1610612736 ))
if [ "$THREADS" -lt 1 ]; then
THREADS=1
fi
+ msg2 "Building LLVM on $THREADS threads..."
+ cd "$srcdir/llvm-project-roc-ocl-$pkgver"
+ mkdir -p build && cd build
+ cmake $CMAKE_FLAGS \
+ -DLLVM_ENABLE_BINDINGS=OFF \
+ -DLLVM_ENABLE_OCAMLDOC=OFF \
+ -DLLVM_ENABLE_PROJECTS='clang;lld' \
+ -DLLVM_TARGETS_TO_BUILD='AMDGPU' \
+ -DOCAMLFIND=NO \
+ -G Ninja \
+ ../llvm
ninja "-j$THREADS"
+ LLVM_DIR="$srcdir/llvm-project-roc-ocl-$pkgver/build"
+ CMAKE_FLAGS="$CMAKE_FLAGS -DLLVM_DIR='$LLVM_DIR'"
- # FIXME Check why lld has to built manually since 2.3.0
- ninja lld
+ if check_buildoption "ccache" "y"; then
+ CMAKE_FLAGS="$CMAKE_FLAGS -DROCM_CCACHE_BUILD=ON"
+ fi
+
+ msg2 'Building prepare builtins...'
+ cd "$srcdir/rocm-device-libs/utils"
+ cmake $CMAKE_FLAGS -G Ninja ..
+ ninja
+
+ msg2 'Building device libs...'
+ cd "$srcdir/rocm-device-libs"
+ mkdir -p build && cd build
+ cmake $CMAKE_FLAGS \
+ -DCMAKE_INSTALL_PREFIX=/opt/rocm \
+ -DPREPARE_BUILTINS="$srcdir/rocm-device-libs/utils/utils/prepare-builtins/prepare-builtins" \
+ -G Ninja \
+ ..
+ ninja
+
+ msg2 'Building rocm-comgr...'
+ cd "$srcdir/rocm-comgr"
+ mkdir -p build && cd build
+ cmake $CMAKE_FLAGS \
+ -DAMDDeviceLibs_DIR="$srcdir/rocm-device-libs/build" \
+ -DClang_DIR="$LLVM_DIR/lib/cmake/clang" \
+ -G Ninja \
+ ../lib/comgr
+ ninja
+
+ msg2 'Building rocm-opencl-runtime...'
+ cd "$srcdir/rocm-opencl-runtime"
+ mkdir -p build && cd build
+ cmake $CMAKE_FLAGS \
+ -DCMAKE_INSTALL_PREFIX=/opt/rocm \
+ -DCMAKE_MODULE_PATH="$srcdir/rocm-cmake/share/rocm/cmake" \
+ -DUSE_COMGR_LIBRARY=ON \
+ -Damd_comgr_DIR="$srcdir/rocm-comgr/build/lib/cmake/amd_comgr" \
+ -G Ninja \
+ ..
+ ninja
}
-package() {
- DESTDIR="$pkgdir/" ninja -C "$srcdir/build" install
+package_rocm-device-libs() {
+ DESTDIR="$pkgdir/" ninja -C "$srcdir/rocm-device-libs/build" install
+}
+
+package_rocm-opencl-runtime() {
+ DESTDIR="$pkgdir/" ninja -C "$srcdir/rocm-opencl-runtime/build" install
# OpenCL vendor file
mkdir -p "$pkgdir/etc/OpenCL/vendors"
- echo "/opt/rocm/opencl/lib/x86_64/libamdocl64.so" > "$pkgdir/etc/OpenCL/vendors/rocm-opencl64.icd"
+ echo "/opt/rocm/lib/x86_64/libamdocl64.so" > "$pkgdir/etc/OpenCL/vendors/rocm-opencl64.icd"
mkdir -p "$pkgdir/etc/ld.so.conf.d"
- echo "/opt/rocm/opencl/lib" > "$pkgdir/etc/ld.so.conf.d/rocm-opencl.conf"
-
- # Discard AMD's OpenCL ICD Loader
- # https://wiki.archlinux.org/index.php/GPGPU#OpenCL_ICD_loader_(libOpenCL.so)
- rm -f "$pkgdir"/opt/rocm/opencl/lib/x86_64/libOpenCL.so*
+ echo "/opt/rocm/lib" > "$pkgdir/etc/ld.so.conf.d/rocm-opencl.conf"
}
diff --git a/change-install-location.patch b/change-install-location.patch
new file mode 100644
index 00000000000..225004aa259
--- /dev/null
+++ b/change-install-location.patch
@@ -0,0 +1,137 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 10430f3..3656ff3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,9 +5,6 @@ if (POLICY CMP0048)
+ set(PROJ_VERSION VERSION 1.5.0)
+ endif()
+
+-# FIXME: Remove following line after enabling COMGR by default
+-set(USE_COMGR_LIBRARY "no" CACHE STRING "Do not enable COMGR by default")
+-
+ # Optionally, build OpenCL Runtime with ccache.
+ set(ROCM_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache enabled build")
+ if (ROCM_CCACHE_BUILD)
+@@ -21,78 +18,31 @@ endif() # if (ROCM_CCACHE_BUILD)
+
+ project(rocm-opencl)
+
++include (GNUInstallDirs)
++
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
+ set(OPENCL_ICD_LOADER_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2" CACHE PATH "")
+
+ find_package(ROCT REQUIRED)
+ find_package(ROCR REQUIRED)
+
+-# FIXME: Remove following if block after enabling COMGR by default
+-if (${USE_COMGR_LIBRARY} STREQUAL "no")
+- set(LLVM_INCLUDE_TESTS OFF CACHE BOOL "")
+- set(LLVM_BUILD_TOOLS OFF CACHE BOOL "")
+- set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
+- set(LLVM_TARGETS_TO_BUILD "AMDGPU" CACHE STRING "")
+- set(CLANG_ENABLE_ARCMT OFF CACHE BOOL "")
+- set(CLANG_ENABLE_STATIC_ANALYZER OFF CACHE BOOL "")
+-
+- # override default option value in library and driver
+- set(GENERIC_IS_ZERO ON CACHE BOOL ON FORCE)
+-
+- add_subdirectory(compiler/llvm EXCLUDE_FROM_ALL)
+-
+- find_package(LLVM REQUIRED CONFIG PATHS ${CMAKE_BINARY_DIR}/compiler/llvm NO_DEFAULT_PATH)
+-
+- list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
+- include(AddLLVM)
+-
+- add_definitions(${LLVM_DEFINITIONS})
+- # TODO: add find_package for Clang and lld, and also use LLVM/Clang variables got from their config
+- include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/include)
+- include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/tools/clang/include)
+- include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/tools/lld/include)
+-
++find_package(LLVM REQUIRED CONFIG PATHS ${LLVM_DIR} "/opt/rocm/llvm" NO_DEFAULT_PATH)
++set(USE_COMGR_LIBRARY "yes")
++find_package(amd_comgr REQUIRED CONFIG)
++add_definitions(-DUSE_COMGR_LIBRARY)
++foreach(DIR ${LLVM_INCLUDE_DIRS})
++ include_directories("${DIR}")
++ include_directories("${DIR}/clang")
++ include_directories("${DIR}/lld")
+ # TODO: move AMDGPU.h header to include folder
+- include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/lib/Target/AMDGPU)
+- include_directories(${CMAKE_BINARY_DIR}/compiler/llvm/lib/Target/AMDGPU)
+-
+- set(BUILD_HC_LIB OFF CACHE BOOL "")
+- set(ROCM_DEVICELIB_INCLUDE_TESTS OFF CACHE BOOL "")
+- set(AMDGCN_TARGETS_LIB_LIST "AMDGCN_LIB_TARGETS")
+- set(AMDGCN_TARGETS_LIB_DEPS "AMDGCN_DEP_TARGETS")
+- set(AMDGPU_TARGET_TRIPLE "amdgcn-amd-amdhsa")
+- add_subdirectory(library/amdgcn EXCLUDE_FROM_ALL)
+- add_subdirectory(compiler/driver EXCLUDE_FROM_ALL)
+-
+- install(PROGRAMS $<TARGET_FILE:clang> $<TARGET_FILE:lld>
+- DESTINATION bin/x86_64
+- COMPONENT DEV)
+-
+- foreach(AMDGCN_LIB_TARGET ${AMDGCN_LIB_TARGETS})
+- get_target_property(lib_file_name ${AMDGCN_LIB_TARGET} ARCHIVE_OUTPUT_NAME)
+- get_target_property(lib_file_path ${AMDGCN_LIB_TARGET} ARCHIVE_OUTPUT_DIRECTORY)
+- install(FILES ${lib_file_path}/${lib_file_name}.amdgcn.bc
+- DESTINATION lib/x86_64/bitcode
+- COMPONENT DEV)
+- endforeach()
+-endif() # if (${USE_COMGR_LIBRARY} STREQUAL "no")
+-
+-if(${USE_COMGR_LIBRARY} MATCHES "yes")
+- set(COMGR_DYN_DLL "yes")
+- add_definitions(-DCOMGR_DYN_DLL)
+- add_definitions(-DUSE_COMGR_LIBRARY)
+- if( ${BUILD_HIP} MATCHES "yes")
+- add_subdirectory(api/hip)
+- endif()
+-endif()
++ include_directories("${DIR}/llvm/Target/AMDGPU")
++endforeach()
+
+ add_subdirectory(api/opencl/amdocl)
+ add_subdirectory(compiler/lib/loaders/elf/utils/libelf)
+ add_subdirectory(runtime)
+-add_subdirectory(tools/clinfo)
+
+ set(BUILD_SHARED_LIBS "Build shared libs" ON)
+-add_subdirectory(api/opencl/khronos/icd)
+
+ ###--- Packaging ------------------------------------------------------------###
+
+@@ -101,31 +51,9 @@ include(ROCMSetupVersion)
+ rocm_setup_version( VERSION "2.0.0" )
+
+ # MAIN package
+-install(PROGRAMS $<TARGET_FILE:clinfo>
+- DESTINATION bin/x86_64
+- COMPONENT MAIN)
+ install(PROGRAMS $<TARGET_FILE:amdocl64>
+ DESTINATION lib/x86_64
+ COMPONENT MAIN)
+-install(PROGRAMS $<TARGET_FILE:OpenCL>
+- DESTINATION lib/x86_64
+- COMPONENT MAIN)
+-install(PROGRAMS $<TARGET_SONAME_FILE:OpenCL>
+- DESTINATION lib/x86_64
+- COMPONENT MAIN)
+-
+-# DEV package
+-install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/api/opencl/khronos/headers/opencl2.2/CL"
+- DESTINATION include
+- COMPONENT DEV
+- USE_SOURCE_PERMISSIONS
+- PATTERN cl_d3d10.h EXCLUDE
+- PATTERN cl_d3d11.h EXCLUDE
+- PATTERN cl_dx9_media_sharing.h EXCLUDE
+- PATTERN cl_egl.h EXCLUDE)
+-install(PROGRAMS $<TARGET_LINKER_FILE:OpenCL>
+- DESTINATION lib/x86_64
+- COMPONENT DEV)
+
+ # Generic CPACK variables
+ set(CPACK_GENERATOR "DEB;RPM" CACHE STRING "Default packaging generators")