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>
8 pkgdesc="AMD's Machine Intelligence Library (HIP backend)"
10 url='https://rocmsoftwareplatform.github.io/MIOpen/doc/html/'
12 depends=('rocblas' 'rocm-clang-ocl' 'hip' 'composable-kernel' 'sqlite')
13 makedepends=('rocm-cmake' 'miopengemm' 'boost' 'nlohmann-json' 'half' 'ninja')
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')
24 _dirname="$(basename "$_git")-$(basename "${source[0]}" .tar.gz)"
25 _mlirname="$(basename "$_mlir")-$(basename "${source[1]}" .tar.gz)"
28 # Disable tests as they require a AMD GPU at build time
29 sed -i '/add_subdirectory(test)/d' "$_dirname/CMakeLists.txt"
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.
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
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
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"