The package rpms/hcc.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/hcc.git/commit/?id=9db564291d8a4f....
Change:
+ExclusiveArch: x86_64 aarch64
Thanks.
Full change:
============
commit 9db564291d8a4f4db86e6af792dc15801d9c083d
Author: Tom Stellard <tstellar(a)redhat.com>
Date: Wed Mar 20 23:17:00 2019 +0000
ROCm 2.0.0 release
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5d8e55b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+/device-libs-2.0.0.tar.gz
+/hcc-clang-upgrade-6ec3c61e09fbb60373eaf5a40021eb862363ba2c-roc-2.0.0.tar.gz
+/hcc-roc-2.0.0.tar.gz
+/lld-roc-2.0.0.tar.gz
+/llvm-roc-2.0.0.tar.gz
diff --git a/0001-Build-mcwamp_atomic-as-a-shared-library.patch
b/0001-Build-mcwamp_atomic-as-a-shared-library.patch
new file mode 100644
index 0000000..8172763
--- /dev/null
+++ b/0001-Build-mcwamp_atomic-as-a-shared-library.patch
@@ -0,0 +1,25 @@
+From e17ca06fe023803f2b2848e4e107f7a1fea7c8f9 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Tue, 12 Feb 2019 20:38:05 -0800
+Subject: [PATCH] Build mcwamp_atomic as a shared library
+
+---
+ lib/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index f47caaae6c..2fa122d1ee 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -16,7 +16,7 @@ set( CONFIG_PACKAGE_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/hcc )
+ # C++AMP runtime (mcwamp)
+ ####################
+ add_mcwamp_shared_library(mcwamp mcwamp.cpp)
+-add_mcwamp_library(mcwamp_atomic mcwamp_atomic.cpp)
++add_mcwamp_shared_library(mcwamp_atomic mcwamp_atomic.cpp)
+
+ # Library interface to use runtime
+ add_library(hccrt INTERFACE)
+--
+2.17.2
+
diff --git a/0001-Disable-compiler-rt-build.patch b/0001-Disable-compiler-rt-build.patch
new file mode 100644
index 0000000..00e45df
--- /dev/null
+++ b/0001-Disable-compiler-rt-build.patch
@@ -0,0 +1,24 @@
+From 5953e287efb8597165fab1fe38209ffb7cef3413 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Mon, 8 Jan 2018 19:23:38 -0800
+Subject: [PATCH] Disable compiler-rt build
+
+---
+ CMakeLists.txt | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c752ad7f5e..9f285a79d9 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -307,7 +307,6 @@ else ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+ endif ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
+
+ set(LLVM_EXTERNAL_CLANG_SOURCE_DIR "${PROJECT_SOURCE_DIR}/clang")
+-set(LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/compiler-rt")
+ set(LLVM_EXTERNAL_LLD_SOURCE_DIR "${PROJECT_SOURCE_DIR}/lld")
+
+ # determine LLVM targets to be built
+--
+2.13.6
+
diff --git a/0001-Don-t-override-CMAKE_CXX_FLAGS-when-building-hcc-con.patch
b/0001-Don-t-override-CMAKE_CXX_FLAGS-when-building-hcc-con.patch
new file mode 100644
index 0000000..60133c5
--- /dev/null
+++ b/0001-Don-t-override-CMAKE_CXX_FLAGS-when-building-hcc-con.patch
@@ -0,0 +1,33 @@
+From 4ec5f858164f234e4bd0f5b79d2d887c36642bf9 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Mon, 25 Feb 2019 15:58:38 -0800
+Subject: [PATCH] Don't override CMAKE_CXX_FLAGS when building hcc-config
+
+---
+ hcc_config/CMakeLists.txt | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/hcc_config/CMakeLists.txt b/hcc_config/CMakeLists.txt
+index 63c4873317..a9e5ef90e6 100644
+--- a/hcc_config/CMakeLists.txt
++++ b/hcc_config/CMakeLists.txt
+@@ -5,8 +5,6 @@ endif (HCC_RUNTIME_DEBUG)
+
+ include_directories(${CMAKE_CURRENT_BINARY_DIR}/../hcc_config)
+
+-set(CMAKE_CXX_FLAGS "-std=c++11" )
+-
+ if (USE_LIBCXX)
+ add_definitions(-DUSE_LIBCXX -DLIBCXX_HEADER=${LIBCXX_HEADER})
+ if (HCC_TOOLCHAIN_RHEL)
+@@ -30,6 +28,7 @@ endif (USE_CODEXL_ACTIVITY_LOGGER EQUAL 1)
+
+ add_executable(hcc-config hcc_config.cpp)
+
++target_compile_options(hcc-config PUBLIC "-std=c++11" )
+
+ add_custom_command(TARGET hcc-config POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ./hcc-config ./clamp-config
+--
+2.17.2
+
diff --git a/0001-Dont-force-libdir-to-lib.patch b/0001-Dont-force-libdir-to-lib.patch
new file mode 100644
index 0000000..1fff2f9
--- /dev/null
+++ b/0001-Dont-force-libdir-to-lib.patch
@@ -0,0 +1,26 @@
+From 72af12c623a8cb503e52d05e7ed322f04d33510d Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Mon, 26 Feb 2018 14:31:15 -0800
+Subject: [PATCH] Dont' force libdir to lib/
+
+---
+ CMakeLists.txt | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4c645e8147..680628657c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -371,9 +371,6 @@ install(PROGRAMS $<TARGET_FILE:LLVMAMDGPUDesc>
+ COMPONENT compiler
+ )
+
+-# force library install path to lib
+-set(CMAKE_INSTALL_LIBDIR "lib" CACHE INTERNAL "Installation directory for
libraries" FORCE)
+-
+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/ImportedTargets.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hcc )
+
+--
+2.13.6
+
diff --git a/0001-Filter-out-cxx-flags-not-supported-by-hcc-when-build.patch
b/0001-Filter-out-cxx-flags-not-supported-by-hcc-when-build.patch
new file mode 100644
index 0000000..3cf687c
--- /dev/null
+++ b/0001-Filter-out-cxx-flags-not-supported-by-hcc-when-build.patch
@@ -0,0 +1,26 @@
+From c351d2473636fd401626ea5e648f53f289cbdc19 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Mon, 25 Feb 2019 16:29:28 -0800
+Subject: [PATCH] Filter out cxx flags not supported by hcc when building the
+ runtime
+
+We only need to do this for the runtime, because it is built by hcc. The
+rest of the code including hcc itself is built by the system compiler.
+---
+ lib/CMakeLists.txt | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index 2fa122d1ee..adafe1ab99 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -1,3 +1,6 @@
++string(REPLACE "-fstack-clash-protection" "" CMAKE_CXX_FLAGS
${CMAKE_CXX_FLAGS})
++# This not supported in -hc mode, because it targets GPUs
++string(REPLACE "-fcf-protection" "" CMAKE_CXX_FLAGS
${CMAKE_CXX_FLAGS})
+
+ option(HCC_RUNTIME_DEBUG "Enable debug build for HCC Runtime" OFF)
+
+--
+2.17.2
+
diff --git a/0001-Fix-paths-in-hcc-config.cmake.in.patch
b/0001-Fix-paths-in-hcc-config.cmake.in.patch
new file mode 100644
index 0000000..eed9807
--- /dev/null
+++ b/0001-Fix-paths-in-hcc-config.cmake.in.patch
@@ -0,0 +1,37 @@
+From c590fcd3041bdc4137b19fcd0e982914ae65869b Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Mon, 11 Feb 2019 19:35:40 -0800
+Subject: [PATCH] Fix paths in hcc-config.cmake.in
+
+---
+ lib/hcc-config.cmake.in | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/hcc-config.cmake.in b/lib/hcc-config.cmake.in
+index 12b14968fe..8bead5ae11 100644
+--- a/lib/hcc-config.cmake.in
++++ b/lib/hcc-config.cmake.in
+@@ -1,17 +1,17 @@
+ @PACKAGE_INIT@
+
+-set_and_check( hcc_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" )
++set_and_check( hcc_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@/hcc" )
+ set_and_check( hcc_INCLUDE_DIRS "${hcc_INCLUDE_DIR}" )
+ set_and_check( hcc_LIB_INSTALL_DIR "@PACKAGE_LIB_INSTALL_DIR@" )
+
+ find_path(HSA_HEADER hsa/hsa.h
+ PATHS
+- /opt/rocm/include
++ /usr/include/
+ )
+
+ find_library(HSA_LIBRARY hsa-runtime64
+ PATHS
+- /opt/rocm/lib
++ /usr/lib64/
+ )
+
+ add_library(hsa-runtime64 SHARED IMPORTED GLOBAL)
+--
+2.17.2
+
diff --git a/0001-Hard-code-rocm-device-libs-search-path-to-usr-share-.patch
b/0001-Hard-code-rocm-device-libs-search-path-to-usr-share-.patch
new file mode 100644
index 0000000..b6bb091
--- /dev/null
+++ b/0001-Hard-code-rocm-device-libs-search-path-to-usr-share-.patch
@@ -0,0 +1,25 @@
+From aac1a513f8861e8f0226dc8c2a5d00cebc9cf3da Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Fri, 23 Feb 2018 06:14:09 -0800
+Subject: [PATCH] Hard-code rocm device libs search path to /usr/share/rocm
+
+---
+ lib/clamp-device.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/clamp-device.in b/lib/clamp-device.in
+index be09544a4a..cbb8bf08ac 100755
+--- a/lib/clamp-device.in
++++ b/lib/clamp-device.in
+@@ -73,7 +73,7 @@ LLD=$BINDIR/ld.lld
+
+
+ HCC_BIN_PATH=$(dirname -- "$(readlink -f -- "$BASH_SOURCE")")
+-ROCM_DEVICE_LIBS_SEARCH_PATHS="$HCC_BIN_PATH/../../rocdl/lib;$HCC_BIN_PATH/../rocdl/lib;@ROCM_DEVICE_LIB_PATHS@"
++ROCM_DEVICE_LIBS_SEARCH_PATHS="/usr/share/rocm/"
+ ROCM_LIB=""
+ for SEARCH_PATH in $(echo $ROCM_DEVICE_LIBS_SEARCH_PATHS | tr ";"
"\n")
+ do
+--
+2.17.2
+
diff --git a/0001-Install-experimental-headers-to-include-hc.patch
b/0001-Install-experimental-headers-to-include-hc.patch
new file mode 100644
index 0000000..a96ba6d
--- /dev/null
+++ b/0001-Install-experimental-headers-to-include-hc.patch
@@ -0,0 +1,29 @@
+From c086c5dc29a8016f5fe6d426f188b920a5c60ec3 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Mon, 11 Feb 2019 19:03:36 -0800
+Subject: [PATCH] Install experimental headers to include/hc
+
+---
+ include/experimental/CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/experimental/CMakeLists.txt b/include/experimental/CMakeLists.txt
+index 509b1394b1..6b7c36bd14 100644
+--- a/include/experimental/CMakeLists.txt
++++ b/include/experimental/CMakeLists.txt
+@@ -52,10 +52,10 @@ add_dependencies(world pstl-headers)
+ # Install command for PSTL exp headers
+ install(FILES ${PSTL_EXP_HEADERS}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION include/experimental)
++ DESTINATION include/hcc/experimental)
+
+ # Install command for PSTL impl headers
+ install(FILES ${PSTL_IMPL_HEADERS}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION include/experimental/impl)
++ DESTINATION include/hcc/experimental/impl)
+
+--
+2.17.2
+
diff --git a/0001-Install-headers-to-usr-include-hcc.patch
b/0001-Install-headers-to-usr-include-hcc.patch
new file mode 100644
index 0000000..aab836e
--- /dev/null
+++ b/0001-Install-headers-to-usr-include-hcc.patch
@@ -0,0 +1,25 @@
+From 8b6a031922bc02dba195be2dc9df9e06472a4172 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Wed, 28 Feb 2018 10:56:02 -0800
+Subject: [PATCH] Install headers to /usr/include/hcc
+
+---
+ include/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index 933af298f3..b44c3ec793 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -36,7 +36,7 @@ add_dependencies(world hcc-headers)
+ # Install command for headers
+ install(FILES ${HCC_HEADERS}
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+- DESTINATION include)
++ DESTINATION include/hcc)
+
+ # PSTL headers
+ ADD_SUBDIRECTORY(experimental)
+--
+2.13.6
+
diff --git a/0001-Install-internal-tools-to-libexecdir.patch
b/0001-Install-internal-tools-to-libexecdir.patch
new file mode 100644
index 0000000..2555513
--- /dev/null
+++ b/0001-Install-internal-tools-to-libexecdir.patch
@@ -0,0 +1,25 @@
+From b5e790c5fc58f7487acfe202cce8d91428cccbf5 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Tue, 12 Feb 2019 20:13:43 -0800
+Subject: [PATCH] Install internal tools to libexecdir
+
+---
+ lib/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index 98c1581d26..f47caaae6c 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -45,7 +45,7 @@ install(PROGRAMS ${PROJECT_BINARY_DIR}/compiler/bin/clamp-device
+ ${PROJECT_BINARY_DIR}/compiler/bin/error-check
+ ${PROJECT_BINARY_DIR}/compiler/bin/hc-kernel-assemble
+ ${PROJECT_BINARY_DIR}/compiler/bin/hc-host-assemble
+- DESTINATION bin)
++ DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/hcc/bin)
+
+ ####################
+ # C++AMP tools (HSA-specific)
+--
+2.17.2
+
diff --git a/0001-Install-irif.amdgcn.bc.patch b/0001-Install-irif.amdgcn.bc.patch
new file mode 100644
index 0000000..345237e
--- /dev/null
+++ b/0001-Install-irif.amdgcn.bc.patch
@@ -0,0 +1,24 @@
+From 69ee2ce9e4e6991b226848a145725bcf2a016093 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Wed, 16 Jan 2019 20:26:42 -0800
+Subject: [PATCH] Install irif.amdgcn.bc
+
+---
+ CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b388a485b5..b9daa8dd72 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -413,6 +413,7 @@ if (HCC_INTEGRATE_ROCDL)
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../ockl/ockl.amdgcn.bc
ockl.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../hc/hc.amdgcn.bc
hc.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../hip/hip.amdgcn.bc
hip.amdgcn.bc
++ COMMAND ${CMAKE_COMMAND} -E create_symlink ../irif/irif.amdgcn.bc
irif.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_701.amdgcn.bc
oclc_isa_version_701.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_802.amdgcn.bc
oclc_isa_version_802.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_810.amdgcn.bc
oclc_isa_version_810.amdgcn.bc
+--
+2.17.2
+
diff --git a/0001-Load-opt-plugins-from-BINDIR-lib64.patch
b/0001-Load-opt-plugins-from-BINDIR-lib64.patch
new file mode 100644
index 0000000..1cd33e9
--- /dev/null
+++ b/0001-Load-opt-plugins-from-BINDIR-lib64.patch
@@ -0,0 +1,53 @@
+From 3f1c9d1bec09e0e9c2aed34136b222e348e8268c Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Tue, 7 Nov 2017 11:16:28 -0800
+Subject: [PATCH] Load opt plugins from BINDIR/lib64
+
+---
+ lib/clamp-device.in | 2 +-
+ lib/hc-host-assemble.in | 2 +-
+ lib/hc-kernel-assemble.in | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/clamp-device.in b/lib/clamp-device.in
+index 80342f118a..be09544a4a 100755
+--- a/lib/clamp-device.in
++++ b/lib/clamp-device.in
+@@ -63,7 +63,7 @@ AS=$BINDIR/llvm-as
+ OPT=$BINDIR/opt
+ LLC=$BINDIR/llc
+ LINK=$BINDIR/llvm-link
+-LIB=$BINDIR/../lib
++LIB=$BINDIR/../lib64
+ LLD=$BINDIR/ld.lld
+
+
+diff --git a/lib/hc-host-assemble.in b/lib/hc-host-assemble.in
+index 15ab239993..2b6152d27d 100755
+--- a/lib/hc-host-assemble.in
++++ b/lib/hc-host-assemble.in
+@@ -18,7 +18,7 @@ CLANG=$BINDIR/hcc
+ OPT=$BINDIR/opt
+ LLVM_AS=$BINDIR/llvm-as
+ LLVM_DIS=$BINDIR/llvm-dis
+-LIBPATH=$BINDIR/../lib
++LIBPATH=$BINDIR/../lib64
+
+ # Add error handling functions
+ . $BINDIR/error-check
+diff --git a/lib/hc-kernel-assemble.in b/lib/hc-kernel-assemble.in
+index 345836b485..eb6182a562 100755
+--- a/lib/hc-kernel-assemble.in
++++ b/lib/hc-kernel-assemble.in
+@@ -26,7 +26,7 @@ CLAMP_DEVICE=$BINDIR/clamp-device
+ LLVM_AS=$BINDIR/llvm-as
+ LLVM_DIS=$BINDIR/llvm-dis
+ CLAMP_ASM=$BINDIR/clamp-assemble
+-LIBPATH=$BINDIR/../lib
++LIBPATH=$BINDIR/../lib64
+ CLANG_OFFLOAD_BUNDLER=$BINDIR/clang-offload-bundler
+
+ # Add error handling functions
+--
+2.17.2
+
diff --git a/0001-Look-for-rocm_agent_enumerator-in-usr-bin.patch
b/0001-Look-for-rocm_agent_enumerator-in-usr-bin.patch
new file mode 100644
index 0000000..163a29b
--- /dev/null
+++ b/0001-Look-for-rocm_agent_enumerator-in-usr-bin.patch
@@ -0,0 +1,25 @@
+From c006e86bd1023bb7aca5ae9d30679d2ae10195e2 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Tue, 20 Feb 2018 14:50:55 -0800
+Subject: [PATCH] Look for rocm_agent_enumerator in /usr/bin
+
+---
+ lib/Driver/ToolChains/Hcc.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/Driver/ToolChains/Hcc.cpp b/lib/Driver/ToolChains/Hcc.cpp
+index 5ad424a69a..80f1420b38 100644
+--- a/lib/Driver/ToolChains/Hcc.cpp
++++ b/lib/Driver/ToolChains/Hcc.cpp
+@@ -188,7 +188,7 @@ namespace
+ std::vector<std::string> r;
+
+ const char* tmp = std::getenv("ROCM_ROOT");
+- const Twine rocm = tmp ? tmp : "/opt/rocm";
++ const Twine rocm = tmp ? tmp : "/usr";
+ const Twine e = rocm + "/bin/rocm_agent_enumerator";
+
+ if (!tc.getVFS().exists(e)) return r;
+--
+2.13.6
+
diff --git a/0001-Make-HCC_VERSION_PATCH-configurable.patch
b/0001-Make-HCC_VERSION_PATCH-configurable.patch
new file mode 100644
index 0000000..f768dc9
--- /dev/null
+++ b/0001-Make-HCC_VERSION_PATCH-configurable.patch
@@ -0,0 +1,25 @@
+From 5670fc18036fe6f888b1148cb39c70a676d84897 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Fri, 23 Feb 2018 13:11:13 -0800
+Subject: [PATCH] Make HCC_VERSION_PATCH configurable
+
+---
+ CMakeLists.txt | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index da1ce8613f..cf84677483 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -217,6 +217,8 @@ endif()
+ add_version_info_from_git(HCC_VERSION_STRING
+ HCC_VERSION_PATCH KALMAR_SDK_COMMIT KALMAR_FRONTEND_COMMIT KALMAR_BACKEND_COMMIT)
+
++set(HCC_VERSION_PATCH CACHE STRING "0")
++
+ # set default installation path
+ set(INSTALL_DIR_NAME "hcc")
+ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND CMAKE_INSTALL_PREFIX MATCHES
"/usr/local")
+--
+2.17.2
+
diff --git a/0001-Remove-broken-rocdl-symlinks.patch
b/0001-Remove-broken-rocdl-symlinks.patch
new file mode 100644
index 0000000..73608fc
--- /dev/null
+++ b/0001-Remove-broken-rocdl-symlinks.patch
@@ -0,0 +1,31 @@
+From 7d8a5d81a2d35a17c452e986cf3660a57c280de4 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Tue, 15 Jan 2019 16:10:53 -0800
+Subject: [PATCH] Remove broken rocdl symlinks
+
+---
+ CMakeLists.txt | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cf84677483..b388a485b5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -423,14 +423,11 @@ if (HCC_INTEGRATE_ROCDL)
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_700.amdgcn.bc
oclc_isa_version_700.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_daz_opt_on.amdgcn.bc
oclc_daz_opt_on.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_unsafe_math_off.amdgcn.bc
oclc_unsafe_math_off.amdgcn.bc
+- COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_800.amdgcn.bc
oclc_isa_version_800.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_daz_opt_off.amdgcn.bc
oclc_daz_opt_off.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_unsafe_math_on.amdgcn.bc
oclc_unsafe_math_on.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
../oclc/oclc_correctly_rounded_sqrt_off.amdgcn.bc
oclc_correctly_rounded_sqrt_off.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_803.amdgcn.bc
oclc_isa_version_803.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink
../oclc/oclc_correctly_rounded_sqrt_on.amdgcn.bc
oclc_correctly_rounded_sqrt_on.amdgcn.bc
+- COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_901.amdgcn.bc
oclc_isa_version_901.amdgcn.bc
+- COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_804.amdgcn.bc
oclc_isa_version_804.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../oclc/oclc_isa_version_906.amdgcn.bc
oclc_isa_version_906.amdgcn.bc
+ COMMAND ${CMAKE_COMMAND} -E create_symlink ../ocml/ocml.amdgcn.bc
ocml.amdgcn.bc
+ WORKING_DIRECTORY ${ROCDL_BUILD_DIR}/lib
+--
+2.17.2
+
diff --git a/0001-Remove-compiler-rt-dependency.patch
b/0001-Remove-compiler-rt-dependency.patch
new file mode 100644
index 0000000..87cad6c
--- /dev/null
+++ b/0001-Remove-compiler-rt-dependency.patch
@@ -0,0 +1,31 @@
+From 150dfffb2ed63af9bed39014e859187a88d40099 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Fri, 17 Nov 2017 15:54:03 -0800
+Subject: [PATCH] Remove compiler-rt dependency
+
+---
+ lib/Driver/ToolChains/Gnu.cpp | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
+index ae7ee818df..076f49e232 100644
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -556,14 +556,6 @@ void tools::gnutools::Linker::ConstructLinkerJob(Compilation
&C,
+ }
+ }
+
+- // HCC: Add compiler-rt library to get the half fp builtins
+- if (C.getArgs().hasArg(options::OPT_famp) ||
+- C.getArgs().getLastArgValue(options::OPT_std_EQ).equals("c++amp")) {
+- CmdArgs.push_back(Args.MakeArgString(
+- "-lclang_rt.builtins-" +
+- getToolChain().getTriple().getArchName()));
+- }
+-
+ // Add OpenMP offloading linker script args if required.
+ AddOpenMPLinkerScript(getToolChain(), C, Output, Inputs, Args, CmdArgs, JA);
+ // Add HIP offloading linker script args if required.
+--
+2.17.2
+
diff --git a/0001-Remove-compiler-rt-install-target.patch
b/0001-Remove-compiler-rt-install-target.patch
new file mode 100644
index 0000000..8455307
--- /dev/null
+++ b/0001-Remove-compiler-rt-install-target.patch
@@ -0,0 +1,27 @@
+From ed668b7dd045c8b239f0aab29fba928e52d0c668 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Thu, 11 Jan 2018 13:02:46 -0800
+Subject: [PATCH] Remove compiler-rt install target
+
+---
+ CMakeLists.txt | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 12f374dce7..da1ce8613f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -372,10 +372,6 @@ install(PROGRAMS $<TARGET_FILE:LLVMAMDGPUDesc>
+ # force library install path to lib
+ set(CMAKE_INSTALL_LIBDIR "lib" CACHE INTERNAL "Installation directory for
libraries" FORCE)
+
+-install(FILES
${CLANG_BIN_DIR}/lib/clang/${CLANG_VERSION}/lib/linux/libclang_rt.builtins-${RT_BUILTIN_SUFFIX}.a
+- DESTINATION ${CMAKE_INSTALL_LIBDIR}
+- COMPONENT compiler)
+-
+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/ImportedTargets.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/hcc )
+
+--
+2.17.2
+
diff --git a/0001-Set-version-for-shared-libraries.patch
b/0001-Set-version-for-shared-libraries.patch
new file mode 100644
index 0000000..2cf27a2
--- /dev/null
+++ b/0001-Set-version-for-shared-libraries.patch
@@ -0,0 +1,52 @@
+From 8798226c6450104c8fb52bb450d8e87a509cfbe4 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Tue, 15 Jan 2019 18:27:15 -0800
+Subject: [PATCH] Set version for shared libraries
+
+---
+ scripts/cmake/MCWAMP.cmake | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/scripts/cmake/MCWAMP.cmake b/scripts/cmake/MCWAMP.cmake
+index 49c155ad40..70a5c31652 100644
+--- a/scripts/cmake/MCWAMP.cmake
++++ b/scripts/cmake/MCWAMP.cmake
+@@ -62,6 +62,8 @@ macro(add_mcwamp_shared_library name )
+ amp_target(${name})
+ # LLVM and Clang shall be compiled beforehand
+ target_link_libraries(${name} PUBLIC hsa-runtime64 dl)
++ set_target_properties(${name} PROPERTIES
++ VERSION
"${HCC_VERSION_MAJOR}.${HCC_VERSION_MINOR}")
+ add_dependencies(${name} llvm-link opt clang rocdl)
+ endmacro(add_mcwamp_shared_library name )
+
+@@ -74,6 +76,8 @@ macro(add_mcwamp_library_cpu name )
+ # LLVM and Clang shall be compiled beforehand
+ add_dependencies(${name} llvm-link opt clang rocdl)
+ add_libcxx_option_if_needed(${name})
++ set_target_properties(${name} PROPERTIES
++ VERSION
"${HCC_VERSION_MAJOR}.${HCC_VERSION_MINOR}")
+ endmacro(add_mcwamp_library_cpu name )
+
+ ####################
+@@ -89,6 +93,8 @@ macro(add_mcwamp_library_hsa name )
+ target_link_libraries(${name} PRIVATE pthread)
+ add_libcxx_option_if_needed(${name})
+ target_link_libraries(${name} PUBLIC hc_am)
++ set_target_properties(${name} PROPERTIES
++ VERSION
"${HCC_VERSION_MAJOR}.${HCC_VERSION_MINOR}")
+ endmacro(add_mcwamp_library_hsa name )
+
+ macro(add_mcwamp_library_hc_am name )
+@@ -100,6 +106,8 @@ macro(add_mcwamp_library_hc_am name )
+ target_link_libraries(${name} PUBLIC hsa-runtime64)
+ target_link_libraries(${name} PRIVATE pthread)
+ add_libcxx_option_if_needed(${name})
++ set_target_properties(${name} PROPERTIES
++ VERSION
"${HCC_VERSION_MAJOR}.${HCC_VERSION_MINOR}")
+ endmacro(add_mcwamp_library_hc_am name )
+
+ if(POLICY CMP0046)
+--
+2.17.2
+
diff --git a/0001-hcc-config-Add-usr-include-hcc-to-include-directorie.patch
b/0001-hcc-config-Add-usr-include-hcc-to-include-directorie.patch
new file mode 100644
index 0000000..b9fbc4a
--- /dev/null
+++ b/0001-hcc-config-Add-usr-include-hcc-to-include-directorie.patch
@@ -0,0 +1,27 @@
+From 8591813c9bf751e329e0b721cf1ed9ab33549a58 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Tue, 22 Jan 2019 22:27:07 -0800
+Subject: [PATCH] hcc-config: Add /usr/include/hcc to include directories
+
+Applications will reference hcc header files directly and not with the
+hcc/ prefix.
+---
+ hcc_config/hcc_config.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/hcc_config/hcc_config.cpp b/hcc_config/hcc_config.cpp
+index 41a165f6f0..1de3912d8f 100644
+--- a/hcc_config/hcc_config.cpp
++++ b/hcc_config/hcc_config.cpp
+@@ -68,7 +68,7 @@ std::string get_path(path_kind kind) {
+ if (kind == path_hcc_lib)
+ path += CMAKE_INSTALL_LIB;
+ else if (kind == path_hcc_include)
+- path += "include";
++ path += "include/hcc";
+
+ if (realpath(path.c_str(), path_buffer) == NULL) {
+ std::cerr << "Error when creating canonical path!" <<
std::endl;
+--
+2.17.2
+
diff --git a/0001-rpt-Convert-to-python3.patch b/0001-rpt-Convert-to-python3.patch
new file mode 100644
index 0000000..57a31f2
--- /dev/null
+++ b/0001-rpt-Convert-to-python3.patch
@@ -0,0 +1,236 @@
+From 9df96ead49d76e7178826029db36277425cabd9e Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Wed, 16 Jan 2019 11:28:55 -0800
+Subject: [PATCH] rpt: Convert to python3
+
+---
+ lib/rpt | 74 ++++++++++++++++++++++++++++-----------------------------
+ 1 file changed, 37 insertions(+), 37 deletions(-)
+
+diff --git a/lib/rpt b/lib/rpt
+index 95347eeb3b..0ed2aec2dd 100755
+--- a/lib/rpt
++++ b/lib/rpt
+@@ -130,11 +130,11 @@ class TextLogRecord:
+
+ def printMe(self,showLines=False):
+ if showLines:
+- print "@%d---\n" % (self.startLineNum),
++ print("@%d---\n" % (self.startLineNum), end=' ')
+ for l in self.text:
+- print ">", l,
++ print(">", l, end=' ')
+ if showLines:
+- print "@%d---\n" % (self.stopLineNum)
++ print("@%d---\n" % (self.stopLineNum))
+
+ def getLineText(self, lineNum):
+ try:
+@@ -158,7 +158,7 @@ class TextLogRecord:
+ class ProfileLogRecord:
+ def __init__(self, lineNum, line, text):
+ if args.db:
+- print "raw:", line
++ print("raw:", line)
+
+ self.lineNum = lineNum
+
+@@ -190,7 +190,7 @@ class ProfileLogRecord:
+ try:
+ (self.device, self.queue, self.cmdNum) = [int(f) for f in
fields[fi].lstrip("#").split(".")]
+ except:
+- print "warning: unknown opid tag=", fields[fi]
++ print("warning: unknown opid tag=", fields[fi])
+ self.device = 0
+ self.queue = 0
+ self.cmdnum = 0
+@@ -216,7 +216,7 @@ class ProfileLogRecord:
+ self.name = self.name + "_" + str(self.sizeBytes) +
"_bytes"
+ #self.bandwidthGBps = (float)(sizeBytes*1000.0/1024.0*1000.0/1024.0)
/ (self.stopTime - self.startTime)
+ except:
+- print "warning: can't find copy size in",
fields[copyField]
++ print("warning: can't find copy size in",
fields[copyField])
+
+ # these structures filled in after sorting the records:
+ self.criticalTime = None
+@@ -224,7 +224,7 @@ class ProfileLogRecord:
+
+ self.valid = True
+ except:
+- print "warning: ignored unparsable profile line:", line,
++ print("warning: ignored unparsable profile line:", line, end='
')
+
+ self.valid = False
+
+@@ -259,19 +259,19 @@ class ProfileLogRecord:
+ @staticmethod
+ def printHeader(printInfo):
+ if (printInfo):
+- print "Display each of the profiling events on a single line.
Fields:"
++ print("Display each of the profiling events on a single line.
Fields:")
+
+- print " Resource : The resource this command executed on. May be GPU#
for a specific GPU or DATA to indicate data transfer command"
+- print " Start(ms) : Start time of the command, displayed in ms.
Command start from time 0"
+- print " +Time(us) : Time which the command contributed to the
'critical' path "
+- print " Type : Type of the command (kernel, barrier, copy)"
+- print " Dev.Q.Cmd : The command sequm is a unique mononotically
increasing number per-queue, so the triple of device.queue.cmdseqnum uniquely identifies
the command during the process execution."
+- print " LineNum : Line number from the input HCC_PROF_FILE"
+- print " Name : Name of the record. For kernels, the kernel name.
For copy commands, the name contains the direction and size. For barrier commands the
name contains dependency counts and acquire and release fences."
++ print(" Resource : The resource this command executed on. May be GPU#
for a specific GPU or DATA to indicate data transfer command")
++ print(" Start(ms) : Start time of the command, displayed in ms.
Command start from time 0")
++ print(" +Time(us) : Time which the command contributed to the
'critical' path ")
++ print(" Type : Type of the command (kernel, barrier, copy)")
++ print(" Dev.Q.Cmd : The command sequm is a unique mononotically
increasing number per-queue, so the triple of device.queue.cmdseqnum uniquely identifies
the command during the process execution.")
++ print(" LineNum : Line number from the input HCC_PROF_FILE")
++ print(" Name : Name of the record. For kernels, the kernel name.
For copy commands, the name contains the direction and size. For barrier commands the
name contains dependency counts and acquire and release fences.")
+
+
+- print "%4s %16s %8s %7s %10s %10s %-30s" % \
+- ("Resource", "Start(ms)", "+Time(us)",
"Type", "#Dev.Q.Cmd", "LineNum", "Name")
++ print("%4s %16s %8s %7s %10s %10s %-30s" % \
++ ("Resource", "Start(ms)", "+Time(us)",
"Type", "#Dev.Q.Cmd", "LineNum", "Name"))
+
+ def printOneLine(self, startTime, lineNum):
+ if lineNum == self.lineNum:
+@@ -280,7 +280,7 @@ class ProfileLogRecord:
+ try:
+ t = self.text.getLineText(lineNum)
+ if (t != None):
+- print t
++ print(t)
+ except ValueError:
+ None
+
+@@ -299,23 +299,23 @@ class ProfileLogRecord:
+ break;
+ markers = markerCnt * "=="
+ #markers += self.gapName()
+- print "%4s %16.6f: %+10.2f %-7s %10s %-30s" % \
++ print("%4s %16.6f: %+10.2f %-7s %10s %-30s" % \
+ (Resource.getName(self),\
+ (self.startTime - self.gapFromPrev - timeOffset)/1000000.0, \
+ self.gapFromPrev/1000.0, \
+- "gap", "", markers)
++ "gap", "", markers))
+
+ if (self.criticalTime == None):
+ time = 0
+ else:
+ time = self.criticalTime
+
+- print "%4s %16.6f: %+10.2f %-7s #%d.%d.%d %8d: %-30s" % \
++ print("%4s %16.6f: %+10.2f %-7s #%d.%d.%d %8d: %-30s" % \
+ (Resource.getName(self), \
+ (self.startTime - timeOffset) / 1000000.0, time/1000.0, \
+ self.type,
+ self.device, self.queue, self.cmdNum,
+- self.lineNum, self.name),
++ self.lineNum, self.name), end=' ')
+
+ #if (self.cmdNum != None):
+ # try:
+@@ -330,7 +330,7 @@ class ProfileLogRecord:
+ # ((self.startTime - timeOffset)/1000000.0, \
+ # (self.stopTime - timeOffset)/1000000.0),
+
+- print ""
++ print("")
+
+
+ def printJSON(self, file, timeOffset=0):
+@@ -406,8 +406,8 @@ class ProfileSummaryRecord:
+
+ @staticmethod
+ def printHeader():
+- print "%14s %11s %8s %8s %8s %8s %-30s" % \
+- ("Total(%)", "Time(us)", "Calls",
"Avg(us)", "Min(us)", "Max(us)", "Name")
++ print("%14s %11s %8s %8s %8s %8s %-30s" % \
++ ("Total(%)", "Time(us)", "Calls",
"Avg(us)", "Min(us)", "Max(us)", "Name"))
+
+
+ def printMe(self, totalTimeNs):
+@@ -416,10 +416,10 @@ class ProfileSummaryRecord:
+ else:
+ timeUs = self.totalCriticalTime / 1000.0;
+
+- print "%13.2f%% %10.1f %8d %8.1f %8.1f %8.1f %-30s" %\
++ print("%13.2f%% %10.1f %8d %8.1f %8.1f %8.1f %-30s" %\
+ (self.totalCriticalTime*100.0/totalTimeNs, timeUs,
+ self.refs,
+- timeUs/self.refs, self.minTime/1000.0, self.maxTime/1000.0,
self.name)
++ timeUs/self.refs, self.minTime/1000.0, self.maxTime/1000.0,
self.name))
+
+
+ """
+@@ -455,7 +455,7 @@ class Resource:
+ elif lr.isCopyCmd():
+ return "DATA"
+ else:
+- print "warning:unknown type='%s'" % ( lr.type )
++ print("warning:unknown type='%s'" % ( lr.type ))
+ return None
+
+ def selectMaxTime(self, roiTime):
+@@ -490,14 +490,14 @@ class Resource:
+
+ def printSummary(self, roiTime):
+
+- sortByTime = sorted(self.summaryByName.iteritems(), key=lambda x:
x[1].totalCriticalTime, reverse=True)
++ sortByTime = sorted(iter(self.summaryByName.items()), key=lambda x:
x[1].totalCriticalTime, reverse=True)
+
+ maxToPrint = args.topn
+ if maxToPrint < 0 or maxToPrint > len(sortByTime) :
+ maxToPrint = len(sortByTime)
+
+- print "Resource=%s Showing %d/%d records %6.2f%% busy" % \
+- (self.name, maxToPrint, len(sortByTime), self.busyTime*100.0/roiTime)
++ print("Resource=%s Showing %d/%d records %6.2f%% busy" % \
++ (self.name, maxToPrint, len(sortByTime), self.busyTime*100.0/roiTime))
+
+ time = self.selectMaxTime(roiTime)
+
+@@ -512,7 +512,7 @@ class Resource:
+
+ def printJSON(self, file):
+ for q in self.opsPerQueue:
+- print "Q=", q
++ print("Q=", q)
+ file.write('{ "name": "thread_name", "ph":
"M", "pid": 1, "tid":%d ,\n' % (q))
+ file.write(' "args": { "name" :
"stream:%d" }\n' % (q))
+ file.write('},\n')
+@@ -567,11 +567,11 @@ class FileParser:
+ self.roiStop = self.profileLogRecords[self.roiStopIndex]
+
+ if show:
+- print "ROI_START:",
++ print("ROI_START:", end=' ')
+ self.roiStart.printMe(self.roiStart.startTime)
+- print "ROI_STOP :" ,
++ print("ROI_STOP :", end=' ')
+ self.roiStop.printMe(self.roiStart.startTime) # yes, this should be
startTime
+- print "ROI_TIME=%8.3f secs" % ((self.roiStop.stopTime -
self.roiStart.startTime)/1000000000.0)
++ print("ROI_TIME=%8.3f secs" % ((self.roiStop.stopTime -
self.roiStart.startTime)/1000000000.0))
+
+ assert (self.roiStartIndex <= self.roiStopIndex)
+ assert (self.roiStartIndex >=0 and
self.roiStartIndex<len(self.profileLogRecords))
+@@ -649,7 +649,7 @@ class FileParser:
+ if lineNum != None:
+ leadingNumbers -= 1
+ if leadingNumbers <= 0:
+- print "info: %%roi regular expression matched @%d
'%s'" %(lineNum, line.rstrip())
++ print("info: %%roi regular expression matched @%d
'%s'" %(lineNum, line.rstrip()))
+ return (lri, lineNum)
+
+ raise Exception ("roi search string not found=", roiStr)
+@@ -660,7 +660,7 @@ class FileParser:
+
+ def printSummary(self):
+ for r in self.resources:
+- print
++ print()
+
self.resources[r].printSummary(self.roiStop.stopTime-self.roiStart.startTime)
+
+
+--
+2.17.2
+
diff --git a/hcc.spec b/hcc.spec
new file mode 100644
index 0000000..e30bb91
--- /dev/null
+++ b/hcc.spec
@@ -0,0 +1,284 @@
+%global rocm_version 2.0.0
+
+%global hcc_clang_upgrade_commit 6ec3c61e09fbb60373eaf5a40021eb862363ba2c
+%global hcc_clang_upgrade_shortcommit %(c=%{hcc_clang_upgrade_commit}; echo ${c:0:7})
+
+%global llvm_commit roc-%{rocm_version}
+%global lld_commit roc-%{rocm_version}
+%global rocdl_commit roc-%{rocm_version}
+
+%global __requires_exclude libLLVM-8-rocm.so
+
+%global hcc_version_major 1
+%global hcc_version_minor 3
+# This comes is generated by using the commit date of the most recent commit:
+# COMMIT_DATE=`git show -s --format=@%ct`
+# date -d $COMMIT_DATE --utc '+%y%U%w'
+# hip will fail to build if we don't set this.
+# Only update this for each new feature release e.g. ROCm 1.7.0 and not for bug
+# fix releases e.g. ROCm 1.7.1.
+%global hcc_version_patch 18505
+
+%ifarch aarch64
+%global llvm_native_target AArch64
+%endif
+
+%ifarch x86_64
+%global llvm_native_target X86
+%endif
+
+
+Name: hcc
+Version: %{hcc_version_major}.%{hcc_version_minor}.%{hcc_version_patch}
+Release: 2.rocm%{rocm_version}%{?dist}
+Summary: HCC C++ Compiler
+
+# stl-test/*.pl.in are ASL 2.0
+# utils/gtest is BSD
+# lib/hsa/unpinnned_copy_engine.* and hc2/external/elfio are MIT
+
+License: NCSA and ASL 2.0 and BSD and MIT
+URL:
https://github.com/RadeonOpenCompute/ROCm
+Source0:
https://github.com/RadeonOpenCompute/hcc/archive/roc-%{rocm_version}/hcc-...
+Source1:
https://github.com/RadeonOpenCompute/hcc-clang-upgrade/archive/%{hcc_clan...
+Source2:
https://github.com/RadeonOpenCompute/llvm/archive/%{llvm_commit}/llvm-roc...
+Source3:
https://github.com/RadeonOpenCompute/lld/archive/%{lld_commit}/lld-roc-%{...
+Source4:
https://github.com/RadeonOpenCompute/ROCm-Device-Libs/archive/%{rocdl_com...
+
+Patch0: 0001-Remove-compiler-rt-dependency.patch
+Patch1: 0001-Look-for-rocm_agent_enumerator-in-usr-bin.patch
+Patch2: 0001-Disable-compiler-rt-build.patch
+Patch4: 0001-Remove-compiler-rt-install-target.patch
+Patch5: 0001-Load-opt-plugins-from-BINDIR-lib64.patch
+Patch6: 0001-Hard-code-rocm-device-libs-search-path-to-usr-share-.patch
+Patch7: 0001-Remove-broken-rocdl-symlinks.patch
+Patch8: 0001-Make-HCC_VERSION_PATCH-configurable.patch
+Patch9: 0001-Dont-force-libdir-to-lib.patch
+Patch10: 0001-Install-headers-to-usr-include-hcc.patch
+Patch11: 0001-Set-version-for-shared-libraries.patch
+Patch12: 0001-rpt-Convert-to-python3.patch
+Patch13: 0001-Install-irif.amdgcn.bc.patch
+Patch14: 0001-hcc-config-Add-usr-include-hcc-to-include-directorie.patch
+Patch15: 0001-Install-experimental-headers-to-include-hc.patch
+Patch16: 0001-Fix-paths-in-hcc-config.cmake.in.patch
+Patch17: 0001-Install-internal-tools-to-libexecdir.patch
+Patch18: 0001-Build-mcwamp_atomic-as-a-shared-library.patch
+Patch19: 0001-Don-t-override-CMAKE_CXX_FLAGS-when-building-hcc-con.patch
+Patch20: 0001-Filter-out-cxx-flags-not-supported-by-hcc-when-build.patch
+
+
+ExclusiveArch: x86_64 aarch64
+
+BuildRequires: cmake
+BuildRequires: hsakmt-devel
+BuildRequires: rocm-runtime-devel = %{rocm_version}
+BuildRequires: gcc-c++
+# We need python3-devel for pathfix.py
+BuildRequires: python3-devel
+# Need because the hcc runtime libraries have enabled excutable stacks.
+BuildRequires: execstack
+
+# gcc-c++ is required because it installs the symlink libstdc++.so, which is
+# needed when passing -lstdc++ to the linker.
+Requires: gcc-c++
+Requires: libstdc++-devel
+Requires: file
+Requires: rocm-device-libs
+Requires: hcc-runtime-devel
+Requires: rocminfo
+
+# The bundled version is a trunk snapshot between 7.0.0 and 8.0.0.
+Provides: bundled(llvm)
+
+%description
+Heterogeneous C++ Compiler supporting offload to AMD GPUs via the
+Radeon Open Compute (ROCm) runtime.
+
+%package runtime
+Summary: HCC runtime libraries
+
+%description runtime
+HCC runtime libraries
+
+%package runtime-devel
+Summary: Development files for HCC runtime libraries
+Requires: %{name}-runtime%{?_isa} = %{version}-%{release}
+
+%description runtime-devel
+Development files for HCC runtime libraries
+
+
+%package -n rocm-device-libs
+Summary: ROCm device library
+BuildArch: noarch
+Version: 0.0.1
+
+%description -n rocm-device-libs
+ROCm device library
+
+%prep
+
+%setup -T -q -b 4 -n ROCm-Device-Libs-%{rocdl_commit}
+
+%setup -T -q -b 1 -n hcc-clang-upgrade-%{hcc_clang_upgrade_commit}
+
+%patch0 -p1 -b .no-compiler-rt
+%patch1 -p1 -b .agent-enumerator
+
+%setup -T -q -b 3 -n lld-%{lld_commit}
+
+%setup -T -q -b 2 -n llvm-%{llvm_commit}
+
+
+%setup -q -n hcc-roc-%{rocm_version}
+%patch2 -p1 -b .disable-compiler-rt
+%patch4 -p1 -b .remove-compiler-rt-install
+%patch5 -p1 -b .plugin-dir
+%patch6 -p1 -b .rocm-search-path
+%patch7 -p1 -b .fix-rocdl-symlinks
+%patch8 -p1 -b .hcc-version
+%patch9 -p1 -b .lib64-install
+%patch10 -p1 -b .headers-install
+%patch11 -p1 -b .shlib-versions
+%patch12 -p1 -b .rpt-py3
+%patch13 -p1 -b .irif
+%patch14 -p1 -b .hcc-config-headers
+%patch15 -p1 -b .experimental-headers-install
+%patch16 -p1 -b .fix-hcc-config-paths
+%patch17 -p1 -b .tools-install
+%patch18 -p1 -b .atomic-shared
+%patch19 -p1 -b .hcc-config-cxxflags
+%patch20 -p1 -b .runtime-cxxflags
+
+pathfix.py -i %{__python3} lib/rpt
+
+mv ../llvm-%{llvm_commit}/* compiler
+mv ../hcc-clang-upgrade-%{hcc_clang_upgrade_commit}/* clang
+mv ../lld-%{lld_commit}/* lld
+mv ../ROCm-Device-Libs-%{rocdl_commit}/* rocdl
+
+%build
+
+%global llvm_tools llc llvm-as llvm-dis llvm-link llvm-objdump opt clang-offload-bundler
+
+mkdir build
+cd build
+
+%cmake .. \
+ -DCMAKE_INSTALL_PREFIX=%{buildroot}%{_prefix} \
+ -DCMAKE_BUILD_TYPE=RELWITHDEBINFO \
+%if 0%{?__isa_bits} == 64
+ -DLLVM_LIBDIR_SUFFIX=64 \
+%else
+ -DLLVM_LIBDIR_SUFFIX= \
+%endif
+ -DBUILD_SHARED_LIBS=OFF \
+ -DLLVM_ENABLE_ASSERTIONS=Off \
+ -DAMDGPU_TARGET=auto \
+ -DLLVM_TARGETS_TO_BUILD="AMDGPU;%{llvm_native_target}" \
+ -DENABLE_LINKER_BUILD_ID=ON \
+ -DLLVM_BUILD_LLVM_DYLIB=ON \
+ -DLLVM_LINK_LLVM_DYLIB=ON \
+ -DLLVM_VERSION_SUFFIX="-rocm" \
+ -DLLVM_INCLUDE_EXAMPLES=off \
+ -DHCC_VERSION_PATCH="%{hcc_version_patch}" \
+ -DROCM_DEVICE_LIB=%{_datadir}/rocm/ \
+ -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
+ -DROCM_ROOT=%{_prefix}
+
+
+# HACK so that the custom CLANG_RESOURCE_DIR we use works when clang is called
+# from the build directory.
+ln -s %{_builddir}/hcc-%{hcc_commit}/build/compiler/%{_lib}/clang/8.0.0
compiler/bin/hcc-resource-dir
+
+# HACK So that hcc can find the plugins from the build directory
+ln -s %{_builddir}/hcc-%{hcc_commit}/build/compiler/%{_lib} compiler/bin/lib64
+
+make %{?_smp_mflags} \
+ clang \
+ lld \
+ %{llvm_tools} \
+ LLVMSelectAcceleratorCode \
+ LLVMPromotePointerKernArgsToGlobal \
+ hcc-config \
+ mcwamp_hsa \
+ mcwamp \
+ rocdl_links
+
+%install
+mkdir -p %{buildroot}%{_libexecdir}/hcc/%{_lib}
+cd build
+
+make -C hcc_config install
+
+make -C lib install
+
+# Disable executable stack for runtime libraries.
+execstack -c %{buildroot}%{_libdir}/*.so.%{hcc_version_major}.%{hcc_version_minor}
+
+make -C include install
+
+# Remove installed CMakeLists.txt file
+rm %{buildroot}%{_includedir}/hcc/CMakeLists.txt.headers-install
+
+# Install ROCm device libs
+mkdir -p %{buildroot}%{_datadir}/rocm
+install -m 0644 rocdl/lib/*.bc %{buildroot}%{_datadir}/rocm
+
+install -m 0755 compiler/bin/hcc %{buildroot}%{_libexecdir}/hcc/bin/
+ln -s %{_libexecdir}/hcc/bin/hcc %{buildroot}%{_bindir}/hcc
+for f in %{llvm_tools} lld; do
+ install -m 0755 compiler/bin/$f %{buildroot}%{_libexecdir}/hcc/bin/
+done
+ln -s lld %{buildroot}%{_libexecdir}/hcc/bin/ld.lld
+
+# Install internal headers for hcc
+mv compiler/%{_lib}/clang/ %{buildroot}%{_libexecdir}/hcc/%{_lib}
+
+# Install plugins. Make these executable, so find-debuginfo.sh will strip them.
+install -m 0755 compiler/%{_lib}/LLVMSelectAcceleratorCode.so
%{buildroot}%{_libexecdir}/hcc/%{_lib}
+install -m 0755 compiler/%{_lib}/LLVMPromotePointerKernArgsToGlobal.so
%{buildroot}%{_libexecdir}/hcc/%{_lib}
+
+install -m 0755 compiler/%{_lib}/libLLVM-8-rocm.so
%{buildroot}%{_libexecdir}/hcc/%{_lib}
+
+# Install some stray cmake files
+install -m 0644 ../scripts/cmake/ImportedTargets.cmake %{buildroot}%{_libdir}/cmake/hcc
+
+%files
+%doc README.md
+%license LICENSE.TXT
+%{_libexecdir}/hcc/
+%{_bindir}/hcc
+%{_bindir}/hcc-config
+%{_bindir}/clamp-config
+%{_bindir}/extractkernel
+%{_bindir}/rpt
+
+%files -n rocm-device-libs
+%license rocdl/LICENSE
+%{_datadir}/rocm/
+
+%files runtime
+%license LICENSE.TXT
+%{_libdir}/libhc_am.so.%{hcc_version_major}.%{hcc_version_minor}
+%{_libdir}/libmcwamp_hsa.so.%{hcc_version_major}.%{hcc_version_minor}
+%{_libdir}/libmcwamp.so.%{hcc_version_major}.%{hcc_version_minor}
+%{_libdir}/libmcwamp_cpu.so.%{hcc_version_major}.%{hcc_version_minor}
+%{_libdir}/libmcwamp_atomic.so.%{hcc_version_major}.%{hcc_version_minor}
+
+%files runtime-devel
+%{_libdir}/libhc_am.so
+%{_libdir}/libmcwamp_hsa.so
+%{_libdir}/libmcwamp.so
+%{_libdir}/libmcwamp_cpu.so
+%{_libdir}/libmcwamp_atomic.so
+%{_includedir}/hcc/
+%{_libdir}/cmake/hcc/
+
+
+%changelog
+* Tue Feb 12 2019 Tom Stellard <tstellar(a)redhat.com> - 1.3.18505-2.rocm2.0.0
+- Address some review comments
+
+* Wed Jan 16 2019 Tom Stellard <tstellar(a)redhat.com> - 1.3.18505-1.rocm2.0.0
+- ROCm 2.0.0 Release
diff --git a/sources b/sources
new file mode 100644
index 0000000..4eb8521
--- /dev/null
+++ b/sources
@@ -0,0 +1,5 @@
+SHA512 (device-libs-2.0.0.tar.gz) =
47609ab22e3b78a024ba30b67f25752d2ead8276f7e06305f8ef8b03502a8a0fbe18d87f03e0b0f8924773a55b88767c9bfb167e0baec4a8ed8178916b8b652a
+SHA512 (hcc-clang-upgrade-6ec3c61e09fbb60373eaf5a40021eb862363ba2c-roc-2.0.0.tar.gz) =
6185c92bfb96c969b0b33260ea59a48f79c29f24ab3c784be49efea468844e95efefefb464f431c94043d06ebd203660b22568fab87eb7f7b48b1b107d281f6b
+SHA512 (hcc-roc-2.0.0.tar.gz) =
c9d912438f7fbef84b18eea94d3704b055ff306c65573edacbf0bb2f6d6ca94f26c9980d1a8682152f06af22020c6c38e4859d762ba3573ba539637ca7a3a56a
+SHA512 (lld-roc-2.0.0.tar.gz) =
04bcf320a961b3b4d0b2776aa63f828bd13d058fcd6dc3397d7e995da1f4c9939dcaf33484906296c6732ba6faf760058d3b37c6304c6d47a97fb3aeb2074903
+SHA512 (llvm-roc-2.0.0.tar.gz) =
0a0bb1b6877d47cb066c96991e6f49ee6a9c1dbbacb1c6f9c990fb0e9c5e34735bd4b607c9037d42aace690c9c669a511f63d812479293d17d794acfe028be8a