# Upstream tags are based on rocm releases: %global rocm_release 6.3 %global rocm_patch 1 %global rocm_version %{rocm_release}.%{rocm_patch} # What LLVM is upstream using (use LLVM_VERSION_MAJOR from llvm/CMakeLists.txt): %global llvm_maj_ver 18 %global upstreamname llvm-project %global toolchain clang %global _lto_cflags %{nil} %global bundle_prefix %{_libdir}/rocm/llvm %global llvm_triple %{_target_platform} %bcond_with debug %if %{with debug} %global build_type DEBUG %else %global build_type RELEASE %endif Name: rocm-omp Version: %{rocm_version} Release: 1%{?dist} Summary: ROCm OpenMP Url: https://github.com/ROCm/%{upstreamname} License: NCSA and MIT Source0: %{url}/archive/rocm-%{rocm_version}.tar.gz#/%{name}-%{rocm_version}.tar.gz Patch3: 0001-Remove-err_drv_duplicate_config-check.patch BuildRequires: binutils-devel BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: libffi-devel BuildRequires: libzstd-devel BuildRequires: perl BuildRequires: rocm-compilersupport-macros BuildRequires: rocm-device-libs BuildRequires: rocm-runtime-devel BuildRequires: zlib-devel %if 0%{?fedora} || 0%{?suse_version} BuildRequires: fdupes %endif ExclusiveArch: x86_64 %global targets_to_build "X86;AMDGPU" %description %{summary} %package devel Summary: Libraries and headers for %{name} Requires: rocm-omp%{?_isa} = %{version}-%{release} %description devel %{summary} %package static Summary: Static Libraries for %{name} Requires: rocm-omp-devel%{?_isa} = %{version}-%{release} %description static %{summary} %prep %autosetup -p1 -n %{upstreamname}-rocm-%{rocm_version} # no nvidia sed -i -e 's@LIBOMPTARGET_DEVICE_ARCHITECTURES "all"@LIBOMPTARGET_DEVICE_ARCHITECTURES "${all_amdgpu_architectures}"@' openmp/libomptarget/DeviceRTL/CMakeLists.txt %build %global llvmrocm_cmake_config \\\ -DBUILD_SHARED_LIBS=OFF \\\ -DLLVM_BUILD_LLVM_DYLIB=ON \\\ -DLLVM_LINK_LLVM_DYLIB=ON \\\ -DBUILD_TESTING=OFF \\\ -DCLANG_ENABLE_ARCMT=OFF \\\ -DCLANG_ENABLE_STATIC_ANALYZER=OFF \\\ -DCMAKE_BUILD_TYPE=%{build_type} \\\ -DCMAKE_INSTALL_PREFIX=%{bundle_prefix} \\\ -DCOMPILER_RT_BUILD_SANITIZERS=OFF \\\ -DLLVM_BINUTILS_INCDIR=%{_includedir} \\\ -DLLVM_BUILD_RUNTIME=ON \\\ -DLLVM_BUILD_TOOLS=ON \\\ -DLLVM_BUILD_UTILS=ON \\\ -DLLVM_DEFAULT_TARGET_TRIPLE=%{llvm_triple} \\\ -DLLVM_ENABLE_EH=ON \\\ -DLLVM_ENABLE_FFI=ON \\\ -DLLVM_ENABLE_RTTI=ON \\\ -DLLVM_ENABLE_ZLIB=ON \\\ -DLLVM_ENABLE_ZSTD=ON \\\ -DLLVM_INCLUDE_BENCHMARKS=OFF \\\ -DLLVM_INCLUDE_EXAMPLES=OFF \\\ -DLLVM_INCLUDE_TESTS=OFF \\\ -DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \\\ -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \\\ -DMLIR_BUILD_MLIR_C_DYLIB=ON \\\ -DROCM_DIR=%{_prefix} pushd . %if 0%{?is_opensuse} %define __sourcedir openmp %else %define _vpath_srcdir openmp %endif %cmake %{llvmrocm_cmake_config} \ -DBUILD_SHARED=ON \ -DClang_DIR=%{rocmllvm_cmakedir}/../clang \ -DCMAKE_AR=%{rocmllvm_bindir}/llvm-ar \ -DCMAKE_INSTALL_RPATH=%{rocmllvm_libdir} \ -DCMAKE_LINKER=%{rocmllvm_bindir}/ld.lld \ -DCMAKE_RANLIB=%{rocmllvm_bindir}/llvm-ranlib \ -DCMAKE_CXX_COMPILER=%{rocmllvm_bindir}/clang++ \ -DCMAKE_C_COMPILER=%{rocmllvm_bindir}/clang \ -DCMAKE_C_COMPILER_AR=%{rocmllvm_bindir}/llvm-ar \ -DCMAKE_C_COMPILER_RANLIB=%{rocmllvm_bindir}/llvm-ranlib \ -DLIBOMPTARGET_AMDGPU_ARCH=%{rocmllvm_bindir}/amdgpu-arch \ -DCMAKE_INSTALL_PREFIX=%{bundle_prefix} \ -DCMAKE_INSTALL_LIBDIR=lib \ -DLLD_DIR=%{rocmllvm_cmakedir}/../lld \ -DLLVM_DIR=%{rocmllvm_cmakedir} \ -DLLVM_ENABLE_PROJECTS="openmp" \ -DLLVM_ENABLE_RUNTIMES="" \ -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=OFF \ -DLIBOMPTARGET_NVPTX_CUDA_COMPILER="" \ -DLIBOMPTARGET_NVPTX_BC_LINKER="" \ -DLIBOMP_OMPD_GDB_SUPPORT=OFF \ -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN=ON \ -DLIBOMPTARGET_BUILD_CUDA_PLUGIN=OFF \ -DLIBOMPTARGET_BUILD_DEVICERTL_BCLIB=ON \ -DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=OFF \ -DLIBOMP_INSTALL_ALIASES=OFF \ -DLIBOMP_ARCHER_SUPPORT=OFF \ -DOPENMP_STANDALONE_BUILD=ON \ -DOPENMP_LLVM_TOOLS_DIR=%{rocmllvm_bindir} %cmake_build %install %cmake_install #Clean up dupes: %if 0%{?fedora} || 0%{?suse_version} %fdupes %{buildroot}%{_prefix} %endif if [ -d %{buildroot}%{bundle_prefix}/lib/omptest ]; then rm -rf %{buildroot}%{bundle_prefix}/lib/omptest fi if [ -d %{buildroot}%{bundle_prefix}/lib/cmake/omptest ]; then rm -rf %{buildroot}%{bundle_prefix}/lib/cmake/omptest fi %files %{bundle_prefix}/bin/llvm-omp* %{bundle_prefix}/bin/prep-libomptarget-bc %{bundle_prefix}/lib/libomp*.so.* %files devel %{bundle_prefix}/include/omp*.h %{bundle_prefix}/lib/clang/%{llvm_maj_ver}/include/hostexec.h %{bundle_prefix}/lib/cmake/openmp/ %{bundle_prefix}/lib/disable_dynamic_devmem.ll %{bundle_prefix}/lib/libdevice/ %{bundle_prefix}/lib/*.bc %{bundle_prefix}/lib/libomp*.so %files static %{bundle_prefix}/lib/libomptarget.devicertl.a %changelog * Thu Dec 26 2024 Tom Rix - 6.3.1-1 - Initial version