nixpkgs/pkgs/development/rocm-modules/5/rocmlir/default.nix
Madoura 39b6fcc8c7
rocmPackages: 5.7.0 -> 5.7.1
rocmPackages.clang-ocl: 5.7.0 -> 5.7.1

rocmPackages.hip-common: 5.7.0 -> 5.7.1

rocmPackages.half: 5.7.0 -> 5.7.1

rocmPackages.hipcc: 5.7.0 -> 5.7.1

rocmPackages.hipcub: 5.7.0 -> 5.7.1

rocmPackages.hipfft: 5.7.0 -> 5.7.1

rocmPackages.composable_kernel: 5.7.0 -> 5.7.1

rocmPackages.hipblas: 5.7.0 -> 5.7.1

rocmPackages.hiprand: 5.7.0 -> 5.7.1

rocmPackages.hipsolver: 5.7.0 -> 5.7.1

rocmPackages.hipsparse: 5.7.0 -> 5.7.1

rocmPackages.llvm.llvm: 5.7.0 -> 5.7.1

rocmPackages.migraphx: 5.7.0 -> 5.7.1

rocmPackages.hipfort: 5.7.0 -> 5.7.1

rocmPackages.miopen: 5.7.0 -> 5.7.1

rocmPackages.mivisionx: 5.7.0 -> 5.7.1

rocmPackages.hipify: 5.7.0 -> 5.7.1

rocmPackages.rocalution: 5.7.0 -> 5.7.1

rocmPackages.rocblas: 5.7.0 -> 5.7.1

rocmPackages.rdc: 5.7.0 -> 5.7.1

rocmPackages.rocfft: 5.7.0 -> 5.7.1

rocmPackages.rocgdb: 5.7.0 -> 5.7.1

rocmPackages.rccl: 5.7.0 -> 5.7.1

rocmPackages.rocm-comgr: 5.7.0 -> 5.7.1

rocmPackages.rocm-cmake: 5.7.0 -> 5.7.1

rocmPackages.rocm-device-libs: 5.7.0 -> 5.7.1

rocmPackages.rocm-runtime: 5.7.0 -> 5.7.1

rocmPackages.rocm-smi: 5.7.0 -> 5.7.1

rocmPackages.rocm-thunk: 5.7.0 -> 5.7.1

rocmPackages.rocminfo: 5.7.0 -> 5.7.1

rocmPackages.rocmlir: 5.7.0 -> 5.7.1

rocmPackages.rocdbgapi: 5.7.0 -> 5.7.1

rocmPackages.rocprim: 5.7.0 -> 5.7.1

rocmPackages.rocr-debug-agent: 5.7.0 -> 5.7.1

rocmPackages.rocsolver: 5.7.0 -> 5.7.1

rocmPackages.rocm-docs-core: 0.25.0 -> 0.26.0

rocmPackages.rocthrust: 5.7.0 -> 5.7.1

rocmPackages.rocprofiler: 5.7.0 -> 5.7.1

rocmPackages.roctracer: 5.7.0 -> 5.7.1

rocmPackages.rocsparse: 5.7.0 -> 5.7.1

rocmPackages.rpp: 5.7.0 -> 5.7.1

rocmPackages.tensile: 5.7.0 -> 5.7.1

rocmPackages.rocwmma: 5.7.0 -> 5.7.1

rocmPackages.clr: 5.7.0 -> 5.7.1
2023-10-17 15:23:30 -05:00

131 lines
3.2 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, cmake
, rocm-cmake
, ninja
, clr
, git
, libxml2
, libedit
, zstd
, zlib
, ncurses
, python3Packages
, buildRockCompiler ? false
, buildTests ? false # `argument of type 'NoneType' is not iterable`
}:
# Theoretically, we could have our MLIR have an output
# with the source and built objects so that we can just
# use it as the external LLVM repo for this
let
suffix =
if buildRockCompiler
then "-rock"
else "";
llvmNativeTarget =
if stdenv.isx86_64 then "X86"
else if stdenv.isAarch64 then "AArch64"
else throw "Unsupported ROCm LLVM platform";
in stdenv.mkDerivation (finalAttrs: {
pname = "rocmlir${suffix}";
version = "5.7.1";
outputs = [
"out"
] ++ lib.optionals (!buildRockCompiler) [
"external"
];
src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "rocMLIR";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-vPi4UVljohVAfnwDVQqeOVaJPa6v8aV5uBOtqLddTtc=";
};
nativeBuildInputs = [
cmake
rocm-cmake
ninja
clr
python3Packages.python
python3Packages.tomli
];
buildInputs = [
git
libxml2
libedit
];
propagatedBuildInputs = [
zstd
zlib
ncurses
];
cmakeFlags = [
"-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}"
"-DLLVM_ENABLE_ZSTD=ON"
"-DLLVM_ENABLE_ZLIB=ON"
"-DLLVM_ENABLE_TERMINFO=ON"
"-DROCM_PATH=${clr}"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals buildRockCompiler [
"-DBUILD_FAT_LIBROCKCOMPILER=ON"
] ++ lib.optionals (!buildRockCompiler) [
"-DROCM_TEST_CHIPSET=gfx000"
];
postPatch = ''
patchShebangs mlir
substituteInPlace mlir/utils/performance/common/CMakeLists.txt \
--replace "/opt/rocm" "${clr}"
'';
dontBuild = true;
doCheck = true;
# Certain libs aren't being generated, try enabling tests next update
checkTarget = if buildRockCompiler
then "librockCompiler"
else if buildTests
then "check-rocmlir"
else "check-rocmlir-build-only";
postInstall = let
libPath = lib.makeLibraryPath [ zstd zlib ncurses clr stdenv.cc.cc ];
in lib.optionals (!buildRockCompiler) ''
mkdir -p $external/lib
cp -a external/llvm-project/llvm/lib/{*.a*,*.so*} $external/lib
patchelf --set-rpath $external/lib:$out/lib:${libPath} $external/lib/*.so*
patchelf --set-rpath $out/lib:$external/lib:${libPath} $out/{bin/*,lib/*.so*}
'';
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
page = "tags?per_page=2";
filter = ".[1].name | split(\"-\") | .[1]";
};
meta = with lib; {
description = "MLIR-based convolution and GEMM kernel generator";
homepage = "https://github.com/ROCmSoftwarePlatform/rocMLIR";
license = with licenses; [ asl20 ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})