Skip to content

Commit 67891c8

Browse files
committed
Re-add nvidia-cudnn-cu12 9.1.0.70 to the mirrored cudnn index
Add a RETAINED_WHEELS mechanism to re-inject wheels we still host that the upstream simple index has stopped publishing, and use it for nvidia-cudnn-cu12 9.1.0.70 on the root and cu124 indexes across nightly, test and prod.
1 parent a339e80 commit 67891c8

1 file changed

Lines changed: 67 additions & 1 deletion

File tree

s3_management/update_dependencies.py

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import re
33
import time
4-
from typing import Dict, List
4+
from typing import Dict, List, NamedTuple
55
from urllib.parse import urljoin
66

77
import boto3 # type: ignore[import-untyped]
@@ -227,6 +227,10 @@
227227
{
228228
"project": "torch",
229229
},
230+
{
231+
"project": "torch",
232+
"target": "cu124",
233+
},
230234
{
231235
"project": "torch",
232236
"target": "cu126",
@@ -919,6 +923,32 @@
919923
}
920924

921925

926+
class RetainedWheel(NamedTuple):
927+
filename: str
928+
url: str
929+
sha256: str
930+
targets: tuple[str, ...]
931+
932+
933+
# Wheels that download.pytorch.org still hosts but the upstream simple index has
934+
# stopped publishing, so mirroring alone drops them and pinned installs stop
935+
# resolving. Keyed by normalised package name; injected into the index for the
936+
# listed targets ("" is the channel root) on nightly, test and prod.
937+
RETAINED_WHEELS: Dict[str, List[RetainedWheel]] = {
938+
"nvidia_cudnn_cu12": [
939+
RetainedWheel(
940+
filename="nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl",
941+
url=(
942+
"https://download.pytorch.org/whl/cu124/"
943+
"nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl"
944+
),
945+
sha256="165764f44ef8c61fcdfdfdbe769d687e06374059fbb388b6c89ecb0e28793a6f",
946+
targets=("", "cu124"),
947+
),
948+
],
949+
}
950+
951+
922952
def is_nvidia_package(pkg_name: str) -> bool:
923953
"""Check if a package is from NVIDIA and is therefore CUDA-target only"""
924954
return pkg_name.startswith("nvidia-") or pkg_name.startswith("cuda-")
@@ -1136,6 +1166,39 @@ def append_preview_numpy_wheels(html: str, pkg_name: str, prefix: str) -> str:
11361166
return f"{html}\n{block}\n"
11371167

11381168

1169+
def append_retained_wheels(html: str, pkg_name: str, prefix: str) -> str:
1170+
"""Merge :data:`RETAINED_WHEELS` links for *pkg_name* into *html*.
1171+
1172+
The target is the last segment of *prefix* ("whl/nightly/cu124" -> "cu124",
1173+
"whl/nightly" -> ""). Wheels the upstream index still lists are skipped, so
1174+
this becomes a no-op if a version is ever restored upstream.
1175+
"""
1176+
entries = RETAINED_WHEELS.get(normalize_pkg_name(pkg_name))
1177+
if not entries:
1178+
return html
1179+
1180+
last_segment = prefix.rsplit("/", 1)[-1]
1181+
target = last_segment if is_valid_target(last_segment) else ""
1182+
1183+
additions = [
1184+
f' <a href="{entry.url}#sha256={entry.sha256}">{entry.filename}</a><br/>'
1185+
for entry in entries
1186+
if target in entry.targets and entry.filename not in html
1187+
]
1188+
1189+
if not additions:
1190+
return html
1191+
1192+
print(
1193+
f"INFO: Merging {len(additions)} retained wheel link(s) "
1194+
f"for {pkg_name} under {prefix}"
1195+
)
1196+
block = "\n".join(additions)
1197+
if "</body>" in html:
1198+
return html.replace("</body>", f"{block}\n </body>", 1)
1199+
return f"{html}\n{block}\n"
1200+
1201+
11391202
def upload_package_using_simple_index(
11401203
pkg_name: str,
11411204
prefix: str,
@@ -1168,6 +1231,9 @@ def upload_package_using_simple_index(
11681231
# published on the scientific-python nightly wheelhouse so pip can resolve them.
11691232
raw_html = append_preview_numpy_wheels(raw_html, pkg_name, prefix)
11701233

1234+
# Re-add wheels we still host that upstream has stopped publishing.
1235+
raw_html = append_retained_wheels(raw_html, pkg_name, prefix)
1236+
11711237
# Upload modified index.html with absolute links
11721238
upload_index_html(pkg_name, prefix, raw_html, source_url, dry_run=dry_run)
11731239

0 commit comments

Comments
 (0)