Merge pull request #258328 from Madouura/pr/rocm-update

This commit is contained in:
Bernardo Meurer 2023-10-10 16:20:36 -04:00 committed by GitHub
commit fd1b81464c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
120 changed files with 3084 additions and 7868 deletions

View File

@ -26,7 +26,7 @@ directory which is scanned by the ICL loader for ICD files. For example:
```ShellSession ```ShellSession
$ export \ $ export \
OCL_ICD_VENDORS=`nix-build '<nixpkgs>' --no-out-link -A rocm-opencl-icd`/etc/OpenCL/vendors/ OCL_ICD_VENDORS=`nix-build '<nixpkgs>' --no-out-link -A rocmPackages.clr.icd`/etc/OpenCL/vendors/
``` ```
The second mechanism is to add the OpenCL driver package to The second mechanism is to add the OpenCL driver package to
@ -50,13 +50,13 @@ Platform Vendor Advanced Micro Devices, Inc.
Modern AMD [Graphics Core Modern AMD [Graphics Core
Next](https://en.wikipedia.org/wiki/Graphics_Core_Next) (GCN) GPUs are Next](https://en.wikipedia.org/wiki/Graphics_Core_Next) (GCN) GPUs are
supported through the rocm-opencl-icd package. Adding this package to supported through the rocmPackages.clr.icd package. Adding this package to
[](#opt-hardware.opengl.extraPackages) [](#opt-hardware.opengl.extraPackages)
enables OpenCL support: enables OpenCL support:
```nix ```nix
hardware.opengl.extraPackages = [ hardware.opengl.extraPackages = [
rocm-opencl-icd rocmPackages.clr.icd
]; ];
``` ```

View File

@ -26,6 +26,9 @@
[`sudo-rs`]: https://github.com/memorysafety/sudo-rs/ [`sudo-rs`]: https://github.com/memorysafety/sudo-rs/
- All [ROCm](https://rocm.docs.amd.com/en/latest/) packages have been updated to 5.7.0.
- [ROCm](https://rocm.docs.amd.com/en/latest/) package attribute sets are versioned: `rocmPackages` -> `rocmPackages_5`.
## New Services {#sec-release-23.11-new-services} ## New Services {#sec-release-23.11-new-services}
- [MCHPRS](https://github.com/MCHPR/MCHPRS), a multithreaded Minecraft server built for redstone. Available as [services.mchprs](#opt-services.mchprs.enable). - [MCHPRS](https://github.com/MCHPR/MCHPRS), a multithreaded Minecraft server built for redstone. Available as [services.mchprs](#opt-services.mchprs.enable).
@ -148,6 +151,17 @@
- `consul` has been updated to `1.16.0`. See the [release note](https://github.com/hashicorp/consul/releases/tag/v1.16.0) for more details. Once a new Consul version has started and upgraded its data directory, it generally cannot be downgraded to the previous version. - `consul` has been updated to `1.16.0`. See the [release note](https://github.com/hashicorp/consul/releases/tag/v1.16.0) for more details. Once a new Consul version has started and upgraded its data directory, it generally cannot be downgraded to the previous version.
- `llvmPackages_rocm` has been moved to `rocmPackages.llvm`.
- `hip`, `rocm-opencl-runtime`, `rocm-opencl-icd`, and `rocclr` have been combined into `rocmPackages.clr`.
- `clang-ocl`, `clr`, `composable_kernel`, `hipblas`, `hipcc`, `hip-common`, `hipcub`,
`hipfft`, `hipfort`, `hipify`, `hipsolver`, `hipsparse`, `migraphx`, `miopen`, `miopengemm`,
`rccl`, `rdc`, `rocalution`, `rocblas`, `rocdgbapi`, `rocfft`, `rocgdb`, `rocm-cmake`,
`rocm-comgr`, `rocm-core`, `rocm-device-libs`, `rocminfo`, `rocmlir`, `rocm-runtime`,
`rocm-smi`, `rocm-thunk`, `rocprim`, `rocprofiler`, `rocrand`, `rocr-debug-agent`,
`rocsolver`, `rocsparse`, `rocthrust`, `roctracer`, `rocwmma`, and `tensile` have been moved to `rocmPackages`.
- `himalaya` has been updated to `0.8.0`, which drops the native TLS support (in favor of Rustls) and add OAuth 2.0 support. See the [release note](https://github.com/soywod/himalaya/releases/tag/v0.8.0) for more details. - `himalaya` has been updated to `0.8.0`, which drops the native TLS support (in favor of Rustls) and add OAuth 2.0 support. See the [release note](https://github.com/soywod/himalaya/releases/tag/v0.8.0) for more details.
- `nix-prefetch-git` now ignores global and user git config, to improve reproducibility. - `nix-prefetch-git` now ignores global and user git config, to improve reproducibility.

View File

@ -6,7 +6,7 @@
, zlib, zstd, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath , zlib, zstd, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath
, jackaudioSupport ? false, libjack2 , jackaudioSupport ? false, libjack2
, cudaSupport ? config.cudaSupport, cudaPackages ? { } , cudaSupport ? config.cudaSupport, cudaPackages ? { }
, hipSupport ? false, hip # comes with a significantly larger closure size , hipSupport ? false, rocmPackages # comes with a significantly larger closure size
, colladaSupport ? true, opencollada , colladaSupport ? true, opencollada
, spaceNavSupport ? stdenv.isLinux, libspnav , spaceNavSupport ? stdenv.isLinux, libspnav
, makeWrapper , makeWrapper
@ -103,8 +103,8 @@ stdenv.mkDerivation (finalAttrs: rec {
substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"' substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"'
'') + '') +
(lib.optionalString hipSupport '' (lib.optionalString hipSupport ''
substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${hip}/lib/libamdhip64.so"' substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${rocmPackages.clr}/lib/libamdhip64.so"'
substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${hip}/bin"' substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"'
''); '');
cmakeFlags = cmakeFlags =

View File

@ -37,11 +37,7 @@
# and for Nvidia see https://github.com/cp2k/cp2k/blob/master/INSTALL.md#2i-cuda-optional-improved-performance-on-gpu-systems # and for Nvidia see https://github.com/cp2k/cp2k/blob/master/INSTALL.md#2i-cuda-optional-improved-performance-on-gpu-systems
, gpuVersion ? "Mi100" , gpuVersion ? "Mi100"
, gpuArch ? "gfx908" , gpuArch ? "gfx908"
, rocm-core , rocmPackages
, hip
, hipblas
, hipfft
, rocblas
}: }:
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ]; assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
@ -86,7 +82,13 @@ stdenv.mkDerivation rec {
] ]
++ lib.optional enableElpa elpa ++ lib.optional enableElpa elpa
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit ++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
++ lib.optional (gpuBackend == "rocm") [hip rocm-core hipblas hipfft rocblas] ++ lib.optional (gpuBackend == "rocm") [
rocmPackages.clr
rocmPackages.rocm-core
rocmPackages.hipblas
rocmPackages.hipfft
rocmPackages.rocblas
]
; ;
propagatedBuildInputs = [ mpi ]; propagatedBuildInputs = [ mpi ];
@ -126,7 +128,7 @@ stdenv.mkDerivation rec {
${lib.strings.optionalString (gpuBackend == "rocm") '' ${lib.strings.optionalString (gpuBackend == "rocm") ''
GPUVER = ${gpuVersion} GPUVER = ${gpuVersion}
OFFLOAD_CC = hipcc OFFLOAD_CC = hipcc
OFFLOAD_FLAGS = -fopenmp -m64 -pthread -fPIC -D__GRID_HIP -O2 --offload-arch=${gpuArch} --rocm-path=${rocm-core} OFFLOAD_FLAGS = -fopenmp -m64 -pthread -fPIC -D__GRID_HIP -O2 --offload-arch=${gpuArch} --rocm-path=${rocmPackages.rocm-core}
OFFLOAD_TARGET = hip OFFLOAD_TARGET = hip
CXX = mpicxx CXX = mpicxx
CXXFLAGS = -std=c++11 -fopenmp -D__HIP_PLATFORM_AMD__ CXXFLAGS = -std=c++11 -fopenmp -D__HIP_PLATFORM_AMD__

View File

@ -23,8 +23,7 @@
, llvmPackages , llvmPackages
, gpuBackend ? "none" , gpuBackend ? "none"
, cudaPackages , cudaPackages
, hip , rocmPackages
, rocblas
}: }:
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ]; assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
@ -67,8 +66,10 @@ stdenv.mkDerivation rec {
libvdwxc libvdwxc
] ]
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit ++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
++ lib.optionals (gpuBackend == "rocm") [ hip rocblas ] ++ lib.optionals (gpuBackend == "rocm") [
++ lib.optional stdenv.isDarwin llvmPackages.openmp rocmPackages.clr
rocmPackages.rocblas
] ++ lib.optional stdenv.isDarwin llvmPackages.openmp
; ;
propagatedBuildInputs = [ mpi ]; propagatedBuildInputs = [ mpi ];
@ -87,7 +88,7 @@ stdenv.mkDerivation rec {
] ]
++ lib.optionals (gpuBackend == "rocm") [ ++ lib.optionals (gpuBackend == "rocm") [
"-DUSE_ROCM=ON" "-DUSE_ROCM=ON"
"-DHIP_ROOT_DIR=${hip}" "-DHIP_ROOT_DIR=${rocmPackages.clr}"
]; ];
doCheck = true; doCheck = true;

View File

@ -8,9 +8,7 @@
, llvmPackages , llvmPackages
, gpuBackend ? "none" , gpuBackend ? "none"
, cudaPackages , cudaPackages
, hip , rocmPackages
, rocfft
, hipfft
}: }:
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ]; assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
@ -35,8 +33,11 @@ stdenv.mkDerivation rec {
fftw fftw
] ]
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit ++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
++ lib.optionals (gpuBackend == "rocm") [ hip rocfft hipfft ] ++ lib.optionals (gpuBackend == "rocm") [
++ lib.optional stdenv.isDarwin llvmPackages.openmp rocmPackages.clr
rocmPackages.rocfft
rocmPackages.hipfft
] ++ lib.optional stdenv.isDarwin llvmPackages.openmp
; ;
propagatedBuildInputs = [ mpi ]; propagatedBuildInputs = [ mpi ];
@ -53,7 +54,7 @@ stdenv.mkDerivation rec {
++ lib.optional (gpuBackend == "cuda") "-DSPFFT_GPU_BACKEND=CUDA" ++ lib.optional (gpuBackend == "cuda") "-DSPFFT_GPU_BACKEND=CUDA"
++ lib.optionals (gpuBackend == "rocm") [ ++ lib.optionals (gpuBackend == "rocm") [
"-DSPFFT_GPU_BACKEND=ROCM" "-DSPFFT_GPU_BACKEND=ROCM"
"-DHIP_ROOT_DIR=${hip}" "-DHIP_ROOT_DIR=${rocmPackages.clr}"
]; ];

View File

@ -8,8 +8,7 @@
, llvmPackages , llvmPackages
, gpuBackend ? "none" , gpuBackend ? "none"
, cudaPackages , cudaPackages
, hip , rocmPackages
, rocblas
}: }:
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ]; assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
@ -39,8 +38,10 @@ stdenv.mkDerivation rec {
blas blas
] ]
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit ++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
++ lib.optionals (gpuBackend == "rocm") [ hip rocblas rocblas ] ++ lib.optionals (gpuBackend == "rocm") [
++ lib.optional stdenv.isDarwin llvmPackages.openmp rocmPackages.clr
rocmPackages.rocblas
] ++ lib.optional stdenv.isDarwin llvmPackages.openmp
; ;
propagatedBuildInputs = [ mpi ]; propagatedBuildInputs = [ mpi ];

View File

@ -1,129 +0,0 @@
diff --git a/bin/hipcc.pl b/bin/hipcc.pl
index da9559b..7aaa540 100755
--- a/bin/hipcc.pl
+++ b/bin/hipcc.pl
@@ -185,7 +185,7 @@ if ($HIP_PLATFORM eq "amd") {
chomp($HIP_CLANG_TARGET);
if (! defined $HIP_CLANG_INCLUDE_PATH) {
- $HIP_CLANG_INCLUDE_PATH = abs_path("$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/include");
+ $HIP_CLANG_INCLUDE_PATH = abs_path("@clang@/resource-root/include");
}
if (! defined $HIP_INCLUDE_PATH) {
$HIP_INCLUDE_PATH = "$HIP_PATH/include";
@@ -206,8 +206,8 @@ if ($HIP_PLATFORM eq "amd") {
print ("HIP_CLANG_TARGET=$HIP_CLANG_TARGET\n");
}
- $HIPCXXFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH/..\"";
- $HIPCFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH/..\"";
+ $HIPCXXFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH\"";
+ $HIPCFLAGS .= " -isystem \"$HIP_CLANG_INCLUDE_PATH\"";
$HIPLDFLAGS .= " -L\"$HIP_LIB_PATH\"";
if ($isWindows) {
$HIPLDFLAGS .= " -lamdhip64";
@@ -625,7 +625,7 @@ if($HIP_PLATFORM eq "amd"){
$targetsStr = $ENV{HCC_AMDGPU_TARGET};
} elsif (not $isWindows) {
# Else try using rocm_agent_enumerator
- $ROCM_AGENT_ENUM = "${ROCM_PATH}/bin/rocm_agent_enumerator";
+ $ROCM_AGENT_ENUM = "@rocminfo@/bin/rocm_agent_enumerator";
$targetsStr = `${ROCM_AGENT_ENUM} -t GPU`;
$targetsStr =~ s/\n/,/g;
}
@@ -724,16 +724,16 @@ if ($HIP_PLATFORM eq "amd") {
if (not $isWindows and not $compileOnly) {
if ($linkType eq 0) {
- $toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L$ROCM_PATH/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs};
+ $toolArgs = " -L$HIP_LIB_PATH -lamdhip64 -L@rocm_runtime@/lib -lhsa-runtime64 -ldl -lnuma " . ${toolArgs};
} else {
$toolArgs = ${toolArgs} . " -Wl,-rpath=$HIP_LIB_PATH:$ROCM_PATH/lib -lamdhip64 ";
}
# To support __fp16 and _Float16, explicitly link with compiler-rt
- $HIP_CLANG_BUILTIN_LIB="$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a";
+ $HIP_CLANG_BUILTIN_LIB="@clang@/resource-root/lib/$HIP_CLANG_TARGET/libclang_rt.builtins.a";
if (-e $HIP_CLANG_BUILTIN_LIB) {
- $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/$HIP_CLANG_TARGET -lclang_rt.builtins "
+ $toolArgs .= " -L@clang@/resource-root/lib/$HIP_CLANG_TARGET -lclang_rt.builtins "
} else {
- $toolArgs .= " -L$HIP_CLANG_PATH/../lib/clang/$HIP_CLANG_VERSION/lib/linux -lclang_rt.builtins-x86_64 "
+ $toolArgs .= " -L@clang@/resource-root/lib/linux -lclang_rt.builtins-x86_64 "
}
}
}
diff --git a/bin/hipconfig.pl b/bin/hipconfig.pl
index 5ddb8e9..6a76a2e 100755
--- a/bin/hipconfig.pl
+++ b/bin/hipconfig.pl
@@ -77,7 +77,7 @@ if ($HIP_COMPILER eq "clang") {
$CPP_CONFIG = " -D__HIP_PLATFORM_HCC__= -D__HIP_PLATFORM_AMD__=";
$HIP_PATH_INCLUDE = $HIP_PATH."/include";
- $HIP_CLANG_INCLUDE = $HIP_CLANG_PATH."/../lib/clang/".$HIP_CLANG_VERSION;
+ $HIP_CLANG_INCLUDE = "@clang@/resource-root/include";
if($isWindows) {
$CPP_CONFIG .= " -I\"$HIP_PATH_INCLUDE\" -I\"$HIP_CLANG_INCLUDE\"";
} else {
@@ -168,7 +168,7 @@ if (!$printed or $p_full) {
print ("HIP_CLANG_PATH : $HIP_CLANG_PATH\n");
if ($isWindows) {
system("\"$HIP_CLANG_PATH/clang++\" --version");
- system("\"$HIP_CLANG_PATH/llc\" --version");
+ system("\"@llvm@/bin/llc\" --version");
printf("hip-clang-cxxflags : ");
$win_output = `perl \"$HIP_PATH/bin/hipcc\" --cxxflags`;
printf("$win_output \n");
@@ -177,7 +177,7 @@ if (!$printed or $p_full) {
printf("$win_output \n");
} else {
system("$HIP_CLANG_PATH/clang++ --version");
- system("$HIP_CLANG_PATH/llc --version");
+ system("@llvm@/bin/llc --version");
print ("hip-clang-cxxflags : ");
system("$HIP_PATH/bin/hipcc --cxxflags");
printf("\n");
@@ -219,8 +219,8 @@ if (!$printed or $p_full) {
system ("uname -a");
}
- if (-e "/usr/bin/lsb_release") {
- system ("/usr/bin/lsb_release -a");
+ if (-e "@lsb_release@/bin/lsb_release") {
+ system ("@lsb_release@/bin/lsb_release -a");
}
print "\n" ;
diff --git a/hip-lang-config.cmake.in b/hip-lang-config.cmake.in
index 9250a68..f6e27b7 100644
--- a/hip-lang-config.cmake.in
+++ b/hip-lang-config.cmake.in
@@ -71,8 +71,8 @@ get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)
#need _IMPORT_PREFIX to be set #FILE_REORG_BACKWARD_COMPATIBILITY
-file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "${_IMPORT_PREFIX}/../llvm/lib/clang/*/include")
-file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "${_IMPORT_PREFIX}/llvm/lib/clang/*/include")
+file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "@clang@/resource-root/include")
+file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG "@clang@/resource-root/include")
find_path(HIP_CLANG_INCLUDE_PATH __clang_cuda_math.h
HINTS ${HIP_CLANG_INCLUDE_SEARCH_PATHS}
${HIP_CLANG_INCLUDE_SEARCH_PATHS_REORG}
@@ -89,7 +89,7 @@ find_path(HSA_HEADER hsa/hsa.h
PATHS
"${_IMPORT_PREFIX}/../include" #FILE_REORG_BACKWARD_COMPATIBILITY
"${_IMPORT_PREFIX}/include"
- "${ROCM_PATH}/include"
+ "@rocm_runtime@/include"
)
if (NOT HSA_HEADER)
@@ -97,7 +97,7 @@ if (NOT HSA_HEADER)
endif()
get_filename_component(HIP_COMPILER_INSTALL_PATH ${CMAKE_HIP_COMPILER} DIRECTORY)
-file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_COMPILER_INSTALL_PATH}/../lib/clang/*/lib/*")
+file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "@clang@/resource-root/lib/*")
find_library(CLANGRT_BUILTINS
NAMES
clang_rt.builtins

View File

@ -1,62 +0,0 @@
diff --git a/hip-config.cmake.in b/hip-config.cmake.in
index 89d1224..dc9ba05 100755
--- a/hip-config.cmake.in
+++ b/hip-config.cmake.in
@@ -142,7 +142,7 @@ if(HIP_COMPILER STREQUAL "clang")
file(TO_CMAKE_PATH "${HIP_PATH}/../lc" HIP_CLANG_ROOT)
endif()
else()
- set(HIP_CLANG_ROOT "${ROCM_PATH}/llvm")
+ set(HIP_CLANG_ROOT "@clang@")
endif()
if(NOT HIP_CXX_COMPILER)
set(HIP_CXX_COMPILER ${CMAKE_CXX_COMPILER})
@@ -171,7 +171,7 @@ if(HIP_COMPILER STREQUAL "clang")
get_filename_component(_HIP_CLANG_BIN_PATH "${_HIP_CLANG_REAL_PATH}" DIRECTORY)
get_filename_component(HIP_CLANG_ROOT "${_HIP_CLANG_BIN_PATH}" DIRECTORY)
endif()
- file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS ${HIP_CLANG_ROOT}/lib/clang/*/include)
+ file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS "@clang@/resource-root/include")
find_path(HIP_CLANG_INCLUDE_PATH stddef.h
HINTS
${HIP_CLANG_INCLUDE_SEARCH_PATHS}
@@ -209,7 +209,7 @@ if(NOT WIN32)
"${_IMPORT_PREFIX}/include"
#FILE_REORG_BACKWARD_COMPATIBILITY ${_IMPORT_PREFIX}/../include is for Backward compatibility
"${_IMPORT_PREFIX}/../include"
- ${ROCM_PATH}/include
+ "@rocm_runtime@/include"
)
if (NOT HSA_HEADER)
@@ -291,7 +291,7 @@ if(HIP_COMPILER STREQUAL "clang")
endif()
endif()
- file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "${HIP_CLANG_ROOT}/lib/clang/*/lib/*")
+ file(GLOB HIP_CLANGRT_LIB_SEARCH_PATHS "@clang@/resource-root/lib/*")
find_library(CLANGRT_BUILTINS
NAMES
clang_rt.builtins
diff --git a/src/hip_embed_pch.sh b/src/hip_embed_pch.sh
index 0a1572b..2feb19a 100755
--- a/src/hip_embed_pch.sh
+++ b/src/hip_embed_pch.sh
@@ -149,7 +149,7 @@ EOF
$LLVM_DIR/bin/clang -cc1 -O3 -emit-pch -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-linux-gnu -fcuda-is-device -std=c++17 -fgnuc-version=4.2.1 -o $tmp/hip_wave64.pch -x hip-cpp-output - <$tmp/pch_wave64.cui &&
- $LLVM_DIR/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&
+ @llvm@/bin/llvm-mc -o hip_pch.o $tmp/hip_pch.mcin --filetype=obj &&
rm -rf $tmp
}
@@ -195,7 +195,7 @@ EOF
set -x
$LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib --hip-version=4.4 -isystem $HIP_INC_DIR -isystem $HIP_BUILD_INC_DIR -isystem $HIP_AMD_INC_DIR --cuda-device-only -D__HIPCC_RTC__ -x hip $tmp/hipRTC_header.h -E -o $tmp/hiprtc &&
cat $macroFile >> $tmp/hiprtc &&
- $LLVM_DIR/bin/llvm-mc -o $tmp/hiprtc_header.o $tmp/hipRTC_header.mcin --filetype=obj &&
+ @llvm@/bin/llvm-mc -o $tmp/hiprtc_header.o $tmp/hipRTC_header.mcin --filetype=obj &&
$LLVM_DIR/bin/clang $tmp/hiprtc_header.o -o $rtc_shared_lib_out -shared &&
$LLVM_DIR/bin/clang -O3 --rocm-path=$HIP_INC_DIR/.. -std=c++14 -nogpulib -nogpuinc -emit-llvm -c -o $tmp/tmp.bc --cuda-device-only -D__HIPCC_RTC__ --offload-arch=gfx906 -x hip-cpp-output $tmp/hiprtc &&
rm -rf $tmp

View File

@ -1,197 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, rocmUpdateScript
, substituteAll
, makeWrapper
, hip-common
, hipcc
, rocclr
, roctracer
, cmake
, perl
, llvm
, rocminfo
, rocm-thunk
, rocm-comgr
, rocm-device-libs
, rocm-runtime
, rocm-opencl-runtime
, cudatoolkit
, numactl
, libxml2
, libX11
, libglvnd
, doxygen
, graphviz
, fontconfig
, python3Packages
, buildDocs ? true
, buildTests ? false
, useNVIDIA ? false
}:
let
hipPlatform = if useNVIDIA then "nvidia" else "amd";
wrapperArgs = [
"--prefix PATH : $out/bin"
"--prefix LD_LIBRARY_PATH : ${rocm-runtime}"
"--set HIP_PLATFORM ${hipPlatform}"
"--set HIP_PATH $out"
"--set HIP_CLANG_PATH ${stdenv.cc}/bin"
"--set DEVICE_LIB_PATH ${rocm-device-libs}/amdgcn/bitcode"
"--set HSA_PATH ${rocm-runtime}"
"--set ROCM_PATH $out"
] ++ lib.optionals useNVIDIA [
"--set CUDA_PATH ${cudatoolkit}"
];
in stdenv.mkDerivation (finalAttrs: {
pname = "hip-${hipPlatform}";
version = "5.4.4";
outputs = [
"out"
] ++ lib.optionals buildDocs [
"doc"
];
src = fetchFromGitHub {
owner = "ROCm-Developer-Tools";
repo = "hipamd";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-FcuylhkG7HqLYXH1J6ND6IVEIbDzHp7h7jg2ZZ4XoFM=";
};
patches = [
(substituteAll {
src = ./0000-fixup-paths.patch;
inherit llvm;
clang = stdenv.cc;
rocm_runtime = rocm-runtime;
})
# https://github.com/ROCm-Developer-Tools/hipamd/commit/be33ec55acc104a59d01df5912261d007c7f3ee9
(fetchpatch {
url = "https://github.com/ROCm-Developer-Tools/hipamd/commit/be33ec55acc104a59d01df5912261d007c7f3ee9.patch";
hash = "sha256-eTC4mUIN1FwRce1n38uDOlITFL/vpcOhvnaZTo5R7lo=";
})
];
nativeBuildInputs = [
makeWrapper
cmake
perl
python3Packages.python
python3Packages.cppheaderparser
] ++ lib.optionals buildDocs [
doxygen
graphviz
fontconfig
];
buildInputs = [
numactl
libxml2
libX11
libglvnd
];
propagatedBuildInputs = [
stdenv.cc
llvm
rocminfo
rocm-thunk
rocm-comgr
rocm-device-libs
rocm-runtime
rocm-opencl-runtime
] ++ lib.optionals useNVIDIA [
cudatoolkit
];
cmakeFlags = [
"-DROCM_PATH=${rocminfo}"
"-DHIP_PLATFORM=${hipPlatform}"
"-DHIP_COMMON_DIR=${hip-common}"
"-DHIPCC_BIN_DIR=${hipcc}/bin"
"-DHIP_LLVM_ROOT=${stdenv.cc}"
"-DROCCLR_PATH=${rocclr}"
"-DAMD_OPENCL_PATH=${rocm-opencl-runtime.src}"
"-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext"
# Temporarily set variables to work around upstream CMakeLists issue
# Can be removed once https://github.com/ROCm-Developer-Tools/hipamd/issues/55 is fixed
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBDIR=lib"
] ++ lib.optionals buildTests [
"-DHIP_CATCH_TEST=1"
];
postPatch = ''
export HIP_CLANG_PATH=${stdenv.cc}/bin
patchShebangs src
'' + lib.optionalString buildDocs ''
export HOME=$(mktemp -d)
export FONTCONFIG_FILE=${fontconfig.out}/etc/fonts/fonts.conf
'';
doCheck = buildTests;
checkTarget = "build_tests";
preCheck = lib.optionalString buildTests ''
export ROCM_PATH=$PWD
export DEVICE_LIB_PATH=${rocm-device-libs}/amdgcn/bitcode
patchShebangs bin
'';
postInstall = ''
patchShebangs $out/bin
cp -a $out/bin/hipcc $out/bin/hipcc-pl
cp -a $out/bin/hipconfig $out/bin/hipconfig-pl
wrapProgram $out/bin/hipcc --set HIP_USE_PERL_SCRIPTS 0
wrapProgram $out/bin/hipconfig --set HIP_USE_PERL_SCRIPTS 0
wrapProgram $out/bin/hipcc.bin ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipconfig.bin ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipcc-pl --set HIP_USE_PERL_SCRIPTS 1
wrapProgram $out/bin/hipconfig-pl --set HIP_USE_PERL_SCRIPTS 1
wrapProgram $out/bin/hipcc.pl ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipconfig.pl ${lib.concatStringsSep " " wrapperArgs}
'';
passthru = {
# All known and valid general GPU targets
# We cannot use this for each ROCm library, as each defines their own supported targets
# See: https://github.com/RadeonOpenCompute/ROCm/blob/77cbac4abab13046ee93d8b5bf410684caf91145/README.md#library-target-matrix
gpuTargets = lib.forEach [
"803"
"900"
"906"
"908"
"90a"
"1010"
"1012"
"1030"
] (target: "gfx${target}");
updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
};
meta = with lib; {
description = "C++ Heterogeneous-Compute Interface for Portability specifically for AMD platform";
homepage = "https://github.com/ROCm-Developer-Tools/hipamd";
license = with licenses; [ mit ];
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
platforms = platforms.linux;
# Tests require GPU, also include issues
broken =
versions.minor finalAttrs.version != versions.minor hip-common.version ||
versions.minor finalAttrs.version != versions.minor hipcc.version ||
buildTests;
};
})

View File

@ -1,130 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c21f247..5bd3e45 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,6 @@ if (NOT WIN32) # C++17 does not require the std lib linking
target_link_libraries(hipconfig.bin ${LINK_LIBS} ) # for hipconfig.bin
endif()
-set(HIP_VERSION_MAJOR 4 PARENT_SCOPE)
-set(HIP_VERSION_MINOR 4 PARENT_SCOPE)
-set(HIP_VERSION_PATCH 4 PARENT_SCOPE)
+set(HIP_VERSION_MAJOR @version_major@)
+set(HIP_VERSION_MINOR @version_minor@)
+set(HIP_VERSION_PATCH @version_patch@)
diff --git a/src/hipBin_amd.h b/src/hipBin_amd.h
index f94e4a5..f0b1b83 100644
--- a/src/hipBin_amd.h
+++ b/src/hipBin_amd.h
@@ -207,7 +207,7 @@ void HipBinAmd::initializeHipCXXFlags() {
hipClangIncludePath = getCompilerIncludePath();
hipCXXFlags += " -isystem \"" + hipClangIncludePath;
fs::path hipCXXFlagsTempFs = hipCXXFlags;
- hipCXXFlagsTempFs /= "..\"";
+ hipCXXFlagsTempFs /= "\"";
hipCXXFlags = hipCXXFlagsTempFs.string();
const EnvVariables& var = getEnvVariables();
// Allow __fp16 as function parameter and return type.
@@ -266,7 +266,7 @@ void HipBinAmd::printCompilerInfo() const {
string cmd = hipClangPath + "/clang++ --version";
system(cmd.c_str()); // hipclang version
cout << "llc-version :" << endl;
- cmd = hipClangPath + "/llc --version";
+ cmd = "@llvm@/bin/llc --version";
system(cmd.c_str()); // llc version
cout << "hip-clang-cxxflags :" << endl;
cmd = hipPath + "/bin/hipcc --cxxflags";
@@ -278,7 +278,7 @@ void HipBinAmd::printCompilerInfo() const {
} else {
string cmd = hipClangPath + "/clang++ --version";
system(cmd.c_str()); // hipclang version
- cmd = hipClangPath + "/llc --version";
+ cmd = "@llvm@/bin/llc --version";
system(cmd.c_str()); // llc version
cout << "hip-clang-cxxflags :" << endl;
cmd = hipPath + "/bin/hipcc --cxxflags";
@@ -331,10 +331,7 @@ string HipBinAmd::getCppConfig() {
hipPathInclude /= "include";
const string& compilerPath = getCompilerPath();
- hipClangInclude = compilerPath;
- hipClangInclude = hipClangInclude.parent_path();
- hipClangInclude /= "lib/clang/";
- hipClangInclude /= compilerVersion;
+ hipClangInclude = "@clang@/resource-root/include";
string hipClangPath = hipClangInclude.string();
const OsType& osInfo = getOSInfo();
@@ -442,17 +439,7 @@ string HipBinAmd::getHipCC() const {
string HipBinAmd::getCompilerIncludePath() {
- string hipClangVersion, includePath, compilerIncludePath;
- const string& hipClangPath = getCompilerPath();
- hipClangVersion = getCompilerVersion();
- fs::path includePathfs = hipClangPath;
- includePathfs = includePathfs.parent_path();
- includePathfs /= "lib/clang/";
- includePathfs /= hipClangVersion;
- includePathfs /= "include";
- includePathfs = fs::absolute(includePathfs).string();
- compilerIncludePath = includePathfs.string();
- return compilerIncludePath;
+ return "@clang@/resource-root/include";
}
@@ -506,8 +493,8 @@ void HipBinAmd::printFull() {
cout << endl << "== Envirnoment Variables" << endl;
printEnvironmentVariables();
getSystemInfo();
- if (fs::exists("/usr/bin/lsb_release"))
- system("/usr/bin/lsb_release -a");
+ if (fs::exists("@lsb_release@/bin/lsb_release"))
+ system("@lsb_release@/bin/lsb_release -a");
cout << endl;
}
@@ -993,7 +980,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
} else if (os != windows) {
// Else try using rocm_agent_enumerator
string ROCM_AGENT_ENUM;
- ROCM_AGENT_ENUM = roccmPath + "/bin/rocm_agent_enumerator";
+ ROCM_AGENT_ENUM = "@rocminfo@/bin/rocm_agent_enumerator";
targetsStr = ROCM_AGENT_ENUM +" -t GPU";
SystemCmdOut sysOut = hipBinUtilPtr_->exec(targetsStr.c_str());
regex toReplace("\n+");
@@ -1097,7 +1084,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
string hipClangVersion, toolArgTemp;
if (linkType == 0) {
toolArgTemp = " -L"+ hipLibPath + "-lamdhip64 -L" +
- roccmPath+ "/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs;
+ "@rocm_runtime@/lib -lhsa-runtime64 -ldl -lnuma " + toolArgs;
toolArgs = toolArgTemp;
} else {
toolArgTemp = toolArgs + " -Wl,--enable-new-dtags -Wl,-rpath=" + hipLibPath + ":"
@@ -1107,8 +1094,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
hipClangVersion = getCompilerVersion();
// To support __fp16 and _Float16, explicitly link with compiler-rt
- toolArgs += " -L" + hipClangPath + "/../lib/clang/" +
- hipClangVersion + "/lib/linux -lclang_rt.builtins-x86_64 ";
+ toolArgs += " -L@clang@/resource-root/lib/linux -lclang_rt.builtins-x86_64 ";
}
if (!var.hipccCompileFlagsAppendEnv_.empty()) {
HIPCXXFLAGS += " " + var.hipccCompileFlagsAppendEnv_ + " ";
diff --git a/src/hipBin_nvidia.h b/src/hipBin_nvidia.h
index 6feb315..b61739d 100644
--- a/src/hipBin_nvidia.h
+++ b/src/hipBin_nvidia.h
@@ -157,8 +157,8 @@ void HipBinNvidia::printFull() {
cout << endl << "== Envirnoment Variables" << endl;
printEnvironmentVariables();
getSystemInfo();
- if (fs::exists("/usr/bin/lsb_release"))
- system("/usr/bin/lsb_release -a");
+ if (fs::exists("@lsb_release@/bin/lsb_release"))
+ system("@lsb_release@/bin/lsb_release -a");
}
// returns hip include

View File

@ -1,18 +0,0 @@
diff --git a/libomptarget/plugins/amdgpu/impl/impl.cpp b/libomptarget/plugins/amdgpu/impl/impl.cpp
index 80e024789..3a14e0889 100644
--- a/libomptarget/plugins/amdgpu/impl/impl.cpp
+++ b/libomptarget/plugins/amdgpu/impl/impl.cpp
@@ -21,10 +21,11 @@ bool is_locked(void *ptr, hsa_status_t *err_p, void **agentBaseAddress) {
info.size = sizeof(hsa_amd_pointer_info_t);
err = hsa_amd_pointer_info(ptr, &info, nullptr, nullptr, nullptr);
- if (err != HSA_STATUS_SUCCESS)
+ if (err != HSA_STATUS_SUCCESS) {
DP("Error when getting pointer info\n");
- else
+ } else {
is_locked = (info.type == HSA_EXT_POINTER_TYPE_LOCKED);
+ }
if (is_locked && agentBaseAddress != nullptr) {
// When user passes in a basePtr+offset we need to fix the

View File

@ -1,603 +0,0 @@
{ lib
, stdenv
, callPackage
, overrideCC
, wrapCCWith
, wrapBintoolsWith
, runCommand
, lit
, glibc
, spirv-llvm-translator
, xz
, swig
, lua5_3
, gtest
, hip
, rocm-comgr
, vulkan-loader
, vulkan-headers
, glslang
, shaderc
, perl
, rocm-device-libs
, rocm-runtime
, elfutils
, python3Packages
}:
let
# Stage 1
# Base
llvm = callPackage ./llvm.nix {
requiredSystemFeatures = [ "big-parallel" ];
isBroken = stdenv.isAarch64; # https://github.com/RadeonOpenCompute/ROCm/issues/1831#issuecomment-1278205344
};
# Projects
clang-unwrapped = callPackage ./llvm.nix rec {
targetName = "clang";
targetDir = targetName;
extraBuildInputs = [ llvm ];
extraCMakeFlags = [
"-DCMAKE_POLICY_DEFAULT_CMP0116=NEW"
"-DCLANG_INCLUDE_DOCS=ON"
"-DCLANG_INCLUDE_TESTS=ON"
];
extraPostPatch = ''
# Looks like they forgot to add finding libedit to the standalone build
ln -s ../cmake/Modules/FindLibEdit.cmake cmake/modules
substituteInPlace CMakeLists.txt \
--replace "include(CheckIncludeFile)" "include(CheckIncludeFile)''\nfind_package(LibEdit)"
# `No such file or directory: '/build/source/clang/tools/scan-build/bin/scan-build'`
rm test/Analysis/scan-build/*.test
rm test/Analysis/scan-build/rebuild_index/rebuild_index.test
# `does not depend on a module exporting 'baz.h'`
rm test/Modules/header-attribs.cpp
# `fatal error: 'stdio.h' file not found`
rm test/OpenMP/amdgcn_emit_llvm.c
'';
extraPostInstall = ''
mv bin/clang-tblgen $out/bin
'';
};
lld = callPackage ./llvm.nix rec {
buildMan = false; # No man pages to build
targetName = "lld";
targetDir = targetName;
extraBuildInputs = [ llvm ];
extraCMakeFlags = [ "-DCMAKE_POLICY_DEFAULT_CMP0116=NEW" ];
checkTargets = [ "check-lld" ];
};
# Runtimes
runtimes = callPackage ./llvm.nix {
buildDocs = false;
buildMan = false;
buildTests = false;
targetDir = "runtimes";
targetRuntimes = [
# "libc" https://github.com/llvm/llvm-project/issues/57719
"libunwind"
"libcxxabi"
"libcxx"
"compiler-rt"
];
extraBuildInputs = [ llvm ];
extraCMakeFlags = [
"-DCMAKE_POLICY_DEFAULT_CMP0114=NEW"
"-DLIBCXX_INCLUDE_BENCHMARKS=OFF"
"-DLIBCXX_CXX_ABI=libcxxabi"
];
extraLicenses = [ lib.licenses.mit ];
};
# Stage 2
# Helpers
rStdenv = overrideCC stdenv (wrapCCWith rec {
inherit bintools;
libcxx = runtimes;
cc = clang-unwrapped;
extraPackages = [
llvm
lld
];
nixSupport.cc-cflags = [
"-resource-dir=$out/resource-root"
"-fuse-ld=lld"
"-rtlib=compiler-rt"
"-unwindlib=libunwind"
"-Wno-unused-command-line-argument"
];
extraBuildCommands = ''
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
mkdir -p $out/resource-root
ln -s ${cc}/lib/clang/$clang_version/include $out/resource-root
ln -s ${runtimes}/lib $out/resource-root
'';
});
bintools = wrapBintoolsWith { bintools = bintools-unwrapped; };
bintools-unwrapped = runCommand "rocm-llvm-binutils-${llvm.version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/$(basename $prog)
done
for prog in ${llvm}/bin/*; do
ln -sf $prog $out/bin/$(basename $prog)
done
ln -s ${llvm}/bin/llvm-ar $out/bin/ar
ln -s ${llvm}/bin/llvm-as $out/bin/as
ln -s ${llvm}/bin/llvm-dwp $out/bin/dwp
ln -s ${llvm}/bin/llvm-nm $out/bin/nm
ln -s ${llvm}/bin/llvm-objcopy $out/bin/objcopy
ln -s ${llvm}/bin/llvm-objdump $out/bin/objdump
ln -s ${llvm}/bin/llvm-ranlib $out/bin/ranlib
ln -s ${llvm}/bin/llvm-readelf $out/bin/readelf
ln -s ${llvm}/bin/llvm-size $out/bin/size
ln -s ${llvm}/bin/llvm-strip $out/bin/strip
ln -s ${lld}/bin/lld $out/bin/ld
'';
in rec {
inherit
llvm
clang-unwrapped
lld
bintools
bintools-unwrapped;
# Runtimes
libc = callPackage ./llvm.nix rec {
stdenv = rStdenv;
targetName = "libc";
targetDir = "runtimes";
targetRuntimes = [ targetName ];
isBroken = true; # https://github.com/llvm/llvm-project/issues/57719
};
libunwind = callPackage ./llvm.nix rec {
stdenv = rStdenv;
buildMan = false; # No man pages to build
targetName = "libunwind";
targetDir = "runtimes";
targetRuntimes = [ targetName ];
extraCMakeFlags = [
"-DLIBUNWIND_INCLUDE_DOCS=ON"
"-DLIBUNWIND_INCLUDE_TESTS=ON"
"-DLIBUNWIND_USE_COMPILER_RT=ON"
];
};
libcxxabi = callPackage ./llvm.nix rec {
stdenv = rStdenv;
buildDocs = false; # No documentation to build
buildMan = false; # No man pages to build
targetName = "libcxxabi";
targetDir = "runtimes";
targetRuntimes = [
"libunwind"
targetName
"libcxx"
];
extraCMakeFlags = [
"-DLIBCXXABI_INCLUDE_TESTS=ON"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
"-DLIBCXXABI_USE_COMPILER_RT=ON"
# Workaround having to build combined
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
"-DLIBUNWIND_USE_COMPILER_RT=ON"
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
"-DLIBCXX_INCLUDE_DOCS=OFF"
"-DLIBCXX_INCLUDE_TESTS=OFF"
"-DLIBCXX_USE_COMPILER_RT=ON"
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_INSTALL_LIBRARY=OFF"
"-DLIBCXX_INSTALL_HEADERS=OFF"
];
};
libcxx = callPackage ./llvm.nix rec {
stdenv = rStdenv;
buildMan = false; # No man pages to build
targetName = "libcxx";
targetDir = "runtimes";
targetRuntimes = [
"libunwind"
"libcxxabi"
targetName
];
extraCMakeFlags = [
"-DLIBCXX_INCLUDE_DOCS=ON"
"-DLIBCXX_INCLUDE_TESTS=ON"
"-DLIBCXX_USE_COMPILER_RT=ON"
"-DLIBCXX_CXX_ABI=libcxxabi"
# Workaround having to build combined
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
"-DLIBUNWIND_USE_COMPILER_RT=ON"
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
"-DLIBCXXABI_INCLUDE_TESTS=OFF"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
"-DLIBCXXABI_USE_COMPILER_RT=ON"
"-DLIBCXXABI_INSTALL_LIBRARY=OFF"
"-DLIBCXXABI_INSTALL_HEADERS=OFF"
];
# Most of these can't find `bash` or `mkdir`, might just be hard-coded paths, or PATH is altered
extraPostPatch = ''
chmod +w -R ../libcxx/test/{libcxx,std}
rm -rf ../libcxx/test/libcxx/input.output/filesystems
rm ../libcxx/test/libcxx/selftest/remote-substitutions.sh.cpp
rm ../libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
rm ../libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp
rm ../libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp
rm ../libcxx/test/std/utilities/optional/optional.object/optional.object.assign/nullopt_t.pass.cpp
rm -rf ../libcxx/test/std/utilities/optional/optional.object/optional.object.ctor
rm -rf ../libcxx/test/std/input.output/filesystems/{class.directory_entry,class.directory_iterator,class.rec.dir.itr,fs.op.funcs}
'';
};
compiler-rt = callPackage ./llvm.nix rec {
stdenv = rStdenv;
buildDocs = false; # No documentation to build
buildMan = false; # No man pages to build
targetName = "compiler-rt";
targetDir = "runtimes";
targetRuntimes = [
"libunwind"
"libcxxabi"
"libcxx"
targetName
];
extraCMakeFlags = [
"-DCMAKE_POLICY_DEFAULT_CMP0114=NEW"
"-DCOMPILER_RT_INCLUDE_TESTS=ON"
"-DCOMPILER_RT_USE_LLVM_UNWINDER=ON"
"-DCOMPILER_RT_CXX_LIBRARY=libcxx"
"-DCOMPILER_RT_CAN_EXECUTE_TESTS=OFF" # We can't run most of these
# Workaround having to build combined
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
"-DLIBUNWIND_USE_COMPILER_RT=ON"
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
"-DLIBCXXABI_INCLUDE_TESTS=OFF"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
"-DLIBCXXABI_USE_COMPILER_RT=ON"
"-DLIBCXXABI_INSTALL_LIBRARY=OFF"
"-DLIBCXXABI_INSTALL_HEADERS=OFF"
"-DLIBCXX_INCLUDE_DOCS=OFF"
"-DLIBCXX_INCLUDE_TESTS=OFF"
"-DLIBCXX_USE_COMPILER_RT=ON"
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_INSTALL_LIBRARY=OFF"
"-DLIBCXX_INSTALL_HEADERS=OFF"
];
extraPostPatch = ''
# `No such file or directory: 'ldd'`
substituteInPlace ../compiler-rt/test/lit.common.cfg.py \
--replace "'ldd'," "'${glibc.bin}/bin/ldd',"
# We can run these
substituteInPlace ../compiler-rt/test/CMakeLists.txt \
--replace "endfunction()" "endfunction()''\nadd_subdirectory(builtins)''\nadd_subdirectory(shadowcallstack)"
'';
extraLicenses = [ lib.licenses.mit ];
};
# Stage 3
# Helpers
rocmClangStdenv = overrideCC stdenv clang;
clang = wrapCCWith rec {
# inherit libc libcxx bintools;
inherit libcxx bintools;
# We do this to avoid HIP pathing problems, and mimic a monolithic install
cc = stdenv.mkDerivation (finalAttrs: {
inherit (clang-unwrapped) pname version;
dontUnpack = true;
installPhase = ''
runHook preInstall
clang_version=`${clang-unwrapped}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
mkdir -p $out/{bin,include/c++/v1,lib/{cmake,clang/$clang_version/{include,lib}},libexec,share}
for path in ${llvm} ${clang-unwrapped} ${lld} ${libunwind} ${libcxxabi} ${libcxx} ${compiler-rt}; do
cp -as $path/* $out
chmod +w $out/{*,include/c++/v1,lib/{clang/$clang_version/include,cmake}}
rm -f $out/lib/libc++.so
done
ln -s $out/lib/* $out/lib/clang/$clang_version/lib
ln -s $out/include/* $out/lib/clang/$clang_version/include
runHook postInstall
'';
passthru.isClang = true;
});
extraPackages = [
llvm
lld
libunwind
libcxxabi
compiler-rt
];
nixSupport.cc-cflags = [
"-resource-dir=$out/resource-root"
"-fuse-ld=lld"
"-rtlib=compiler-rt"
"-unwindlib=libunwind"
"-Wno-unused-command-line-argument"
];
extraBuildCommands = ''
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
mkdir -p $out/resource-root
ln -s ${cc}/lib/clang/$clang_version/{include,lib} $out/resource-root
# Not sure why, but hardening seems to make things break
rm $out/nix-support/add-hardening.sh
touch $out/nix-support/add-hardening.sh
# GPU compilation uses builtin `lld`
substituteInPlace $out/bin/{clang,clang++} \
--replace "-MM) dontLink=1 ;;" "-MM | --cuda-device-only) dontLink=1 ;;''\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;"
'';
};
# Base
# Unfortunately, we cannot build `clang-tools-extra` separately.
clang-tools-extra = callPackage ./llvm.nix {
stdenv = rocmClangStdenv;
buildTests = false; # `invalid operands to binary expression ('std::basic_stringstream<char>' and 'const llvm::StringRef')`
targetName = "clang-tools-extra";
targetProjects = [
"clang"
"clang-tools-extra"
];
extraBuildInputs = [ gtest ];
extraCMakeFlags = [
"-DLLVM_INCLUDE_DOCS=OFF"
"-DLLVM_INCLUDE_TESTS=OFF"
"-DCLANG_INCLUDE_DOCS=OFF"
"-DCLANG_INCLUDE_TESTS=ON"
"-DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=ON"
];
extraPostInstall = ''
# Remove LLVM and Clang
for path in `find ${llvm} ${clang-unwrapped}`; do
if [ $path != ${llvm} ] && [ $path != ${clang-unwrapped} ]; then
rm -f $out''${path#${llvm}} $out''${path#${clang-unwrapped}} || true
fi
done
# Cleanup empty directories
find $out -type d -empty -delete
'';
};
# Projects
libclc = let
spirv = (spirv-llvm-translator.override { inherit llvm; });
in callPackage ./llvm.nix rec {
stdenv = rocmClangStdenv;
buildDocs = false; # No documentation to build
buildMan = false; # No man pages to build
targetName = "libclc";
targetDir = targetName;
extraBuildInputs = [ spirv ];
# `spirv-mesa3d` isn't compiling with LLVM 15.0.0, it does with LLVM 14.0.0
# Try removing the `spirv-mesa3d` and `clspv` patches next update
# `clspv` tests fail, unresolved calls
extraPostPatch = ''
substituteInPlace CMakeLists.txt \
--replace "find_program( LLVM_CLANG clang PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \
"find_program( LLVM_CLANG clang PATHS \"${clang}/bin\" NO_DEFAULT_PATH )" \
--replace "find_program( LLVM_SPIRV llvm-spirv PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \
"find_program( LLVM_SPIRV llvm-spirv PATHS \"${spirv}/bin\" NO_DEFAULT_PATH )" \
--replace " spirv-mesa3d-" "" \
--replace " spirv64-mesa3d-" "" \
--replace "NOT \''${t} MATCHES" \
"NOT \''${ARCH} STREQUAL \"clspv\" AND NOT \''${ARCH} STREQUAL \"clspv64\" AND NOT \''${t} MATCHES"
'';
checkTargets = [ ];
};
lldb = callPackage ./llvm.nix rec {
stdenv = rocmClangStdenv;
buildTests = false; # ld.lld: error: unable to find library -lllvm_gtest_main
targetName = "lldb";
targetDir = targetName;
extraNativeBuildInputs = [ python3Packages.sphinx-automodapi ];
extraBuildInputs = [
xz
swig
lua5_3
gtest
];
extraCMakeFlags = [
"-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped"
"-DLLDB_INCLUDE_TESTS=ON"
"-DLLDB_INCLUDE_UNITTESTS=ON"
];
};
mlir = callPackage ./llvm.nix rec {
stdenv = rocmClangStdenv;
buildDocs = false; # No decent way to hack this to work
buildMan = false; # No man pages to build
targetName = "mlir";
targetDir = targetName;
extraNativeBuildInputs = [ hip ];
extraBuildInputs = [
rocm-comgr
vulkan-headers
vulkan-loader
glslang
shaderc
];
extraCMakeFlags = [
"-DCMAKE_POLICY_DEFAULT_CMP0116=NEW"
"-DMLIR_INCLUDE_DOCS=ON"
"-DMLIR_INCLUDE_TESTS=ON"
"-DMLIR_ENABLE_ROCM_RUNNER=ON"
"-DMLIR_ENABLE_SPIRV_CPU_RUNNER=ON"
"-DMLIR_ENABLE_VULKAN_RUNNER=ON"
"-DROCM_TEST_CHIPSET=gfx000" # CPU runner
];
extraPostPatch = ''
chmod +w ../llvm
mkdir -p ../llvm/build/bin
ln -s ${lit}/bin/lit ../llvm/build/bin/llvm-lit
substituteInPlace test/CMakeLists.txt \
--replace "FileCheck count not" "" \
--replace "list(APPEND MLIR_TEST_DEPENDS mlir_rocm_runtime)" ""
substituteInPlace lib/ExecutionEngine/CMakeLists.txt \
--replace "return()" ""
# Remove problematic tests
rm test/CAPI/execution_engine.c
rm test/Target/LLVMIR/llvmir-intrinsics.mlir
rm test/Target/LLVMIR/llvmir.mlir
rm test/Target/LLVMIR/openmp-llvm.mlir
rm test/mlir-cpu-runner/*.mlir
rm test/mlir-vulkan-runner/*.mlir
'';
extraPostInstall = ''
mkdir -p $out/bin
mv bin/mlir-tblgen $out/bin
'';
checkTargets = [ "check-${targetName}" ];
};
polly = callPackage ./llvm.nix rec {
stdenv = rocmClangStdenv;
targetName = "polly";
targetDir = targetName;
checkTargets = [ "check-${targetName}" ];
};
flang = callPackage ./llvm.nix rec {
stdenv = rocmClangStdenv;
buildTests = false; # `Executable "flang1" doesn't exist!`
targetName = "flang";
targetDir = targetName;
extraNativeBuildInputs = [ python3Packages.sphinx-markdown-tables ];
extraBuildInputs = [ mlir ];
extraCMakeFlags = [
"-DCMAKE_POLICY_DEFAULT_CMP0116=NEW"
"-DCLANG_DIR=${clang-unwrapped}/lib/cmake/clang"
"-DFLANG_INCLUDE_TESTS=OFF"
"-DMLIR_TABLEGEN_EXE=${mlir}/bin/mlir-tblgen"
];
extraPostPatch = ''
substituteInPlace test/CMakeLists.txt \
--replace "FileCheck" "" \
--replace "count" "" \
--replace "not" ""
substituteInPlace docs/CMakeLists.txt \
--replace "CLANG_TABLEGEN_EXE clang-tblgen" "CLANG_TABLEGEN_EXE ${clang-unwrapped}/bin/clang-tblgen"
'';
};
openmp = callPackage ./llvm.nix rec {
stdenv = rocmClangStdenv;
buildTests = false; # Too many failures, most pass
targetName = "openmp";
targetDir = targetName;
extraPatches = [ ./0000-fix-openmp.patch ];
extraNativeBuildInputs = [ perl ];
extraBuildInputs = [
rocm-device-libs
rocm-runtime
elfutils
];
extraCMakeFlags = [
"-DCMAKE_MODULE_PATH=/build/source/llvm/cmake/modules" # For docs
"-DCLANG_TOOL=${clang}/bin/clang"
"-DCLANG_OFFLOAD_BUNDLER_TOOL=${clang-unwrapped}/bin/clang-offload-bundler"
"-DOPENMP_LLVM_TOOLS_DIR=${llvm}/bin"
"-DOPENMP_LLVM_LIT_EXECUTABLE=${lit}/bin/.lit-wrapped"
"-DDEVICELIBS_ROOT=${rocm-device-libs.src}"
];
extraPostPatch = ''
# We can't build this target at the moment
substituteInPlace libomptarget/DeviceRTL/CMakeLists.txt \
--replace "gfx1010" ""
'';
checkTargets = [ "check-${targetName}" ];
extraLicenses = [ lib.licenses.mit ];
};
# Runtimes
pstl = callPackage ./llvm.nix rec {
stdenv = rocmClangStdenv;
buildDocs = false; # No documentation to build
buildMan = false; # No man pages to build
buildTests = false; # Too many errors
targetName = "pstl";
targetDir = "runtimes";
targetRuntimes = [ targetName ];
checkTargets = [ "check-${targetName}" ];
};
}

View File

@ -2,15 +2,13 @@
, fetchFromGitHub , fetchFromGitHub
, llvmPackages_15 , llvmPackages_15
, lld_15 , lld_15
, rocm-device-libs
, python3 , python3
, rocm-runtime
, cmake , cmake
, boost , boost
, libxml2 , libxml2
, libffi , libffi
, makeWrapper , makeWrapper
, hip , rocmPackages
, rocmSupport ? false , rocmSupport ? false
}: }:
let let
@ -40,8 +38,8 @@ stdenv.mkDerivation rec {
llvmPackages_15.libclang.dev llvmPackages_15.libclang.dev
llvmPackages_15.llvm llvmPackages_15.llvm
] ++ lib.optionals rocmSupport [ ] ++ lib.optionals rocmSupport [
hip rocmPackages.clr
rocm-runtime rocmPackages.rocm-runtime
]; ];
# opensycl makes use of clangs internal headers. Its cmake does not successfully discover them automatically on nixos, so we supply the path manually # opensycl makes use of clangs internal headers. Its cmake does not successfully discover them automatically on nixos, so we supply the path manually
@ -55,7 +53,7 @@ stdenv.mkDerivation rec {
--add-flags "-L${llvmPackages_15.openmp}/lib" \ --add-flags "-L${llvmPackages_15.openmp}/lib" \
--add-flags "-I${llvmPackages_15.openmp.dev}/include" \ --add-flags "-I${llvmPackages_15.openmp.dev}/include" \
'' + lib.optionalString rocmSupport '' '' + lib.optionalString rocmSupport ''
--add-flags "--rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode" --add-flags "--rocm-device-lib-path=${rocmPackages.rocm-device-libs}/amdgcn/bitcode"
''; '';
meta = with lib; { meta = with lib; {

View File

@ -13,13 +13,17 @@ let
llvmMajor = lib.versions.major llvm.version; llvmMajor = lib.versions.major llvm.version;
isROCm = lib.hasPrefix "rocm" llvm.pname; isROCm = lib.hasPrefix "rocm" llvm.pname;
# ROCm will always be at the latest version # ROCm, if actively updated will always be at the latest version
branch = branch =
if llvmMajor == "16" then rec { if llvmMajor == "17" || isROCm then rec {
version = "17.0.0";
rev = "v${version}";
hash = "sha256-Rzm5Py9IPFtS9G7kME+uSwZ/0gPGW6MlL35ZWk4LfHM=";
} else if llvmMajor == "16" then rec {
version = "16.0.0"; version = "16.0.0";
rev = "v${version}"; rev = "v${version}";
hash = "sha256-EUabcYqSjXshbPmcs1DRLvCSL1nd9rEdpqELBrItCW8="; hash = "sha256-EUabcYqSjXshbPmcs1DRLvCSL1nd9rEdpqELBrItCW8=";
} else if llvmMajor == "15" || isROCm then rec { } else if llvmMajor == "15" then rec {
version = "15.0.0"; version = "15.0.0";
rev = "v${version}"; rev = "v${version}";
hash = "sha256-OsDohXRxovtEXaWiRGp8gJ0dXmoALyO+ZimeSO8aPVI="; hash = "sha256-OsDohXRxovtEXaWiRGp8gJ0dXmoALyO+ZimeSO8aPVI=";

View File

@ -0,0 +1,53 @@
{ lib
, stdenv
, fetchFromGitHub
, gitUpdater
, cmake
, functionalplus
, eigen
, nlohmann_json
, doctest
, python3Packages
, buildTests ? false # Needs tensorflow
}:
stdenv.mkDerivation (finalAttrs: {
pname = "frugally-deep";
version = "0.15.24-p0";
src = fetchFromGitHub {
owner = "Dobiasd";
repo = "frugally-deep";
rev = "v${finalAttrs.version}";
hash = "sha256-yg2SMsYOOSOgsdwIH1bU3iPM45z6c7WeIrgOddt3um4=";
};
nativeBuildInputs = [
cmake
] ++ lib.optionals buildTests [
python3Packages.python
python3Packages.numpy
];
buildInputs = lib.optionals buildTests [
doctest
python3Packages.tensorflow
];
propagatedBuildInputs = [
functionalplus
eigen
nlohmann_json
];
cmakeFlags = lib.optionals buildTests [ "-DFDEEP_BUILD_UNITTEST=ON" ];
passthru.updateScript = gitUpdater;
meta = with lib; {
description = "Header-only library for using Keras (TensorFlow) models in C++";
homepage = "https://github.com/Dobiasd/frugally-deep";
license = with licenses; [ mit ];
maintainers = with maintainers; [ Madouura ];
platforms = platforms.linux;
};
})

View File

@ -1,190 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, rocmUpdateScript
, pkg-config
, cmake
, rocm-cmake
, rocblas
, rocmlir
, hip
, clang-tools-extra
, clang-ocl
, llvm
, miopengemm
, composable_kernel
, half
, boost
, sqlite
, bzip2
, nlohmann_json
, texlive
, doxygen
, sphinx
, zlib
, gtest
, rocm-comgr
, python3Packages
, buildDocs ? true
, buildTests ? false
, fetchKDBs ? true
, useOpenCL ? false
}:
let
latex = lib.optionalAttrs buildDocs texlive.combine {
inherit (texlive) scheme-small
latexmk
tex-gyre
fncychap
wrapfig
capt-of
framed
needspace
tabulary
varwidth
titlesec;
};
kdbs = lib.optionalAttrs fetchKDBs import ./deps.nix {
inherit fetchurl;
mirror = "https://repo.radeon.com/rocm/miopen-kernel/rel-5.0";
};
in stdenv.mkDerivation (finalAttrs: {
pname = "miopen";
version = "5.4.2";
outputs = [
"out"
] ++ lib.optionals buildDocs [
"doc"
] ++ lib.optionals buildTests [
"test"
];
src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "MIOpen";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-GfXPCXiVJVve3d8sQCQcFLb/vEnKkVEn7xYUhHkEEVI=";
};
nativeBuildInputs = [
pkg-config
cmake
rocm-cmake
hip
clang-tools-extra
];
buildInputs = [
llvm
rocblas
rocmlir
clang-ocl
miopengemm
composable_kernel
half
boost
sqlite
bzip2
nlohmann_json
] ++ lib.optionals buildDocs [
latex
doxygen
sphinx
python3Packages.sphinx-rtd-theme
python3Packages.breathe
python3Packages.myst-parser
] ++ lib.optionals buildTests [
zlib
];
cmakeFlags = [
"-DMIOPEN_USE_MIOPENGEMM=ON"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals (!useOpenCL) [
"-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc"
"-DMIOPEN_BACKEND=HIP"
] ++ lib.optionals useOpenCL [
"-DMIOPEN_BACKEND=OpenCL"
] ++ lib.optionals buildTests [
"-DBUILD_TESTS=ON"
"-DMIOPEN_TEST_ALL=ON"
"-DMIOPEN_TEST_GFX900=ON"
"-DMIOPEN_TEST_GFX906=ON"
"-DMIOPEN_TEST_GFX908=ON"
"-DMIOPEN_TEST_GFX90A=ON"
"-DMIOPEN_TEST_GFX103X=ON"
"-DGOOGLETEST_DIR=${gtest.src}" # Custom linker names
];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "enable_testing()" "" \
--replace "MIOPEN_HIP_COMPILER MATCHES \".*clang\\\\+\\\\+$\"" "true" \
--replace "set(MIOPEN_TIDY_ERRORS ALL)" "" # error: missing required key 'key'
'' + lib.optionalString buildTests ''
substituteInPlace test/gtest/CMakeLists.txt \
--replace "enable_testing()" ""
'' + lib.optionalString (!buildTests) ''
substituteInPlace CMakeLists.txt \
--replace "add_subdirectory(test)" ""
'' + lib.optionalString fetchKDBs ''
ln -sf ${kdbs.gfx1030_36} src/kernels/gfx1030_36.kdb
ln -sf ${kdbs.gfx900_56} src/kernels/gfx900_56.kdb
ln -sf ${kdbs.gfx900_64} src/kernels/gfx900_64.kdb
ln -sf ${kdbs.gfx906_60} src/kernels/gfx906_60.kdb
ln -sf ${kdbs.gfx906_64} src/kernels/gfx906_64.kdb
ln -sf ${kdbs.gfx90878} src/kernels/gfx90878.kdb
ln -sf ${kdbs.gfx90a68} src/kernels/gfx90a68.kdb
ln -sf ${kdbs.gfx90a6e} src/kernels/gfx90a6e.kdb
'';
# Unfortunately, it seems like we have to call make on these manually
postBuild = lib.optionalString buildDocs ''
export HOME=$(mktemp -d)
make -j$NIX_BUILD_CORES doc
'' + lib.optionalString buildTests ''
make -j$NIX_BUILD_CORES check
'';
postInstall = ''
rm $out/bin/install_precompiled_kernels.sh
'' + lib.optionalString buildDocs ''
mv ../doc/html $out/share/doc/miopen-${if useOpenCL then "opencl" else "hip"}
mv ../doc/pdf/miopen.pdf $out/share/doc/miopen-${if useOpenCL then "opencl" else "hip"}
'' + lib.optionalString buildTests ''
mkdir -p $test/bin
mv bin/test_* $test/bin
patchelf --set-rpath $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++
[ hip rocm-comgr ])} $test/bin/*
'' + lib.optionalString fetchKDBs ''
# Apparently gfx1030_40 wasn't generated so the developers suggest just renaming gfx1030_36 to it
# Should be fixed in the next miopen kernel generation batch
ln -s ${kdbs.gfx1030_36} $out/share/miopen/db/gfx1030_40.kdb
'';
requiredSystemFeatures = [ "big-parallel" ];
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
meta = with lib; {
description = "Machine intelligence library for ROCm";
homepage = "https://github.com/ROCmSoftwarePlatform/MIOpen";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version;
};
})

View File

@ -1,45 +0,0 @@
{ fetchurl
, mirror
}:
{
gfx1030_36 = fetchurl {
sha256 = "sha256-zEXDLkRWAHS15LDA5IRyqG5rO7HHPBiVgPlQ8JjSqNc=";
url = "${mirror}/gfx1030_36.kdb";
};
gfx900_56 = fetchurl {
sha256 = "sha256-ZTqUPhVKcQzjO6bxykvZMJk1VZh31dRVs+XqcxEtmeI=";
url = "${mirror}/gfx900_56.kdb";
};
gfx900_64 = fetchurl {
sha256 = "sha256-ZTqUPhVKcQzjO6bxykvZMJk1VZh31dRVs+XqcxEtmeI=";
url = "${mirror}/gfx900_64.kdb";
};
gfx906_60 = fetchurl {
sha256 = "sha256-U6pDo8ICfs6fVIEqRziWeE5/4Vzvu41JkcRVn3ou1e4=";
url = "${mirror}/gfx906_60.kdb";
};
gfx906_64 = fetchurl {
sha256 = "sha256-U6pDo8ICfs6fVIEqRziWeE5/4Vzvu41JkcRVn3ou1e4=";
url = "${mirror}/gfx906_64.kdb";
};
gfx90878 = fetchurl {
sha256 = "sha256-r7DRhNH+jHUXAu64b9vWsZzGD4w5oSHnxH0l2RN0qlQ=";
url = "${mirror}/gfx90878.kdb";
};
gfx90a68 = fetchurl {
sha256 = "sha256-NT//zIPTbzsPJyaVycxwU6BcMTzGc/d+Z4Ab9FImDko=";
url = "${mirror}/gfx90a68.kdb";
};
gfx90a6e = fetchurl {
sha256 = "sha256-ENZHbf+/MGYgSTpALKh2meuZPNhH5bG+WrW/jzvGpBs=";
url = "${mirror}/gfx90a6e.kdb";
};
}

View File

@ -1,139 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, cmake
, rocm-cmake
, hip
, python3
, tensile
, msgpack
, libxml2
, gtest
, gfortran
, openmp
, amd-blis
, python3Packages
, buildTensile ? true
, buildTests ? false
, buildBenchmarks ? false
, tensileLogic ? "asm_full"
, tensileCOVersion ? "V3"
, tensileSepArch ? true
, tensileLazyLib ? true
, tensileLibFormat ? "msgpack"
, gpuTargets ? [ "all" ]
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rocblas";
version = "5.4.3";
outputs = [
"out"
] ++ lib.optionals buildTests [
"test"
] ++ lib.optionals buildBenchmarks [
"benchmark"
];
src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "rocBLAS";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-XhYpzBXviMnUdbF6lZi9g0LARKpzWLtDxJxLI3MuHiM=";
};
nativeBuildInputs = [
cmake
rocm-cmake
hip
];
buildInputs = [
python3
] ++ lib.optionals buildTensile [
msgpack
libxml2
python3Packages.msgpack
] ++ lib.optionals buildTests [
gtest
] ++ lib.optionals (buildTests || buildBenchmarks) [
gfortran
openmp
amd-blis
] ++ lib.optionals (buildTensile || buildTests || buildBenchmarks) [
python3Packages.pyyaml
];
cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc"
"-Dpython=python3"
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
"-DBUILD_WITH_TENSILE=${if buildTensile then "ON" else "OFF"}"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals buildTensile [
"-DVIRTUALENV_HOME_DIR=/build/source/tensile"
"-DTensile_TEST_LOCAL_PATH=/build/source/tensile"
"-DTensile_ROOT=/build/source/tensile/lib/python${python3.pythonVersion}/site-packages/Tensile"
"-DTensile_LOGIC=${tensileLogic}"
"-DTensile_CODE_OBJECT_VERSION=${tensileCOVersion}"
"-DTensile_SEPARATE_ARCHITECTURES=${if tensileSepArch then "ON" else "OFF"}"
"-DTensile_LAZY_LIBRARY_LOADING=${if tensileLazyLib then "ON" else "OFF"}"
"-DTensile_LIBRARY_FORMAT=${tensileLibFormat}"
] ++ lib.optionals buildTests [
"-DBUILD_CLIENTS_TESTS=ON"
] ++ lib.optionals buildBenchmarks [
"-DBUILD_CLIENTS_BENCHMARKS=ON"
] ++ lib.optionals (buildTests || buildBenchmarks) [
"-DCMAKE_CXX_FLAGS=-I${amd-blis}/include/blis"
];
# Tensile REALLY wants to write to the nix directory if we include it normally
postPatch = lib.optionalString buildTensile ''
cp -a ${tensile} tensile
chmod +w -R tensile
# Rewrap Tensile
substituteInPlace tensile/bin/{.t*,.T*,*} \
--replace "${tensile}" "/build/source/tensile"
substituteInPlace CMakeLists.txt \
--replace "include(virtualenv)" "" \
--replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" ""
'';
postInstall = lib.optionalString buildTests ''
mkdir -p $test/bin
cp -a $out/bin/* $test/bin
rm $test/bin/*-bench || true
'' + lib.optionalString buildBenchmarks ''
mkdir -p $benchmark/bin
cp -a $out/bin/* $benchmark/bin
rm $benchmark/bin/*-test || true
'' + lib.optionalString (buildTests || buildBenchmarks ) ''
rm -rf $out/bin
'';
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
requiredSystemFeatures = [ "big-parallel" ];
meta = with lib; {
description = "BLAS implementation for ROCm platform";
homepage = "https://github.com/ROCmSoftwarePlatform/rocBLAS";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version;
};
})

View File

@ -1,64 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, rocmUpdateScript
, rocm-comgr
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rocclr";
version = "5.4.4";
src = fetchFromGitHub {
owner = "ROCm-Developer-Tools";
repo = "ROCclr";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-DbN7kL8oyaPeYQB19Q96L3wX66v62TMSWl0Yor7Q4kE=";
};
patches = [
# Enable support for gfx8 again
# See the upstream issue: https://github.com/RadeonOpenCompute/ROCm/issues/1659
# And the arch patch: https://github.com/rocm-arch/rocm-arch/pull/742
(fetchpatch {
url = "https://raw.githubusercontent.com/John-Gee/rocm-arch/d6812d308fee3caf2b6bb01b4d19fe03a6a0e3bd/rocm-opencl-runtime/enable-gfx800.patch";
hash = "sha256-59jFDIIsTTZcNns9RyMVWPRUggn/bSlAGrky4quu8B4=";
})
];
postPatch = ''
substituteInPlace device/comgrctx.cpp \
--replace "libamd_comgr.so" "${rocm-comgr}/lib/libamd_comgr.so"
'';
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out
cp -a * $out/
runHook postInstall
'';
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
meta = with lib; {
description = "Source package of the Radeon Open Compute common language runtime";
homepage = "https://github.com/ROCm-Developer-Tools/ROCclr";
license = licenses.mit;
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
# rocclr seems to have some AArch64 ifdefs, but does not seem
# to be supported yet by the build infrastructure. Recheck in
# the future.
platforms = [ "x86_64-linux" ];
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})

View File

@ -1,15 +0,0 @@
diff --git a/library/src/device/CMakeLists.txt b/library/src/device/CMakeLists.txt
index 73a8ec9..9bfd4b8 100644
--- a/library/src/device/CMakeLists.txt
+++ b/library/src/device/CMakeLists.txt
@@ -255,4 +255,10 @@ foreach( sub ${AMDGPU_TARGETS} )
if( NOT BUILD_SHARED_LIBS )
set_target_properties( rocfft-device-${sub} PROPERTIES PREFIX "lib" )
endif( )
+
+ rocm_install_targets(
+ TARGETS
+ rocfft-device-${sub}
+ COMPONENT device
+ )
endforeach()

View File

@ -1,124 +0,0 @@
diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt
index 3a16304..606b711 100644
--- a/library/src/CMakeLists.txt
+++ b/library/src/CMakeLists.txt
@@ -250,12 +250,12 @@ foreach( target
endforeach()
-add_executable( rocfft_aot_helper
+add_executable( rocfft_aot_helper EXCLUDE_FROM_ALL
rocfft_aot_helper.cpp
rocfft_stub.cpp
)
-add_executable( rocfft_config_search
+add_executable( rocfft_config_search EXCLUDE_FROM_ALL
rocfft_config_search.cpp
rocfft_stub.cpp
)
@@ -279,10 +279,10 @@ endif()
target_link_libraries( rocfft PRIVATE ${ROCFFT_DEVICE_LINK_LIBS} )
-target_link_libraries( rocfft PRIVATE rocfft-device-0 )
-target_link_libraries( rocfft PRIVATE rocfft-device-1 )
-target_link_libraries( rocfft PRIVATE rocfft-device-2 )
-target_link_libraries( rocfft PRIVATE rocfft-device-3 )
+foreach( sub ${AMDGPU_TARGETS} )
+ target_link_libraries( rocfft PRIVATE -lrocfft-device-${sub} )
+endforeach()
+
foreach( target rocfft rocfft_aot_helper rocfft_config_search )
# RTC uses dladdr to find the RTC helper program
if( NOT WIN32 )
@@ -347,7 +347,7 @@ add_custom_command(
DEPENDS rocfft_aot_helper rocfft_rtc_helper
COMMENT "Compile kernels into shipped cache file"
)
-add_custom_target( rocfft_kernel_cache_target ALL
+add_custom_target( rocfft_kernel_cache_target
DEPENDS rocfft_kernel_cache.db
VERBATIM
)
@@ -392,7 +392,8 @@ else()
endif()
rocm_install(FILES ${ROCFFT_KERNEL_CACHE_PATH}
DESTINATION "${ROCFFT_KERNEL_CACHE_INSTALL_DIR}"
- COMPONENT runtime
+ COMPONENT kernel_cache
+ EXCLUDE_FROM_ALL
)
# PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
diff --git a/library/src/device/CMakeLists.txt b/library/src/device/CMakeLists.txt
index 9f7b85f..73a8ec9 100644
--- a/library/src/device/CMakeLists.txt
+++ b/library/src/device/CMakeLists.txt
@@ -170,11 +170,11 @@ list( SORT rocfft_device_source )
# functions callable by rocFFT and depends on amdhip64, and another
# one usable by AOT RTC that contains no device code
list( FILTER rocfft_device_source EXCLUDE REGEX function_pool.cpp )
-add_library( rocfft-function-pool OBJECT
+add_library( rocfft-function-pool OBJECT EXCLUDE_FROM_ALL
function_pool.cpp
)
target_compile_definitions( rocfft-function-pool PRIVATE FUNCTION_POOL_STANDALONE_BODY= )
-add_library( rocfft-function-pool-standalone OBJECT
+add_library( rocfft-function-pool-standalone OBJECT EXCLUDE_FROM_ALL
function_pool.cpp
)
target_compile_definitions( rocfft-function-pool-standalone PRIVATE FUNCTION_POOL_STANDALONE_BODY={} )
@@ -193,26 +193,15 @@ foreach( pool rocfft-function-pool rocfft-function-pool-standalone )
add_dependencies(${pool} gen_headers_target)
endforeach()
-list( LENGTH rocfft_device_source rocfft_device_source_len )
-math(EXPR split_len "${rocfft_device_source_len} / 4")
-math(EXPR split_idx_2 "${rocfft_device_source_len} / 4 * 2")
-math(EXPR split_idx_3 "${rocfft_device_source_len} / 4 * 3")
-
-list( SUBLIST rocfft_device_source 0 ${split_len} rocfft_device_source_0 )
-list( SUBLIST rocfft_device_source ${split_len} ${split_len} rocfft_device_source_1 )
-list( SUBLIST rocfft_device_source ${split_idx_2} ${split_len} rocfft_device_source_2 )
-list( SUBLIST rocfft_device_source ${split_idx_3} -1 rocfft_device_source_3 )
-
-foreach( sub RANGE 3 )
- set( rocfft_device_source_var rocfft_device_source_${sub} )
+foreach( sub ${AMDGPU_TARGETS} )
if(NOT SINGLELIB)
- add_library( rocfft-device-${sub}
- ${${rocfft_device_source_var}} )
+ add_library( rocfft-device-${sub} EXCLUDE_FROM_ALL
+ ${rocfft_device_source} )
else()
# Compile the device lib as a static library, which is then linked
# into librocfft.so Useful for testing purposes.
- add_library( rocfft-device-${sub} STATIC
- ${${rocfft_device_source_var}} )
+ add_library( rocfft-device-${sub} STATIC EXCLUDE_FROM_ALL
+ ${rocfft_device_source} )
# if we're building singlelib, we don't want to export any of the
# device library symbols to the main library
@@ -241,9 +230,7 @@ foreach( sub RANGE 3 )
# Set AMD GPU architecture options
# Enable compilation of desired architectures
- foreach( target ${AMDGPU_TARGETS} )
- target_compile_options( rocfft-device-${sub} PRIVATE --offload-arch=${target} )
- endforeach( )
+ target_compile_options( rocfft-device-${sub} PRIVATE --offload-arch=${sub} )
target_include_directories( rocfft-device-${sub}
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
@@ -268,9 +255,4 @@ foreach( sub RANGE 3 )
if( NOT BUILD_SHARED_LIBS )
set_target_properties( rocfft-device-${sub} PROPERTIES PREFIX "lib" )
endif( )
-
- rocm_install_targets(
- TARGETS
- rocfft-device-${sub}
- )
endforeach()

View File

@ -1,365 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 62b857b..d21c7f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -147,8 +147,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
@@ -175,10 +175,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)
@@ -212,10 +208,14 @@ target_include_directories(amd_comgr
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE: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)
set(AMD_COMGR_VERSION_NAME amd_comgr-config-version.cmake)
-set(AMD_COMGR_PACKAGE_PREFIX ${CMAKE_INSTALL_LIBDIR}/cmake/amd_comgr)
+set(AMD_COMGR_PACKAGE_PREFIX cmake/amd_comgr)
# Generate the build-tree package.
set(AMD_COMGR_PREFIX_CODE)
@@ -226,13 +226,13 @@ if (NOT COMGR_BUILD_SHARED_LIBS)
endif()
set(AMD_COMGR_TARGETS_PATH
- "${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}")
+ "${CMAKE_CURRENT_BINARY_DIR}/lib/${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}")
+ "${CMAKE_CURRENT_BINARY_DIR}/lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_VERSION_NAME}")
export(TARGETS amd_comgr
- FILE "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}")
+ FILE "lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_TARGETS_NAME}")
configure_file("cmake/${AMD_COMGR_CONFIG_NAME}.in"
- "${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_CONFIG_NAME}"
+ "lib/${AMD_COMGR_PACKAGE_PREFIX}/${AMD_COMGR_CONFIG_NAME}"
@ONLY)
write_basic_package_version_file("${AMD_COMGR_VERSION_PATH}"
VERSION "${amd_comgr_VERSION}"
@@ -266,7 +266,7 @@ install(FILES
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}")
+string(REGEX REPLACE "/" ";" count "${CMAKE_INSTALL_LIBDIR}/${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)")
@@ -278,20 +278,20 @@ if (NOT COMGR_BUILD_SHARED_LIBS)
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}")
+set(AMD_COMGR_TARGETS_PATH "\${AMD_COMGR_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${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"
+ "${AMD_COMGR_CONFIG_NAME}.install"
@ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${AMD_COMGR_CONFIG_NAME}.install"
- DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}"
RENAME "${AMD_COMGR_CONFIG_NAME}")
install(EXPORT amd_comgr_export
- DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}"
FILE "${AMD_COMGR_TARGETS_NAME}")
install(FILES
"${AMD_COMGR_VERSION_PATH}"
- DESTINATION "${AMD_COMGR_PACKAGE_PREFIX}")
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/${AMD_COMGR_PACKAGE_PREFIX}")
if(TARGET clangFrontendTool)
set(CLANG_LIBS
diff --git a/cmake/DeviceLibs.cmake b/cmake/DeviceLibs.cmake
index 27e9546..dfe1b57 100644
--- a/cmake/DeviceLibs.cmake
+++ b/cmake/DeviceLibs.cmake
@@ -1,8 +1,7 @@
set(INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
set(GEN_LIBRARY_INC_FILE ${INC_DIR}/libraries.inc)
-
-file(WRITE ${GEN_LIBRARY_INC_FILE} "// Automatically generated file; DO NOT EDIT.\n")
+set(GEN_LIBRARY_DEFS_INC_FILE ${INC_DIR}/libraries_defs.inc)
# cmake does not provide a way to query targets produced by a project,
# so we have to make one up. Ordinarily, individual library target
@@ -23,6 +22,7 @@ if(NOT AMD_DEVICE_LIBS_TARGETS)
message(FATAL_ERROR "Could not find list of device libraries")
endif()
+set(TARGETS_INCLUDES "")
foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS})
set(header ${AMDGCN_LIB_TARGET}.inc)
@@ -54,75 +54,52 @@ foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS})
add_custom_target(${AMDGCN_LIB_TARGET}_header DEPENDS ${INC_DIR}/${header})
add_dependencies(amd_comgr ${AMDGCN_LIB_TARGET}_header)
- file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"${header}\"\n")
+ list(APPEND TARGETS_INCLUDES "#include \"${header}\"")
+endforeach()
+
+list(JOIN TARGETS_INCLUDES "\n" TARGETS_INCLUDES)
+file(GENERATE OUTPUT ${GEN_LIBRARY_INC_FILE} CONTENT "${TARGETS_INCLUDES}")
+
+foreach(OPENCL_VERSION 1.2 2.0)
+ string(REPLACE . _ OPENCL_UNDERSCORE_VERSION ${OPENCL_VERSION})
+ add_custom_command(OUTPUT ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc
+ COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl${OPENCL_VERSION}-c.pch
+ ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc
+ opencl${OPENCL_UNDERSCORE_VERSION}_c
+ DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl${OPENCL_VERSION}-c.pch
+ COMMENT "Generating opencl${OPENCL_VERSION}-c.inc"
+ )
+ set_property(DIRECTORY APPEND PROPERTY
+ ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc)
+ add_custom_target(opencl${OPENCL_VERSION}-c.inc_target DEPENDS ${INC_DIR}/opencl${OPENCL_VERSION}-c.inc)
+ add_dependencies(amd_comgr opencl${OPENCL_VERSION}-c.inc_target)
endforeach()
-add_custom_command(OUTPUT ${INC_DIR}/opencl1.2-c.inc
- COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.pch
- ${INC_DIR}/opencl1.2-c.inc
- opencl1_2_c
- DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl1.2-c.pch
- COMMENT "Generating opencl1.2-c.inc"
-)
-set_property(DIRECTORY APPEND PROPERTY
- ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl1.2-c.inc)
-add_custom_target(opencl1.2-c.inc_target DEPENDS ${INC_DIR}/opencl1.2-c.inc)
-add_dependencies(amd_comgr opencl1.2-c.inc_target)
-file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"opencl1.2-c.inc\"\n")
-
-add_custom_command(OUTPUT ${INC_DIR}/opencl2.0-c.inc
- COMMAND bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.pch
- ${INC_DIR}/opencl2.0-c.inc
- opencl2_0_c
- DEPENDS bc2h ${CMAKE_CURRENT_BINARY_DIR}/opencl2.0-c.pch
- COMMENT "Generating opencl2.0-c.inc"
-)
-set_property(DIRECTORY APPEND PROPERTY
- ADDITIONAL_MAKE_CLEAN_FILES ${INC_DIR}/opencl2.0-c.inc)
-add_custom_target(opencl2.0-c.inc_target DEPENDS ${INC_DIR}/opencl2.0-c.inc)
-add_dependencies(amd_comgr opencl2.0-c.inc_target)
-file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"opencl2.0-c.inc\"\n")
-
-# Generate function to select libraries for a given GFXIP number.
-file(APPEND ${GEN_LIBRARY_INC_FILE} "#include \"llvm/ADT/StringRef.h\"\n")
-file(APPEND ${GEN_LIBRARY_INC_FILE}
- "static std::tuple<const char*, const void*, size_t> get_oclc_isa_version(llvm::StringRef gfxip) {")
+set(TARGETS_DEFS "")
+list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_TARGET\n#define AMD_DEVICE_LIBS_TARGET(t)\n#endif")
+list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_GFXIP\n#define AMD_DEVICE_LIBS_GFXIP(t, g)\n#endif")
+list(APPEND TARGETS_DEFS "#ifndef AMD_DEVICE_LIBS_FUNCTION\n#define AMD_DEVICE_LIBS_FUNCTION(t, f)\n#endif")
+list(APPEND TARGETS_DEFS "")
foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS})
+ list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_TARGET(${AMDGCN_LIB_TARGET})")
+ # Generate function to select libraries for a given GFXIP number.
if (${AMDGCN_LIB_TARGET} MATCHES "^oclc_isa_version_.+$")
string(REGEX REPLACE "^oclc_isa_version_(.+)$" "\\1" gfxip ${AMDGCN_LIB_TARGET})
- file(APPEND ${GEN_LIBRARY_INC_FILE}
- "if (gfxip == \"${gfxip}\") return std::make_tuple(\"${AMDGCN_LIB_TARGET}.bc\", ${AMDGCN_LIB_TARGET}_lib, ${AMDGCN_LIB_TARGET}_lib_size);")
+ list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_GFXIP(${AMDGCN_LIB_TARGET}, \"${gfxip}\")")
endif()
-endforeach()
-file(APPEND ${GEN_LIBRARY_INC_FILE}
- "return std::make_tuple(nullptr, nullptr, 0); }")
-
-# Generate function to select libraries for given feature.
-foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS})
+ # Generate function to select libraries for given feature.
if (${AMDGCN_LIB_TARGET} MATCHES "^oclc_.*_on$")
string(REGEX REPLACE "^oclc_(.*)_on" "\\1" function ${AMDGCN_LIB_TARGET})
- file(APPEND ${GEN_LIBRARY_INC_FILE}
- "static std::tuple<const char*, const void*, size_t> get_oclc_${function}(bool on) { \
- return std::make_tuple( \
- on ? \"oclc_${function}_on_lib.bc\" : \"oclc_${function}_off_lib.bc\", \
- on ? oclc_${function}_on_lib : oclc_${function}_off_lib, \
- on ? oclc_${function}_on_lib_size : oclc_${function}_off_lib_size \
- ); }")
+ list(APPEND TARGETS_DEFS "AMD_DEVICE_LIBS_FUNCTION(${AMDGCN_LIB_TARGET}, ${function})")
endif()
endforeach()
-# Generate function yield all libraries.
-file(APPEND ${GEN_LIBRARY_INC_FILE} "\n#include \"llvm/ADT/ArrayRef.h\"\n")
-file(APPEND ${GEN_LIBRARY_INC_FILE}
- "llvm::ArrayRef<std::tuple<llvm::StringRef, llvm::StringRef>> COMGR::getDeviceLibraries() { \
- static std::tuple<llvm::StringRef, llvm::StringRef> DeviceLibs[] = {")
-foreach(AMDGCN_LIB_TARGET ${AMD_DEVICE_LIBS_TARGETS})
- file(APPEND ${GEN_LIBRARY_INC_FILE}
- "{\"${AMDGCN_LIB_TARGET}.bc\", llvm::StringRef(reinterpret_cast<const char *>(${AMDGCN_LIB_TARGET}_lib), ${AMDGCN_LIB_TARGET}_lib_size)},")
-endforeach()
-file(APPEND ${GEN_LIBRARY_INC_FILE}
- "}; \
- return DeviceLibs; \
- }")
+list(APPEND TARGETS_DEFS "")
+list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_TARGET")
+list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_GFXIP")
+list(APPEND TARGETS_DEFS "#undef AMD_DEVICE_LIBS_FUNCTION")
+
+list(JOIN TARGETS_DEFS "\n" TARGETS_DEFS)
+file(GENERATE OUTPUT ${GEN_LIBRARY_DEFS_INC_FILE} CONTENT "${TARGETS_DEFS}")
include_directories(${INC_DIR})
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")
diff --git a/src/comgr-device-libs.cpp b/src/comgr-device-libs.cpp
index 4d2b914..80786d1 100644
--- a/src/comgr-device-libs.cpp
+++ b/src/comgr-device-libs.cpp
@@ -35,7 +35,7 @@
#include "comgr-device-libs.h"
#include "comgr.h"
-#include "libraries.inc"
+#include "comgr-libraries.h"
#include "llvm/ADT/StringSwitch.h"
#include <cstdint>
diff --git a/src/comgr-libraries.h b/src/comgr-libraries.h
new file mode 100644
index 0000000..3caa0a0
--- /dev/null
+++ b/src/comgr-libraries.h
@@ -0,0 +1,34 @@
+#include "libraries.inc"
+#include "opencl1.2-c.inc"
+#include "opencl2.0-c.inc"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/ArrayRef.h"
+
+static std::tuple<const char*, const void*, size_t> get_oclc_isa_version(llvm::StringRef gfxip) {
+#define AMD_DEVICE_LIBS_GFXIP(target, target_gfxip) \
+ if (gfxip == target_gfxip) return std::make_tuple(#target ".bc", target##_lib, target##_lib_size);
+#include "libraries_defs.inc"
+
+ return std::make_tuple(nullptr, nullptr, 0);
+}
+
+#define AMD_DEVICE_LIBS_FUNCTION(target, function) \
+ static std::tuple<const char*, const void*, size_t> get_oclc_##function(bool on) { \
+ return std::make_tuple( \
+ on ? "oclc_" #function "_on_lib.bc" : "oclc_" #function "_off_lib.bc", \
+ on ? oclc_##function##_on_lib : oclc_##function##_off_lib, \
+ on ? oclc_##function##_on_lib_size : oclc_##function##_off_lib_size \
+ ); \
+ }
+#include "libraries_defs.inc"
+
+llvm::ArrayRef<std::tuple<llvm::StringRef, llvm::StringRef>> COMGR::getDeviceLibraries() {
+ static std::tuple<llvm::StringRef, llvm::StringRef> DeviceLibs[] = {
+#define AMD_DEVICE_LIBS_TARGET(target) \
+ {#target ".bc", llvm::StringRef(reinterpret_cast<const char *>(target##_lib), target##_lib_size)},
+#include "libraries_defs.inc"
+ };
+ return DeviceLibs;
+}
+
+

View File

@ -1,58 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, runCommand
, substituteAll
, cmake
}:
let
rocm_version = with lib; concatStrings (intersperse "0" (splitString "." stdenv.cc.version));
in stdenv.mkDerivation (finalAttrs: {
pname = "rocm-core";
version = stdenv.cc.version;
# Based on https://github.com/rocm-arch/rocm-arch/tree/ad0b15690d403e5822db062ffff4db3912de6669/rocm-core
src = let
rocm_major = lib.versions.major finalAttrs.version;
rocm_minor = lib.versions.minor finalAttrs.version;
rocm_patch = lib.versions.patch finalAttrs.version;
cmake_lists = substituteAll {
inherit rocm_version;
src = ./src/CMakeLists.txt;
};
version_c = substituteAll {
inherit rocm_major rocm_minor rocm_patch;
src = ./src/rocm_version.c;
};
version_h = substituteAll {
inherit rocm_major rocm_minor rocm_patch;
src = ./src/rocm_version.h;
};
in runCommand "rocm-core-${finalAttrs.version}-source" { preferLocalBuild = true; } ''
mkdir -p $out/rocm-core
ln -s ${cmake_lists} $out/CMakeLists.txt
ln -s ${version_c} $out/rocm_version.c
ln -s ${version_h} $out/rocm-core/rocm_version.h
'';
nativeBuildInputs = [ cmake ];
postInstall = ''
mkdir -p $out/include
cp -a ../rocm-core $out/include
ln -s $out/include/rocm-core/rocm_version.h $out/include
ln -s $out/lib/librocm-core.so.1.0.${rocm_version} $out/lib/librocm-core.so.1
'';
meta = with lib; {
description = "ROCm core";
homepage = "https://docs.amd.com";
license = with licenses; [ ncsa ]; # See src/rocm_version.h
maintainers = teams.rocm.members;
platforms = platforms.linux;
};
})

View File

@ -1,5 +0,0 @@
cmake_minimum_required(VERSION 3.23)
project(rocm-core)
add_library(rocm-core SHARED rocm_version.c)
set_target_properties(rocm-core PROPERTIES VERSION "1.0.@rocm_version@")
install(TARGETS rocm-core LIBRARY DESTINATION lib)

View File

@ -1,10 +0,0 @@
#include "rocm-core/rocm_version.h"
VerErrors getROCmVersion(unsigned int *Major, unsigned int *Minor,
unsigned int *Patch) {
*Major = @rocm_major@;
*Minor = @rocm_minor@;
*Patch = @rocm_patch@;
return 0;
}

View File

@ -1,82 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
//
// The University of Illinois/NCSA
// Open Source License (NCSA)
//
// Copyright (c) 2014-2021, Advanced Micro Devices, Inc. All rights reserved.
//
// Developed by:
//
// AMD Research and AMD HSA Software Development
//
// Advanced Micro Devices, Inc.
//
// www.amd.com
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal with the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimers.
// - Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimers in
// the documentation and/or other materials provided with the distribution.
// - Neither the names of Advanced Micro Devices, Inc,
// nor the names of its contributors may be used to endorse or promote
// products derived from this Software without specific prior written
// permission.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS WITH THE SOFTWARE.
//
////////////////////////////////////////////////////////////////////////////////
#ifndef _ROCM_VERSION_H_
#define _ROCM_VERSION_H_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define ROCM_VERSION_MAJOR @rocm_major@
#define ROCM_VERSION_MINOR @rocm_minor@
#define ROCM_VERSION_PATCH @rocm_patch@
typedef enum {
VerSuccess=0,
VerIncorrecPararmeters,
VerValuesNotDefined,
VerErrorMAX //This should always be last value in the enumerations
} VerErrors;
// API for getting the verion
// Return val : VerErros : API execution status. The parameters are valid only when the exetution status is SUCCESS==0
VerErrors getROCmVersion(unsigned int* Major, unsigned int* Minor, unsigned int* Patch) __attribute__((nonnull)) ;
// Usage :
// int mj=0,mn=0,p=0,ret=0;
// ret=getROCMVersion(&mj,&mn,&p);
// if(ret !=VerSuccess ) // error occured
//
// check for the values and
//
#ifdef __cplusplus
} // end extern "C" block
#endif
#endif //_ROCM_VERSION_H_ header guard

View File

@ -1,26 +0,0 @@
{ lib
, stdenv
, callPackage
, rocm-opencl-runtime
}:
stdenv.mkDerivation rec {
pname = "rocm-opencl-icd";
version = rocm-opencl-runtime.version;
dontUnpack = true;
installPhase = ''
mkdir -p $out/etc/OpenCL/vendors
echo "${rocm-opencl-runtime}/lib/libamdocl64.so" > $out/etc/OpenCL/vendors/amdocl64.icd
'';
passthru.impureTests = { rocm-opencl = callPackage ./test.nix { }; };
meta = with lib; {
description = "OpenCL ICD definition for AMD GPUs using the ROCm stack";
license = licenses.mit;
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
platforms = platforms.linux;
};
}

View File

@ -1,69 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, addOpenGLRunpath
, cmake
, rocm-comgr
, rocm-runtime
, rocclr
, glew
, libX11
, numactl
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rocm-opencl-runtime";
version = "5.4.4";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "ROCm-OpenCL-Runtime";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-E1+Y/fgp5b+7H1LN+O1fwVi0/XRCgvsiSxTY3u/q+8I=";
};
nativeBuildInputs = [ cmake ];
buildInputs = [
rocm-comgr
rocm-runtime
glew
libX11
numactl
];
cmakeFlags = [
"-DAMD_OPENCL_PATH=${finalAttrs.src}"
"-DROCCLR_PATH=${rocclr}"
];
dontStrip = true;
# Remove clinfo, which is already provided through the
# `clinfo` package.
postInstall = ''
rm -rf $out/bin
'';
# Fix the ICD installation path for NixOS
postPatch = ''
substituteInPlace khronos/icd/loader/linux/icd_linux.c \
--replace 'ICD_VENDOR_PATH' '"${addOpenGLRunpath.driverLink}/etc/OpenCL/vendors/"'
'';
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
meta = with lib; {
description = "OpenCL runtime for AMD GPUs, part of the ROCm stack";
homepage = "https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime";
license = with licenses; [ asl20 mit ];
maintainers = with maintainers; [ acowley lovesegfault ] ++ teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})

View File

@ -1,20 +0,0 @@
diff --git a/src/util/hsa_rsrc_factory.cpp b/src/util/hsa_rsrc_factory.cpp
index 643ff16..c08d98f 100644
--- a/src/util/hsa_rsrc_factory.cpp
+++ b/src/util/hsa_rsrc_factory.cpp
@@ -127,15 +127,6 @@ HsaRsrcFactory::HsaRsrcFactory(bool initialize_hsa) : initialize_hsa_(initialize
if (cpu_pool_ == NULL) CHECK_STATUS("CPU memory pool is not found", HSA_STATUS_ERROR);
if (kern_arg_pool_ == NULL) CHECK_STATUS("Kern-arg memory pool is not found", HSA_STATUS_ERROR);
- // Get AqlProfile API table
- aqlprofile_api_ = {0};
-#ifdef ROCP_LD_AQLPROFILE
- status = LoadAqlProfileLib(&aqlprofile_api_);
-#else
- status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_AQLPROFILE, hsa_ven_amd_aqlprofile_VERSION_MAJOR, sizeof(aqlprofile_api_), &aqlprofile_api_);
-#endif
- CHECK_STATUS("aqlprofile API table load failed", status);
-
// Get Loader API table
loader_api_ = {0};
status = hsa_api_.hsa_system_get_major_extension_table(HSA_EXTENSION_AMD_LOADER, 1, sizeof(loader_api_), &loader_api_);

View File

@ -1,66 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, cmake
, rocm-runtime
, rocm-thunk
, roctracer
, numactl
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rocprofiler";
version = "5.4.3";
src = fetchFromGitHub {
owner = "ROCm-Developer-Tools";
repo = "rocprofiler";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-CpD/+soMN8WTeSb5X7dsnZ596PMkw+4EVsVSvFtKCak=";
};
patches = [ ./0000-dont-require-hsa_amd_aqlprofile.patch ];
nativeBuildInputs = [ cmake ];
buildInputs = [
rocm-thunk
rocm-runtime
numactl
];
cmakeFlags = [
"-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
];
postPatch = ''
patchShebangs bin test
substituteInPlace cmake_modules/env.cmake \
--replace "FATAL_ERROR \"AQL_PROFILE" "WARNING \"AQL_PROFILE"
'';
postInstall = ''
patchelf --set-rpath $out/lib:${lib.makeLibraryPath finalAttrs.buildInputs} $out/lib/rocprofiler/librocprof-tool.so
'';
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
meta = with lib; {
description = "Profiling with perf-counters and derived metrics";
homepage = "https://github.com/ROCm-Developer-Tools/rocprofiler";
license = with licenses; [ mit ]; # mitx11
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})

View File

@ -18,15 +18,12 @@
, gfortran , gfortran
, cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities , cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities
, gpuTargets ? [ ] # Non-CUDA targets, that is HIP , gpuTargets ? [ ] # Non-CUDA targets, that is HIP
, hip , rocmPackages
, hipblas
, hipsparse
, lapack , lapack
, lib , lib
, libpthreadstubs , libpthreadstubs
, magmaRelease , magmaRelease
, ninja , ninja
, openmp
, rocmSupport ? false , rocmSupport ? false
, static ? false , static ? false
, stdenv , stdenv
@ -47,7 +44,7 @@ let
# NOTE: The hip.gpuTargets are prefixed with "gfx" instead of "sm" like cudaFlags.realArches. # NOTE: The hip.gpuTargets are prefixed with "gfx" instead of "sm" like cudaFlags.realArches.
# For some reason, Magma's CMakeLists.txt file does not handle the "gfx" prefix, so we must # For some reason, Magma's CMakeLists.txt file does not handle the "gfx" prefix, so we must
# remove it. # remove it.
rocmArches = lists.map (x: strings.removePrefix "gfx" x) hip.gpuTargets; rocmArches = lists.map (x: strings.removePrefix "gfx" x) rocmPackages.clr.gpuTargets;
supportedRocmArches = lists.intersectLists rocmArches supportedGpuTargets; supportedRocmArches = lists.intersectLists rocmArches supportedGpuTargets;
unsupportedRocmArches = lists.subtractLists supportedRocmArches rocmArches; unsupportedRocmArches = lists.subtractLists supportedRocmArches rocmArches;
@ -125,10 +122,10 @@ stdenv.mkDerivation {
] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [ ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [
cuda_profiler_api.dev # <cuda_profiler_api.h> cuda_profiler_api.dev # <cuda_profiler_api.h>
]) ++ lists.optionals rocmSupport [ ]) ++ lists.optionals rocmSupport [
hip rocmPackages.clr
hipblas rocmPackages.hipblas
hipsparse rocmPackages.hipsparse
openmp rocmPackages.llvm.openmp
]; ];
cmakeFlags = [ cmakeFlags = [
@ -142,8 +139,8 @@ stdenv.mkDerivation {
"-DCMAKE_CXX_COMPILER=${backendStdenv.cc}/bin/c++" "-DCMAKE_CXX_COMPILER=${backendStdenv.cc}/bin/c++"
"-DMAGMA_ENABLE_CUDA=ON" "-DMAGMA_ENABLE_CUDA=ON"
] ++ lists.optionals rocmSupport [ ] ++ lists.optionals rocmSupport [
"-DCMAKE_C_COMPILER=${hip}/bin/hipcc" "-DCMAKE_C_COMPILER=${rocmPackages.clr}/bin/hipcc"
"-DCMAKE_CXX_COMPILER=${hip}/bin/hipcc" "-DCMAKE_CXX_COMPILER=${rocmPackages.clr}/bin/hipcc"
"-DMAGMA_ENABLE_HIP=ON" "-DMAGMA_ENABLE_HIP=ON"
]; ];

View File

@ -4,7 +4,7 @@
, enableCuda ? config.cudaSupport , enableCuda ? config.cudaSupport
, cudatoolkit , cudatoolkit
, enableRocm ? false , enableRocm ? false
, rocm-core, rocm-runtime, rocm-device-libs, hip , rocmPackages
}: }:
let let
@ -13,9 +13,12 @@ let
inherit (cudatoolkit) name meta; inherit (cudatoolkit) name meta;
paths = [ cudatoolkit cudatoolkit.lib ]; paths = [ cudatoolkit cudatoolkit.lib ];
}; };
rocmList = with rocmPackages; [ rocm-core rocm-runtime rocm-device-libs clr ];
rocm = symlinkJoin { rocm = symlinkJoin {
name = "rocm"; name = "rocm";
paths = [ rocm-core rocm-runtime rocm-device-libs hip ]; paths = rocmList;
}; };
in in
@ -40,7 +43,7 @@ stdenv.mkDerivation rec {
rdma-core rdma-core
zlib zlib
] ++ lib.optional enableCuda cudatoolkit ] ++ lib.optional enableCuda cudatoolkit
++ lib.optionals enableRocm [ rocm-core rocm-runtime rocm-device-libs hip ]; ++ lib.optionals enableRocm rocmList;
configureFlags = [ configureFlags = [
"--with-rdmacm=${lib.getDev rdma-core}" "--with-rdmacm=${lib.getDev rdma-core}"

View File

@ -0,0 +1,44 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, poetry-core
, pytestCheckHook
, setuptools
, jsonschema
, pyyaml
, jinja2
, termcolor
}:
buildPythonPackage rec {
pname = "barectf";
version = "3.1.2";
format = "pyproject";
src = fetchFromGitHub {
owner = "efficios";
repo = "barectf";
rev = "v${version}";
hash = "sha256-JelFfd3WS012dveNlIljhLdyPmgE9VEOXoZE3MBA/Gw=";
};
nativeBuildInputs = [ poetry-core ];
nativeCheckInputs = [ pytestCheckHook ];
propagatedBuildInputs = [
setuptools # needs pkg_resources at runtime
jsonschema
pyyaml
jinja2
termcolor
];
pythonImportsCheck = [ "barectf" ];
meta = with lib; {
description = "Generator of ANSI C tracers which output CTF data streams ";
homepage = "https://github.com/efficios/barectf";
license = licenses.mit;
maintainers = with maintainers; [ Madouura ];
};
}

View File

@ -6,11 +6,11 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "lit"; pname = "lit";
version = "15.0.6"; version = "17.0.1";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
hash = "sha256-S06OQfDmDyutls21HxyQ016ku3FTTsDOP8Di67d9f+k="; hash = "sha256-RIZ65Xa1eQVnsSC8Pw2fAh2slCTRsIQMdazYX0YQrAQ=";
}; };
passthru = { passthru = {

View File

@ -1,12 +1,13 @@
{ lib { lib
, callPackage
, buildPythonPackage , buildPythonPackage
, python
, fetchpatch
, fetchFromGitHub , fetchFromGitHub
, addOpenGLRunpath , addOpenGLRunpath
, pytestCheckHook
, pythonRelaxDepsHook
, pkgsTargetTarget
, cmake , cmake
, cudaPackages , ninja
, llvmPackages
, pybind11 , pybind11
, gtest , gtest
, zlib , zlib
@ -15,18 +16,11 @@
, lit , lit
, filelock , filelock
, torchWithRocm , torchWithRocm
, pytest , python
, pytestCheckHook , cudaPackages
, pythonRelaxDepsHook
, pkgsTargetTarget
}: }:
let let
pname = "triton";
version = "2.0.0";
inherit (cudaPackages) cuda_cudart backendStdenv;
# A time may come we'll want to be cross-friendly # A time may come we'll want to be cross-friendly
# #
# Short explanation: we need pkgsTargetTarget, because we use string # Short explanation: we need pkgsTargetTarget, because we use string
@ -38,20 +32,12 @@ let
# pkgsTargetTarget maybe doesn't matter, because ptxas compiles programs to # pkgsTargetTarget maybe doesn't matter, because ptxas compiles programs to
# be executed on the GPU. # be executed on the GPU.
# Cf. https://nixos.org/manual/nixpkgs/unstable/#sec-cross-infra # Cf. https://nixos.org/manual/nixpkgs/unstable/#sec-cross-infra
ptxas = "${pkgsTargetTarget.cudaPackages.cuda_nvcc}/bin/ptxas"; ptxas = "${pkgsTargetTarget.cudaPackages.cuda_nvcc}/bin/ptxas"; # Make sure cudaPackages is the right version each update (See python/setup.py)
llvm = callPackage ./llvm.nix { }; # Use a custom llvm, see llvm.nix for details
llvm = (llvmPackages.llvm.override {
llvmTargetsToBuild = [ "NATIVE" "NVPTX" ];
# Upstream CI sets these too:
# targetProjects = [ "mlir" ];
extraCMakeFlags = [
"-DLLVM_INSTALL_UTILS=ON"
];
});
in in
buildPythonPackage { buildPythonPackage rec {
inherit pname version; pname = "triton";
version = "2.0.0";
format = "setuptools"; format = "setuptools";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -62,21 +48,6 @@ buildPythonPackage {
}; };
patches = [ patches = [
# Prerequisite for llvm15 patch
(fetchpatch {
url = "https://github.com/openai/triton/commit/2aba985daaa70234823ea8f1161da938477d3e02.patch";
hash = "sha256-LGv0+Ut2WYPC4Ksi4803Hwmhi3FyQOF9zElJc/JCobk=";
})
(fetchpatch {
url = "https://github.com/openai/triton/commit/e3941f9d09cdd31529ba4a41018cfc0096aafea6.patch";
hash = "sha256-A+Gor6qzFlGQhVVhiaaYOzqqx8yO2MdssnQS6TIfUWg=";
})
# Source: https://github.com/openai/triton/commit/fc7a8e35819bda632bdcf1cf75fd9abe4d4e077a.patch
# The original patch adds ptxas binary, so we include our own clean copy
# Drop with the next update
./llvm15.patch
# TODO: there have been commits upstream aimed at removing the "torch" # TODO: there have been commits upstream aimed at removing the "torch"
# circular dependency, but the patches fail to apply on the release # circular dependency, but the patches fail to apply on the release
# revision. Keeping the link for future reference # revision. Keeping the link for future reference
@ -88,70 +59,11 @@ buildPythonPackage {
# }) # })
]; ];
postPatch = ''
substituteInPlace python/setup.py \
--replace \
'= get_thirdparty_packages(triton_cache_path)' \
'= os.environ["cmakeFlags"].split()'
''
# Wiring triton=2.0.0 with llcmPackages_rocm.llvm=5.4.3
# Revisit when updating either triton or llvm
+ ''
substituteInPlace CMakeLists.txt \
--replace "nvptx" "NVPTX" \
--replace "LLVM 11" "LLVM"
sed -i '/AddMLIR/a set(MLIR_TABLEGEN_EXE "${llvmPackages.mlir}/bin/mlir-tblgen")' CMakeLists.txt
sed -i '/AddMLIR/a set(MLIR_INCLUDE_DIR ''${MLIR_INCLUDE_DIRS})' CMakeLists.txt
find -iname '*.td' -exec \
sed -i \
-e '\|include "mlir/IR/OpBase.td"|a include "mlir/IR/AttrTypeBase.td"' \
-e 's|include "mlir/Dialect/StandardOps/IR/Ops.td"|include "mlir/Dialect/Func/IR/FuncOps.td"|' \
'{}' ';'
substituteInPlace unittest/CMakeLists.txt --replace "include(GoogleTest)" "find_package(GTest REQUIRED)"
sed -i 's/^include.*$//' unittest/CMakeLists.txt
sed -i '/LINK_LIBS/i NVPTXInfo' lib/Target/PTX/CMakeLists.txt
sed -i '/LINK_LIBS/i NVPTXCodeGen' lib/Target/PTX/CMakeLists.txt
''
# TritonMLIRIR already links MLIRIR. Not transitive?
# + ''
# echo "target_link_libraries(TritonPTX PUBLIC MLIRIR)" >> lib/Target/PTX/CMakeLists.txt
# ''
# Already defined in llvm, when built with -DLLVM_INSTALL_UTILS
+ ''
substituteInPlace bin/CMakeLists.txt \
--replace "add_subdirectory(FileCheck)" ""
rm cmake/FindLLVM.cmake
''
+
(
let
# Bash was getting weird without linting,
# but basically upstream contains [cc, ..., "-lcuda", ...]
# and we replace it with [..., "-lcuda", "-L/run/opengl-driver/lib", "-L$stubs", ...]
old = [ "-lcuda" ];
new = [ "-lcuda" "-L${addOpenGLRunpath.driverLink}" "-L${cuda_cudart}/lib/stubs/" ];
quote = x: ''"${x}"'';
oldStr = lib.concatMapStringsSep ", " quote old;
newStr = lib.concatMapStringsSep ", " quote new;
in
''
substituteInPlace python/triton/compiler.py \
--replace '${oldStr}' '${newStr}'
''
)
# Triton seems to be looking up cuda.h
+ ''
sed -i 's|cu_include_dir = os.path.join.*$|cu_include_dir = "${cuda_cudart}/include"|' python/triton/compiler.py
'';
nativeBuildInputs = [ nativeBuildInputs = [
cmake
pythonRelaxDepsHook pythonRelaxDepsHook
# pytestCheckHook # Requires torch (circular dependency) and probably needs GPUs:
# Requires torch (circular dependency) and probably needs GPUs: cmake
# pytestCheckHook ninja
# Note for future: # Note for future:
# These *probably* should go in depsTargetTarget # These *probably* should go in depsTargetTarget
@ -159,7 +71,6 @@ buildPythonPackage {
# because we only support cudaPackages on x86_64-linux atm # because we only support cudaPackages on x86_64-linux atm
lit lit
llvm llvm
llvmPackages.mlir
]; ];
buildInputs = [ buildInputs = [
@ -170,17 +81,44 @@ buildPythonPackage {
zlib zlib
]; ];
propagatedBuildInputs = [ propagatedBuildInputs = [ filelock ];
filelock
]; postPatch = let
# Bash was getting weird without linting,
# but basically upstream contains [cc, ..., "-lcuda", ...]
# and we replace it with [..., "-lcuda", "-L/run/opengl-driver/lib", "-L$stubs", ...]
old = [ "-lcuda" ];
new = [ "-lcuda" "-L${addOpenGLRunpath.driverLink}" "-L${cudaPackages.cuda_cudart}/lib/stubs/" ];
quote = x: ''"${x}"'';
oldStr = lib.concatMapStringsSep ", " quote old;
newStr = lib.concatMapStringsSep ", " quote new;
in ''
# Use our `cmakeFlags` instead and avoid downloading dependencies
substituteInPlace python/setup.py \
--replace "= get_thirdparty_packages(triton_cache_path)" "= os.environ[\"cmakeFlags\"].split()"
# Already defined in llvm, when built with -DLLVM_INSTALL_UTILS
substituteInPlace bin/CMakeLists.txt \
--replace "add_subdirectory(FileCheck)" ""
# Use our linker flags
substituteInPlace python/triton/compiler.py \
--replace '${oldStr}' '${newStr}'
# Don't fetch googletest
substituteInPlace unittest/CMakeLists.txt \
--replace "include (\''${CMAKE_CURRENT_SOURCE_DIR}/googletest.cmake)" ""\
--replace "include(GoogleTest)" "find_package(GTest REQUIRED)"
'';
# Avoid GLIBCXX mismatch with other cuda-enabled python packages # Avoid GLIBCXX mismatch with other cuda-enabled python packages
preConfigure = '' preConfigure = ''
export CC="${backendStdenv.cc}/bin/cc"; export CC=${cudaPackages.backendStdenv.cc}/bin/cc;
export CXX="${backendStdenv.cc}/bin/c++"; export CXX=${cudaPackages.backendStdenv.cc}/bin/c++;
# Upstream's setup.py tries to write cache somewhere in ~/ # Upstream's setup.py tries to write cache somewhere in ~/
export HOME=$TMPDIR export HOME=$(mktemp -d)
# Upstream's github actions patch setup.cfg to write base-dir. May be redundant # Upstream's github actions patch setup.cfg to write base-dir. May be redundant
echo " echo "
@ -188,52 +126,41 @@ buildPythonPackage {
base-dir=$PWD" >> python/setup.cfg base-dir=$PWD" >> python/setup.cfg
# The rest (including buildPhase) is relative to ./python/ # The rest (including buildPhase) is relative to ./python/
cd python/ cd python
# Work around download_and_copy_ptxas() # Work around download_and_copy_ptxas()
dst_cuda="$PWD/triton/third_party/cuda/bin" mkdir -p $PWD/triton/third_party/cuda/bin
mkdir -p "$dst_cuda" ln -s ${ptxas} $PWD/triton/third_party/cuda/bin
ln -s "${ptxas}" "$dst_cuda/"
''; '';
# CMake is run by setup.py instead # CMake is run by setup.py instead
dontUseCmakeConfigure = true; dontUseCmakeConfigure = true;
cmakeFlags = [
"-DMLIR_DIR=${llvmPackages.mlir}/lib/cmake/mlir"
];
postFixup = # Setuptools (?) strips runpath and +x flags. Let's just restore the symlink
let postFixup = ''
ptxasDestination = "$out/${python.sitePackages}/triton/third_party/cuda/bin/ptxas"; rm -f $out/${python.sitePackages}/triton/third_party/cuda/bin/ptxas
in ln -s ${ptxas} $out/${python.sitePackages}/triton/third_party/cuda/bin/ptxas
# Setuptools (?) strips runpath and +x flags. Let's just restore the symlink '';
''
rm -f ${ptxasDestination}
ln -s ${ptxas} ${ptxasDestination}
'';
checkInputs = [ checkInputs = [ cmake ]; # ctest
cmake # ctest
];
dontUseSetuptoolsCheck = true; dontUseSetuptoolsCheck = true;
preCheck =
preCheck = ''
# build/temp* refers to build_ext.build_temp (looked up in the build logs) # build/temp* refers to build_ext.build_temp (looked up in the build logs)
'' (cd /build/source/python/build/temp* ; ctest)
(cd /build/source/python/build/temp* ; ctest)
'' # For pytestCheckHook # For pytestCheckHook
+ '' cd test/unit
cd test/unit '';
'';
pythonImportsCheck = [ # Circular dependency on torch
# Circular dependency on torch # pythonImportsCheck = [
# "triton" # "triton"
# "triton.language" # "triton.language"
]; # ];
# Ultimately, torch is our test suite: # Ultimately, torch is our test suite:
passthru.tests = { passthru.tests = { inherit torchWithRocm; };
inherit torchWithRocm;
};
pythonRemoveDeps = [ pythonRemoveDeps = [
# Circular dependency, cf. https://github.com/openai/triton/issues/1374 # Circular dependency, cf. https://github.com/openai/triton/issues/1374
@ -243,11 +170,12 @@ buildPythonPackage {
"cmake" "cmake"
"lit" "lit"
]; ];
meta = with lib; { meta = with lib; {
description = "Development repository for the Triton language and compiler"; description = "Language and compiler for writing highly efficient custom Deep-Learning primitives";
homepage = "https://github.com/openai/triton/"; homepage = "https://github.com/openai/triton";
platforms = lib.platforms.unix; platforms = lib.platforms.unix;
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ SomeoneSerge ]; maintainers = with maintainers; [ SomeoneSerge Madouura ];
}; };
} }

View File

@ -0,0 +1,112 @@
{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, cmake
, ninja
, git
, doxygen
, sphinx
, libxml2
, libxcrypt
, libedit
, libffi
, mpfr
, zlib
, ncurses
, python3Packages
, buildDocs ? true
, buildMan ? true
, buildTests ? true
}:
stdenv.mkDerivation (finalAttrs: {
pname = "triton-llvm";
version = "14.0.6-f28c006a5895";
outputs = [
"out"
] ++ lib.optionals buildDocs [
"doc"
] ++ lib.optionals buildMan [
"man"
];
# See https://github.com/openai/triton/blob/main/python/setup.py and https://github.com/ptillet/triton-llvm-releases/releases
src = fetchFromGitHub {
owner = "llvm";
repo = "llvm-project";
rev = "f28c006a5895fc0e329fe15fead81e37457cb1d1";
hash = "sha256-vffu4HilvYwtzwgq+NlS26m65DGbp6OSSne2aje1yJE=";
};
nativeBuildInputs = [
pkg-config
cmake
ninja
git
python3Packages.python
] ++ lib.optionals (buildDocs || buildMan) [
doxygen
sphinx
python3Packages.recommonmark
];
buildInputs = [
libxml2
libxcrypt
libedit
libffi
mpfr
];
propagatedBuildInputs = [
zlib
ncurses
];
sourceRoot = "${finalAttrs.src.name}/llvm";
cmakeFlags = [
"-DLLVM_TARGETS_TO_BUILD=X86;AMDGPU;NVPTX"
"-DLLVM_ENABLE_PROJECTS=llvm;mlir"
"-DLLVM_INSTALL_UTILS=ON"
] ++ lib.optionals (buildDocs || buildMan) [
"-DLLVM_INCLUDE_DOCS=ON"
"-DMLIR_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"
"-DMLIR_INCLUDE_TESTS=ON"
"-DLLVM_BUILD_TESTS=ON"
];
postPatch = ''
# `CMake Error: cannot write to file "/build/source/llvm/build/lib/cmake/mlir/MLIRTargets.cmake": Permission denied`
chmod +w -R ../mlir
# 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" ""
'';
doCheck = buildTests;
requiredSystemFeatures = [ "big-parallel" ];
meta = with lib; {
description = "Collection of modular and reusable compiler and toolchain technologies";
homepage = "https://github.com/llvm/llvm-project";
license = with licenses; [ ncsa ];
maintainers = with maintainers; [ SomeoneSerge Madouura ];
platforms = platforms.linux;
broken = stdenv.isAarch64; # https://github.com/RadeonOpenCompute/ROCm/issues/1831#issuecomment-1278205344
};
})

File diff suppressed because it is too large Load Diff

View File

@ -43,11 +43,7 @@
# ROCm dependencies # ROCm dependencies
rocmSupport ? false, rocmSupport ? false,
gpuTargets ? [ ], gpuTargets ? [ ], rocmPackages
openmp, rocm-core, hip, rccl, miopen, miopengemm, rocrand, rocblas,
rocfft, rocsparse, hipsparse, rocthrust, rocprim, hipcub, roctracer,
rocsolver, hipfft, hipsolver, hipblas, rocminfo, rocm-thunk, rocm-comgr,
rocm-device-libs, rocm-runtime, rocm-opencl-runtime, hipify
}: }:
let let
@ -89,7 +85,7 @@ let
else if cudaSupport then else if cudaSupport then
gpuArchWarner supportedCudaCapabilities unsupportedCudaCapabilities gpuArchWarner supportedCudaCapabilities unsupportedCudaCapabilities
else if rocmSupport then else if rocmSupport then
hip.gpuTargets rocmPackages.clr.gpuTargets
else else
throw "No GPU targets specified" throw "No GPU targets specified"
); );
@ -97,13 +93,19 @@ let
rocmtoolkit_joined = symlinkJoin { rocmtoolkit_joined = symlinkJoin {
name = "rocm-merged"; name = "rocm-merged";
paths = [ paths = with rocmPackages; [
rocm-core hip rccl miopen miopengemm rocrand rocblas rocm-core clr rccl miopen miopengemm rocrand rocblas
rocfft rocsparse hipsparse rocthrust rocprim hipcub rocsparse hipsparse rocthrust rocprim hipcub
roctracer rocfft rocsolver hipfft hipsolver hipblas roctracer # Unfree at the moment due to hsa-amd-aqlprofile hard dependency in rocprofiler
rocfft rocsolver hipfft hipsolver hipblas
rocminfo rocm-thunk rocm-comgr rocm-device-libs rocminfo rocm-thunk rocm-comgr rocm-device-libs
rocm-runtime rocm-opencl-runtime hipify rocm-runtime clr.icd hipify
]; ];
# Fix `setuptools` not being found
postBuild = ''
rm -rf $out/nix-support
'';
}; };
brokenConditions = attrsets.filterAttrs (_: cond: cond) { brokenConditions = attrsets.filterAttrs (_: cond: cond) {
@ -170,7 +172,7 @@ in buildPythonPackage rec {
# Strangely, this is never set in cmake # Strangely, this is never set in cmake
substituteInPlace cmake/public/LoadHIP.cmake \ substituteInPlace cmake/public/LoadHIP.cmake \
--replace "set(ROCM_PATH \$ENV{ROCM_PATH})" \ --replace "set(ROCM_PATH \$ENV{ROCM_PATH})" \
"set(ROCM_PATH \$ENV{ROCM_PATH})''\nset(ROCM_VERSION ${lib.concatStrings (lib.intersperse "0" (lib.splitString "." hip.version))})" "set(ROCM_PATH \$ENV{ROCM_PATH})''\nset(ROCM_VERSION ${lib.concatStrings (lib.intersperse "0" (lib.splitString "." rocmPackages.clr.version))})"
'' ''
# Detection of NCCL version doesn't work particularly well when using the static binary. # Detection of NCCL version doesn't work particularly well when using the static binary.
+ lib.optionalString cudaSupport '' + lib.optionalString cudaSupport ''
@ -323,7 +325,7 @@ in buildPythonPackage rec {
] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [ ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [
cuda_profiler_api.dev # <cuda_profiler_api.h> cuda_profiler_api.dev # <cuda_profiler_api.h>
]) ])
++ lib.optionals rocmSupport [ openmp ] ++ lib.optionals rocmSupport [ rocmPackages.llvm.openmp ]
++ lib.optionals (cudaSupport || rocmSupport) [ magma ] ++ lib.optionals (cudaSupport || rocmSupport) [ magma ]
++ lib.optionals stdenv.isLinux [ numactl ] ++ lib.optionals stdenv.isLinux [ numactl ]
++ lib.optionals stdenv.isDarwin [ Accelerate CoreServices libobjc ]; ++ lib.optionals stdenv.isDarwin [ Accelerate CoreServices libobjc ];

View File

@ -9,7 +9,7 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "clang-ocl"; pname = "clang-ocl";
version = "5.4.2"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "RadeonOpenCompute"; owner = "RadeonOpenCompute";

View File

@ -0,0 +1,165 @@
{ lib
, stdenv
, callPackage
, fetchFromGitHub
, rocmUpdateScript
, makeWrapper
, cmake
, perl
, clang
, hip-common
, hipcc
, rocm-device-libs
, rocm-comgr
, rocm-runtime
, roctracer
, rocminfo
, rocm-smi
, numactl
, libGL
, libxml2
, libX11
, python3Packages
}:
let
wrapperArgs = [
"--prefix PATH : $out/bin"
"--prefix LD_LIBRARY_PATH : ${rocm-runtime}"
"--set HIP_PLATFORM amd"
"--set HIP_PATH $out"
"--set HIP_CLANG_PATH ${clang}/bin"
"--set DEVICE_LIB_PATH ${rocm-device-libs}/amdgcn/bitcode"
"--set HSA_PATH ${rocm-runtime}"
"--set ROCM_PATH $out"
];
in stdenv.mkDerivation (finalAttrs: {
pname = "clr";
version = "5.7.0";
outputs = [
"out"
"icd"
];
src = fetchFromGitHub {
owner = "ROCm-Developer-Tools";
repo = "clr";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-C+rFW/7kf35rz0sQTI2+iY5RhZZQY07fc5a+e6cB5OQ=";
};
nativeBuildInputs = [
makeWrapper
cmake
perl
python3Packages.python
python3Packages.cppheaderparser
];
buildInputs = [
numactl
libGL
libxml2
libX11
];
propagatedBuildInputs = [
rocm-device-libs
rocm-comgr
rocm-runtime
rocminfo
];
cmakeFlags = [
"-DCMAKE_POLICY_DEFAULT_CMP0072=NEW" # Prefer newer OpenGL libraries
"-DCLR_BUILD_HIP=ON"
"-DCLR_BUILD_OCL=ON"
"-DHIP_COMMON_DIR=${hip-common}"
"-DHIPCC_BIN_DIR=${hipcc}/bin"
"-DHIP_PLATFORM=amd"
"-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext"
"-DROCM_PATH=${rocminfo}"
# Temporarily set variables to work around upstream CMakeLists issue
# Can be removed once https://github.com/ROCm-Developer-Tools/hipamd/issues/55 is fixed
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
"-DCMAKE_INSTALL_LIBDIR=lib"
];
postPatch = ''
patchShebangs hipamd/src
# We're not on Windows so these are never installed to hipcc...
substituteInPlace hipamd/CMakeLists.txt \
--replace "install(PROGRAMS \''${HIPCC_BIN_DIR}/hipcc.bat DESTINATION bin)" "" \
--replace "install(PROGRAMS \''${HIPCC_BIN_DIR}/hipconfig.bat DESTINATION bin)" ""
substituteInPlace hipamd/src/hip_embed_pch.sh \
--replace "\''$LLVM_DIR/bin/clang" "${clang}/bin/clang"
'';
postInstall = ''
patchShebangs $out/bin
# hipcc.bin and hipconfig.bin is mysteriously never installed
cp -a ${hipcc}/bin/{hipcc.bin,hipconfig.bin} $out/bin
wrapProgram $out/bin/hipcc.bin ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipconfig.bin ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipcc.pl ${lib.concatStringsSep " " wrapperArgs}
wrapProgram $out/bin/hipconfig.pl ${lib.concatStringsSep " " wrapperArgs}
# Just link rocminfo, it's easier
ln -s ${rocminfo}/bin/* $out/bin
# Replace rocm-opencl-icd functionality
mkdir -p $icd/etc/OpenCL/vendors
echo "$out/lib/libamdocl64.so" > $icd/etc/OpenCL/vendors/amdocl64.icd
'';
passthru = {
# All known and valid general GPU targets
# We cannot use this for each ROCm library, as each defines their own supported targets
# See: https://github.com/RadeonOpenCompute/ROCm/blob/77cbac4abab13046ee93d8b5bf410684caf91145/README.md#library-target-matrix
gpuTargets = lib.forEach [
"803"
"900"
"906"
"908"
"90a"
"940"
"941"
"942"
"1010"
"1012"
"1030"
"1100"
"1101"
"1102"
] (target: "gfx${target}");
updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
impureTests = {
clr-icd = callPackage ./test.nix {
inherit rocm-smi;
clr = finalAttrs.finalPackage;
};
};
};
meta = with lib; {
description = "AMD Common Language Runtime for hipamd, opencl, and rocclr";
homepage = "https://github.com/ROCm-Developer-Tools/clr";
license = with licenses; [ mit ];
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})

View File

@ -1,11 +1,15 @@
{ lib, makeImpureTest, clinfo, rocm-opencl-icd, rocm-smi }: { lib
, makeImpureTest
, clinfo
, clr
, rocm-smi
}:
makeImpureTest { makeImpureTest {
name = "rocm-opencl"; name = "clr-icd";
testedPackage = "rocm-opencl-icd"; testedPackage = "rocmPackages.clr";
nativeBuildInputs = [ clinfo rocm-smi ]; nativeBuildInputs = [ clinfo rocm-smi ];
OCL_ICD_VENDORS = "${clr.icd}/etc/OpenCL/vendors";
OCL_ICD_VENDORS = "${rocm-opencl-icd}/etc/OpenCL/vendors/";
testScript = '' testScript = ''
# Test fails if the number of platforms is 0 # Test fails if the number of platforms is 0

View File

@ -1,10 +1,10 @@
{ lib { lib
, stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, unstableGitUpdater , rocmUpdateScript
, cmake , cmake
, rocm-cmake , rocm-cmake
, hip , clr
, openmp , openmp
, clang-tools-extra , clang-tools-extra
, gtest , gtest
@ -15,7 +15,7 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "composable_kernel"; pname = "composable_kernel";
version = "unstable-2023-01-16"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -25,24 +25,21 @@ stdenv.mkDerivation (finalAttrs: {
"example" "example"
]; ];
# ROCm 5.6 should release composable_kernel as stable with a tag in the future
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "composable_kernel"; repo = "composable_kernel";
rev = "80e05267417f948e4f7e63c0fe807106d9a0c0ef"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-+c0E2UtlG/abweLwCWWjNHDO5ZvSIVKwwwettT9mqR4="; hash = "sha256-Z9X+S2SijGJ8bhr9ghkkWicBUzLzs9fxPpqZxX6BBM4=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
rocm-cmake rocm-cmake
hip clr
clang-tools-extra clang-tools-extra
]; ];
buildInputs = [ buildInputs = [ openmp ];
openmp
];
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc" "-DCMAKE_C_COMPILER=hipcc"
@ -71,7 +68,11 @@ stdenv.mkDerivation (finalAttrs: {
mv $out/bin/example_* $example/bin mv $out/bin/example_* $example/bin
''; '';
passthru.updateScript = unstableGitUpdater { }; passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
# Times out otherwise # Times out otherwise
requiredSystemFeatures = [ "big-parallel" ]; requiredSystemFeatures = [ "big-parallel" ];
@ -82,5 +83,6 @@ stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -0,0 +1,272 @@
{ callPackage
, recurseIntoAttrs
, cudaPackages
, python3Packages
, elfutils
, boost179
}:
let
rocmUpdateScript = callPackage ./update.nix { };
in rec {
## RadeonOpenCompute ##
llvm = recurseIntoAttrs (callPackage ./llvm/default.nix { inherit rocmUpdateScript rocm-device-libs rocm-runtime rocm-thunk clr; });
rocm-core = callPackage ./rocm-core {
inherit rocmUpdateScript;
stdenv = llvm.rocmClangStdenv;
};
rocm-cmake = callPackage ./rocm-cmake {
inherit rocmUpdateScript;
stdenv = llvm.rocmClangStdenv;
};
rocm-thunk = callPackage ./rocm-thunk {
inherit rocmUpdateScript;
stdenv = llvm.rocmClangStdenv;
};
rocm-smi = python3Packages.callPackage ./rocm-smi {
inherit rocmUpdateScript;
stdenv = llvm.rocmClangStdenv;
};
# Eventually will be in the LLVM repo
rocm-device-libs = callPackage ./rocm-device-libs {
inherit rocmUpdateScript rocm-cmake;
stdenv = llvm.rocmClangStdenv;
};
rocm-runtime = callPackage ./rocm-runtime {
inherit rocmUpdateScript rocm-device-libs rocm-thunk;
stdenv = llvm.rocmClangStdenv;
};
# Eventually will be in the LLVM repo
rocm-comgr = callPackage ./rocm-comgr {
inherit rocmUpdateScript rocm-cmake rocm-device-libs;
stdenv = llvm.rocmClangStdenv;
};
rocminfo = callPackage ./rocminfo {
inherit rocmUpdateScript rocm-cmake rocm-runtime;
stdenv = llvm.rocmClangStdenv;
};
clang-ocl = callPackage ./clang-ocl {
inherit rocmUpdateScript rocm-cmake rocm-device-libs;
stdenv = llvm.rocmClangStdenv;
};
# Unfree
hsa-amd-aqlprofile-bin = callPackage ./hsa-amd-aqlprofile-bin {
stdenv = llvm.rocmClangStdenv;
};
# Broken, too many errors
rdc = callPackage ./rdc {
inherit rocmUpdateScript rocm-smi rocm-runtime;
# stdenv = llvm.rocmClangStdenv;
};
rocm-docs-core = python3Packages.callPackage ./rocm-docs-core { };
## ROCm-Developer-Tools ##
hip-common = callPackage ./hip-common {
inherit rocmUpdateScript;
stdenv = llvm.rocmClangStdenv;
};
# Eventually will be in the LLVM repo
hipcc = callPackage ./hipcc {
inherit rocmUpdateScript;
stdenv = llvm.rocmClangStdenv;
};
# Replaces hip, opencl-runtime, and rocclr
clr = callPackage ./clr {
inherit rocmUpdateScript hip-common hipcc rocm-device-libs rocm-comgr rocm-runtime roctracer rocminfo rocm-smi;
inherit (llvm) clang;
stdenv = llvm.rocmClangStdenv;
};
hipify = callPackage ./hipify {
inherit rocmUpdateScript;
inherit (llvm) clang;
stdenv = llvm.rocmClangStdenv;
};
# Needs GCC
rocprofiler = callPackage ./rocprofiler {
inherit (llvm) clang;
inherit rocmUpdateScript clr rocm-thunk roctracer rocm-smi hsa-amd-aqlprofile-bin;
};
# Needs GCC
roctracer = callPackage ./roctracer {
inherit rocmUpdateScript rocm-device-libs rocm-runtime rocprofiler clr;
inherit (llvm) clang;
};
# Needs GCC
rocgdb = callPackage ./rocgdb {
inherit rocmUpdateScript;
elfutils = elfutils.override { enableDebuginfod = true; };
};
rocdbgapi = callPackage ./rocdbgapi {
inherit rocmUpdateScript rocm-cmake rocm-comgr rocm-runtime;
stdenv = llvm.rocmClangStdenv;
};
rocr-debug-agent = callPackage ./rocr-debug-agent {
inherit rocmUpdateScript clr rocdbgapi;
stdenv = llvm.rocmClangStdenv;
};
## ROCmSoftwarePlatform ##
rocprim = callPackage ./rocprim {
inherit rocmUpdateScript rocm-cmake clr;
stdenv = llvm.rocmClangStdenv;
};
rocsparse = callPackage ./rocsparse {
inherit rocmUpdateScript rocm-cmake rocprim clr;
stdenv = llvm.rocmClangStdenv;
};
rocthrust = callPackage ./rocthrust {
inherit rocmUpdateScript rocm-cmake rocprim clr;
stdenv = llvm.rocmClangStdenv;
};
rocrand = callPackage ./rocrand {
inherit rocmUpdateScript rocm-cmake clr;
stdenv = llvm.rocmClangStdenv;
};
hiprand = rocrand; # rocrand includes hiprand
rocfft = callPackage ./rocfft {
inherit rocmUpdateScript rocm-cmake rocrand rocfft clr;
inherit (llvm) openmp;
stdenv = llvm.rocmClangStdenv;
};
rccl = callPackage ./rccl {
inherit rocmUpdateScript rocm-cmake rocm-smi clr hipify;
stdenv = llvm.rocmClangStdenv;
};
hipcub = callPackage ./hipcub {
inherit rocmUpdateScript rocm-cmake rocprim clr;
stdenv = llvm.rocmClangStdenv;
};
hipsparse = callPackage ./hipsparse {
inherit rocmUpdateScript rocm-cmake rocsparse clr;
inherit (llvm) openmp;
stdenv = llvm.rocmClangStdenv;
};
hipfort = callPackage ./hipfort {
inherit rocmUpdateScript rocm-cmake;
stdenv = llvm.rocmClangStdenv;
};
hipfft = callPackage ./hipfft {
inherit rocmUpdateScript rocm-cmake rocfft clr;
inherit (llvm) openmp;
stdenv = llvm.rocmClangStdenv;
};
tensile = python3Packages.callPackage ./tensile {
inherit rocmUpdateScript rocminfo;
stdenv = llvm.rocmClangStdenv;
};
rocblas = callPackage ./rocblas {
inherit rocmUpdateScript rocm-cmake clr tensile;
inherit (llvm) openmp;
stdenv = llvm.rocmClangStdenv;
};
rocsolver = callPackage ./rocsolver {
inherit rocmUpdateScript rocm-cmake rocblas rocsparse clr;
stdenv = llvm.rocmClangStdenv;
};
rocwmma = callPackage ./rocwmma {
inherit rocmUpdateScript rocm-cmake rocm-smi rocblas clr;
inherit (llvm) openmp;
stdenv = llvm.rocmClangStdenv;
};
rocalution = callPackage ./rocalution {
inherit rocmUpdateScript rocm-cmake rocprim rocsparse rocrand rocblas clr;
inherit (llvm) openmp;
stdenv = llvm.rocmClangStdenv;
};
rocmlir = callPackage ./rocmlir {
inherit rocmUpdateScript rocm-cmake clr;
stdenv = llvm.rocmClangStdenv;
};
rocmlir-rock = rocmlir.override {
buildRockCompiler = true;
};
hipsolver = callPackage ./hipsolver {
inherit rocmUpdateScript rocm-cmake rocblas rocsolver clr;
stdenv = llvm.rocmClangStdenv;
};
hipblas = callPackage ./hipblas {
inherit rocmUpdateScript rocm-cmake rocblas rocsolver clr;
stdenv = llvm.rocmClangStdenv;
};
# hipBlasLt - Very broken with Tensile at the moment, only supports GFX9
# hipTensor - Only supports GFX9
miopengemm = callPackage ./miopengemm {
inherit rocmUpdateScript rocm-cmake clr;
stdenv = llvm.rocmClangStdenv;
};
composable_kernel = callPackage ./composable_kernel {
inherit rocmUpdateScript rocm-cmake clr;
inherit (llvm) openmp clang-tools-extra;
stdenv = llvm.rocmClangStdenv;
};
half = callPackage ./half {
inherit rocmUpdateScript rocm-cmake;
stdenv = llvm.rocmClangStdenv;
};
miopen = callPackage ./miopen {
inherit rocmUpdateScript rocm-cmake rocblas clang-ocl miopengemm composable_kernel rocm-comgr clr rocm-docs-core half;
inherit (llvm) clang-tools-extra;
stdenv = llvm.rocmClangStdenv;
rocmlir = rocmlir-rock;
boost = boost179.override { enableStatic = true; };
};
miopen-hip = miopen.override {
useOpenCL = false;
};
miopen-opencl = miopen.override {
useOpenCL = true;
};
migraphx = callPackage ./migraphx {
inherit rocmUpdateScript rocm-cmake rocblas composable_kernel miopengemm miopen clr half rocm-device-libs;
inherit (llvm) openmp clang-tools-extra;
stdenv = llvm.rocmClangStdenv;
rocmlir = rocmlir-rock;
};
}

View File

@ -0,0 +1,39 @@
{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, cmake
, rocm-cmake
}:
stdenv.mkDerivation (finalAttrs: {
pname = "half";
version = "5.7.0";
src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "half";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-82It+/wm8+umBdQYn7lz/fS69h+f0mzwPdGxoJNYUq0=";
};
nativeBuildInputs = [
cmake
rocm-cmake
];
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
meta = with lib; {
description = "C++ library for half precision floating point arithmetics";
homepage = "https://github.com/ROCmSoftwarePlatform/half";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
platforms = platforms.unix;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})

View File

@ -2,34 +2,19 @@
, stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, rocmUpdateScript , rocmUpdateScript
, substituteAll
, llvm
, rocm-runtime
, rocminfo
, lsb-release
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hip-common"; pname = "hip-common";
version = "5.4.2"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ROCm-Developer-Tools"; owner = "ROCm-Developer-Tools";
repo = "HIP"; repo = "HIP";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-44CZWk6EsP5EduzBCBbOh2kshS89qOm4v3mx/xNDzV0="; hash = "sha256-1Abit9qZCwrCVcnaFT4uMygFB9G6ovRasLmTsOsJ/Fw=";
}; };
patches = [
(substituteAll {
src = ./0000-fixup-paths.patch;
inherit llvm rocminfo;
clang = stdenv.cc;
rocm_runtime = rocm-runtime;
lsb_release = lsb-release;
})
];
dontConfigure = true; dontConfigure = true;
dontBuild = true; dontBuild = true;

View File

@ -4,7 +4,7 @@
, rocmUpdateScript , rocmUpdateScript
, cmake , cmake
, rocm-cmake , rocm-cmake
, hip , clr
, gfortran , gfortran
, rocblas , rocblas
, rocsolver , rocsolver
@ -18,7 +18,7 @@
# Can also use cuBLAS # Can also use cuBLAS
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hipblas"; pname = "hipblas";
version = "5.4.3"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -34,13 +34,13 @@ stdenv.mkDerivation (finalAttrs: {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "hipBLAS"; repo = "hipBLAS";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-mSZCq8UaiffMzWVflW1nAX6CQZ1DqwWJaSIzKslZSEk="; hash = "sha256-abaEZN82dsoEC5gIF3/6epRDVz5ItUo6CkZsybu/G+g=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
rocm-cmake rocm-cmake
hip clr
gfortran gfortran
]; ];
@ -94,7 +94,6 @@ stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
# Fixed in develop branch by using C++17 and related refactor broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
broken = versions.minor finalAttrs.version != versions.minor hip.version || buildTests || buildBenchmarks || buildSamples;
}; };
}) })

View File

@ -2,47 +2,31 @@
, stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, rocmUpdateScript , rocmUpdateScript
, substituteAll
, cmake , cmake
, llvm
, rocm-runtime
, rocminfo
, lsb-release , lsb-release
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hipcc"; pname = "hipcc";
version = "5.4.2"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ROCm-Developer-Tools"; owner = "ROCm-Developer-Tools";
repo = "HIPCC"; repo = "HIPCC";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-PEwue4O43MiMkF8UmTeHsmlikBG2V3/nFQLKmtHrRWQ="; hash = "sha256-lJX6nF1V4YmK5ai7jivXlRnG3doIOf6X9CWLHVdRuVg=";
}; };
patches = [
(substituteAll {
src = ./0000-fixup-paths.patch;
inherit llvm rocminfo;
version_major = lib.versions.major finalAttrs.version;
version_minor = lib.versions.minor finalAttrs.version;
version_patch = lib.versions.patch finalAttrs.version;
clang = stdenv.cc;
rocm_runtime = rocm-runtime;
lsb_release = lsb-release;
})
];
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
installPhase = '' postPatch = ''
runHook preInstall substituteInPlace src/hipBin_amd.h \
--replace "/usr/bin/lsb_release" "${lsb-release}/bin/lsb_release"
'';
mkdir -p $out/bin postInstall = ''
mv *.bin $out/bin rm -r $out/hip/bin
ln -s $out/bin $out/hip/bin
runHook postInstall
''; '';
passthru.updateScript = rocmUpdateScript { passthru.updateScript = rocmUpdateScript {

View File

@ -5,17 +5,18 @@
, cmake , cmake
, rocm-cmake , rocm-cmake
, rocprim , rocprim
, hip , clr
, gtest , gtest
, gbenchmark , gbenchmark
, buildTests ? false , buildTests ? false
, buildBenchmarks ? false , buildBenchmarks ? false
, gpuTargets ? [ ]
}: }:
# CUB can also be used as a backend instead of rocPRIM. # CUB can also be used as a backend instead of rocPRIM.
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hipcub"; pname = "hipcub";
version = "5.4.4"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -29,13 +30,13 @@ stdenv.mkDerivation (finalAttrs: {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "hipCUB"; repo = "hipCUB";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-reFxSOYQOf9QcoZzaLt4D1yKGQoDxpt/3rwiHgP1DCo="; hash = "sha256-ygBEA3NuCQ13QrSzGqyWXkx8Dy9WhR3u4syzapRTkFU=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
rocm-cmake rocm-cmake
hip clr
]; ];
buildInputs = [ buildInputs = [
@ -48,12 +49,14 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_CXX_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc"
"-DHIP_ROOT_DIR=${hip}" "-DHIP_ROOT_DIR=${clr}"
# Manually define CMAKE_INSTALL_<DIR> # Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838 # See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include" "-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals (gpuTargets != [ ]) [
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
] ++ lib.optionals buildTests [ ] ++ lib.optionals buildTests [
"-DBUILD_TEST=ON" "-DBUILD_TEST=ON"
] ++ lib.optionals buildBenchmarks [ ] ++ lib.optionals buildBenchmarks [
@ -82,6 +85,6 @@ stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ bsd3 ]; license = with licenses; [ bsd3 ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -4,7 +4,7 @@
, rocmUpdateScript , rocmUpdateScript
, cmake , cmake
, rocm-cmake , rocm-cmake
, hip , clr
, git , git
, rocfft , rocfft
, gtest , gtest
@ -15,12 +15,13 @@
, buildTests ? false , buildTests ? false
, buildBenchmarks ? false , buildBenchmarks ? false
, buildSamples ? false , buildSamples ? false
, gpuTargets ? [ ]
}: }:
# Can also use cuFFT # Can also use cuFFT
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hipfft"; pname = "hipfft";
version = "5.4.3"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -36,12 +37,12 @@ stdenv.mkDerivation (finalAttrs: {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "hipFFT"; repo = "hipFFT";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-yDtm9J0wqH6zo4HcgQbqhvwbzbOiJPQ48gJ2gC8PvjA="; hash = "sha256-fuYRKdlTrRMwxr3cgMeT3YniPzs4nuvF8YCzr3LLPFM=";
fetchSubmodules = true; fetchSubmodules = true;
}; };
nativeBuildInputs = [ nativeBuildInputs = [
hip clr
git git
cmake cmake
rocm-cmake rocm-cmake
@ -60,14 +61,16 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc" "-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc"
"-DCMAKE_MODULE_PATH=${hip}/lib/cmake/hip" "-DCMAKE_MODULE_PATH=${clr}/lib/cmake/hip"
"-DHIP_ROOT_DIR=${hip}" "-DHIP_ROOT_DIR=${clr}"
"-DHIP_PATH=${hip}" "-DHIP_PATH=${clr}"
# Manually define CMAKE_INSTALL_<DIR> # Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838 # See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include" "-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals (gpuTargets != [ ]) [
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
] ++ lib.optionals buildTests [ ] ++ lib.optionals buildTests [
"-DBUILD_CLIENTS_TESTS=ON" "-DBUILD_CLIENTS_TESTS=ON"
] ++ lib.optionals buildBenchmarks [ ] ++ lib.optionals buildBenchmarks [
@ -102,6 +105,6 @@ stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -9,13 +9,13 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hipfort"; pname = "hipfort";
version = "5.6.0"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "hipfort"; repo = "hipfort";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-x1pF9md7RIcobE/4UxHxOaURbljFZGOashW1KM0lmo0="; hash = "sha256-DRjUWhdinDKP7CZgq2SmU3lGmmodCuXvco9aEeMLSZ4=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -3,18 +3,19 @@
, fetchFromGitHub , fetchFromGitHub
, rocmUpdateScript , rocmUpdateScript
, cmake , cmake
, clang
, libxml2 , libxml2
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hipify"; pname = "hipify";
version = "5.4.2"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ROCm-Developer-Tools"; owner = "ROCm-Developer-Tools";
repo = "HIPIFY"; repo = "HIPIFY";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-EaHtI1ywjEHioWptuHvCllJ3dENtSClVoE6NpWTOa9I="; hash = "sha256-lCQ2VTUGmFC90Xu70/tvoeDhFaInGqLT3vC2A1UojNI=";
}; };
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
@ -22,7 +23,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = '' postPatch = ''
substituteInPlace CMakeLists.txt \ substituteInPlace CMakeLists.txt \
--replace "\''${LLVM_TOOLS_BINARY_DIR}/clang" "${stdenv.cc}/bin/clang" --replace "\''${LLVM_TOOLS_BINARY_DIR}/clang" "${clang}/bin/clang"
''; '';
passthru.updateScript = rocmUpdateScript { passthru.updateScript = rocmUpdateScript {
@ -31,11 +32,11 @@ stdenv.mkDerivation (finalAttrs: {
repo = finalAttrs.src.repo; repo = finalAttrs.src.repo;
}; };
# Fixup weird install paths # Fixup bad symlinks
postInstall = '' postInstall = ''
mkdir -p $out/bin rm -r $out/hip/bin
mv $out/{*.sh,hipify-*} $out/bin ln -s $out/bin $out/hip/bin
cp -afs $out/bin $out/hip patchShebangs $out/bin
''; '';
meta = with lib; { meta = with lib; {

View File

@ -4,7 +4,7 @@
, rocmUpdateScript , rocmUpdateScript
, cmake , cmake
, rocm-cmake , rocm-cmake
, hip , clr
, gfortran , gfortran
, rocblas , rocblas
, rocsolver , rocsolver
@ -18,7 +18,7 @@
# Can also use cuSOLVER # Can also use cuSOLVER
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hipsolver"; pname = "hipsolver";
version = "5.4.4"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -34,13 +34,13 @@ stdenv.mkDerivation (finalAttrs: {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "hipSOLVER"; repo = "hipSOLVER";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-p9hgKqRALLItv/HTpVlTsu+m9wlwCBYPYnJcm8StIao="; hash = "sha256-I9Xjkilo+baeM1CRXjLAbj/vrg8r5/E2yEImhHGSyf8=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
rocm-cmake rocm-cmake
hip clr
gfortran gfortran
]; ];
@ -95,6 +95,6 @@ stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -5,19 +5,20 @@
, cmake , cmake
, rocm-cmake , rocm-cmake
, rocsparse , rocsparse
, hip , clr
, gfortran , gfortran
, git , git
, gtest , gtest
, openmp , openmp
, buildTests ? false , buildTests ? false
, buildSamples ? false , buildSamples ? false
, gpuTargets ? [ ]
}: }:
# This can also use cuSPARSE as a backend instead of rocSPARSE # This can also use cuSPARSE as a backend instead of rocSPARSE
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "hipsparse"; pname = "hipsparse";
version = "5.4.4"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -31,13 +32,13 @@ stdenv.mkDerivation (finalAttrs: {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "hipSPARSE"; repo = "hipSPARSE";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-JWjmMvqIm4in1aPq2UgYmL0eWjrrRBiU6vH3FnCZZ40="; hash = "sha256-txigaOoZMI/v+EQLgGlj2O0IHfE7EpgjL0cyv49nKzo=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
rocm-cmake rocm-cmake
hip clr
gfortran gfortran
]; ];
@ -59,16 +60,15 @@ stdenv.mkDerivation (finalAttrs: {
"-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include" "-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals (gpuTargets != [ ]) [
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
] ++ lib.optionals buildTests [ ] ++ lib.optionals buildTests [
"-DBUILD_CLIENTS_TESTS=ON" "-DBUILD_CLIENTS_TESTS=ON"
]; ];
# We have to manually generate the matrices # We have to manually generate the matrices
# CMAKE_MATRICES_DIR seems to be reset in clients/tests/CMakeLists.txt # CMAKE_MATRICES_DIR seems to be reset in clients/tests/CMakeLists.txt
postPatch = '' postPatch = lib.optionalString buildTests ''
substituteInPlace clients/common/utility.cpp \
--replace "#ifdef __cpp_lib_filesystem" " #if true"
'' + lib.optionalString buildTests ''
mkdir -p matrices mkdir -p matrices
ln -s ${rocsparse.passthru.matrices.matrix-01}/*.mtx matrices ln -s ${rocsparse.passthru.matrices.matrix-01}/*.mtx matrices
@ -116,7 +116,7 @@ stdenv.mkDerivation (finalAttrs: {
mkdir -p $sample/bin mkdir -p $sample/bin
mv clients/staging/example_* $sample/bin mv clients/staging/example_* $sample/bin
patchelf --set-rpath $out/lib:${lib.makeLibraryPath ( patchelf --set-rpath $out/lib:${lib.makeLibraryPath (
finalAttrs.buildInputs ++ [ hip gfortran.cc ])} $sample/bin/example_* finalAttrs.buildInputs ++ [ clr gfortran.cc ])} $sample/bin/example_*
''; '';
passthru.updateScript = rocmUpdateScript { passthru.updateScript = rocmUpdateScript {
@ -131,6 +131,6 @@ stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -0,0 +1,45 @@
{ lib
, stdenv
, fetchurl
, dpkg
}:
let
prefix = "hsa-amd-aqlprofile";
version = "5.7.0";
major = lib.versions.major version;
minor = lib.versions.minor version;
patch = lib.versions.patch version;
magic = lib.strings.concatStrings (lib.strings.intersperse "0" (lib.versions.splitVersion version));
in stdenv.mkDerivation (finalAttrs: {
inherit version;
pname = "${prefix}-bin";
src = fetchurl {
url = "https://repo.radeon.com/rocm/apt/${major}.${minor}/pool/main/h/${prefix}/${prefix}_1.0.0.${magic}.${magic}-63~22.04_amd64.deb";
hash = "sha256-FQ25eXkhnvOmcf0sGW3GYu9kZj69bVvZrh0jVx/G/kI=";
};
nativeBuildInputs = [ dpkg ];
dontPatch = true;
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out
cp -a opt/rocm-${version}/* $out
runHook postInstall
'';
meta = with lib; {
description = "AQLPROFILE library for AMD HSA runtime API extension support";
homepage = "https://rocm.docs.amd.com/en/latest/";
license = with licenses; [ unfree ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})

View File

@ -24,8 +24,7 @@
, targetDir ? "llvm" , targetDir ? "llvm"
, targetProjects ? [ ] , targetProjects ? [ ]
, targetRuntimes ? [ ] , targetRuntimes ? [ ]
# "NATIVE" resolves into x86 or aarch64 depending on stdenv , llvmTargetsToBuild ? [ "NATIVE" ] # "NATIVE" resolves into x86 or aarch64 depending on stdenv
, llvmTargetsToBuild ? [ "NATIVE" ]
, extraPatches ? [ ] , extraPatches ? [ ]
, extraNativeBuildInputs ? [ ] , extraNativeBuildInputs ? [ ]
, extraBuildInputs ? [ ] , extraBuildInputs ? [ ]
@ -39,6 +38,7 @@
) )
)] )]
, extraPostInstall ? "" , extraPostInstall ? ""
, hardeningDisable ? [ ]
, requiredSystemFeatures ? [ ] , requiredSystemFeatures ? [ ]
, extraLicenses ? [ ] , extraLicenses ? [ ]
, isBroken ? false , isBroken ? false
@ -53,7 +53,7 @@ let
llvmTargetsToBuild' = [ "AMDGPU" ] ++ builtins.map inferNativeTarget llvmTargetsToBuild; llvmTargetsToBuild' = [ "AMDGPU" ] ++ builtins.map inferNativeTarget llvmTargetsToBuild;
in stdenv.mkDerivation (finalAttrs: { in stdenv.mkDerivation (finalAttrs: {
pname = "rocm-llvm-${targetName}"; pname = "rocm-llvm-${targetName}";
version = "5.4.4"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -70,7 +70,7 @@ in stdenv.mkDerivation (finalAttrs: {
owner = "RadeonOpenCompute"; owner = "RadeonOpenCompute";
repo = "llvm-project"; repo = "llvm-project";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-BDvC6QFDFtahA9hmJDLiM6K4mrO3j9E9rEXm7KulcuA="; hash = "sha256-oJIXALwxo130jl8b6yCFw+a2kMBlny5/0ubiqF6MOWY=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@ -108,22 +108,20 @@ in stdenv.mkDerivation (finalAttrs: {
"-DLLVM_ENABLE_PROJECTS=${lib.concatStringsSep ";" targetProjects}" "-DLLVM_ENABLE_PROJECTS=${lib.concatStringsSep ";" targetProjects}"
] ++ lib.optionals ((finalAttrs.passthru.isLLVM || targetDir == "runtimes") && targetRuntimes != [ ]) [ ] ++ lib.optionals ((finalAttrs.passthru.isLLVM || targetDir == "runtimes") && targetRuntimes != [ ]) [
"-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" targetRuntimes}" "-DLLVM_ENABLE_RUNTIMES=${lib.concatStringsSep ";" targetRuntimes}"
] ++ lib.optionals (finalAttrs.passthru.isLLVM || finalAttrs.passthru.isClang) [ ] ++ lib.optionals finalAttrs.passthru.isLLVM [
"-DLLVM_ENABLE_RTTI=ON" "-DLLVM_INSTALL_UTILS=ON"
"-DLLVM_ENABLE_EH=ON" "-DLLVM_INSTALL_GTEST=ON"
] ++ lib.optionals (buildDocs || buildMan) [ ] ++ lib.optionals (buildDocs || buildMan) [
"-DLLVM_INCLUDE_DOCS=ON" "-DLLVM_INCLUDE_DOCS=ON"
"-DLLVM_BUILD_DOCS=ON" "-DLLVM_BUILD_DOCS=ON"
# "-DLLVM_ENABLE_DOXYGEN=ON" Way too slow, only uses one core # "-DLLVM_ENABLE_DOXYGEN=ON" Way too slow, only uses one core
"-DLLVM_ENABLE_SPHINX=ON" "-DLLVM_ENABLE_SPHINX=ON"
"-DLLVM_ENABLE_OCAMLDOC=OFF"
"-DSPHINX_OUTPUT_HTML=ON" "-DSPHINX_OUTPUT_HTML=ON"
"-DSPHINX_OUTPUT_MAN=ON" "-DSPHINX_OUTPUT_MAN=ON"
"-DSPHINX_WARNINGS_AS_ERRORS=OFF" "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
] ++ lib.optionals buildTests [ ] ++ lib.optionals buildTests [
"-DLLVM_INCLUDE_TESTS=ON" "-DLLVM_INCLUDE_TESTS=ON"
"-DLLVM_BUILD_TESTS=ON" "-DLLVM_BUILD_TESTS=ON"
] ++ lib.optionals (buildTests && !finalAttrs.passthru.isLLVM) [
"-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped" "-DLLVM_EXTERNAL_LIT=${lit}/bin/.lit-wrapped"
] ++ extraCMakeFlags; ] ++ extraCMakeFlags;
@ -141,10 +139,7 @@ in stdenv.mkDerivation (finalAttrs: {
doCheck = buildTests; doCheck = buildTests;
checkTarget = lib.concatStringsSep " " checkTargets; checkTarget = lib.concatStringsSep " " checkTargets;
postInstall = lib.optionalString finalAttrs.passthru.isLLVM '' postInstall = lib.optionalString buildMan ''
# `lit` expects these for some test suites
mv bin/{FileCheck,not,count,yaml2obj,obj2yaml} $out/bin
'' + lib.optionalString buildMan ''
mkdir -p $info mkdir -p $info
'' + extraPostInstall; '' + extraPostInstall;
@ -159,7 +154,7 @@ in stdenv.mkDerivation (finalAttrs: {
}; };
}; };
inherit requiredSystemFeatures; inherit hardeningDisable requiredSystemFeatures;
meta = with lib; { meta = with lib; {
description = "ROCm fork of the LLVM compiler infrastructure"; description = "ROCm fork of the LLVM compiler infrastructure";

View File

@ -0,0 +1,57 @@
{ stdenv
, callPackage
, rocmUpdateScript
, wrapBintoolsWith
, overrideCC
, rocm-device-libs
, rocm-runtime
, rocm-thunk
, clr
}:
let
## Stage 1 ##
# Projects
llvm = callPackage ./stage-1/llvm.nix { inherit rocmUpdateScript; };
clang-unwrapped = callPackage ./stage-1/clang-unwrapped.nix { inherit rocmUpdateScript llvm; };
lld = callPackage ./stage-1/lld.nix { inherit rocmUpdateScript llvm; };
# Runtimes
runtimes = callPackage ./stage-1/runtimes.nix { inherit rocmUpdateScript llvm; };
## Stage 2 ##
# Helpers
bintools-unwrapped = callPackage ./stage-2/bintools-unwrapped.nix { inherit llvm lld; };
bintools = wrapBintoolsWith { bintools = bintools-unwrapped; };
rStdenv = callPackage ./stage-2/rstdenv.nix { inherit llvm clang-unwrapped lld runtimes bintools; };
in rec {
inherit
llvm
clang-unwrapped
lld
bintools;
# Runtimes
libc = callPackage ./stage-2/libc.nix { inherit rocmUpdateScript; stdenv = rStdenv; };
libunwind = callPackage ./stage-2/libunwind.nix { inherit rocmUpdateScript; stdenv = rStdenv; };
libcxxabi = callPackage ./stage-2/libcxxabi.nix { inherit rocmUpdateScript; stdenv = rStdenv; };
libcxx = callPackage ./stage-2/libcxx.nix { inherit rocmUpdateScript; stdenv = rStdenv; };
compiler-rt = callPackage ./stage-2/compiler-rt.nix { inherit rocmUpdateScript llvm; stdenv = rStdenv; };
## Stage 3 ##
# Helpers
clang = callPackage ./stage-3/clang.nix { inherit llvm lld clang-unwrapped bintools libc libunwind libcxxabi libcxx compiler-rt; };
rocmClangStdenv = overrideCC stdenv clang;
# Projects
clang-tools-extra = callPackage ./stage-3/clang-tools-extra.nix { inherit rocmUpdateScript llvm clang-unwrapped; stdenv = rocmClangStdenv; };
libclc = callPackage ./stage-3/libclc.nix { inherit rocmUpdateScript llvm clang; stdenv = rocmClangStdenv; };
lldb = callPackage ./stage-3/lldb.nix { inherit rocmUpdateScript clang; stdenv = rocmClangStdenv; };
mlir = callPackage ./stage-3/mlir.nix { inherit rocmUpdateScript clr; stdenv = rocmClangStdenv; };
polly = callPackage ./stage-3/polly.nix { inherit rocmUpdateScript; stdenv = rocmClangStdenv; };
flang = callPackage ./stage-3/flang.nix { inherit rocmUpdateScript clang-unwrapped mlir; stdenv = rocmClangStdenv; };
openmp = callPackage ./stage-3/openmp.nix { inherit rocmUpdateScript llvm clang-unwrapped clang rocm-device-libs rocm-runtime rocm-thunk; stdenv = rocmClangStdenv; };
# Runtimes
pstl = callPackage ./stage-3/pstl.nix { inherit rocmUpdateScript; stdenv = rocmClangStdenv; };
}

View File

@ -0,0 +1,46 @@
{ callPackage
, rocmUpdateScript
, llvm
}:
callPackage ../base.nix rec {
inherit rocmUpdateScript;
targetName = "clang-unwrapped";
targetDir = "clang";
extraBuildInputs = [ llvm ];
extraCMakeFlags = [
"-DCLANG_INCLUDE_DOCS=ON"
"-DCLANG_INCLUDE_TESTS=ON"
];
extraPostPatch = ''
# Looks like they forgot to add finding libedit to the standalone build
ln -s ../cmake/Modules/FindLibEdit.cmake cmake/modules
substituteInPlace CMakeLists.txt \
--replace "include(CheckIncludeFile)" "include(CheckIncludeFile)''\nfind_package(LibEdit)"
# `No such file or directory: '/build/source/clang/tools/scan-build/bin/scan-build'`
rm test/Analysis/scan-build/*.test
rm test/Analysis/scan-build/rebuild_index/rebuild_index.test
# `does not depend on a module exporting 'baz.h'`
rm test/Modules/header-attribs.cpp
# We do not have HIP or the ROCm stack available yet
rm test/Driver/hip-options.hip
# ???? `ld: cannot find crti.o: No such file or directory` linker issue?
rm test/Interpreter/dynamic-library.cpp
# `fatal error: 'stdio.h' file not found`
rm test/OpenMP/amdgcn_emit_llvm.c
'';
extraPostInstall = ''
mv bin/clang-tblgen $out/bin
'';
requiredSystemFeatures = [ "big-parallel" ];
}

View File

@ -0,0 +1,13 @@
{ callPackage
, rocmUpdateScript
, llvm
}:
callPackage ../base.nix rec {
inherit rocmUpdateScript;
buildMan = false; # No man pages to build
targetName = "lld";
targetDir = targetName;
extraBuildInputs = [ llvm ];
checkTargets = [ "check-${targetName}" ];
}

View File

@ -0,0 +1,10 @@
{ stdenv
, callPackage
, rocmUpdateScript
}:
callPackage ../base.nix {
inherit rocmUpdateScript;
requiredSystemFeatures = [ "big-parallel" ];
isBroken = stdenv.isAarch64; # https://github.com/RadeonOpenCompute/ROCm/issues/1831#issuecomment-1278205344
}

View File

@ -0,0 +1,30 @@
{ lib
, callPackage
, rocmUpdateScript
, llvm
}:
callPackage ../base.nix rec {
inherit rocmUpdateScript;
buildDocs = false;
buildMan = false;
buildTests = false;
targetName = "runtimes";
targetDir = targetName;
targetRuntimes = [
"libunwind"
"libcxxabi"
"libcxx"
"compiler-rt"
];
extraBuildInputs = [ llvm ];
extraCMakeFlags = [
"-DLIBCXX_INCLUDE_BENCHMARKS=OFF"
"-DLIBCXX_CXX_ABI=libcxxabi"
];
extraLicenses = [ lib.licenses.mit ];
}

View File

@ -0,0 +1,171 @@
../libcxx/test/libcxx/containers/gnu_cxx/hash_map.pass.cpp
../libcxx/test/libcxx/containers/gnu_cxx/hash_set.pass.cpp
../libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/allocate.cxx2a.pass.cpp
../libcxx/test/libcxx/depr/depr.default.allocator/allocator.members/construct.cxx2a.pass.cpp
../libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp
../libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp
../libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp
../libcxx/test/libcxx/localization/locales/locale/locale.types/locale.facet/no_allocation.pass.cpp
../libcxx/test/libcxx/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_underaligned_buffer.pass.cpp
../libcxx/test/libcxx/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_in_geometric_progression.pass.cpp
../libcxx/test/std/containers/associative/map/map.access/index_key.pass.cpp
../libcxx/test/std/containers/associative/map/map.access/index_rv_key.pass.cpp
../libcxx/test/std/containers/associative/map/map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
../libcxx/test/std/containers/associative/multimap/multimap.modifiers/insert_allocator_requirements.pass.cpp
../libcxx/test/std/containers/associative/multiset/insert_emplace_allocator_requirements.pass.cpp
../libcxx/test/std/containers/associative/set/insert_and_emplace_allocator_requirements.pass.cpp
../libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
../libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_size_value.pass.cpp
../libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_value.pass.cpp
../libcxx/test/std/containers/sequences/vector.bool/ctor_exceptions.pass.cpp
../libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp
../libcxx/test/std/containers/unord/unord.map/unord.map.elem/index.pass.cpp
../libcxx/test/std/containers/unord/unord.map/unord.map.modifiers/insert_and_emplace_allocator_requirements.pass.cpp
../libcxx/test/std/containers/unord/unord.multimap/unord.multimap.modifiers/insert_allocator_requirements.pass.cpp
../libcxx/test/std/containers/unord/unord.multiset/insert_emplace_allocator_requirements.pass.cpp
../libcxx/test/std/containers/unord/unord.set/insert_and_emplace_allocator_requirements.pass.cpp
../libcxx/test/std/experimental/memory/memory.resource.global/new_delete_resource.pass.cpp
../libcxx/test/std/experimental/memory/memory.resource.global/null_memory_resource.pass.cpp
../libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/pbackfail.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy_assign.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/copy.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move_assign.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/move.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.cons/path.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/assign.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/refresh.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.mods/replace_filename.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_size.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/status.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_entry/directory_entry.obs/symlink_status.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy_assign.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/copy.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/ctor.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/increment.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move_assign.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.members/move.pass.cpp
../libcxx/test/std/input.output/filesystems/class.directory_iterator/directory_iterator.nonmembers/begin_end.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/move.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.assign/source.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.concat.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.construct/move.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_normal.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_string_alloc.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.generic.obs/named_overloads.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/clear.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/make_preferred.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/remove_filename.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_extension.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/replace_filename.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.modifiers/swap.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.member/path.native.obs/named_overloads.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp
../libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy_assign.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/ctor.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/depth.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/disable_recursion_pending.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move_assign.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/move.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/pop.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/recursion_pending.pass.cpp
../libcxx/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.nonmembers/begin_end.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.canonical/canonical.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy_symlink/copy_symlink.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.copy/copy.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory_symlink/create_directory_symlink.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_hard_link/create_hard_link.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.create_symlink/create_symlink.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.current_path/current_path.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.equivalent/equivalent.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.exists/exists.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.file_size/file_size.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.hard_lk_ct/hard_link_count.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_block_file/is_block_file.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_char_file/is_character_file.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_directory/is_directory.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_empty/is_empty.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_fifo/is_fifo.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_other/is_other.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_regular_file/is_regular_file.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_socket/is_socket.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.is_symlink/is_symlink.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.permissions/permissions.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.proximate/proximate.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.read_symlink/read_symlink.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.relative/relative.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/remove_all.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove_all/toctou.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.remove/remove.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.rename/rename.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.resize_file/resize_file.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.space/space.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.status/status.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.symlink_status/symlink_status.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp
../libcxx/test/std/input.output/filesystems/fs.op.funcs/fs.op.weakly_canonical/weakly_canonical.pass.cpp
../libcxx/test/std/localization/locale.categories/category.ctype/facet.ctype.special/facet.ctype.char.dtor/dtor.pass.cpp
../libcxx/test/std/localization/locale.stdcvt/codecvt_utf16.pass.cpp
../libcxx/test/std/localization/locale.stdcvt/codecvt_utf8.pass.cpp
../libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/ctor.pass.cpp
../libcxx/test/std/localization/locales/locale/locale.members/combine.pass.cpp
../libcxx/test/std/strings/basic.string/string.cons/substr_rvalue.pass.cpp
../libcxx/test/std/utilities/any/any.class/any.assign/copy.pass.cpp
../libcxx/test/std/utilities/any/any.class/any.assign/value.pass.cpp
../libcxx/test/std/utilities/any/any.class/any.cons/copy.pass.cpp
../libcxx/test/std/utilities/any/any.class/any.cons/default.pass.cpp
../libcxx/test/std/utilities/any/any.class/any.cons/in_place_type.pass.cpp
../libcxx/test/std/utilities/any/any.class/any.cons/move.pass.cpp
../libcxx/test/std/utilities/any/any.class/any.cons/value.pass.cpp
../libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp
../libcxx/test/std/utilities/any/any.nonmembers/any.cast/any_cast_reference.pass.cpp
../libcxx/test/std/utilities/any/any.nonmembers/make_any.pass.cpp
../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.alg/swap.pass.cpp
../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_assign.pass.cpp
../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp
../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F.pass.cpp
../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign.pass.cpp
../libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.mod/swap.pass.cpp
../libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate_at_least.pass.cpp
../libcxx/test/std/utilities/memory/default.allocator/allocator.members/allocate.pass.cpp
../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.enab/enable_shared_from_this.pass.cpp
../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_throw.pass.cpp
../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_throw.pass.cpp
../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_throw.pass.cpp
../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
../libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.global/new_delete_resource.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.global/null_memory_resource.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.ctor/without_buffer.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_deallocate.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_exception_safety.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_initial_buffer.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_from_zero_sized_buffer.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_in_geometric_progression.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_overaligned_request.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.monotonic.buffer/mem.res.monotonic.buffer.mem/allocate_with_initial_size.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.ctor/ctor_does_not_allocate.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/equality.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_overaligned_request.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate_reuse_blocks.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/sync_allocate.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_overaligned_request.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate_reuse_blocks.pass.cpp
../libcxx/test/std/utilities/utility/mem.res/mem.res.pool/mem.res.pool.mem/unsync_allocate.pass.cpp

View File

@ -0,0 +1,28 @@
{ runCommand
, llvm
, lld
}:
runCommand "rocm-llvm-binutils-${llvm.version}" { preferLocalBuild = true; } ''
mkdir -p $out/bin
for prog in ${lld}/bin/*; do
ln -s $prog $out/bin/$(basename $prog)
done
for prog in ${llvm}/bin/*; do
ln -sf $prog $out/bin/$(basename $prog)
done
ln -s ${llvm}/bin/llvm-ar $out/bin/ar
ln -s ${llvm}/bin/llvm-as $out/bin/as
ln -s ${llvm}/bin/llvm-dwp $out/bin/dwp
ln -s ${llvm}/bin/llvm-nm $out/bin/nm
ln -s ${llvm}/bin/llvm-objcopy $out/bin/objcopy
ln -s ${llvm}/bin/llvm-objdump $out/bin/objdump
ln -s ${llvm}/bin/llvm-ranlib $out/bin/ranlib
ln -s ${llvm}/bin/llvm-readelf $out/bin/readelf
ln -s ${llvm}/bin/llvm-size $out/bin/size
ln -s ${llvm}/bin/llvm-strip $out/bin/strip
ln -s ${lld}/bin/lld $out/bin/ld
''

View File

@ -0,0 +1,63 @@
{ lib
, stdenv
, callPackage
, rocmUpdateScript
, llvm
, glibc
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildDocs = false; # No documentation to build
buildMan = false; # No man pages to build
targetName = "compiler-rt";
targetDir = "runtimes";
targetRuntimes = [
"libunwind"
"libcxxabi"
"libcxx"
targetName
];
extraCMakeFlags = [
"-DCOMPILER_RT_INCLUDE_TESTS=ON"
"-DCOMPILER_RT_USE_LLVM_UNWINDER=ON"
"-DCOMPILER_RT_CXX_LIBRARY=libcxx"
"-DCOMPILER_RT_CAN_EXECUTE_TESTS=OFF" # We can't run most of these
# Workaround having to build combined
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
"-DLIBUNWIND_USE_COMPILER_RT=ON"
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
"-DLIBCXXABI_INCLUDE_TESTS=OFF"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
"-DLIBCXXABI_USE_COMPILER_RT=ON"
"-DLIBCXXABI_INSTALL_LIBRARY=OFF"
"-DLIBCXXABI_INSTALL_HEADERS=OFF"
"-DLIBCXX_INCLUDE_DOCS=OFF"
"-DLIBCXX_INCLUDE_TESTS=OFF"
"-DLIBCXX_USE_COMPILER_RT=ON"
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_INSTALL_LIBRARY=OFF"
"-DLIBCXX_INSTALL_HEADERS=OFF"
];
extraPostPatch = ''
# `No such file or directory: 'ldd'`
substituteInPlace ../compiler-rt/test/lit.common.cfg.py \
--replace "'ldd'," "'${glibc.bin}/bin/ldd',"
# We can run these
substituteInPlace ../compiler-rt/test/CMakeLists.txt \
--replace "endfunction()" "endfunction()''\nadd_subdirectory(builtins)''\nadd_subdirectory(shadowcallstack)"
# Could not launch llvm-config in /build/source/runtimes/build/bin
mkdir -p build/bin
ln -s ${llvm}/bin/llvm-config build/bin
'';
extraLicenses = [ lib.licenses.mit ];
}

View File

@ -0,0 +1,26 @@
{ stdenv
, callPackage
, rocmUpdateScript
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildMan = false; # No man pages to build
targetName = "libc";
targetDir = "runtimes";
targetRuntimes = [ targetName ];
extraPostPatch = ''
# `Failed to match ... against ...` `Match value not within tolerance value of MPFR result:`
# We need a better way, but I don't know enough sed magic and patching `CMakeLists.txt` isn't working...
substituteInPlace ../libc/test/src/math/log10_test.cpp \
--replace "i < N" "i < 0" \
--replace "test(mpfr::RoundingMode::Nearest);" "" \
--replace "test(mpfr::RoundingMode::Downward);" "" \
--replace "test(mpfr::RoundingMode::Upward);" "" \
--replace "test(mpfr::RoundingMode::TowardZero);" ""
'';
checkTargets = [ "check-${targetName}" ];
hardeningDisable = [ "fortify" ]; # Prevent `error: "Assumed value of MB_LEN_MAX wrong"`
}

View File

@ -0,0 +1,42 @@
{ stdenv
, callPackage
, rocmUpdateScript
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildMan = false; # No man pages to build
targetName = "libcxx";
targetDir = "runtimes";
targetRuntimes = [
"libunwind"
"libcxxabi"
targetName
];
extraCMakeFlags = [
"-DLIBCXX_INCLUDE_DOCS=ON"
"-DLIBCXX_INCLUDE_TESTS=ON"
"-DLIBCXX_USE_COMPILER_RT=ON"
"-DLIBCXX_CXX_ABI=libcxxabi"
# Workaround having to build combined
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
"-DLIBUNWIND_USE_COMPILER_RT=ON"
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
"-DLIBCXXABI_INCLUDE_TESTS=OFF"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
"-DLIBCXXABI_USE_COMPILER_RT=ON"
"-DLIBCXXABI_INSTALL_LIBRARY=OFF"
"-DLIBCXXABI_INSTALL_HEADERS=OFF"
];
# Most of these can't find `bash` or `mkdir`, might just be hard-coded paths, or PATH is altered
extraPostPatch = ''
chmod +w -R ../libcxx/test/{libcxx,std}
cat ${./1000-libcxx-failing-tests.list} | xargs -d \\n rm
'';
}

View File

@ -0,0 +1,37 @@
{ stdenv
, callPackage
, rocmUpdateScript
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildDocs = false; # No documentation to build
buildMan = false; # No man pages to build
targetName = "libcxxabi";
targetDir = "runtimes";
targetRuntimes = [
"libunwind"
targetName
"libcxx"
];
extraCMakeFlags = [
"-DLIBCXXABI_INCLUDE_TESTS=ON"
"-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
"-DLIBCXXABI_USE_COMPILER_RT=ON"
# Workaround having to build combined
"-DLIBUNWIND_INCLUDE_DOCS=OFF"
"-DLIBUNWIND_INCLUDE_TESTS=OFF"
"-DLIBUNWIND_USE_COMPILER_RT=ON"
"-DLIBUNWIND_INSTALL_LIBRARY=OFF"
"-DLIBUNWIND_INSTALL_HEADERS=OFF"
"-DLIBCXX_INCLUDE_DOCS=OFF"
"-DLIBCXX_INCLUDE_TESTS=OFF"
"-DLIBCXX_USE_COMPILER_RT=ON"
"-DLIBCXX_CXX_ABI=libcxxabi"
"-DLIBCXX_INSTALL_LIBRARY=OFF"
"-DLIBCXX_INSTALL_HEADERS=OFF"
];
}

View File

@ -0,0 +1,26 @@
{ stdenv
, callPackage
, rocmUpdateScript
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildMan = false; # No man pages to build
targetName = "libunwind";
targetDir = "runtimes";
targetRuntimes = [ targetName ];
extraCMakeFlags = [
"-DLIBUNWIND_INCLUDE_DOCS=ON"
"-DLIBUNWIND_INCLUDE_TESTS=ON"
"-DLIBUNWIND_USE_COMPILER_RT=ON"
];
extraPostPatch = ''
# `command had no output on stdout or stderr` (Says these unsupported tests)
chmod +w -R ../libunwind/test
rm ../libunwind/test/floatregister.pass.cpp
rm ../libunwind/test/unwind_leaffunction.pass.cpp
rm ../libunwind/test/libunwind_02.pass.cpp
'';
}

View File

@ -0,0 +1,35 @@
{ stdenv
, overrideCC
, wrapCCWith
, llvm
, clang-unwrapped
, lld
, runtimes
, bintools
}:
overrideCC stdenv (wrapCCWith rec {
inherit bintools;
libcxx = runtimes;
cc = clang-unwrapped;
extraPackages = [
llvm
lld
];
nixSupport.cc-cflags = [
"-resource-dir=$out/resource-root"
"-fuse-ld=lld"
"-rtlib=compiler-rt"
"-unwindlib=libunwind"
"-Wno-unused-command-line-argument"
];
extraBuildCommands = ''
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
mkdir -p $out/resource-root
ln -s ${cc}/lib/clang/$clang_version/include $out/resource-root
ln -s ${runtimes}/lib $out/resource-root
'';
})

View File

@ -0,0 +1,36 @@
From f1d1e10ec7e1061bf0b90abbc1e298d9438a5e74 Mon Sep 17 00:00:00 2001
From: Scott Linder <Scott.Linder@amd.com>
Date: Mon, 11 Sep 2023 18:37:37 +0000
Subject: [PATCH] [HeterogeneousDWARF] Update MLIR DI Metadata handling
Pass a default DW_MSPACE_LLVM_none to satisfy new API
Change-Id: I50df461f00b5510a715f55f61107122318102d22
---
lib/Target/LLVMIR/DebugTranslation.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/Target/LLVMIR/DebugTranslation.cpp b/lib/Target/LLVMIR/DebugTranslation.cpp
index 2053f5bcef06aa6..635ee5d7e5fefdc 100644
--- a/lib/Target/LLVMIR/DebugTranslation.cpp
+++ b/lib/Target/LLVMIR/DebugTranslation.cpp
@@ -148,7 +148,8 @@ llvm::DIDerivedType *DebugTranslation::translateImpl(DIDerivedTypeAttr attr) {
/*File=*/nullptr, /*Line=*/0,
/*Scope=*/nullptr, translate(attr.getBaseType()), attr.getSizeInBits(),
attr.getAlignInBits(), attr.getOffsetInBits(),
- /*DWARFAddressSpace=*/std::nullopt, /*Flags=*/llvm::DINode::FlagZero);
+ /*DWARFAddressSpace=*/std::nullopt, llvm::dwarf::DW_MSPACE_LLVM_none,
+ /*Flags=*/llvm::DINode::FlagZero);
}
llvm::DIFile *DebugTranslation::translateImpl(DIFileAttr attr) {
@@ -185,7 +186,8 @@ DebugTranslation::translateImpl(DILocalVariableAttr attr) {
llvmCtx, translate(attr.getScope()), getMDStringOrNull(attr.getName()),
translate(attr.getFile()), attr.getLine(), translate(attr.getType()),
attr.getArg(),
- /*Flags=*/llvm::DINode::FlagZero, attr.getAlignInBits(),
+ /*Flags=*/llvm::DINode::FlagZero, llvm::dwarf::DW_MSPACE_LLVM_none,
+ attr.getAlignInBits(),
/*Annotations=*/nullptr);
}

View File

@ -0,0 +1,122 @@
runtime/test/tasking/hidden_helper_task/gtid.cpp
runtime/test/ompt/parallel/parallel_if0.c
runtime/test/ompt/parallel/serialized.c
runtime/test/ompt/teams/parallel_team.c
runtime/test/ompt/teams/serial_teams.c
runtime/test/ompt/teams/serialized.c
runtime/test/ompt/teams/team.c
libomptarget/test/api/assert.c
libomptarget/test/api/omp_device_managed_memory.c
libomptarget/test/api/omp_device_memory.c
libomptarget/test/api/omp_get_device_num.c
libomptarget/test/api/omp_host_pinned_memory.c
libomptarget/test/api/omp_host_pinned_memory_alloc.c
libomptarget/test/api/omp_target_memcpy_async1.c
libomptarget/test/api/omp_target_memcpy_async2.c
libomptarget/test/api/omp_target_memcpy_rect_async1.c
libomptarget/test/api/omp_target_memcpy_rect_async2.c
libomptarget/test/mapping/array_section_implicit_capture.c
libomptarget/test/mapping/data_absent_at_exit.c
libomptarget/test/mapping/data_member_ref.cpp
libomptarget/test/mapping/declare_mapper_api.cpp
libomptarget/test/mapping/declare_mapper_target.cpp
libomptarget/test/mapping/declare_mapper_target_data.cpp
libomptarget/test/mapping/declare_mapper_target_data_enter_exit.cpp
libomptarget/test/mapping/firstprivate_aligned.cpp
libomptarget/test/mapping/has_device_addr.cpp
libomptarget/test/mapping/implicit_device_ptr.c
libomptarget/test/mapping/is_device_ptr.cpp
libomptarget/test/mapping/lambda_mapping.cpp
libomptarget/test/mapping/low_alignment.c
libomptarget/test/mapping/map_back_race.cpp
libomptarget/test/mapping/power_of_two_alignment.c
libomptarget/test/mapping/pr38704.c
libomptarget/test/mapping/prelock.cpp
libomptarget/test/mapping/present/target_data_at_exit.c
libomptarget/test/mapping/private_mapping.c
libomptarget/test/mapping/ptr_and_obj_motion.c
libomptarget/test/mapping/reduction_implicit_map.cpp
libomptarget/test/mapping/target_derefence_array_pointrs.cpp
libomptarget/test/mapping/target_map_for_member_data.cpp
libomptarget/test/mapping/target_update_array_extension.c
libomptarget/test/mapping/target_use_device_addr.c
libomptarget/test/offloading/atomic-compare-signedness.c
libomptarget/test/offloading/bug47654.cpp
libomptarget/test/offloading/bug49021.cpp
libomptarget/test/offloading/bug49779.cpp
libomptarget/test/offloading/bug50022.cpp
libomptarget/test/offloading/bug51781.c
libomptarget/test/offloading/bug51982.c
libomptarget/test/offloading/bug53727.cpp
libomptarget/test/offloading/complex_reduction.cpp
libomptarget/test/offloading/cuda_no_devices.c
libomptarget/test/offloading/d2d_memcpy.c
libomptarget/test/offloading/dynamic_module.c
libomptarget/test/offloading/dynamic_module_load.c
libomptarget/test/offloading/global_constructor.cpp
libomptarget/test/offloading/lone_target_exit_data.c
libomptarget/test/offloading/memory_manager.cpp
libomptarget/test/offloading/parallel_offloading_map.cpp
libomptarget/test/offloading/static_linking.c
libomptarget/test/offloading/std_complex_arithmetic.cpp
libomptarget/test/offloading/target-teams-atomic.c
libomptarget/test/offloading/target_constexpr_mapping.cpp
libomptarget/test/offloading/target_critical_region.cpp
libomptarget/test/offloading/target_depend_nowait.cpp
libomptarget/test/offloading/target_nowait_target.cpp
libomptarget/test/offloading/taskloop_offload_nowait.cpp
libomptarget/test/offloading/test_libc.cpp
libomptarget/test/ompt/veccopy.c
libomptarget/test/ompt/veccopy_disallow_both.c
libomptarget/test/ompt/veccopy_emi.c
libomptarget/test/ompt/veccopy_emi_map.c
libomptarget/test/ompt/veccopy_map.c
libomptarget/test/ompt/veccopy_no_device_init.c
libomptarget/test/ompt/veccopy_wrong_return.c
libomptarget/test/api/is_initial_device.c
libomptarget/test/mapping/declare_mapper_nested_default_mappers_array_subscript.cpp
libomptarget/test/mapping/declare_mapper_nested_default_mappers_ptr_subscript.cpp
libomptarget/test/mapping/declare_mapper_nested_default_mappers_var.cpp
libomptarget/test/mapping/target_pointers_members_map.cpp
libomptarget/test/api/omp_dynamic_shared_memory_mixed.c
libomptarget/test/api/omp_env_vars.c
libomptarget/test/api/omp_get_mapped_ptr.c
libomptarget/test/api/omp_get_num_devices.c
libomptarget/test/api/omp_get_num_devices_with_empty_target.c
libomptarget/test/mapping/alloc_fail.c
libomptarget/test/mapping/array_section_use_device_ptr.c
libomptarget/test/mapping/declare_mapper_nested_default_mappers.cpp
libomptarget/test/mapping/declare_mapper_nested_mappers.cpp
libomptarget/test/mapping/declare_mapper_target_update.cpp
libomptarget/test/mapping/delete_inf_refcount.c
libomptarget/test/mapping/lambda_by_value.cpp
libomptarget/test/mapping/ompx_hold/omp_target_disassociate_ptr.c
libomptarget/test/mapping/ompx_hold/struct.c
libomptarget/test/mapping/ompx_hold/target-data.c
libomptarget/test/mapping/ompx_hold/target.c
libomptarget/test/mapping/present/target.c
libomptarget/test/mapping/present/target_array_extension.c
libomptarget/test/mapping/present/target_data.c
libomptarget/test/mapping/present/target_data_array_extension.c
libomptarget/test/mapping/present/target_enter_data.c
libomptarget/test/mapping/present/target_exit_data_delete.c
libomptarget/test/mapping/present/target_exit_data_release.c
libomptarget/test/mapping/present/target_update.c
libomptarget/test/mapping/present/target_update_array_extension.c
libomptarget/test/mapping/present/zero_length_array_section.c
libomptarget/test/mapping/present/zero_length_array_section_exit.c
libomptarget/test/mapping/target_data_array_extension_at_exit.c
libomptarget/test/mapping/target_has_device_addr.c
libomptarget/test/mapping/target_implicit_partial_map.c
libomptarget/test/mapping/target_wrong_use_device_addr.c
libomptarget/test/offloading/host_as_target.c
libomptarget/test/offloading/info.c
libomptarget/test/offloading/offloading_success.c
libomptarget/test/offloading/offloading_success.cpp
libomptarget/test/offloading/wtime.c
libomptarget/test/unified_shared_memory/api.c
libomptarget/test/unified_shared_memory/associate_ptr.c
libomptarget/test/unified_shared_memory/close_enter_exit.c
libomptarget/test/unified_shared_memory/close_manual.c
libomptarget/test/unified_shared_memory/close_member.c
libomptarget/test/unified_shared_memory/close_modifier.c

View File

@ -0,0 +1,11 @@
./test/Target/LLVMIR/openmp-llvm.mlir
./test/mlir-spirv-cpu-runner/double.mlir
./test/mlir-spirv-cpu-runner/simple_add.mlir
./test/mlir-vulkan-runner/addf.mlir
./test/mlir-vulkan-runner/addi.mlir
./test/mlir-vulkan-runner/addi8.mlir
./test/mlir-vulkan-runner/mulf.mlir
./test/mlir-vulkan-runner/smul_extended.mlir
./test/mlir-vulkan-runner/subf.mlir
./test/mlir-vulkan-runner/time.mlir
./test/mlir-vulkan-runner/umul_extended.mlir

View File

@ -0,0 +1,42 @@
{ stdenv
, callPackage
, rocmUpdateScript
, llvm
, clang-unwrapped
, gtest
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildTests = false; # `invalid operands to binary expression ('std::basic_stringstream<char>' and 'const llvm::StringRef')`
targetName = "clang-tools-extra";
targetProjects = [
"clang"
"clang-tools-extra"
];
extraBuildInputs = [ gtest ];
extraCMakeFlags = [
"-DLLVM_INCLUDE_DOCS=OFF"
"-DLLVM_INCLUDE_TESTS=OFF"
"-DCLANG_INCLUDE_DOCS=OFF"
"-DCLANG_INCLUDE_TESTS=ON"
"-DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=ON"
];
extraPostInstall = ''
# Remove LLVM and Clang
for path in `find ${llvm} ${clang-unwrapped}`; do
if [ $path != ${llvm} ] && [ $path != ${clang-unwrapped} ]; then
rm -f $out''${path#${llvm}} $out''${path#${clang-unwrapped}} || true
fi
done
# Cleanup empty directories
find $out -type d -empty -delete
'';
requiredSystemFeatures = [ "big-parallel" ];
}

View File

@ -0,0 +1,73 @@
{ stdenv
, wrapCCWith
, llvm
, lld
, clang-unwrapped
, bintools
, libc
, libunwind
, libcxxabi
, libcxx
, compiler-rt
}:
wrapCCWith rec {
inherit libcxx bintools;
# We do this to avoid HIP pathing problems, and mimic a monolithic install
cc = stdenv.mkDerivation (finalAttrs: {
inherit (clang-unwrapped) version;
pname = "rocm-llvm-clang";
dontUnpack = true;
installPhase = ''
runHook preInstall
clang_version=`${clang-unwrapped}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
mkdir -p $out/{bin,include/c++/v1,lib/{cmake,clang/$clang_version/{include,lib}},libexec,share}
for path in ${llvm} ${clang-unwrapped} ${lld} ${libc} ${libunwind} ${libcxxabi} ${libcxx} ${compiler-rt}; do
cp -as $path/* $out
chmod +w $out/{*,include/c++/v1,lib/{clang/$clang_version/include,cmake}}
rm -f $out/lib/libc++.so
done
ln -s $out/lib/* $out/lib/clang/$clang_version/lib
ln -sf $out/include/* $out/lib/clang/$clang_version/include
runHook postInstall
'';
passthru.isClang = true;
});
extraPackages = [
llvm
lld
libc
libunwind
libcxxabi
compiler-rt
];
nixSupport.cc-cflags = [
"-resource-dir=$out/resource-root"
"-fuse-ld=lld"
"-rtlib=compiler-rt"
"-unwindlib=libunwind"
"-Wno-unused-command-line-argument"
];
extraBuildCommands = ''
clang_version=`${cc}/bin/clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
mkdir -p $out/resource-root
ln -s ${cc}/lib/clang/$clang_version/{include,lib} $out/resource-root
# Not sure why, but hardening seems to make things break
echo "" > $out/nix-support/add-hardening.sh
# GPU compilation uses builtin `lld`
substituteInPlace $out/bin/{clang,clang++} \
--replace "-MM) dontLink=1 ;;" "-MM | --cuda-device-only) dontLink=1 ;;''\n--cuda-host-only | --cuda-compile-host-device) dontLink=0 ;;"
'';
}

View File

@ -0,0 +1,31 @@
{ stdenv
, callPackage
, rocmUpdateScript
, clang-unwrapped
, mlir
, graphviz
, python3Packages
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
targetName = "flang";
targetDir = targetName;
extraNativeBuildInputs = [
graphviz
python3Packages.sphinx-markdown-tables
];
extraBuildInputs = [ mlir ];
extraCMakeFlags = [
"-DCLANG_DIR=${clang-unwrapped}/lib/cmake/clang"
"-DMLIR_TABLEGEN_EXE=${mlir}/bin/mlir-tblgen"
"-DCLANG_TABLEGEN_EXE=${clang-unwrapped}/bin/clang-tblgen"
"-DFLANG_INCLUDE_TESTS=OFF" # `The dependency target "Bye" of target ...`
];
# `flang/lib/Semantics/check-omp-structure.cpp:1905:1: error: no member named 'v' in 'Fortran::parser::OmpClause::OmpxDynCgroupMem'`
isBroken = true;
}

View File

@ -0,0 +1,36 @@
{ stdenv
, callPackage
, rocmUpdateScript
, llvm
, clang
, spirv-llvm-translator
}:
let
spirv = (spirv-llvm-translator.override { inherit llvm; });
in callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildDocs = false; # No documentation to build
buildMan = false; # No man pages to build
targetName = "libclc";
targetDir = targetName;
extraBuildInputs = [ spirv ];
# `spirv-mesa3d` isn't compiling with LLVM 15.0.0, it does with LLVM 14.0.0
# Try removing the `spirv-mesa3d` and `clspv` patches next update
# `clspv` tests fail, unresolved calls
extraPostPatch = ''
substituteInPlace CMakeLists.txt \
--replace "find_program( LLVM_CLANG clang PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \
"find_program( LLVM_CLANG clang PATHS \"${clang}/bin\" NO_DEFAULT_PATH )" \
--replace "find_program( LLVM_SPIRV llvm-spirv PATHS \''${LLVM_BINDIR} NO_DEFAULT_PATH )" \
"find_program( LLVM_SPIRV llvm-spirv PATHS \"${spirv}/bin\" NO_DEFAULT_PATH )" \
--replace " spirv-mesa3d-" "" \
--replace " spirv64-mesa3d-" "" \
--replace "NOT \''${t} MATCHES" \
"NOT \''${ARCH} STREQUAL \"clspv\" AND NOT \''${ARCH} STREQUAL \"clspv64\" AND NOT \''${t} MATCHES"
'';
checkTargets = [ ];
isBroken = true; # ROCm 5.7.0 doesn't have IR/AttributeMask.h yet...?
}

View File

@ -0,0 +1,39 @@
{ stdenv
, callPackage
, rocmUpdateScript
, clang
, xz
, swig
, lua5_3
, graphviz
, gtest
, python3Packages
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildTests = false; # FIXME: Bad pathing for clang executable in tests, using relative path most likely
targetName = "lldb";
targetDir = targetName;
extraNativeBuildInputs = [ python3Packages.sphinx-automodapi ];
extraBuildInputs = [
xz
swig
lua5_3
graphviz
gtest
];
extraCMakeFlags = [
"-DLLDB_EXTERNAL_CLANG_RESOURCE_DIR=${clang}/resource-root/lib/clang/$clang_version"
"-DLLDB_INCLUDE_TESTS=ON"
"-DLLDB_INCLUDE_UNITTESTS=ON"
];
extraPostPatch = ''
export clang_version=`clang -v 2>&1 | grep "clang version " | grep -E -o "[0-9.-]+"`
'';
checkTargets = [ "check-${targetName}" ];
}

View File

@ -0,0 +1,57 @@
{ stdenv
, callPackage
, rocmUpdateScript
, clr
, vulkan-headers
, vulkan-loader
, glslang
, shaderc
, lit
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildDocs = false; # No decent way to hack this to work
buildMan = false; # No man pages to build
targetName = "mlir";
targetDir = targetName;
# Fix `DebugTranslation.cpp:139:10: error: no matching function for call to 'get'`
# We patch at a different source root, so we modify the patch and include it locally
# https://github.com/RadeonOpenCompute/llvm-project/commit/f1d1e10ec7e1061bf0b90abbc1e298d9438a5e74.patch
extraPatches = [ ./0000-mlir-fix-debugtranslation.patch ];
extraNativeBuildInputs = [ clr ];
extraBuildInputs = [
vulkan-headers
vulkan-loader
glslang
shaderc
];
extraCMakeFlags = [
"-DMLIR_INCLUDE_DOCS=ON"
"-DMLIR_INCLUDE_TESTS=ON"
"-DMLIR_ENABLE_ROCM_RUNNER=ON"
"-DMLIR_ENABLE_SPIRV_CPU_RUNNER=ON"
"-DMLIR_ENABLE_VULKAN_RUNNER=ON"
"-DROCM_TEST_CHIPSET=gfx000" # CPU runner
];
extraPostPatch = ''
# `add_library cannot create target "llvm_gtest" because an imported target with the same name already exists`
substituteInPlace CMakeLists.txt \
--replace "EXISTS \''${UNITTEST_DIR}/googletest/include/gtest/gtest.h" "FALSE"
# Mainly `No such file or directory`
cat ${./1001-mlir-failing-tests.list} | xargs -d \\n rm
'';
extraPostInstall = ''
mkdir -p $out/bin
mv bin/mlir-tblgen $out/bin
'';
checkTargets = [ "check-${targetName}" ];
requiredSystemFeatures = [ "big-parallel" ];
}

View File

@ -0,0 +1,54 @@
{ lib
, stdenv
, callPackage
, rocmUpdateScript
, llvm
, clang
, clang-unwrapped
, rocm-device-libs
, rocm-runtime
, rocm-thunk
, perl
, elfutils
, libdrm
, numactl
, lit
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
targetName = "openmp";
targetDir = targetName;
extraNativeBuildInputs = [ perl ];
extraBuildInputs = [
rocm-device-libs
rocm-runtime
rocm-thunk
elfutils
libdrm
numactl
];
extraCMakeFlags = [
"-DCMAKE_MODULE_PATH=/build/source/llvm/cmake/modules" # For docs
"-DCLANG_TOOL=${clang}/bin/clang"
"-DCLANG_OFFLOAD_BUNDLER_TOOL=${clang-unwrapped}/bin/clang-offload-bundler"
"-DPACKAGER_TOOL=${clang-unwrapped}/bin/clang-offload-packager"
"-DOPENMP_LLVM_TOOLS_DIR=${llvm}/bin"
"-DOPENMP_LLVM_LIT_EXECUTABLE=${lit}/bin/.lit-wrapped"
"-DDEVICELIBS_ROOT=${rocm-device-libs.src}"
];
extraPostPatch = ''
# We can't build this target at the moment
substituteInPlace libomptarget/DeviceRTL/CMakeLists.txt \
--replace "gfx1010" ""
# No idea what's going on here...
cat ${./1000-openmp-failing-tests.list} | xargs -d \\n rm
'';
checkTargets = [ "check-${targetName}" ];
extraLicenses = [ lib.licenses.mit ];
}

View File

@ -0,0 +1,18 @@
{ stdenv
, callPackage
, rocmUpdateScript
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
targetName = "polly";
targetDir = targetName;
extraPostPatch = ''
# `add_library cannot create target "llvm_gtest" because an imported target with the same name already exists`
substituteInPlace CMakeLists.txt \
--replace "NOT TARGET gtest" "FALSE"
'';
checkTargets = [ "check-${targetName}" ];
}

View File

@ -0,0 +1,15 @@
{ stdenv
, callPackage
, rocmUpdateScript
}:
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildDocs = false; # No documentation to build
buildMan = false; # No man pages to build
buildTests = false; # Too many errors
targetName = "pstl";
targetDir = "runtimes";
targetRuntimes = [ targetName ];
checkTargets = [ "check-${targetName}" ];
}

View File

@ -5,11 +5,12 @@
, pkg-config , pkg-config
, cmake , cmake
, rocm-cmake , rocm-cmake
, hip , clr
, clang-tools-extra , clang-tools-extra
, openmp , openmp
, rocblas , rocblas
, rocmlir , rocmlir
, composable_kernel
, miopengemm , miopengemm
, miopen , miopen
, protobuf , protobuf
@ -19,6 +20,8 @@
, sqlite , sqlite
, oneDNN_2 , oneDNN_2
, blaze , blaze
, cppcheck
, rocm-device-libs
, texlive , texlive
, doxygen , doxygen
, sphinx , sphinx
@ -46,7 +49,7 @@ let
}; };
in stdenv.mkDerivation (finalAttrs: { in stdenv.mkDerivation (finalAttrs: {
pname = "migraphx"; pname = "migraphx";
version = "5.4.3"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -60,14 +63,14 @@ in stdenv.mkDerivation (finalAttrs: {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "AMDMIGraphX"; repo = "AMDMIGraphX";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-UDhm+j9qs4Rk81C1PE4kkacytfY2StYbfsCOtFL+p6s="; hash = "sha256-7yL7Zn5I8GUPIAgB7tVLZI7OEHLv0E4FcLVx9xMfsNY=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config pkg-config
cmake cmake
rocm-cmake rocm-cmake
hip clr
clang-tools-extra clang-tools-extra
python3Packages.python python3Packages.python
] ++ lib.optionals buildDocs [ ] ++ lib.optionals buildDocs [
@ -84,6 +87,7 @@ in stdenv.mkDerivation (finalAttrs: {
openmp openmp
rocblas rocblas
rocmlir rocmlir
composable_kernel
miopengemm miopengemm
miopen miopen
protobuf protobuf
@ -93,18 +97,16 @@ in stdenv.mkDerivation (finalAttrs: {
sqlite sqlite
oneDNN_2 oneDNN_2
blaze blaze
cppcheck
python3Packages.pybind11 python3Packages.pybind11
python3Packages.onnx python3Packages.onnx
]; ];
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_POLICY_DEFAULT_CMP0079=NEW" "-DMIGRAPHX_ENABLE_GPU=ON"
# "-DCMAKE_C_COMPILER=hipcc"
# "-DCMAKE_CXX_COMPILER=hipcc"
"-DMIGRAPHX_ENABLE_GPU=OFF" # GPU compilation is broken, don't know why
"-DMIGRAPHX_ENABLE_CPU=ON" "-DMIGRAPHX_ENABLE_CPU=ON"
"-DMIGRAPHX_ENABLE_FPGA=ON" "-DMIGRAPHX_ENABLE_FPGA=ON"
"-DMIGRAPHX_ENABLE_MLIR=ON" "-DMIGRAPHX_ENABLE_MLIR=OFF" # LLVM or rocMLIR mismatch?
# Manually define CMAKE_INSTALL_<DIR> # Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838 # See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_BINDIR=bin"
@ -113,10 +115,20 @@ in stdenv.mkDerivation (finalAttrs: {
]; ];
postPatch = '' postPatch = ''
# We need to not use hipcc and define the CXXFLAGS manually due to `undefined hidden symbol: tensorflow:: ...`
export CXXFLAGS+="--rocm-path=${clr} --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode"
patchShebangs tools patchShebangs tools
# `error: '__clang_hip_runtime_wrapper.h' file not found [clang-diagnostic-error]`
substituteInPlace CMakeLists.txt \
--replace "set(MIGRAPHX_TIDY_ERRORS ALL)" ""
# JIT library was removed from composable_kernel...
# https://github.com/ROCmSoftwarePlatform/composable_kernel/issues/782
substituteInPlace src/targets/gpu/CMakeLists.txt \ substituteInPlace src/targets/gpu/CMakeLists.txt \
--replace "CMAKE_CXX_COMPILER MATCHES \".*clang\\\+\\\+\$\"" "TRUE" --replace " COMPONENTS jit_library" "" \
--replace " composable_kernel::jit_library" "" \
--replace "if(WIN32)" "if(TRUE)"
'' + lib.optionalString (!buildDocs) '' '' + lib.optionalString (!buildDocs) ''
substituteInPlace CMakeLists.txt \ substituteInPlace CMakeLists.txt \
--replace "add_subdirectory(doc)" "" --replace "add_subdirectory(doc)" ""
@ -155,6 +167,6 @@ in stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -0,0 +1,240 @@
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, rocmUpdateScript
, runCommand
, pkg-config
, cmake
, rocm-cmake
, rocblas
, rocmlir
, clr
, clang-tools-extra
, clang-ocl
, miopengemm
, composable_kernel
, frugally-deep
, rocm-docs-core
, half
, boost
, sqlite
, bzip2
, lbzip2
, nlohmann_json
, texlive
, doxygen
, sphinx
, zlib
, gtest
, rocm-comgr
, python3Packages
, buildDocs ? false # Needs internet because of rocm-docs-core
, buildTests ? false
, useOpenCL ? false
}:
let
version = "5.7.0";
src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "MIOpen";
rev = "rocm-${version}";
hash = "sha256-xcKmFI8HcRA9bbh6EQGElKykIQ3RJX/q5f4IxXvM1Is=";
fetchLFS = true;
leaveDotGit = true;
# If you're reading this, it's gonna take a bit of time.
# fetchSubModules doesn't work with postFetch???
# fetchLFS isn't actually fetching the LFS files...
postFetch = ''
export HOME=$(mktemp -d)
cd $out
# We need more history to fetch LFS files
git remote add origin $url
git fetch origin
git clean -fdx
git checkout rocm-${version}
# We need to do this manually since using leaveDotGit and fetchSubmodules errors
git submodule update --init
# Fetch the LFS files
git lfs install
git lfs fetch --all
git lfs checkout
# Remove the defunct .git folder
rm -rf .git
'';
};
latex = lib.optionalAttrs buildDocs texlive.combine {
inherit (texlive) scheme-small
latexmk
tex-gyre
fncychap
wrapfig
capt-of
framed
needspace
tabulary
varwidth
titlesec;
};
gfx900 = runCommand "miopen-gfx900.kdb" { preferLocalBuild = true; } ''
${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx900.kdb.bz2 > $out
'';
gfx906 = runCommand "miopen-gfx906.kdb" { preferLocalBuild = true; } ''
${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx906.kdb.bz2 > $out
'';
gfx908 = runCommand "miopen-gfx908.kdb" { preferLocalBuild = true; } ''
${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx908.kdb.bz2 > $out
'';
gfx90a = runCommand "miopen-gfx90a.kdb" { preferLocalBuild = true; } ''
${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx90a.kdb.bz2 > $out
'';
gfx1030 = runCommand "miopen-gfx1030.kdb" { preferLocalBuild = true; } ''
${lbzip2}/bin/lbzip2 -ckd ${src}/src/kernels/gfx1030.kdb.bz2 > $out
'';
in stdenv.mkDerivation (finalAttrs: {
inherit version src;
pname = "miopen";
# Find zstd and add to target. Mainly for torch.
patches = [
(fetchpatch {
url = "https://github.com/ROCmSoftwarePlatform/MIOpen/commit/e608b4325646afeabb5e52846997b926d2019d19.patch";
hash = "sha256-oxa3qlIC2bzbwGxrQOZXoY/S7CpLsMrnWRB7Og0tk0M=";
})
(fetchpatch {
url = "https://github.com/ROCmSoftwarePlatform/MIOpen/commit/3413d2daaeb44b7d6eadcc03033a5954a118491e.patch";
hash = "sha256-ST4snUcTmmSI1Ogx815KEX9GdMnmubsavDzXCGJkiKs=";
})
];
outputs = [
"out"
] ++ lib.optionals buildDocs [
"doc"
] ++ lib.optionals buildTests [
"test"
];
nativeBuildInputs = [
pkg-config
cmake
rocm-cmake
clr
clang-tools-extra
];
buildInputs = [
rocblas
rocmlir
clang-ocl
miopengemm
composable_kernel
half
boost
sqlite
bzip2
nlohmann_json
frugally-deep
] ++ lib.optionals buildDocs [
latex
doxygen
sphinx
rocm-docs-core
python3Packages.sphinx-rtd-theme
python3Packages.breathe
python3Packages.myst-parser
] ++ lib.optionals buildTests [
zlib
];
cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-Wno-#warnings" # <half> -> <half/half.hpp>
"-DMIOPEN_USE_MIOPENGEMM=ON"
"-DUNZIPPER=${bzip2}/bin/bunzip2"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals (!useOpenCL) [
"-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc"
"-DMIOPEN_BACKEND=HIP"
] ++ lib.optionals useOpenCL [
"-DMIOPEN_BACKEND=OpenCL"
] ++ lib.optionals buildTests [
"-DBUILD_TESTS=ON"
"-DMIOPEN_TEST_ALL=ON"
];
postPatch = ''
patchShebangs test src/composable_kernel fin utils install_deps.cmake
substituteInPlace CMakeLists.txt \
--replace "unpack_db(\"\''${CMAKE_SOURCE_DIR}/src/kernels/\''${FILE_NAME}.kdb.bz2\")" "" \
--replace "MIOPEN_HIP_COMPILER MATCHES \".*clang\\\\+\\\\+$\"" "true" \
--replace "set(MIOPEN_TIDY_ERRORS ALL)" "" # error: missing required key 'key'
substituteInPlace test/gtest/CMakeLists.txt \
--replace "include(googletest)" ""
ln -sf ${gfx900} src/kernels/gfx900.kdb
ln -sf ${gfx906} src/kernels/gfx906.kdb
ln -sf ${gfx908} src/kernels/gfx908.kdb
ln -sf ${gfx90a} src/kernels/gfx90a.kdb
ln -sf ${gfx1030} src/kernels/gfx1030.kdb
'';
# Unfortunately, it seems like we have to call make on these manually
postBuild = lib.optionalString buildDocs ''
python -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html
'' + lib.optionalString buildTests ''
make -j$NIX_BUILD_CORES check
'';
postInstall = ''
rm $out/bin/install_precompiled_kernels.sh
ln -sf ${gfx900} $out/share/miopen/db/gfx900.kdb
ln -sf ${gfx906} $out/share/miopen/db/gfx906.kdb
ln -sf ${gfx908} $out/share/miopen/db/gfx908.kdb
ln -sf ${gfx90a} $out/share/miopen/db/gfx90a.kdb
ln -sf ${gfx1030} $out/share/miopen/db/gfx1030.kdb
'' + lib.optionalString buildDocs ''
mv ../doc/html $out/share/doc/miopen-${if useOpenCL then "opencl" else "hip"}
'' + lib.optionalString buildTests ''
mkdir -p $test/bin
mv bin/test_* $test/bin
patchelf --set-rpath $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++
[ clr rocm-comgr ])} $test/bin/*
'';
requiredSystemFeatures = [ "big-parallel" ];
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
meta = with lib; {
description = "Machine intelligence library for ROCm";
homepage = "https://github.com/ROCmSoftwarePlatform/MIOpen";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})

View File

@ -4,7 +4,8 @@
, rocmUpdateScript , rocmUpdateScript
, cmake , cmake
, rocm-cmake , rocm-cmake
, rocm-opencl-runtime , clr
, clblast
, texlive , texlive
, doxygen , doxygen
, sphinx , sphinx
@ -31,7 +32,7 @@ let
}; };
in stdenv.mkDerivation (finalAttrs: { in stdenv.mkDerivation (finalAttrs: {
pname = "miopengemm"; pname = "miopengemm";
version = "5.4.3"; version = "5.5.0";
outputs = [ outputs = [
"out" "out"
@ -53,11 +54,10 @@ in stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
rocm-cmake rocm-cmake
clr
]; ];
buildInputs = [ buildInputs = lib.optionals buildDocs [
rocm-opencl-runtime
] ++ lib.optionals buildDocs [
latex latex
doxygen doxygen
sphinx sphinx
@ -65,6 +65,9 @@ in stdenv.mkDerivation (finalAttrs: {
python3Packages.breathe python3Packages.breathe
] ++ lib.optionals buildTests [ ] ++ lib.optionals buildTests [
openblas openblas
] ++ lib.optionals buildBenchmarks [
clblast
python3Packages.openai-triton
]; ];
cmakeFlags = [ cmakeFlags = [
@ -77,10 +80,8 @@ in stdenv.mkDerivation (finalAttrs: {
"-DOPENBLAS=ON" "-DOPENBLAS=ON"
] ++ lib.optionals buildBenchmarks [ ] ++ lib.optionals buildBenchmarks [
"-DAPI_BENCH_MIOGEMM=ON" "-DAPI_BENCH_MIOGEMM=ON"
# Needs https://github.com/CNugteren/CLBlast "-DAPI_BENCH_CLBLAST=ON"
# "-DAPI_BENCH_CLBLAST=ON" "-DAPI_BENCH_ISAAC=ON"
# Needs https://github.com/openai/triton
# "-DAPI_BENCH_ISAAC=ON"
]; ];
# Unfortunately, it seems like we have to call make on these manually # Unfortunately, it seems like we have to call make on these manually
@ -118,6 +119,8 @@ in stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; # They are not making tags or releases, this may break other derivations in the future
# Use version major instead of minor, 6.0 will HOPEFULLY have a release or tag
broken = versions.major finalAttrs.version != versions.major stdenv.cc.version;
}; };
}) })

View File

@ -5,15 +5,18 @@
, cmake , cmake
, rocm-cmake , rocm-cmake
, rocm-smi , rocm-smi
, hip , clr
, perl
, hipify
, gtest , gtest
, chrpath , chrpath
, buildTests ? false , buildTests ? false
, gpuTargets ? [ ]
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "rccl"; pname = "rccl";
version = "5.4.3"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -25,13 +28,15 @@ stdenv.mkDerivation (finalAttrs: {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "rccl"; repo = "rccl";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-hQTzaiPMo5FAVScmxV0iNhy80uJ1xvx/kzlbfwROOs4="; hash = "sha256-Abrwmsjnkx9JVTrARP/BM965g+R10lY+XPwthy/SG0k=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
rocm-cmake rocm-cmake
hip clr
perl
hipify
]; ];
buildInputs = [ buildInputs = [
@ -42,22 +47,25 @@ stdenv.mkDerivation (finalAttrs: {
]; ];
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc"
"-DBUILD_BFD=OFF" # Can't get it to detect bfd.h
# Manually define CMAKE_INSTALL_<DIR> # Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838 # See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include" "-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals (gpuTargets != [ ]) [
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
] ++ lib.optionals buildTests [ ] ++ lib.optionals buildTests [
"-DBUILD_TESTS=ON" "-DBUILD_TESTS=ON"
]; ];
# Replace the manually set parallel jobs to NIX_BUILD_CORES
postPatch = '' postPatch = ''
patchShebangs src tools
# Really strange behavior, `#!/usr/bin/env perl` should work...
substituteInPlace CMakeLists.txt \ substituteInPlace CMakeLists.txt \
--replace "8 P" "$NIX_BUILD_CORES P" \ --replace "\''$ \''${hipify-perl_executable}" "${perl}/bin/perl ${hipify}/bin/hipify-perl"
--replace "8)" "$NIX_BUILD_CORES)"
''; '';
postInstall = lib.optionalString buildTests '' postInstall = lib.optionalString buildTests ''
@ -78,6 +86,6 @@ stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ bsd2 bsd3 ]; license = with licenses; [ bsd2 bsd3 ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -41,7 +41,7 @@ let
}; };
in stdenv.mkDerivation (finalAttrs: { in stdenv.mkDerivation (finalAttrs: {
pname = "rdc"; pname = "rdc";
version = "5.4.2"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -55,7 +55,7 @@ in stdenv.mkDerivation (finalAttrs: {
owner = "RadeonOpenCompute"; owner = "RadeonOpenCompute";
repo = "rdc"; repo = "rdc";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-dYacqkRp+zVejo/4dME1K6EN8t/1EBtIynEQ+AQ4JZo="; hash = "sha256-xZD/WI/LfNtKK9j6ZjuU0OTTFZz3G4atyD5mVcSsQ8A=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@ -120,6 +120,7 @@ in stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor rocm-smi.version; # broken = versions.minor finalAttrs.version != versions.minor rocm-smi.version;
broken = true; # Too many errors, unsure how to fix
}; };
}) })

View File

@ -8,7 +8,7 @@
, rocsparse , rocsparse
, rocprim , rocprim
, rocrand , rocrand
, hip , clr
, git , git
, openmp , openmp
, openmpi , openmpi
@ -21,7 +21,7 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "rocalution"; pname = "rocalution";
version = "5.4.3"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -37,13 +37,13 @@ stdenv.mkDerivation (finalAttrs: {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "rocALUTION"; repo = "rocALUTION";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-jovhodhNa7tr1bSqpZCKI/9xF7Ie96JB+giqAEfis2k="; hash = "sha256-+UGpFuZsC4+kmo8LWZWC2YoFJSdTukjN47e1YqW5Zu4=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
rocm-cmake rocm-cmake
hip clr
git git
]; ];
@ -60,8 +60,8 @@ stdenv.mkDerivation (finalAttrs: {
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_CXX_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc"
"-DROCM_PATH=${hip}" "-DROCM_PATH=${clr}"
"-DHIP_ROOT_DIR=${hip}" "-DHIP_ROOT_DIR=${clr}"
"-DSUPPORT_HIP=ON" "-DSUPPORT_HIP=ON"
"-DSUPPORT_OMP=ON" "-DSUPPORT_OMP=ON"
"-DSUPPORT_MPI=ON" "-DSUPPORT_MPI=ON"
@ -92,7 +92,7 @@ stdenv.mkDerivation (finalAttrs: {
rm $sample/bin/rocalution-bench || true rm $sample/bin/rocalution-bench || true
patchelf --set-rpath \ patchelf --set-rpath \
$out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ [ hip ])} \ $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ [ clr ])} \
$sample/bin/* $sample/bin/*
'' + lib.optionalString (buildTests || buildBenchmarks) '' '' + lib.optionalString (buildTests || buildBenchmarks) ''
rmdir $out/bin rmdir $out/bin
@ -110,6 +110,6 @@ stdenv.mkDerivation (finalAttrs: {
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = teams.rocm.members; maintainers = teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -0,0 +1,200 @@
{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, runCommand
, cmake
, rocm-cmake
, clr
, python3
, tensile
, msgpack
, libxml2
, gtest
, gfortran
, openmp
, amd-blis
, python3Packages
, buildTensile ? true
, buildTests ? false
, buildBenchmarks ? false
, tensileLogic ? "asm_full"
, tensileCOVersion ? "default"
, tensileSepArch ? true
, tensileLazyLib ? true
, tensileLibFormat ? "msgpack"
, gpuTargets ? [ "all" ]
}:
let
rocblas = stdenv.mkDerivation (finalAttrs: {
pname = "rocblas";
version = "5.7.0";
outputs = [
"out"
] ++ lib.optionals buildTests [
"test"
] ++ lib.optionals buildBenchmarks [
"benchmark"
];
src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "rocBLAS";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-3wKnwvAra8u9xqlC05wUD+gSoBILTVJFU2cIV6xv3Lk=";
};
nativeBuildInputs = [
cmake
rocm-cmake
clr
];
buildInputs = [
python3
] ++ lib.optionals buildTensile [
msgpack
libxml2
python3Packages.msgpack
python3Packages.joblib
] ++ lib.optionals buildTests [
gtest
] ++ lib.optionals (buildTests || buildBenchmarks) [
gfortran
openmp
amd-blis
] ++ lib.optionals (buildTensile || buildTests || buildBenchmarks) [
python3Packages.pyyaml
];
cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc"
"-Dpython=python3"
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
"-DBUILD_WITH_TENSILE=${if buildTensile then "ON" else "OFF"}"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals buildTensile [
"-DVIRTUALENV_HOME_DIR=/build/source/tensile"
"-DTensile_TEST_LOCAL_PATH=/build/source/tensile"
"-DTensile_ROOT=/build/source/tensile/lib/python${python3.pythonVersion}/site-packages/Tensile"
"-DTensile_LOGIC=${tensileLogic}"
"-DTensile_CODE_OBJECT_VERSION=${tensileCOVersion}"
"-DTensile_SEPARATE_ARCHITECTURES=${if tensileSepArch then "ON" else "OFF"}"
"-DTensile_LAZY_LIBRARY_LOADING=${if tensileLazyLib then "ON" else "OFF"}"
"-DTensile_LIBRARY_FORMAT=${tensileLibFormat}"
] ++ lib.optionals buildTests [
"-DBUILD_CLIENTS_TESTS=ON"
] ++ lib.optionals buildBenchmarks [
"-DBUILD_CLIENTS_BENCHMARKS=ON"
] ++ lib.optionals (buildTests || buildBenchmarks) [
"-DCMAKE_CXX_FLAGS=-I${amd-blis}/include/blis"
];
# Tensile REALLY wants to write to the nix directory if we include it normally
postPatch = lib.optionalString buildTensile ''
cp -a ${tensile} tensile
chmod +w -R tensile
# Rewrap Tensile
substituteInPlace tensile/bin/{.t*,.T*,*} \
--replace "${tensile}" "/build/source/tensile"
substituteInPlace CMakeLists.txt \
--replace "include(virtualenv)" "" \
--replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" ""
'';
postInstall = lib.optionalString buildTests ''
mkdir -p $test/bin
cp -a $out/bin/* $test/bin
rm $test/bin/*-bench || true
'' + lib.optionalString buildBenchmarks ''
mkdir -p $benchmark/bin
cp -a $out/bin/* $benchmark/bin
rm $benchmark/bin/*-test || true
'' + lib.optionalString (buildTests || buildBenchmarks ) ''
rm -rf $out/bin
'';
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
requiredSystemFeatures = [ "big-parallel" ];
meta = with lib; {
description = "BLAS implementation for ROCm platform";
homepage = "https://github.com/ROCmSoftwarePlatform/rocBLAS";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
});
gfx80 = runCommand "rocblas-gfx80" { preferLocalBuild = true; } ''
mkdir -p $out/lib/rocblas/library
cp -a ${rocblas}/lib/rocblas/library/*gfx80* $out/lib/rocblas/library
'';
gfx90 = runCommand "rocblas-gfx90" { preferLocalBuild = true; } ''
mkdir -p $out/lib/rocblas/library
cp -a ${rocblas}/lib/rocblas/library/*gfx90* $out/lib/rocblas/library
'';
gfx94 = runCommand "rocblas-gfx94" { preferLocalBuild = true; } ''
mkdir -p $out/lib/rocblas/library
cp -a ${rocblas}/lib/rocblas/library/*gfx94* $out/lib/rocblas/library
'';
gfx10 = runCommand "rocblas-gfx10" { preferLocalBuild = true; } ''
mkdir -p $out/lib/rocblas/library
cp -a ${rocblas}/lib/rocblas/library/*gfx10* $out/lib/rocblas/library
'';
gfx11 = runCommand "rocblas-gfx11" { preferLocalBuild = true; } ''
mkdir -p $out/lib/rocblas/library
cp -a ${rocblas}/lib/rocblas/library/*gfx11* $out/lib/rocblas/library
'';
in stdenv.mkDerivation (finalAttrs: {
inherit (rocblas) pname version src passthru meta;
outputs = [
"out"
] ++ lib.optionals buildTests [
"test"
] ++ lib.optionals buildBenchmarks [
"benchmark"
];
dontUnpack = true;
dontPatch = true;
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out
cp -a --no-preserve=mode ${rocblas}/* $out
ln -sf ${gfx80}/lib/rocblas/library/* $out/lib/rocblas/library
ln -sf ${gfx90}/lib/rocblas/library/* $out/lib/rocblas/library
ln -sf ${gfx94}/lib/rocblas/library/* $out/lib/rocblas/library
ln -sf ${gfx10}/lib/rocblas/library/* $out/lib/rocblas/library
ln -sf ${gfx11}/lib/rocblas/library/* $out/lib/rocblas/library
'' + lib.optionalString buildTests ''
cp -a ${rocblas.test} $test
'' + lib.optionalString buildBenchmarks ''
cp -a ${rocblas.benchmark} $benchmark
'' + ''
runHook postInstall
'';
})

View File

@ -7,6 +7,7 @@
, git , git
, rocm-comgr , rocm-comgr
, rocm-runtime , rocm-runtime
, hwdata
, texlive , texlive
, doxygen , doxygen
, graphviz , graphviz
@ -37,7 +38,7 @@ let
}; };
in stdenv.mkDerivation (finalAttrs: { in stdenv.mkDerivation (finalAttrs: {
pname = "rocdbgapi"; pname = "rocdbgapi";
version = "5.4.2"; version = "5.7.0";
outputs = [ outputs = [
"out" "out"
@ -49,7 +50,7 @@ in stdenv.mkDerivation (finalAttrs: {
owner = "ROCm-Developer-Tools"; owner = "ROCm-Developer-Tools";
repo = "ROCdbgapi"; repo = "ROCdbgapi";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-KoFa6JzoEPT5/ns9X/hMfu8bOh29HD9n2qGJ3gzhiBA="; hash = "sha256-qMXvgcS61lgcylz62ErYq8fhpYIR31skQEeKUryuP1w=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@ -65,6 +66,16 @@ in stdenv.mkDerivation (finalAttrs: {
buildInputs = [ buildInputs = [
rocm-comgr rocm-comgr
rocm-runtime rocm-runtime
hwdata
];
cmakeFlags = [
"-DPCI_IDS_PATH=${hwdata}/share/hwdata"
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
]; ];
# Unfortunately, it seems like we have to call make on this manually # Unfortunately, it seems like we have to call make on this manually

View File

@ -4,7 +4,7 @@
, fetchFromGitHub , fetchFromGitHub
, rocmUpdateScript , rocmUpdateScript
, cmake , cmake
, hip , clr
, python3 , python3
, rocm-cmake , rocm-cmake
, sqlite , sqlite
@ -14,118 +14,42 @@
, gtest , gtest
, openmp , openmp
, rocrand , rocrand
# NOTE: Update the default GPU targets on every update , gpuTargets ? [ ]
, gpuTargets ? [
"gfx803"
"gfx900"
"gfx906"
"gfx908"
"gfx90a"
"gfx1030"
"gfx1100"
"gfx1102"
]
}: }:
let
# To avoid output limit exceeded errors in hydra, we build kernel
# device libs and the kernel RTC cache database in separate derivations
kernelDeviceLibs = map
(target:
(rocfft.overrideAttrs (prevAttrs: {
pname = "rocfft-device-${target}";
patches = prevAttrs.patches ++ [
# Add back install rule for device library
# This workaround is needed because rocm_install_targets
# doesn't support an EXCLUDE_FROM_ALL option
./device-install.patch
];
buildFlags = [ "rocfft-device-${target}" ];
installPhase = ''
runHook preInstall
cmake --install . --component device
runHook postInstall
'';
requiredSystemFeatures = [ "big-parallel" ];
})).override {
gpuTargets = [ target ];
}
)
gpuTargets;
# TODO: Figure out how to also split this by GPU target
#
# It'll be bit more complicated than what we're doing for the kernel
# device libs, because the kernel cache needs to be compiled into
# one sqlite database (whereas the device libs can be linked into
# rocfft as separate libraries for each GPU target).
#
# It's not clear why this needs to even be a db in the first place.
# It would simplify things A LOT if we could just store these
# pre-compiled kernels as files (but that'd need a lot of patching).
kernelRtcCache = rocfft.overrideAttrs (_: {
pname = "rocfft-kernel-cache";
buildFlags = [ "rocfft_kernel_cache_target" ];
installPhase = ''
runHook preInstall
cmake --install . --component kernel_cache
runHook postInstall
'';
requiredSystemFeatures = [ "big-parallel" ];
});
in
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "rocfft"; pname = "rocfft";
version = "5.4.3"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform"; owner = "ROCmSoftwarePlatform";
repo = "rocFFT"; repo = "rocFFT";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-FsefE0B2hF5ZcHDB6TscwFeZ1NKFkWX7VDpEvvbDbOk="; hash = "sha256-GZSi03geTT+NUztBWhGYyghLqJGsFjUQzVAKQ7d03uA=";
}; };
patches = [
# Exclude kernel compilation & installation from "all" target,
# and split device libraries by GPU target
./split-kernel-compilation.patch
];
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
hip clr
python3 python3
rocm-cmake rocm-cmake
]; ];
buildInputs = [ buildInputs = [ sqlite ];
sqlite
] ++ lib.optionals (finalAttrs.pname == "rocfft") kernelDeviceLibs;
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc" "-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc" "-DCMAKE_CXX_COMPILER=hipcc"
"-DUSE_HIP_CLANG=ON"
"-DSQLITE_USE_SYSTEM_PACKAGE=ON" "-DSQLITE_USE_SYSTEM_PACKAGE=ON"
# Manually define CMAKE_INSTALL_<DIR> # Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838 # See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin" "-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include" "-DCMAKE_INSTALL_INCLUDEDIR=include"
] ++ lib.optionals (gpuTargets != [ ]) [
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
]; ];
postInstall = lib.optionalString (finalAttrs.pname == "rocfft") ''
ln -s ${kernelRtcCache}/lib/rocfft_kernel_cache.db "$out/lib"
'';
passthru = { passthru = {
test = stdenv.mkDerivation { test = stdenv.mkDerivation {
pname = "${finalAttrs.pname}-test"; pname = "${finalAttrs.pname}-test";
@ -135,7 +59,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
hip clr
rocm-cmake rocm-cmake
]; ];
@ -168,7 +92,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
hip clr
rocm-cmake rocm-cmake
]; ];
@ -201,7 +125,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
hip clr
rocm-cmake rocm-cmake
]; ];
@ -232,12 +156,14 @@ stdenv.mkDerivation (finalAttrs: {
}; };
}; };
requiredSystemFeatures = [ "big-parallel" ];
meta = with lib; { meta = with lib; {
description = "FFT implementation for ROCm"; description = "FFT implementation for ROCm";
homepage = "https://github.com/ROCmSoftwarePlatform/rocFFT"; homepage = "https://github.com/ROCmSoftwarePlatform/rocFFT";
license = with licenses; [ mit ]; license = with licenses; [ mit ];
maintainers = with maintainers; [ kira-bruneau ] ++ teams.rocm.members; maintainers = with maintainers; [ kira-bruneau ] ++ teams.rocm.members;
platforms = platforms.linux; platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor hip.version; broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
}; };
}) })

View File

@ -15,13 +15,13 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "rocgdb"; pname = "rocgdb";
version = "5.4.2"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ROCm-Developer-Tools"; owner = "ROCm-Developer-Tools";
repo = "ROCgdb"; repo = "ROCgdb";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-DORPvfon32+rIk+YcO9LlUefNvvC7trmiTswg9MMuIs="; hash = "sha256-TlT7vvTrVd7P6ilVnWIG5VIrjTleFgDezK/mudBV+xE=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -7,13 +7,13 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "rocm-cmake"; pname = "rocm-cmake";
version = "5.4.4"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "RadeonOpenCompute"; owner = "RadeonOpenCompute";
repo = "rocm-cmake"; repo = "rocm-cmake";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-JarQqiiZ36WV1d6vyQD546GN1EtoKLcdvcZsG3QWD2Y="; hash = "sha256-aVjzuJ4BiSfwOdjufFc5CznfnL8di5h992zl+pzD0DU=";
}; };
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
@ -22,6 +22,8 @@ stdenv.mkDerivation (finalAttrs: {
name = finalAttrs.pname; name = finalAttrs.pname;
owner = finalAttrs.src.owner; owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo; repo = finalAttrs.src.repo;
page = "releases?per_page=2";
filter = ".[1].tag_name | split(\"-\") | .[1]";
}; };
meta = with lib; { meta = with lib; {

View File

@ -15,16 +15,15 @@ let
else throw "Unsupported ROCm LLVM platform"; else throw "Unsupported ROCm LLVM platform";
in stdenv.mkDerivation (finalAttrs: { in stdenv.mkDerivation (finalAttrs: {
pname = "rocm-comgr"; pname = "rocm-comgr";
version = "5.4.4"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "RadeonOpenCompute"; owner = "RadeonOpenCompute";
repo = "ROCm-CompilerSupport"; repo = "ROCm-CompilerSupport";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-qLsrBTeSop7lIQv8gZDwgpvGZJOAq90zsvMi1QpfbAs="; hash = "sha256-QB3G0V92UTW67hD6+zSuExN1+eMT820iYSlMyZeWSFw=";
}; };
patches = [ ./cmake.patch ];
sourceRoot = "${finalAttrs.src.name}/lib/comgr"; sourceRoot = "${finalAttrs.src.name}/lib/comgr";
nativeBuildInputs = [ nativeBuildInputs = [

View File

@ -0,0 +1,36 @@
{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, cmake
}:
stdenv.mkDerivation (finalAttrs: {
pname = "rocm-core";
version = "5.7.0";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "rocm-core";
rev = "rocm-${finalAttrs.version}";
hash = "sha256-jFAHLqf/AR27Nbuq8aypWiKqApNcTgG5LWESVjVCKIg=";
};
nativeBuildInputs = [ cmake ];
cmakeFlags = [ "-DROCM_VERSION=${finalAttrs.version}" ];
passthru.updateScript = rocmUpdateScript {
name = finalAttrs.pname;
owner = finalAttrs.src.owner;
repo = finalAttrs.src.repo;
};
meta = with lib; {
description = "Utility for getting the ROCm release version";
homepage = "https://github.com/RadeonOpenCompute/rocm-core";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
};
})

View File

@ -14,13 +14,13 @@ let
else throw "Unsupported ROCm LLVM platform"; else throw "Unsupported ROCm LLVM platform";
in stdenv.mkDerivation (finalAttrs: { in stdenv.mkDerivation (finalAttrs: {
pname = "rocm-device-libs"; pname = "rocm-device-libs";
version = "5.4.4"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "RadeonOpenCompute"; owner = "RadeonOpenCompute";
repo = "ROCm-Device-Libs"; repo = "ROCm-Device-Libs";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-8gxvgy2GlROxM5qKtZVu5Lxa1FmTIVlBTpfp8rxhNhk="; hash = "sha256-f6/LAhJ2mBDO1/JloHvl7MJyDo3WutbXd4IDknA9nzM=";
}; };
patches = [ ./cmake.patch ]; patches = [ ./cmake.patch ];

View File

@ -0,0 +1,65 @@
{ lib
, stdenv
, fetchFromGitHub
, gitUpdater
, buildPythonPackage
, setuptools
, beautifulsoup4
, gitpython
, pydata-sphinx-theme
, pygithub
, sphinx
, breathe
, myst-parser
, sphinx-book-theme
, sphinx-copybutton
, sphinx-design
, sphinx-external-toc
, sphinx-notfound-page
, pyyaml
, fastjsonschema
}:
buildPythonPackage rec {
pname = "rocm-docs-core";
version = "0.25.0";
format = "pyproject";
src = fetchFromGitHub {
owner = "RadeonOpenCompute";
repo = "rocm-docs-core";
rev = "v${version}";
hash = "sha256-kOsoIK0vaPT60hGr960s5vc0eloSr5CECtd8Dy24YuM=";
};
buildInputs = [ setuptools ];
propagatedBuildInputs = [
beautifulsoup4
gitpython
pydata-sphinx-theme
pygithub
sphinx
breathe
myst-parser
sphinx-book-theme
sphinx-copybutton
sphinx-design
sphinx-external-toc
sphinx-notfound-page
pyyaml
fastjsonschema
];
pythonImportsCheck = [ "rocm_docs" ];
passthru.updateScript = gitUpdater { rev-prefix = "v"; };
meta = with lib; {
description = "ROCm Documentation Python package for ReadTheDocs build standardization";
homepage = "https://github.com/RadeonOpenCompute/rocm-docs-core";
license = with licenses; [ mit cc-by-40 ];
maintainers = teams.rocm.members;
platforms = platforms.linux;
};
}

View File

@ -16,13 +16,13 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "rocm-runtime"; pname = "rocm-runtime";
version = "5.4.3"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "RadeonOpenCompute"; owner = "RadeonOpenCompute";
repo = "ROCR-Runtime"; repo = "ROCR-Runtime";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-JkTXTQmdESHSFbA6HZdMK3pYEApz9aoAlMzdXayzdyY="; hash = "sha256-D7Ahan5cxDhqPtV5iDDNys0A4FlxQ9oVRa2EeMoY5Qk=";
}; };
sourceRoot = "${finalAttrs.src.name}/src"; sourceRoot = "${finalAttrs.src.name}/src";
@ -50,8 +50,10 @@ stdenv.mkDerivation (finalAttrs: {
--replace 'hsa/include/hsa' 'include/hsa' --replace 'hsa/include/hsa' 'include/hsa'
# We compile clang before rocm-device-libs, so patch it in afterwards # We compile clang before rocm-device-libs, so patch it in afterwards
# Replace object version: https://github.com/RadeonOpenCompute/ROCR-Runtime/issues/166 (TODO: Remove on LLVM update?)
substituteInPlace image/blit_src/CMakeLists.txt \ substituteInPlace image/blit_src/CMakeLists.txt \
--replace '-cl-denorms-are-zero' '-cl-denorms-are-zero --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode' --replace '-cl-denorms-are-zero' '-cl-denorms-are-zero --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode' \
--replace '-mcode-object-version=4' '-mcode-object-version=5'
''; '';
fixupPhase = '' fixupPhase = ''

View File

@ -8,25 +8,33 @@
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "rocm-smi"; pname = "rocm-smi";
version = "5.4.4"; version = "5.7.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "RadeonOpenCompute"; owner = "RadeonOpenCompute";
repo = "rocm_smi_lib"; repo = "rocm_smi_lib";
rev = "rocm-${finalAttrs.version}"; rev = "rocm-${finalAttrs.version}";
hash = "sha256-nkidiDNNU6MGhne9EbYClkODJZw/zZu3LWzlniJKyJE="; hash = "sha256-swCRO4PBMBJ6fO2bLq/xxFZIYw2IgiFB490wsU8Wm2o=";
}; };
postPatch = ''
sed '1i#include <cstring>' -i src/rocm_smi{,_gpu_metrics}.cc # since gcc12 probably
'';
nativeBuildInputs = [ cmake wrapPython ];
patches = [ ./cmake.patch ]; patches = [ ./cmake.patch ];
nativeBuildInputs = [
cmake
wrapPython
];
cmakeFlags = [
# Manually define CMAKE_INSTALL_<DIR>
# See: https://github.com/NixOS/nixpkgs/pull/197838
"-DCMAKE_INSTALL_BINDIR=bin"
"-DCMAKE_INSTALL_LIBDIR=lib"
"-DCMAKE_INSTALL_INCLUDEDIR=include"
];
postInstall = '' postInstall = ''
wrapPythonProgramsIn $out wrapPythonProgramsIn $out
mv $out/libexec/rocm_smi/.rsmiBindings.py-wrapped $out/libexec/rocm_smi/rsmiBindings.py
''; '';
passthru.updateScript = rocmUpdateScript { passthru.updateScript = rocmUpdateScript {

Some files were not shown because too many files have changed in this diff Show More