llvmPackages_rocm: compile as one derivation
This is the supported way rocm is tested. It makes packaging in nix a *lot* easier (see the code size). An important change is the dontLink detection in the clang/clang++ wrapper script: When compiling with --cuda-device-only, the linker must not be set, otherwise e.g. the blender kernels fail to compile.
This commit is contained in:
parent
9513a3b0c2
commit
ec590fdd24
14 changed files with 290 additions and 285 deletions
|
@ -1,9 +1,7 @@
|
||||||
{ stdenv
|
{ stdenv
|
||||||
, binutils-unwrapped
|
, binutils-unwrapped
|
||||||
, clang
|
, clang
|
||||||
, clang-unwrapped
|
|
||||||
, cmake
|
, cmake
|
||||||
, compiler-rt
|
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, file
|
, file
|
||||||
|
@ -11,7 +9,6 @@
|
||||||
, libglvnd
|
, libglvnd
|
||||||
, libX11
|
, libX11
|
||||||
, libxml2
|
, libxml2
|
||||||
, lld
|
|
||||||
, llvm
|
, llvm
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
, numactl
|
, numactl
|
||||||
|
@ -63,8 +60,9 @@ let
|
||||||
-e 's,^\($HIP_COMPILER=\).*$,\1"clang";,' \
|
-e 's,^\($HIP_COMPILER=\).*$,\1"clang";,' \
|
||||||
-e 's,^\($HIP_RUNTIME=\).*$,\1"ROCclr";,' \
|
-e 's,^\($HIP_RUNTIME=\).*$,\1"ROCclr";,' \
|
||||||
-e 's,^\([[:space:]]*$HSA_PATH=\).*$,\1"${rocm-runtime}";,'g \
|
-e 's,^\([[:space:]]*$HSA_PATH=\).*$,\1"${rocm-runtime}";,'g \
|
||||||
-e 's,^\([[:space:]]*\)$HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");,\1$HIP_CLANG_INCLUDE_PATH = "${clang-unwrapped}/lib/clang/$HIP_CLANG_VERSION/include";,' \
|
-e 's,^\([[:space:]]*\)$HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");,\1$HIP_CLANG_INCLUDE_PATH = "${llvm}/lib/clang/$HIP_CLANG_VERSION/include";,' \
|
||||||
-e 's,^\([[:space:]]*$HIPCXXFLAGS .= " -isystem \\"$HIP_CLANG_INCLUDE_PATH/..\\"\)";,\1 -isystem ${rocm-runtime}/include";,' \
|
-e 's,^\([[:space:]]*$HIPCXXFLAGS .= " -isystem \\"$HIP_CLANG_INCLUDE_PATH/..\\"\)";,\1 -isystem ${rocm-runtime}/include";,' \
|
||||||
|
-e 's,$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION,$HIP_CLANG_PATH/../resource-root,g' \
|
||||||
-e 's,`file,`${file}/bin/file,g' \
|
-e 's,`file,`${file}/bin/file,g' \
|
||||||
-e 's,`readelf,`${binutils-unwrapped}/bin/readelf,' \
|
-e 's,`readelf,`${binutils-unwrapped}/bin/readelf,' \
|
||||||
-e 's, ar , ${binutils-unwrapped}/bin/ar ,g' \
|
-e 's, ar , ${binutils-unwrapped}/bin/ar ,g' \
|
||||||
|
@ -115,8 +113,6 @@ stdenv.mkDerivation rec {
|
||||||
buildInputs = [ libxml2 numactl libglvnd libX11 ];
|
buildInputs = [ libxml2 numactl libglvnd libX11 ];
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
clang
|
clang
|
||||||
compiler-rt
|
|
||||||
lld
|
|
||||||
llvm
|
llvm
|
||||||
rocm-comgr
|
rocm-comgr
|
||||||
rocm-device-libs
|
rocm-device-libs
|
||||||
|
@ -139,7 +135,8 @@ stdenv.mkDerivation rec {
|
||||||
];
|
];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
wrapProgram $out/bin/hipcc --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin --prefix PATH : ${lld}/bin --set NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt} 1 --prefix NIX_LDFLAGS ' ' -L${compiler-rt}/lib --prefix NIX_LDFLAGS_FOR_TARGET ' ' -L${compiler-rt}/lib --add-flags "-nogpuinc"
|
patchShebangs $out/bin
|
||||||
|
wrapProgram $out/bin/hipcc --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin --prefix PATH : ${llvm}/bin --set ROCM_PATH $out
|
||||||
wrapProgram $out/bin/hipconfig --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin
|
wrapProgram $out/bin/hipconfig --set HIP_PATH $out --set HSA_PATH ${rocm-runtime} --set HIP_CLANG_PATH ${clang}/bin
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
{ stdenv
|
|
||||||
, lib
|
|
||||||
, fetchFromGitHub
|
|
||||||
, cmake
|
|
||||||
, python3
|
|
||||||
, llvm
|
|
||||||
, clang-tools-extra_src ? null
|
|
||||||
, lld
|
|
||||||
|
|
||||||
, version
|
|
||||||
, src
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
inherit version src;
|
|
||||||
|
|
||||||
pname = "clang";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python3 ];
|
|
||||||
|
|
||||||
buildInputs = [ llvm ];
|
|
||||||
|
|
||||||
hardeningDisable = [ "all" ];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DLLVM_CMAKE_PATH=${llvm}/lib/cmake/llvm"
|
|
||||||
"-DLLVM_MAIN_SRC_DIR=${llvm.src}"
|
|
||||||
"-DCLANG_SOURCE_DIR=${src}"
|
|
||||||
"-DLLVM_ENABLE_RTTI=ON"
|
|
||||||
];
|
|
||||||
|
|
||||||
VCSVersion = ''
|
|
||||||
#undef LLVM_REVISION
|
|
||||||
#undef LLVM_REPOSITORY
|
|
||||||
#undef CLANG_REVISION
|
|
||||||
#undef CLANG_REPOSITORY
|
|
||||||
'';
|
|
||||||
|
|
||||||
postUnpack = lib.optionalString (!(isNull clang-tools-extra_src)) ''
|
|
||||||
ln -s ${clang-tools-extra_src} $sourceRoot/tools/extra
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Rather than let cmake extract version information from LLVM or
|
|
||||||
# clang source control repositories, we generate the wanted
|
|
||||||
# `VCSVersion.inc` file ourselves and remove it from the
|
|
||||||
# depencencies of the `clangBasic` target.
|
|
||||||
preConfigure = ''
|
|
||||||
sed 's/ ''${version_inc}//' -i lib/Basic/CMakeLists.txt
|
|
||||||
sed 's|sys::path::parent_path(BundlerExecutable)|StringRef("${llvm}/bin")|' -i tools/clang-offload-bundler/ClangOffloadBundler.cpp
|
|
||||||
sed 's|\([[:space:]]*std::string Linker = \)getToolChain().GetProgramPath(getShortName())|\1"${lld}/bin/ld.lld"|' -i lib/Driver/ToolChains/AMDGPU.cpp
|
|
||||||
substituteInPlace lib/Driver/ToolChains/AMDGPU.h --replace ld.lld ${lld}/bin/ld.lld
|
|
||||||
sed 's|configure_file(AST/gen_ast_dump_json_test.py ''${LLVM_TOOLS_BINARY_DIR}/gen_ast_dump_json_test.py COPYONLY)||' -i test/CMakeLists.txt
|
|
||||||
'';
|
|
||||||
|
|
||||||
postConfigure = ''
|
|
||||||
mkdir -p lib/Basic
|
|
||||||
echo "$VCSVersion" > lib/Basic/VCSVersion.inc
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
isClang = true;
|
|
||||||
inherit llvm;
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "ROCm fork of the clang C/C++/Objective-C/Objective-C++ LLVM compiler frontend";
|
|
||||||
homepage = "https://llvm.org/";
|
|
||||||
license = with licenses; [ ncsa ];
|
|
||||||
maintainers = with maintainers; [ acowley lovesegfault ];
|
|
||||||
platforms = platforms.linux;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
{ stdenv, lib, version, src, cmake, python3, llvm, libcxxabi, fetchpatch }:
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "compiler-rt";
|
|
||||||
inherit version src;
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python3 llvm ];
|
|
||||||
|
|
||||||
NIX_CFLAGS_COMPILE = [
|
|
||||||
"-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
|
|
||||||
];
|
|
||||||
|
|
||||||
cmakeFlags = [
|
|
||||||
"-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
|
|
||||||
"-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
|
||||||
"-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
|
|
||||||
"-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
|
|
||||||
"-DCOMPILER_RT_BUILD_XRAY=OFF"
|
|
||||||
"-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
|
|
||||||
"-DCOMPILER_RT_BUILD_PROFILE=OFF"
|
|
||||||
"-DCMAKE_C_COMPILER_WORKS=ON"
|
|
||||||
"-DCMAKE_CXX_COMPILER_WORKS=ON"
|
|
||||||
"-DCOMPILER_RT_BAREMETAL_BUILD=ON"
|
|
||||||
"-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
|
|
||||||
"-DCOMPILER_RT_BUILD_BUILTINS=ON"
|
|
||||||
"-DCMAKE_C_FLAGS=-nodefaultlibs"
|
|
||||||
#https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
|
|
||||||
"-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
|
|
||||||
];
|
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
|
||||||
|
|
||||||
prePatch = ''
|
|
||||||
cd compiler-rt
|
|
||||||
'';
|
|
||||||
|
|
||||||
# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
|
|
||||||
# to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
|
|
||||||
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
|
|
||||||
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
|
|
||||||
# a flag and turn the flag off during the stdenv build.
|
|
||||||
postPatch = lib.optionalString (!stdenv.isDarwin) ''
|
|
||||||
substituteInPlace cmake/builtin-config-ix.cmake \
|
|
||||||
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Hack around weird upsream RPATH bug
|
|
||||||
postInstall = ''
|
|
||||||
ln -s "$out/lib"/*/* "$out/lib"
|
|
||||||
ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
|
|
||||||
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
|
|
||||||
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
|
|
||||||
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
|
|
||||||
'';
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "ROCm fork of the LLVM Compiler runtime libraries";
|
|
||||||
homepage = "https://github.com/RadeonOpenCompute/llvm-project";
|
|
||||||
license = licenses.ncsa;
|
|
||||||
maintainers = with maintainers; [ acowley lovesegfault ];
|
|
||||||
platforms = platforms.linux;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -10,23 +10,27 @@ let
|
||||||
};
|
};
|
||||||
in rec {
|
in rec {
|
||||||
clang = wrapCCWith rec {
|
clang = wrapCCWith rec {
|
||||||
cc = clang-unwrapped;
|
cc = llvm;
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
||||||
rsrc="$out/resource-root"
|
rsrc="$out/resource-root"
|
||||||
mkdir "$rsrc"
|
mkdir "$rsrc"
|
||||||
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
|
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
|
||||||
ln -s "${compiler-rt}/lib" "$rsrc/lib"
|
ln -s "${cc}/lib/clang/$clang_version/lib" "$rsrc/lib"
|
||||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||||
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
|
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
|
||||||
echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
|
|
||||||
rm $out/nix-support/add-hardening.sh
|
rm $out/nix-support/add-hardening.sh
|
||||||
touch $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 {
|
clangNoCompilerRt = wrapCCWith rec {
|
||||||
cc = clang-unwrapped;
|
cc = llvm;
|
||||||
extraBuildCommands = ''
|
extraBuildCommands = ''
|
||||||
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
|
||||||
rsrc="$out/resource-root"
|
rsrc="$out/resource-root"
|
||||||
|
@ -34,28 +38,17 @@ in rec {
|
||||||
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
|
ln -s "${cc}/lib/clang/$clang_version/include" "$rsrc"
|
||||||
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
|
||||||
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
|
echo "--gcc-toolchain=${stdenv.cc.cc}" >> $out/nix-support/cc-cflags
|
||||||
echo "-Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
|
|
||||||
rm $out/nix-support/add-hardening.sh
|
rm $out/nix-support/add-hardening.sh
|
||||||
touch $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 ;;'
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
clang-unwrapped = callPackage ./clang.nix {
|
llvm = callPackage ./llvm.nix {
|
||||||
inherit lld llvm version;
|
|
||||||
src = "${src}/clang";
|
|
||||||
};
|
|
||||||
|
|
||||||
compiler-rt = callPackage ./compiler-rt {
|
|
||||||
inherit version llvm;
|
|
||||||
inherit src;
|
|
||||||
stdenv = overrideCC stdenv clangNoCompilerRt;
|
|
||||||
};
|
|
||||||
|
|
||||||
lld = callPackage ./lld.nix {
|
|
||||||
inherit llvm src version;
|
|
||||||
};
|
|
||||||
|
|
||||||
llvm = callPackage ./llvm {
|
|
||||||
inherit src version;
|
inherit src version;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
23
pkgs/development/compilers/llvm/rocm/install-symlinks.patch
Normal file
23
pkgs/development/compilers/llvm/rocm/install-symlinks.patch
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
diff --git a/llvm/cmake/modules/LLVMInstallSymlink.cmake b/llvm/cmake/modules/LLVMInstallSymlink.cmake
|
||||||
|
index b5c35f706cb7..ac25e40b1436 100644
|
||||||
|
--- a/cmake/modules/LLVMInstallSymlink.cmake
|
||||||
|
+++ b/cmake/modules/LLVMInstallSymlink.cmake
|
||||||
|
@@ -4,11 +4,16 @@
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../cmake/Modules" ${CMAKE_MODULE_PATH})
|
||||||
|
+include(ExtendPath)
|
||||||
|
+
|
||||||
|
function(install_symlink name target outdir)
|
||||||
|
set(DESTDIR $ENV{DESTDIR})
|
||||||
|
- set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
|
||||||
|
+ message(STATUS "Creating ${name} at ${bindir} (${CMAKE_MODULE_PATH})")
|
||||||
|
+ extend_path(prefixed_outdir "${CMAKE_INSTALL_PREFIX}" "${outdir}")
|
||||||
|
+ set(bindir "${DESTDIR}${prefixed_outdir}")
|
||||||
|
|
||||||
|
- message(STATUS "Creating ${name}")
|
||||||
|
+ message(STATUS "Creating ${name} at ${bindir}")
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}"
|
|
@ -1,43 +0,0 @@
|
||||||
{ stdenv
|
|
||||||
, lib
|
|
||||||
, cmake
|
|
||||||
, libxml2
|
|
||||||
, llvm
|
|
||||||
, ninja
|
|
||||||
|
|
||||||
, version
|
|
||||||
, src
|
|
||||||
}:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
inherit version src;
|
|
||||||
|
|
||||||
sourceRoot = "${src.name}/lld";
|
|
||||||
|
|
||||||
pname = "lld";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ninja ];
|
|
||||||
|
|
||||||
buildInputs = [ libxml2 llvm ];
|
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
|
||||||
|
|
||||||
cmakeFlags = [ "-DLLVM_MAIN_SRC_DIR=${src}/llvm" ];
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
moveToOutput include "$dev"
|
|
||||||
moveToOutput lib "$dev"
|
|
||||||
|
|
||||||
# Fix lld binary path for CMake.
|
|
||||||
substituteInPlace "$dev/lib/cmake/lld/LLDTargets-release.cmake" \
|
|
||||||
--replace "\''${_IMPORT_PREFIX}/bin/lld" "$out/bin/lld"
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "ROCm fork of the LLVM Linker";
|
|
||||||
homepage = "https://github.com/RadeonOpenCompute/llvm-project";
|
|
||||||
license = licenses.ncsa;
|
|
||||||
maintainers = with maintainers; [ acowley lovesegfault ];
|
|
||||||
platforms = platforms.linux;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
{ stdenv
|
{ stdenv
|
||||||
, lib
|
, lib
|
||||||
|
, fetchgit
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, writeScript
|
, writeScript
|
||||||
, cmake
|
, cmake
|
||||||
|
@ -12,7 +13,6 @@
|
||||||
, zlib
|
, zlib
|
||||||
, debugVersion ? false
|
, debugVersion ? false
|
||||||
, enableManpages ? false
|
, enableManpages ? false
|
||||||
, enableSharedLibraries ? false
|
|
||||||
|
|
||||||
, version
|
, version
|
||||||
, src
|
, src
|
||||||
|
@ -30,28 +30,18 @@ in stdenv.mkDerivation rec {
|
||||||
|
|
||||||
sourceRoot = "${src.name}/llvm";
|
sourceRoot = "${src.name}/llvm";
|
||||||
|
|
||||||
outputs = [ "out" "python" ]
|
|
||||||
++ lib.optional enableSharedLibraries "lib";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ninja python3 ];
|
nativeBuildInputs = [ cmake ninja python3 ];
|
||||||
|
|
||||||
buildInputs = [ libxml2 libffi ];
|
buildInputs = [ libxml2 ];
|
||||||
|
|
||||||
propagatedBuildInputs = [ ncurses zlib ];
|
propagatedBuildInputs = [ ncurses zlib ];
|
||||||
|
|
||||||
cmakeFlags = with stdenv; [
|
cmakeFlags = with stdenv; [
|
||||||
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
"-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
|
||||||
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
"-DLLVM_INSTALL_UTILS=ON" # Needed by rustc
|
||||||
"-DLLVM_BUILD_TESTS=OFF"
|
|
||||||
"-DLLVM_ENABLE_FFI=ON"
|
|
||||||
"-DLLVM_ENABLE_RTTI=ON"
|
|
||||||
"-DLLVM_ENABLE_DUMP=ON"
|
|
||||||
"-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}"
|
"-DLLVM_TARGETS_TO_BUILD=AMDGPU;${llvmNativeTarget}"
|
||||||
|
"-DLLVM_ENABLE_PROJECTS=clang;lld;compiler-rt"
|
||||||
]
|
]
|
||||||
++
|
|
||||||
lib.optional
|
|
||||||
enableSharedLibraries
|
|
||||||
"-DLLVM_LINK_LLVM_DYLIB=ON"
|
|
||||||
++ lib.optionals enableManpages [
|
++ lib.optionals enableManpages [
|
||||||
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
|
"-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
|
||||||
"-DLLVM_BUILD_DOCS=ON"
|
"-DLLVM_BUILD_DOCS=ON"
|
||||||
|
@ -61,39 +51,16 @@ in stdenv.mkDerivation rec {
|
||||||
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
"-DSPHINX_WARNINGS_AS_ERRORS=OFF"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./install-symlinks.patch
|
||||||
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
patchShebangs lib/OffloadArch/make_generated_offload_arch_h.sh
|
patchShebangs lib/OffloadArch/make_generated_offload_arch_h.sh
|
||||||
'' + lib.optionalString enableSharedLibraries ''
|
substituteInPlace ../clang/cmake/modules/CMakeLists.txt \
|
||||||
substitute '${./outputs.patch}' ./outputs.patch --subst-var lib
|
--replace 'FILES_MATCHING' 'NO_SOURCE_PERMISSIONS FILES_MATCHING'
|
||||||
patch -p1 < ./outputs.patch
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# hacky fix: created binaries need to be run before installation
|
|
||||||
preBuild = ''
|
|
||||||
mkdir -p $out/
|
|
||||||
ln -sv $PWD/lib $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
postBuild = ''
|
|
||||||
rm -fR $out
|
|
||||||
'';
|
|
||||||
|
|
||||||
preCheck = ''
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
|
|
||||||
'';
|
|
||||||
|
|
||||||
postInstall = ''
|
|
||||||
moveToOutput share/opt-viewer "$python"
|
|
||||||
''
|
|
||||||
+ lib.optionalString enableSharedLibraries ''
|
|
||||||
moveToOutput "lib/libLLVM-*" "$lib"
|
|
||||||
moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
|
|
||||||
substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
|
|
||||||
--replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru.src = src;
|
|
||||||
|
|
||||||
updateScript = writeScript "update.sh" ''
|
updateScript = writeScript "update.sh" ''
|
||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
|
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
|
||||||
|
@ -111,11 +78,13 @@ in stdenv.mkDerivation rec {
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.isClang = true;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "ROCm fork of the LLVM compiler infrastructure";
|
description = "ROCm fork of the LLVM compiler infrastructure";
|
||||||
homepage = "https://github.com/RadeonOpenCompute/llvm-project";
|
homepage = "https://github.com/RadeonOpenCompute/llvm-project";
|
||||||
license = with licenses; [ ncsa ];
|
license = with licenses; [ ncsa ];
|
||||||
maintainers = with maintainers; [ acowley lovesegfault ];
|
maintainers = with maintainers; [ acowley lovesegfault Flakebi ];
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
|
|
||||||
index 94d426b..37f7794 100644
|
|
||||||
--- a/tools/llvm-config/llvm-config.cpp
|
|
||||||
+++ b/tools/llvm-config/llvm-config.cpp
|
|
||||||
@@ -333,6 +333,11 @@ int main(int argc, char **argv) {
|
|
||||||
ActiveIncludeOption = "-I" + ActiveIncludeDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /// Nix-specific multiple-output handling: override ActiveLibDir
|
|
||||||
+ if (!IsInDevelopmentTree) {
|
|
||||||
+ ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/// We only use `shared library` mode in cases where the static library form
|
|
||||||
/// of the components provided are not available; note however that this is
|
|
||||||
/// skipped if we're run from within the build dir. However, once installed,
|
|
224
pkgs/development/libraries/rocm-comgr/cmake.patch
Normal file
224
pkgs/development/libraries/rocm-comgr/cmake.patch
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index eac270a..27610ec 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -53,10 +53,6 @@ set(SOURCES
|
||||||
|
|
||||||
|
if(COMGR_BUILD_SHARED_LIBS)
|
||||||
|
add_library(amd_comgr SHARED ${SOURCES})
|
||||||
|
- # Windows doesn't have a strip utility, so CMAKE_STRIP won't be set.
|
||||||
|
- if((CMAKE_BUILD_TYPE STREQUAL "Release") AND NOT ("${CMAKE_STRIP}" STREQUAL ""))
|
||||||
|
- add_custom_command(TARGET amd_comgr POST_BUILD COMMAND ${CMAKE_STRIP} $<TARGET_FILE:amd_comgr>)
|
||||||
|
- endif()
|
||||||
|
else()
|
||||||
|
add_library(amd_comgr STATIC ${SOURCES})
|
||||||
|
endif()
|
||||||
|
@@ -141,8 +137,8 @@ if (UNIX)
|
||||||
|
list(APPEND AMD_COMGR_PUBLIC_LINKER_OPTIONS -pthread)
|
||||||
|
if (NOT APPLE AND COMGR_BUILD_SHARED_LIBS)
|
||||||
|
configure_file(
|
||||||
|
- ${CMAKE_CURRENT_SOURCE_DIR}/src/exportmap.in
|
||||||
|
- ${CMAKE_CURRENT_BINARY_DIR}/src/exportmap @ONLY)
|
||||||
|
+ src/exportmap.in
|
||||||
|
+ src/exportmap @ONLY)
|
||||||
|
list(APPEND AMD_COMGR_PRIVATE_LINKER_OPTIONS
|
||||||
|
"-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/src/exportmap")
|
||||||
|
# When building a shared library with -fsanitize=address we can't be
|
||||||
|
@@ -154,6 +150,9 @@ if (UNIX)
|
||||||
|
-Wl,--no-undefined)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
+
|
||||||
|
+ # Strip in release build
|
||||||
|
+ set_target_properties(amd_comgr PROPERTIES LINK_FLAGS_RELEASE -s)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
|
list(APPEND AMD_COMGR_PRIVATE_COMPILE_OPTIONS
|
||||||
|
"/wd4244" #[[Suppress 'argument' : conversion from 'type1' to 'type2', possible loss of data]]
|
||||||
|
@@ -169,10 +168,6 @@ endif()
|
||||||
|
# the shared header.
|
||||||
|
list(APPEND AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS AMD_COMGR_EXPORT)
|
||||||
|
|
||||||
|
-configure_file(
|
||||||
|
- ${CMAKE_CURRENT_SOURCE_DIR}/include/amd_comgr.h.in
|
||||||
|
- ${CMAKE_CURRENT_BINARY_DIR}/include/amd_comgr.h @ONLY)
|
||||||
|
-
|
||||||
|
include(bc2h)
|
||||||
|
include(opencl_pch)
|
||||||
|
include(DeviceLibs)
|
||||||
|
@@ -203,8 +198,11 @@ target_compile_definitions(amd_comgr
|
||||||
|
PRIVATE "${AMD_COMGR_PRIVATE_COMPILE_DEFINITIONS}")
|
||||||
|
target_include_directories(amd_comgr
|
||||||
|
PUBLIC
|
||||||
|
- $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||||
|
- $<INSTALL_INTERFACE:include>)
|
||||||
|
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
|
||||||
|
+
|
||||||
|
+configure_file(
|
||||||
|
+ include/amd_comgr.h.in
|
||||||
|
+ include/amd_comgr.h @ONLY)
|
||||||
|
|
||||||
|
set(AMD_COMGR_CONFIG_NAME amd_comgr-config.cmake)
|
||||||
|
set(AMD_COMGR_TARGETS_NAME amd_comgr-targets.cmake)
|
||||||
|
@@ -220,29 +218,30 @@ if (NOT COMGR_BUILD_SHARED_LIBS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(AMD_COMGR_TARGETS_PATH
|
||||||
|
- "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}")
|
||||||
|
-set(AMD_COMGR_VERSION_PATH
|
||||||
|
- "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_VERSION_NAME}")
|
||||||
|
-export(TARGETS amd_comgr
|
||||||
|
- FILE "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}")
|
||||||
|
+ "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}")
|
||||||
|
configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in"
|
||||||
|
- "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_CONFIG_NAME}"
|
||||||
|
+ ${AMD_COMGR_CONFIG_NAME}
|
||||||
|
@ONLY)
|
||||||
|
-write_basic_package_version_file("${AMD_COMGR_VERSION_PATH}"
|
||||||
|
+write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_VERSION_NAME}"
|
||||||
|
VERSION "${amd_comgr_VERSION}"
|
||||||
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
|
install(TARGETS amd_comgr
|
||||||
|
EXPORT amd_comgr_export
|
||||||
|
- COMPONENT amd-comgr
|
||||||
|
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
+ COMPONENT amd-comgr)
|
||||||
|
+install(EXPORT amd_comgr_export
|
||||||
|
+ DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}"
|
||||||
|
+ FILE "${AMD_COMGR_TARGETS_NAME}")
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/include/amd_comgr.h"
|
||||||
|
COMPONENT amd-comgr
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
+install(FILES
|
||||||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}"
|
||||||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_VERSION_NAME}"
|
||||||
|
+ COMPONENT amd-comgr
|
||||||
|
+ DESTINATION ${AMD_COMGR_PACKAGE_PREFIX})
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
"README.md"
|
||||||
|
@@ -251,37 +250,6 @@ install(FILES
|
||||||
|
COMPONENT amd-comgr
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/amd_comgr)
|
||||||
|
|
||||||
|
-# Generate the install-tree package.
|
||||||
|
-set(AMD_COMGR_PREFIX_CODE "
|
||||||
|
-# Derive absolute install prefix from config file path.
|
||||||
|
-get_filename_component(AMD_COMGR_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
|
||||||
|
-string(REGEX REPLACE "/" ";" count "${AMD_COMGR_PACKAGE_PREFIX}")
|
||||||
|
-foreach(p ${count})
|
||||||
|
- set(AMD_COMGR_PREFIX_CODE "${AMD_COMGR_PREFIX_CODE}
|
||||||
|
-get_filename_component(AMD_COMGR_PREFIX \"\${AMD_COMGR_PREFIX}\" PATH)")
|
||||||
|
-endforeach()
|
||||||
|
-
|
||||||
|
-if (NOT COMGR_BUILD_SHARED_LIBS)
|
||||||
|
- string(APPEND AMD_COMGR_PREFIX_CODE "\ninclude(CMakeFindDependencyMacro)\n")
|
||||||
|
- string(APPEND AMD_COMGR_PREFIX_CODE "find_dependency(Clang REQUIRED)\n")
|
||||||
|
- string(APPEND AMD_COMGR_PREFIX_CODE "find_dependency(LLD REQUIRED)\n")
|
||||||
|
-endif()
|
||||||
|
-
|
||||||
|
-set(AMD_COMGR_TARGETS_PATH "\${AMD_COMGR_PREFIX}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}")
|
||||||
|
-configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in"
|
||||||
|
- "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install"
|
||||||
|
- @ONLY)
|
||||||
|
-install(FILES
|
||||||
|
- "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install"
|
||||||
|
- DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}"
|
||||||
|
- RENAME "${AMD_COMGR_CONFIG_NAME}")
|
||||||
|
-install(EXPORT amd_comgr_export
|
||||||
|
- DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}"
|
||||||
|
- FILE "${AMD_COMGR_TARGETS_NAME}")
|
||||||
|
-install(FILES
|
||||||
|
- "${AMD_COMGR_VERSION_PATH}"
|
||||||
|
- DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}")
|
||||||
|
-
|
||||||
|
set(CLANG_LIBS
|
||||||
|
clangFrontendTool)
|
||||||
|
|
||||||
|
diff --git a/cmake/bc2h.cmake b/cmake/bc2h.cmake
|
||||||
|
index 146fe2b..9134985 100644
|
||||||
|
--- a/cmake/bc2h.cmake
|
||||||
|
+++ b/cmake/bc2h.cmake
|
||||||
|
@@ -1,40 +1,41 @@
|
||||||
|
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c
|
||||||
|
-"#include <stdio.h>\n"
|
||||||
|
-"int main(int argc, char **argv){\n"
|
||||||
|
-" FILE *ifp, *ofp;\n"
|
||||||
|
-" int c, i, l;\n"
|
||||||
|
-" if (argc != 4) return 1;\n"
|
||||||
|
-" ifp = fopen(argv[1], \"rb\");\n"
|
||||||
|
-" if (!ifp) return 1;\n"
|
||||||
|
-" i = fseek(ifp, 0, SEEK_END);\n"
|
||||||
|
-" if (i < 0) return 1;\n"
|
||||||
|
-" l = ftell(ifp);\n"
|
||||||
|
-" if (l < 0) return 1;\n"
|
||||||
|
-" i = fseek(ifp, 0, SEEK_SET);\n"
|
||||||
|
-" if (i < 0) return 1;\n"
|
||||||
|
-" ofp = fopen(argv[2], \"wb+\");\n"
|
||||||
|
-" if (!ofp) return 1;\n"
|
||||||
|
-" fprintf(ofp, \"#define %s_size %d\\n\\n\"\n"
|
||||||
|
-" \"#if defined __GNUC__\\n\"\n"
|
||||||
|
-" \"__attribute__((aligned (4096)))\\n\"\n"
|
||||||
|
-" \"#elif defined _MSC_VER\\n\"\n"
|
||||||
|
-" \"__declspec(align(4096))\\n\"\n"
|
||||||
|
-" \"#endif\\n\"\n"
|
||||||
|
-" \"static const unsigned char %s[%s_size+1] = {\",\n"
|
||||||
|
-" argv[3], l,\n"
|
||||||
|
-" argv[3], argv[3]);\n"
|
||||||
|
-" i = 0;\n"
|
||||||
|
-" while ((c = getc(ifp)) != EOF) {\n"
|
||||||
|
-" if (0 == (i&7)) fprintf(ofp, \"\\n \");\n"
|
||||||
|
-" fprintf(ofp, \" 0x%02x,\", c);\n"
|
||||||
|
-" ++i;\n"
|
||||||
|
-" }\n"
|
||||||
|
-" fprintf(ofp, \" 0x00\\n};\\n\\n\");\n"
|
||||||
|
-" fclose(ifp);\n"
|
||||||
|
-" fclose(ofp);\n"
|
||||||
|
-" return 0;\n"
|
||||||
|
-"}\n"
|
||||||
|
-)
|
||||||
|
+file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c
|
||||||
|
+ CONTENT
|
||||||
|
+"#include <stdio.h>
|
||||||
|
+int main(int argc, char **argv){
|
||||||
|
+ FILE *ifp, *ofp;
|
||||||
|
+ int c, i, l;
|
||||||
|
+ if (argc != 4) return 1;
|
||||||
|
+ ifp = fopen(argv[1], \"rb\");
|
||||||
|
+ if (!ifp) return 1;
|
||||||
|
+ i = fseek(ifp, 0, SEEK_END);
|
||||||
|
+ if (i < 0) return 1;
|
||||||
|
+ l = ftell(ifp);
|
||||||
|
+ if (l < 0) return 1;
|
||||||
|
+ i = fseek(ifp, 0, SEEK_SET);
|
||||||
|
+ if (i < 0) return 1;
|
||||||
|
+ ofp = fopen(argv[2], \"wb+\");
|
||||||
|
+ if (!ofp) return 1;
|
||||||
|
+ fprintf(ofp, \"#define %s_size %d\\n\\n\"
|
||||||
|
+ \"#if defined __GNUC__\\n\"
|
||||||
|
+ \"__attribute__((aligned (4096)))\\n\"
|
||||||
|
+ \"#elif defined _MSC_VER\\n\"
|
||||||
|
+ \"__declspec(align(4096))\\n\"
|
||||||
|
+ \"#endif\\n\"
|
||||||
|
+ \"static const unsigned char %s[%s_size+1] = {\",
|
||||||
|
+ argv[3], l,
|
||||||
|
+ argv[3], argv[3]);
|
||||||
|
+ i = 0;
|
||||||
|
+ while ((c = getc(ifp)) != EOF) {
|
||||||
|
+ if (0 == (i&7)) fprintf(ofp, \"\\n \");
|
||||||
|
+ fprintf(ofp, \" 0x%02x,\", c);
|
||||||
|
+ ++i;
|
||||||
|
+ }
|
||||||
|
+ fprintf(ofp, \" 0x00\\n};\\n\\n\");
|
||||||
|
+ fclose(ifp);
|
||||||
|
+ fclose(ofp);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+")
|
||||||
|
|
||||||
|
add_executable(bc2h ${CMAKE_CURRENT_BINARY_DIR}/bc2h.c)
|
||||||
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, writeScript, cmake, clang, rocm-device-libs, lld, llvm }:
|
{ lib, stdenv, fetchFromGitHub, writeScript, cmake, clang, rocm-device-libs, llvm }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocm-comgr";
|
pname = "rocm-comgr";
|
||||||
|
@ -15,18 +15,19 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
|
||||||
buildInputs = [ clang rocm-device-libs lld llvm ];
|
buildInputs = [ clang rocm-device-libs llvm ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DCLANG=${clang}/bin/clang"
|
|
||||||
"-DCMAKE_BUILD_TYPE=Release"
|
"-DCMAKE_BUILD_TYPE=Release"
|
||||||
"-DCMAKE_C_COMPILER=${clang}/bin/clang"
|
"-DCMAKE_C_COMPILER=${clang}/bin/clang"
|
||||||
"-DCMAKE_CXX_COMPILER=${clang}/bin/clang++"
|
"-DCMAKE_CXX_COMPILER=${clang}/bin/clang++"
|
||||||
"-DCMAKE_PREFIX_PATH=${llvm}/lib/cmake/llvm"
|
"-DCMAKE_PREFIX_PATH=${llvm}/lib/cmake/llvm"
|
||||||
"-DLLD_INCLUDE_DIRS=${lld.src}/include"
|
"-DLLD_INCLUDE_DIRS=${llvm}/include"
|
||||||
"-DLLVM_TARGETS_TO_BUILD=\"AMDGPU;X86\""
|
"-DLLVM_TARGETS_TO_BUILD=\"AMDGPU;X86\""
|
||||||
];
|
];
|
||||||
|
|
||||||
|
patches = [ ./cmake.patch ];
|
||||||
|
|
||||||
passthru.updateScript = writeScript "update.sh" ''
|
passthru.updateScript = writeScript "update.sh" ''
|
||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#!nix-shell -i bash -p curl jq common-updater-scripts
|
#!nix-shell -i bash -p curl jq common-updater-scripts
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
, writeScript
|
, writeScript
|
||||||
, cmake
|
, cmake
|
||||||
, clang
|
, clang
|
||||||
, clang-unwrapped
|
|
||||||
, lld
|
|
||||||
, llvm
|
, llvm
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -21,10 +19,10 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
|
||||||
buildInputs = [ clang lld llvm ];
|
buildInputs = [ clang llvm ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DCMAKE_PREFIX_PATH=${llvm}/lib/cmake/llvm;${clang-unwrapped}/lib/cmake/clang"
|
"-DCMAKE_PREFIX_PATH=${llvm}/lib/cmake/llvm;${llvm}/lib/cmake/clang"
|
||||||
"-DLLVM_TARGETS_TO_BUILD='AMDGPU;X86'"
|
"-DLLVM_TARGETS_TO_BUILD='AMDGPU;X86'"
|
||||||
"-DCLANG=${clang}/bin/clang"
|
"-DCLANG=${clang}/bin/clang"
|
||||||
];
|
];
|
||||||
|
|
|
@ -6,11 +6,9 @@
|
||||||
, cmake
|
, cmake
|
||||||
, rocm-cmake
|
, rocm-cmake
|
||||||
, clang
|
, clang
|
||||||
, clang-unwrapped
|
|
||||||
, glew
|
, glew
|
||||||
, libglvnd
|
, libglvnd
|
||||||
, libX11
|
, libX11
|
||||||
, lld
|
|
||||||
, llvm
|
, llvm
|
||||||
, mesa
|
, mesa
|
||||||
, numactl
|
, numactl
|
||||||
|
@ -37,11 +35,9 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
clang
|
clang
|
||||||
clang-unwrapped
|
|
||||||
glew
|
glew
|
||||||
libglvnd
|
libglvnd
|
||||||
libX11
|
libX11
|
||||||
lld
|
|
||||||
llvm
|
llvm
|
||||||
mesa
|
mesa
|
||||||
numactl
|
numactl
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, writeScript
|
, writeScript
|
||||||
, addOpenGLRunpath
|
, addOpenGLRunpath
|
||||||
, clang-unwrapped
|
|
||||||
, cmake
|
, cmake
|
||||||
, xxd
|
, xxd
|
||||||
, elfutils
|
, elfutils
|
||||||
|
@ -27,7 +26,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake xxd ];
|
nativeBuildInputs = [ cmake xxd ];
|
||||||
|
|
||||||
buildInputs = [ clang-unwrapped elfutils llvm numactl ];
|
buildInputs = [ elfutils llvm numactl ];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DBITCODE_DIR=${rocm-device-libs}/amdgcn/bitcode"
|
"-DBITCODE_DIR=${rocm-device-libs}/amdgcn/bitcode"
|
||||||
|
|
|
@ -14132,27 +14132,27 @@ with pkgs;
|
||||||
rocclr = callPackage ../development/libraries/rocclr { };
|
rocclr = callPackage ../development/libraries/rocclr { };
|
||||||
|
|
||||||
hip = callPackage ../development/compilers/hip {
|
hip = callPackage ../development/compilers/hip {
|
||||||
inherit (llvmPackages_rocm) clang clang-unwrapped compiler-rt lld llvm;
|
inherit (llvmPackages_rocm) clang llvm;
|
||||||
};
|
};
|
||||||
|
|
||||||
rocm-cmake = callPackage ../development/tools/build-managers/rocm-cmake { };
|
rocm-cmake = callPackage ../development/tools/build-managers/rocm-cmake { };
|
||||||
|
|
||||||
rocm-comgr = callPackage ../development/libraries/rocm-comgr {
|
rocm-comgr = callPackage ../development/libraries/rocm-comgr {
|
||||||
inherit (llvmPackages_rocm) clang lld llvm;
|
inherit (llvmPackages_rocm) clang llvm;
|
||||||
};
|
};
|
||||||
|
|
||||||
rocm-device-libs = callPackage ../development/libraries/rocm-device-libs {
|
rocm-device-libs = callPackage ../development/libraries/rocm-device-libs {
|
||||||
inherit (llvmPackages_rocm) clang clang-unwrapped lld llvm;
|
inherit (llvmPackages_rocm) clang llvm;
|
||||||
};
|
};
|
||||||
|
|
||||||
rocm-opencl-icd = callPackage ../development/libraries/rocm-opencl-icd { };
|
rocm-opencl-icd = callPackage ../development/libraries/rocm-opencl-icd { };
|
||||||
|
|
||||||
rocm-opencl-runtime = callPackage ../development/libraries/rocm-opencl-runtime {
|
rocm-opencl-runtime = callPackage ../development/libraries/rocm-opencl-runtime {
|
||||||
inherit (llvmPackages_rocm) clang clang-unwrapped lld llvm;
|
inherit (llvmPackages_rocm) clang llvm;
|
||||||
};
|
};
|
||||||
|
|
||||||
rocm-runtime = callPackage ../development/libraries/rocm-runtime {
|
rocm-runtime = callPackage ../development/libraries/rocm-runtime {
|
||||||
inherit (llvmPackages_rocm) clang-unwrapped llvm;
|
inherit (llvmPackages_rocm) llvm;
|
||||||
};
|
};
|
||||||
|
|
||||||
rocm-smi = python3Packages.callPackage ../tools/system/rocm-smi { };
|
rocm-smi = python3Packages.callPackage ../tools/system/rocm-smi { };
|
||||||
|
|
Loading…
Reference in a new issue