Projects
home:Thomas134:branches:Factory:RISC-V:ROCm
rocMLIR
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 4
View file
rocmlir.spec
Added
@@ -0,0 +1,175 @@ +%global upstreamname rocMLIR +%define debug_package %{nil} + +%global rocm_release 6.2 +%global rocm_patch 2 +%global rocm_version %{rocm_release}.%{rocm_patch} + +%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/') + +# $gpu will be evaluated in the loops below +%global _vpath_builddir %{_vendor}-%{_target_os}-build-${gpu} + +%bcond_with debug +%if %{with debug} +%global build_type DEBUG +%else +%global build_type RelWithDebInfo +%endif + +# It is necessary to use this with a local build +# export QA_RPATHS=0xff +%bcond_with test +%if %{with test} +%global build_test ON +%else +%global build_test OFF +%endif + +# Option to test suite for testing on real HW: +%bcond_with check + +Name: rocmlir +Version: %{rocm_version} +Release: 2 +Summary: rocMLIR is for a MLIR-based convolution and GEMM kernel generator targetting AMD hardware. + +Url: https://github.com/ROCm/rocMLIR +License: MIT and BSD +Source0: %{url}/archive/rocm-%{version}.tar.gz#/%{upstreamname}-%{version}.tar.gz + +Patch0: 0001-Fix-build-on-riscv64.patch + +BuildRequires: git +BuildRequires: cmake +BuildRequires: rocm-cmake +BuildRequires: rocm-comgr-devel +BuildRequires: rocm-hip-devel +BuildRequires: rocm-runtime-devel +BuildRequires: rocm-rpm-macros +BuildRequires: rocm-rpm-macros-modules +BuildRequires: rocblas-devel +BuildRequires: ninja-build + +#Use compat if LLVM is not latest, 1 is enable +%global compat_build 1 +%global maj_ver 18 + +%if %{compat_build} +BuildRequires: llvm%{maj_ver} +BuildRequires: llvm%{maj_ver}-devel +BuildRequires: llvm%{maj_ver}-test +BuildRequires: llvm%{maj_ver}-cmake-utils +BuildRequires: llvm%{maj_ver}-libs +BuildRequires: lld%{maj_ver} +BuildRequires: lld%{maj_ver}-devel +BuildRequires: clang%{maj_ver} +BuildRequires: clang%{maj_ver}-devel +BuildRequires: clang%{maj_ver}-libs +BuildRequires: clang%{maj_ver}-tools-extra +%else +BuildRequires: llvm-devel = %{version} +BuildRequires: llvm-test = %{version} +BuildRequires: llvm-cmake-utils = %{version} +%endif + +%if %{with test} +BuildRequires: gtest-devel +%endif + +Requires: rocm-rpm-macros-modules + +# Only x86_64 works right now: +ExclusiveArch: x86_64 riscv64 + +%description +rocMLIR is for a MLIR-based convolution and GEMM kernel generator +targetting AMD hardware. This generator is mainly used from MIGraphX, +but it can be used on a standalone basis. (The ability to use this code +via torch-mlir is being investigated as well.) + +%package devel +Summary: The rocRAND development package +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The rocRAND development package. + +%if %{with test} +%package test +Summary: Tests for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description test +%{summary} +%endif + +%prep +%autosetup -p1 -n %{upstreamname}-rocm-%{version} + +%build +for gpu in %{rocm_gpu_list} +do + module load rocm/$gpu + mkdir %{_target_platform}-$gpu + pushd %{_target_platform}-$gpu + # We can't compile all the targets at once + export ROCM_GPUS='gfx1030;gfx1100' + %cmake -G Ninja .. \ + -DCMAKE_BUILD_TYPE=%build_type \ + -DAMDGPU_TARGETS=${ROCM_GPUS} \ + -DCMAKE_INSTALL_LIBDIR=$ROCM_LIB \ + -DCMAKE_INSTALL_BINDIR=$ROCM_BIN \ + -DCMAKE_C_FLAGS="-Wno-gnu-line-marker" \ + -DCMAKE_C_COMPILER=%{_libdir}/llvm%{maj_ver}/bin/clang \ + -DCMAKE_CXX_COMPILER=%{_libdir}/llvm%{maj_ver}/bin/clang++ \ + -DBUILD_FAT_LIBROCKCOMPILER=ON \ + -DCMAKE_CXX_FLAGS="-Wno-gnu-line-marker -Wno-narrowing" \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DBUILD_TEST=%build_test + popd + ninja -C %{_target_platform}-$gpu %{?_smp_mflags} -v + module purge +done + +%install +for gpu in %{rocm_gpu_list} +do + DESTDIR=%{buildroot} ninja -C %{_target_platform}-$gpu install +done + +echo s@%{buildroot}@@ > br.sed +find %{buildroot}/usr/lib -name '*.a' | sed -f br.sed > %{name}.files +find %{buildroot}/usr/lib -name '*.o' | sed -f br.sed >> %{name}.files +find %{buildroot}%{_libdir} -name '*.cmake' | sed -f br.sed > %{name}.devel +%if %{with test} +find %{buildroot} -name 'test_*' | sed -f br.sed > %{name}.test +find %{buildroot} -name '*RAND' | sed -f br.sed >> %{name}.test +%endif + +%check +%if %{with test} +%if %{with check} +# Assumes default +%ctest +%endif +%endif + +%files -f %{name}.files +%license %{_docdir}/%{name}/LICENSE + +%files devel -f %{name}.devel +%{_includedir}/%{name} + +%if %{with test} +%files test -f %{name}.test +%endif + +%changelog +* Thu Dec 11 2024 QiuWenjian <wenjian.oerv@isrc.iscas.ac.cn> - 6.2.2-2 +- Fix compile error + +* Tue Nov 26 2024 misaka00251 <liuxin@iscas.ac.cn> - 6.2.2-1 +- Init package
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2