%global upstreamname ROCm-OpenCL-Runtime Name: rocm-opencl Version: 5.1.0 Release: 7%{?dist} Summary: ROCm OpenCL Runtime Url: https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime License: MIT Source0: https://github.com/RadeonOpenCompute/%{upstreamname}/archive/refs/tags/rocm-%{version}.tar.gz#/%{upstreamname}-%{version}.tar.gz #ROCclr has to be build with rocm-opencl, since the sources are overlapping: Source1: https://github.com/ROCm-Developer-Tools/ROCclr/archive/refs/tags/rocm-%{version}.tar.gz#/ROCclr-%{version}.tar.gz # https://github.com/ROCm-Developer-Tools/ROCclr/commit/211c1c4d8c7f6dac48ba6c73256da60955f9dbd1 Patch0: 0001-SWDEV-323669-Fix-linux-arch-detection.patch # Allow debundling ROCclr in hip (still need to build it with OpenCL) Patch2: 0001-Allow-ROCclr-to-be-built-standalone.patch #These patches were submitted upstream, but haven't been pushed to github # Fixes ppc64le ROCclr build: Patch1: 0001-SWDEV-323669-Improve-arch-detection.patch # Fixes OCL libdir install location: Patch100: 0001-SWDEV-321118-Use-GNUInstallDirs.patch # Allows unbundling of khronos' ocl icd loader: Patch101: 0002-SWDEV-321116-Allow-disabling-ICD-loader.patch Patch102: 0003-SWDEV-321116-Drop-unnecessary-ICD-include.patch BuildRequires: cmake BuildRequires: clang-devel BuildRequires: libglvnd-devel BuildRequires: numactl-devel BuildRequires: ocl-icd-devel BuildRequires: rocm-comgr-devel BuildRequires: rocm-runtime-devel Requires: rocm-comgr Requires: ocl-icd 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. %package -n rocclr Summary: Radeon Open Compute Common Language Runtime %description -n rocclr ROCclr is a virtual device interface that compute runtimes interact with to different backends such as ROCr or PAL. This abstraction allows runtimes to work on Windows as well as on Linux without much effort. %package -n rocclr-devel Summary: ROCclr development package Requires: rocclr%{?_isa} = %{version}-%{release} Requires: %{name}-devel%{?_isa} = %{version}-%{release} %description -n rocclr-devel The AMD ROCclr development package. %prep %autosetup -N -a 1 -n %{upstreamname}-rocm-%{version} pushd ROCclr-rocm-%{version} %autopatch -p1 -m 0 -M 99 #Use shared rocclr by changing static to shared and add a soname sed -i "s/STATIC/SHARED/" cmake/ROCclr.cmake echo "set_target_properties(rocclr PROPERTIES VERSION %{version} SOVERSION %(v=%{version};echo ${v%%.*}))" \ >> cmake/ROCclr.cmake popd %autopatch -p1 -m 100 #Add soname to cltrace: echo "set_target_properties(cltrace PROPERTIES VERSION %{version} SOVERSION %(v=%{version};echo ${v%%.*}))" \ >> tools/cltrace/CMakeLists.txt #Clean up unused bundled code: # 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/*/tests/ %build %cmake \ -DAMD_OPENCL_PATH=$(pwd) \ -DROCM_PATH=%{_prefix} \ -DROCCLR_STANDALONE=ON \ -DROCCLR_PATH=$(pwd)/ROCclr-rocm-%{version} \ -DBUILD_ICD=OFF \ -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 #Add new include path to to ROCclrConfig.cmake: sed -i '/ROCCLR_INCLUDE_DIRS/a %{_includedir}/%{name}' \ %{buildroot}%{_libdir}/cmake/ROCclr/ROCclrConfig.cmake #CMake excludes installing this for some reason install -m 644 khronos/headers/opencl2.2/CL/cl_egl.h \ %{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 %{_libdir}/libcltrace.so.5{,.*} #Duplicated files: %exclude %{_docdir}/*/LICENSE* %files devel %{_includedir}/%{name} %{_libdir}/libcltrace.so %files -n rocm-clinfo %license LICENSE.txt %{_bindir}/rocm-clinfo %files -n rocclr %license LICENSE.txt %{_libdir}/librocclr.so.5{,.*} %files -n rocclr-devel %{_libdir}/librocclr.so %{_libdir}/cmake/ROCclr %{_includedir}/rocclr %changelog * Sat May 07 2022 Jeremy Newton - 5.1.0-7 - Add missing license to rocclr package - Massive rework of ROCclr patch - Unbundle all ASL code * Thu Apr 21 2022 Jeremy Newton - 5.1.0-6 - Use dynamically shared rocclr instead of static - Improve rocclr stand alone patch * Thu Apr 21 2022 Jeremy Newton - 5.1.0-5 - Fix up and clarify licensing - Delete more unused bundled code * Wed Apr 20 2022 Jeremy Newton - 5.1.0-4 - Create rocclr package to allow unbundling in HIP - Fix cltrace missing soname * Wed Apr 06 2022 Jeremy Newton - 5.1.0-3 - Update with proposed patches * Tue Apr 05 2022 Jeremy Newton - 5.1.0-2 - Enable ppc64le * Fri Apr 01 2022 Jeremy Newton - 5.1.0-1 - Update to 5.1.0 - Fix clarification of bundled code - Delete unnecessary bundled code in prep - Add missing rocm-comgr requires * Sat Mar 12 2022 Jeremy Newton - 5.0.0-1 - Initial package