3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/llvm/rocm/default.nix
Madoura 6eefaa031c
rocm-related: 5.3.1 → 5.3.3
rocm-smi: 5.3.1 → 5.3.3

rocm-cmake: 5.3.1 → 5.3.3

rocm-thunk: 5.3.1 → 5.3.3

rocm-runtime: 5.3.1 → 5.3.3

rocm-opencl-runtime: 5.3.1 → 5.3.3

rocm-device-libs: 5.3.1 → 5.3.3

rocm-comgr: 5.3.1 → 5.3.3

rocclr: 5.3.1 → 5.3.3

rocminfo: 5.3.1 → 5.3.3

llvmPackages_rocm.llvm: 5.3.1 → 5.3.3

hip: 5.3.1 → 5.3.3

hipcub: 2.12.0-5.3.1 → 2.12.0-5.3.3

rocsparse: 2.3.2-5.3.1 → 2.3.2-5.3.3

hipsparse: 2.3.1-5.3.1 → 2.3.1-5.3.3

rccl: 2.12.10-5.3.1 → 2.12.10-5.3.3

rocfft: 1.0.18-5.3.1 → 1.0.18-5.3.3

tensile: 4.34.0-5.3.1 → 4.34.0-5.3.3

rocblas: 2.45.0-5.3.1 → 2.45.0-5.3.3

miopengemm: 5.3.1 → 5.3.3

clang-ocl: 5.3.1 → 5.3.3

rocthrust: 2.16.0-5.3.1 → 2.16.0-5.3.3

rocprim: 2.11.0-5.3.1 → 2.11.1-5.3.3

rocmlir: 5.3.1 → 5.3.3
2022-11-24 01:19:47 -06:00

55 lines
2.3 KiB
Nix

{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:
let
version = "5.3.3";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "llvm-project";
rev = "rocm-${version}";
hash = "sha256-IKo7N8wWvh5PBrZ2mh1Vu5s3uUXhanqYtC4qLV/+JBs=";
};
in rec {
clang = wrapCCWith rec {
cc = llvm;
extraBuildCommands = ''
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
ln -s "${cc}/lib/clang/$clang_version/lib" "$rsrc/lib"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
rm $out/nix-support/add-hardening.sh
touch $out/nix-support/add-hardening.sh
# GPU compilation uses builtin lld
substituteInPlace $out/bin/clang \
--replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;'
substituteInPlace $out/bin/clang++ \
--replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;'
'';
};
clangNoCompilerRt = wrapCCWith rec {
cc = llvm;
extraBuildCommands = ''
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
rm $out/nix-support/add-hardening.sh
touch $out/nix-support/add-hardening.sh
# GPU compilation uses builtin lld
substituteInPlace $out/bin/clang \
--replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;'
substituteInPlace $out/bin/clang++ \
--replace '-MM) dontLink=1 ;;' $'-MM | --cuda-device-only) dontLink=1 ;;\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;'
'';
};
llvm = callPackage ./llvm.nix {
inherit src version;
};
}