8 Commits

Author SHA1 Message Date
f9638ce9c8 Split builds for core library and tensile modules
Build and package core library and arch dependent
tensile modules separately to parallelize the build.
Add:
Modify-CMakeLists.txt-files-to-allow-to-build-modules-independently.patch

Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-13 11:48:10 +02:00
c78f006f1c Fix buildinfo and compiler flags handling for SUSE
When building without debug support, remove `-g` flag
from compiler arguments.
Also make sure the %build_cxxflags macro is used. SUSE
doesn't use it by default.

Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-11 16:51:42 +02:00
f1a170e59f Restructure tensile verbosity option
Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-06 16:33:27 +02:00
1d0dc4c3a6 Consolidate Python module BuildRequires for SUSE
Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-06 16:33:27 +02:00
036475756a Enable msgpack for SUSE
Also restructure tensile_library_format build option.

Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-06 16:33:27 +02:00
78c6468afd Add rpmlintrc
This suppresses errors incorrectly generated for tensile modules.

Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-06 16:33:25 +02:00
09a815cc30 enable Ninja on SUSE, restructure spec file
Move bcond_with* settings to the top.

Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-06 16:32:52 +02:00
af5d87154b Fix build and runtime dependencies of test package
Signed-off-by: Egbert Eich <eich@suse.com>
2025-08-05 06:56:25 +02:00
3 changed files with 197 additions and 32 deletions

View File

@@ -0,0 +1,80 @@
From: Egbert Eich <eich@suse.com>
Date: Wed Apr 30 16:18:49 2025 +0200
Subject: Modify CMakeLists.txt files to allow to build modules independently
Patch-mainline: Not yet
Git-commit: f4724507a2770b2ed5ecc633aa406ad70a675e6f
References:
Signed-off-by: Egbert Eich <eich@suse.com>
Signed-off-by: Egbert Eich <eich@suse.de>
---
library/src/CMakeLists.txt | 24 +++++-------------------
library/src/TensileInstall/CMakeLists.txt | 19 +++++++++++++++++++
2 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt
index 35342e1..efa732c 100644
--- a/library/src/CMakeLists.txt
+++ b/library/src/CMakeLists.txt
@@ -97,7 +97,9 @@ if( BUILD_WITH_TENSILE )
set_target_properties( TensileHost PROPERTIES OUTPUT_NAME rocblas-tensile CXX_EXTENSIONS NO )
# Tensile host depends on libs build target
- add_dependencies( TensileHost TENSILE_LIBRARY_TARGET )
+ if(NOT DEFINED ENV{TENSILE_SKIP_LIBRARY} OR NOT $ENV{TENSILE_SKIP_LIBRARY})
+ add_dependencies( TensileHost TENSILE_LIBRARY_TARGET )
+ endif()
if( ROCBLAS_SHARED_LIBS )
set( BUILD_SHARED_LIBS ON )
@@ -823,24 +825,8 @@ rocm_install_targets(
${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}
)
-if( BUILD_WITH_TENSILE )
- if (WIN32)
- set( ROCBLAS_TENSILE_LIBRARY_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}/bin/rocblas" CACHE PATH "path to tensile library" )
- else()
- set( ROCBLAS_TENSILE_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}/rocblas" CACHE PATH "path to tensile library" )
- endif()
- # For ASAN package, Tensile library files(which are not shared libraries) are not required
- if( NOT ENABLE_ASAN_PACKAGING )
- if( BUILD_SHARED_LIBS )
- set( TENSILE_DATA_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} )
- else()
- set( TENSILE_DATA_COMPONENT_NAME devel )
- endif()
- rocm_install(
- DIRECTORY ${CMAKE_BINARY_DIR}/Tensile/library
- DESTINATION ${ROCBLAS_TENSILE_LIBRARY_DIR}
- COMPONENT ${TENSILE_DATA_COMPONENT_NAME}) # Use this cmake variable to be compatible with rocm-cmake 0.6 and 0.7
- endif()
+if(NOT DEFINED ENV{TENSILE_SKIP_LIBRARY} OR NOT $ENV{TENSILE_SKIP_LIBRARY})
+ add_subdirectory( TensileInstall )
endif()
if(NOT WIN32)
diff --git a/library/src/TensileInstall/CMakeLists.txt b/library/src/TensileInstall/CMakeLists.txt
new file mode 100644
index 0000000..fa39e9f
--- /dev/null
+++ b/library/src/TensileInstall/CMakeLists.txt
@@ -0,0 +1,19 @@
+if( BUILD_WITH_TENSILE )
+ if (WIN32)
+ set( ROCBLAS_TENSILE_LIBRARY_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}/bin/rocblas" CACHE PATH "path to tensile library" )
+ else()
+ set( ROCBLAS_TENSILE_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}/rocblas" CACHE PATH "path to tensile library" )
+ endif()
+ # For ASAN package, Tensile library files(which are not shared libraries) are not required
+ if( NOT ENABLE_ASAN_PACKAGING )
+ if( BUILD_SHARED_LIBS )
+ set( TENSILE_DATA_COMPONENT_NAME ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} )
+ else()
+ set( TENSILE_DATA_COMPONENT_NAME devel )
+ endif()
+ rocm_install(
+ DIRECTORY ${CMAKE_BINARY_DIR}/Tensile/library
+ DESTINATION ${ROCBLAS_TENSILE_LIBRARY_DIR}
+ COMPONENT ${TENSILE_DATA_COMPONENT_NAME}) # Use this cmake variable to be compatible with rocm-cmake 0.6 and 0.7
+ endif()
+endif()

3
rocblas.rpmlintrc Normal file
View File

@@ -0,0 +1,3 @@
# librocblas4-arch-.* are no shared libraries but modules loaded onto the GPU.
addFilter("rocblas-arch-.*: W: shared-lib-without-dependency-information")
addFilter("rocblas-arch-.*: E: shlib-fixed-dependency.")

View File

@@ -9,16 +9,32 @@
%global rocm_patch 2 %global rocm_patch 2
%global rocm_version %{rocm_release}.%{rocm_patch} %global rocm_version %{rocm_release}.%{rocm_patch}
%if 0%{?suse_version}
# On SUSE build the .so module only - tensile modules are built in a separate package
%bcond_with tensile_package
%define build_tensile_separately 1
%else
%define build_tensile_separately 0
%endif
%global toolchain rocm %global toolchain rocm
# hipcc does not support some clang flags # 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/' -e 's/-mtls-dialect=gnu2//') %global build_cxxflags %(echo %{optflags} | sed -e 's/-fstack-protector-strong/-Xarch_host -fstack-protector-strong/' -e 's/-fcf-protection/-Xarch_host -fcf-protection/' -e 's/-mtls-dialect=gnu2//')
%bcond_with debug %bcond_with debug
%if 0%{?suse_version}
%if %{without debug}
%global build_type RELEASE
%global build_cxxflags %(echo %{optflags} | sed -e 's/-g\\( \\|$\\)/ /')
%endif
%else
%if %{with debug} %if %{with debug}
%global build_type DEBUG %global build_type DEBUG
%else %else
%global build_type RELEASE %global build_type RELEASE
%endif %endif
%endif
%bcond_without compress %bcond_without compress
%if %{with compress} %if %{with compress}
@@ -28,7 +44,7 @@
%endif %endif
%bcond_with test %bcond_with test
%if %{with test} %if %{with test} && %{without tensile_package}
%global build_test ON %global build_test ON
%global __brp_check_rpaths %{nil} %global __brp_check_rpaths %{nil}
%else %else
@@ -49,6 +65,19 @@
%global build_tensile OFF %global build_tensile OFF
%endif %endif
%if 0%{?rhel}
%bcond_with msgpack
%else
%bcond_without msgpack
%endif
# Use ninja if it is available
%if 0%{?fedora} || 0%{?suse_version}
%bcond_without ninja
%else
%bcond_with ninja
%endif
%if 0%{?rhel} && 0%{?rhel} < 10 %if 0%{?rhel} && 0%{?rhel} < 10
# On CS9: /usr/bin/debugedit: Cannot handle 8-byte build ID # On CS9: /usr/bin/debugedit: Cannot handle 8-byte build ID
%global debug_package %{nil} %global debug_package %{nil}
@@ -67,14 +96,6 @@
# OracleLinux 9 has a problem with it's strip not recognizing *.co's # OracleLinux 9 has a problem with it's strip not recognizing *.co's
%global __strip %rocmllvm_bindir/llvm-strip %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} %if %{with ninja}
%global cmake_generator -G Ninja %global cmake_generator -G Ninja
%else %else
@@ -87,7 +108,7 @@
-DCMAKE_LINKER=%rocmllvm_bindir/ld.lld \\\ -DCMAKE_LINKER=%rocmllvm_bindir/ld.lld \\\
-DCMAKE_AR=%rocmllvm_bindir/llvm-ar \\\ -DCMAKE_AR=%rocmllvm_bindir/llvm-ar \\\
-DCMAKE_RANLIB=%rocmllvm_bindir/llvm-ranlib \\\ -DCMAKE_RANLIB=%rocmllvm_bindir/llvm-ranlib \\\
-DCMAKE_BUILD_TYPE=%{build_type} \\\ %{?build_type:-DCMAKE_BUILD_TYPE=%{build_type}} \\\
-DCMAKE_PREFIX_PATH=%{rocmllvm_cmakedir}/.. \\\ -DCMAKE_PREFIX_PATH=%{rocmllvm_cmakedir}/.. \\\
-DCMAKE_SKIP_RPATH=ON \\\ -DCMAKE_SKIP_RPATH=ON \\\
-DCMAKE_VERBOSE_MAKEFILE=ON \\\ -DCMAKE_VERBOSE_MAKEFILE=ON \\\
@@ -119,16 +140,29 @@
Name: %{rocblas_name} Name: %{rocblas_name}
Version: %{rocm_version} Version: %{rocm_version}
Release: 4%{?dist} Release: 5%{?dist}
Summary: BLAS implementation for ROCm Summary: BLAS implementation for ROCm
Url: https://github.com/ROCmSoftwarePlatform/%{upstreamname} Url: https://github.com/ROCmSoftwarePlatform/%{upstreamname}
License: MIT AND BSD-3-Clause License: MIT AND BSD-3-Clause
Source0: %{url}/archive/refs/tags/rocm-%{rocm_version}.tar.gz#/%{upstreamname}-%{rocm_version}.tar.gz Source0: %{url}/archive/refs/tags/rocm-%{rocm_version}.tar.gz#/%{upstreamname}-%{rocm_version}.tar.gz
Source1: rocblas.rpmlintrc
Patch2: 0001-fixup-install-of-tensile-output.patch 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 Patch4: 0001-offload-compress-option.patch
Patch6: 0001-option-to-disable-roctracer-logging.patch Patch6: 0001-option-to-disable-roctracer-logging.patch
%if 0%{build_tensile_separately}
Requires: rocblas-tensile = %version
%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
BuildRequires: rocblas-tensile = %version
%endif
%endif
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: rocm-cmake BuildRequires: rocm-cmake
@@ -141,26 +175,24 @@ BuildRequires: rocm-rpm-macros-modules
%if %{with tensile} %if %{with tensile}
%if 0%{?suse_version} %if 0%{?suse_version}
%if %{suse_version} < 1699 BuildRequires: %{python_module tensile-devel}
BuildRequires: python3-tensile-devel BuildRequires: %{python_module joblib}
BuildRequires: python3-joblib %{?with_msgpack:BuildRequires: msgpack-cxx-devel}
%else
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 %else
BuildRequires: python3dist(tensile) BuildRequires: python3dist(tensile)
%if 0%{?rhel} %{?with_msgpack:BuildRequires: msgpack-devel}
%global tensile_verbose 2
%global tensile_library_format yaml
%else
BuildRequires: msgpack-devel
%global tensile_verbose 1
%global tensile_library_format msgpack
%endif
%endif # suse_version %endif # suse_version
# OBS vm times out without console output
%if 0%{?rhel} || 0%{?suse_version}
%global tensile_verbose 2
%else
%global tensile_verbose 1
%endif
%if %{with msgpack}
%global tensile_library_format msgpack
%else
%global tensile_library_format yaml
%endif
%else %else
%global tensile_verbose %{nil} %global tensile_verbose %{nil}
%global tensile_library_format %{nil} %global tensile_library_format %{nil}
@@ -171,10 +203,13 @@ BuildRequires: pkgconfig(libzstd)
%endif %endif
%if %{with test} %if %{with test}
%if 0%{?suse_version}
BuildRequires: %{python_module PyYAML}
%else
BuildRequires: python3dist(pyyaml)
%endif
BuildRequires: blas-devel BuildRequires: blas-devel
BuildRequires: libomp-devel BuildRequires: libomp-devel
BuildRequires: python3dist(pyyaml)
BuildRequires: rocminfo BuildRequires: rocminfo
BuildRequires: rocm-smi-devel BuildRequires: rocm-smi-devel
BuildRequires: roctracer-devel BuildRequires: roctracer-devel
@@ -221,9 +256,17 @@ Provides: rocblas-devel = %{version}-%{release}
%description devel %description devel
%{summary} %{summary}
%if %{with test} %package -n rocblas-tensile
Summary: ROCBlas Tensile Modules
Requires: %{name} = %version
%description -n rocblas-tensile
BLAS architecture modules for all AMDGPU architectures
%if %{with test} && %{without tensile_package}
%package test %package test
Summary: Tests for %{name} Summary: Tests for %{name}
Requires: diffutils
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
%description test %description test
@@ -276,21 +319,31 @@ if [ ${CORES} = 1 ]; then
fi fi
fi fi
%if %{build_tensile_separately} && %{without tensile_package}
export TENSILE_SKIP_LIBRARY=true
%endif
%{?suse_version:%{?build_cxxflags:CXXFLAGS="%{build_cxxflags}"}}
%cmake %{cmake_generator} %{cmake_config} \ %cmake %{cmake_generator} %{cmake_config} \
-DGPU_TARGETS=%{gpu_list} \ -DGPU_TARGETS=%{gpu_list} \
-DBUILD_WITH_TENSILE=%{build_tensile} \ -DBUILD_WITH_TENSILE=%{build_tensile} \
-DCMAKE_INSTALL_LIBDIR=%_libdir \ -DCMAKE_INSTALL_LIBDIR=%_libdir \
%cmake_build %cmake_build %{?with_tensile_package:TENSILE_LIBRARY_TARGET}
%install %install
%if %{with tensile_package}
DESTDIR=%{buildroot} /usr/bin/cmake -P build/library/src/TensileInstall/cmake_install.cmake
%else
%cmake_install %cmake_install
if [ -f %{buildroot}%{_prefix}/share/doc/rocblas/LICENSE.md ]; then if [ -f %{buildroot}%{_prefix}/share/doc/rocblas/LICENSE.md ]; then
rm %{buildroot}%{_prefix}/share/doc/rocblas/LICENSE.md rm %{buildroot}%{_prefix}/share/doc/rocblas/LICENSE.md
fi fi
%endif
%check %check
%if %{without tensile_package}
%if %{with test} %if %{with test}
%if %{with check} %if %{with check}
%if 0%{?suse_version} %if 0%{?suse_version}
@@ -302,16 +355,20 @@ export LD_LIBRARY_PATH=%{_vpath_builddir}/library/src:$LD_LIBRARY_PATH
%endif %endif
%endif %endif
%endif %endif
%endif
%if %{without tensile_package}
%files %files
%license LICENSE.md %license LICENSE.md
%{_libdir}/librocblas.so.4{,.*} %{_libdir}/librocblas.so.4{,.*}
%if %{with tensile} %if %{with tensile}
%if ! %{build_tensile_separately}
%dir %{_libdir}/rocblas %dir %{_libdir}/rocblas
%dir %{_libdir}/rocblas/library %dir %{_libdir}/rocblas/library
%{_libdir}/rocblas/library/Kernels* %{_libdir}/rocblas/library/Kernels*
%{_libdir}/rocblas/library/Tensile* %{_libdir}/rocblas/library/Tensile*
%endif %endif
%endif # with tensile
%files devel %files devel
%doc README.md %doc README.md
@@ -326,7 +383,32 @@ export LD_LIBRARY_PATH=%{_vpath_builddir}/library/src:$LD_LIBRARY_PATH
%{_bindir}/rocblas* %{_bindir}/rocblas*
%endif %endif
%else # ?tensile_package
%if %{with tensile}
%files -n rocblas-tensile
%dir %{_libdir}/rocblas
%dir %{_libdir}/rocblas/library
%{_libdir}/rocblas/library/Kernels*
%{_libdir}/rocblas/library/Tensile*
%endif
%endif # ?tensile_package
%changelog %changelog
* Fri Aug 1 2025 Egbert Eich <eich@suse.com> - 6.4.2-5
- Fix build and runtime dependencies of test package.
- Enable Ninja on SUSE and Move bcond_with* settings to the top of spec file.
- Add rpmlitrc to suppress erroneous error messages when
building tensile module package.
- Enable msgpack on SUSE, restructure build requires and build settings.
- Consoldiate Python module BuildRequires for SUSE.
- Restructure tensile verbosity option.
- Fix buildinfo and compiler flags handling for SUSE.
- Build and package core library and arch dependent
tensile modules separately to parallelize the build.
Add: Modify-CMakeLists.txt-files-to-allow-to-build-modules-independently.patch
* Tue Jul 29 2025 Tom Rix <Tom.Rix@amd.com> - 6.4.2-4 * Tue Jul 29 2025 Tom Rix <Tom.Rix@amd.com> - 6.4.2-4
- Remove -mtls-dialect cflag - Remove -mtls-dialect cflag