archrelease: copy trunk to community-any
[ArchLinux/community.git] / miopen-hip / repos / community-x86_64 / PKGBUILD
blobdaed8155c4d37aaa656ca600f47ce9f8e52ee0b3
1 # Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
2 # Contributor: acxz <akashpatel at yahoo dot com>
3 # Contributor: JP-Ellis <josh@jpellis.me>
5 pkgname=miopen-hip
6 pkgver=5.4.3
7 pkgrel=1
8 pkgdesc="AMD's Machine Intelligence Library (HIP backend)"
9 arch=('x86_64')
10 url='https://rocmsoftwareplatform.github.io/MIOpen/doc/html/'
11 license=('MIT')
12 depends=('rocblas' 'rocm-clang-ocl' 'hip' 'composable-kernel' 'sqlite')
13 makedepends=('rocm-cmake' 'miopengemm' 'boost' 'nlohmann-json' 'half' 'ninja')
14 provides=('miopen')
15 conflicts=('miopen')
16 _git='https://github.com/ROCmSoftwarePlatform/MIOpen'
17 _mlir='https://github.com/ROCmSoftwarePlatform/rocMLIR'
18 _mlirver=5.4.1 #No changes between 5.4.1 and 5.4.3, so no upstream tag
19 source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz"
20         "$pkgname-rocmlir-$pkgver.tar.gz::$_mlir/archive/rocm-$_mlirver.tar.gz")
21 sha256sums=('37ffe2ed3d7942da8ea2f6bdb85c7a2f58e3ccd31767db158a322769d3604efd'
22             '2474c0b82593284a6ae8e55982e6c7b672e7812ad13f0a4544d1b796d7243966')
23 options=(!lto)
24 _dirname="$(basename "$_git")-$(basename "${source[0]}" .tar.gz)"
25 _mlirname="$(basename "$_mlir")-$(basename "${source[1]}" .tar.gz)"
27 prepare() {
28     # Disable tests as they require a AMD GPU at build time
29     sed -i '/add_subdirectory(test)/d' "$_dirname/CMakeLists.txt"
32 build() {
33   export CC=/opt/rocm/llvm/bin/clang
34   export CXX=/opt/rocm/llvm/bin/clang++
35   # -fcf-protection is not supported by HIP, see
36   # https://docs.amd.com/bundle/ROCm-Compiler-Reference-Guide-v5.4/page/Appendix_A.html
37   export CXXFLAGS="${CXXFLAGS} -fcf-protection=none"
39   # Set ROCm test chipset to Vega in order to pass the configuration step.
40   cmake \
41     -Wno-dev \
42     -G Ninja \
43     -B build-mlir \
44     -S "$_mlirname" \
45     -DCMAKE_INSTALL_PREFIX=/usr \
46     -DCMAKE_BUILD_TYPE=Release \
47     -DMLIR_MIOPEN_SQLITE_ENABLED=ON \
48     -DROCM_TEST_CHIPSET=gfx900 \
49     -DBUILD_FAT_LIBROCKCOMPILER=ON
50   cmake --build build-mlir --target librockCompiler
51   DESTDIR="$srcdir/deps" cmake --install build-mlir --component librockCompiler
53   cmake \
54     -Wno-dev \
55     -G Ninja \
56     -B build \
57     -S "$_dirname" \
58     -DMIOPEN_BACKEND=HIP \
59     -DCMAKE_BUILD_TYPE=None \
60     -DHALF_INCLUDE_DIR=/usr/include/half \
61     -DCMAKE_PREFIX_PATH="$srcdir/deps/usr/lib/cmake" \
62     -DCMAKE_INSTALL_PREFIX=/opt/rocm
63   cmake --build build
66 package() {
67   DESTDIR="$pkgdir" cmake --install build
69   echo '/opt/rocm/miopen/lib' > 'miopen.conf'
70   install -Dm644 "miopen.conf" "$pkgdir/etc/ld.so.conf.d/miopen.conf"
72   install -Dm644 "$_dirname/LICENSE.txt" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"