diff options
-rw-r--r-- | .SRCINFO | 25 | ||||
-rw-r--r-- | PKGBUILD | 117 | ||||
-rw-r--r-- | change-install-location.patch | 137 | ||||
-rw-r--r-- | rocm-opencl-runtime-2.8.0-amdocl64icd.patch | 13 | ||||
-rw-r--r-- | rocm-opencl-runtime-2.8.0-change-AMDCompilerh.patch | 79 | ||||
-rw-r--r-- | rocm-opencl-runtime-2.8.0-change-opencl.patch | 70 | ||||
-rw-r--r-- | rocm-opencl-runtime-2.8.0-update-README.patch | 41 |
7 files changed, 266 insertions, 216 deletions
@@ -1,34 +1,37 @@ pkgbase = rocm-opencl-runtime - pkgdesc = ROCm OpenCL™ Compatible Runtime + pkgdesc = Radeon Open Compute - OpenCL runtime pkgver = 3.0.0 - pkgrel = 1 + pkgrel = 2 url = https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime arch = x86_64 license = MIT makedepends = mesa makedepends = cmake - makedepends = ninja makedepends = git + makedepends = llvm-roc + makedepends = rocm-comgr + depends = roct-thunk-interface>=3.0.0 depends = rocr-runtime>=3.0.0 depends = opencl-icd-loader 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-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-opencl-runtime::git+https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime#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 = rocm-opencl-runtime-2.8.0-change-AMDCompilerh.patch + source = rocm-opencl-runtime-2.8.0-change-opencl.patch + source = rocm-opencl-runtime-2.8.0-update-README.patch + source = rocm-opencl-runtime-2.8.0-amdocl64icd.patch source = fix_rocm_opencl_build_order.patch sha256sums = SKIP - sha256sums = 7715db8fd6322bdda4a75a9220cb6c747ca7e93e94ff158d7689d10f984efa45 - sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP - sha256sums = f90a725a14dd972c86a6919e776e7a3a9dc1792031a9ba89d26a4068975034e6 + sha256sums = 07c437ff43942a90a658986f88d5df3d5159af3d5c506aa8d1d7281fbb74d7be + sha256sums = 3af5c9c3b8b88b78a2fd574f339e88a5cd62c365d94e9289c2a2cb4afef3d435 + sha256sums = 9b72ea0101c39a0e67c94d0907061fe493bd0765d884585b2e55d51fafc99fff + sha256sums = 2cfd11bda9a485d6de2231c56742ad553329cab9b6dcc009dbddbcde1436f485 sha256sums = 0f735299810e9e22cd57f5b96a7628a0f399d445a1f3bacefd8b890e84ca372f pkgname = rocm-device-libs @@ -4,124 +4,105 @@ _opencl_icd_loader_commit='978b4b3a29a3aebc86ce9315d5c5963e88722d03' pkgbase=rocm-opencl-runtime pkgname=(rocm-device-libs rocm-opencl-runtime) +pkgdesc='Radeon Open Compute - OpenCL runtime' pkgver=3.0.0 -pkgrel=1 -pkgdesc='ROCm OpenCL™ Compatible Runtime' +pkgrel=2 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) +depends=("roct-thunk-interface>=${pkgver}" "rocr-runtime>=${pkgver}" 'opencl-icd-loader') +makedepends=(mesa cmake git llvm-roc rocm-comgr) provides=("$pkgname" 'opencl-driver') -conflicts=('rocm-opencl-git') source=( - "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-opencl-runtime::git+https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime#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' + "rocm-opencl-runtime-2.8.0-change-AMDCompilerh.patch" + "rocm-opencl-runtime-2.8.0-change-opencl.patch" + "rocm-opencl-runtime-2.8.0-update-README.patch" + "rocm-opencl-runtime-2.8.0-amdocl64icd.patch" + + # Fix build missing dependency + # https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/issues/64#issuecomment-473502685 'fix_rocm_opencl_build_order.patch' ) sha256sums=('SKIP' - '7715db8fd6322bdda4a75a9220cb6c747ca7e93e94ff158d7689d10f984efa45' - 'SKIP' 'SKIP' 'SKIP' 'SKIP' - 'f90a725a14dd972c86a6919e776e7a3a9dc1792031a9ba89d26a4068975034e6' + '07c437ff43942a90a658986f88d5df3d5159af3d5c506aa8d1d7281fbb74d7be' + '3af5c9c3b8b88b78a2fd574f339e88a5cd62c365d94e9289c2a2cb4afef3d435' + '9b72ea0101c39a0e67c94d0907061fe493bd0765d884585b2e55d51fafc99fff' + '2cfd11bda9a485d6de2231c56742ad553329cab9b6dcc009dbddbcde1436f485' '0f735299810e9e22cd57f5b96a7628a0f399d445a1f3bacefd8b890e84ca372f') prepare() { cd "$srcdir/rocm-opencl-runtime" - mkdir -p api/opencl/khronos - ln -s "$srcdir/opencl-icd-loader" api/opencl/khronos/icd + # [ -d tools/clinfo ] && rm -rf tools/clinfo - patch -Np1 -i "$srcdir/change-install-location.patch" - # Fix build missing dependency - # https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/issues/64#issuecomment-473502685 - patch -Np1 -i "$srcdir/fix_rocm_opencl_build_order.patch" + mkdir -p api/opencl/khronos + mv "$srcdir/opencl-icd-loader" api/opencl/khronos/icd + + local src + for src in "${source[@]}"; do + src="${src%%::*}" + src="${src##*/}" + [[ $src = *.patch ]] || continue + msg2 "Applying patch $src..." + patch -Np1 -i "$srcdir/$src" + done } build() { - 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'" - + CMAKE_FLAGS=( + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX='/opt/rocm' + -DLLVM_DIR=/opt/rocm/lib/cmake/llvm + ) if check_buildoption "ccache" "y"; then - CMAKE_FLAGS="$CMAKE_FLAGS -DROCM_CCACHE_BUILD=ON" + CMAKE_FLAGS+=(-DROCM_CCACHE_BUILD=ON) fi msg2 'Building prepare builtins...' cd "$srcdir/rocm-device-libs/utils" - cmake $CMAKE_FLAGS -G Ninja .. - ninja + cmake ${CMAKE_FLAGS[@]} .. + make msg2 'Building device libs...' cd "$srcdir/rocm-device-libs" mkdir -p build && cd build - cmake $CMAKE_FLAGS \ - -DCMAKE_INSTALL_PREFIX=/opt/rocm \ + cmake ${CMAKE_FLAGS[@]} \ -DPREPARE_BUILTINS="$srcdir/rocm-device-libs/utils/utils/prepare-builtins/prepare-builtins" \ - -G Ninja \ .. - ninja + make - 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...' + msg2 'Building OpenCL runtime...' cd "$srcdir/rocm-opencl-runtime" mkdir -p build && cd build - cmake $CMAKE_FLAGS \ - -DCMAKE_INSTALL_PREFIX=/opt/rocm \ + cmake ${CMAKE_FLAGS[@]} \ -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 \ + -DUSE_COMGR_LIBRARY=yes \ + -Damd_comgr_DIR='/opt/rocm/lib/cmake/amd_comgr' \ .. - ninja + make } package_rocm-device-libs() { - DESTDIR="$pkgdir/" ninja -C "$srcdir/rocm-device-libs/build" install + DESTDIR="$pkgdir/" make -C "$srcdir/rocm-device-libs/build" install } package_rocm-opencl-runtime() { - DESTDIR="$pkgdir/" ninja -C "$srcdir/rocm-opencl-runtime/build" install + DESTDIR="$pkgdir/" make -C "$srcdir/rocm-opencl-runtime/build" install # OpenCL vendor file mkdir -p "$pkgdir/etc/OpenCL/vendors" - echo "/opt/rocm/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/lib" > "$pkgdir/etc/ld.so.conf.d/rocm-opencl.conf" + echo '/opt/rocm/lib' > "$pkgdir/etc/ld.so.conf.d/rocm-opencl.conf" + + install -Dm644 "$srcdir/rocm-opencl-runtime/License" "$pkgdir/usr/share/licenses/rocm-opencl-runtime/LICENSE" } diff --git a/change-install-location.patch b/change-install-location.patch deleted file mode 100644 index 225004aa2591..000000000000 --- a/change-install-location.patch +++ /dev/null @@ -1,137 +0,0 @@ -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") diff --git a/rocm-opencl-runtime-2.8.0-amdocl64icd.patch b/rocm-opencl-runtime-2.8.0-amdocl64icd.patch new file mode 100644 index 000000000000..f399f360c9cf --- /dev/null +++ b/rocm-opencl-runtime-2.8.0-amdocl64icd.patch @@ -0,0 +1,13 @@ +diff --git a/api/opencl/amdocl/CMakeLists.txt b/api/opencl/amdocl/CMakeLists.txt +index 8ea8517..d1223ed 100644 +--- a/api/opencl/amdocl/CMakeLists.txt ++++ b/api/opencl/amdocl/CMakeLists.txt +@@ -82,3 +82,7 @@ if(${USE_COMGR_LIBRARY} MATCHES "yes") + else() + target_link_libraries(amdocl64 opencl_driver oclelf pthread dl ${ROCT_LIBRARIES} ${ROCR_LIBRARIES}) + endif() ++ ++file(GENERATE OUTPUT "${CMAKE_BINARY_DIR}/amdocl64.icd" CONTENT "$<TARGET_FILE_NAME:amdocl64>") ++install(FILES "${CMAKE_BINARY_DIR}/amdocl64.icd" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}/OpenCL/vendors/") ++ + diff --git a/rocm-opencl-runtime-2.8.0-change-AMDCompilerh.patch b/rocm-opencl-runtime-2.8.0-change-AMDCompilerh.patch new file mode 100644 index 000000000000..d6bb149f60d7 --- /dev/null +++ b/rocm-opencl-runtime-2.8.0-change-AMDCompilerh.patch @@ -0,0 +1,79 @@ +diff --git a/runtime/device/device.hpp b/runtime/device/device.hpp +index 9eb45b2..a721463 100644 +--- a/runtime/device/device.hpp ++++ b/runtime/device/device.hpp +@@ -21,7 +21,7 @@ + + #if defined(WITH_LIGHTNING_COMPILER) && !defined(USE_COMGR_LIBRARY) + #include "caching/cache.hpp" +-#include "driver/AmdCompiler.h" ++#include "AmdCompiler.h" + #endif // defined(WITH_LIGHTNING_COMPILER) && ! defined(USE_COMGR_LIBRARY) + #include "acl.h" + +diff --git a/runtime/device/devprogram.cpp b/runtime/device/devprogram.cpp +index 587e950..dc233f3 100644 +--- a/runtime/device/devprogram.cpp ++++ b/runtime/device/devprogram.cpp +@@ -14,7 +14,7 @@ + + #if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) + #ifndef USE_COMGR_LIBRARY +-#include "driver/AmdCompiler.h" ++#include "AmdCompiler.h" + #include "libraries.amdgcn.inc" + #include "opencl1.2-c.amdgcn.inc" + #include "opencl2.0-c.amdgcn.inc" +diff --git a/runtime/device/devprogram.hpp b/runtime/device/devprogram.hpp +index 68de7ba..8b91ba2 100644 +--- a/runtime/device/devprogram.hpp ++++ b/runtime/device/devprogram.hpp +@@ -11,7 +11,7 @@ + + #if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) + #ifndef USE_COMGR_LIBRARY +-#include "driver/AmdCompiler.h" ++#include "AmdCompiler.h" + #else + #include "amd_comgr.h" + #endif +diff --git a/runtime/device/rocm/rocdevice.cpp b/runtime/device/rocm/rocdevice.cpp +index 4cba9d7..7ab30ed 100644 +--- a/runtime/device/rocm/rocdevice.cpp ++++ b/runtime/device/rocm/rocdevice.cpp +@@ -20,7 +20,7 @@ + #include "device/rocm/rocvirtual.hpp" + #include "device/rocm/rocprogram.hpp" + #if defined(WITH_LIGHTNING_COMPILER) && ! defined(USE_COMGR_LIBRARY) +-#include "driver/AmdCompiler.h" ++#include "AmdCompiler.h" + #endif // defined(WITH_LIGHTNING_COMPILER) && ! defined(USE_COMGR_LIBRARY) + #include "device/rocm/rocmemory.hpp" + #include "device/rocm/rocglinterop.hpp" +diff --git a/runtime/device/rocm/rockernel.cpp b/runtime/device/rocm/rockernel.cpp +index 8a28acc..7d5b62d 100644 +--- a/runtime/device/rocm/rockernel.cpp ++++ b/runtime/device/rocm/rockernel.cpp +@@ -11,7 +11,7 @@ + + #if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) + #ifndef USE_COMGR_LIBRARY +-#include "driver/AmdCompiler.h" ++#include "AmdCompiler.h" + #endif + #include "llvm/Support/AMDGPUMetadata.h" + +diff --git a/runtime/device/rocm/rocprogram.cpp b/runtime/device/rocm/rocprogram.cpp +index 0155dc2..613d00d 100644 +--- a/runtime/device/rocm/rocprogram.cpp ++++ b/runtime/device/rocm/rocprogram.cpp +@@ -10,7 +10,7 @@ + #if defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) + #include <gelf.h> + #ifndef USE_COMGR_LIBRARY +-#include "driver/AmdCompiler.h" ++#include "AmdCompiler.h" + #include "libraries.amdgcn.inc" + #endif + #endif // defined(WITH_LIGHTNING_COMPILER) || defined(USE_COMGR_LIBRARY) + diff --git a/rocm-opencl-runtime-2.8.0-change-opencl.patch b/rocm-opencl-runtime-2.8.0-change-opencl.patch new file mode 100644 index 000000000000..d9b8641f2949 --- /dev/null +++ b/rocm-opencl-runtime-2.8.0-change-opencl.patch @@ -0,0 +1,70 @@ +diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt +index 2c9dfd6..863b4bf 100644 +--- a/runtime/CMakeLists.txt ++++ b/runtime/CMakeLists.txt +@@ -23,7 +23,6 @@ if (${USE_COMGR_LIBRARY} STREQUAL "no") + include_directories(${CMAKE_SOURCE_DIR}/compiler/llvm/include) + endif() # if (${USE_COMGR_LIBRARY} STREQUAL "no") + +-include_directories(${CMAKE_SOURCE_DIR}/compiler/driver/src) + include_directories(${CMAKE_SOURCE_DIR}/compiler/lib) + include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/include) + include_directories(${CMAKE_SOURCE_DIR}/compiler/lib/backends/common) +@@ -79,6 +78,8 @@ add_library(oclruntime OBJECT + ${COMGR_CPP} + ) + set_target_properties(oclruntime PROPERTIES POSITION_INDEPENDENT_CODE ON) ++#add_dependencies(oclruntime opencl1.2-c.amdgcn.inc_target) ++#add_dependencies(oclruntime opencl2.0-c.amdgcn.inc_target) + + set(AMDGCN_DEP_LIST) + if(AMDGCN_TARGETS_LIB_DEPS) +diff --git a/runtime/device/rocm/CMakeLists.txt b/runtime/device/rocm/CMakeLists.txt +index 5870b65..39166f3 100644 +--- a/runtime/device/rocm/CMakeLists.txt ++++ b/runtime/device/rocm/CMakeLists.txt +@@ -1,3 +1,21 @@ ++find_package(Clang REQUIRED CONFIG) ++ ++# FIXME: CLANG_CMAKE_DIR seems like the most stable way to find this, but ++# really there is no way to reliably discover this header. ++# ++# We effectively back up to the Clang output directory (for the case of a build ++# tree) or install prefix (for the case of an installed copy), and then search ++# for a file named opencl-c.h anywhere below that. We take the first result in ++# the case where there are multiple (e.g. if there is an installed copy nested ++# in a build directory). This is a bit imprecise, but it covers cases like MSVC ++# adding some additional configuration-specific subdirectories to the build ++# tree but not to an installed copy. ++file(GLOB_RECURSE OPENCL_C_H_LIST "${CLANG_CMAKE_DIR}/../../../*/opencl-c.h") ++list(GET OPENCL_C_H_LIST 0 OPENCL_C_H) ++if (NOT EXISTS "${OPENCL_C_H}" OR IS_DIRECTORY "${OPENCL_C_H}") ++ message(FATAL_ERROR "Unable to locate opencl-c.h from the supplied Clang. The path '${CLANG_CMAKE_DIR}/../../../*' was searched.") ++endif() ++ + include(bc2h) + + set(INC_SUFFIX "amdgcn.inc") +@@ -82,8 +100,8 @@ if (${USE_COMGR_LIBRARY} STREQUAL "no") + + # generating opencl*.inc files + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.amdgcn.pch +- COMMAND clang -cc1 -x cl-header -triple amdgcn-amd-amdhsa -Werror -O3 -DNDEBUG -cl-std=CL1.2 -emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.amdgcn.pch < ${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/lib/Headers/opencl-c.h +- DEPENDS clang ${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/lib/Headers/opencl-c.h ++ COMMAND clang -cc1 -x cl-header -triple amdgcn-amd-amdhsa -Werror -O3 -DNDEBUG -cl-std=CL1.2 -emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.amdgcn.pch < ${OPENCL_C_H} ++ DEPENDS clang ${OPENCL_C_H} + COMMENT "Generating opencl1.2-c.amdgcn.pch" + ) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.amdgcn.inc +@@ -96,8 +114,8 @@ if (${USE_COMGR_LIBRARY} STREQUAL "no") + add_dependencies(oclrocm opencl1.2-c.amdgcn.inc_target) + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.pch +- COMMAND clang -cc1 -x cl-header -triple amdgcn-amd-amdhsa -Werror -O3 -DNDEBUG -cl-std=CL2.0 -emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.pch < ${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/lib/Headers/opencl-c.h +- DEPENDS clang ${CMAKE_SOURCE_DIR}/compiler/llvm/tools/clang/lib/Headers/opencl-c.h ++ COMMAND clang -cc1 -x cl-header -triple amdgcn-amd-amdhsa -Werror -O3 -DNDEBUG -cl-std=CL2.0 -emit-pch -o ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.pch < ${OPENCL_C_H} ++ DEPENDS clang ${OPENCL_C_H} + COMMENT "Generating opencl2.0-c.amdgcn.pch" + ) + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.amdgcn.inc + diff --git a/rocm-opencl-runtime-2.8.0-update-README.patch b/rocm-opencl-runtime-2.8.0-update-README.patch new file mode 100644 index 000000000000..39d7495e9099 --- /dev/null +++ b/rocm-opencl-runtime-2.8.0-update-README.patch @@ -0,0 +1,41 @@ +diff --git a/README.md b/README.md +index a834965..7fea026 100644 +--- a/README.md ++++ b/README.md +@@ -8,12 +8,6 @@ Developer preview Version 2 of the new + + + ## GETTING REPO +- +-Repo is a git wrapper that manages a collection of git repositories. Install this tool and add it to the command search PATH: +- +- curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo +- chmod a+x ~/bin/repo +- + ## GETTING THE SOURCE CODE + + Main OpenCL™ Compatible Components: +@@ -26,11 +20,6 @@ Main OpenCL™ Compatible Components: + * https://github.com/RadeonOpenCompute/lld + * https://github.com/KhronosGroup/OpenCL-ICD-Loader + +-Download the git projects with the following commands: +- +- ~/bin/repo init -u https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime.git -b master -m opencl.xml +- ~/bin/repo sync +- + ## INSTALL ROCm + + Follow the instructions at https://rocm.github.io/install.html to install ROCm. +@@ -45,6 +34,11 @@ Copy the amdocl64.icd file to /etc/OpenCL/vendors + + To install additional dependencies: + ++* ROCm-OpenCL-Runtime ++* ROCm-OpenCL-Driver ++* ROC versions of LLVM, Clang, and lld ++* ROCm-Device-Libs ++* OpenCL-ICD-Loade + * OCaml + * findlib + * A Python 2 environment or active virtualenv with the Microsoft Z3 package |