Skip to content

Fix ROCm index URLs dropping the parent-directory hop - #8446

Merged
atalman merged 1 commit into
pytorch:mainfrom
atalman:atalman/fix-rocm-index-urls
Aug 5, 2026
Merged

Fix ROCm index URLs dropping the parent-directory hop#8446
atalman merged 1 commit into
pytorch:mainfrom
atalman:atalman/fix-rocm-index-urls

Conversation

@atalman

@atalman atalman commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Follow-up to #8436. The ROCm indices it generates point at URLs that do not
exist. From
whl/nightly/rocm7.14/rocm-sdk-device-gfx1010/:

<a href="https://repo.amd.com/rocm/whl-multi-arch/rocm-sdk-device-gfx1010/rocm_sdk_device_gfx1010-7.13.0-py3-none-linux_x86_64.whl">

AMD serves a per-package index at whl-multi-arch/<package>/, but stores the
wheels flat in whl-multi-arch/:

URL result
.../whl-multi-arch/rocm-sdk-device-gfx1010/rocm_sdk_device_gfx1010-7.13.0-...whl (published) 403
.../whl-multi-arch/rocm_sdk_device_gfx1010-7.13.0-...whl (actual location) 206

Every link in every ROCm package index is currently broken.

Cause

AMD's index hrefs carry the parent hop:

<a href="../rocm_sdk_device_gfx1010-7.13.0-py3-none-linux_x86_64.whl">

replace_relative_links_with_absolute() normalised them with:

url = url.lstrip("./")
url = url.lstrip("/")

str.lstrip("./") strips leading . and / characters, not a prefix, so
../x.whl collapses to x.whl, which is then concatenated onto the package
URL — silently producing the 403 path.

Fix

Resolve the href with urllib.parse.urljoin, which honours ../.

Scoped to ROCm via the existing is_amd_package(): NVIDIA
(pypi.nvidia.com/<pkg>/, plain-filename hrefs) and PyPI (absolute
files.pythonhosted.org hrefs) do not use ../ and keep the existing code
path, so their generated indices are unchanged.

Test plan

Ran the real AMD index HTML for 6 ROCm packages through the patched function and
HTTP range-requested every resulting URL:

rocm                       2/2 reachable
rocm-sdk-core              4/4 reachable
rocm-sdk-libraries         4/4 reachable
rocm-sdk-device-gfx1010    4/4 reachable
rocm-sdk-device-gfx942     2/2 reachable
rocm-sdk-device-gfx90a     3/3 reachable
-------------------------------------------
TOTAL after fix           19/19 reachable
currently published        0/4 reachable

Non-ROCm paths asserted byte-identical to today's output:

index href in href out
NVIDIA x.whl#sha256=a https://pypi.nvidia.com/nvidia-cublas-cu12/x.whl#sha256=a
PyPI https://files.pythonhosted.org/... unchanged

black --check clean, flake8 clean, py_compile passes.

After merge

The published indices are regenerated by the update-s3-dependencies workflow,
so the broken links will be corrected on its next run — no manual S3/R2 cleanup
needed.

Follow-up to pytorch#8436. AMD serves a per-package index at
whl-multi-arch/<package>/ but stores the wheels flat in whl-multi-arch/, so
every href is "../<wheel>.whl".

replace_relative_links_with_absolute() normalised those with
str.lstrip("./"), which strips leading "." and "/" *characters* rather than a
prefix, so "../x.whl" collapsed to "x.whl" and was joined onto the package
URL. The published indices therefore point at
whl-multi-arch/<package>/<wheel>.whl, which returns HTTP 403:

  https://download.pytorch.org/whl/nightly/rocm7.14/rocm-sdk-device-gfx1010/

Resolve the href with urllib.parse.urljoin instead, which honours the parent
hop. Scoped to ROCm via is_amd_package(): NVIDIA and PyPI indices do not use
"../" hrefs and keep the existing code path.
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

@atalman is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 5, 2026

@huydhn huydhn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@atalman
atalman merged commit 7dea3c6 into pytorch:main Aug 5, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/rocm CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: rocm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants