nixpkgs/pkgs/development/rocm-modules/5/llvm/base.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

168 lines
4.4 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, pkg-config
, cmake
, ninja
, git
, doxygen
, sphinx
, lit
, libxml2
, libxcrypt
, libedit
, libffi
, mpfr
, zlib
, ncurses
, python3Packages
, buildDocs ? true
, buildMan ? true
, buildTests ? true
, targetName ? "llvm"
, targetDir ? "llvm"
, targetProjects ? [ ]
, targetRuntimes ? [ ]
, llvmTargetsToBuild ? [ "NATIVE" ] # "NATIVE" resolves into x86 or aarch64 depending on stdenv
, extraPatches ? [ ]
, extraNativeBuildInputs ? [ ]
, extraBuildInputs ? [ ]
, extraCMakeFlags ? [ ]
, extraPostPatch ? ""
, checkTargets ? [(
lib.optionalString buildTests (
if targetDir == "runtimes"
then "check-runtimes"
else "check-all"
)
)]
, extraPostInstall ? ""
, hardeningDisable ? [ ]
, requiredSystemFeatures ? [ ]
, extraLicenses ? [ ]
, isBroken ? false
}:
let
llvmNativeTarget =
if stdenv.isx86_64 then "X86"
else if stdenv.isAarch64 then "AArch64"
else throw "Unsupported ROCm LLVM platform";
inferNativeTarget = t: if t == "NATIVE" then llvmNativeTarget else t;
llvmTargetsToBuild' = [ "AMDGPU" ] ++ builtins.map inferNativeTarget llvmTargetsToBuild;
in stdenv.mkDerivation (finalAttrs: {
pname = "rocm-llvm-${targetName}";
version = "5.7.1";
outputs = [
"out"
] ++ lib.optionals buildDocs [
"doc"
] ++ lib.optionals buildMan [
"man"
"info" # Avoid `attribute 'info' missing` when using with wrapCC
];
patches = extraPatches;
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "llvm-project";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-0+lJnDiMntxCYbZBCSWvHOcKXexFfEzRfb49QbfOmK8=";
};
nativeBuildInputs = [
pkg-config
cmake
ninja
git
python3Packages.python
] ++ lib.optionals (buildDocs || buildMan) [
doxygen
sphinx
python3Packages.recommonmark
] ++ lib.optionals (buildTests && !finalAttrs.passthru.isLLVM) [
lit
] ++ extraNativeBuildInputs;
buildInputs = [
libxml2
libxcrypt
libedit
libffi
mpfr
] ++ extraBuildInputs;
propagatedBuildInputs = lib.optionals finalAttrs.passthru.isLLVM [
zlib
ncurses
];
sourceRoot = "${finalAttrs.src.name}/${targetDir}";
cmakeFlags = [
"-DLLVM_TARGETS_TO_BUILD=${builtins.concatStringsSep ";" llvmTargetsToBuild'}"
] ++ lib.optionals (finalAttrs.passthru.isLLVM && targetProjects != [ ]) [
"-DLLVM_ENABLE_PROJECTS=${lib.concatStringsSep ";" targetProjects}"
] ++ lib.optionals ((finalAttrs.passthru.isLLVM || targetDir == "runtimes") && targetRuntimes != [ ]) [
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" targetRuntimes}"
] ++ lib.optionals finalAttrs.passthru.isLLVM [
"-DLLVM_INSTALL_UTILS=ON"
"-DLLVM_INSTALL_GTEST=ON"
] ++ lib.optionals (buildDocs || buildMan) [
"-DLLVM_INCLUDE_DOCS=ON"
"-DLLVM_BUILD_DOCS=ON"
# "-DLLVM_ENABLE_DOXYGEN=ON" Way too slow, only uses one core
"-DLLVM_ENABLE_SPHINX=ON"
"-DSPHINX_OUTPUT_HTML=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ++ lib.optionals buildTests [
"-DLLVM_INCLUDE_TESTS=ON"
"-DLLVM_BUILD_TESTS=ON"
"-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped"
] ++ extraCMakeFlags;
postPatch = lib.optionalString finalAttrs.passthru.isLLVM ''
patchShebangs lib/OffloadArch/make_generated_offload_arch_h.sh
'' + lib.optionalString (buildTests && finalAttrs.passthru.isLLVM) ''
# FileSystem permissions tests fail with various special bits
rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
rm unittests/Support/Path.cpp
substituteInPlace unittests/Support/CMakeLists.txt \
--replace "Path.cpp" ""
'' + extraPostPatch;
doCheck = buildTests;
checkTarget = lib.concatStringsSep " " checkTargets;
postInstall = lib.optionalString buildMan ''
mkdir -p $info
'' + extraPostInstall;
passthru = {
isLLVM = targetDir == "llvm";
isClang = targetDir == "clang" || builtins.elem "clang" targetProjects;
updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
};
inherit hardeningDisable requiredSystemFeatures;
meta = with lib; {
description = "ROCm fork of the LLVM compiler infrastructure";
homepage = "https://github.com/RadeonOpenCompute/llvm-project";
license = with licenses; [ ncsa ] ++ extraLicenses;
maintainers = with maintainers; [ acowley lovesegfault ] ++ teams.rocm.members;
platforms = platforms.linux;
broken = isBroken;
};
})