Unverified Commit c59bda0a authored by Masum Reza's avatar Masum Reza Committed by GitHub
Browse files

rocmPackages.rocblas: remove reference to tensile in librocblas, split outputs (#458711)

parents c785298f 9a22a291
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -26,8 +26,6 @@ let
    {
      inherit rocmClangStdenv;
      stdenv = rocmClangStdenv;
      buildTests = false;
      buildBenchmarks = false;

      rocmUpdateScript = self.callPackage ./update.nix { };

+37 −9
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
  cmake,
  rocm-cmake,
  clr,
  diffutils,
  python3,
  tensile,
  boost,
@@ -24,9 +25,10 @@
  python3Packages,
  rocm-smi,
  pkg-config,
  removeReferencesTo,
  buildTensile ? true,
  buildTests ? false,
  buildBenchmarks ? false,
  buildTests ? true,
  buildBenchmarks ? true,
  tensileSepArch ? true,
  tensileLazyLib ? true,
  withHipBlasLt ? true,
@@ -47,6 +49,8 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-FCzo/BOk4xLEFkdOdqcCXh4a9t3/OIIBEy8oz6oOMWg=";
  };

  outputs = [ "out" ] ++ lib.optional buildBenchmarks "benchmark" ++ lib.optional buildTests "test";

  nativeBuildInputs = [
    cmake
    # no ninja, it buffers console output and nix times out long periods of no output
@@ -54,6 +58,7 @@ stdenv.mkDerivation (finalAttrs: {
    clr
    gitMinimal
    pkg-config
    removeReferencesTo
  ]
  ++ lib.optionals buildTensile [
    tensile
@@ -76,10 +81,8 @@ stdenv.mkDerivation (finalAttrs: {
    python3Packages.msgpack
    python3Packages.zstandard
  ]
  ++ lib.optionals buildTests [
    gtest
  ]
  ++ lib.optionals (buildTests || buildBenchmarks) [
    gtest
    gfortran
    rocm-smi
  ]
@@ -146,14 +149,39 @@ stdenv.mkDerivation (finalAttrs: {
    substituteInPlace CMakeLists.txt \
      --replace-fail "4.43.0" "4.44.0" \
      --replace-fail '0.10' '1.0'
  ''
  # Fixes sh: line 1: /usr/bin/diff: No such file or directory
  # /build/source/clients/gtest/../include/testing_logging.hpp:1117: Failure
  + lib.optionals buildTests ''
    substituteInPlace clients/include/testing_logging.hpp \
      --replace-fail "/usr/bin/diff" "${lib.getExe' diffutils "diff"}"
  '';

  postInstall =
    # tensile isn't needed at runtime and pulls in ~400MB of python deps
    ''
      remove-references-to -t ${tensile} \
        "$out/lib/librocblas.so."*
    ''
    + lib.optionalString buildBenchmarks ''
      moveToOutput "bin/*-tune" "$benchmark"
      moveToOutput "bin/*-bench" "$benchmark"
      moveToOutput "bin/*example*" "$benchmark"
      cp "$out/bin/"*.{yaml,txt} "$benchmark/bin"
    ''
    + lib.optionalString buildTests ''
      moveToOutput "bin/*test*" "$test"
      cp "$out/bin/"*.{yaml,txt} "$test/bin"
    ''
    + ''
      if [ -d $out/bin ]; then
        rm $out/bin/*.{yaml,txt} || true
        rmdir $out/bin
      fi
    '';

  passthru = {
    amdgpu_targets = gpuTargets';
    tests.rocblas-tests = finalAttrs.finalPackage.override {
      buildBenchmarks = true;
      buildTests = true;
    };
    updateScript = rocmUpdateScript {
      name = finalAttrs.pname;
      inherit (finalAttrs.src) owner;