Skip to content

Commit f89222e

Browse files
committed
infra: Enabling aarch64 builds
1 parent f34e667 commit f89222e

11 files changed

+444
-85
lines changed

.github/scripts/filter-matrix.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/usr/bin/env python3
2+
from typing import List
23

34
import argparse
45
import json
56
import sys
67

78
disabled_python_versions = "3.13"
9+
cpu_tag = "cpu"
810

911

10-
def main(args: list[str]) -> None:
12+
def main(args: List[str]) -> None:
1113
parser = argparse.ArgumentParser()
1214
parser.add_argument(
1315
"--matrix",
@@ -24,7 +26,8 @@ def main(args: list[str]) -> None:
2426
includes = matrix_dict["include"]
2527
filtered_includes = []
2628
for item in includes:
27-
if item["python_version"] not in disabled_python_versions:
29+
if all([item["python_version"] not in disabled_python_versions,
30+
item["desired_cuda"] != cpu_tag]):
2831
filtered_includes.append(item)
2932
filtered_matrix_dict = {}
3033
filtered_matrix_dict["include"] = filtered_includes

.github/scripts/generate_binary_build_matrix.py

+46-36
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
"""Generates a matrix to be utilized through github actions
44
5+
Important. After making changes to this file please run following command:
6+
python -m tools.tests.test_generate_binary_build_matrix --update-reference-files
7+
58
Will output a condensed version of the matrix if on a pull request that only
69
includes the latest version of python we support built on four different
710
architectures:
@@ -11,13 +14,13 @@
1114
* Latest XPU
1215
"""
1316

14-
1517
import argparse
1618
import json
1719
import os
1820
import sys
1921
from typing import Any, Callable, Dict, List, Optional, Tuple
2022

23+
2124
PYTHON_ARCHES_DICT = {
2225
"nightly": ["3.9", "3.10", "3.11", "3.12"],
2326
"test": ["3.9", "3.10", "3.11", "3.12"],
@@ -26,16 +29,30 @@
2629
CUDA_ARCHES_DICT = {
2730
"nightly": ["11.8", "12.6", "12.8"],
2831
"test": ["11.8", "12.6", "12.8"],
29-
"release": ["11.8", "12.6", "12.8"],
32+
"release": ["11.8", "12.4", "12.6"],
3033
}
3134
ROCM_ARCHES_DICT = {
32-
"nightly": ["6.1", "6.2"],
33-
"test": ["6.1", "6.2"],
34-
"release": ["6.1", "6.2"],
35+
"nightly": ["6.2.4", "6.3"],
36+
"test": ["6.2.4", "6.3"],
37+
"release": ["6.1", "6.2.4"],
38+
}
39+
40+
CUDA_CUDNN_VERSIONS = {
41+
"11.8": {"cuda": "11.8.0", "cudnn": "9"},
42+
"12.4": {"cuda": "12.4.1", "cudnn": "9"},
43+
"12.6": {"cuda": "12.6.3", "cudnn": "9"},
44+
"12.8": {"cuda": "12.8.0", "cudnn": "9"},
45+
}
46+
47+
STABLE_CUDA_VERSIONS = {
48+
"nightly": "12.6",
49+
"test": "12.6",
50+
"release": "12.4",
3551
}
3652

53+
CUDA_AARCH64_ARCHES = ["12.8-aarch64", "12.6-aarch64", "11.8-aarch64"]
54+
3755
PACKAGE_TYPES = ["wheel", "conda", "libtorch"]
38-
PRE_CXX11_ABI = "pre-cxx11"
3956
CXX11_ABI = "cxx11-abi"
4057
RELEASE = "release"
4158
DEBUG = "debug"
@@ -59,7 +76,7 @@
5976

6077
CURRENT_NIGHTLY_VERSION = "2.8.0"
6178
CURRENT_CANDIDATE_VERSION = "2.7.0"
62-
CURRENT_STABLE_VERSION = "2.7.0"
79+
CURRENT_STABLE_VERSION = "2.6.0"
6380
CURRENT_VERSION = CURRENT_STABLE_VERSION
6481

6582
# By default use Nightly for CUDA arches
@@ -94,7 +111,7 @@ def arch_type(arch_version: str) -> str:
94111
return ROCM
95112
elif arch_version == CPU_AARCH64:
96113
return CPU_AARCH64
97-
elif arch_version == CUDA_AARCH64:
114+
elif arch_version in CUDA_AARCH64_ARCHES:
98115
return CUDA_AARCH64
99116
elif arch_version == XPU:
100117
return XPU
@@ -140,11 +157,14 @@ def initialize_globals(channel: str, build_python_only: bool) -> None:
140157
else:
141158
PYTHON_ARCHES = PYTHON_ARCHES_DICT[channel]
142159
WHEEL_CONTAINER_IMAGES = {
143-
"11.8": "pytorch/manylinux2_28-builder:cuda11.8",
144-
"12.1": "pytorch/manylinux2_28-builder:cuda12.1",
145-
"12.4": "pytorch/manylinux2_28-builder:cuda12.4",
146-
"12.6": "pytorch/manylinux2_28-builder:cuda12.6",
147-
"12.8": "pytorch/manylinux2_28-builder:cuda12.8",
160+
**{
161+
gpu_arch: f"pytorch/manylinux2_28-builder:cuda{gpu_arch}"
162+
for gpu_arch in CUDA_ARCHES
163+
},
164+
**{
165+
gpu_arch: f"pytorch/manylinuxaarch64-builder:cuda{gpu_arch.replace('-aarch64', '')}"
166+
for gpu_arch in CUDA_AARCH64_ARCHES
167+
},
148168
**{
149169
gpu_arch: f"pytorch/manylinux2_28-builder:rocm{gpu_arch}"
150170
for gpu_arch in ROCM_ARCHES
@@ -153,26 +173,17 @@ def initialize_globals(channel: str, build_python_only: bool) -> None:
153173
XPU: "pytorch/manylinux2_28-builder:xpu",
154174
# TODO: Migrate CUDA_AARCH64 image to manylinux2_28_aarch64-builder:cuda12.4
155175
CPU_AARCH64: "pytorch/manylinux2_28_aarch64-builder:cpu-aarch64",
156-
CUDA_AARCH64: "pytorch/manylinuxaarch64-builder:cuda12.4",
176+
CUDA_AARCH64: "pytorch/manylinuxaarch64-builder:cuda12.6",
157177
}
158178
LIBTORCH_CONTAINER_IMAGES = {
159-
**{
160-
(gpu_arch, PRE_CXX11_ABI): f"pytorch/manylinux2_28-builder:cuda{gpu_arch}"
161-
for gpu_arch in CUDA_ARCHES
162-
},
163179
**{
164180
(gpu_arch, CXX11_ABI): f"pytorch/libtorch-cxx11-builder:cuda{gpu_arch}"
165181
for gpu_arch in CUDA_ARCHES
166182
},
167-
**{
168-
(gpu_arch, PRE_CXX11_ABI): f"pytorch/manylinux2_28-builder:rocm{gpu_arch}"
169-
for gpu_arch in ROCM_ARCHES
170-
},
171183
**{
172184
(gpu_arch, CXX11_ABI): f"pytorch/libtorch-cxx11-builder:rocm{gpu_arch}"
173185
for gpu_arch in ROCM_ARCHES
174186
},
175-
(CPU, PRE_CXX11_ABI): "pytorch/manylinux2_28-builder:cpu",
176187
(CPU, CXX11_ABI): "pytorch/libtorch-cxx11-builder:cpu",
177188
}
178189

@@ -181,7 +192,7 @@ def translate_desired_cuda(gpu_arch_type: str, gpu_arch_version: str) -> str:
181192
return {
182193
CPU: "cpu",
183194
CPU_AARCH64: CPU,
184-
CUDA_AARCH64: "cu124",
195+
CUDA_AARCH64: f"cu{gpu_arch_version.replace('-aarch64', '').replace('.', '')}",
185196
CUDA: f"cu{gpu_arch_version.replace('.', '')}",
186197
ROCM: f"rocm{gpu_arch_version}",
187198
XPU: "xpu",
@@ -272,7 +283,7 @@ def get_wheel_install_command(
272283
return f"{WHL_INSTALL_BASE} {PACKAGES_TO_INSTALL_WHL} --index-url {get_base_download_url_for_repo('whl', channel, gpu_arch_type, desired_cuda)}_pypi_pkg" # noqa: E501
273284
else:
274285
raise ValueError(
275-
"Split build is not supported for this configuration. It is only supported for CUDA 11.8, 12.4, 12.6, 12.8 on Linux nightly builds." # noqa: E501
286+
"Split build is not supported for this configuration. It is only supported for CUDA 11.8, 12.4, 12.6 on Linux nightly builds." # noqa: E501
276287
)
277288
if (
278289
channel == RELEASE
@@ -343,7 +354,7 @@ def generate_libtorch_matrix(
343354
if os == WINDOWS:
344355
abi_versions = [RELEASE, DEBUG]
345356
elif os == LINUX:
346-
abi_versions = [PRE_CXX11_ABI, CXX11_ABI]
357+
abi_versions = [CXX11_ABI]
347358
elif os in [MACOS_ARM64]:
348359
abi_versions = [CXX11_ABI]
349360
else:
@@ -422,11 +433,6 @@ def generate_wheels_matrix(
422433
# Define default python version
423434
python_versions = list(PYTHON_ARCHES)
424435

425-
# If the list of python versions is set explicitly by the caller, stick with it instead
426-
# of trying to add more versions behind the scene
427-
if channel == NIGHTLY and (os in (LINUX, MACOS_ARM64, LINUX_AARCH64)):
428-
python_versions += ["3.13"]
429-
430436
if os == LINUX:
431437
# NOTE: We only build manywheel packages for linux
432438
package_type = "manywheel"
@@ -442,7 +448,11 @@ def generate_wheels_matrix(
442448
if os == LINUX_AARCH64:
443449
# Only want the one arch as the CPU type is different and
444450
# uses different build/test scripts
445-
arches = [CPU_AARCH64, CUDA_AARCH64]
451+
arches = []
452+
if with_cpu == ENABLE:
453+
arches += [CPU_AARCH64]
454+
elif with_cuda == ENABLE:
455+
arches += CUDA_AARCH64_ARCHES
446456

447457
if with_cuda == ENABLE:
448458
upload_to_base_bucket = "no"
@@ -463,15 +473,15 @@ def generate_wheels_matrix(
463473
ret: List[Dict[str, Any]] = []
464474
for python_version in python_versions:
465475
for arch_version in arches:
466-
# TODO: Enable Python 3.13 support for ROCM
467-
if arch_version in ROCM_ARCHES and python_version == "3.13":
468-
continue
469-
470476
gpu_arch_type = arch_type(arch_version)
471477
gpu_arch_version = (
472478
"" if arch_version in [CPU, CPU_AARCH64, XPU] else arch_version
473479
)
474480

481+
# TODO: Enable python 3.13t on cpu-s390x or Windows
482+
if (gpu_arch_type == "cpu-s390x") and python_version == "3.13t":
483+
continue
484+
475485
desired_cuda = translate_desired_cuda(gpu_arch_type, gpu_arch_version)
476486
entry = {
477487
"python_version": python_version,

0 commit comments

Comments
 (0)