mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-07 21:18:05 +03:00
Merge pull request #150767 from Flakebi/rocm
This commit is contained in:
commit
f403d1f791
@ -8,9 +8,13 @@
|
|||||||
, fetchpatch
|
, fetchpatch
|
||||||
, file
|
, file
|
||||||
, lib
|
, lib
|
||||||
|
, libglvnd
|
||||||
|
, libX11
|
||||||
|
, libxml2
|
||||||
, lld
|
, lld
|
||||||
, llvm
|
, llvm
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
|
, numactl
|
||||||
, perl
|
, perl
|
||||||
, python
|
, python
|
||||||
, rocclr
|
, rocclr
|
||||||
@ -24,28 +28,96 @@
|
|||||||
, writeText
|
, writeText
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
hip = stdenv.mkDerivation rec {
|
||||||
|
pname = "hip";
|
||||||
|
version = "4.5.2";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "ROCm-Developer-Tools";
|
||||||
|
repo = "HIP";
|
||||||
|
rev = "rocm-${version}";
|
||||||
|
sha256 = "sha256-AuA5ubRPywXaBBrjdHg5AT8rrVKULKog6Lh8jPaUcXY=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# - fix bash paths
|
||||||
|
# - fix path to rocm_agent_enumerator
|
||||||
|
# - fix hcc path
|
||||||
|
# - fix hcc version parsing
|
||||||
|
# - add linker flags for libhsa-runtime64 and hc_am since libhip_hcc
|
||||||
|
# refers to them.
|
||||||
|
prePatch = ''
|
||||||
|
for f in $(find bin -type f); do
|
||||||
|
sed -e 's,#!/usr/bin/perl,#!${perl}/bin/perl,' \
|
||||||
|
-e 's,#!/bin/bash,#!${stdenv.shell},' \
|
||||||
|
-i "$f"
|
||||||
|
done
|
||||||
|
|
||||||
|
substituteInPlace bin/hip_embed_pch.sh \
|
||||||
|
--replace '$LLVM_DIR/bin/' ""
|
||||||
|
|
||||||
|
sed 's,#!/usr/bin/python,#!${python}/bin/python,' -i hip_prof_gen.py
|
||||||
|
|
||||||
|
sed -e 's,$ROCM_AGENT_ENUM = "''${ROCM_PATH}/bin/rocm_agent_enumerator";,$ROCM_AGENT_ENUM = "${rocminfo}/bin/rocm_agent_enumerator";,' \
|
||||||
|
-e 's,^\($DEVICE_LIB_PATH=\).*$,\1"${rocm-device-libs}/amdgcn/bitcode";,' \
|
||||||
|
-e 's,^\($HIP_COMPILER=\).*$,\1"clang";,' \
|
||||||
|
-e 's,^\($HIP_RUNTIME=\).*$,\1"ROCclr";,' \
|
||||||
|
-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:]]*$HIPCXXFLAGS .= " -isystem \\"$HIP_CLANG_INCLUDE_PATH/..\\"\)";,\1 -isystem ${rocm-runtime}/include";,' \
|
||||||
|
-e 's,`file,`${file}/bin/file,g' \
|
||||||
|
-e 's,`readelf,`${binutils-unwrapped}/bin/readelf,' \
|
||||||
|
-e 's, ar , ${binutils-unwrapped}/bin/ar ,g' \
|
||||||
|
-i bin/hipcc
|
||||||
|
|
||||||
|
sed -e 's,^\($HSA_PATH=\).*$,\1"${rocm-runtime}";,' \
|
||||||
|
-e 's,^\($HIP_CLANG_PATH=\).*$,\1"${clang}/bin";,' \
|
||||||
|
-e 's,^\($HIP_PLATFORM=\).*$,\1"amd";,' \
|
||||||
|
-e 's,$HIP_CLANG_PATH/llc,${llvm}/bin/llc,' \
|
||||||
|
-e 's, abs_path, Cwd::abs_path,' \
|
||||||
|
-i bin/hipconfig
|
||||||
|
|
||||||
|
sed -e 's, abs_path, Cwd::abs_path,' -i bin/hipvars.pm
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = "";
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r * $out/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "C++ Heterogeneous-Compute Interface for Portability";
|
||||||
|
homepage = "https://github.com/ROCm-Developer-Tools/HIP";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [ lovesegfault ];
|
||||||
|
platforms = platforms.linux;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "hip";
|
pname = "hip";
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "ROCm-Developer-Tools";
|
owner = "ROCm-Developer-Tools";
|
||||||
repo = "HIP";
|
repo = "hipamd";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
sha256 = "sha256-dUdP32H0u6kVItS+VUE549vvxkV1mSN84HvyfeK2hEE=";
|
sha256 = "WvOuQu/EN81Kwcoc3ZtGlhb996edQJ3OWFsmPuqeNXE=";
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME: https://github.com/ROCm-Developer-Tools/HIP/issues/2317
|
nativeBuildInputs = [ cmake python makeWrapper perl ];
|
||||||
postPatch = ''
|
buildInputs = [ libxml2 numactl libglvnd libX11 ];
|
||||||
cp ${rocm-opencl-runtime.src}/amdocl/cl_vk_amd.hpp amdocl/
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python makeWrapper ];
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
clang
|
clang
|
||||||
compiler-rt
|
compiler-rt
|
||||||
lld
|
lld
|
||||||
llvm
|
llvm
|
||||||
rocclr
|
|
||||||
rocm-comgr
|
rocm-comgr
|
||||||
rocm-device-libs
|
rocm-device-libs
|
||||||
rocm-runtime
|
rocm-runtime
|
||||||
@ -58,123 +130,28 @@ stdenv.mkDerivation rec {
|
|||||||
export DEVICE_LIB_PATH=${rocm-device-libs}/lib
|
export DEVICE_LIB_PATH=${rocm-device-libs}/lib
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# The patch version is the last two digits of year + week number +
|
|
||||||
# day in the week: date -d "2021-07-25" +%y%U%w
|
|
||||||
workweek = "21300";
|
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DHSA_PATH=${rocm-runtime}"
|
|
||||||
"-DHIP_COMPILER=clang"
|
|
||||||
"-DHIP_PLATFORM=amd"
|
"-DHIP_PLATFORM=amd"
|
||||||
"-DHIP_VERSION_GITDATE=${workweek}"
|
"-DAMD_OPENCL_PATH=${rocm-opencl-runtime.src}"
|
||||||
"-DCMAKE_C_COMPILER=${clang}/bin/clang"
|
"-DHIP_COMMON_DIR=${hip}"
|
||||||
"-DCMAKE_CXX_COMPILER=${clang}/bin/clang++"
|
"-DROCCLR_PATH=${rocclr}"
|
||||||
"-DLLVM_ENABLE_RTTI=ON"
|
|
||||||
"-DLIBROCclr_STATIC_DIR=${rocclr}/lib/cmake"
|
|
||||||
"-DROCclr_DIR=${rocclr}"
|
|
||||||
"-DHIP_CLANG_ROOT=${clang-unwrapped}"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
patches = [
|
|
||||||
(fetchpatch {
|
|
||||||
name = "no-git-during-build";
|
|
||||||
url = "https://github.com/acowley/HIP/commit/310b7e972cfb23216250c0240ba6134741679aee.patch";
|
|
||||||
sha256 = "08ky7v1yvajabn9m5x3afzrnz38gnrgc7vgqlbyr7s801c383ha1";
|
|
||||||
})
|
|
||||||
(fetchpatch {
|
|
||||||
name = "use-PATH-when-compiling-pch";
|
|
||||||
url = "https://github.com/acowley/HIP/commit/bfb4dd1eafa9714a2c05a98229cc35ffa3429b37.patch";
|
|
||||||
sha256 = "1wp0m32df7pf4rhx3k5n750fd7kz10zr60z0wllb0mw6h00w6xpz";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
# - fix bash paths
|
|
||||||
# - fix path to rocm_agent_enumerator
|
|
||||||
# - fix hcc path
|
|
||||||
# - fix hcc version parsing
|
|
||||||
# - add linker flags for libhsa-runtime64 and hc_am since libhip_hcc
|
|
||||||
# refers to them.
|
|
||||||
prePatch = ''
|
|
||||||
for f in $(find bin -type f); do
|
|
||||||
sed -e 's,#!/usr/bin/perl,#!${perl}/bin/perl,' \
|
|
||||||
-e 's,#!/bin/bash,#!${stdenv.shell},' \
|
|
||||||
-i "$f"
|
|
||||||
done
|
|
||||||
|
|
||||||
for f in $(find . -regex '.*\.cpp\|.*\.h\(pp\)?'); do
|
|
||||||
if grep -q __hcc_workweek__ "$f" ; then
|
|
||||||
substituteInPlace "$f" --replace '__hcc_workweek__' '${workweek}'
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
sed 's,#!/usr/bin/python,#!${python}/bin/python,' -i hip_prof_gen.py
|
|
||||||
|
|
||||||
sed -e 's,$ROCM_AGENT_ENUM = "''${ROCM_PATH}/bin/rocm_agent_enumerator";,$ROCM_AGENT_ENUM = "${rocminfo}/bin/rocm_agent_enumerator";,' \
|
|
||||||
-e "s,^\($HIP_LIB_PATH=\).*$,\1\"$out/lib\";," \
|
|
||||||
-e 's,^\($HIP_CLANG_PATH=\).*$,\1"${clang}/bin";,' \
|
|
||||||
-e 's,^\($DEVICE_LIB_PATH=\).*$,\1"${rocm-device-libs}/amdgcn/bitcode";,' \
|
|
||||||
-e 's,^\($HIP_COMPILER=\).*$,\1"clang";,' \
|
|
||||||
-e 's,^\($HIP_RUNTIME=\).*$,\1"ROCclr";,' \
|
|
||||||
-e 's,^\([[:space:]]*$HSA_PATH=\).*$,\1"${rocm-runtime}";,'g \
|
|
||||||
-e 's,\([[:space:]]*$HOST_OSNAME=\).*,\1"nixos";,' \
|
|
||||||
-e 's,\([[:space:]]*$HOST_OSVER=\).*,\1"${lib.versions.majorMinor lib.version}";,' \
|
|
||||||
-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:]]*$HIPCXXFLAGS .= " -isystem $HIP_CLANG_INCLUDE_PATH\)";,\1 -isystem ${rocm-runtime}/include";,' \
|
|
||||||
-e 's,\($HIPCXXFLAGS .= " -isystem \\"$HIP_INCLUDE_PATH\\"\)" ;,\1 --rocm-path=${rocclr}";,' \
|
|
||||||
-e "s,\$HIP_PATH/\(bin\|lib\),$out/\1,g" \
|
|
||||||
-e "s,^\$HIP_LIB_PATH=\$ENV{'HIP_LIB_PATH'};,\$HIP_LIB_PATH=\"$out/lib\";," \
|
|
||||||
-e 's,`file,`${file}/bin/file,g' \
|
|
||||||
-e 's,`readelf,`${binutils-unwrapped}/bin/readelf,' \
|
|
||||||
-e 's, ar , ${binutils-unwrapped}/bin/ar ,g' \
|
|
||||||
-i bin/hipcc
|
|
||||||
|
|
||||||
sed -e 's,^\($HSA_PATH=\).*$,\1"${rocm-runtime}";,' \
|
|
||||||
-e 's,^\($HIP_CLANG_PATH=\).*$,\1"${clang}/bin";,' \
|
|
||||||
-e 's,^\($HIP_PLATFORM=\).*$,\1"amd";,' \
|
|
||||||
-e 's,$HIP_CLANG_PATH/llc,${llvm}/bin/llc,' \
|
|
||||||
-e 's, abs_path, Cwd::abs_path,' \
|
|
||||||
-i bin/hipconfig
|
|
||||||
|
|
||||||
sed -e 's, abs_path, Cwd::abs_path,' -i bin/hipvars.pm
|
|
||||||
|
|
||||||
sed -e 's|_IMPORT_PREFIX}/../include|_IMPORT_PREFIX}/include|g' \
|
|
||||||
-e 's|''${HIP_CLANG_ROOT}/lib/clang/\*/include|${clang-unwrapped}/lib/clang/*/include|' \
|
|
||||||
-i hip-config.cmake.in
|
|
||||||
'';
|
|
||||||
|
|
||||||
preInstall = ''
|
|
||||||
mkdir -p $out/lib/cmake
|
|
||||||
'';
|
|
||||||
|
|
||||||
# The upstream ROCclr setup wants everything built into the same
|
|
||||||
# ROCclr output directory. We copy things into the HIP output
|
|
||||||
# directory, since it is downstream of ROCclr in terms of dependency
|
|
||||||
# direction. Thus we have device-libs and rocclr pieces in the HIP
|
|
||||||
# output directory.
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -p $out/share
|
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"
|
||||||
mv $out/lib/cmake $out/share/
|
|
||||||
mv $out/cmake/* $out/share/cmake/hip
|
|
||||||
mkdir -p $out/lib
|
|
||||||
ln -s ${rocm-device-libs}/lib $out/lib/bitcode
|
|
||||||
mkdir -p $out/include
|
|
||||||
ln -s ${clang-unwrapped}/lib/clang/11.0.0/include $out/include/clang
|
|
||||||
ln -s ${rocclr}/lib/*.* $out/lib
|
|
||||||
ln -s ${rocclr}/include/* $out/include
|
|
||||||
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
|
|
||||||
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
|
||||||
'';
|
'';
|
||||||
|
|
||||||
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
|
||||||
version="$(curl -sL "https://api.github.com/repos/ROCm-Developer-Tools/HIP/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
|
version="$(curl -sL "https://api.github.com/repos/ROCm-Developer-Tools/hipamd/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
|
||||||
update-source-version hip "$version"
|
update-source-version hip "$version"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "C++ Heterogeneous-Compute Interface for Portability";
|
description = "C++ Heterogeneous-Compute Interface for Portability";
|
||||||
homepage = "https://github.com/ROCm-Developer-Tools/HIP";
|
homepage = "https://github.com/ROCm-Developer-Tools/hipamd";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
maintainers = with maintainers; [ lovesegfault ];
|
maintainers = with maintainers; [ lovesegfault ];
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
--- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
|
||||||
|
@@ -370,15 +370,6 @@
|
||||||
|
|
||||||
|
#if SANITIZER_GLIBC
|
||||||
|
// _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
|
||||||
|
- _(CYGETDEFTHRESH, WRITE, sizeof(int));
|
||||||
|
- _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
|
||||||
|
- _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
|
||||||
|
- _(CYGETTHRESH, WRITE, sizeof(int));
|
||||||
|
- _(CYGETTIMEOUT, WRITE, sizeof(int));
|
||||||
|
- _(CYSETDEFTHRESH, NONE, 0);
|
||||||
|
- _(CYSETDEFTIMEOUT, NONE, 0);
|
||||||
|
- _(CYSETTHRESH, NONE, 0);
|
||||||
|
- _(CYSETTIMEOUT, NONE, 0);
|
||||||
|
_(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
|
||||||
|
_(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
|
||||||
|
_(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
|
||||||
|
@@ -143,7 +143,6 @@
|
||||||
|
# include <sys/procfs.h>
|
||||||
|
#endif
|
||||||
|
#include <sys/user.h>
|
||||||
|
-#include <linux/cyclades.h>
|
||||||
|
#include <linux/if_eql.h>
|
||||||
|
#include <linux/if_plip.h>
|
||||||
|
#include <linux/lp.h>
|
||||||
|
@@ -460,7 +459,6 @@
|
||||||
|
|
||||||
|
#if SANITIZER_GLIBC
|
||||||
|
unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
|
||||||
|
- unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
|
||||||
|
#if EV_VERSION > (0x010000)
|
||||||
|
unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
|
||||||
|
#else
|
||||||
|
@@ -824,15 +822,6 @@
|
||||||
|
#endif // SANITIZER_LINUX
|
||||||
|
|
||||||
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
|
- unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
|
||||||
|
- unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
|
||||||
|
- unsigned IOCTL_CYGETMON = CYGETMON;
|
||||||
|
- unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
|
||||||
|
- unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
|
||||||
|
- unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
|
||||||
|
- unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
|
||||||
|
- unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
|
||||||
|
- unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
|
||||||
|
unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
|
||||||
|
unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
|
||||||
|
unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
|
||||||
|
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.h
|
||||||
|
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.h
|
||||||
|
@@ -983,7 +983,6 @@
|
||||||
|
|
||||||
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
|
extern unsigned struct_ax25_parms_struct_sz;
|
||||||
|
-extern unsigned struct_cyclades_monitor_sz;
|
||||||
|
extern unsigned struct_input_keymap_entry_sz;
|
||||||
|
extern unsigned struct_ipx_config_data_sz;
|
||||||
|
extern unsigned struct_kbdiacrs_sz;
|
||||||
|
@@ -1328,15 +1327,6 @@
|
||||||
|
#endif // SANITIZER_LINUX
|
||||||
|
|
||||||
|
#if SANITIZER_LINUX && !SANITIZER_ANDROID
|
||||||
|
-extern unsigned IOCTL_CYGETDEFTHRESH;
|
||||||
|
-extern unsigned IOCTL_CYGETDEFTIMEOUT;
|
||||||
|
-extern unsigned IOCTL_CYGETMON;
|
||||||
|
-extern unsigned IOCTL_CYGETTHRESH;
|
||||||
|
-extern unsigned IOCTL_CYGETTIMEOUT;
|
||||||
|
-extern unsigned IOCTL_CYSETDEFTHRESH;
|
||||||
|
-extern unsigned IOCTL_CYSETDEFTIMEOUT;
|
||||||
|
-extern unsigned IOCTL_CYSETTHRESH;
|
||||||
|
-extern unsigned IOCTL_CYSETTIMEOUT;
|
||||||
|
extern unsigned IOCTL_EQL_EMANCIPATE;
|
||||||
|
extern unsigned IOCTL_EQL_ENSLAVE;
|
||||||
|
extern unsigned IOCTL_EQL_GETMASTRCFG;
|
@ -31,12 +31,8 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
|
||||||
(fetchpatch {
|
# https://github.com/llvm/llvm-project/commit/68d5235cb58f988c71b403334cd9482d663841ab.diff but the compiler-rt part of the path is stripped
|
||||||
name = "libsanitizer-no-cyclades-rocm.patch";
|
./68d5235cb58f988c71b403334cd9482d663841ab.patch
|
||||||
url = "https://gist.github.com/lovesegfault/b255dcf2fa4e202411a6a04b61e6cc04/raw";
|
|
||||||
sha256 = "sha256-PMMSLr2zHuNDn1OWqumqHwB74ktJSHxhJWkqEKB7Z64=";
|
|
||||||
stripLen = 1;
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:
|
{ stdenv, lib, buildPackages, fetchFromGitHub, callPackage, wrapCCWith, overrideCC }:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "RadeonOpenCompute";
|
owner = "RadeonOpenCompute";
|
||||||
repo = "llvm-project";
|
repo = "llvm-project";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
hash = "sha256-7XVtHcrTpw+NYUvuKQFWWFE0FlOTt8EnfZpvepQqE1c=";
|
hash = "sha256-XWh81+2yyXQEPO+5SgxHh66fzFG1bVbvnjPfvXDC+fU=";
|
||||||
};
|
};
|
||||||
in rec {
|
in rec {
|
||||||
clang = wrapCCWith rec {
|
clang = wrapCCWith rec {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, writeScript
|
, writeScript
|
||||||
, cmake
|
, cmake
|
||||||
|
, ninja
|
||||||
, python3
|
, python3
|
||||||
, libxml2
|
, libxml2
|
||||||
, libffi
|
, libffi
|
||||||
@ -30,7 +31,7 @@ in stdenv.mkDerivation rec {
|
|||||||
outputs = [ "out" "python" ]
|
outputs = [ "out" "python" ]
|
||||||
++ lib.optional enableSharedLibraries "lib";
|
++ lib.optional enableSharedLibraries "lib";
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake python3 ];
|
nativeBuildInputs = [ cmake ninja python3 ];
|
||||||
|
|
||||||
buildInputs = [ libxml2 libffi ];
|
buildInputs = [ libxml2 libffi ];
|
||||||
|
|
||||||
|
@ -1,55 +1,34 @@
|
|||||||
{ lib, stdenv
|
{ lib, stdenv
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, writeScript
|
, writeScript
|
||||||
, cmake
|
|
||||||
, rocm-cmake
|
|
||||||
, clang
|
|
||||||
, rocm-comgr
|
, rocm-comgr
|
||||||
, rocm-opencl-runtime
|
|
||||||
, rocm-runtime
|
|
||||||
, rocm-thunk
|
|
||||||
, libelf
|
|
||||||
, libglvnd
|
|
||||||
, libX11
|
|
||||||
, numactl
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocclr";
|
pname = "rocclr";
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "ROCm-Developer-Tools";
|
owner = "ROCm-Developer-Tools";
|
||||||
repo = "ROCclr";
|
repo = "ROCclr";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
hash = "sha256-3lk7Zucoam+11gFBzg/TWQI1L8uAlxTrPz/mDwTwod4=";
|
hash = "sha256-fsQANBND/oDeC/+wmCH/aLlDTxPIi7Z/oN1HnNHHnm0=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake rocm-cmake ];
|
|
||||||
|
|
||||||
buildInputs = [ clang rocm-comgr rocm-runtime rocm-thunk ];
|
|
||||||
|
|
||||||
propagatedBuildInputs = [ libelf libglvnd libX11 numactl ];
|
|
||||||
|
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
substituteInPlace CMakeLists.txt \
|
|
||||||
--replace 'set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ''${CMAKE_CURRENT_BINARY_DIR}/lib)' \
|
|
||||||
'set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ''${CMAKE_INSTALL_LIBDIR})'
|
|
||||||
substituteInPlace device/comgrctx.cpp \
|
substituteInPlace device/comgrctx.cpp \
|
||||||
--replace "libamd_comgr.so" "${rocm-comgr}/lib/libamd_comgr.so"
|
--replace "libamd_comgr.so" "${rocm-comgr}/lib/libamd_comgr.so"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cmakeFlags = [
|
buildPhase = "";
|
||||||
"-DOPENCL_DIR=${rocm-opencl-runtime.src}"
|
|
||||||
];
|
|
||||||
|
|
||||||
preFixup = ''
|
installPhase = ''
|
||||||
# Work around broken cmake files
|
runHook preInstall
|
||||||
ln -s $out/include/compiler/lib/include/* $out/include
|
|
||||||
ln -s $out/include/elf/elfio $out/include/elfio
|
|
||||||
|
|
||||||
substituteInPlace $out/lib/cmake/rocclr/ROCclrConfig.cmake \
|
mkdir -p $out
|
||||||
--replace "/build/source/build" "$out"
|
cp -r * $out/
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.updateScript = writeScript "update.sh" ''
|
passthru.updateScript = writeScript "update.sh" ''
|
||||||
@ -60,7 +39,7 @@ stdenv.mkDerivation rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Radeon Open Compute common language runtime";
|
description = "Source package of the Radeon Open Compute common language runtime";
|
||||||
homepage = "https://github.com/ROCm-Developer-Tools/ROCclr";
|
homepage = "https://github.com/ROCm-Developer-Tools/ROCclr";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
maintainers = with maintainers; [ lovesegfault ];
|
maintainers = with maintainers; [ lovesegfault ];
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocm-comgr";
|
pname = "rocm-comgr";
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "RadeonOpenCompute";
|
owner = "RadeonOpenCompute";
|
||||||
repo = "ROCm-CompilerSupport";
|
repo = "ROCm-CompilerSupport";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
hash = "sha256-wHSAhp1cqR9xOreGt2M2Td/ELCuLEHjpMRRkqE9dUy0=";
|
hash = "sha256-enGzu1EOo87/S5oH1eEqPy0AtsBhCcroG3DYemeNgR0=";
|
||||||
};
|
};
|
||||||
|
|
||||||
sourceRoot = "source/lib/comgr";
|
sourceRoot = "source/lib/comgr";
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocm-device-libs";
|
pname = "rocm-device-libs";
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "RadeonOpenCompute";
|
owner = "RadeonOpenCompute";
|
||||||
repo = "ROCm-Device-Libs";
|
repo = "ROCm-Device-Libs";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
hash = "sha256-fPD9vevO2UDaFaclSI0CC/lRfM5WemWmxP1K5ajXHbk=";
|
hash = "sha256-UeunsDRLhmsDOzesiEgYIzYotwecehB6VswshzdRwjw=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
, lld
|
, lld
|
||||||
, llvm
|
, llvm
|
||||||
, mesa
|
, mesa
|
||||||
, python2
|
, numactl
|
||||||
|
, python3
|
||||||
, rocclr
|
, rocclr
|
||||||
, rocm-comgr
|
, rocm-comgr
|
||||||
, rocm-device-libs
|
, rocm-device-libs
|
||||||
@ -23,13 +24,13 @@
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocm-opencl-runtime";
|
pname = "rocm-opencl-runtime";
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "RadeonOpenCompute";
|
owner = "RadeonOpenCompute";
|
||||||
repo = "ROCm-OpenCL-Runtime";
|
repo = "ROCm-OpenCL-Runtime";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
hash = "sha256-4+PNxRqvAvU0Nj2igYl3WiS5h5HGV63J+cHbIVW89LE=";
|
hash = "sha256-0OGYF4urlscr8tMkQwo2yATXwN0DjB092KQ+CBEhfIA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake rocm-cmake ];
|
nativeBuildInputs = [ cmake rocm-cmake ];
|
||||||
@ -43,8 +44,8 @@ stdenv.mkDerivation rec {
|
|||||||
lld
|
lld
|
||||||
llvm
|
llvm
|
||||||
mesa
|
mesa
|
||||||
python2
|
numactl
|
||||||
rocclr
|
python3
|
||||||
rocm-comgr
|
rocm-comgr
|
||||||
rocm-device-libs
|
rocm-device-libs
|
||||||
rocm-runtime
|
rocm-runtime
|
||||||
@ -52,12 +53,8 @@ stdenv.mkDerivation rec {
|
|||||||
];
|
];
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
"-DAMDGPU_TARGET_TRIPLE='amdgcn-amd-amdhsa'"
|
"-DAMD_OPENCL_PATH=${src}"
|
||||||
"-DCLANG_OPTIONS_APPEND=-Wno-bitwise-conditional-parentheses"
|
"-DROCCLR_PATH=${rocclr}"
|
||||||
"-DClang_DIR=${clang-unwrapped}/lib/cmake/clang"
|
|
||||||
"-DLIBROCclr_STATIC_DIR=${rocclr}/lib/cmake"
|
|
||||||
"-DLLVM_DIR=${llvm.out}/lib/cmake/llvm"
|
|
||||||
"-DUSE_COMGR_LIBRARY='yes'"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
@ -72,7 +69,6 @@ stdenv.mkDerivation rec {
|
|||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace khronos/icd/loader/linux/icd_linux.c \
|
substituteInPlace khronos/icd/loader/linux/icd_linux.c \
|
||||||
--replace 'ICD_VENDOR_PATH' '"${addOpenGLRunpath.driverLink}/etc/OpenCL/vendors/"'
|
--replace 'ICD_VENDOR_PATH' '"${addOpenGLRunpath.driverLink}/etc/OpenCL/vendors/"'
|
||||||
echo 'add_dependencies(amdocl64 OpenCL)' >> amdocl/CMakeLists.txt
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru.updateScript = writeScript "update.sh" ''
|
passthru.updateScript = writeScript "update.sh" ''
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocm-runtime";
|
pname = "rocm-runtime";
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "RadeonOpenCompute";
|
owner = "RadeonOpenCompute";
|
||||||
repo = "ROCR-Runtime";
|
repo = "ROCR-Runtime";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
hash = "sha256-B67v9B8LXDbWNxYNRxM3dgFFLjFSyJmm0zd3G5Bgvek=";
|
hash = "sha256-DJDlEHnXhegcenO8BIY/8GnZdHldVs0GFLrQy4Z6heY=";
|
||||||
};
|
};
|
||||||
|
|
||||||
sourceRoot = "source/src";
|
sourceRoot = "source/src";
|
||||||
|
@ -3,18 +3,19 @@
|
|||||||
, writeScript
|
, writeScript
|
||||||
, cmake
|
, cmake
|
||||||
, pkg-config
|
, pkg-config
|
||||||
|
, libdrm
|
||||||
, numactl
|
, numactl
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocm-thunk";
|
pname = "rocm-thunk";
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "RadeonOpenCompute";
|
owner = "RadeonOpenCompute";
|
||||||
repo = "ROCT-Thunk-Interface";
|
repo = "ROCT-Thunk-Interface";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
hash = "sha256-jpwFL4UbEnWkw1AiM4U1s1t7GiqzBeOwa55VpnOG2Dk=";
|
hash = "sha256-s/N1wkAgpxYCK6rIiWH8cGQU5YFGj0q4Dxj9j3yIys8=";
|
||||||
};
|
};
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
@ -23,7 +24,7 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
nativeBuildInputs = [ cmake pkg-config ];
|
nativeBuildInputs = [ cmake pkg-config ];
|
||||||
|
|
||||||
buildInputs = [ numactl ];
|
buildInputs = [ libdrm numactl ];
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
cp -r $src/include $out
|
cp -r $src/include $out
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocm-cmake";
|
pname = "rocm-cmake";
|
||||||
version = "4.3.1";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "RadeonOpenCompute";
|
owner = "RadeonOpenCompute";
|
||||||
repo = "rocm-cmake";
|
repo = "rocm-cmake";
|
||||||
rev = "rocm-${version}";
|
rev = "rocm-${version}";
|
||||||
hash = "sha256-BhpYOL7+IlBpkzeFjfy6KLO7ail472KQWFfQX/sXLGo=";
|
hash = "sha256-5RwhIIOtqeMl/Gyufl5U1gTEpoCjdPJP5MbVnhEKYMM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ];
|
nativeBuildInputs = [ cmake ];
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "rocm-smi";
|
pname = "rocm-smi";
|
||||||
version = "4.5.0";
|
version = "4.5.2";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "RadeonOpenCompute";
|
owner = "RadeonOpenCompute";
|
||||||
|
@ -12823,9 +12823,7 @@ with pkgs;
|
|||||||
|
|
||||||
rgxg = callPackage ../tools/text/rgxg { };
|
rgxg = callPackage ../tools/text/rgxg { };
|
||||||
|
|
||||||
rocclr = callPackage ../development/libraries/rocclr {
|
rocclr = callPackage ../development/libraries/rocclr { };
|
||||||
inherit (llvmPackages_rocm) clang;
|
|
||||||
};
|
|
||||||
|
|
||||||
hip = callPackage ../development/compilers/hip {
|
hip = callPackage ../development/compilers/hip {
|
||||||
inherit (llvmPackages_rocm) clang clang-unwrapped compiler-rt lld llvm;
|
inherit (llvmPackages_rocm) clang clang-unwrapped compiler-rt lld llvm;
|
||||||
|
Loading…
Reference in New Issue
Block a user