PR #35670: [ROCm] Fix invalid rocm_distro argument

Imported from GitHub PR https://github.com/openxla/xla/pull/35670

📝 Summary of Changes
Fix regression in hermetic rocm builds due to an invalid argument

🎯 Justification
Fix invalid argument passed to setup rocm redist directory

🚀 Kind of Contribution
Please remove what does not apply: 🐛 Bug Fix

📊 Benchmark (for Performance Improvements)
Not relevant

🧪 Unit Tests:
Not relevant

🧪 Execution Tests:
Not relevant

Copybara import of the project:

--
fadf42fb6152b73997e988bed12afdb29b5ebc47 by Alexandros Theodoridis <atheodor@amd.com>:

Fix invalid rocm_distro argument

--
e01b84f4501eccf964b459a1562885c510465dea by Alexandros Theodoridis <atheodor@amd.com>:

Cleanup

--
4926f012009bc6a66ad7ab6596337d92df6cf8a2 by Alexandros Theodoridis <atheodor@amd.com>:

Fix malformed call to fail

--
99a8ae5d08a4d6ffe884439aced99beffd33b917 by Alexandros Theodoridis <atheodor@amd.com>:

Add debug print for downloaded files

Merging this change closes #35670

PiperOrigin-RevId: 849958226
This commit is contained in:
Alex
2025-12-29 00:51:16 -08:00
committed by TensorFlower Gardener
parent 67426a18ba
commit 720202b2ee
2 changed files with 7 additions and 8 deletions

View File

@@ -288,9 +288,7 @@ common:rocm_ci --config=rocm
common:rocm_ci_hermetic --dynamic_mode=off
common:rocm_ci_hermetic --config=rocm_clang_official
common:rocm_ci_hermetic --repo_env="ROCM_DISTRO_URL=https://therock-nightly-tarball.s3.amazonaws.com/therock-dist-linux-gfx94X-dcgpu-7.10.0a20251107.tar.gz"
common:rocm_ci_hermetic --repo_env="ROCM_DISTRO_HASH=486dbf647bcf9b78f21d7477f43addc7b2075b1a322a119045db9cdc5eb98380"
common:rocm_ci_hermetic --repo_env="ROCM_DISTRO_LINKS=llvm/amdgcn:amdgcn"
common:rocm_ci_hermetic --repo_env="ROCM_DISTRO_VERSION=rocm_7.10.0_gfx90X"
common:rocm_ci_hermetic --@local_config_rocm//rocm:rocm_path_type=hermetic
# This config option is used for SYCL as GPU backend.

View File

@@ -527,6 +527,7 @@ def _get_file_name(url):
def _download_package(repository_ctx, pkg):
file_name = _get_file_name(pkg["url"])
print("Downloading {}".format(pkg["url"]))
repository_ctx.report_progress("Downloading and extracting {}, expected hash is {}".format(pkg["url"], pkg["sha256"])) # buildifier: disable=print
repository_ctx.download_and_extract(
url = pkg["url"],
@@ -569,17 +570,17 @@ def _setup_rocm_distro_dir(repository_ctx):
if rocm_distro_url:
rocm_distro_hash = repository_ctx.os.environ.get(_ROCM_DISTRO_HASH)
if not rocm_distro_hash:
fail("{} environment variable is required", _ROCM_DISTRO_HASH)
fail("{} environment variable is required".format(_ROCM_DISTRO_HASH))
rocm_distro_links = repository_ctx.os.environ.get(_ROCM_DISTRO_LINKS, "")
rocm_distro = create_rocm_distro(rocm_distro_url, rocm_distro_hash, rocm_distro_links)
return _setup_rocm_distro_dir_impl(repository_ctx, rocm_distro)
rocm_distro = repository_ctx.os.environ.get(_ROCM_DISTRO_VERSION)
multiple_paths = repository_ctx.os.environ.get(_TF_ROCM_MULTIPLE_PATHS)
if rocm_distro:
redist = rocm_redist[rocm_distro]
return _setup_rocm_distro_dir_impl(repository_ctx, rocm_distro)
elif multiple_paths:
return _setup_rocm_distro_dir_impl(repository_ctx, rocm_redist[rocm_distro])
multiple_paths = repository_ctx.os.environ.get(_TF_ROCM_MULTIPLE_PATHS)
if multiple_paths:
paths_list = multiple_paths.split(":")
for rocm_custom_path in paths_list:
cmd = "find " + rocm_custom_path + "/* \\( -type f -o -type l \\)"