2023-10-19 13:55:26 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, rocmUpdateScript
|
2023-11-16 04:20:00 +00:00
|
|
|
, symlinkJoin
|
|
|
|
, substituteAll
|
2023-10-19 13:55:26 +00:00
|
|
|
, cmake
|
|
|
|
, clang
|
|
|
|
, clr
|
2023-11-16 04:20:00 +00:00
|
|
|
, rocm-core
|
2023-10-19 13:55:26 +00:00
|
|
|
, rocm-thunk
|
2023-11-16 04:20:00 +00:00
|
|
|
, rocm-device-libs
|
2023-10-19 13:55:26 +00:00
|
|
|
, roctracer
|
2023-11-16 04:20:00 +00:00
|
|
|
, rocdbgapi
|
2023-10-19 13:55:26 +00:00
|
|
|
, rocm-smi
|
|
|
|
, hsa-amd-aqlprofile-bin
|
|
|
|
, numactl
|
|
|
|
, libpciaccess
|
|
|
|
, libxml2
|
|
|
|
, elfutils
|
|
|
|
, mpi
|
2023-11-16 04:20:00 +00:00
|
|
|
, systemd
|
2023-10-19 13:55:26 +00:00
|
|
|
, gtest
|
|
|
|
, python3Packages
|
2023-11-16 04:20:00 +00:00
|
|
|
, gpuTargets ? clr.gpuTargets
|
2023-10-19 13:55:26 +00:00
|
|
|
}:
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
let
|
|
|
|
rocmtoolkit-merged = symlinkJoin {
|
|
|
|
name = "rocmtoolkit-merged";
|
|
|
|
|
|
|
|
paths = [
|
|
|
|
rocm-core
|
|
|
|
rocm-thunk
|
|
|
|
rocm-device-libs
|
|
|
|
roctracer
|
|
|
|
rocdbgapi
|
|
|
|
rocm-smi
|
|
|
|
hsa-amd-aqlprofile-bin
|
|
|
|
clr
|
|
|
|
];
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
rm -rf $out/nix-support
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
2023-10-19 13:55:26 +00:00
|
|
|
pname = "rocprofiler";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "5.7.1";
|
2023-10-19 13:55:26 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2024-01-02 11:29:13 +00:00
|
|
|
owner = "ROCm";
|
2023-10-19 13:55:26 +00:00
|
|
|
repo = "rocprofiler";
|
|
|
|
rev = "rocm-${finalAttrs.version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-1s/7C9y+73ADLF/17Vepw0pZNVtYnKoP24GdwKc9X2Y=";
|
2023-10-19 13:55:26 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
# These just simply won't build
|
|
|
|
./0000-dont-install-tests-hsaco.patch
|
|
|
|
|
|
|
|
# Fix bad paths
|
|
|
|
(substituteAll {
|
|
|
|
src = ./0001-fix-shell-scripts.patch;
|
|
|
|
rocmtoolkit_merged = rocmtoolkit-merged;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
clang
|
|
|
|
clr
|
|
|
|
python3Packages.lxml
|
|
|
|
python3Packages.cppheaderparser
|
|
|
|
python3Packages.pyyaml
|
|
|
|
python3Packages.barectf
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
numactl
|
|
|
|
libpciaccess
|
|
|
|
libxml2
|
|
|
|
elfutils
|
|
|
|
mpi
|
2023-11-16 04:20:00 +00:00
|
|
|
systemd
|
2023-10-19 13:55:26 +00:00
|
|
|
gtest
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
propagatedBuildInputs = [ rocmtoolkit-merged ];
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DCMAKE_MODULE_PATH=${clr}/lib/cmake/hip"
|
|
|
|
"-DHIP_ROOT_DIR=${clr}"
|
|
|
|
"-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
|
|
|
|
# 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 .
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
substituteInPlace tests-v2/featuretests/profiler/CMakeLists.txt \
|
|
|
|
--replace "--build-id=sha1" "--build-id=sha1 --rocm-path=${clr} --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode"
|
|
|
|
|
|
|
|
substituteInPlace test/CMakeLists.txt \
|
|
|
|
--replace "\''${ROCM_ROOT_DIR}/amdgcn/bitcode" "${rocm-device-libs}/amdgcn/bitcode"
|
2023-10-19 13:55:26 +00:00
|
|
|
'';
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
postInstall = ''
|
|
|
|
# Why do these not already have the executable bit set?
|
|
|
|
chmod +x $out/lib/rocprofiler/librocprof-tool.so
|
|
|
|
chmod +x $out/share/rocprofiler/tests-v1/test/ocl/SimpleConvolution
|
|
|
|
|
|
|
|
# Why do these have the executable bit set?
|
|
|
|
chmod -x $out/libexec/rocprofiler/counters/basic_counters.xml
|
|
|
|
chmod -x $out/libexec/rocprofiler/counters/derived_counters.xml
|
2023-10-19 13:55:26 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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";
|
2024-01-02 11:29:13 +00:00
|
|
|
homepage = "https://github.com/ROCm/rocprofiler";
|
2023-10-19 13:55:26 +00:00
|
|
|
license = with licenses; [ mit ]; # mitx11
|
|
|
|
maintainers = teams.rocm.members;
|
|
|
|
platforms = platforms.linux;
|
2024-01-02 11:29:13 +00:00
|
|
|
broken = versions.minor finalAttrs.version != versions.minor clr.version || versionAtLeast finalAttrs.version "6.0.0";
|
2023-10-19 13:55:26 +00:00
|
|
|
};
|
|
|
|
})
|