py-tensorflow: change py-tensorflow@2.16-rocm-enhanced to use tarball instead of branch (#45218)
* change py-tensorflow@2.16-rocm-enhanced to use tarball instead of branch * remove revert_fd6b0a4.patch and use github commit patch url
This commit is contained in:
		| @@ -1,97 +0,0 @@ | |||||||
| From 765f49b0bc5503ee82280a48aaa4a065dcd8ae6c Mon Sep 17 00:00:00 2001 |  | ||||||
| From: Afzal Patel <Afzal.Patel@amd.com> |  | ||||||
| Date: Mon, 24 Jun 2024 09:31:26 +0000 |  | ||||||
| Subject: [PATCH] add rocm components lib paths |  | ||||||
|  |  | ||||||
| --- |  | ||||||
|  .../clang/bin/crosstool_wrapper_driver_rocm.tpl   | 15 +++++++++++++++ |  | ||||||
|  third_party/gpus/rocm_configure.bzl               |  7 ++++++- |  | ||||||
|  .../tsl/tsl/platform/default/rocm_rocdl_path.cc   |  7 ++++++- |  | ||||||
|  .../gpu/llvm_gpu_backend/gpu_backend_lib.cc       |  4 ++-- |  | ||||||
|  4 files changed, 29 insertions(+), 4 deletions(-) |  | ||||||
|  |  | ||||||
| diff --git a/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl b/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl |  | ||||||
| index 6cc91e19..17d0ad83 100755 |  | ||||||
| --- a/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl |  | ||||||
| +++ b/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl |  | ||||||
| @@ -31,6 +31,11 @@ HIP_RUNTIME_PATH = '%{hip_runtime_path}' |  | ||||||
|  HIP_RUNTIME_LIBRARY = '%{hip_runtime_library}' |  | ||||||
|  ROCR_RUNTIME_PATH = '%{rocr_runtime_path}' |  | ||||||
|  ROCR_RUNTIME_LIBRARY = '%{rocr_runtime_library}' |  | ||||||
| +RCCL_RUNTIME_PATH = '%{rccl_runtime_path}' |  | ||||||
| +MIOPEN_RUNTIME_PATH = '%{miopen_runtime_path}' |  | ||||||
| +ROCBLAS_RUNTIME_PATH = '%{rocblas_runtime_path}' |  | ||||||
| +HIPFFT_RUNTIME_PATH = '%{hipfft_runtime_path}' |  | ||||||
| +ROCRAND_RUNTIME_PATH = '%{rocrand_runtime_path}' |  | ||||||
|  VERBOSE = '%{crosstool_verbose}'=='1' |  | ||||||
|  CPU_COMPILER_IS_CLANG = '%{crosstool_clang}'=='1' |  | ||||||
|  |  | ||||||
| @@ -258,6 +263,16 @@ def main(): |  | ||||||
|      gpu_linker_flags.append('-L' + HIP_RUNTIME_PATH) |  | ||||||
|      gpu_linker_flags.append('-Wl,-rpath=' + HIP_RUNTIME_PATH) |  | ||||||
|      gpu_linker_flags.append('-l' + HIP_RUNTIME_LIBRARY) |  | ||||||
| +    gpu_linker_flags.append('-L' + RCCL_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-Wl,-rpath=' + RCCL_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-L' + ROCBLAS_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-Wl,-rpath=' + ROCBLAS_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-L' + MIOPEN_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-Wl,-rpath=' + MIOPEN_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-L' + ROCRAND_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-Wl,-rpath=' + ROCRAND_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-L' + HIPFFT_RUNTIME_PATH) |  | ||||||
| +    gpu_linker_flags.append('-Wl,-rpath=' + HIPFFT_RUNTIME_PATH) |  | ||||||
|      gpu_linker_flags.append("-lrt") |  | ||||||
|      gpu_linker_flags.append("-lstdc++") |  | ||||||
|  |  | ||||||
| diff --git a/third_party/gpus/rocm_configure.bzl b/third_party/gpus/rocm_configure.bzl |  | ||||||
| index 6eb17486..7ab931f5 100644 |  | ||||||
| --- a/third_party/gpus/rocm_configure.bzl |  | ||||||
| +++ b/third_party/gpus/rocm_configure.bzl |  | ||||||
| @@ -746,7 +746,12 @@ def _create_local_rocm_repository(repository_ctx): |  | ||||||
|              "%{rocr_runtime_library}": "hsa-runtime64", |  | ||||||
|              "%{hip_runtime_path}": rocm_config.rocm_toolkit_path + "/lib", |  | ||||||
|              "%{hip_runtime_library}": "amdhip64", |  | ||||||
| -            "%{crosstool_verbose}": _crosstool_verbose(repository_ctx), |  | ||||||
| +            "%{rccl_runtime_path}": rocm_config.rocm_paths["RCCL"] + "/lib", |  | ||||||
| +           "%{rocblas_runtime_path}": rocm_config.rocm_paths["ROCBLAS"] + "/lib", |  | ||||||
| +           "%{miopen_runtime_path}": rocm_config.rocm_paths["MIOPEN"] + "/lib", |  | ||||||
| +           "%{hipfft_runtime_path}": rocm_config.rocm_paths["HIPFFT"] + "/lib", |  | ||||||
| +           "%{rocrand_runtime_path}": rocm_config.rocm_paths["ROCRAND"] + "/lib", |  | ||||||
| +           "%{crosstool_verbose}": _crosstool_verbose(repository_ctx), |  | ||||||
|              "%{gcc_host_compiler_path}": str(cc), |  | ||||||
|              "%{crosstool_clang}": "1" if _is_clang_enabled(repository_ctx) else "0", |  | ||||||
|          }, |  | ||||||
| diff --git a/third_party/xla/third_party/tsl/tsl/platform/default/rocm_rocdl_path.cc b/third_party/xla/third_party/tsl/tsl/platform/default/rocm_rocdl_path.cc |  | ||||||
| index a1f3eba2..ae411688 100644 |  | ||||||
| --- a/third_party/xla/third_party/tsl/tsl/platform/default/rocm_rocdl_path.cc |  | ||||||
| +++ b/third_party/xla/third_party/tsl/tsl/platform/default/rocm_rocdl_path.cc |  | ||||||
| @@ -40,6 +40,11 @@ string RocmRoot() { |  | ||||||
|  #endif |  | ||||||
|  } |  | ||||||
|  |  | ||||||
| -string RocdlRoot() { return io::JoinPath(RocmRoot(), "amdgcn/bitcode"); } |  | ||||||
| +string RocdlRoot() { |  | ||||||
| +  if (const char* device_lib_path_env = std::getenv("HIP_DEVICE_LIB_PATH")) { |  | ||||||
| +   return device_lib_path_env; |  | ||||||
| +  else{ |  | ||||||
| +   return io::JoinPath(RocmRoot(), "amdgcn/bitcode"); |  | ||||||
| +} |  | ||||||
|  |  | ||||||
|  }  // namespace tsl |  | ||||||
| diff --git a/third_party/xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc b/third_party/xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc |  | ||||||
| index 8a5f2c2d..ec951099 100644 |  | ||||||
| --- a/third_party/xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc |  | ||||||
| +++ b/third_party/xla/xla/service/gpu/llvm_gpu_backend/gpu_backend_lib.cc |  | ||||||
| @@ -771,8 +771,8 @@ absl::StatusOr<std::vector<uint8_t>> EmitModuleToHsaco( |  | ||||||
|    } |  | ||||||
|    // Locate lld. |  | ||||||
|    std::string lld_path; |  | ||||||
| -  if (std::getenv("ROCM_PATH")) { |  | ||||||
| -       lld_path = tsl::io::JoinPath(std::getenv("ROCM_PATH"), "llvm/bin"); |  | ||||||
| +  if (std::getenv("LLVM_PATH")) { |  | ||||||
| +       lld_path = tsl::io::JoinPath(std::getenv("LLVM_PATH"), "bin"); |  | ||||||
|    } |  | ||||||
|    else { |  | ||||||
|         lld_path = tsl::io::JoinPath("/opt/rocm", "llvm/bin"); |  | ||||||
| -- |  | ||||||
| 2.25.1 |  | ||||||
| @@ -49,8 +49,8 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension): | |||||||
|     version("2.16.1", sha256="c729e56efc945c6df08efe5c9f5b8b89329c7c91b8f40ad2bb3e13900bd4876d") |     version("2.16.1", sha256="c729e56efc945c6df08efe5c9f5b8b89329c7c91b8f40ad2bb3e13900bd4876d") | ||||||
|     version( |     version( | ||||||
|         "2.16-rocm-enhanced", |         "2.16-rocm-enhanced", | ||||||
|         git="https://github.com/ROCm/tensorflow-upstream.git", |         sha256="6765e85675734b8fe17bca3c0669aec2f9ee97699b413780bcf3c6f00661ce72", | ||||||
|         branch="r2.16-rocm-enhanced", |         url="https://github.com/ROCm/tensorflow-upstream/archive/refs/tags/r2.16-rocm-enhanced.tar.gz", | ||||||
|     ) |     ) | ||||||
|     version("2.15.1", sha256="f36416d831f06fe866e149c7cd752da410a11178b01ff5620e9f265511ed57cf") |     version("2.15.1", sha256="f36416d831f06fe866e149c7cd752da410a11178b01ff5620e9f265511ed57cf") | ||||||
|     version("2.15.0", sha256="9cec5acb0ecf2d47b16891f8bc5bc6fbfdffe1700bdadc0d9ebe27ea34f0c220") |     version("2.15.0", sha256="9cec5acb0ecf2d47b16891f8bc5bc6fbfdffe1700bdadc0d9ebe27ea34f0c220") | ||||||
| @@ -418,6 +418,13 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension): | |||||||
|     # and https://github.com/abseil/abseil-cpp/issues/1665 |     # and https://github.com/abseil/abseil-cpp/issues/1665 | ||||||
|     patch("absl_neon.patch", when="@2.16.1: target=aarch64:") |     patch("absl_neon.patch", when="@2.16.1: target=aarch64:") | ||||||
| 
 | 
 | ||||||
|  |     # reverting change otherwise the c467913 commit patch won't apply | ||||||
|  |     patch( | ||||||
|  |         "https://github.com/ROCm/tensorflow-upstream/commit/fd6b0a4356c66f5f30cedbc62b24f18d9e32806f.patch?full_index=1", | ||||||
|  |         sha256="43f1519dfc618b4fb568f760d559c063234248fa12c47a35c1cf3b7114756424", | ||||||
|  |         when="@2.16-rocm-enhanced +rocm", | ||||||
|  |         reverse=True, | ||||||
|  |     ) | ||||||
|     patch( |     patch( | ||||||
|         "https://github.com/ROCm/tensorflow-upstream/commit/c467913bf4411ce2681391f37a9adf6031d23c2c.patch?full_index=1", |         "https://github.com/ROCm/tensorflow-upstream/commit/c467913bf4411ce2681391f37a9adf6031d23c2c.patch?full_index=1", | ||||||
|         sha256="82554a84d19d99180a6bec274c6106dd217361e809b446e2e4bc4b6b979bdf7a", |         sha256="82554a84d19d99180a6bec274c6106dd217361e809b446e2e4bc4b6b979bdf7a", | ||||||
| @@ -428,7 +435,11 @@ class PyTensorflow(Package, CudaPackage, ROCmPackage, PythonExtension): | |||||||
|         sha256="a4c0fd62a0af3ba113c8933fa531dd17fa6667e507202a144715cd87fbdaf476", |         sha256="a4c0fd62a0af3ba113c8933fa531dd17fa6667e507202a144715cd87fbdaf476", | ||||||
|         when="@2.16-rocm-enhanced: +rocm", |         when="@2.16-rocm-enhanced: +rocm", | ||||||
|     ) |     ) | ||||||
|     patch("Add_ROCm_lib_paths.patch", when="@2.16-rocm-enhanced +rocm") |     patch( | ||||||
|  |         "https://github.com/ROCm/tensorflow-upstream/commit/8b7fcccb2914078737689347540cb79ace579bbb.patch?full_index=1", | ||||||
|  |         sha256="75a61a79ce3aae51fda920f677f4dc045374b20e25628626eb37ca19c3a3b4c4", | ||||||
|  |         when="@2.16-rocm-enhanced +rocm", | ||||||
|  |     ) | ||||||
|     phases = ["configure", "build", "install"] |     phases = ["configure", "build", "install"] | ||||||
| 
 | 
 | ||||||
|     # https://www.tensorflow.org/install/source |     # https://www.tensorflow.org/install/source | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 afzpatel
					afzpatel