3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/llvm/rocm/llvm.nix
Madoura 18c88296d0
rocm-related: 5.4.1 → 5.4.2
hip-common: 5.4.1 → 5.4.2

hipblas: 5.4.1 → 5.4.2

hipcc: 5.4.1 → 5.4.2

hip: 5.4.1 → 5.4.2

hipfft: 5.4.1 → 5.4.2

hipcub: 5.4.1 → 5.4.2

hipify: 5.4.1 → 5.4.2

hipfort: 5.4.1 → 5.4.2

clang-ocl: 5.4.1 → 5.4.2

hipsolver: 5.4.1 → 5.4.2

llvmPackages_rocm.llvm: 5.4.1 → 5.4.2

migraphx: 5.4.1 → 5.4.2

miopen: 5.4.1 → 5.4.2

rdc: 5.4.1 → 5.4.2

rccl: 5.4.1 → 5.4.2

rocblas: 5.4.1 → 5.4.2

miopengemm: 5.4.1 → 5.4.2

hipsparse: 5.4.1 → 5.4.2

rocdbgapi: 5.4.1 → 5.4.2

rocfft: 5.4.1 → 5.4.2

rocgdb: 5.4.1 → 5.4.2

rocclr: 5.4.1 → 5.4.2

rocalution: 5.4.1 → 5.4.2

rocm-device-libs: 5.4.1 → 5.4.2

rocm-opencl-runtime: 5.4.1 → 5.4.2

rocm-cmake: 5.4.1 → 5.4.2

rocm-thunk: 5.4.1 → 5.4.2

rocminfo: 5.4.1 → 5.4.2

rocmlir: 5.4.0 → 5.4.1

rocm-comgr: 5.4.1 → 5.4.2

rocprofiler: 5.4.1 → 5.4.2

rocr-debug-agent: 5.4.1 → 5.4.2

rocrand: 5.4.1 → 5.4.2

rocsolver: 5.4.1 → 5.4.2

roctracer: 5.4.1 → 5.4.2

rocm-smi: 5.4.1 → 5.4.2

rocwmma: 5.4.1 → 5.4.2

rocprim: 5.4.1 → 5.4.2

rocsparse: 5.4.1 → 5.4.2

rocthrust: 5.4.1 → 5.4.2

tensile: 5.4.1 → 5.4.2
2023-01-18 16:59:22 -06:00

166 lines
4.3 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 ? [ ]
, extraPatches ? [ ]
, extraNativeBuildInputs ? [ ]
, extraBuildInputs ? [ ]
, extraCMakeFlags ? [ ]
, extraPostPatch ? ""
, checkTargets ? [(
lib.optionalString buildTests (
if targetDir == "runtimes"
then "check-runtimes"
else "check-all"
)
)]
, extraPostInstall ? ""
, extraLicenses ? [ ]
, isBroken ? false
}:
let
llvmNativeTarget =
if stdenv.isx86_64 then "X86"
else if stdenv.isAarch64 then "AArch64"
else throw "Unsupported ROCm LLVM platform";
in stdenv.mkDerivation (finalAttrs: {
pname = "rocm-llvm-${targetName}";
version = "5.4.2";
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-iyr3cstC8CB1YaACadNqBs/oI8lh4bJzK0WtEB0wZvg=";
};
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=AMDGPU;${llvmNativeTarget}"
] ++ 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 || finalAttrs.passthru.isClang) [
"-DLLVM_ENABLE_RTTI=ON"
"-DLLVM_ENABLE_EH=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"
"-DLLVM_ENABLE_OCAMLDOC=OFF"
"-DSPHINX_OUTPUT_HTML=ON"
"-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ++ lib.optionals buildTests [
"-DLLVM_INCLUDE_TESTS=ON"
"-DLLVM_BUILD_TESTS=ON"
] ++ lib.optionals (buildTests && !finalAttrs.passthru.isLLVM) [
"-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 finalAttrs.passthru.isLLVM ''
# `lit` expects these for some test suites
mv bin/{FileCheck,not,count,yaml2obj,obj2yaml} $out/bin
'' + 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;
};
};
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;
};
})