diff --git a/pkgs/development/libraries/rocm-runtime/default.nix b/pkgs/development/libraries/rocm-runtime/default.nix index 7470784d4896..6f573adabe13 100644 --- a/pkgs/development/libraries/rocm-runtime/default.nix +++ b/pkgs/development/libraries/rocm-runtime/default.nix @@ -1,41 +1,42 @@ { stdenv , fetchFromGitHub , addOpenGLRunpath +, clang-unwrapped , cmake +, xxd , elfutils +, llvm +, rocm-device-libs , rocm-thunk }: stdenv.mkDerivation rec { pname = "rocm-runtime"; - version = "3.5.0"; + version = "3.7.0"; src = fetchFromGitHub { owner = "RadeonOpenCompute"; repo = "ROCR-Runtime"; rev = "rocm-${version}"; - sha256 = "028x1f0if6lw41cpfpysp82ikp6c3fdxxd2a6ixs0vpm4424svb1"; + sha256 = "1lm4cbx1d727zll85vjc1kykc72mk82nfhyyhjljv82gd4mnz00c"; }; sourceRoot = "source/src"; - buildInputs = [ cmake elfutils ]; + nativeBuildInputs = [ cmake xxd ]; - cmakeFlags = [ "-DCMAKE_PREFIX_PATH=${rocm-thunk}" ]; + buildInputs = [ clang-unwrapped elfutils llvm ]; - # Use the ROCR_EXT_DIR environment variable and/or OpenGL driver - # link path to try to find binary-only ROCm runtime extension - # libraries. Without this change, we would have to rely on - # LD_LIBRARY_PATH to let the HSA runtime discover the shared - # libraries. - patchPhase = '' - substitute '${./rocr-ext-dir.diff}' ./rocr-ext-dir.diff \ - --subst-var-by rocrExtDir "${addOpenGLRunpath.driverLink}/lib/rocm-runtime-ext" - patch -p2 < ./rocr-ext-dir.diff + cmakeFlags = [ + "-DBITCODE_DIR=${rocm-device-libs}/lib" + "-DCMAKE_PREFIX_PATH=${rocm-thunk}" + ]; + + postPatch = '' + patchShebangs image/blit_src/create_hsaco_ascii_file.sh ''; fixupPhase = '' - rm -r $out/lib $out/include - mv $out/hsa/lib $out/hsa/include $out + rm -rf $out/hsa ''; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/rocm-runtime/rocr-ext-dir.diff b/pkgs/development/libraries/rocm-runtime/rocr-ext-dir.diff deleted file mode 100644 index 21ffe7d8c34a..000000000000 --- a/pkgs/development/libraries/rocm-runtime/rocr-ext-dir.diff +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/src/core/runtime/runtime.cpp b/src/core/runtime/runtime.cpp -index dd6a15c..fb6de49 100644 ---- a/src/core/runtime/runtime.cpp -+++ b/src/core/runtime/runtime.cpp -@@ -1358,7 +1358,17 @@ void Runtime::LoadExtensions() { - core::HsaApiTable::HSA_EXT_FINALIZER_API_TABLE_ID); - - // Update Hsa Api Table with handle of Image extension Apis -- extensions_.LoadImage(kImageLib[os_index(os::current_os)]); -+ // -+ // Use ROCR_EXT_DIR when it is non-empty. Otherwise, try to load the -+ // library from the OpenGL driver path. -+ std::string extDirVar = os::GetEnvVar("ROCR_EXT_DIR"); -+ if (!extDirVar.empty()) { -+ extensions_.LoadImage(extDirVar + "/" + kImageLib[os_index(os::current_os)]); -+ } else { -+ std::string globalDriverDir("@rocrExtDir@"); -+ extensions_.LoadImage(globalDriverDir + "/" + kImageLib[os_index(os::current_os)]); -+ } -+ - hsa_api_table_.LinkExts(&extensions_.image_api, - core::HsaApiTable::HSA_EXT_IMAGE_API_TABLE_ID); - } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0964ed81cb96..0ccc4d05c1a4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9354,7 +9354,9 @@ in inherit (llvmPackages_rocm) clang clang-unwrapped lld llvm; }; - rocm-runtime = callPackage ../development/libraries/rocm-runtime { }; + rocm-runtime = callPackage ../development/libraries/rocm-runtime { + inherit (llvmPackages_rocm) clang-unwrapped llvm; + }; rocm-runtime-ext = callPackage ../development/libraries/rocm-runtime-ext { };