The package rpms/rocm-opencl.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/rocm-opencl.git/commit/?id=60249d...
https://src.fedoraproject.org/cgit/rpms/rocm-opencl.git/commit/?id=ef3caf....
Change:
+ExclusiveArch: x86_64 aarch64
+ExclusiveArch: x86_64 aarch64 ppc64le
Thanks.
Full change:
============
commit f0803bd968e87cd526314d752a56b241f4b645df
Author: Jeremy Newton <Jeremy.Newton(a)amd.com>
Date: Tue Jul 5 17:46:09 2022 -0400
Update to 5.2.0
This is the output of the initial package review with some fixes.
Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
diff --git a/.gitignore b/.gitignore
index 452c8a3..05fec7c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
/ROCclr-5.0.2.tar.gz
/ROCm-OpenCL-Runtime-5.0.2.tar.gz
+/ROCclr-5.2.0.tar.gz
+/ROCm-OpenCL-Runtime-5.2.0.tar.gz
diff --git a/0001-SWDEV-321118-Use-GNUInstallDirs.patch
b/0001-SWDEV-321118-Use-GNUInstallDirs.patch
deleted file mode 100644
index 853d8b4..0000000
--- a/0001-SWDEV-321118-Use-GNUInstallDirs.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From b2adcd6bb9be35291c8389d4c04cecd4703c38fd Mon Sep 17 00:00:00 2001
-From: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Date: Mon, 31 Jan 2022 17:54:14 -0500
-Subject: [PATCH 1/4] SWDEV-321118 - Use GNUInstallDirs
-
-Use GNUInstallDirs variables to determine the location of BINDIR,
-LIBDIR, DOCDIR, and SYSCONFDIR.
-
-Note that CMAKE_INSTALL_LIBDIR is overriden, since the default for RHEL
-is lib64, but ROCm packaging wants it to be lib always. Distros or users
-can easily override this.
-
-Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Change-Id: Ifb38263dce80d80c5ebb4eacd8e49c76bb013a44
----
- CMakeLists.txt | 5 ++++-
- packaging/rocm-ocl-icd.postinst | 4 ++--
- packaging/rocm-ocl-icd.prerm | 4 ++--
- packaging/rocm-ocl-icd.txt | 8 ++++----
- packaging/rocm-opencl.txt | 6 +++---
- 5 files changed, 15 insertions(+), 12 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 4464ed0..9849ec8 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -7,6 +7,9 @@ endif()
-
- project(opencl)
-
-+# Set default libdir to be "lib" for ROCm, distros will override this anyway:
-+set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library install
directory")
-+
- include(GNUInstallDirs)
-
- option(BUILD_TESTS "Enable building OpenCL tests" OFF)
-@@ -25,7 +28,7 @@ endif()
-
- # DEV package
- install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL"
-- DESTINATION include
-+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
- COMPONENT DEV
- USE_SOURCE_PERMISSIONS
- PATTERN cl_d3d10.h EXCLUDE
-diff --git a/packaging/rocm-ocl-icd.postinst b/packaging/rocm-ocl-icd.postinst
-index 0780970..7c46ade 100644
---- a/packaging/rocm-ocl-icd.postinst
-+++ b/packaging/rocm-ocl-icd.postinst
-@@ -6,8 +6,8 @@ INSTALL_PATH=@CPACK_PACKAGING_INSTALL_PREFIX@
- ROCM_LIBPATH=@ROCM_PATH@/lib
-
- do_ldconfig() {
-- echo ${INSTALL_PATH}/lib > /etc/ld.so.conf.d/10-rocm-opencl.conf &&
ldconfig
-- mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so >
/etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@)
-+ echo ${INSTALL_PATH}/@CMAKE_INSTALL_LIBDIR@ >
/@CMAKE_INSTALL_SYSCONFDIR(a)/ld.so.conf.d/10-rocm-opencl.conf && ldconfig
-+ mkdir -p /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors && (echo libamdocl64.so
> /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@)
- }
-
- case "$1" in
-diff --git a/packaging/rocm-ocl-icd.prerm b/packaging/rocm-ocl-icd.prerm
-index 9fc6c8d..e0b5417 100644
---- a/packaging/rocm-ocl-icd.prerm
-+++ b/packaging/rocm-ocl-icd.prerm
-@@ -3,8 +3,8 @@
- set -e
-
- rm_ldconfig() {
-- rm -f /etc/ld.so.conf.d/10-rocm-opencl.conf && ldconfig
-- rm -f /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@
-+ rm -f /@CMAKE_INSTALL_SYSCONFDIR(a)/ld.so.conf.d/10-rocm-opencl.conf &&
ldconfig
-+ rm -f /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@
- }
-
- case "$1" in
-diff --git a/packaging/rocm-ocl-icd.txt b/packaging/rocm-ocl-icd.txt
-index 66e3863..63f60ad 100644
---- a/packaging/rocm-ocl-icd.txt
-+++ b/packaging/rocm-ocl-icd.txt
-@@ -1,10 +1,10 @@
- cmake_minimum_required(VERSION 3.5.1)
- project(rocm-ocl-icd)
-
--install(FILES @PROJECT_BINARY_DIR(a)/khronos/icd/libOpenCL.so DESTINATION lib)
--install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_MAJOR@
DESTINATION lib)
--install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_STRING@
DESTINATION lib)
--install(FILES @opencl_SOURCE_DIR@/khronos/icd/LICENSE DESTINATION
share/doc/rocm-ocl-icd)
-+install(FILES @PROJECT_BINARY_DIR(a)/khronos/icd/libOpenCL.so DESTINATION
${CMAKE_INSTALL_LIBDIR})
-+install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_MAJOR@
DESTINATION ${CMAKE_INSTALL_LIBDIR})
-+install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_STRING@
DESTINATION ${CMAKE_INSTALL_LIBDIR})
-+install(FILES @opencl_SOURCE_DIR@/khronos/icd/LICENSE DESTINATION
${CMAKE_INSTALL_DATADIR}/doc/rocm-ocl-icd)
-
- #############################
- # Packaging steps
-diff --git a/packaging/rocm-opencl.txt b/packaging/rocm-opencl.txt
-index 830c378..65707b0 100644
---- a/packaging/rocm-opencl.txt
-+++ b/packaging/rocm-opencl.txt
-@@ -1,9 +1,9 @@
- cmake_minimum_required(VERSION 3.5.1)
- project(rocm-opencl)
-
--install(PROGRAMS @PROJECT_BINARY_DIR@/tools/clinfo/clinfo DESTINATION bin)
--install(FILES @PROJECT_BINARY_DIR(a)/amdocl/libamdocl64.so DESTINATION lib)
--install(FILES @opencl_SOURCE_DIR(a)/LICENSE.txt DESTINATION share/doc/rocm-opencl)
-+install(PROGRAMS @PROJECT_BINARY_DIR@/tools/clinfo/clinfo DESTINATION
${CMAKE_INSTALL_BINDIR})
-+install(FILES @PROJECT_BINARY_DIR(a)/amdocl/libamdocl64.so DESTINATION
${CMAKE_INSTALL_LIBDIR})
-+install(FILES @opencl_SOURCE_DIR(a)/LICENSE.txt DESTINATION
${CMAKE_INSTALL_DATADIR}/doc/rocm-opencl)
-
- #############################
- # Packaging steps
---
-2.35.3
-
diff --git a/0001-SWDEV-323669-Fix-linux-arch-detection.patch
b/0001-SWDEV-323669-Fix-linux-arch-detection.patch
deleted file mode 100644
index 0ef6922..0000000
--- a/0001-SWDEV-323669-Fix-linux-arch-detection.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 211c1c4d8c7f6dac48ba6c73256da60955f9dbd1 Mon Sep 17 00:00:00 2001
-From: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Date: Thu, 17 Feb 2022 09:05:56 -0500
-Subject: [PATCH] SWDEV-323669 - Fix linux arch detection
-
-CMake assumes we're bundling on x86, but for GNU compatible compilers,
-we should rely on the compiler target to set the build arch.
-
-For non-gnu compilers, just fall back to assuming x86 (no change).
-
-Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Change-Id: Iee9794e6f7c3973c781ddaf740ded77f34712c4f
----
- cmake/ROCclr.cmake | 1 -
- include/top.hpp | 10 ++++++++++
- 2 files changed, 10 insertions(+), 1 deletion(-)
-
-diff --git a/cmake/ROCclr.cmake b/cmake/ROCclr.cmake
-index 2f6ff8c1..e4d0cdc1 100644
---- a/cmake/ROCclr.cmake
-+++ b/cmake/ROCclr.cmake
-@@ -100,7 +100,6 @@ if(NOT CMAKE_CL_64)
- endif()
-
- target_compile_definitions(rocclr PUBLIC
-- ATI_ARCH_X86
- LITTLEENDIAN_CPU
- WITH_LIQUID_FLASH=0
- ${AMD_OPENCL_DEFS})
-diff --git a/include/top.hpp b/include/top.hpp
-index f51db7d1..70273510 100644
---- a/include/top.hpp
-+++ b/include/top.hpp
-@@ -21,6 +21,16 @@
- #ifndef TOP_HPP_
- #define TOP_HPP_
-
-+#if defined(__GNUC__)
-+#if defined(__arm__) || defined(__aarch64__)
-+#define ATI_ARCH_ARM
-+#elif defined(__x86__) || defined(__x86_64__)
-+#define ATI_ARCH_X86
-+#endif
-+#else /*!__GNUC__*/
-+#define ATI_ARCH_X86
-+#endif /*!__GNUC__*/
-+
- #if defined(ATI_ARCH_ARM)
- #define __EXPORTED_HEADERS__ 1
- #endif /*ATI_ARCH_ARM*/
---
-2.34.1
-
diff --git a/0001-SWDEV-323669-Improve-arch-detection.patch
b/0001-SWDEV-323669-Improve-arch-detection.patch
deleted file mode 100644
index 0d91ab2..0000000
--- a/0001-SWDEV-323669-Improve-arch-detection.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-From e373cba2fb2d458239918eb1f957e919e65d7a3c Mon Sep 17 00:00:00 2001
-From: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Date: Wed, 6 Apr 2022 11:07:35 -0400
-Subject: [PATCH] SWDEV-323669 - Improve arch detection
-
-- Clean up detection by using visual studio macros to detect arch; I
- didn't list all possible ARM platforms (can be done later if desired)
-- Fixed two incorrect uses of !defined(ATI_ARCH_ARM) to instead use
- defined(ATI_ARCH_X86), as they contain X86 specific code
-- Fixed one use of __ARM_ARCH_7A__ to use ATI_ARCH_ARM instead
-
-This is an improvement to the fixes in the last patch for SWDEV-323669
-
-Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Change-Id: I8568167293c34ad5331902105877f3ab6e25acb3
----
- include/top.hpp | 12 ++++--------
- os/os.cpp | 2 +-
- os/os_posix.cpp | 6 +++---
- 3 files changed, 8 insertions(+), 12 deletions(-)
-
-diff --git a/include/top.hpp b/include/top.hpp
-index 70273510..d6aa00c8 100644
---- a/include/top.hpp
-+++ b/include/top.hpp
-@@ -21,15 +21,11 @@
- #ifndef TOP_HPP_
- #define TOP_HPP_
-
--#if defined(__GNUC__)
--#if defined(__arm__) || defined(__aarch64__)
-+#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__arm) ||
defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || defined(_M_ARM64)
- #define ATI_ARCH_ARM
--#elif defined(__x86__) || defined(__x86_64__)
-+#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) ||
defined(__x86__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) ||
defined(__amd64__) || defined(_M_X64) || defined(_M_AMD64)
- #define ATI_ARCH_X86
- #endif
--#else /*!__GNUC__*/
--#define ATI_ARCH_X86
--#endif /*!__GNUC__*/
-
- #if defined(ATI_ARCH_ARM)
- #define __EXPORTED_HEADERS__ 1
-@@ -51,9 +47,9 @@
- #define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035
- #endif
-
--#if !defined(ATI_ARCH_ARM)
-+#if defined(ATI_ARCH_X86)
- #include <xmmintrin.h>
--#endif /*!ATI_ARCH_ARM*/
-+#endif /*ATI_ARCH_X86*/
-
- #include <atomic>
- #include <cstdint>
-diff --git a/os/os.cpp b/os/os.cpp
-index f5ea547d..0437f7f1 100644
---- a/os/os.cpp
-+++ b/os/os.cpp
-@@ -112,7 +112,7 @@ int Os::processorCount_ = 0;
- void Os::spinPause() {
- #if defined(ATI_ARCH_X86)
- _mm_pause();
--#elif defined(__ARM_ARCH_7A__)
-+#elif defined(ATI_ARCH_ARM)
- __asm__ __volatile__("yield");
- #endif
- }
-diff --git a/os/os_posix.cpp b/os/os_posix.cpp
-index dd1e61fc..aa43a773 100644
---- a/os/os_posix.cpp
-+++ b/os/os_posix.cpp
-@@ -701,14 +701,14 @@ void Os::setCurrentStackPtr(address sp) {
- sp -= sizeof(void*);
- *(void**)sp = __builtin_return_address(0);
-
--#if defined(ATI_ARCH_ARM)
-- assert(!"Unimplemented");
--#else
-+#if defined(ATI_ARCH_X86)
- __asm__ __volatile__(
- #if !defined(OMIT_FRAME_POINTER)
- LP64_SWITCH("movl (%%ebp),%%ebp;", "movq (%%rbp),%%rbp;")
- #endif // !OMIT_FRAME_POINTER
- LP64_SWITCH("movl %0,%%esp; ret;", "movq %0,%%rsp;
ret;")::"r"(sp));
-+#else
-+ assert(!"Unimplemented");
- #endif
- }
-
---
-2.35.1
-
diff --git a/0002-SWDEV-321116-Allow-disabling-ICD-loader.patch
b/0002-SWDEV-321116-Allow-disabling-ICD-loader.patch
deleted file mode 100644
index 76876b3..0000000
--- a/0002-SWDEV-321116-Allow-disabling-ICD-loader.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From fff4ab16df4ca9a76fe3f648c76aefd267ee45b4 Mon Sep 17 00:00:00 2001
-From: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Date: Wed, 6 Apr 2022 15:07:13 -0400
-Subject: [PATCH 2/4] SWDEV-321116 - Allow disabling ICD loader
-
-This patch adds an option (BUILD_ICD) to toggle the ICD loader build
-with rocm-opencl. This isn't useful for official ROCm use, but distros
-or users may want build rocm-opencl with their own OCL ICD loader.
-
-The default option is BUILD_ICD=ON.
-If this option is set to OFF, an OpenCL OCD loader must be installed
-prior to attempting to build rocm-opencl.
-
-E.g. distros already provide ocl icd loader packages:
-sudo yum install ocd-icd-devel
-sudo apt-get install ocl-icd-opencl-dev
-sudo zypper install ocd-icd-devel
-
-Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Change-Id: I6006593eceed543cd829e8949ec2256482815673
----
- CMakeLists.txt | 15 ++++++++++++---
- packaging/rocm-ocl-icd.txt | 2 ++
- 2 files changed, 14 insertions(+), 3 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 9849ec8..c4197ec 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -13,10 +13,15 @@ set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library
install directory")
- include(GNUInstallDirs)
-
- option(BUILD_TESTS "Enable building OpenCL tests" OFF)
-+option(BUILD_ICD "Enable building OpenCL ICD Loader" ON)
- option(EMU_ENV "Enable building for emulation environment" OFF)
-
- set(OPENCL_ICD_LOADER_HEADERS_DIR
"${CMAKE_CURRENT_LIST_DIR}/khronos/headers/opencl2.2" CACHE PATH "")
--add_subdirectory(khronos/icd)
-+if(BUILD_ICD)
-+ add_subdirectory(khronos/icd)
-+else()
-+ find_package(OpenCL REQUIRED)
-+endif()
- add_subdirectory(amdocl)
- add_subdirectory(tools/clinfo)
- add_subdirectory(tools/cltrace)
-@@ -54,8 +59,10 @@ if (DEFINED ROCM_PATCH_VERSION)
- set(OPENCL_AMD_ICD_FILE "amdocl64_${ROCM_PATCH_VERSION}.icd")
- endif()
-
--get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION)
--get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION)
-+if(BUILD_ICD)
-+ get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION)
-+ get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION)
-+endif()
-
- set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/rocm/opencl" CACHE PATH "Package
Installation path for OpenCL")
-
-@@ -65,6 +72,7 @@ if(NOT DEFINED ROCM_PATH)
- endif()
- message (STATUS "ROCM Installation path(ROCM_PATH): ${ROCM_PATH}")
-
-+if(BUILD_ICD)
- # Package: rocm-ocl-icd
- set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/rocm-ocl-icd)
- configure_file(packaging/rocm-ocl-icd.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
-@@ -79,6 +87,7 @@ add_custom_target(pkg_rocm_ocl_icd COMMAND ${CMAKE_COMMAND}
-DROCM_DEP_ROCMCORE=
- COMMAND cp *.rpm ${PROJECT_BINARY_DIR}
- WORKING_DIRECTORY ${BUILD_DIR}
- DEPENDS amdocl OpenCL)
-+endif()
-
- # Package: rocm-opencl
- set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/rocm-opencl)
-diff --git a/packaging/rocm-ocl-icd.txt b/packaging/rocm-ocl-icd.txt
-index 63f60ad..08b1947 100644
---- a/packaging/rocm-ocl-icd.txt
-+++ b/packaging/rocm-ocl-icd.txt
-@@ -1,10 +1,12 @@
- cmake_minimum_required(VERSION 3.5.1)
- project(rocm-ocl-icd)
-
-+if(BUILD_ICD)
- install(FILES @PROJECT_BINARY_DIR(a)/khronos/icd/libOpenCL.so DESTINATION
${CMAKE_INSTALL_LIBDIR})
- install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_MAJOR@
DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_STRING@
DESTINATION ${CMAKE_INSTALL_LIBDIR})
- install(FILES @opencl_SOURCE_DIR@/khronos/icd/LICENSE DESTINATION
${CMAKE_INSTALL_DATADIR}/doc/rocm-ocl-icd)
-+endif()
-
- #############################
- # Packaging steps
---
-2.35.3
-
diff --git a/0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch
b/0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch
deleted file mode 100644
index 40743d5..0000000
--- a/0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 175968b622a730881dd8b936b9089a84b0dfeabc Mon Sep 17 00:00:00 2001
-From: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Date: Wed, 6 Apr 2022 18:37:47 -0400
-Subject: [PATCH 3/4] SWDEV-321116 - Drop unnecessary ICD include
-
-This looks unused. This should allow building rocm-opencl without any
-dependency on any particular OCL ICD.
-
-Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
-Change-Id: Ib9229ede8400fd0e883275659ab99513b03952cb
----
- amdocl/cl_execute.cpp | 2 --
- amdocl/cl_icd.cpp | 2 --
- 2 files changed, 4 deletions(-)
-
-diff --git a/amdocl/cl_execute.cpp b/amdocl/cl_execute.cpp
-index 71fe535..e1d5be2 100644
---- a/amdocl/cl_execute.cpp
-+++ b/amdocl/cl_execute.cpp
-@@ -27,8 +27,6 @@
- #include "platform/program.hpp"
- #include "os/os.hpp"
-
--#include <icd/loader/icd_dispatch.h>
--
- /*! \addtogroup API
- * @{
- *
-diff --git a/amdocl/cl_icd.cpp b/amdocl/cl_icd.cpp
-index 2a4f3af..4fce08b 100644
---- a/amdocl/cl_icd.cpp
-+++ b/amdocl/cl_icd.cpp
-@@ -27,8 +27,6 @@
- #include "cl_d3d11_amd.hpp"
- #endif //_WIN32
-
--#include <icd/loader/icd_dispatch.h>
--
- #include <mutex>
-
- amd::PlatformIDS amd::PlatformID::Platform = //{ NULL };
---
-2.35.3
-
diff --git a/0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
b/0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
index 325f937..846a877 100644
--- a/0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
+++ b/0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
@@ -1,4 +1,4 @@
-From 2cd867fdb94a608b5fc0ebe89149c4487ec5e59f Mon Sep 17 00:00:00 2001
+From 59e15ab918ee1823e1d289585d75686032a08909 Mon Sep 17 00:00:00 2001
From: Jeremy Newton <Jeremy.Newton(a)amd.com>
Date: Mon, 25 Apr 2022 12:33:46 -0400
Subject: [PATCH 4/4] SWDEV-336248 - Don't exclude cl_egl.h from install
@@ -15,23 +15,23 @@ projects.
Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
Change-Id: I506257c2dc51512ec8e11b1e5dadbe6e48ad785b
---
- CMakeLists.txt | 3 +--
+ packaging/CMakeLists.txt | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index c4197ec..6dabea7 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -38,8 +38,7 @@ install(DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL"
+diff --git a/packaging/CMakeLists.txt b/packaging/CMakeLists.txt
+index b6d206a..60050f3 100644
+--- a/packaging/CMakeLists.txt
++++ b/packaging/CMakeLists.txt
+@@ -18,8 +18,7 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/khronos/headers/opencl2.2/CL
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)
-+ PATTERN cl_dx9_media_sharing.h EXCLUDE)
+- PATTERN cl_egl.h EXCLUDE )
++ PATTERN cl_dx9_media_sharing.h EXCLUDE )
- #############################
- # Packaging steps
+ if(BUILD_ICD)
+ install(TARGETS OpenCL DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT icd )
--
-2.35.3
+2.34.1
diff --git a/rocm-opencl.spec b/rocm-opencl.spec
index 0e50f5d..fdfb57b 100644
--- a/rocm-opencl.spec
+++ b/rocm-opencl.spec
@@ -1,6 +1,6 @@
%global upstreamname ROCm-OpenCL-Runtime
-%global rocm_release 5.0
-%global rocm_patch 2
+%global rocm_release 5.2
+%global rocm_patch 0
%global rocm_version %{rocm_release}.%{rocm_patch}
#Set enable_ocltst to enable HW OCL test suite
@@ -19,18 +19,6 @@ License: MIT
Source0:
https://github.com/RadeonOpenCompute/%{upstreamname}/archive/refs/tags/ro...
Source1:
https://github.com/ROCm-Developer-Tools/ROCclr/archive/refs/tags/rocm-%{v...
-#https://github.com/ROCm-Developer-Tools/ROCclr/commit/211c1c4d8c7f6dac48ba6c73256da60955f9dbd1
-Patch0: 0001-SWDEV-323669-Fix-linux-arch-detection.patch
-#https://github.com/ROCm-Developer-Tools/ROCclr/commit/47150917c466e7b5df89cf18e9270d12ecb54ee6
-Patch1: 0001-SWDEV-323669-Improve-arch-detection.patch
-
-##The following are cherry-picked and rebased on 5.0.2:
-#https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/9afc68795b7f063e24d5585ee88497e6592d2c2e
-Patch101: 0001-SWDEV-321118-Use-GNUInstallDirs.patch
-#https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/33d345c490ab50d41cc04621ba656116afb36dc9
-Patch102: 0002-SWDEV-321116-Allow-disabling-ICD-loader.patch
-#https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/4b36f7363a228002b04ec1b07a519629dbecf137
-Patch103: 0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch
#https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/b98828a206fef952abe2f65c337dafe0316c9e9e
Patch104: 0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
@@ -46,7 +34,7 @@ BuildRequires: pkgconfig(ocl-icd)
BuildRequires: rocm-comgr-devel
BuildRequires: rocm-runtime-devel
-Requires: rocm-comgr%{?_isa}
+Requires: comgr(rocm) = %{rocm_release}
Requires: ocl-icd%{?_isa}
Requires: opencl-filesystem
@@ -178,5 +166,9 @@ mv %{buildroot}%{_bindir}/clinfo %{buildroot}%{_bindir}/rocm-clinfo
%{_bindir}/rocm-clinfo
%changelog
+* Sun Jul 05 2022 Jeremy Newton <alexjnewt at hotmail dot com> - 5.2.0-1
+- Update to 5.2.0
+- Use comgr(rocm) instead of rocm-comgr for requires for easier maintenance
+
* Tue Jul 05 2022 Jeremy Newton <alexjnewt at hotmail dot com> - 5.0.2-1
- Initial package
diff --git a/sources b/sources
index a702570..07cd952 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,2 @@
-SHA512 (ROCclr-5.0.2.tar.gz) =
b30a57c09973d8ef624511f422babaf9722685b9f85643783aebc000671b41fd54f44b308cece0baab187e1ee00b10335c6d22b6bad6fb3468abe6ef0da97d73
-SHA512 (ROCm-OpenCL-Runtime-5.0.2.tar.gz) =
fa01d1fafc890181b9e67070353ee7c9100619494b7509cae1a3659f24ef1d00f650024cb24bdb0e6e7eacfdec1115e4683ec6f320228a19f41ae83321780780
+SHA512 (ROCclr-5.2.0.tar.gz) =
d197e2719990bab907a5b14f0c5a0261fc03acd42cf494c9ec8c0d16504c8eae0f174981367a0ede056c16faa3796dd3548160329ebb98f5658545573a0bc0b6
+SHA512 (ROCm-OpenCL-Runtime-5.2.0.tar.gz) =
d8c091eb131f6edda4f4e42cb84f921be4fbb81075d4e4c875ad16a129caa74cdf21677f87e744191c2f4d111f48260ba21cb913ba348c501f0fb08a41e5c915
commit a17aa32b25d7afcc536f552eba68c5a2280d5731
Author: Jeremy Newton <Jeremy.Newton(a)amd.com>
Date: Tue Jul 5 18:07:50 2022 -0400
Typo in last commit
Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
diff --git a/rocm-opencl.spec b/rocm-opencl.spec
index a0115e6..0e50f5d 100644
--- a/rocm-opencl.spec
+++ b/rocm-opencl.spec
@@ -54,7 +54,7 @@ Requires: opencl-filesystem
# The kernel support only exists for x86_64, aarch64, and ppc64le
# 32bit userspace is excluded based on current Fedora policies
#TODO: ppc64le doesn't build on EPEL8 due to type casting issue
-%if 0%{?rhel} <= 8
+%if 0%{?rhel} <= 8 && 0%{?rhel}
ExclusiveArch: x86_64 aarch64
%else
ExclusiveArch: x86_64 aarch64 ppc64le
commit 60249d071c5417806cb5d99551e9b2fe0bca70b1
Author: Jeremy Newton <Jeremy.Newton(a)amd.com>
Date: Tue Jul 5 18:02:08 2022 -0400
Disable ppc64le on EL8
I'll fix this later when I have time, it seems like el9's gcc is more
tollerant of type casting issues.
Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
diff --git a/rocm-opencl.spec b/rocm-opencl.spec
index 72fea36..a0115e6 100644
--- a/rocm-opencl.spec
+++ b/rocm-opencl.spec
@@ -53,7 +53,12 @@ Requires: opencl-filesystem
#Only the following architectures are supported:
# The kernel support only exists for x86_64, aarch64, and ppc64le
# 32bit userspace is excluded based on current Fedora policies
+#TODO: ppc64le doesn't build on EPEL8 due to type casting issue
+%if 0%{?rhel} <= 8
+ExclusiveArch: x86_64 aarch64
+%else
ExclusiveArch: x86_64 aarch64 ppc64le
+%endif
#rocm-opencl bundles OpenCL 2.2 headers
# Some work is needed to unbundle this, as it fails to compile with latest
commit ef3caf960f5341583fd0f11d407ddec72a9e6087
Author: Jeremy Newton <Jeremy.Newton(a)amd.com>
Date: Tue Jul 5 17:41:34 2022 -0400
Initial import
I rebased the reviewed specfile to 5.0.2 to help with EPEL import.
Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..452c8a3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/ROCclr-5.0.2.tar.gz
+/ROCm-OpenCL-Runtime-5.0.2.tar.gz
diff --git a/0001-SWDEV-321118-Use-GNUInstallDirs.patch
b/0001-SWDEV-321118-Use-GNUInstallDirs.patch
new file mode 100644
index 0000000..853d8b4
--- /dev/null
+++ b/0001-SWDEV-321118-Use-GNUInstallDirs.patch
@@ -0,0 +1,114 @@
+From b2adcd6bb9be35291c8389d4c04cecd4703c38fd Mon Sep 17 00:00:00 2001
+From: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Date: Mon, 31 Jan 2022 17:54:14 -0500
+Subject: [PATCH 1/4] SWDEV-321118 - Use GNUInstallDirs
+
+Use GNUInstallDirs variables to determine the location of BINDIR,
+LIBDIR, DOCDIR, and SYSCONFDIR.
+
+Note that CMAKE_INSTALL_LIBDIR is overriden, since the default for RHEL
+is lib64, but ROCm packaging wants it to be lib always. Distros or users
+can easily override this.
+
+Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Change-Id: Ifb38263dce80d80c5ebb4eacd8e49c76bb013a44
+---
+ CMakeLists.txt | 5 ++++-
+ packaging/rocm-ocl-icd.postinst | 4 ++--
+ packaging/rocm-ocl-icd.prerm | 4 ++--
+ packaging/rocm-ocl-icd.txt | 8 ++++----
+ packaging/rocm-opencl.txt | 6 +++---
+ 5 files changed, 15 insertions(+), 12 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4464ed0..9849ec8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -7,6 +7,9 @@ endif()
+
+ project(opencl)
+
++# Set default libdir to be "lib" for ROCm, distros will override this anyway:
++set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library install
directory")
++
+ include(GNUInstallDirs)
+
+ option(BUILD_TESTS "Enable building OpenCL tests" OFF)
+@@ -25,7 +28,7 @@ endif()
+
+ # DEV package
+ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL"
+- DESTINATION include
++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT DEV
+ USE_SOURCE_PERMISSIONS
+ PATTERN cl_d3d10.h EXCLUDE
+diff --git a/packaging/rocm-ocl-icd.postinst b/packaging/rocm-ocl-icd.postinst
+index 0780970..7c46ade 100644
+--- a/packaging/rocm-ocl-icd.postinst
++++ b/packaging/rocm-ocl-icd.postinst
+@@ -6,8 +6,8 @@ INSTALL_PATH=@CPACK_PACKAGING_INSTALL_PREFIX@
+ ROCM_LIBPATH=@ROCM_PATH@/lib
+
+ do_ldconfig() {
+- echo ${INSTALL_PATH}/lib > /etc/ld.so.conf.d/10-rocm-opencl.conf &&
ldconfig
+- mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so >
/etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@)
++ echo ${INSTALL_PATH}/@CMAKE_INSTALL_LIBDIR@ >
/@CMAKE_INSTALL_SYSCONFDIR(a)/ld.so.conf.d/10-rocm-opencl.conf && ldconfig
++ mkdir -p /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors && (echo libamdocl64.so
> /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@)
+ }
+
+ case "$1" in
+diff --git a/packaging/rocm-ocl-icd.prerm b/packaging/rocm-ocl-icd.prerm
+index 9fc6c8d..e0b5417 100644
+--- a/packaging/rocm-ocl-icd.prerm
++++ b/packaging/rocm-ocl-icd.prerm
+@@ -3,8 +3,8 @@
+ set -e
+
+ rm_ldconfig() {
+- rm -f /etc/ld.so.conf.d/10-rocm-opencl.conf && ldconfig
+- rm -f /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@
++ rm -f /@CMAKE_INSTALL_SYSCONFDIR(a)/ld.so.conf.d/10-rocm-opencl.conf &&
ldconfig
++ rm -f /@CMAKE_INSTALL_SYSCONFDIR@/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@
+ }
+
+ case "$1" in
+diff --git a/packaging/rocm-ocl-icd.txt b/packaging/rocm-ocl-icd.txt
+index 66e3863..63f60ad 100644
+--- a/packaging/rocm-ocl-icd.txt
++++ b/packaging/rocm-ocl-icd.txt
+@@ -1,10 +1,10 @@
+ cmake_minimum_required(VERSION 3.5.1)
+ project(rocm-ocl-icd)
+
+-install(FILES @PROJECT_BINARY_DIR(a)/khronos/icd/libOpenCL.so DESTINATION lib)
+-install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_MAJOR@
DESTINATION lib)
+-install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_STRING@
DESTINATION lib)
+-install(FILES @opencl_SOURCE_DIR@/khronos/icd/LICENSE DESTINATION
share/doc/rocm-ocl-icd)
++install(FILES @PROJECT_BINARY_DIR(a)/khronos/icd/libOpenCL.so DESTINATION
${CMAKE_INSTALL_LIBDIR})
++install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_MAJOR@
DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_STRING@
DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(FILES @opencl_SOURCE_DIR@/khronos/icd/LICENSE DESTINATION
${CMAKE_INSTALL_DATADIR}/doc/rocm-ocl-icd)
+
+ #############################
+ # Packaging steps
+diff --git a/packaging/rocm-opencl.txt b/packaging/rocm-opencl.txt
+index 830c378..65707b0 100644
+--- a/packaging/rocm-opencl.txt
++++ b/packaging/rocm-opencl.txt
+@@ -1,9 +1,9 @@
+ cmake_minimum_required(VERSION 3.5.1)
+ project(rocm-opencl)
+
+-install(PROGRAMS @PROJECT_BINARY_DIR@/tools/clinfo/clinfo DESTINATION bin)
+-install(FILES @PROJECT_BINARY_DIR(a)/amdocl/libamdocl64.so DESTINATION lib)
+-install(FILES @opencl_SOURCE_DIR(a)/LICENSE.txt DESTINATION share/doc/rocm-opencl)
++install(PROGRAMS @PROJECT_BINARY_DIR@/tools/clinfo/clinfo DESTINATION
${CMAKE_INSTALL_BINDIR})
++install(FILES @PROJECT_BINARY_DIR(a)/amdocl/libamdocl64.so DESTINATION
${CMAKE_INSTALL_LIBDIR})
++install(FILES @opencl_SOURCE_DIR(a)/LICENSE.txt DESTINATION
${CMAKE_INSTALL_DATADIR}/doc/rocm-opencl)
+
+ #############################
+ # Packaging steps
+--
+2.35.3
+
diff --git a/0001-SWDEV-323669-Fix-linux-arch-detection.patch
b/0001-SWDEV-323669-Fix-linux-arch-detection.patch
new file mode 100644
index 0000000..0ef6922
--- /dev/null
+++ b/0001-SWDEV-323669-Fix-linux-arch-detection.patch
@@ -0,0 +1,53 @@
+From 211c1c4d8c7f6dac48ba6c73256da60955f9dbd1 Mon Sep 17 00:00:00 2001
+From: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Date: Thu, 17 Feb 2022 09:05:56 -0500
+Subject: [PATCH] SWDEV-323669 - Fix linux arch detection
+
+CMake assumes we're bundling on x86, but for GNU compatible compilers,
+we should rely on the compiler target to set the build arch.
+
+For non-gnu compilers, just fall back to assuming x86 (no change).
+
+Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Change-Id: Iee9794e6f7c3973c781ddaf740ded77f34712c4f
+---
+ cmake/ROCclr.cmake | 1 -
+ include/top.hpp | 10 ++++++++++
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/ROCclr.cmake b/cmake/ROCclr.cmake
+index 2f6ff8c1..e4d0cdc1 100644
+--- a/cmake/ROCclr.cmake
++++ b/cmake/ROCclr.cmake
+@@ -100,7 +100,6 @@ if(NOT CMAKE_CL_64)
+ endif()
+
+ target_compile_definitions(rocclr PUBLIC
+- ATI_ARCH_X86
+ LITTLEENDIAN_CPU
+ WITH_LIQUID_FLASH=0
+ ${AMD_OPENCL_DEFS})
+diff --git a/include/top.hpp b/include/top.hpp
+index f51db7d1..70273510 100644
+--- a/include/top.hpp
++++ b/include/top.hpp
+@@ -21,6 +21,16 @@
+ #ifndef TOP_HPP_
+ #define TOP_HPP_
+
++#if defined(__GNUC__)
++#if defined(__arm__) || defined(__aarch64__)
++#define ATI_ARCH_ARM
++#elif defined(__x86__) || defined(__x86_64__)
++#define ATI_ARCH_X86
++#endif
++#else /*!__GNUC__*/
++#define ATI_ARCH_X86
++#endif /*!__GNUC__*/
++
+ #if defined(ATI_ARCH_ARM)
+ #define __EXPORTED_HEADERS__ 1
+ #endif /*ATI_ARCH_ARM*/
+--
+2.34.1
+
diff --git a/0001-SWDEV-323669-Improve-arch-detection.patch
b/0001-SWDEV-323669-Improve-arch-detection.patch
new file mode 100644
index 0000000..0d91ab2
--- /dev/null
+++ b/0001-SWDEV-323669-Improve-arch-detection.patch
@@ -0,0 +1,93 @@
+From e373cba2fb2d458239918eb1f957e919e65d7a3c Mon Sep 17 00:00:00 2001
+From: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Date: Wed, 6 Apr 2022 11:07:35 -0400
+Subject: [PATCH] SWDEV-323669 - Improve arch detection
+
+- Clean up detection by using visual studio macros to detect arch; I
+ didn't list all possible ARM platforms (can be done later if desired)
+- Fixed two incorrect uses of !defined(ATI_ARCH_ARM) to instead use
+ defined(ATI_ARCH_X86), as they contain X86 specific code
+- Fixed one use of __ARM_ARCH_7A__ to use ATI_ARCH_ARM instead
+
+This is an improvement to the fixes in the last patch for SWDEV-323669
+
+Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Change-Id: I8568167293c34ad5331902105877f3ab6e25acb3
+---
+ include/top.hpp | 12 ++++--------
+ os/os.cpp | 2 +-
+ os/os_posix.cpp | 6 +++---
+ 3 files changed, 8 insertions(+), 12 deletions(-)
+
+diff --git a/include/top.hpp b/include/top.hpp
+index 70273510..d6aa00c8 100644
+--- a/include/top.hpp
++++ b/include/top.hpp
+@@ -21,15 +21,11 @@
+ #ifndef TOP_HPP_
+ #define TOP_HPP_
+
+-#if defined(__GNUC__)
+-#if defined(__arm__) || defined(__aarch64__)
++#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__arm) ||
defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || defined(_M_ARM64)
+ #define ATI_ARCH_ARM
+-#elif defined(__x86__) || defined(__x86_64__)
++#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) ||
defined(__x86__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) ||
defined(__amd64__) || defined(_M_X64) || defined(_M_AMD64)
+ #define ATI_ARCH_X86
+ #endif
+-#else /*!__GNUC__*/
+-#define ATI_ARCH_X86
+-#endif /*!__GNUC__*/
+
+ #if defined(ATI_ARCH_ARM)
+ #define __EXPORTED_HEADERS__ 1
+@@ -51,9 +47,9 @@
+ #define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035
+ #endif
+
+-#if !defined(ATI_ARCH_ARM)
++#if defined(ATI_ARCH_X86)
+ #include <xmmintrin.h>
+-#endif /*!ATI_ARCH_ARM*/
++#endif /*ATI_ARCH_X86*/
+
+ #include <atomic>
+ #include <cstdint>
+diff --git a/os/os.cpp b/os/os.cpp
+index f5ea547d..0437f7f1 100644
+--- a/os/os.cpp
++++ b/os/os.cpp
+@@ -112,7 +112,7 @@ int Os::processorCount_ = 0;
+ void Os::spinPause() {
+ #if defined(ATI_ARCH_X86)
+ _mm_pause();
+-#elif defined(__ARM_ARCH_7A__)
++#elif defined(ATI_ARCH_ARM)
+ __asm__ __volatile__("yield");
+ #endif
+ }
+diff --git a/os/os_posix.cpp b/os/os_posix.cpp
+index dd1e61fc..aa43a773 100644
+--- a/os/os_posix.cpp
++++ b/os/os_posix.cpp
+@@ -701,14 +701,14 @@ void Os::setCurrentStackPtr(address sp) {
+ sp -= sizeof(void*);
+ *(void**)sp = __builtin_return_address(0);
+
+-#if defined(ATI_ARCH_ARM)
+- assert(!"Unimplemented");
+-#else
++#if defined(ATI_ARCH_X86)
+ __asm__ __volatile__(
+ #if !defined(OMIT_FRAME_POINTER)
+ LP64_SWITCH("movl (%%ebp),%%ebp;", "movq (%%rbp),%%rbp;")
+ #endif // !OMIT_FRAME_POINTER
+ LP64_SWITCH("movl %0,%%esp; ret;", "movq %0,%%rsp;
ret;")::"r"(sp));
++#else
++ assert(!"Unimplemented");
+ #endif
+ }
+
+--
+2.35.1
+
diff --git a/0002-SWDEV-321116-Allow-disabling-ICD-loader.patch
b/0002-SWDEV-321116-Allow-disabling-ICD-loader.patch
new file mode 100644
index 0000000..76876b3
--- /dev/null
+++ b/0002-SWDEV-321116-Allow-disabling-ICD-loader.patch
@@ -0,0 +1,95 @@
+From fff4ab16df4ca9a76fe3f648c76aefd267ee45b4 Mon Sep 17 00:00:00 2001
+From: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Date: Wed, 6 Apr 2022 15:07:13 -0400
+Subject: [PATCH 2/4] SWDEV-321116 - Allow disabling ICD loader
+
+This patch adds an option (BUILD_ICD) to toggle the ICD loader build
+with rocm-opencl. This isn't useful for official ROCm use, but distros
+or users may want build rocm-opencl with their own OCL ICD loader.
+
+The default option is BUILD_ICD=ON.
+If this option is set to OFF, an OpenCL OCD loader must be installed
+prior to attempting to build rocm-opencl.
+
+E.g. distros already provide ocl icd loader packages:
+sudo yum install ocd-icd-devel
+sudo apt-get install ocl-icd-opencl-dev
+sudo zypper install ocd-icd-devel
+
+Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Change-Id: I6006593eceed543cd829e8949ec2256482815673
+---
+ CMakeLists.txt | 15 ++++++++++++---
+ packaging/rocm-ocl-icd.txt | 2 ++
+ 2 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9849ec8..c4197ec 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -13,10 +13,15 @@ set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library
install directory")
+ include(GNUInstallDirs)
+
+ option(BUILD_TESTS "Enable building OpenCL tests" OFF)
++option(BUILD_ICD "Enable building OpenCL ICD Loader" ON)
+ option(EMU_ENV "Enable building for emulation environment" OFF)
+
+ set(OPENCL_ICD_LOADER_HEADERS_DIR
"${CMAKE_CURRENT_LIST_DIR}/khronos/headers/opencl2.2" CACHE PATH "")
+-add_subdirectory(khronos/icd)
++if(BUILD_ICD)
++ add_subdirectory(khronos/icd)
++else()
++ find_package(OpenCL REQUIRED)
++endif()
+ add_subdirectory(amdocl)
+ add_subdirectory(tools/clinfo)
+ add_subdirectory(tools/cltrace)
+@@ -54,8 +59,10 @@ if (DEFINED ROCM_PATCH_VERSION)
+ set(OPENCL_AMD_ICD_FILE "amdocl64_${ROCM_PATCH_VERSION}.icd")
+ endif()
+
+-get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION)
+-get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION)
++if(BUILD_ICD)
++ get_target_property(OPENCL_LIB_VERSION_MAJOR OpenCL SOVERSION)
++ get_target_property(OPENCL_LIB_VERSION_STRING OpenCL VERSION)
++endif()
+
+ set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/rocm/opencl" CACHE PATH "Package
Installation path for OpenCL")
+
+@@ -65,6 +72,7 @@ if(NOT DEFINED ROCM_PATH)
+ endif()
+ message (STATUS "ROCM Installation path(ROCM_PATH): ${ROCM_PATH}")
+
++if(BUILD_ICD)
+ # Package: rocm-ocl-icd
+ set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/rocm-ocl-icd)
+ configure_file(packaging/rocm-ocl-icd.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
+@@ -79,6 +87,7 @@ add_custom_target(pkg_rocm_ocl_icd COMMAND ${CMAKE_COMMAND}
-DROCM_DEP_ROCMCORE=
+ COMMAND cp *.rpm ${PROJECT_BINARY_DIR}
+ WORKING_DIRECTORY ${BUILD_DIR}
+ DEPENDS amdocl OpenCL)
++endif()
+
+ # Package: rocm-opencl
+ set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/rocm-opencl)
+diff --git a/packaging/rocm-ocl-icd.txt b/packaging/rocm-ocl-icd.txt
+index 63f60ad..08b1947 100644
+--- a/packaging/rocm-ocl-icd.txt
++++ b/packaging/rocm-ocl-icd.txt
+@@ -1,10 +1,12 @@
+ cmake_minimum_required(VERSION 3.5.1)
+ project(rocm-ocl-icd)
+
++if(BUILD_ICD)
+ install(FILES @PROJECT_BINARY_DIR(a)/khronos/icd/libOpenCL.so DESTINATION
${CMAKE_INSTALL_LIBDIR})
+ install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_MAJOR@
DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(FILES @PROJECT_BINARY_DIR@/khronos/icd/libOpenCL.so.(a)OPENCL_LIB_VERSION_STRING@
DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(FILES @opencl_SOURCE_DIR@/khronos/icd/LICENSE DESTINATION
${CMAKE_INSTALL_DATADIR}/doc/rocm-ocl-icd)
++endif()
+
+ #############################
+ # Packaging steps
+--
+2.35.3
+
diff --git a/0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch
b/0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch
new file mode 100644
index 0000000..40743d5
--- /dev/null
+++ b/0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch
@@ -0,0 +1,44 @@
+From 175968b622a730881dd8b936b9089a84b0dfeabc Mon Sep 17 00:00:00 2001
+From: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Date: Wed, 6 Apr 2022 18:37:47 -0400
+Subject: [PATCH 3/4] SWDEV-321116 - Drop unnecessary ICD include
+
+This looks unused. This should allow building rocm-opencl without any
+dependency on any particular OCL ICD.
+
+Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Change-Id: Ib9229ede8400fd0e883275659ab99513b03952cb
+---
+ amdocl/cl_execute.cpp | 2 --
+ amdocl/cl_icd.cpp | 2 --
+ 2 files changed, 4 deletions(-)
+
+diff --git a/amdocl/cl_execute.cpp b/amdocl/cl_execute.cpp
+index 71fe535..e1d5be2 100644
+--- a/amdocl/cl_execute.cpp
++++ b/amdocl/cl_execute.cpp
+@@ -27,8 +27,6 @@
+ #include "platform/program.hpp"
+ #include "os/os.hpp"
+
+-#include <icd/loader/icd_dispatch.h>
+-
+ /*! \addtogroup API
+ * @{
+ *
+diff --git a/amdocl/cl_icd.cpp b/amdocl/cl_icd.cpp
+index 2a4f3af..4fce08b 100644
+--- a/amdocl/cl_icd.cpp
++++ b/amdocl/cl_icd.cpp
+@@ -27,8 +27,6 @@
+ #include "cl_d3d11_amd.hpp"
+ #endif //_WIN32
+
+-#include <icd/loader/icd_dispatch.h>
+-
+ #include <mutex>
+
+ amd::PlatformIDS amd::PlatformID::Platform = //{ NULL };
+--
+2.35.3
+
diff --git a/0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
b/0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
new file mode 100644
index 0000000..325f937
--- /dev/null
+++ b/0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
@@ -0,0 +1,37 @@
+From 2cd867fdb94a608b5fc0ebe89149c4487ec5e59f Mon Sep 17 00:00:00 2001
+From: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Date: Mon, 25 Apr 2022 12:33:46 -0400
+Subject: [PATCH 4/4] SWDEV-336248 - Don't exclude cl_egl.h from install
+
+cl_icd.h includes cl_egl.h, but cl_egl.h is excluded from install. It
+was reported by the community that including cl_icd.h would error due to
+the missing cl_egl.h file.
+
+I'm assuming that cl_egl.h was excluded because EGL isn't important for
+ROCm. Since cl_icd.h has some important typedefs, it makes sense just
+to include cl_egl.h, which seems to be a common practice in open source
+projects.
+
+Signed-off-by: Jeremy Newton <Jeremy.Newton(a)amd.com>
+Change-Id: I506257c2dc51512ec8e11b1e5dadbe6e48ad785b
+---
+ CMakeLists.txt | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c4197ec..6dabea7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -38,8 +38,7 @@ install(DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2/CL"
+ 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)
++ PATTERN cl_dx9_media_sharing.h EXCLUDE)
+
+ #############################
+ # Packaging steps
+--
+2.35.3
+
diff --git a/rocm-opencl.spec b/rocm-opencl.spec
new file mode 100644
index 0000000..72fea36
--- /dev/null
+++ b/rocm-opencl.spec
@@ -0,0 +1,177 @@
+%global upstreamname ROCm-OpenCL-Runtime
+%global rocm_release 5.0
+%global rocm_patch 2
+%global rocm_version %{rocm_release}.%{rocm_patch}
+
+#Set enable_ocltst to enable HW OCL test suite
+%if 0%{?enable_ocltst}
+#Using -Werror=format-security fails to compile ocltst:
+%global _warning_options -Wall
+%endif
+
+Name: rocm-opencl
+Version: %{rocm_version}
+Release: 1%{?dist}
+Summary: ROCm OpenCL Runtime
+
+Url:
https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime
+License: MIT
+Source0:
https://github.com/RadeonOpenCompute/%{upstreamname}/archive/refs/tags/ro...
+Source1:
https://github.com/ROCm-Developer-Tools/ROCclr/archive/refs/tags/rocm-%{v...
+
+#https://github.com/ROCm-Developer-Tools/ROCclr/commit/211c1c4d8c7f6dac48ba6c73256da60955f9dbd1
+Patch0: 0001-SWDEV-323669-Fix-linux-arch-detection.patch
+#https://github.com/ROCm-Developer-Tools/ROCclr/commit/47150917c466e7b5df89cf18e9270d12ecb54ee6
+Patch1: 0001-SWDEV-323669-Improve-arch-detection.patch
+
+##The following are cherry-picked and rebased on 5.0.2:
+#https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/9afc68795b7f063e24d5585ee88497e6592d2c2e
+Patch101: 0001-SWDEV-321118-Use-GNUInstallDirs.patch
+#https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/33d345c490ab50d41cc04621ba656116afb36dc9
+Patch102: 0002-SWDEV-321116-Allow-disabling-ICD-loader.patch
+#https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/4b36f7363a228002b04ec1b07a519629dbecf137
+Patch103: 0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch
+#https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/commit/b98828a206fef952abe2f65c337dafe0316c9e9e
+Patch104: 0004-SWDEV-336248-Don-t-exclude-cl_egl.h-from-install.patch
+
+BuildRequires: cmake
+BuildRequires: clang-devel
+%if 0%{?enable_ocltst}
+BuildRequires: pkgconfig(glew)
+%endif
+BuildRequires: gcc-c++
+BuildRequires: pkgconfig(opengl)
+BuildRequires: pkgconfig(numa)
+BuildRequires: pkgconfig(ocl-icd)
+BuildRequires: rocm-comgr-devel
+BuildRequires: rocm-runtime-devel
+
+Requires: rocm-comgr%{?_isa}
+Requires: ocl-icd%{?_isa}
+Requires: opencl-filesystem
+
+#Only the following architectures are supported:
+# The kernel support only exists for x86_64, aarch64, and ppc64le
+# 32bit userspace is excluded based on current Fedora policies
+ExclusiveArch: x86_64 aarch64 ppc64le
+
+#rocm-opencl bundles OpenCL 2.2 headers
+# Some work is needed to unbundle this, as it fails to compile with latest
+Provides: bundled(opencl-headers) = 2.2
+
+%description
+ROCm OpenCL language runtime.
+Supports offline and in-process/in-memory compilation.
+
+%package devel
+Summary: ROCm OpenCL development package
+Requires: %{name}%{?_isa} = %{version}-%{release}
+
+%description devel
+The AMD ROCm OpenCL development package.
+
+%package -n rocm-clinfo
+Summary: ROCm OpenCL platform and device tool
+
+%description -n rocm-clinfo
+A simple ROCm OpenCL application that enumerates all possible platform and
+device information.
+
+%if 0%{?enable_ocltst}
+%package -n rocm-ocltst
+Summary: ROCm OpenCL test suite
+
+%description -n rocm-ocltst
+Test suite provided with rocm-opencl.
+%endif
+
+%prep
+%autosetup -N -a 1 -n %{upstreamname}-rocm-%{version}
+
+pushd ROCclr-rocm-%{version}
+%autopatch -p1 -m 0 -M 99
+popd
+%autopatch -p1 -m 100
+
+#Add soname to amdocl and cltrace:
+# Upstream doesn't want this because they don't guarentee ABI.
+# Just use the package version. SOVERSION can be major.minor as patch releases
+# are unlikely to break anything.
+#TODO: make a patch for upstream to allow setting a soname optionally
+echo "set_target_properties(amdocl PROPERTIES VERSION %{version} SOVERSION
%(v=%{version};echo ${v%%.*}))" \
+ >> amdocl/CMakeLists.txt
+echo "libamdocl64.so.%{rocm_release}" > config/amdocl64.icd
+echo "set_target_properties(cltrace PROPERTIES VERSION %{version} SOVERSION
%(v=%{version};echo ${v%%.*}))" \
+ >> tools/cltrace/CMakeLists.txt
+
+#Clean up unused bundled code:
+# bundled opencl2.2 headers are needed as ocl doesn't compile against latest:
+ls -d khronos/* | grep -v headers | xargs rm -r
+ls -d khronos/headers/* | grep -v opencl2.2 | xargs rm -r
+# unused opencl 2.2 test code:
+rm -r khronos/headers/opencl2.2/tests/
+
+%if 0%{?enable_ocltst}
+#Change install location for ocltst test suite:
+sed -i "s|\(DESTINATION \)tests/ocltst|\1\${CMAKE_INSTALL_LIBDIR}|" \
+ tests/ocltst/log/CMakeLists.txt tests/ocltst/module/*/CMakeLists.txt
+sed -i "s|\(DESTINATION \)tests/ocltst|\1\${CMAKE_INSTALL_BINDIR}|" \
+ tests/ocltst/env/CMakeLists.txt
+%endif
+
+%build
+%cmake \
+ -DAMD_OPENCL_PATH=$(pwd) \
+ -DCMAKE_INSTALL_LIBDIR=%{_lib} \
+ -DROCCLR_PATH=$(pwd)/ROCclr-rocm-%{version} \
+ -DBUILD_ICD=OFF \
+ -DFILE_REORG_BACKWARD_COMPATIBILITY=OFF \
+%if 0%{?enable_ocltst}
+ -DBUILD_TESTS=ON \
+%endif
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
+%cmake_build
+
+%install
+%cmake_install
+
+#Install ICD configuration:
+install -D -m 644 config/amdocl64.icd \
+ %{buildroot}%{_sysconfdir}/OpenCL/vendors/amdocl64.icd
+
+#Avoid file conflicts with opencl-headers package:
+mkdir -p %{buildroot}%{_includedir}/%{name}
+mv %{buildroot}%{_includedir}/CL %{buildroot}%{_includedir}/%{name}/CL
+
+#Avoid file conflicts with clinfo package:
+mv %{buildroot}%{_bindir}/clinfo %{buildroot}%{_bindir}/rocm-clinfo
+
+%files
+%license LICENSE.txt
+%config(noreplace) %{_sysconfdir}/OpenCL/vendors/amdocl64.icd
+%{_libdir}/libamdocl64.so.5{,.*}
+%{_libdir}/libcltrace.so.5{,.*}
+#Duplicated files:
+%exclude %{_docdir}/*/LICENSE*
+
+%files devel
+%{_libdir}/libamdocl64.so
+%{_libdir}/libcltrace.so
+%{_includedir}/%{name}
+
+%if 0%{?enable_ocltst}
+%files -n rocm-ocltst
+%license LICENSE.txt
+%{_bindir}/ocltst
+%{_libdir}/libocl*.so
+%{_libdir}/ocl*.exclude
+%{_libdir}/libTestLog.so
+%endif
+
+%files -n rocm-clinfo
+%license LICENSE.txt
+%{_bindir}/rocm-clinfo
+
+%changelog
+* Tue Jul 05 2022 Jeremy Newton <alexjnewt at hotmail dot com> - 5.0.2-1
+- Initial package
diff --git a/sources b/sources
new file mode 100644
index 0000000..a702570
--- /dev/null
+++ b/sources
@@ -0,0 +1,2 @@
+SHA512 (ROCclr-5.0.2.tar.gz) =
b30a57c09973d8ef624511f422babaf9722685b9f85643783aebc000671b41fd54f44b308cece0baab187e1ee00b10335c6d22b6bad6fb3468abe6ef0da97d73
+SHA512 (ROCm-OpenCL-Runtime-5.0.2.tar.gz) =
fa01d1fafc890181b9e67070353ee7c9100619494b7509cae1a3659f24ef1d00f650024cb24bdb0e6e7eacfdec1115e4683ec6f320228a19f41ae83321780780