From 67591d667107ab4ec4ef585c2f1bf060a5ffe884 Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Thu, 9 Jul 2020 18:04:18 -0700 Subject: [PATCH] Adding support for multiple icd files specific to ROCm version - amdocl64.icd is renamed to amdocl64_.icd - This will enable support for multiple icd for different versions of ROCm Signed-off-by: Pruthvi Madugundu Change-Id: I8031b19f8579507ffb6727dedcd2e3fbb4e45de8 [ROCm/clr commit: b88a313eff3332969f726b65979b923bd173613b] --- projects/clr/opencl/CMakeLists.txt | 6 ++++++ projects/clr/opencl/packaging/rocm-opencl.postinst | 2 +- projects/clr/opencl/packaging/rocm-opencl.prerm | 2 +- projects/clr/opencl/packaging/rocm-opencl.rpm_post | 2 +- projects/clr/opencl/packaging/rocm-opencl.rpm_postun | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/projects/clr/opencl/CMakeLists.txt b/projects/clr/opencl/CMakeLists.txt index e1c6d1267b..9817653e1b 100644 --- a/projects/clr/opencl/CMakeLists.txt +++ b/projects/clr/opencl/CMakeLists.txt @@ -17,6 +17,12 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(OPENCL_ICD_LOADER_HEADERS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/khronos/headers/opencl2.2" CACHE PATH "") option(BUILD_SHARED_LIBS "Build shared libs" ON) +#set a name for icd file +set(OPENCL_AMD_ICD_FILE "amdocl64.icd") +if (DEFINED ROCM_PATCH_VERSION) + set(OPENCL_AMD_ICD_FILE "amdocl64_${ROCM_PATCH_VERSION}.icd") +endif() + # FIXME: Handling legacy custom boolean matching "yes" or "no" if(DEFINED USE_COMGR_LIBRARY) if(${USE_COMGR_LIBRARY} MATCHES "yes") diff --git a/projects/clr/opencl/packaging/rocm-opencl.postinst b/projects/clr/opencl/packaging/rocm-opencl.postinst index b41c6450ea..c11d1ad2d5 100644 --- a/projects/clr/opencl/packaging/rocm-opencl.postinst +++ b/projects/clr/opencl/packaging/rocm-opencl.postinst @@ -6,7 +6,7 @@ do_ldconfig() { if [ -e "/opt/rocm/opencl" ] ; then echo /opt/rocm/opencl/lib > /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig fi - mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/amdocl64.icd) + mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@) } INSTALL_PATH=@CPACK_PACKAGING_INSTALL_PREFIX@ diff --git a/projects/clr/opencl/packaging/rocm-opencl.prerm b/projects/clr/opencl/packaging/rocm-opencl.prerm index 3e85a50fe8..722d3e1aa4 100644 --- a/projects/clr/opencl/packaging/rocm-opencl.prerm +++ b/projects/clr/opencl/packaging/rocm-opencl.prerm @@ -4,7 +4,7 @@ set -e rm_ldconfig() { rm -f /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig - rm -f /etc/OpenCL/vendors/amdocl64.icd + rm -f /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@ } case "$1" in diff --git a/projects/clr/opencl/packaging/rocm-opencl.rpm_post b/projects/clr/opencl/packaging/rocm-opencl.rpm_post index 5da6501e1b..936d9e16d1 100644 --- a/projects/clr/opencl/packaging/rocm-opencl.rpm_post +++ b/projects/clr/opencl/packaging/rocm-opencl.rpm_post @@ -1,7 +1,7 @@ if [ -e "/opt/rocm/opencl" ] ; then echo /opt/rocm/opencl/lib > /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig fi -mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/amdocl64.icd) +mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@) INSTALL_PATH=@CPACK_PACKAGING_INSTALL_PREFIX@ ROCM_LIBPATH=@ROCM_PATH@/lib diff --git a/projects/clr/opencl/packaging/rocm-opencl.rpm_postun b/projects/clr/opencl/packaging/rocm-opencl.rpm_postun index 7a595f7878..7cc5860de7 100644 --- a/projects/clr/opencl/packaging/rocm-opencl.rpm_postun +++ b/projects/clr/opencl/packaging/rocm-opencl.rpm_postun @@ -1,6 +1,6 @@ if [ $1 -eq 0 ]; then rm -f /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig - rm -f /etc/OpenCL/vendors/amdocl64.icd + rm -f /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@ rm -f @ROCM_PATH@/lib/libOpenCL.so rm -f @ROCM_PATH@/lib/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ rm -f @ROCM_PATH@/lib/libOpenCL.so.@OPENCL_LIB_VERSION_STRING@