SHA256
1
0
forked from ROCm/rocblas

4 Commits

Author SHA256 Message Date
7ec4e270f7 Restructure spec file
Move bcond_with* settings to the top.

Signed-off-by: Egbert Eich <eich@suse.com>
2025-06-24 17:46:20 +02:00
f6563a357b Use distro specific macros to hide some distribution differences
Signed-off-by: Egbert Eich <eich@suse.com>
2025-06-24 17:44:29 +02:00
72752f85de Fix build and runtime dependencies of test package
Signed-off-by: Egbert Eich <eich@suse.com>
2025-06-24 15:57:23 +02:00
9e34eda30d Build and package core library and arch dependent tensile modules separately to parallelize the build
Signed-off-by: Egbert Eich <eich@suse.com>
2025-06-24 15:50:27 +02:00

View File

@@ -1,14 +1,23 @@
%if 0%{?suse_version}
%global rocblas_name librocblas4
%else
%global rocblas_name rocblas
%endif
%global upstreamname rocBLAS
%global rocm_release 6.4
%global rocm_patch 0
%global rocm_version %{rocm_release}.%{rocm_patch}
%{rocm_set_libpackage_name rocblas -s 4}
%if 0%{?suse_version}
# OBS replaces @BUILD_FLAVOR@ by each value of 'package'
# in the file _multibuild resulting in a separate build.
%global flavor @BUILD_FLAVOR@%{?nil}
%if "%{?flavor}" != ""
%define _flavor %{flavor}
%define __flavor %(a=%flavor; a=${a/_minus/-}; a=${a/_plus/+}; echo ${a/_/:})
%endif
%define use_flavors 1
%else
%define use_flavors 0
%endif
%global toolchain rocm
# hipcc does not support some clang flags
%global build_cxxflags %(echo %{optflags} | sed -e 's/-fstack-protector-strong/-Xarch_host -fstack-protector-strong/' -e 's/-fcf-protection/-Xarch_host -fcf-protection/')
@@ -28,7 +37,7 @@
%endif
%bcond_with test
%if %{with test}
%if %{with test} && 0%{!?_flavor:1}
%global build_test ON
%global __brp_check_rpaths %{nil}
%else
@@ -49,6 +58,20 @@
%global build_tensile OFF
%endif
%if 0%{?rhel} || 0%{?sle_version} > 160000
%bcond_with msgpack
%else
%bcond_without msgpack
%endif
# Use ninja if it is available
# Ninja is available on suse but obs times out with ninja build, make doesn't
%if 0%{?fedora}
%bcond_without ninja
%else
%bcond_with ninja
%endif
%if 0%{?rhel} && 0%{?rhel} < 10
# On CS9: /usr/bin/debugedit: Cannot handle 8-byte build ID
%global debug_package %{nil}
@@ -67,20 +90,6 @@
# OracleLinux 9 has a problem with it's strip not recognizing *.co's
%global __strip %rocmllvm_bindir/llvm-strip
# Use ninja if it is available
# Ninja is available on suse but obs times out with ninja build, make doesn't
%if 0%{?fedora}
%bcond_without ninja
%else
%bcond_with ninja
%endif
%if %{with ninja}
%global cmake_generator -G Ninja
%else
%global cmake_generator %{nil}
%endif
%global cmake_config \\\
-DCMAKE_CXX_COMPILER=hipcc \\\
-DCMAKE_C_COMPILER=hipcc \\\
@@ -111,11 +120,15 @@
%bcond_with generic
%global rocm_gpu_list_generic "gfx9-generic;gfx9-4-generic;gfx10-1-generic;gfx10-3-generic;gfx11-generic;gfx12-generic"
%if 0%{!?_flavor:1} || "%{?_flavor}" == "all"
%if %{with generic}
%global gpu_list %{rocm_gpu_list_generic}
%else
%global gpu_list %{rocm_gpu_list_default}
%endif
%else
%global gpu_list %_flavor
%endif
# gfx950 is an experimental target
# Enabling will short circuit the normal build.
@@ -126,18 +139,39 @@
# $ module purge
%bcond_with gfx950
%if %{with gfx950} && 0%{?_flavor:1}
ExclusiveArch: do_not_build
%endif
Name: %{rocblas_name}
Version: %{rocm_version}
Release: 8%{?dist}
Release: 9%{?dist}
Summary: BLAS implementation for ROCm
Url: https://github.com/ROCmSoftwarePlatform/%{upstreamname}
License: MIT AND BSD-3-Clause
Source0: %{url}/archive/refs/tags/rocm-%{rocm_version}.tar.gz#/%{upstreamname}-%{rocm_version}.tar.gz
Source1: rocblas.rpmlintrc
Source2: _multibuild
Patch2: 0001-fixup-install-of-tensile-output.patch
Patch3: Modify-CMakeLists.txt-files-to-allow-to-build-modules-independently.patch
Patch4: 0001-offload-compress-option.patch
Patch6: 0001-option-to-disable-roctracer-logging.patch
%if 0%{use_flavors}
%(for i in `sed -ne "/package/s@ *<package>\([^<]*\)</package>@\1@p" %{S:2}`;\
do echo "Requires: rocblas-tensile-$i = %version";\
done)
%if %{with check}
# If %check is enabled, we need to serialize the builds which will introduce
# a circular dependency. The flag below causes OBS to ignore this.
#
#!BuildIgnore: %name
%(for i in `sed -ne "/package/s@ *<package>\([^<]*\)</package>@\1@p" %{S:2}`;\
do echo "BuildRequires: rocblas-tensile-$i = %version";\
done)
%endif
%endif
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: rocm-cmake
@@ -153,37 +187,29 @@ BuildRequires: rocm-rpm-macros-modules
%if %{suse_version} < 1699
BuildRequires: python3-tensile-devel
BuildRequires: python3-joblib
%else
%else # suse_version 1699
BuildRequires: python311-tensile-devel
%endif # suse_version < 1699
# OBS vm times out without console output
%global tensile_verbose 2
%global tensile_library_format yaml
%else
%{?with_msgpack:BuildRequires: msgpack-cxx-devel}
%else # ?suse_version
BuildRequires: python3dist(tensile)
%if 0%{?rhel}
%global tensile_verbose 2
%global tensile_library_format yaml
%else
BuildRequires: msgpack-devel
%global tensile_verbose 1
%global tensile_library_format msgpack
%endif
%{?with_msgpack:BuildRequires: msgpack-devel}
%endif # suse_version
%else
%global tensile_verbose %{nil}
%global tensile_library_format %{nil}
%endif # tensile
%rocm_set_tensile
%if %{with compress}
BuildRequires: pkgconfig(libzstd)
%endif
%if %{with test}
%if 0%{?suse_version}
BuildRequires: %{python_module PyYAML}
%else
BuildRequires: python3dist(pyyaml)
%endif
BuildRequires: blas-devel
BuildRequires: libomp-devel
BuildRequires: python3dist(pyyaml)
BuildRequires: rocminfo
BuildRequires: rocm-smi-devel
BuildRequires: roctracer-devel
@@ -198,15 +224,7 @@ BuildRequires: gtest-devel
%endif
%if %{with ninja}
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: ninja-build
%endif
%if 0%{?suse_version}
BuildRequires: ninja
%define __builder ninja
%endif
%endif
%rocm_set_ninja
Provides: rocblas = %{version}-%{release}
@@ -230,9 +248,17 @@ Provides: rocblas-devel = %{version}-%{release}
%description devel
%{summary}
%package -n rocblas-tensile-%{?_flavor}
Summary: ROCBlas Tensile Module for %{?__flavor} Architecture
Requires: %{name} = %version
%description -n rocblas-tensile-%{?_flavor}
BLAS architecture modules for %{?__flavor} AMDGPU architectures
%if %{with test}
%package test
Summary: Tests for %{name}
Requires: diffutils
Requires: %{name}%{?_isa} = %{version}-%{release}
%description test
@@ -258,7 +284,7 @@ Conflicts: %{name}-devel
%description gfx950-devel
%{summary}
%if %{with test}
%if %{with test} && 0%{!?_flavor:1}
%package gfx950-test
Summary: The gfx950 rocBLAS test package
Requires: %{name}-gfx950%{?_isa} = %{version}-%{release}
@@ -328,6 +354,11 @@ module load rocm/gfx950
-DCMAKE_INSTALL_LIBDIR=${ROCM_LIB}
%else
%if %use_flavors && 0%{!?_flavor:1}
export TENSILE_SKIP_LIBRARY=true
%endif
%cmake %{cmake_generator} %{cmake_config} \
-DGPU_TARGETS=%{gpu_list} \
-DBUILD_WITH_TENSILE=%{build_tensile} \
@@ -335,27 +366,28 @@ module load rocm/gfx950
%endif
%cmake_build
%cmake_build %{?_flavor:TENSILE_LIBRARY_TARGET}
%if %{with gfx950}
module purge
%endif
%install
%if 0%{?_flavor:1}
DESTDIR=%{buildroot} /usr/bin/cmake -P build/library/src/TensileInstall/cmake_install.cmake
%else
%cmake_install
if [ -f %{buildroot}%{_prefix}/share/doc/rocblas/LICENSE.md ]; then
rm %{buildroot}%{_prefix}/share/doc/rocblas/LICENSE.md
fi
%endif
%check
%if 0%{!?flavor:1}
%if %{with test}
%if %{with check}
%if 0%{?suse_version}
export LD_LIBRARY_PATH=%{__builddir}/library/src:$LD_LIBRARY_PATH
%{__builddir}/clients/staging/rocblas-test --gtest_brief=1
%else
export LD_LIBRARY_PATH=%{_vpath_builddir}/library/src:$LD_LIBRARY_PATH
%{_vpath_builddir}/clients/staging/rocblas-test --gtest_brief=1
export LD_LIBRARY_PATH=%{rocm_builddir}/library/src:$LD_LIBRARY_PATH
%{rocm_builddir}/clients/staging/rocblas-test --gtest_brief=1
%endif
%endif
%endif
@@ -379,15 +411,18 @@ export LD_LIBRARY_PATH=%{_vpath_builddir}/library/src:$LD_LIBRARY_PATH
%else
%if 0%{!?_flavor:1}
%files
%license LICENSE.md
%{_libdir}/librocblas.so.4{,.*}
%if %{with tensile}
%if ! %{?use_flavors}
%dir %{_libdir}/rocblas
%dir %{_libdir}/rocblas/library
%{_libdir}/rocblas/library/Kernels*
%{_libdir}/rocblas/library/Tensile*
%endif
%endif # with tensile
%files devel
%doc README.md
@@ -402,9 +437,28 @@ export LD_LIBRARY_PATH=%{_vpath_builddir}/library/src:$LD_LIBRARY_PATH
%{_bindir}/rocblas*
%endif
%else # ?_flavor
%if %{with tensile}
%files -n rocblas-tensile-%{?_flavor}
%dir %{_libdir}/rocblas
%dir %{_libdir}/rocblas/library
%{_libdir}/rocblas/library/Kernels*
%{_libdir}/rocblas/library/Tensile*
%endif
%endif # ?_flavor
%endif # gfx950
%changelog
* Thu Jun 12 2025 Egbert Eich <eich@suse.com> - 6.4.0-9
- Build and package core library and arch dependent
tensile modules separately to parallelize the build.
- Fix build and runtime dependencies of test package.
- Use distro specific macros to hide some distribution differences.
- Restructure spec file (move bcond_with* settings to
the top).
* Wed Jun 11 2025 Tom Rix <Tom.Rix@amd.com> - 6.4.0-8
- Remove suse check for using ldconfig