about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/rocm-modules/5/rocprofiler/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-10-31 22:19:45 +0100
committerAlyssa Ross <hi@alyssa.is>2023-10-31 22:19:45 +0100
commit78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc (patch)
treefd9cfb92edfaa37c919be8d24063b8a6c6d94c83 /nixpkgs/pkgs/development/rocm-modules/5/rocprofiler/default.nix
parent7e0c8fe656bbc2fcbdfc3e03a367d2c6ff389769 (diff)
parent0cbe9f69c234a7700596e943bfae7ef27a31b735 (diff)
downloadnixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar
nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.gz
nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.bz2
nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.lz
nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.xz
nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.tar.zst
nixlib-78ba0c65b7bf9a64c12ca8c08f2e0220afdc8dbc.zip
Merge commit '0cbe9f69c234a7700596e943bfae7ef27a31b735' into HEAD
Diffstat (limited to 'nixpkgs/pkgs/development/rocm-modules/5/rocprofiler/default.nix')
-rw-r--r--nixpkgs/pkgs/development/rocm-modules/5/rocprofiler/default.nix80
1 files changed, 54 insertions, 26 deletions
diff --git a/nixpkgs/pkgs/development/rocm-modules/5/rocprofiler/default.nix b/nixpkgs/pkgs/development/rocm-modules/5/rocprofiler/default.nix
index c77014b50cfd..c66c56a64eb8 100644
--- a/nixpkgs/pkgs/development/rocm-modules/5/rocprofiler/default.nix
+++ b/nixpkgs/pkgs/development/rocm-modules/5/rocprofiler/default.nix
@@ -2,11 +2,16 @@
 , stdenv
 , fetchFromGitHub
 , rocmUpdateScript
+, symlinkJoin
+, substituteAll
 , cmake
 , clang
 , clr
+, rocm-core
 , rocm-thunk
+, rocm-device-libs
 , roctracer
+, rocdbgapi
 , rocm-smi
 , hsa-amd-aqlprofile-bin
 , numactl
@@ -14,24 +19,32 @@
 , libxml2
 , elfutils
 , mpi
+, systemd
 , gtest
 , python3Packages
-, gpuTargets ? [
-  "gfx900"
-  "gfx906"
-  "gfx908"
-  "gfx90a"
-  "gfx940"
-  "gfx941"
-  "gfx942"
-  "gfx1030"
-  "gfx1100"
-  "gfx1101"
-  "gfx1102"
-]
+, gpuTargets ? clr.gpuTargets
 }:
 
-stdenv.mkDerivation (finalAttrs: {
+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: {
   pname = "rocprofiler";
   version = "5.7.1";
 
@@ -42,6 +55,17 @@ stdenv.mkDerivation (finalAttrs: {
     hash = "sha256-1s/7C9y+73ADLF/17Vepw0pZNVtYnKoP24GdwKc9X2Y=";
   };
 
+  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;
+    })
+  ];
+
   nativeBuildInputs = [
     cmake
     clang
@@ -53,20 +77,19 @@ stdenv.mkDerivation (finalAttrs: {
   ];
 
   buildInputs = [
-    rocm-thunk
-    rocm-smi
-    hsa-amd-aqlprofile-bin
     numactl
     libpciaccess
     libxml2
     elfutils
     mpi
+    systemd
     gtest
   ];
 
+  propagatedBuildInputs = [ rocmtoolkit-merged ];
+
   cmakeFlags = [
     "-DCMAKE_MODULE_PATH=${clr}/lib/cmake/hip"
-    "-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext"
     "-DHIP_ROOT_DIR=${clr}"
     "-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
     # Manually define CMAKE_INSTALL_<DIR>
@@ -79,16 +102,21 @@ stdenv.mkDerivation (finalAttrs: {
   postPatch = ''
     patchShebangs .
 
-    # Cannot find ROCm device library, pointless
-    substituteInPlace CMakeLists.txt \
-      --replace "add_subdirectory(tests-v2)" "" \
-      --replace "add_subdirectory(samples)" ""
+    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"
   '';
 
-  postBuild = ''
-    # HSACO aren't being built for some reason
-    substituteInPlace test/cmake_install.cmake \
-      --replace "file(INSTALL DESTINATION \"\''${CMAKE_INSTALL_PREFIX}/share/rocprofiler/tests-v1\" TYPE FILE FILES \"" "message(\""
+  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
   '';
 
   passthru.updateScript = rocmUpdateScript {