mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-30 11:44:59 +08:00
Compare commits
1 Commits
yguo/patch
...
ca_0431d47
| Author | SHA1 | Date | |
|---|---|---|---|
| f47875d5f9 |
@ -3,15 +3,22 @@ set -eux -o pipefail
|
||||
|
||||
GPU_ARCH_VERSION=${GPU_ARCH_VERSION:-}
|
||||
|
||||
if [[ "$GPU_ARCH_VERSION" == *"12.6"* ]]; then
|
||||
export TORCH_CUDA_ARCH_LIST="9.0"
|
||||
elif [[ "$GPU_ARCH_VERSION" == *"12.8"* ]]; then
|
||||
export TORCH_CUDA_ARCH_LIST="9.0;10.0;12.0"
|
||||
fi
|
||||
|
||||
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
source $SCRIPTPATH/aarch64_ci_setup.sh
|
||||
|
||||
tagged_version() {
|
||||
GIT_DESCRIBE="git --git-dir /pytorch/.git describe --tags --match v[0-9]*.[0-9]*.[0-9]*"
|
||||
if ${GIT_DESCRIBE} --exact >/dev/null; then
|
||||
${GIT_DESCRIBE}
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
if tagged_version >/dev/null; then
|
||||
export OVERRIDE_PACKAGE_VERSION="$(tagged_version | sed -e 's/^v//' -e 's/-.*$//')"
|
||||
fi
|
||||
|
||||
###############################################################################
|
||||
# Run aarch64 builder python
|
||||
###############################################################################
|
||||
|
||||
@ -5,14 +5,16 @@ set -eux -o pipefail
|
||||
# By creating symlinks from desired /opt/python to /usr/local/bin/
|
||||
|
||||
NUMPY_VERSION=2.0.2
|
||||
if [[ "$DESIRED_PYTHON" == "3.13" || "$DESIRED_PYTHON" == "3.13t" ]]; then
|
||||
PYGIT2_VERSION=1.15.1
|
||||
if [[ "$DESIRED_PYTHON" == "3.13" ]]; then
|
||||
NUMPY_VERSION=2.1.2
|
||||
PYGIT2_VERSION=1.16.0
|
||||
fi
|
||||
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||
source $SCRIPTPATH/../manywheel/set_desired_python.sh
|
||||
|
||||
pip install -q numpy==${NUMPY_VERSION} pyyaml==6.0.2 scons==4.7.0 ninja==1.11.1 patchelf==0.17.2
|
||||
pip install -q numpy==${NUMPY_VERSION} pyyaml==6.0.2 scons==4.7.0 ninja==1.11.1 patchelf==0.17.2 pygit2==${PYGIT2_VERSION}
|
||||
|
||||
for tool in python python3 pip pip3 ninja scons patchelf; do
|
||||
ln -sf ${DESIRED_PYTHON_BIN_DIR}/${tool} /usr/local/bin;
|
||||
|
||||
@ -4,9 +4,12 @@
|
||||
import os
|
||||
import shutil
|
||||
from subprocess import check_call, check_output
|
||||
from typing import List
|
||||
|
||||
from pygit2 import Repository
|
||||
|
||||
|
||||
def list_dir(path: str) -> list[str]:
|
||||
def list_dir(path: str) -> List[str]:
|
||||
"""'
|
||||
Helper for getting paths for Python
|
||||
"""
|
||||
@ -55,7 +58,7 @@ def build_ArmComputeLibrary() -> None:
|
||||
shutil.copytree(f"{acl_checkout_dir}/{d}", f"{acl_install_dir}/{d}")
|
||||
|
||||
|
||||
def update_wheel(wheel_path, desired_cuda) -> None:
|
||||
def update_wheel(wheel_path) -> None:
|
||||
"""
|
||||
Update the cuda wheel libraries
|
||||
"""
|
||||
@ -77,6 +80,7 @@ def update_wheel(wheel_path, desired_cuda) -> None:
|
||||
"/usr/local/cuda/lib64/libnvToolsExt.so.1",
|
||||
"/usr/local/cuda/lib64/libnvJitLink.so.12",
|
||||
"/usr/local/cuda/lib64/libnvrtc.so.12",
|
||||
"/usr/local/cuda/lib64/libnvrtc-builtins.so.12.6",
|
||||
"/usr/local/cuda/lib64/libcudnn_adv.so.9",
|
||||
"/usr/local/cuda/lib64/libcudnn_cnn.so.9",
|
||||
"/usr/local/cuda/lib64/libcudnn_graph.so.9",
|
||||
@ -96,14 +100,6 @@ def update_wheel(wheel_path, desired_cuda) -> None:
|
||||
"/usr/local/lib/libnvpl_lapack_core.so.0",
|
||||
"/usr/local/lib/libnvpl_blas_core.so.0",
|
||||
]
|
||||
if "126" in desired_cuda:
|
||||
libs_to_copy += [
|
||||
"/usr/local/cuda/lib64/libnvrtc-builtins.so.12.6",
|
||||
]
|
||||
elif "128" in desired_cuda:
|
||||
libs_to_copy += [
|
||||
"/usr/local/cuda/lib64/libnvrtc-builtins.so.12.8",
|
||||
]
|
||||
else:
|
||||
libs_to_copy += [
|
||||
"/opt/OpenBLAS/lib/libopenblas.so.0",
|
||||
@ -175,22 +171,22 @@ if __name__ == "__main__":
|
||||
args = parse_arguments()
|
||||
enable_mkldnn = args.enable_mkldnn
|
||||
enable_cuda = args.enable_cuda
|
||||
branch = check_output(
|
||||
["git", "rev-parse", "--abbrev-ref", "HEAD"], cwd="/pytorch"
|
||||
).decode()
|
||||
repo = Repository("/pytorch")
|
||||
branch = repo.head.name
|
||||
if branch == "HEAD":
|
||||
branch = "master"
|
||||
|
||||
print("Building PyTorch wheel")
|
||||
build_vars = "MAX_JOBS=5 CMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=0x10000 "
|
||||
os.system("cd /pytorch; python setup.py clean")
|
||||
|
||||
override_package_version = os.getenv("OVERRIDE_PACKAGE_VERSION")
|
||||
desired_cuda = os.getenv("DESIRED_CUDA")
|
||||
if override_package_version is not None:
|
||||
version = override_package_version
|
||||
build_vars += (
|
||||
f"BUILD_TEST=0 PYTORCH_BUILD_VERSION={version} PYTORCH_BUILD_NUMBER=1 "
|
||||
)
|
||||
elif branch in ["nightly", "main"]:
|
||||
elif branch in ["nightly", "master"]:
|
||||
build_date = (
|
||||
check_output(["git", "log", "--pretty=format:%cs", "-1"], cwd="/pytorch")
|
||||
.decode()
|
||||
@ -200,6 +196,7 @@ if __name__ == "__main__":
|
||||
check_output(["cat", "version.txt"], cwd="/pytorch").decode().strip()[:-2]
|
||||
)
|
||||
if enable_cuda:
|
||||
desired_cuda = os.getenv("DESIRED_CUDA")
|
||||
build_vars += f"BUILD_TEST=0 PYTORCH_BUILD_VERSION={version}.dev{build_date}+{desired_cuda} PYTORCH_BUILD_NUMBER=1 "
|
||||
else:
|
||||
build_vars += f"BUILD_TEST=0 PYTORCH_BUILD_VERSION={version}.dev{build_date} PYTORCH_BUILD_NUMBER=1 "
|
||||
@ -228,6 +225,6 @@ if __name__ == "__main__":
|
||||
print("Updating Cuda Dependency")
|
||||
filename = os.listdir("/pytorch/dist/")
|
||||
wheel_path = f"/pytorch/dist/{filename[0]}"
|
||||
update_wheel(wheel_path, desired_cuda)
|
||||
update_wheel(wheel_path)
|
||||
pytorch_wheel_name = complete_wheel("/pytorch/")
|
||||
print(f"Build Complete. Created {pytorch_wheel_name}..")
|
||||
|
||||
@ -12,7 +12,7 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from typing import Optional, Union
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
|
||||
import boto3
|
||||
|
||||
@ -24,12 +24,10 @@ os_amis = {
|
||||
"ubuntu22_04": "ami-0c6c29c5125214c77", # login_name: ubuntu
|
||||
"redhat8": "ami-0698b90665a2ddcf1", # login_name: ec2-user
|
||||
}
|
||||
|
||||
ubuntu18_04_ami = os_amis["ubuntu18_04"]
|
||||
ubuntu20_04_ami = os_amis["ubuntu20_04"]
|
||||
|
||||
|
||||
def compute_keyfile_path(key_name: Optional[str] = None) -> tuple[str, str]:
|
||||
def compute_keyfile_path(key_name: Optional[str] = None) -> Tuple[str, str]:
|
||||
if key_name is None:
|
||||
key_name = os.getenv("AWS_KEY_NAME")
|
||||
if key_name is None:
|
||||
@ -59,7 +57,7 @@ def ec2_instances_by_id(instance_id):
|
||||
|
||||
|
||||
def start_instance(
|
||||
key_name, ami=ubuntu20_04_ami, instance_type="t4g.2xlarge", ebs_size: int = 50
|
||||
key_name, ami=ubuntu18_04_ami, instance_type="t4g.2xlarge", ebs_size: int = 50
|
||||
):
|
||||
inst = ec2.create_instances(
|
||||
ImageId=ami,
|
||||
@ -98,7 +96,7 @@ class RemoteHost:
|
||||
self.keyfile_path = keyfile_path
|
||||
self.login_name = login_name
|
||||
|
||||
def _gen_ssh_prefix(self) -> list[str]:
|
||||
def _gen_ssh_prefix(self) -> List[str]:
|
||||
return [
|
||||
"ssh",
|
||||
"-o",
|
||||
@ -110,13 +108,13 @@ class RemoteHost:
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def _split_cmd(args: Union[str, list[str]]) -> list[str]:
|
||||
def _split_cmd(args: Union[str, List[str]]) -> List[str]:
|
||||
return args.split() if isinstance(args, str) else args
|
||||
|
||||
def run_ssh_cmd(self, args: Union[str, list[str]]) -> None:
|
||||
def run_ssh_cmd(self, args: Union[str, List[str]]) -> None:
|
||||
subprocess.check_call(self._gen_ssh_prefix() + self._split_cmd(args))
|
||||
|
||||
def check_ssh_output(self, args: Union[str, list[str]]) -> str:
|
||||
def check_ssh_output(self, args: Union[str, List[str]]) -> str:
|
||||
return subprocess.check_output(
|
||||
self._gen_ssh_prefix() + self._split_cmd(args)
|
||||
).decode("utf-8")
|
||||
@ -159,7 +157,7 @@ class RemoteHost:
|
||||
def using_docker(self) -> bool:
|
||||
return self.container_id is not None
|
||||
|
||||
def run_cmd(self, args: Union[str, list[str]]) -> None:
|
||||
def run_cmd(self, args: Union[str, List[str]]) -> None:
|
||||
if not self.using_docker():
|
||||
return self.run_ssh_cmd(args)
|
||||
assert self.container_id is not None
|
||||
@ -180,7 +178,7 @@ class RemoteHost:
|
||||
if rc != 0:
|
||||
raise subprocess.CalledProcessError(rc, docker_cmd)
|
||||
|
||||
def check_output(self, args: Union[str, list[str]]) -> str:
|
||||
def check_output(self, args: Union[str, List[str]]) -> str:
|
||||
if not self.using_docker():
|
||||
return self.check_ssh_output(args)
|
||||
assert self.container_id is not None
|
||||
@ -232,7 +230,7 @@ class RemoteHost:
|
||||
)
|
||||
self.download_file(remote_file, local_file)
|
||||
|
||||
def list_dir(self, path: str) -> list[str]:
|
||||
def list_dir(self, path: str) -> List[str]:
|
||||
return self.check_output(["ls", "-1", path]).split("\n")
|
||||
|
||||
|
||||
@ -360,7 +358,7 @@ def checkout_repo(
|
||||
branch: str = "main",
|
||||
url: str,
|
||||
git_clone_flags: str,
|
||||
mapping: dict[str, tuple[str, str]],
|
||||
mapping: Dict[str, Tuple[str, str]],
|
||||
) -> Optional[str]:
|
||||
for prefix in mapping:
|
||||
if not branch.startswith(prefix):
|
||||
@ -683,7 +681,7 @@ def build_domains(
|
||||
branch: str = "main",
|
||||
use_conda: bool = True,
|
||||
git_clone_flags: str = "",
|
||||
) -> tuple[str, str, str, str]:
|
||||
) -> Tuple[str, str, str, str]:
|
||||
vision_wheel_name = build_torchvision(
|
||||
host, branch=branch, use_conda=use_conda, git_clone_flags=git_clone_flags
|
||||
)
|
||||
@ -710,7 +708,7 @@ def start_build(
|
||||
pytorch_build_number: Optional[str] = None,
|
||||
shallow_clone: bool = True,
|
||||
enable_mkldnn: bool = False,
|
||||
) -> tuple[str, str, str, str, str]:
|
||||
) -> Tuple[str, str, str, str, str]:
|
||||
git_clone_flags = " --depth 1 --shallow-submodules" if shallow_clone else ""
|
||||
if host.using_docker() and not use_conda:
|
||||
print("Auto-selecting conda option for docker images")
|
||||
@ -934,9 +932,9 @@ def parse_arguments():
|
||||
parser.add_argument("--debug", action="store_true")
|
||||
parser.add_argument("--build-only", action="store_true")
|
||||
parser.add_argument("--test-only", type=str)
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument("--os", type=str, choices=list(os_amis.keys()))
|
||||
group.add_argument("--ami", type=str)
|
||||
parser.add_argument(
|
||||
"--os", type=str, choices=list(os_amis.keys()), default="ubuntu20_04"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--python-version",
|
||||
type=str,
|
||||
@ -966,13 +964,7 @@ def parse_arguments():
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = parse_arguments()
|
||||
ami = (
|
||||
args.ami
|
||||
if args.ami is not None
|
||||
else os_amis[args.os]
|
||||
if args.os is not None
|
||||
else ubuntu20_04_ami
|
||||
)
|
||||
ami = os_amis[args.os]
|
||||
keyfile_path, key_name = compute_keyfile_path(args.key_name)
|
||||
|
||||
if args.list_instances:
|
||||
|
||||
5
.ci/docker/aotriton_version.txt
Normal file
5
.ci/docker/aotriton_version.txt
Normal file
@ -0,0 +1,5 @@
|
||||
0.8b
|
||||
manylinux_2_28
|
||||
rocm6.2
|
||||
6f8cbcac8a92775291bb1ba8f514d4beb350baf4
|
||||
e938def5d32869fe2e00aec0300f354c9f157867bebdf2e104d732b94cb238d8
|
||||
@ -86,10 +86,6 @@ CMAKE_VERSION=3.18.5
|
||||
|
||||
_UCX_COMMIT=7bb2722ff2187a0cad557ae4a6afa090569f83fb
|
||||
_UCC_COMMIT=20eae37090a4ce1b32bcce6144ccad0b49943e0b
|
||||
if [[ "$image" == *rocm* ]]; then
|
||||
_UCX_COMMIT=cc312eaa4655c0cc5c2bcd796db938f90563bcf6
|
||||
_UCC_COMMIT=0c0fc21559835044ab107199e334f7157d6a0d3d
|
||||
fi
|
||||
|
||||
# It's annoying to rename jobs every time you want to rewrite a
|
||||
# configuration, so we hardcode everything here rather than do it
|
||||
@ -109,6 +105,20 @@ case "$image" in
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
;;
|
||||
pytorch-linux-focal-cuda12.1-cudnn9-py3-gcc9)
|
||||
CUDA_VERSION=12.1.1
|
||||
CUDNN_VERSION=9
|
||||
ANACONDA_PYTHON_VERSION=3.10
|
||||
GCC_VERSION=9
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
KATEX=yes
|
||||
UCX_COMMIT=${_UCX_COMMIT}
|
||||
UCC_COMMIT=${_UCC_COMMIT}
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
;;
|
||||
pytorch-linux-focal-cuda12.4-cudnn9-py3-gcc9-inductor-benchmarks)
|
||||
CUDA_VERSION=12.4.1
|
||||
CUDNN_VERSION=9
|
||||
@ -124,6 +134,36 @@ case "$image" in
|
||||
TRITON=yes
|
||||
INDUCTOR_BENCHMARKS=yes
|
||||
;;
|
||||
pytorch-linux-focal-cuda12.1-cudnn9-py3-gcc9-inductor-benchmarks)
|
||||
CUDA_VERSION=12.1.1
|
||||
CUDNN_VERSION=9
|
||||
ANACONDA_PYTHON_VERSION=3.10
|
||||
GCC_VERSION=9
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
KATEX=yes
|
||||
UCX_COMMIT=${_UCX_COMMIT}
|
||||
UCC_COMMIT=${_UCC_COMMIT}
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
INDUCTOR_BENCHMARKS=yes
|
||||
;;
|
||||
pytorch-linux-focal-cuda12.1-cudnn9-py3.12-gcc9-inductor-benchmarks)
|
||||
CUDA_VERSION=12.1.1
|
||||
CUDNN_VERSION=9
|
||||
ANACONDA_PYTHON_VERSION=3.12
|
||||
GCC_VERSION=9
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
KATEX=yes
|
||||
UCX_COMMIT=${_UCX_COMMIT}
|
||||
UCC_COMMIT=${_UCC_COMMIT}
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
INDUCTOR_BENCHMARKS=yes
|
||||
;;
|
||||
pytorch-linux-focal-cuda12.4-cudnn9-py3.12-gcc9-inductor-benchmarks)
|
||||
CUDA_VERSION=12.4.1
|
||||
CUDNN_VERSION=9
|
||||
@ -168,6 +208,48 @@ case "$image" in
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
;;
|
||||
pytorch-linux-focal-cuda12.4-cudnn9-py3-gcc9)
|
||||
CUDA_VERSION=12.4.1
|
||||
CUDNN_VERSION=9
|
||||
ANACONDA_PYTHON_VERSION=3.10
|
||||
GCC_VERSION=9
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
KATEX=yes
|
||||
UCX_COMMIT=${_UCX_COMMIT}
|
||||
UCC_COMMIT=${_UCC_COMMIT}
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
;;
|
||||
pytorch-linux-focal-cuda12.1-cudnn9-py3-gcc9)
|
||||
CUDA_VERSION=12.1.1
|
||||
CUDNN_VERSION=9
|
||||
ANACONDA_PYTHON_VERSION=3.10
|
||||
GCC_VERSION=9
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
KATEX=yes
|
||||
UCX_COMMIT=${_UCX_COMMIT}
|
||||
UCC_COMMIT=${_UCC_COMMIT}
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
;;
|
||||
pytorch-linux-focal-cuda12.4-cudnn9-py3-gcc9)
|
||||
CUDA_VERSION=12.4.1
|
||||
CUDNN_VERSION=9
|
||||
ANACONDA_PYTHON_VERSION=3.10
|
||||
GCC_VERSION=9
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
KATEX=yes
|
||||
UCX_COMMIT=${_UCX_COMMIT}
|
||||
UCC_COMMIT=${_UCC_COMMIT}
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
;;
|
||||
pytorch-linux-focal-py3-clang10-onnx)
|
||||
ANACONDA_PYTHON_VERSION=3.9
|
||||
CLANG_VERSION=10
|
||||
@ -210,7 +292,18 @@ case "$image" in
|
||||
;;
|
||||
pytorch-linux-focal-rocm-n-1-py3)
|
||||
ANACONDA_PYTHON_VERSION=3.10
|
||||
GCC_VERSION=11
|
||||
GCC_VERSION=9
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
ROCM_VERSION=6.1
|
||||
NINJA_VERSION=1.9.0
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
;;
|
||||
pytorch-linux-focal-rocm-n-py3)
|
||||
ANACONDA_PYTHON_VERSION=3.10
|
||||
GCC_VERSION=9
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
@ -218,25 +311,6 @@ case "$image" in
|
||||
NINJA_VERSION=1.9.0
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
KATEX=yes
|
||||
UCX_COMMIT=${_UCX_COMMIT}
|
||||
UCC_COMMIT=${_UCC_COMMIT}
|
||||
INDUCTOR_BENCHMARKS=yes
|
||||
;;
|
||||
pytorch-linux-focal-rocm-n-py3)
|
||||
ANACONDA_PYTHON_VERSION=3.10
|
||||
GCC_VERSION=11
|
||||
PROTOBUF=yes
|
||||
DB=yes
|
||||
VISION=yes
|
||||
ROCM_VERSION=6.3
|
||||
NINJA_VERSION=1.9.0
|
||||
CONDA_CMAKE=yes
|
||||
TRITON=yes
|
||||
KATEX=yes
|
||||
UCX_COMMIT=${_UCX_COMMIT}
|
||||
UCC_COMMIT=${_UCC_COMMIT}
|
||||
INDUCTOR_BENCHMARKS=yes
|
||||
;;
|
||||
pytorch-linux-jammy-xpu-2024.0-py3)
|
||||
ANACONDA_PYTHON_VERSION=3.9
|
||||
@ -451,7 +525,7 @@ docker build \
|
||||
--build-arg "NINJA_VERSION=${NINJA_VERSION:-}" \
|
||||
--build-arg "KATEX=${KATEX:-}" \
|
||||
--build-arg "ROCM_VERSION=${ROCM_VERSION:-}" \
|
||||
--build-arg "PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH:-gfx90a;gfx942}" \
|
||||
--build-arg "PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH:-gfx90a}" \
|
||||
--build-arg "IMAGE_NAME=${IMAGE_NAME}" \
|
||||
--build-arg "UCX_COMMIT=${UCX_COMMIT}" \
|
||||
--build-arg "UCC_COMMIT=${UCC_COMMIT}" \
|
||||
|
||||
@ -113,6 +113,13 @@ COPY triton_version.txt triton_version.txt
|
||||
RUN if [ -n "${TRITON}" ]; then bash ./install_triton.sh; fi
|
||||
RUN rm install_triton.sh common_utils.sh triton.txt triton_version.txt
|
||||
|
||||
# Install AOTriton (Early fail)
|
||||
COPY ./aotriton_version.txt aotriton_version.txt
|
||||
COPY ./common/common_utils.sh common_utils.sh
|
||||
COPY ./common/install_aotriton.sh install_aotriton.sh
|
||||
RUN ["/bin/bash", "-c", "./install_aotriton.sh /opt/rocm && rm -rf install_aotriton.sh aotriton_version.txt common_utils.sh"]
|
||||
ENV AOTRITON_INSTALLED_PREFIX /opt/rocm/aotriton
|
||||
|
||||
# Install ccache/sccache (do this last, so we get priority in PATH)
|
||||
COPY ./common/install_cache.sh install_cache.sh
|
||||
ENV PATH /opt/cache/bin:$PATH
|
||||
|
||||
@ -1 +1 @@
|
||||
5e4d6b6380d575e48e37e9d987fded4ec588e7bc
|
||||
6f638937d64e3396793956d75ee3e14802022745
|
||||
|
||||
@ -1 +0,0 @@
|
||||
v2.21.5-1
|
||||
@ -1 +0,0 @@
|
||||
v2.25.1-1
|
||||
@ -1 +1 @@
|
||||
5d535d7a2d4b435b1b5c1177fd8f04a12b942b9a
|
||||
ac3470188b914c5d7a5058a7e28b9eb685a62427
|
||||
|
||||
@ -1 +1 @@
|
||||
4b3bb1f8da0ded6ccd572dd1358ef45af5a1befe
|
||||
0d4682f073ded4d1a8260dd4208a43d735ae3a2b
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
readonly version=v24.04
|
||||
readonly src_host=https://github.com/ARM-software
|
||||
readonly src_host=https://review.mlplatform.org/ml
|
||||
readonly src_repo=ComputeLibrary
|
||||
|
||||
# Clone ACL
|
||||
|
||||
23
.ci/docker/common/install_aotriton.sh
Executable file
23
.ci/docker/common/install_aotriton.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/common_utils.sh"
|
||||
|
||||
TARBALL='aotriton.tar.gz'
|
||||
# This read command alwasy returns with exit code 1
|
||||
read -d "\n" VER MANYLINUX ROCMBASE PINNED_COMMIT SHA256 < aotriton_version.txt || true
|
||||
ARCH=$(uname -m)
|
||||
AOTRITON_INSTALL_PREFIX="$1"
|
||||
AOTRITON_URL="https://github.com/ROCm/aotriton/releases/download/${VER}/aotriton-${VER}-${MANYLINUX}_${ARCH}-${ROCMBASE}-shared.tar.gz"
|
||||
|
||||
cd "${AOTRITON_INSTALL_PREFIX}"
|
||||
# Must use -L to follow redirects
|
||||
curl -L --retry 3 -o "${TARBALL}" "${AOTRITON_URL}"
|
||||
ACTUAL_SHA256=$(sha256sum "${TARBALL}" | cut -d " " -f 1)
|
||||
if [ "${SHA256}" != "${ACTUAL_SHA256}" ]; then
|
||||
echo -n "Error: The SHA256 of downloaded tarball is ${ACTUAL_SHA256},"
|
||||
echo " which does not match the expected value ${SHA256}."
|
||||
exit
|
||||
fi
|
||||
tar xf "${TARBALL}" && rm -rf "${TARBALL}"
|
||||
@ -32,12 +32,8 @@ install_ubuntu() {
|
||||
|
||||
# HACK: UCC testing relies on libnccl library from NVIDIA repo, and version 2.16 crashes
|
||||
# See https://github.com/pytorch/pytorch/pull/105260#issuecomment-1673399729
|
||||
# TODO: Eliminate this hack, we should not relay on apt-get installation
|
||||
# See https://github.com/pytorch/pytorch/issues/144768
|
||||
if [[ "$UBUNTU_VERSION" == "20.04"* && "$CUDA_VERSION" == "11.8"* ]]; then
|
||||
maybe_libnccl_dev="libnccl2=2.15.5-1+cuda11.8 libnccl-dev=2.15.5-1+cuda11.8 --allow-downgrades --allow-change-held-packages"
|
||||
elif [[ "$UBUNTU_VERSION" == "20.04"* && "$CUDA_VERSION" == "12.4"* ]]; then
|
||||
maybe_libnccl_dev="libnccl2=2.25.1-1+cuda12.4 libnccl-dev=2.25.1-1+cuda12.4 --allow-downgrades --allow-change-held-packages"
|
||||
else
|
||||
maybe_libnccl_dev=""
|
||||
fi
|
||||
|
||||
@ -9,7 +9,7 @@ install_ubuntu() {
|
||||
# Instead use lib and headers from OpenSSL1.1 installed in `install_openssl.sh``
|
||||
apt-get install -y cargo
|
||||
echo "Checking out sccache repo"
|
||||
git clone https://github.com/mozilla/sccache -b v0.9.1
|
||||
git clone https://github.com/mozilla/sccache -b v0.9.0
|
||||
cd sccache
|
||||
echo "Building sccache"
|
||||
cargo build --release
|
||||
@ -36,7 +36,11 @@ sed -e 's|PATH="\(.*\)"|PATH="/opt/cache/bin:\1"|g' -i /etc/environment
|
||||
export PATH="/opt/cache/bin:$PATH"
|
||||
|
||||
# Setup compiler cache
|
||||
install_ubuntu
|
||||
if [ -n "$ROCM_VERSION" ]; then
|
||||
curl --retry 3 http://repo.radeon.com/misc/.sccache_amd/sccache -o /opt/cache/bin/sccache
|
||||
else
|
||||
install_ubuntu
|
||||
fi
|
||||
chmod a+x /opt/cache/bin/sccache
|
||||
|
||||
function write_sccache_stub() {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
set -ex
|
||||
|
||||
NCCL_VERSION=v2.25.1-1
|
||||
NCCL_VERSION=v2.21.5-1
|
||||
CUDNN_VERSION=9.5.1.17
|
||||
|
||||
function install_cusparselt_040 {
|
||||
@ -16,6 +16,17 @@ function install_cusparselt_040 {
|
||||
rm -rf tmp_cusparselt
|
||||
}
|
||||
|
||||
function install_cusparselt_052 {
|
||||
# cuSparseLt license: https://docs.nvidia.com/cuda/cusparselt/license.html
|
||||
mkdir tmp_cusparselt && pushd tmp_cusparselt
|
||||
wget -q https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-x86_64/libcusparse_lt-linux-x86_64-0.5.2.1-archive.tar.xz
|
||||
tar xf libcusparse_lt-linux-x86_64-0.5.2.1-archive.tar.xz
|
||||
cp -a libcusparse_lt-linux-x86_64-0.5.2.1-archive/include/* /usr/local/cuda/include/
|
||||
cp -a libcusparse_lt-linux-x86_64-0.5.2.1-archive/lib/* /usr/local/cuda/lib64/
|
||||
popd
|
||||
rm -rf tmp_cusparselt
|
||||
}
|
||||
|
||||
function install_cusparselt_062 {
|
||||
# cuSparseLt license: https://docs.nvidia.com/cuda/cusparselt/license.html
|
||||
mkdir tmp_cusparselt && pushd tmp_cusparselt
|
||||
@ -40,7 +51,6 @@ function install_cusparselt_063 {
|
||||
|
||||
function install_118 {
|
||||
CUDNN_VERSION=9.1.0.70
|
||||
NCCL_VERSION=v2.21.5-1
|
||||
echo "Installing CUDA 11.8 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.4.0"
|
||||
rm -rf /usr/local/cuda-11.8 /usr/local/cuda
|
||||
# install CUDA 11.8.0 in the same container
|
||||
@ -73,6 +83,39 @@ function install_118 {
|
||||
ldconfig
|
||||
}
|
||||
|
||||
function install_121 {
|
||||
echo "Installing CUDA 12.1 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.5.2"
|
||||
rm -rf /usr/local/cuda-12.1 /usr/local/cuda
|
||||
# install CUDA 12.1.0 in the same container
|
||||
wget -q https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda_12.1.1_530.30.02_linux.run
|
||||
chmod +x cuda_12.1.1_530.30.02_linux.run
|
||||
./cuda_12.1.1_530.30.02_linux.run --toolkit --silent
|
||||
rm -f cuda_12.1.1_530.30.02_linux.run
|
||||
rm -f /usr/local/cuda && ln -s /usr/local/cuda-12.1 /usr/local/cuda
|
||||
|
||||
# cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
|
||||
mkdir tmp_cudnn && cd tmp_cudnn
|
||||
wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive.tar.xz -O cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive.tar.xz
|
||||
tar xf cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive.tar.xz
|
||||
cp -a cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive/include/* /usr/local/cuda/include/
|
||||
cp -a cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive/lib/* /usr/local/cuda/lib64/
|
||||
cd ..
|
||||
rm -rf tmp_cudnn
|
||||
|
||||
# NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
|
||||
# Follow build: https://github.com/NVIDIA/nccl/tree/master?tab=readme-ov-file#build
|
||||
git clone -b $NCCL_VERSION --depth 1 https://github.com/NVIDIA/nccl.git
|
||||
cd nccl && make -j src.build
|
||||
cp -a build/include/* /usr/local/cuda/include/
|
||||
cp -a build/lib/* /usr/local/cuda/lib64/
|
||||
cd ..
|
||||
rm -rf nccl
|
||||
|
||||
install_cusparselt_052
|
||||
|
||||
ldconfig
|
||||
}
|
||||
|
||||
function install_124 {
|
||||
CUDNN_VERSION=9.1.0.70
|
||||
echo "Installing CUDA 12.4.1 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.6.2"
|
||||
@ -171,6 +214,37 @@ function prune_118 {
|
||||
rm -rf $CUDA_BASE/libnvvp $CUDA_BASE/nsightee_plugins $CUDA_BASE/nsight-compute-2022.3.0 $CUDA_BASE/nsight-systems-2022.4.2/
|
||||
}
|
||||
|
||||
function prune_121 {
|
||||
echo "Pruning CUDA 12.1"
|
||||
#####################################################################################
|
||||
# CUDA 12.1 prune static libs
|
||||
#####################################################################################
|
||||
export NVPRUNE="/usr/local/cuda-12.1/bin/nvprune"
|
||||
export CUDA_LIB_DIR="/usr/local/cuda-12.1/lib64"
|
||||
|
||||
export GENCODE="-gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90"
|
||||
export GENCODE_CUDNN="-gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90"
|
||||
|
||||
if [[ -n "$OVERRIDE_GENCODE" ]]; then
|
||||
export GENCODE=$OVERRIDE_GENCODE
|
||||
fi
|
||||
|
||||
# all CUDA libs except CuDNN and CuBLAS
|
||||
ls $CUDA_LIB_DIR/ | grep "\.a" | grep -v "culibos" | grep -v "cudart" | grep -v "cudnn" | grep -v "cublas" | grep -v "metis" \
|
||||
| xargs -I {} bash -c \
|
||||
"echo {} && $NVPRUNE $GENCODE $CUDA_LIB_DIR/{} -o $CUDA_LIB_DIR/{}"
|
||||
|
||||
# prune CuDNN and CuBLAS
|
||||
$NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR/libcublas_static.a -o $CUDA_LIB_DIR/libcublas_static.a
|
||||
$NVPRUNE $GENCODE_CUDNN $CUDA_LIB_DIR/libcublasLt_static.a -o $CUDA_LIB_DIR/libcublasLt_static.a
|
||||
|
||||
#####################################################################################
|
||||
# CUDA 12.1 prune visual tools
|
||||
#####################################################################################
|
||||
export CUDA_BASE="/usr/local/cuda-12.1/"
|
||||
rm -rf $CUDA_BASE/libnvvp $CUDA_BASE/nsightee_plugins $CUDA_BASE/nsight-compute-2023.1.0 $CUDA_BASE/nsight-systems-2023.1.2/
|
||||
}
|
||||
|
||||
function prune_124 {
|
||||
echo "Pruning CUDA 12.4"
|
||||
#####################################################################################
|
||||
@ -239,52 +313,18 @@ function prune_126 {
|
||||
rm -rf $CUDA_BASE/libnvvp $CUDA_BASE/nsightee_plugins $CUDA_BASE/nsight-compute-2024.3.2 $CUDA_BASE/nsight-systems-2024.5.1/
|
||||
}
|
||||
|
||||
function install_128 {
|
||||
CUDNN_VERSION=9.7.1.26
|
||||
echo "Installing CUDA 12.8.0 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.6.3"
|
||||
rm -rf /usr/local/cuda-12.8 /usr/local/cuda
|
||||
# install CUDA 12.8.0 in the same container
|
||||
wget -q https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda_12.8.0_570.86.10_linux.run
|
||||
chmod +x cuda_12.8.0_570.86.10_linux.run
|
||||
./cuda_12.8.0_570.86.10_linux.run --toolkit --silent
|
||||
rm -f cuda_12.8.0_570.86.10_linux.run
|
||||
rm -f /usr/local/cuda && ln -s /usr/local/cuda-12.8 /usr/local/cuda
|
||||
|
||||
# cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
|
||||
mkdir tmp_cudnn && cd tmp_cudnn
|
||||
wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive.tar.xz -O cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive.tar.xz
|
||||
tar xf cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive.tar.xz
|
||||
cp -a cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive/include/* /usr/local/cuda/include/
|
||||
cp -a cudnn-linux-x86_64-${CUDNN_VERSION}_cuda12-archive/lib/* /usr/local/cuda/lib64/
|
||||
cd ..
|
||||
rm -rf tmp_cudnn
|
||||
|
||||
# NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
|
||||
# Follow build: https://github.com/NVIDIA/nccl/tree/master?tab=readme-ov-file#build
|
||||
git clone -b $NCCL_VERSION --depth 1 https://github.com/NVIDIA/nccl.git
|
||||
cd nccl && make -j src.build
|
||||
cp -a build/include/* /usr/local/cuda/include/
|
||||
cp -a build/lib/* /usr/local/cuda/lib64/
|
||||
cd ..
|
||||
rm -rf nccl
|
||||
|
||||
install_cusparselt_063
|
||||
|
||||
ldconfig
|
||||
}
|
||||
|
||||
# idiomatic parameter and option handling in sh
|
||||
while test $# -gt 0
|
||||
do
|
||||
case "$1" in
|
||||
11.8) install_118; prune_118
|
||||
;;
|
||||
12.1) install_121; prune_121
|
||||
;;
|
||||
12.4) install_124; prune_124
|
||||
;;
|
||||
12.6) install_126; prune_126
|
||||
;;
|
||||
12.8) install_128;
|
||||
;;
|
||||
*) echo "bad argument $1"; exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -57,7 +57,7 @@ function install_124 {
|
||||
cd ..
|
||||
rm -rf nccl
|
||||
|
||||
install_cusparselt_063
|
||||
install_cusparselt_062
|
||||
|
||||
ldconfig
|
||||
}
|
||||
@ -160,40 +160,6 @@ function prune_126 {
|
||||
rm -rf $CUDA_BASE/libnvvp $CUDA_BASE/nsightee_plugins $CUDA_BASE/nsight-compute-2024.3.2 $CUDA_BASE/nsight-systems-2024.5.1/
|
||||
}
|
||||
|
||||
function install_128 {
|
||||
CUDNN_VERSION=9.7.1.26
|
||||
echo "Installing CUDA 12.8.0 and cuDNN ${CUDNN_VERSION} and NCCL ${NCCL_VERSION} and cuSparseLt-0.6.3"
|
||||
rm -rf /usr/local/cuda-12.8 /usr/local/cuda
|
||||
# install CUDA 12.8.0 in the same container
|
||||
wget -q https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda_12.8.0_570.86.10_linux_sbsa.run
|
||||
chmod +x cuda_12.8.0_570.86.10_linux_sbsa.run
|
||||
./cuda_12.8.0_570.86.10_linux_sbsa.run --toolkit --silent
|
||||
rm -f cuda_12.8.0_570.86.10_linux_sbsa.run
|
||||
rm -f /usr/local/cuda && ln -s /usr/local/cuda-12.8 /usr/local/cuda
|
||||
|
||||
# cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
|
||||
mkdir tmp_cudnn && cd tmp_cudnn
|
||||
wget -q https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-sbsa/cudnn-linux-sbsa-${CUDNN_VERSION}_cuda12-archive.tar.xz -O cudnn-linux-sbsa-${CUDNN_VERSION}_cuda12-archive.tar.xz
|
||||
tar xf cudnn-linux-sbsa-${CUDNN_VERSION}_cuda12-archive.tar.xz
|
||||
cp -a cudnn-linux-sbsa-${CUDNN_VERSION}_cuda12-archive/include/* /usr/local/cuda/include/
|
||||
cp -a cudnn-linux-sbsa-${CUDNN_VERSION}_cuda12-archive/lib/* /usr/local/cuda/lib64/
|
||||
cd ..
|
||||
rm -rf tmp_cudnn
|
||||
|
||||
# NCCL license: https://docs.nvidia.com/deeplearning/nccl/#licenses
|
||||
# Follow build: https://github.com/NVIDIA/nccl/tree/master?tab=readme-ov-file#build
|
||||
git clone -b ${NCCL_VERSION} --depth 1 https://github.com/NVIDIA/nccl.git
|
||||
cd nccl && make -j src.build
|
||||
cp -a build/include/* /usr/local/cuda/include/
|
||||
cp -a build/lib/* /usr/local/cuda/lib64/
|
||||
cd ..
|
||||
rm -rf nccl
|
||||
|
||||
install_cusparselt_063
|
||||
|
||||
ldconfig
|
||||
}
|
||||
|
||||
# idiomatic parameter and option handling in sh
|
||||
while test $# -gt 0
|
||||
do
|
||||
@ -202,8 +168,6 @@ do
|
||||
;;
|
||||
12.6) install_126; prune_126
|
||||
;;
|
||||
12.8) install_128;
|
||||
;;
|
||||
*) echo "bad argument $1"; exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -4,9 +4,7 @@ if [[ -n "${CUDNN_VERSION}" ]]; then
|
||||
# cuDNN license: https://developer.nvidia.com/cudnn/license_agreement
|
||||
mkdir tmp_cudnn
|
||||
pushd tmp_cudnn
|
||||
if [[ ${CUDA_VERSION:0:4} == "12.8" ]]; then
|
||||
CUDNN_NAME="cudnn-linux-x86_64-9.7.1.26_cuda12-archive"
|
||||
elif [[ ${CUDA_VERSION:0:4} == "12.6" ]]; then
|
||||
if [[ ${CUDA_VERSION:0:4} == "12.6" ]]; then
|
||||
CUDNN_NAME="cudnn-linux-x86_64-9.5.1.17_cuda12-archive"
|
||||
elif [[ ${CUDA_VERSION:0:2} == "12" ]]; then
|
||||
CUDNN_NAME="cudnn-linux-x86_64-9.1.0.70_cuda12-archive"
|
||||
|
||||
@ -5,15 +5,7 @@ set -ex
|
||||
# cuSPARSELt license: https://docs.nvidia.com/cuda/cusparselt/license.html
|
||||
mkdir tmp_cusparselt && cd tmp_cusparselt
|
||||
|
||||
if [[ ${CUDA_VERSION:0:4} =~ ^12\.[5-8]$ ]]; then
|
||||
arch_path='sbsa'
|
||||
export TARGETARCH=${TARGETARCH:-$(uname -m)}
|
||||
if [ ${TARGETARCH} = 'amd64' ] || [ "${TARGETARCH}" = 'x86_64' ]; then
|
||||
arch_path='x86_64'
|
||||
fi
|
||||
CUSPARSELT_NAME="libcusparse_lt-linux-${arch_path}-0.6.3.2-archive"
|
||||
curl --retry 3 -OLs https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-${arch_path}/${CUSPARSELT_NAME}.tar.xz
|
||||
elif [[ ${CUDA_VERSION:0:4} == "12.4" ]]; then
|
||||
if [[ ${CUDA_VERSION:0:4} =~ ^12\.[2-6]$ ]]; then
|
||||
arch_path='sbsa'
|
||||
export TARGETARCH=${TARGETARCH:-$(uname -m)}
|
||||
if [ ${TARGETARCH} = 'amd64' ] || [ "${TARGETARCH}" = 'x86_64' ]; then
|
||||
@ -21,11 +13,17 @@ elif [[ ${CUDA_VERSION:0:4} == "12.4" ]]; then
|
||||
fi
|
||||
CUSPARSELT_NAME="libcusparse_lt-linux-${arch_path}-0.6.2.3-archive"
|
||||
curl --retry 3 -OLs https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-${arch_path}/${CUSPARSELT_NAME}.tar.xz
|
||||
elif [[ ${CUDA_VERSION:0:4} == "12.1" ]]; then
|
||||
arch_path='sbsa'
|
||||
export TARGETARCH=${TARGETARCH:-$(uname -m)}
|
||||
if [ ${TARGETARCH} = 'amd64' ] || [ "${TARGETARCH}" = 'x86_64' ]; then
|
||||
arch_path='x86_64'
|
||||
fi
|
||||
CUSPARSELT_NAME="libcusparse_lt-linux-${arch_path}-0.5.2.1-archive"
|
||||
curl --retry 3 -OLs https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-${arch_path}/${CUSPARSELT_NAME}.tar.xz
|
||||
elif [[ ${CUDA_VERSION:0:4} == "11.8" ]]; then
|
||||
CUSPARSELT_NAME="libcusparse_lt-linux-x86_64-0.4.0.7-archive"
|
||||
curl --retry 3 -OLs https://developer.download.nvidia.com/compute/cusparselt/redist/libcusparse_lt/linux-x86_64/${CUSPARSELT_NAME}.tar.xz
|
||||
else
|
||||
echo "Not sure which libcusparselt version to install for this ${CUDA_VERSION}"
|
||||
fi
|
||||
|
||||
tar xf ${CUSPARSELT_NAME}.tar.xz
|
||||
|
||||
@ -37,12 +37,7 @@ install_conda_dependencies() {
|
||||
|
||||
install_pip_dependencies() {
|
||||
pushd executorch
|
||||
as_jenkins bash install_executorch.sh
|
||||
|
||||
# A workaround, ExecuTorch has moved to numpy 2.0 which is not compatible with the current
|
||||
# numba and scipy version used in PyTorch CI
|
||||
conda_run pip uninstall -y numba scipy
|
||||
|
||||
as_jenkins bash install_requirements.sh --pybind xnnpack
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
@ -31,15 +31,15 @@ pip_install \
|
||||
pip_install coloredlogs packaging
|
||||
|
||||
pip_install onnxruntime==1.18.1
|
||||
pip_install onnx==1.17.0
|
||||
pip_install onnxscript==0.1.0 --no-deps
|
||||
pip_install onnx==1.16.2
|
||||
pip_install onnxscript==0.1.0.dev20241124 --no-deps
|
||||
# required by onnxscript
|
||||
pip_install ml_dtypes
|
||||
|
||||
# Cache the transformers model to be used later by ONNX tests. We need to run the transformers
|
||||
# package to download the model. By default, the model is cached at ~/.cache/huggingface/hub/
|
||||
IMPORT_SCRIPT_FILENAME="/tmp/onnx_import_script.py"
|
||||
as_jenkins echo 'import transformers; transformers.GPTJForCausalLM.from_pretrained("hf-internal-testing/tiny-random-gptj");' > "${IMPORT_SCRIPT_FILENAME}"
|
||||
as_jenkins echo 'import transformers; transformers.AutoModel.from_pretrained("sshleifer/tiny-gpt2"); transformers.AutoTokenizer.from_pretrained("sshleifer/tiny-gpt2"); transformers.AutoModelForSpeechSeq2Seq.from_pretrained("openai/whisper-large-v3");' > "${IMPORT_SCRIPT_FILENAME}"
|
||||
|
||||
# Need a PyTorch version for transformers to work
|
||||
pip_install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
|
||||
|
||||
@ -62,22 +62,6 @@ install_ubuntu() {
|
||||
sqlite3 $kdb "PRAGMA journal_mode=off; PRAGMA VACUUM;"
|
||||
done
|
||||
|
||||
# ROCm 6.3 had a regression where initializing static code objects had significant overhead
|
||||
if [[ $(ver $ROCM_VERSION) -eq $(ver 6.3) ]]; then
|
||||
# clr build needs CppHeaderParser but can only find it using conda's python
|
||||
/opt/conda/bin/python -m pip install CppHeaderParser
|
||||
git clone https://github.com/ROCm/HIP -b rocm-6.3.x
|
||||
HIP_COMMON_DIR=$(readlink -f HIP)
|
||||
git clone https://github.com/jeffdaily/clr -b release/rocm-rel-6.3-statco-hotfix
|
||||
mkdir -p clr/build
|
||||
pushd clr/build
|
||||
cmake .. -DCLR_BUILD_HIP=ON -DHIP_COMMON_DIR=$HIP_COMMON_DIR
|
||||
make -j
|
||||
cp hipamd/lib/libamdhip64.so.6.3.* /opt/rocm/lib/libamdhip64.so.6.3.*
|
||||
popd
|
||||
rm -rf HIP clr
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
apt-get autoclean && apt-get clean
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
@ -8,12 +8,6 @@ else
|
||||
with_cuda=no
|
||||
fi
|
||||
|
||||
if [[ -d "/opt/rocm" ]]; then
|
||||
with_rocm=/opt/rocm
|
||||
else
|
||||
with_rocm=no
|
||||
fi
|
||||
|
||||
function install_ucx() {
|
||||
set -ex
|
||||
git clone --recursive https://github.com/openucx/ucx.git
|
||||
@ -25,7 +19,6 @@ function install_ucx() {
|
||||
./configure --prefix=$UCX_HOME \
|
||||
--enable-mt \
|
||||
--with-cuda=$with_cuda \
|
||||
--with-rocm=$with_rocm \
|
||||
--enable-profiling \
|
||||
--enable-stats
|
||||
time make -j
|
||||
@ -43,29 +36,12 @@ function install_ucc() {
|
||||
git submodule update --init --recursive
|
||||
|
||||
./autogen.sh
|
||||
|
||||
# We only run distributed tests on Tesla M60 and A10G
|
||||
NVCC_GENCODE="-gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_86,code=compute_86"
|
||||
|
||||
if [[ -n "$ROCM_VERSION" ]]; then
|
||||
if [[ -n "$PYTORCH_ROCM_ARCH" ]]; then
|
||||
amdgpu_targets=`echo $PYTORCH_ROCM_ARCH | sed 's/;/ /g'`
|
||||
else
|
||||
amdgpu_targets=`rocm_agent_enumerator | grep -v gfx000 | sort -u | xargs`
|
||||
fi
|
||||
for arch in $amdgpu_targets; do
|
||||
HIP_OFFLOAD="$HIP_OFFLOAD --offload-arch=$arch"
|
||||
done
|
||||
else
|
||||
HIP_OFFLOAD="all-arch-no-native"
|
||||
fi
|
||||
|
||||
./configure --prefix=$UCC_HOME \
|
||||
--with-ucx=$UCX_HOME \
|
||||
--with-cuda=$with_cuda \
|
||||
--with-nvcc-gencode="${NVCC_GENCODE}" \
|
||||
--with-rocm=$with_rocm \
|
||||
--with-rocm-arch="${HIP_OFFLOAD}"
|
||||
--with-nvcc-gencode="${NVCC_GENCODE}"
|
||||
time make -j
|
||||
sudo make install
|
||||
|
||||
|
||||
@ -56,6 +56,11 @@ RUN bash ./install_cuda.sh 11.8
|
||||
RUN bash ./install_magma.sh 11.8
|
||||
RUN ln -sf /usr/local/cuda-11.8 /usr/local/cuda
|
||||
|
||||
FROM cuda as cuda12.1
|
||||
RUN bash ./install_cuda.sh 12.1
|
||||
RUN bash ./install_magma.sh 12.1
|
||||
RUN ln -sf /usr/local/cuda-12.1 /usr/local/cuda
|
||||
|
||||
FROM cuda as cuda12.4
|
||||
RUN bash ./install_cuda.sh 12.4
|
||||
RUN bash ./install_magma.sh 12.4
|
||||
@ -66,11 +71,6 @@ RUN bash ./install_cuda.sh 12.6
|
||||
RUN bash ./install_magma.sh 12.6
|
||||
RUN ln -sf /usr/local/cuda-12.6 /usr/local/cuda
|
||||
|
||||
FROM cuda as cuda12.8
|
||||
RUN bash ./install_cuda.sh 12.8
|
||||
RUN bash ./install_magma.sh 12.8
|
||||
RUN ln -sf /usr/local/cuda-12.8 /usr/local/cuda
|
||||
|
||||
FROM cpu as rocm
|
||||
ARG PYTORCH_ROCM_ARCH
|
||||
ENV PYTORCH_ROCM_ARCH ${PYTORCH_ROCM_ARCH}
|
||||
@ -92,6 +92,13 @@ RUN apt-get update -y && \
|
||||
RUN bash ./install_rocm_drm.sh && rm install_rocm_drm.sh
|
||||
RUN bash ./install_rocm_magma.sh && rm install_rocm_magma.sh
|
||||
|
||||
# Install AOTriton
|
||||
COPY ./common/common_utils.sh common_utils.sh
|
||||
COPY ./aotriton_version.txt aotriton_version.txt
|
||||
COPY ./common/install_aotriton.sh install_aotriton.sh
|
||||
RUN bash ./install_aotriton.sh /opt/rocm && rm install_aotriton.sh aotriton_version.txt
|
||||
ENV AOTRITON_INSTALLED_PREFIX /opt/rocm/aotriton
|
||||
|
||||
FROM ${BASE_TARGET} as final
|
||||
COPY --from=openssl /opt/openssl /opt/openssl
|
||||
# Install patchelf
|
||||
|
||||
@ -198,3 +198,10 @@ ADD ./common/install_rocm_magma.sh install_rocm_magma.sh
|
||||
RUN bash ./install_rocm_magma.sh && rm install_rocm_magma.sh
|
||||
ADD ./common/install_miopen.sh install_miopen.sh
|
||||
RUN bash ./install_miopen.sh ${ROCM_VERSION} && rm install_miopen.sh
|
||||
|
||||
# Install AOTriton
|
||||
COPY ./common/common_utils.sh common_utils.sh
|
||||
COPY ./aotriton_version.txt aotriton_version.txt
|
||||
COPY ./common/install_aotriton.sh install_aotriton.sh
|
||||
RUN bash ./install_aotriton.sh /opt/rocm && rm install_aotriton.sh aotriton_version.txt
|
||||
ENV AOTRITON_INSTALLED_PREFIX /opt/rocm/aotriton
|
||||
|
||||
@ -304,7 +304,7 @@ pytest-cpp==2.3.0
|
||||
#Pinned versions: 2.3.0
|
||||
#test that import:
|
||||
|
||||
z3-solver==4.12.6.0
|
||||
z3-solver==4.12.2.0
|
||||
#Description: The Z3 Theorem Prover Project
|
||||
#Pinned versions:
|
||||
#test that import:
|
||||
@ -329,7 +329,7 @@ lxml==5.3.0
|
||||
|
||||
PyGithub==2.3.0
|
||||
|
||||
sympy==1.13.3
|
||||
sympy==1.13.1 ; python_version >= "3.9"
|
||||
#Description: Required by coremltools, also pinned in .github/requirements/pip-requirements-macOS.txt
|
||||
#Pinned versions:
|
||||
#test that import:
|
||||
@ -339,7 +339,7 @@ onnx==1.17.0
|
||||
#Pinned versions:
|
||||
#test that import:
|
||||
|
||||
onnxscript==0.1.0
|
||||
onnxscript==0.1.0.dev20240817
|
||||
#Description: Required by mypy and test_public_bindings.py when checking torch.onnx._internal
|
||||
#Pinned versions:
|
||||
#test that import:
|
||||
@ -362,7 +362,6 @@ pwlf==2.2.1 ; python_version >= "3.8"
|
||||
# To build PyTorch itself
|
||||
astunparse
|
||||
PyYAML
|
||||
pyzstd
|
||||
setuptools
|
||||
|
||||
ninja==1.11.1 ; platform_machine == "aarch64"
|
||||
@ -372,8 +371,3 @@ pulp==2.9.0 ; python_version >= "3.8"
|
||||
#Description: required for testing ilp formulaiton under torch/distributed/_tools
|
||||
#Pinned versions: 2.9.0
|
||||
#test that import: test_sac_ilp.py
|
||||
|
||||
dataclasses_json==0.6.7
|
||||
#Description: required for data pipeline and scripts under tools/stats
|
||||
#Pinned versions: 0.6.7
|
||||
#test that import:
|
||||
|
||||
@ -14,20 +14,21 @@ ENV PYTORCH_ROCM_ARCH ${PYTORCH_ROCM_ARCH}
|
||||
COPY ./common/install_base.sh install_base.sh
|
||||
RUN bash ./install_base.sh && rm install_base.sh
|
||||
|
||||
# Install clang
|
||||
ARG LLVMDEV
|
||||
ARG CLANG_VERSION
|
||||
COPY ./common/install_clang.sh install_clang.sh
|
||||
RUN bash ./install_clang.sh && rm install_clang.sh
|
||||
|
||||
# Install user
|
||||
COPY ./common/install_user.sh install_user.sh
|
||||
RUN bash ./install_user.sh && rm install_user.sh
|
||||
|
||||
# Install katex
|
||||
ARG KATEX
|
||||
COPY ./common/install_docs_reqs.sh install_docs_reqs.sh
|
||||
RUN bash ./install_docs_reqs.sh && rm install_docs_reqs.sh
|
||||
|
||||
# Install conda and other packages (e.g., numpy, pytest)
|
||||
ARG ANACONDA_PYTHON_VERSION
|
||||
ARG CONDA_CMAKE
|
||||
ENV ANACONDA_PYTHON_VERSION=$ANACONDA_PYTHON_VERSION
|
||||
ENV PATH /opt/conda/envs/py_$ANACONDA_PYTHON_VERSION/bin:/opt/conda/bin:$PATH
|
||||
ARG CONDA_CMAKE
|
||||
COPY requirements-ci.txt /opt/conda/requirements-ci.txt
|
||||
COPY ./common/install_conda.sh install_conda.sh
|
||||
COPY ./common/common_utils.sh common_utils.sh
|
||||
@ -38,11 +39,6 @@ ARG GCC_VERSION
|
||||
COPY ./common/install_gcc.sh install_gcc.sh
|
||||
RUN bash ./install_gcc.sh && rm install_gcc.sh
|
||||
|
||||
# Install clang
|
||||
ARG CLANG_VERSION
|
||||
COPY ./common/install_clang.sh install_clang.sh
|
||||
RUN bash ./install_clang.sh && rm install_clang.sh
|
||||
|
||||
# (optional) Install protobuf for ONNX
|
||||
ARG PROTOBUF
|
||||
COPY ./common/install_protobuf.sh install_protobuf.sh
|
||||
@ -89,32 +85,6 @@ COPY ./common/install_amdsmi.sh install_amdsmi.sh
|
||||
RUN bash ./install_amdsmi.sh
|
||||
RUN rm install_amdsmi.sh
|
||||
|
||||
# (optional) Install UCC
|
||||
ARG UCX_COMMIT
|
||||
ARG UCC_COMMIT
|
||||
ENV UCX_COMMIT $UCX_COMMIT
|
||||
ENV UCC_COMMIT $UCC_COMMIT
|
||||
ENV UCX_HOME /usr
|
||||
ENV UCC_HOME /usr
|
||||
ADD ./common/install_ucc.sh install_ucc.sh
|
||||
RUN if [ -n "${UCX_COMMIT}" ] && [ -n "${UCC_COMMIT}" ]; then bash ./install_ucc.sh; fi
|
||||
RUN rm install_ucc.sh
|
||||
|
||||
COPY ./common/install_openssl.sh install_openssl.sh
|
||||
ENV OPENSSL_ROOT_DIR /opt/openssl
|
||||
RUN bash ./install_openssl.sh
|
||||
ENV OPENSSL_DIR /opt/openssl
|
||||
|
||||
ARG INDUCTOR_BENCHMARKS
|
||||
ARG ANACONDA_PYTHON_VERSION
|
||||
ENV ANACONDA_PYTHON_VERSION=$ANACONDA_PYTHON_VERSION
|
||||
COPY ./common/install_inductor_benchmark_deps.sh install_inductor_benchmark_deps.sh
|
||||
COPY ./common/common_utils.sh common_utils.sh
|
||||
COPY ci_commit_pins/huggingface.txt huggingface.txt
|
||||
COPY ci_commit_pins/timm.txt timm.txt
|
||||
RUN if [ -n "${INDUCTOR_BENCHMARKS}" ]; then bash ./install_inductor_benchmark_deps.sh; fi
|
||||
RUN rm install_inductor_benchmark_deps.sh common_utils.sh timm.txt huggingface.txt
|
||||
|
||||
# (optional) Install non-default CMake version
|
||||
ARG CMAKE_VERSION
|
||||
COPY ./common/install_cmake.sh install_cmake.sh
|
||||
@ -137,17 +107,18 @@ COPY triton_version.txt triton_version.txt
|
||||
RUN if [ -n "${TRITON}" ]; then bash ./install_triton.sh; fi
|
||||
RUN rm install_triton.sh common_utils.sh triton.txt triton_version.txt
|
||||
|
||||
# Install AOTriton
|
||||
COPY ./aotriton_version.txt aotriton_version.txt
|
||||
COPY ./common/common_utils.sh common_utils.sh
|
||||
COPY ./common/install_aotriton.sh install_aotriton.sh
|
||||
RUN ["/bin/bash", "-c", "./install_aotriton.sh /opt/rocm && rm -rf install_aotriton.sh aotriton_version.txt common_utils.sh"]
|
||||
ENV AOTRITON_INSTALLED_PREFIX /opt/rocm/aotriton
|
||||
|
||||
# Install ccache/sccache (do this last, so we get priority in PATH)
|
||||
COPY ./common/install_cache.sh install_cache.sh
|
||||
ENV PATH /opt/cache/bin:$PATH
|
||||
RUN bash ./install_cache.sh && rm install_cache.sh
|
||||
|
||||
# Install Open MPI for ROCm
|
||||
COPY ./common/install_openmpi.sh install_openmpi.sh
|
||||
RUN if [ -n "${CUDA_VERSION}" ]; then bash install_openmpi.sh; fi
|
||||
RUN rm install_openmpi.sh
|
||||
|
||||
# Include BUILD_ENVIRONMENT environment variable in image
|
||||
ARG BUILD_ENVIRONMENT
|
||||
ENV BUILD_ENVIRONMENT ${BUILD_ENVIRONMENT}
|
||||
|
||||
@ -16,9 +16,9 @@ DOCKER_RUN = set -eou pipefail; ${DOCKER_CMD} run --rm -i \
|
||||
magma/build_magma.sh
|
||||
|
||||
.PHONY: all
|
||||
all: magma-cuda128
|
||||
all: magma-cuda126
|
||||
all: magma-cuda124
|
||||
all: magma-cuda121
|
||||
all: magma-cuda118
|
||||
|
||||
.PHONY:
|
||||
@ -26,12 +26,6 @@ clean:
|
||||
$(RM) -r magma-*
|
||||
$(RM) -r output
|
||||
|
||||
.PHONY: magma-cuda128
|
||||
magma-cuda128: DESIRED_CUDA := 12.8
|
||||
magma-cuda128: CUDA_ARCH_LIST += -gencode arch=compute_100,code=sm_100 -gencode arch=compute_120,code=sm_120
|
||||
magma-cuda128:
|
||||
$(DOCKER_RUN)
|
||||
|
||||
.PHONY: magma-cuda126
|
||||
magma-cuda126: DESIRED_CUDA := 12.6
|
||||
magma-cuda126:
|
||||
@ -42,6 +36,11 @@ magma-cuda124: DESIRED_CUDA := 12.4
|
||||
magma-cuda124:
|
||||
$(DOCKER_RUN)
|
||||
|
||||
.PHONY: magma-cuda121
|
||||
magma-cuda121: DESIRED_CUDA := 12.1
|
||||
magma-cuda121:
|
||||
$(DOCKER_RUN)
|
||||
|
||||
.PHONY: magma-cuda118
|
||||
magma-cuda118: DESIRED_CUDA := 11.8
|
||||
magma-cuda118: CUDA_ARCH_LIST += -gencode arch=compute_37,code=sm_37
|
||||
|
||||
@ -14,7 +14,6 @@ export USE_CUDA_STATIC_LINK=1
|
||||
export INSTALL_TEST=0 # dont install test binaries into site-packages
|
||||
export USE_CUPTI_SO=0
|
||||
export USE_CUSPARSELT=${USE_CUSPARSELT:-1} # Enable if not disabled by libtorch build
|
||||
export USE_CUFILE=${USE_CUFILE:-1}
|
||||
|
||||
# Keep an array of cmake variables to add to
|
||||
if [[ -z "$CMAKE_ARGS" ]]; then
|
||||
@ -53,15 +52,23 @@ cuda_version_nodot=$(echo $CUDA_VERSION | tr -d '.')
|
||||
|
||||
TORCH_CUDA_ARCH_LIST="5.0;6.0;7.0;7.5;8.0;8.6"
|
||||
case ${CUDA_VERSION} in
|
||||
12.8)
|
||||
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};9.0;10.0;12.0+PTX" #Ripping out 5.0 and 6.0 due to ld error
|
||||
EXTRA_CAFFE2_CMAKE_FLAGS+=("-DATEN_NO_TEST=ON")
|
||||
;;
|
||||
12.6)
|
||||
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};9.0+PTX"
|
||||
if [[ "$GPU_ARCH_TYPE" = "cuda-aarch64" ]]; then
|
||||
TORCH_CUDA_ARCH_LIST="9.0"
|
||||
else
|
||||
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};9.0+PTX"
|
||||
fi
|
||||
EXTRA_CAFFE2_CMAKE_FLAGS+=("-DATEN_NO_TEST=ON")
|
||||
;;
|
||||
12.4)
|
||||
if [[ "$GPU_ARCH_TYPE" = "cuda-aarch64" ]]; then
|
||||
TORCH_CUDA_ARCH_LIST="9.0"
|
||||
else
|
||||
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};9.0"
|
||||
fi
|
||||
EXTRA_CAFFE2_CMAKE_FLAGS+=("-DATEN_NO_TEST=ON")
|
||||
;;
|
||||
12.1)
|
||||
TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST};9.0"
|
||||
EXTRA_CAFFE2_CMAKE_FLAGS+=("-DATEN_NO_TEST=ON")
|
||||
;;
|
||||
@ -119,16 +126,7 @@ if [[ $USE_CUSPARSELT == "1" && $CUDA_VERSION == "11.8" ]]; then
|
||||
)
|
||||
fi
|
||||
|
||||
|
||||
# Turn USE_CUFILE off for CUDA 11.8, 12.4 since nvidia-cufile-cu11 and 1.9.0.20 are
|
||||
# not available in PYPI
|
||||
if [[ $CUDA_VERSION == "11.8" || $CUDA_VERSION == "12.4" ]]; then
|
||||
export USE_CUFILE=0
|
||||
fi
|
||||
|
||||
|
||||
# CUDA_VERSION 12.4, 12.6, 12.8
|
||||
if [[ $CUDA_VERSION == 12* ]]; then
|
||||
if [[ $CUDA_VERSION == "12.4" || $CUDA_VERSION == "12.6" ]]; then
|
||||
export USE_STATIC_CUDNN=0
|
||||
# Try parallelizing nvcc as well
|
||||
export TORCH_NVCC_FLAGS="-Xfatbin -compress-all --threads 2"
|
||||
@ -169,16 +167,6 @@ if [[ $CUDA_VERSION == 12* ]]; then
|
||||
"libnvrtc.so.12"
|
||||
"libnvrtc-builtins.so"
|
||||
)
|
||||
if [[ $USE_CUFILE == 1 ]]; then
|
||||
DEPS_LIST+=(
|
||||
"/usr/local/cuda/lib64/libcufile.so.0"
|
||||
"/usr/local/cuda/lib64/libcufile_rdma.so.1"
|
||||
)
|
||||
DEPS_SONAME+=(
|
||||
"libcufile.so.0"
|
||||
"libcufile_rdma.so.1"
|
||||
)
|
||||
fi
|
||||
else
|
||||
echo "Using nvidia libs from pypi."
|
||||
CUDA_RPATHS=(
|
||||
@ -195,11 +183,6 @@ if [[ $CUDA_VERSION == 12* ]]; then
|
||||
'$ORIGIN/../../nvidia/nccl/lib'
|
||||
'$ORIGIN/../../nvidia/nvtx/lib'
|
||||
)
|
||||
if [[ $USE_CUFILE == 1 ]]; then
|
||||
CUDA_RPATHS+=(
|
||||
'$ORIGIN/../../nvidia/cufile/lib'
|
||||
)
|
||||
fi
|
||||
CUDA_RPATHS=$(IFS=: ; echo "${CUDA_RPATHS[*]}")
|
||||
export C_SO_RPATH=$CUDA_RPATHS':$ORIGIN:$ORIGIN/lib'
|
||||
export LIB_SO_RPATH=$CUDA_RPATHS':$ORIGIN'
|
||||
|
||||
@ -186,6 +186,15 @@ do
|
||||
OS_SO_FILES[${#OS_SO_FILES[@]}]=$file_name # Append lib to array
|
||||
done
|
||||
|
||||
# FIXME: Temporary until https://github.com/pytorch/pytorch/pull/137443 lands
|
||||
# Install AOTriton
|
||||
if [ -e ${PYTORCH_ROOT}/.ci/docker/aotriton_version.txt ]; then
|
||||
cp -a ${PYTORCH_ROOT}/.ci/docker/aotriton_version.txt aotriton_version.txt
|
||||
bash ${PYTORCH_ROOT}/.ci/docker/common/install_aotriton.sh ${ROCM_HOME} && rm aotriton_version.txt
|
||||
export AOTRITON_INSTALLED_PREFIX=${ROCM_HOME}/aotriton
|
||||
ROCM_SO_FILES+=("libaotriton_v2.so")
|
||||
fi
|
||||
|
||||
# rocBLAS library files
|
||||
ROCBLAS_LIB_SRC=$ROCM_HOME/lib/rocblas/library
|
||||
ROCBLAS_LIB_DST=lib/rocblas/library
|
||||
@ -257,6 +266,20 @@ RCCL_SHARE_FILES=($(ls $RCCL_SHARE_SRC))
|
||||
DEPS_AUX_SRCLIST+=(${RCCL_SHARE_FILES[@]/#/$RCCL_SHARE_SRC/})
|
||||
DEPS_AUX_DSTLIST+=(${RCCL_SHARE_FILES[@]/#/$RCCL_SHARE_DST/})
|
||||
|
||||
# PyTorch 2.6+ (AOTriton 0.8b+)
|
||||
# AKS = "AOTriton Kernel Storage", a file format to store GPU kernels compactly
|
||||
if (( $(echo "${PYTORCH_VERSION} 2.6" | awk '{print ($1 >= $2)}') )); then
|
||||
LIBAOTRITON_DIR=$(find "$ROCM_HOME/lib/" -name "libaotriton_v2.so" -printf '%h\n')
|
||||
if [[ -z ${LIBAOTRITON_DIR} ]]; then
|
||||
LIBAOTRITON_DIR=$(find "$ROCM_HOME/" -name "libaotriton_v2.so" -printf '%h\n')
|
||||
fi
|
||||
AKS_FILES=($(find "${LIBAOTRITON_DIR}/aotriton.images" -type f -name '*.aks?' -printf '%P\n'))
|
||||
AKS_SRC="${LIBAOTRITON_DIR}/aotriton.images"
|
||||
AKS_DST="lib/aotriton.images"
|
||||
DEPS_AUX_SRCLIST+=(${AKS_FILES[@]/#/${AKS_SRC}/})
|
||||
DEPS_AUX_DSTLIST+=(${AKS_FILES[@]/#/${AKS_DST}/})
|
||||
fi
|
||||
|
||||
echo "PYTORCH_ROCM_ARCH: ${PYTORCH_ROCM_ARCH}"
|
||||
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||
|
||||
@ -228,7 +228,7 @@ if [[ "$BUILD_ENVIRONMENT" == *-debug* ]]; then
|
||||
export CMAKE_BUILD_TYPE=RelWithAssert
|
||||
fi
|
||||
|
||||
# Do not change workspace permissions for ROCm and s390x CI jobs
|
||||
# Do not change workspace permissions for ROCm CI jobs
|
||||
# as it can leave workspace with bad permissions for cancelled jobs
|
||||
if [[ "$BUILD_ENVIRONMENT" != *rocm* && "$BUILD_ENVIRONMENT" != *s390x* && -d /var/lib/jenkins/workspace ]]; then
|
||||
# Workaround for dind-rootless userid mapping (https://github.com/pytorch/ci-infra/issues/96)
|
||||
|
||||
@ -387,7 +387,7 @@ fi
|
||||
###############################################################################
|
||||
# Check for C++ ABI compatibility between gcc7 and gcc9 compiled binaries
|
||||
###############################################################################
|
||||
if [[ "$(uname)" == 'Linux' && "$PACKAGE_TYPE" == 'manywheel' ]]; then
|
||||
if [[ "$(uname)" == 'Linux' && ("$PACKAGE_TYPE" == 'conda' || "$PACKAGE_TYPE" == 'manywheel')]]; then
|
||||
pushd /tmp
|
||||
python -c "import torch; exit(0 if torch.compiled_with_cxx11_abi() else (0 if torch._C._PYBIND11_BUILD_ABI == '_cxxabi1011' else 1))"
|
||||
popd
|
||||
|
||||
@ -169,34 +169,24 @@ function install_torchrec_and_fbgemm() {
|
||||
torchrec_commit=$(get_pinned_commit torchrec)
|
||||
local fbgemm_commit
|
||||
fbgemm_commit=$(get_pinned_commit fbgemm)
|
||||
if [[ "$BUILD_ENVIRONMENT" == *rocm* ]] ; then
|
||||
fbgemm_commit=$(get_pinned_commit fbgemm_rocm)
|
||||
fi
|
||||
pip_uninstall torchrec-nightly
|
||||
pip_uninstall fbgemm-gpu-nightly
|
||||
pip_install setuptools-git-versioning scikit-build pyre-extensions
|
||||
|
||||
if [[ "$BUILD_ENVIRONMENT" == *rocm* ]] ; then
|
||||
# install torchrec first because it installs fbgemm nightly on top of rocm fbgemm
|
||||
pip_install --no-use-pep517 --user "git+https://github.com/pytorch/torchrec.git@${torchrec_commit}"
|
||||
pip_uninstall fbgemm-gpu-nightly
|
||||
# TODO (huydhn): I still have no clue on why sccache doesn't work with only fbgemm_gpu here, but it
|
||||
# seems to be an sccache-related issue
|
||||
if [[ "$IS_A100_RUNNER" == "1" ]]; then
|
||||
unset CMAKE_CUDA_COMPILER_LAUNCHER
|
||||
sudo mv /opt/cache/bin /opt/cache/bin-backup
|
||||
fi
|
||||
|
||||
pip_install tabulate # needed for newer fbgemm
|
||||
pip_install patchelf # needed for rocm fbgemm
|
||||
git clone --recursive https://github.com/pytorch/fbgemm
|
||||
pushd fbgemm/fbgemm_gpu
|
||||
git checkout "${fbgemm_commit}"
|
||||
python setup.py install \
|
||||
--package_variant=rocm \
|
||||
-DHIP_ROOT_DIR="${ROCM_PATH}" \
|
||||
-DCMAKE_C_FLAGS="-DTORCH_USE_HIP_DSA" \
|
||||
-DCMAKE_CXX_FLAGS="-DTORCH_USE_HIP_DSA"
|
||||
popd
|
||||
rm -rf fbgemm
|
||||
else
|
||||
# See https://github.com/pytorch/pytorch/issues/106971
|
||||
CUDA_PATH=/usr/local/cuda-12.1 pip_install --no-use-pep517 --user "git+https://github.com/pytorch/FBGEMM.git@${fbgemm_commit}#egg=fbgemm-gpu&subdirectory=fbgemm_gpu"
|
||||
pip_install --no-use-pep517 --user "git+https://github.com/pytorch/torchrec.git@${torchrec_commit}"
|
||||
# See https://github.com/pytorch/pytorch/issues/106971
|
||||
CUDA_PATH=/usr/local/cuda-12.1 pip_install --no-use-pep517 --user "git+https://github.com/pytorch/FBGEMM.git@${fbgemm_commit}#egg=fbgemm-gpu&subdirectory=fbgemm_gpu"
|
||||
pip_install --no-use-pep517 --user "git+https://github.com/pytorch/torchrec.git@${torchrec_commit}"
|
||||
|
||||
if [[ "$IS_A100_RUNNER" == "1" ]]; then
|
||||
export CMAKE_CUDA_COMPILER_LAUNCHER=/opt/cache/bin/sccache
|
||||
sudo mv /opt/cache/bin-backup /opt/cache/bin
|
||||
fi
|
||||
}
|
||||
|
||||
@ -226,11 +216,6 @@ function checkout_install_torchbench() {
|
||||
# to install and test other models
|
||||
python install.py --continue_on_fail
|
||||
fi
|
||||
|
||||
# TODO (huydhn): transformers-4.44.2 added by https://github.com/pytorch/benchmark/pull/2488
|
||||
# is regressing speedup metric. This needs to be investigated further
|
||||
pip install transformers==4.38.1
|
||||
|
||||
echo "Print all dependencies after TorchBench is installed"
|
||||
python -mpip freeze
|
||||
popd
|
||||
|
||||
@ -18,9 +18,6 @@ if [[ ! $(python -c "import torch; print(int(torch.backends.openmp.is_available(
|
||||
fi
|
||||
popd
|
||||
|
||||
# enable debug asserts in serialization
|
||||
export TORCH_SERIALIZATION_DEBUG=1
|
||||
|
||||
setup_test_python() {
|
||||
# The CircleCI worker hostname doesn't resolve to an address.
|
||||
# This environment variable makes ProcessGroupGloo default to
|
||||
|
||||
@ -8,62 +8,55 @@
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||
|
||||
echo "Testing pytorch"
|
||||
# When adding more tests, please use HUD to see which shard is shorter
|
||||
if [[ "${SHARD_NUMBER:-1}" == "1" ]]; then
|
||||
# FSDP tests
|
||||
for f in test/distributed/fsdp/*.py ; do time python test/run_test.py --verbose -i "${f#*/}" ; done
|
||||
fi
|
||||
time python test/run_test.py --include test_cuda_multigpu test_cuda_primary_ctx --verbose
|
||||
|
||||
if [[ "${SHARD_NUMBER:-2}" == "2" ]]; then
|
||||
time python test/run_test.py --include test_cuda_multigpu test_cuda_primary_ctx --verbose
|
||||
# Disabling tests to see if they solve timeout issues; see https://github.com/pytorch/pytorch/issues/70015
|
||||
# python tools/download_mnist.py --quiet -d test/cpp/api/mnist
|
||||
# OMP_NUM_THREADS=2 TORCH_CPP_TEST_MNIST_PATH="test/cpp/api/mnist" build/bin/test_api
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_common
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_gloo
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_nccl
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_spawn_gloo
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_spawn_nccl
|
||||
time python test/run_test.py --verbose -i distributed/test_compute_comm_reordering
|
||||
time python test/run_test.py --verbose -i distributed/test_store
|
||||
time python test/run_test.py --verbose -i distributed/test_symmetric_memory
|
||||
time python test/run_test.py --verbose -i distributed/test_pg_wrapper
|
||||
time python test/run_test.py --verbose -i distributed/rpc/cuda/test_tensorpipe_agent
|
||||
# FSDP tests
|
||||
for f in test/distributed/fsdp/*.py ; do time python test/run_test.py --verbose -i "${f#*/}" ; done
|
||||
# ShardedTensor tests
|
||||
time python test/run_test.py --verbose -i distributed/checkpoint/test_checkpoint
|
||||
time python test/run_test.py --verbose -i distributed/checkpoint/test_file_system_checkpoint
|
||||
time python test/run_test.py --verbose -i distributed/_shard/sharding_spec/test_sharding_spec
|
||||
time python test/run_test.py --verbose -i distributed/_shard/sharding_plan/test_sharding_plan
|
||||
time python test/run_test.py --verbose -i distributed/_shard/sharded_tensor/test_sharded_tensor
|
||||
time python test/run_test.py --verbose -i distributed/_shard/sharded_tensor/test_sharded_tensor_reshard
|
||||
|
||||
# Disabling tests to see if they solve timeout issues; see https://github.com/pytorch/pytorch/issues/70015
|
||||
# python tools/download_mnist.py --quiet -d test/cpp/api/mnist
|
||||
# OMP_NUM_THREADS=2 TORCH_CPP_TEST_MNIST_PATH="test/cpp/api/mnist" build/bin/test_api
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_common
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_gloo
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_nccl
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_spawn_gloo
|
||||
time python test/run_test.py --verbose -i distributed/test_c10d_spawn_nccl
|
||||
time python test/run_test.py --verbose -i distributed/test_compute_comm_reordering
|
||||
time python test/run_test.py --verbose -i distributed/test_store
|
||||
time python test/run_test.py --verbose -i distributed/test_symmetric_memory
|
||||
time python test/run_test.py --verbose -i distributed/test_pg_wrapper
|
||||
time python test/run_test.py --verbose -i distributed/rpc/cuda/test_tensorpipe_agent
|
||||
# functional collective tests
|
||||
time python test/run_test.py --verbose -i distributed/test_functional_api
|
||||
|
||||
# ShardedTensor tests
|
||||
time python test/run_test.py --verbose -i distributed/checkpoint/test_checkpoint
|
||||
time python test/run_test.py --verbose -i distributed/checkpoint/test_file_system_checkpoint
|
||||
time python test/run_test.py --verbose -i distributed/_shard/sharding_spec/test_sharding_spec
|
||||
time python test/run_test.py --verbose -i distributed/_shard/sharding_plan/test_sharding_plan
|
||||
time python test/run_test.py --verbose -i distributed/_shard/sharded_tensor/test_sharded_tensor
|
||||
time python test/run_test.py --verbose -i distributed/_shard/sharded_tensor/test_sharded_tensor_reshard
|
||||
# DTensor tests
|
||||
time python test/run_test.py --verbose -i distributed/_tensor/test_random_ops
|
||||
time python test/run_test.py --verbose -i distributed/_tensor/test_dtensor_compile
|
||||
|
||||
# functional collective tests
|
||||
time python test/run_test.py --verbose -i distributed/test_functional_api
|
||||
# DeviceMesh test
|
||||
time python test/run_test.py --verbose -i distributed/test_device_mesh
|
||||
|
||||
# DTensor tests
|
||||
time python test/run_test.py --verbose -i distributed/tensor/test_random_ops
|
||||
time python test/run_test.py --verbose -i distributed/tensor/test_dtensor_compile
|
||||
# DTensor/TP tests
|
||||
time python test/run_test.py --verbose -i distributed/tensor/parallel/test_tp_examples
|
||||
time python test/run_test.py --verbose -i distributed/tensor/parallel/test_tp_random_state
|
||||
|
||||
# DeviceMesh test
|
||||
time python test/run_test.py --verbose -i distributed/test_device_mesh
|
||||
# FSDP2 tests
|
||||
time python test/run_test.py --verbose -i distributed/_composable/fsdp/test_fully_shard_training -- -k test_2d_mlp_with_nd_mesh
|
||||
|
||||
# DTensor/TP tests
|
||||
time python test/run_test.py --verbose -i distributed/tensor/parallel/test_tp_examples
|
||||
time python test/run_test.py --verbose -i distributed/tensor/parallel/test_tp_random_state
|
||||
# ND composability tests
|
||||
time python test/run_test.py --verbose -i distributed/_composable/test_composability/test_2d_composability
|
||||
time python test/run_test.py --verbose -i distributed/_composable/test_composability/test_pp_composability
|
||||
|
||||
# FSDP2 tests
|
||||
time python test/run_test.py --verbose -i distributed/_composable/fsdp/test_fully_shard_training -- -k test_2d_mlp_with_nd_mesh
|
||||
|
||||
# ND composability tests
|
||||
time python test/run_test.py --verbose -i distributed/_composable/test_composability/test_2d_composability
|
||||
time python test/run_test.py --verbose -i distributed/_composable/test_composability/test_pp_composability
|
||||
|
||||
# Other tests
|
||||
time python test/run_test.py --verbose -i test_cuda_primary_ctx
|
||||
time python test/run_test.py --verbose -i test_optim -- -k test_forloop_goes_right_direction_multigpu
|
||||
time python test/run_test.py --verbose -i test_optim -- -k test_mixed_device_dtype
|
||||
time python test/run_test.py --verbose -i test_foreach -- -k test_tensors_grouping
|
||||
fi
|
||||
# Other tests
|
||||
time python test/run_test.py --verbose -i test_cuda_primary_ctx
|
||||
time python test/run_test.py --verbose -i test_optim -- -k test_forloop_goes_right_direction_multigpu
|
||||
time python test/run_test.py --verbose -i test_optim -- -k test_mixed_device_dtype
|
||||
time python test/run_test.py --verbose -i test_foreach -- -k test_tensors_grouping
|
||||
assert_git_not_dirty
|
||||
|
||||
@ -40,7 +40,7 @@ retry () {
|
||||
if [[ "$#" != 3 ]]; then
|
||||
if [[ -z "${DESIRED_PYTHON:-}" || -z "${DESIRED_CUDA:-}" || -z "${PACKAGE_TYPE:-}" ]]; then
|
||||
echo "USAGE: run_tests.sh PACKAGE_TYPE DESIRED_PYTHON DESIRED_CUDA"
|
||||
echo "The env variable PACKAGE_TYPE must be set to 'manywheel' or 'libtorch'"
|
||||
echo "The env variable PACKAGE_TYPE must be set to 'conda' or 'manywheel' or 'libtorch'"
|
||||
echo "The env variable DESIRED_PYTHON must be set like '2.7mu' or '3.6m' etc"
|
||||
echo "The env variable DESIRED_CUDA must be set like 'cpu' or 'cu80' etc"
|
||||
exit 1
|
||||
|
||||
@ -6,7 +6,7 @@ import itertools
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
|
||||
# We also check that there are [not] cxx11 symbols in libtorch
|
||||
@ -46,17 +46,17 @@ LIBTORCH_PRE_CXX11_PATTERNS = _apply_libtorch_symbols(PRE_CXX11_SYMBOLS)
|
||||
|
||||
|
||||
@functools.lru_cache(100)
|
||||
def get_symbols(lib: str) -> list[tuple[str, str, str]]:
|
||||
def get_symbols(lib: str) -> List[Tuple[str, str, str]]:
|
||||
from subprocess import check_output
|
||||
|
||||
lines = check_output(f'nm "{lib}"|c++filt', shell=True)
|
||||
return [x.split(" ", 2) for x in lines.decode("latin1").split("\n")[:-1]]
|
||||
|
||||
|
||||
def grep_symbols(lib: str, patterns: list[Any]) -> list[str]:
|
||||
def grep_symbols(lib: str, patterns: List[Any]) -> List[str]:
|
||||
def _grep_symbols(
|
||||
symbols: list[tuple[str, str, str]], patterns: list[Any]
|
||||
) -> list[str]:
|
||||
symbols: List[Tuple[str, str, str]], patterns: List[Any]
|
||||
) -> List[str]:
|
||||
rc = []
|
||||
for _s_addr, _s_type, s_name in symbols:
|
||||
for pattern in patterns:
|
||||
|
||||
@ -6,7 +6,6 @@ import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
import torch
|
||||
import torch._dynamo
|
||||
@ -162,32 +161,6 @@ def test_cuda_runtime_errors_captured() -> None:
|
||||
raise RuntimeError("Expected CUDA RuntimeError but have not received!")
|
||||
|
||||
|
||||
def test_cuda_gds_errors_captured() -> None:
|
||||
major_version = int(torch.version.cuda.split(".")[0])
|
||||
minor_version = int(torch.version.cuda.split(".")[1])
|
||||
|
||||
if major_version < 12 or (major_version == 12 and minor_version < 6):
|
||||
print("CUDA version is not supported for GDS smoke test")
|
||||
return
|
||||
|
||||
cuda_exception_missed = True
|
||||
try:
|
||||
print("Testing test_cuda_gds_errors_captured")
|
||||
with NamedTemporaryFile() as f:
|
||||
torch.cuda.gds.GdsFile(f.name, os.O_CREAT | os.O_RDWR)
|
||||
except RuntimeError as e:
|
||||
expected_error = "cuFileHandleRegister failed"
|
||||
if re.search(expected_error, f"{e}"):
|
||||
print(f"Caught CUDA exception with success: {e}")
|
||||
cuda_exception_missed = False
|
||||
else:
|
||||
raise e
|
||||
if cuda_exception_missed:
|
||||
raise RuntimeError(
|
||||
"Expected cuFileHandleRegister failed RuntimeError but have not received!"
|
||||
)
|
||||
|
||||
|
||||
def smoke_test_cuda(
|
||||
package: str, runtime_error_check: str, torch_compile_check: str
|
||||
) -> None:
|
||||
@ -408,7 +381,6 @@ def main() -> None:
|
||||
test_numpy()
|
||||
if is_cuda_system:
|
||||
test_linalg("cuda")
|
||||
test_cuda_gds_errors_captured()
|
||||
|
||||
if options.package == "all":
|
||||
smoke_test_modules()
|
||||
|
||||
@ -12,9 +12,9 @@ export TERM=vt100
|
||||
# shellcheck source=./common.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||
|
||||
# Do not change workspace permissions for ROCm and s390x CI jobs
|
||||
# Do not change workspace permissions for ROCm CI jobs
|
||||
# as it can leave workspace with bad permissions for cancelled jobs
|
||||
if [[ "$BUILD_ENVIRONMENT" != *rocm* && "$BUILD_ENVIRONMENT" != *s390x* && -d /var/lib/jenkins/workspace ]]; then
|
||||
if [[ "$BUILD_ENVIRONMENT" != *rocm* && -d /var/lib/jenkins/workspace ]]; then
|
||||
# Workaround for dind-rootless userid mapping (https://github.com/pytorch/ci-infra/issues/96)
|
||||
WORKSPACE_ORIGINAL_OWNER_ID=$(stat -c '%u' "/var/lib/jenkins/workspace")
|
||||
cleanup_workspace() {
|
||||
@ -46,9 +46,6 @@ BUILD_BIN_DIR="$BUILD_DIR"/bin
|
||||
SHARD_NUMBER="${SHARD_NUMBER:=1}"
|
||||
NUM_TEST_SHARDS="${NUM_TEST_SHARDS:=1}"
|
||||
|
||||
# enable debug asserts in serialization
|
||||
export TORCH_SERIALIZATION_DEBUG=1
|
||||
|
||||
export VALGRIND=ON
|
||||
# export TORCH_INDUCTOR_INSTALL_GXX=ON
|
||||
if [[ "$BUILD_ENVIRONMENT" == *clang9* || "$BUILD_ENVIRONMENT" == *xpu* ]]; then
|
||||
@ -89,13 +86,6 @@ if [[ "$BUILD_ENVIRONMENT" == *clang9* || "$BUILD_ENVIRONMENT" == *xpu* ]]; then
|
||||
export VALGRIND=OFF
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$BUILD_ENVIRONMENT" == *s390x* ]]; then
|
||||
# There are additional warnings on s390x, maybe due to newer gcc.
|
||||
# Skip this check for now
|
||||
export VALGRIND=OFF
|
||||
fi
|
||||
|
||||
if [[ "${PYTORCH_TEST_RERUN_DISABLED_TESTS}" == "1" ]] || [[ "${CONTINUE_THROUGH_ERROR}" == "1" ]]; then
|
||||
# When rerunning disable tests, do not generate core dumps as it could consume
|
||||
# the runner disk space when crashed tests are run multiple times. Running out
|
||||
@ -139,7 +129,7 @@ if [[ "$TEST_CONFIG" == 'default' ]]; then
|
||||
fi
|
||||
|
||||
if [[ "$TEST_CONFIG" == 'distributed' ]] && [[ "$BUILD_ENVIRONMENT" == *rocm* ]]; then
|
||||
export HIP_VISIBLE_DEVICES=0,1,2,3
|
||||
export HIP_VISIBLE_DEVICES=0,1
|
||||
fi
|
||||
|
||||
if [[ "$TEST_CONFIG" == 'slow' ]]; then
|
||||
@ -177,9 +167,6 @@ if [[ "$BUILD_ENVIRONMENT" == *rocm* ]]; then
|
||||
# Print GPU info
|
||||
rocminfo
|
||||
rocminfo | grep -E 'Name:.*\sgfx|Marketing'
|
||||
|
||||
# for benchmarks/dynamo/check_accuracy.py, we need to put results in a rocm specific directory to avoid clashes with cuda
|
||||
MAYBE_ROCM="rocm/"
|
||||
fi
|
||||
|
||||
if [[ "$BUILD_ENVIRONMENT" == *xpu* ]]; then
|
||||
@ -342,7 +329,7 @@ test_inductor_distributed() {
|
||||
python test/run_test.py -i inductor/test_aot_inductor.py -k test_non_default_cuda_device --verbose
|
||||
python test/run_test.py -i inductor/test_aot_inductor.py -k test_replicate_on_devices --verbose
|
||||
python test/run_test.py -i distributed/test_c10d_functional_native.py --verbose
|
||||
python test/run_test.py -i distributed/tensor/test_dtensor_compile.py --verbose
|
||||
python test/run_test.py -i distributed/_tensor/test_dtensor_compile.py --verbose
|
||||
python test/run_test.py -i distributed/tensor/parallel/test_micro_pipeline_tp.py --verbose
|
||||
python test/run_test.py -i distributed/_composable/test_replicate_with_compiler.py --verbose
|
||||
python test/run_test.py -i distributed/_composable/fsdp/test_fully_shard_comm.py --verbose
|
||||
@ -395,32 +382,15 @@ test_inductor_aoti() {
|
||||
CPP_TESTS_DIR="${BUILD_BIN_DIR}" LD_LIBRARY_PATH="${TORCH_LIB_DIR}" python test/run_test.py --cpp --verbose -i cpp/test_aoti_abi_check cpp/test_aoti_inference
|
||||
}
|
||||
|
||||
test_inductor_cpp_wrapper_shard() {
|
||||
if [[ -z "$NUM_TEST_SHARDS" ]]; then
|
||||
echo "NUM_TEST_SHARDS must be defined to run a Python test shard"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test_inductor_cpp_wrapper() {
|
||||
export TORCHINDUCTOR_CPP_WRAPPER=1
|
||||
TEST_REPORTS_DIR=$(pwd)/test/test-reports
|
||||
mkdir -p "$TEST_REPORTS_DIR"
|
||||
|
||||
if [[ "$1" -eq "2" ]]; then
|
||||
# For now, manually put the opinfo tests in shard 2, and all other tests in
|
||||
# shard 1. Test specific things triggering past bugs, for now.
|
||||
python test/run_test.py \
|
||||
--include inductor/test_torchinductor_opinfo \
|
||||
-k 'linalg or to_sparse' \
|
||||
--verbose
|
||||
exit
|
||||
fi
|
||||
# Run certain inductor unit tests with cpp wrapper. In the end state, we should be able to run all the inductor
|
||||
# unit tests with cpp wrapper.
|
||||
python test/run_test.py --include inductor/test_torchinductor.py --verbose
|
||||
|
||||
# Run certain inductor unit tests with cpp wrapper. In the end state, we
|
||||
# should be able to run all the inductor unit tests with cpp_wrapper.
|
||||
python test/run_test.py \
|
||||
--include inductor/test_torchinductor inductor/test_max_autotune inductor/test_cpu_repro \
|
||||
--verbose
|
||||
python test/run_test.py --inductor --include test_torch -k 'take' --verbose
|
||||
|
||||
# Run inductor benchmark tests with cpp wrapper.
|
||||
# Skip benchmark tests if it's in rerun-disabled-mode.
|
||||
@ -433,7 +403,7 @@ test_inductor_cpp_wrapper_shard() {
|
||||
--output "$TEST_REPORTS_DIR/inductor_cpp_wrapper_training.csv"
|
||||
python benchmarks/dynamo/check_accuracy.py \
|
||||
--actual "$TEST_REPORTS_DIR/inductor_cpp_wrapper_training.csv" \
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${MAYBE_ROCM}inductor_timm_training.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/inductor_timm_training.csv"
|
||||
|
||||
python benchmarks/dynamo/torchbench.py --device cuda --accuracy \
|
||||
--bfloat16 --inference --inductor --only hf_T5 --output "$TEST_REPORTS_DIR/inductor_cpp_wrapper_inference.csv"
|
||||
@ -443,7 +413,7 @@ test_inductor_cpp_wrapper_shard() {
|
||||
--bfloat16 --inference --inductor --only moco --output "$TEST_REPORTS_DIR/inductor_cpp_wrapper_inference.csv"
|
||||
python benchmarks/dynamo/check_accuracy.py \
|
||||
--actual "$TEST_REPORTS_DIR/inductor_cpp_wrapper_inference.csv" \
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${MAYBE_ROCM}inductor_torchbench_inference.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/inductor_torchbench_inference.csv"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -518,8 +488,6 @@ test_perf_for_dashboard() {
|
||||
test_inductor_set_cpu_affinity
|
||||
elif [[ "${TEST_CONFIG}" == *cuda_a10g* ]]; then
|
||||
device=cuda_a10g
|
||||
elif [[ "${TEST_CONFIG}" == *rocm* ]]; then
|
||||
device=rocm
|
||||
fi
|
||||
|
||||
for mode in "${modes[@]}"; do
|
||||
@ -552,7 +520,7 @@ test_perf_for_dashboard() {
|
||||
--dynamic-batch-only "$@" \
|
||||
--output "$TEST_REPORTS_DIR/${backend}_dynamic_${suite}_${dtype}_${mode}_${device}_${target}.csv"
|
||||
fi
|
||||
if [[ "$DASHBOARD_TAG" == *cppwrapper-true* ]]; then
|
||||
if [[ "$DASHBOARD_TAG" == *cppwrapper-true* ]] && [[ "$mode" == "inference" ]]; then
|
||||
TORCHINDUCTOR_CPP_WRAPPER=1 $TASKSET python "benchmarks/dynamo/$suite.py" \
|
||||
"${target_flag[@]}" --"$mode" --"$dtype" --backend "$backend" --disable-cudagraphs "$@" \
|
||||
--output "$TEST_REPORTS_DIR/${backend}_cpp_wrapper_${suite}_${dtype}_${mode}_${device}_${target}.csv"
|
||||
@ -636,16 +604,16 @@ test_single_dynamo_benchmark() {
|
||||
TEST_CONFIG=${TEST_CONFIG//_avx512/}
|
||||
fi
|
||||
python "benchmarks/dynamo/$suite.py" \
|
||||
--ci --accuracy --timing --explain --print-compilation-time \
|
||||
--ci --accuracy --timing --explain \
|
||||
"${DYNAMO_BENCHMARK_FLAGS[@]}" \
|
||||
"$@" "${partition_flags[@]}" \
|
||||
--output "$TEST_REPORTS_DIR/${name}_${suite}.csv"
|
||||
python benchmarks/dynamo/check_accuracy.py \
|
||||
--actual "$TEST_REPORTS_DIR/${name}_$suite.csv" \
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${MAYBE_ROCM}${TEST_CONFIG}_${name}.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${TEST_CONFIG}_${name}.csv"
|
||||
python benchmarks/dynamo/check_graph_breaks.py \
|
||||
--actual "$TEST_REPORTS_DIR/${name}_$suite.csv" \
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${MAYBE_ROCM}${TEST_CONFIG}_${name}.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${TEST_CONFIG}_${name}.csv"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -668,7 +636,7 @@ test_inductor_halide() {
|
||||
}
|
||||
|
||||
test_inductor_triton_cpu() {
|
||||
python test/run_test.py --include inductor/test_triton_cpu_backend.py inductor/test_torchinductor_strided_blocks.py --verbose
|
||||
python test/run_test.py --include inductor/test_triton_cpu_backend.py --verbose
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
@ -732,7 +700,7 @@ test_inductor_torchbench_smoketest_perf() {
|
||||
--only $test --output "$TEST_REPORTS_DIR/inductor_warm_start_smoketest_$test.csv"
|
||||
python benchmarks/dynamo/check_accuracy.py \
|
||||
--actual "$TEST_REPORTS_DIR/inductor_warm_start_smoketest_$test.csv" \
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${MAYBE_ROCM}inductor_huggingface_training.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/inductor_huggingface_training.csv"
|
||||
done
|
||||
}
|
||||
|
||||
@ -928,20 +896,10 @@ test_libtorch_api() {
|
||||
else
|
||||
# Exclude IMethodTest that relies on torch::deploy, which will instead be ran in test_deploy
|
||||
OMP_NUM_THREADS=2 TORCH_CPP_TEST_MNIST_PATH="${MNIST_DIR}" python test/run_test.py --cpp --verbose -i cpp/test_api -k "not IMethodTest"
|
||||
|
||||
# On s390x, pytorch is built without llvm.
|
||||
# Even if it would be built with llvm, llvm currently doesn't support used features on s390x and
|
||||
# test fails with errors like:
|
||||
# JIT session error: Unsupported target machine architecture in ELF object pytorch-jitted-objectbuffer
|
||||
# unknown file: Failure
|
||||
# C++ exception with description "valOrErr INTERNAL ASSERT FAILED at "/var/lib/jenkins/workspace/torch/csrc/jit/tensorexpr/llvm_jit.h":34, please report a bug to PyTorch. Unexpected failure in LLVM JIT: Failed to materialize symbols: { (main, { func }) }
|
||||
if [[ "${BUILD_ENVIRONMENT}" != *s390x* ]]; then
|
||||
python test/run_test.py --cpp --verbose -i cpp/test_tensorexpr
|
||||
fi
|
||||
python test/run_test.py --cpp --verbose -i cpp/test_tensorexpr
|
||||
fi
|
||||
|
||||
# quantization is not fully supported on s390x yet
|
||||
if [[ "${BUILD_ENVIRONMENT}" != *android* && "${BUILD_ENVIRONMENT}" != *cuda* && "${BUILD_ENVIRONMENT}" != *asan* && "${BUILD_ENVIRONMENT}" != *s390x* ]]; then
|
||||
if [[ "${BUILD_ENVIRONMENT}" != *android* && "${BUILD_ENVIRONMENT}" != *cuda* && "${BUILD_ENVIRONMENT}" != *asan* ]]; then
|
||||
# NB: This test is not under TORCH_BIN_DIR but under BUILD_BIN_DIR
|
||||
export CPP_TESTS_DIR="${BUILD_BIN_DIR}"
|
||||
python test/run_test.py --cpp --verbose -i cpp/static_runtime_test
|
||||
@ -1439,7 +1397,7 @@ test_executorch() {
|
||||
test_linux_aarch64() {
|
||||
python test/run_test.py --include test_modules test_mkldnn test_mkldnn_fusion test_openmp test_torch test_dynamic_shapes \
|
||||
test_transformers test_multiprocessing test_numpy_interop test_autograd test_binary_ufuncs test_complex test_spectral_ops \
|
||||
test_foreach test_reductions test_unary_ufuncs test_tensor_creation_ops \
|
||||
test_foreach test_reductions test_unary_ufuncs \
|
||||
--shard "$SHARD_NUMBER" "$NUM_TEST_SHARDS" --verbose
|
||||
|
||||
# Dynamo tests
|
||||
@ -1542,7 +1500,7 @@ elif [[ "${TEST_CONFIG}" == *inductor_cpp_wrapper* ]]; then
|
||||
install_torchaudio cuda
|
||||
install_torchvision
|
||||
checkout_install_torchbench hf_T5 llama moco
|
||||
PYTHONPATH=$(pwd)/torchbench test_inductor_cpp_wrapper_shard "$SHARD_NUMBER"
|
||||
PYTHONPATH=$(pwd)/torchbench test_inductor_cpp_wrapper
|
||||
elif [[ "${TEST_CONFIG}" == *inductor* ]]; then
|
||||
install_torchvision
|
||||
test_inductor_shard "${SHARD_NUMBER}"
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
r"""
|
||||
It's used to check basic rnn features with cpu-only.
|
||||
For example, it would throw exception if some components are missing
|
||||
"""
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
import torch.optim as optim
|
||||
|
||||
|
||||
class SimpleCNN(nn.Module):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.conv = nn.Conv2d(1, 1, 3)
|
||||
self.pool = nn.MaxPool2d(2, 2)
|
||||
|
||||
def forward(self, inputs):
|
||||
output = self.pool(F.relu(self.conv(inputs)))
|
||||
output = output.view(1)
|
||||
return output
|
||||
|
||||
|
||||
try:
|
||||
# Mock one infer
|
||||
net = SimpleCNN()
|
||||
net_inputs = torch.rand((1, 1, 5, 5))
|
||||
outputs = net(net_inputs)
|
||||
print(outputs)
|
||||
|
||||
criterion = nn.MSELoss()
|
||||
optimizer = optim.SGD(net.parameters(), lr=0.001, momentum=0.1)
|
||||
|
||||
# Mock one step training
|
||||
label = torch.full((1,), 1.0, dtype=torch.float)
|
||||
loss = criterion(outputs, label)
|
||||
loss.backward()
|
||||
optimizer.step()
|
||||
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
@ -1,13 +0,0 @@
|
||||
r"""
|
||||
It's used to check basic rnn features with cpu-only.
|
||||
For example, it would throw exception if missing some components are missing
|
||||
"""
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
|
||||
|
||||
rnn = nn.RNN(10, 20, 2)
|
||||
inputs = torch.randn(5, 3, 10)
|
||||
h0 = torch.randn(2, 3, 20)
|
||||
output, hn = rnn(inputs, h0)
|
||||
@ -18,9 +18,6 @@ export PYTORCH_FINAL_PACKAGE_DIR="${PYTORCH_FINAL_PACKAGE_DIR:-/c/w/build-result
|
||||
PYTORCH_FINAL_PACKAGE_DIR_WIN=$(cygpath -w "${PYTORCH_FINAL_PACKAGE_DIR}")
|
||||
export PYTORCH_FINAL_PACKAGE_DIR_WIN
|
||||
|
||||
# enable debug asserts in serialization
|
||||
export TORCH_SERIALIZATION_DEBUG=1
|
||||
|
||||
mkdir -p "$TMP_DIR"/build/torch
|
||||
|
||||
export SCRIPT_HELPERS_DIR=$SCRIPT_PARENT_DIR/win-test-helpers
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
@echo off
|
||||
|
||||
echo Dependency ARM Performance Libraries (APL) installation started.
|
||||
|
||||
:: Pre-check for downloads and dependencies folders
|
||||
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
|
||||
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%
|
||||
|
||||
:: Set download URL for the ARM Performance Libraries (APL)
|
||||
set DOWNLOAD_URL="https://developer.arm.com/-/cdn-downloads/permalink/Arm-Performance-Libraries/Version_24.10/arm-performance-libraries_24.10_Windows.msi"
|
||||
set INSTALLER_FILE=%DOWNLOADS_DIR%\arm-performance-libraries.msi
|
||||
|
||||
:: Download installer
|
||||
echo Downloading ARM Performance Libraries (APL)...
|
||||
curl -L -o "%INSTALLER_FILE%" %DOWNLOAD_URL%
|
||||
|
||||
:: Install ARM Performance Libraries (APL)
|
||||
echo Installing ARM Performance Libraries (APL)...
|
||||
msiexec /i "%INSTALLER_FILE%" /qn /norestart ACCEPT_EULA=1 INSTALLFOLDER="%DEPENDENCIES_DIR%"
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed to install ARM Performance Libraries (APL) components. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Add to environment
|
||||
echo ARMPL_DIR=%DEPENDENCIES_DIR%\armpl_24.10\>> %GITHUB_ENV%
|
||||
echo %DEPENDENCIES_DIR%\armpl_24.10\bin\>> %GITHUB_PATH%
|
||||
|
||||
echo Dependency ARM Performance Libraries (APL) installation finished.
|
||||
@ -1,49 +0,0 @@
|
||||
@echo off
|
||||
|
||||
echo Dependency MSVC Build Tools with C++ with ARM64/ARM64EC components installation started.
|
||||
|
||||
:: Pre-check for downloads and dependencies folders
|
||||
if not exist "%DOWNLOADS_DIR%" mkdir "%DOWNLOADS_DIR%"
|
||||
if not exist "%DEPENDENCIES_DIR%" mkdir "%DEPENDENCIES_DIR%"
|
||||
|
||||
:: Set download URL for the Visual Studio Installer
|
||||
set DOWNLOAD_URL=https://aka.ms/vs/17/release/vs_BuildTools.exe
|
||||
set INSTALLER_FILE=%DOWNLOADS_DIR%\vs_BuildTools.exe
|
||||
|
||||
:: Download installer
|
||||
echo Downloading Visual Studio Build Tools with C++ installer...
|
||||
curl -L -o "%INSTALLER_FILE%" %DOWNLOAD_URL%
|
||||
|
||||
:: Install the Visual Studio Build Tools with C++ components
|
||||
echo Installing Visual Studio Build Tools with C++ components...
|
||||
echo Installing MSVC %MSVC_VERSION%
|
||||
if "%MSVC_VERSION%" == "latest" (
|
||||
"%INSTALLER_FILE%" --norestart --nocache --quiet --wait --installPath "%DEPENDENCIES_DIR%\VSBuildTools" ^
|
||||
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 ^
|
||||
--add Microsoft.VisualStudio.Component.VC.ASAN ^
|
||||
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
|
||||
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^
|
||||
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64
|
||||
) else if "%MSVC_VERSION%" == "14.40" (
|
||||
"%INSTALLER_FILE%" --norestart --nocache --quiet --wait --installPath "%DEPENDENCIES_DIR%\VSBuildTools" ^
|
||||
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 ^
|
||||
--add Microsoft.VisualStudio.Component.VC.ASAN ^
|
||||
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
|
||||
--add Microsoft.VisualStudio.Component.VC.14.40.17.10.ARM64 ^
|
||||
--add Microsoft.VisualStudio.Component.VC.14.40.17.10.x86.x64
|
||||
) else if "%MSVC_VERSION%" == "14.36" (
|
||||
"%INSTALLER_FILE%" --norestart --nocache --quiet --wait --installPath "%DEPENDENCIES_DIR%\VSBuildTools" ^
|
||||
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 ^
|
||||
--add Microsoft.VisualStudio.Component.VC.ASAN ^
|
||||
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
|
||||
--add Microsoft.VisualStudio.Component.VC.14.36.17.6.ARM64 ^
|
||||
--add Microsoft.VisualStudio.Component.VC.14.36.17.6.x86.x64
|
||||
)
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed to install Visual Studio Build Tools with C++ components. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Dependency Visual Studio Build Tools with C++ installation finished.
|
||||
@ -1,37 +0,0 @@
|
||||
:: we need to install newer version of Git manually as "-submodules" function is not supported in the default version of runner.
|
||||
|
||||
@echo off
|
||||
|
||||
echo Dependency Git installation started.
|
||||
|
||||
:: Pre-check for downloads and dependencies folders
|
||||
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
|
||||
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%
|
||||
|
||||
:: Set download URL for the Git
|
||||
set DOWNLOAD_URL="https://github.com/git-for-windows/git/releases/download/v2.46.0.windows.1/Git-2.46.0-64-bit.exe"
|
||||
set INSTALLER_FILE=%DOWNLOADS_DIR%\Git-2.46.0-64-bit.exe
|
||||
|
||||
:: Download installer
|
||||
echo Downloading Git...
|
||||
curl -L -o "%INSTALLER_FILE%" %DOWNLOAD_URL%
|
||||
|
||||
:: Install Git
|
||||
echo Installing Git...
|
||||
"%INSTALLER_FILE%" /VERYSILENT /DIR="%DEPENDENCIES_DIR%\git"
|
||||
|
||||
dir %DEPENDENCIES_DIR%\git
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed to install Git. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Enable long paths
|
||||
call "%DEPENDENCIES_DIR%\git\cmd\git.exe" config --system core.longpaths true
|
||||
|
||||
:: Add to PATH
|
||||
echo %DEPENDENCIES_DIR%\git\cmd\;%DEPENDENCIES_DIR%\git\bin\>> %GITHUB_PATH%
|
||||
|
||||
echo Dependency Git installation finished.
|
||||
@ -1,33 +0,0 @@
|
||||
@echo off
|
||||
|
||||
echo Dependency libuv installation started.
|
||||
|
||||
:: Pre-check for downloads and dependencies folders
|
||||
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
|
||||
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%
|
||||
|
||||
:: activate visual studio
|
||||
call "%DEPENDENCIES_DIR%\VSBuildTools\VC\Auxiliary\Build\vcvarsall.bat" arm64
|
||||
where cl.exe
|
||||
|
||||
cd %DEPENDENCIES_DIR%
|
||||
git clone https://github.com/libuv/libuv.git -b v1.39.0
|
||||
|
||||
echo Configuring libuv...
|
||||
mkdir libuv\build
|
||||
cd libuv\build
|
||||
cmake .. -DBUILD_TESTING=OFF
|
||||
|
||||
echo Building libuv...
|
||||
cmake --build . --config Release
|
||||
|
||||
echo Installing libuv...
|
||||
cmake --install . --prefix ../install
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed to install libuv. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Dependency libuv installation finished.
|
||||
@ -1,46 +0,0 @@
|
||||
@echo off
|
||||
|
||||
echo Dependency OpenBLAS installation started.
|
||||
|
||||
:: Pre-check for downloads and dependencies folders
|
||||
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
|
||||
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%
|
||||
|
||||
:: activate visual studio
|
||||
call "%DEPENDENCIES_DIR%\VSBuildTools\VC\Auxiliary\Build\vcvarsall.bat" arm64
|
||||
where cl.exe
|
||||
|
||||
:: Clone OpenBLAS
|
||||
cd %DEPENDENCIES_DIR%
|
||||
git clone https://github.com/OpenMathLib/OpenBLAS.git -b v0.3.29
|
||||
|
||||
echo Configuring OpenBLAS...
|
||||
mkdir OpenBLAS\build
|
||||
cd OpenBLAS\build
|
||||
cmake .. -G Ninja ^
|
||||
-DBUILD_TESTING=0 ^
|
||||
-DBUILD_BENCHMARKS=0 ^
|
||||
-DC_LAPACK=1 ^
|
||||
-DNOFORTRAN=1 ^
|
||||
-DDYNAMIC_ARCH=0 ^
|
||||
-DARCH=arm64 ^
|
||||
-DBINARY=64 ^
|
||||
-DTARGET=GENERIC ^
|
||||
-DUSE_OPENMP=1 ^
|
||||
-DCMAKE_SYSTEM_PROCESSOR=ARM64 ^
|
||||
-DCMAKE_SYSTEM_NAME=Windows ^
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
echo Building OpenBLAS...
|
||||
cmake --build . --config Release
|
||||
|
||||
echo Installing OpenBLAS...
|
||||
cmake --install . --prefix ../install
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed to install OpenBLAS. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Dependency OpenBLAS installation finished.
|
||||
@ -1,41 +0,0 @@
|
||||
@echo off
|
||||
|
||||
echo Dependency Python installation started.
|
||||
|
||||
:: Pre-check for downloads and dependencies folders
|
||||
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
|
||||
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%
|
||||
|
||||
if "%PYTHON_VERSION%"=="Python312" (
|
||||
echo Python version is set to Python312
|
||||
set DOWNLOAD_URL="https://www.python.org/ftp/python/3.12.7/python-3.12.7-arm64.exe"
|
||||
) else if "%PYTHON_VERSION%"=="Python311" (
|
||||
echo Python version is set to Python311
|
||||
set DOWNLOAD_URL="https://www.python.org/ftp/python/3.11.9/python-3.11.9-arm64.exe"
|
||||
) else (
|
||||
echo PYTHON_VERSION not defined, Python version is set to Python312
|
||||
set DOWNLOAD_URL="https://www.python.org/ftp/python/3.12.7/python-3.12.7-arm64.exe"
|
||||
)
|
||||
|
||||
set INSTALLER_FILE=%DOWNLOADS_DIR%\python-installer.exe
|
||||
|
||||
:: Download installer
|
||||
echo Downloading Python...
|
||||
curl -L -o "%INSTALLER_FILE%" %DOWNLOAD_URL%
|
||||
|
||||
:: Install Python
|
||||
echo Installing Python...
|
||||
"%INSTALLER_FILE%" /quiet Include_debug=1 TargetDir="%DEPENDENCIES_DIR%\Python"
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed to install Python. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Add to PATH
|
||||
echo %DEPENDENCIES_DIR%\Python\>> %GITHUB_PATH%
|
||||
echo %DEPENDENCIES_DIR%\Python\scripts\>> %GITHUB_PATH%
|
||||
echo %DEPENDENCIES_DIR%\Python\libs\>> %GITHUB_PATH%
|
||||
|
||||
echo Dependency Python installation finished.
|
||||
@ -1,33 +0,0 @@
|
||||
@echo off
|
||||
|
||||
echo Dependency Rust installation started.
|
||||
|
||||
:: Pre-check for downloads and dependencies folders
|
||||
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
|
||||
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%
|
||||
|
||||
set DOWNLOAD_URL="https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe"
|
||||
set INSTALLER_FILE=%DOWNLOADS_DIR%\rustup-init.exe
|
||||
set RUSTUP_HOME=%DEPENDENCIES_DIR%\rust
|
||||
set CARGO_HOME=%DEPENDENCIES_DIR%\cargo
|
||||
|
||||
:: Download installer
|
||||
echo Downloading Rust...
|
||||
curl -L -o "%INSTALLER_FILE%" %DOWNLOAD_URL%
|
||||
|
||||
:: Install APL
|
||||
echo Installing Rust...
|
||||
"%INSTALLER_FILE%" -q -y --default-host aarch64-pc-windows-msvc --default-toolchain stable --profile default
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed to install Rust. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Add to PATH
|
||||
echo %DEPENDENCIES_DIR%\cargo\bin\>> %GITHUB_PATH%
|
||||
echo RUSTUP_HOME=%DEPENDENCIES_DIR%\rust>> %GITHUB_ENV%
|
||||
echo CARGO_HOME=%DEPENDENCIES_DIR%\cargo>> %GITHUB_ENV%
|
||||
|
||||
echo Dependency Rust installation finished.
|
||||
@ -1,33 +0,0 @@
|
||||
@echo off
|
||||
|
||||
echo Dependency sccache installation started.
|
||||
|
||||
:: Pre-check for downloads and dependencies folders
|
||||
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
|
||||
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%
|
||||
|
||||
:: Set download URL for the sccache
|
||||
set DOWNLOAD_URL="https://github.com/mozilla/sccache/releases/download/v0.8.1/sccache-v0.8.1-x86_64-pc-windows-msvc.zip"
|
||||
set INSTALLER_FILE=%DOWNLOADS_DIR%\sccache.zip
|
||||
|
||||
:: Download installer
|
||||
echo Downloading sccache.zip...
|
||||
curl -L -o "%INSTALLER_FILE%" %DOWNLOAD_URL%
|
||||
|
||||
:: Install sccache
|
||||
echo Extracting sccache.zip...
|
||||
tar -xf "%INSTALLER_FILE%" -C %DEPENDENCIES_DIR%
|
||||
cd %DEPENDENCIES_DIR%
|
||||
ren sccache-v0.8.1-x86_64-pc-windows-msvc sccache
|
||||
cd ..
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed to install sccache. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Add to PATH
|
||||
echo %DEPENDENCIES_DIR%\sccache\>> %GITHUB_PATH%
|
||||
|
||||
echo Dependency sccache installation finished.
|
||||
@ -1,22 +0,0 @@
|
||||
:: change to source directory
|
||||
cd %PYTORCH_ROOT%
|
||||
|
||||
:: activate visual studio
|
||||
call "%DEPENDENCIES_DIR%\VSBuildTools\VC\Auxiliary\Build\vcvarsall.bat" arm64
|
||||
where cl.exe
|
||||
|
||||
:: create virtual environment
|
||||
python -m venv .venv
|
||||
echo * > .venv\.gitignore
|
||||
call .\.venv\Scripts\activate
|
||||
where python
|
||||
|
||||
:: install dependencies
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
pip install pytest numpy
|
||||
|
||||
:: find file name for pytorch wheel
|
||||
for /f "delims=" %%f in ('dir /b "%PYTORCH_FINAL_PACKAGE_DIR%" ^| findstr "torch-"') do set "TORCH_WHEEL_FILENAME=%PYTORCH_FINAL_PACKAGE_DIR%\%%f"
|
||||
|
||||
pip install %TORCH_WHEEL_FILENAME%
|
||||
@ -1,101 +0,0 @@
|
||||
@echo on
|
||||
|
||||
:: environment variables
|
||||
set CMAKE_BUILD_TYPE=%BUILD_TYPE%
|
||||
set CMAKE_C_COMPILER_LAUNCHER=sccache
|
||||
set CMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||||
set libuv_ROOT=%DEPENDENCIES_DIR%\libuv\install
|
||||
set MSSdk=1
|
||||
if defined PYTORCH_BUILD_VERSION (
|
||||
set PYTORCH_BUILD_VERSION=%PYTORCH_BUILD_VERSION%
|
||||
set PYTORCH_BUILD_NUMBER=1
|
||||
)
|
||||
|
||||
:: Set BLAS type
|
||||
if %ENABLE_APL% == 1 (
|
||||
set BLAS=APL
|
||||
set USE_LAPACK=1
|
||||
) else if %ENABLE_OPENBLAS% == 1 (
|
||||
set BLAS=OpenBLAS
|
||||
set OpenBLAS_HOME=%DEPENDENCIES_DIR%\OpenBLAS\install
|
||||
)
|
||||
|
||||
:: activate visual studio
|
||||
call "%DEPENDENCIES_DIR%\VSBuildTools\VC\Auxiliary\Build\vcvarsall.bat" arm64
|
||||
where cl.exe
|
||||
|
||||
:: change to source directory
|
||||
cd %PYTORCH_ROOT%
|
||||
|
||||
:: copy libuv.dll
|
||||
copy %libuv_ROOT%\lib\Release\uv.dll torch\lib\uv.dll
|
||||
|
||||
:: create virtual environment
|
||||
python -m venv .venv
|
||||
echo * > .venv\.gitignore
|
||||
call .\.venv\Scripts\activate
|
||||
where python
|
||||
|
||||
:: python install dependencies
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
:: DISTUTILS_USE_SDK should be set after psutil dependency
|
||||
set DISTUTILS_USE_SDK=1
|
||||
|
||||
:: start sccache server and reset sccache stats
|
||||
sccache --start-server
|
||||
sccache --zero-stats
|
||||
sccache --show-stats
|
||||
|
||||
:: Prepare the environment
|
||||
mkdir libtorch
|
||||
mkdir libtorch\bin
|
||||
mkdir libtorch\cmake
|
||||
mkdir libtorch\include
|
||||
mkdir libtorch\lib
|
||||
mkdir libtorch\share
|
||||
mkdir libtorch\test
|
||||
|
||||
:: Call LibTorch build script
|
||||
python ./tools/build_libtorch.py
|
||||
|
||||
:: Check if there is an error
|
||||
IF ERRORLEVEL 1 exit /b 1
|
||||
IF NOT ERRORLEVEL 0 exit /b 1
|
||||
|
||||
:: Move the files to the correct location
|
||||
move /Y torch\bin\*.* libtorch\bin\
|
||||
move /Y torch\cmake\*.* libtorch\cmake\
|
||||
robocopy /move /e torch\include\ libtorch\include\
|
||||
move /Y torch\lib\*.* libtorch\lib\
|
||||
robocopy /move /e torch\share\ libtorch\share\
|
||||
move /Y torch\test\*.* libtorch\test\
|
||||
move /Y libtorch\bin\*.dll libtorch\lib\
|
||||
|
||||
:: Set version
|
||||
echo %PYTORCH_BUILD_VERSION% > libtorch\build-version
|
||||
git rev-parse HEAD > libtorch\build-hash
|
||||
|
||||
:: Set LIBTORCH_PREFIX
|
||||
IF "%DEBUG%" == "" (
|
||||
set LIBTORCH_PREFIX=libtorch-win-arm64-shared-with-deps
|
||||
) ELSE (
|
||||
set LIBTORCH_PREFIX=libtorch-win-arm64-shared-with-deps-debug
|
||||
)
|
||||
|
||||
:: Create output
|
||||
C:\Windows\System32\tar.exe -cvaf %LIBTORCH_PREFIX%-%PYTORCH_BUILD_VERSION%.zip -C libtorch *
|
||||
|
||||
:: Copy output to target directory
|
||||
if not exist ..\output mkdir ..\output
|
||||
copy /Y "%LIBTORCH_PREFIX%-%PYTORCH_BUILD_VERSION%.zip" "%PYTORCH_FINAL_PACKAGE_DIR%\"
|
||||
copy /Y "%LIBTORCH_PREFIX%-%PYTORCH_BUILD_VERSION%.zip" "%PYTORCH_FINAL_PACKAGE_DIR%\%LIBTORCH_PREFIX%-latest.zip"
|
||||
|
||||
:: Cleanup raw data to save space
|
||||
rmdir /s /q libtorch
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed on build_libtorch. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
@ -1,60 +0,0 @@
|
||||
@echo on
|
||||
|
||||
:: environment variables
|
||||
set CMAKE_BUILD_TYPE=%BUILD_TYPE%
|
||||
set CMAKE_C_COMPILER_LAUNCHER=sccache
|
||||
set CMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||||
set libuv_ROOT=%DEPENDENCIES_DIR%\libuv\install
|
||||
set MSSdk=1
|
||||
if defined PYTORCH_BUILD_VERSION (
|
||||
set PYTORCH_BUILD_VERSION=%PYTORCH_BUILD_VERSION%
|
||||
set PYTORCH_BUILD_NUMBER=1
|
||||
)
|
||||
|
||||
:: Set BLAS type
|
||||
if %ENABLE_APL% == 1 (
|
||||
set BLAS=APL
|
||||
set USE_LAPACK=1
|
||||
) else if %ENABLE_OPENBLAS% == 1 (
|
||||
set BLAS=OpenBLAS
|
||||
set OpenBLAS_HOME=%DEPENDENCIES_DIR%\OpenBLAS\install
|
||||
)
|
||||
|
||||
:: activate visual studio
|
||||
call "%DEPENDENCIES_DIR%\VSBuildTools\VC\Auxiliary\Build\vcvarsall.bat" arm64
|
||||
where cl.exe
|
||||
|
||||
:: change to source directory
|
||||
cd %PYTORCH_ROOT%
|
||||
|
||||
:: copy libuv.dll
|
||||
copy %libuv_ROOT%\lib\Release\uv.dll torch\lib\uv.dll
|
||||
|
||||
:: create virtual environment
|
||||
python -m venv .venv
|
||||
echo * > .venv\.gitignore
|
||||
call .\.venv\Scripts\activate
|
||||
where python
|
||||
|
||||
:: python install dependencies
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
:: DISTUTILS_USE_SDK should be set after psutil dependency
|
||||
set DISTUTILS_USE_SDK=1
|
||||
|
||||
:: start sccache server and reset sccache stats
|
||||
sccache --start-server
|
||||
sccache --zero-stats
|
||||
sccache --show-stats
|
||||
|
||||
:: Call PyTorch build script
|
||||
python setup.py bdist_wheel -d "%PYTORCH_FINAL_PACKAGE_DIR%"
|
||||
|
||||
:: show sccache stats
|
||||
sccache --show-stats
|
||||
|
||||
:: Check if installation was successful
|
||||
if %errorlevel% neq 0 (
|
||||
echo "Failed on build_pytorch. (exitcode = %errorlevel%)"
|
||||
exit /b 1
|
||||
)
|
||||
@ -1,65 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
set "ORIG_PATH=%PATH%"
|
||||
|
||||
if "%PACKAGE_TYPE%" == "wheel" goto wheel
|
||||
if "%PACKAGE_TYPE%" == "libtorch" goto libtorch
|
||||
|
||||
echo "unknown package type"
|
||||
exit /b 1
|
||||
|
||||
:wheel
|
||||
echo "install wheel package"
|
||||
|
||||
echo Running pip install...
|
||||
pip install -q --pre numpy protobuf
|
||||
echo Error level after pip install: %ERRORLEVEL%
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
goto smoke_test
|
||||
|
||||
:smoke_test
|
||||
python -c "import torch"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
echo Running python rnn_smoke.py...
|
||||
python %PYTORCH_ROOT%\.ci\pytorch\test_example_code\rnn_smoke_win_arm64.py
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
echo Checking that basic CNN works...
|
||||
python %PYTORCH_ROOT%\.ci\pytorch\test_example_code\cnn_smoke_win_arm64.py
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
goto end
|
||||
|
||||
:libtorch
|
||||
echo "install and test libtorch"
|
||||
|
||||
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *-latest.zip') do tar -xf "%%i" -C tmp
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
pushd tmp\libtorch
|
||||
|
||||
set VC_VERSION_LOWER=14
|
||||
set VC_VERSION_UPPER=36
|
||||
|
||||
call "%DEPENDENCIES_DIR%\VSBuildTools\VC\Auxiliary\Build\vcvarsall.bat" arm64
|
||||
|
||||
set install_root=%CD%
|
||||
set INCLUDE=%INCLUDE%;%install_root%\include;%install_root%\include\torch\csrc\api\include
|
||||
set LIB=%LIB%;%install_root%\lib
|
||||
set PATH=%PATH%;%install_root%\lib
|
||||
|
||||
cl %PYTORCH_ROOT%\.ci\pytorch\test_example_code\simple-torch-test.cpp c10.lib torch_cpu.lib /EHsc /std:c++17
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
.\simple-torch-test.exe
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
:end
|
||||
set "PATH=%ORIG_PATH%"
|
||||
popd
|
||||
@ -9,13 +9,12 @@ FOR %%v IN (%DESIRED_PYTHON%) DO (
|
||||
set PYTHON_VERSION_STR=%%v
|
||||
set PYTHON_VERSION_STR=!PYTHON_VERSION_STR:.=!
|
||||
conda remove -n py!PYTHON_VERSION_STR! --all -y || rmdir %CONDA_HOME%\envs\py!PYTHON_VERSION_STR! /s
|
||||
if "%%v" == "3.9" call conda create -n py!PYTHON_VERSION_STR! -y numpy=2.0.1 boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.10" call conda create -n py!PYTHON_VERSION_STR! -y -c=conda-forge numpy=2.0.1 boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.11" call conda create -n py!PYTHON_VERSION_STR! -y -c=conda-forge numpy=2.0.1 boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.12" call conda create -n py!PYTHON_VERSION_STR! -y -c=conda-forge numpy=2.0.1 boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.13" call conda create -n py!PYTHON_VERSION_STR! -y -c=conda-forge numpy=2.1.2 boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.13t" call conda create -n py!PYTHON_VERSION_STR! -y -c=conda-forge numpy=2.1.2 boto3 cmake ninja typing_extensions setuptools=72.1.0 python-freethreading python=3.13
|
||||
call conda run -n py!PYTHON_VERSION_STR! pip install pyyaml
|
||||
if "%%v" == "3.8" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=1.11 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.9" call conda create -n py!PYTHON_VERSION_STR! -y -q numpy=2.0.1 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.10" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=2.0.1 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.11" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=2.0.1 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.12" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=2.0.1 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
if "%%v" == "3.13" call conda create -n py!PYTHON_VERSION_STR! -y -q -c=conda-forge numpy=2.1.2 pyyaml boto3 cmake ninja typing_extensions setuptools=72.1.0 python=%%v
|
||||
call conda run -n py!PYTHON_VERSION_STR! pip install mkl-include
|
||||
call conda run -n py!PYTHON_VERSION_STR! pip install mkl-static
|
||||
)
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
@echo off
|
||||
|
||||
set MODULE_NAME=pytorch
|
||||
|
||||
IF NOT EXIST "setup.py" IF NOT EXIST "%MODULE_NAME%" (
|
||||
call internal\clone.bat
|
||||
cd %~dp0
|
||||
) ELSE (
|
||||
call internal\clean.bat
|
||||
)
|
||||
IF ERRORLEVEL 1 goto :eof
|
||||
|
||||
call internal\check_deps.bat
|
||||
IF ERRORLEVEL 1 goto :eof
|
||||
|
||||
REM Check for optional components
|
||||
|
||||
set USE_CUDA=
|
||||
set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
|
||||
|
||||
IF "%NVTOOLSEXT_PATH%"=="" (
|
||||
IF EXIST "C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64\nvToolsExt64_1.lib" (
|
||||
set NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt
|
||||
) ELSE (
|
||||
echo NVTX ^(Visual Studio Extension ^for CUDA^) ^not installed, failing
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
IF "%CUDA_PATH_V128%"=="" (
|
||||
IF EXIST "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\bin\nvcc.exe" (
|
||||
set "CUDA_PATH_V128=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8"
|
||||
) ELSE (
|
||||
echo CUDA 12.8 not found, failing
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
IF "%BUILD_VISION%" == "" (
|
||||
set TORCH_CUDA_ARCH_LIST=5.0;6.0;6.1;7.0;7.5;8.0;8.6;9.0;10.0;12.0
|
||||
set TORCH_NVCC_FLAGS=-Xfatbin -compress-all
|
||||
) ELSE (
|
||||
set NVCC_FLAGS=-D__CUDA_NO_HALF_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=compute_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_90,code=compute_90 -gencode=arch=compute_100,code=compute_100 -gencode=arch=compute_120,code=compute_120
|
||||
)
|
||||
|
||||
set "CUDA_PATH=%CUDA_PATH_V128%"
|
||||
set "PATH=%CUDA_PATH_V128%\bin;%PATH%"
|
||||
|
||||
:optcheck
|
||||
|
||||
call internal\check_opts.bat
|
||||
IF ERRORLEVEL 1 goto :eof
|
||||
|
||||
if exist "%NIGHTLIES_PYTORCH_ROOT%" cd %NIGHTLIES_PYTORCH_ROOT%\..
|
||||
call %~dp0\internal\copy.bat
|
||||
IF ERRORLEVEL 1 goto :eof
|
||||
|
||||
call %~dp0\internal\setup.bat
|
||||
IF ERRORLEVEL 1 goto :eof
|
||||
@ -9,8 +9,7 @@ if "%CUDA_VERSION%" == "xpu" (
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
set SRC_DIR=%~dp0\..
|
||||
|
||||
set SRC_DIR=%NIGHTLIES_PYTORCH_ROOT%
|
||||
if not exist "%SRC_DIR%\temp_build" mkdir "%SRC_DIR%\temp_build"
|
||||
|
||||
set /a CUDA_VER=%CUDA_VERSION%
|
||||
@ -24,9 +23,9 @@ set CUDNN_LIB_FOLDER="lib\x64"
|
||||
if exist "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUDA_VERSION_STR%\bin\nvcc.exe" goto set_cuda_env_vars
|
||||
|
||||
if %CUDA_VER% EQU 118 goto cuda118
|
||||
if %CUDA_VER% EQU 121 goto cuda121
|
||||
if %CUDA_VER% EQU 124 goto cuda124
|
||||
if %CUDA_VER% EQU 126 goto cuda126
|
||||
if %CUDA_VER% EQU 128 goto cuda128
|
||||
|
||||
echo CUDA %CUDA_VERSION_STR% is not supported
|
||||
exit /b 1
|
||||
@ -112,33 +111,6 @@ xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32"
|
||||
|
||||
goto cuda_common
|
||||
|
||||
:cuda128
|
||||
|
||||
set CUDA_INSTALL_EXE=cuda_12.8.0_571.96_windows.exe
|
||||
if not exist "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%" (
|
||||
curl -k -L "https://ossci-windows.s3.amazonaws.com/%CUDA_INSTALL_EXE%" --output "%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%"
|
||||
if errorlevel 1 exit /b 1
|
||||
set "CUDA_SETUP_FILE=%SRC_DIR%\temp_build\%CUDA_INSTALL_EXE%"
|
||||
set "ARGS=cuda_profiler_api_12.8 thrust_12.8 nvcc_12.8 cuobjdump_12.8 nvprune_12.8 nvprof_12.8 cupti_12.8 cublas_12.8 cublas_dev_12.8 cudart_12.8 cufft_12.8 cufft_dev_12.8 curand_12.8 curand_dev_12.8 cusolver_12.8 cusolver_dev_12.8 cusparse_12.8 cusparse_dev_12.8 npp_12.8 npp_dev_12.8 nvrtc_12.8 nvrtc_dev_12.8 nvml_dev_12.8 nvjitlink_12.8 nvtx_12.8"
|
||||
)
|
||||
|
||||
set CUDNN_FOLDER=cudnn-windows-x86_64-9.7.0.66_cuda12-archive
|
||||
set CUDNN_LIB_FOLDER="lib"
|
||||
set "CUDNN_INSTALL_ZIP=%CUDNN_FOLDER%.zip"
|
||||
if not exist "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%" (
|
||||
curl -k -L "http://s3.amazonaws.com/ossci-windows/%CUDNN_INSTALL_ZIP%" --output "%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%"
|
||||
if errorlevel 1 exit /b 1
|
||||
set "CUDNN_SETUP_FILE=%SRC_DIR%\temp_build\%CUDNN_INSTALL_ZIP%"
|
||||
)
|
||||
|
||||
@REM cuDNN 8.3+ required zlib to be installed on the path
|
||||
echo Installing ZLIB dlls
|
||||
curl -k -L "http://s3.amazonaws.com/ossci-windows/zlib123dllx64.zip" --output "%SRC_DIR%\temp_build\zlib123dllx64.zip"
|
||||
7z x "%SRC_DIR%\temp_build\zlib123dllx64.zip" -o"%SRC_DIR%\temp_build\zlib"
|
||||
xcopy /Y "%SRC_DIR%\temp_build\zlib\dll_x64\*.dll" "C:\Windows\System32"
|
||||
|
||||
goto cuda_common
|
||||
|
||||
:cuda_common
|
||||
:: NOTE: We only install CUDA if we don't have it installed already.
|
||||
:: With GHA runners these should be pre-installed as part of our AMI process
|
||||
|
||||
@ -27,6 +27,7 @@ for /F "delims=" %%i in ('wmic path win32_VideoController get name') do (
|
||||
endlocal & set NVIDIA_GPU_EXISTS=%NVIDIA_GPU_EXISTS%
|
||||
|
||||
if "%PACKAGE_TYPE%" == "wheel" goto wheel
|
||||
if "%PACKAGE_TYPE%" == "conda" goto conda
|
||||
if "%PACKAGE_TYPE%" == "libtorch" goto libtorch
|
||||
|
||||
echo "unknown package type"
|
||||
@ -36,7 +37,6 @@ exit /b 1
|
||||
echo "install wheel package"
|
||||
|
||||
set PYTHON_INSTALLER_URL=
|
||||
if "%DESIRED_PYTHON%" == "3.13t" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe"
|
||||
if "%DESIRED_PYTHON%" == "3.13" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.13.0/python-3.13.0-amd64.exe"
|
||||
if "%DESIRED_PYTHON%" == "3.12" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.12.0/python-3.12.0-amd64.exe"
|
||||
if "%DESIRED_PYTHON%" == "3.11" set "PYTHON_INSTALLER_URL=https://www.python.org/ftp/python/3.11.0/python-3.11.0-amd64.exe"
|
||||
@ -47,13 +47,6 @@ if "%PYTHON_INSTALLER_URL%" == "" (
|
||||
echo Python %DESIRED_PYTHON% not supported yet
|
||||
)
|
||||
|
||||
set ADDITIONAL_OPTIONS=""
|
||||
set PYTHON_EXEC="python"
|
||||
if "%DESIRED_PYTHON%" == "3.13t" (
|
||||
set ADDITIONAL_OPTIONS="Include_freethreaded=1"
|
||||
set PYTHON_EXEC="python3.13t"
|
||||
)
|
||||
|
||||
del python-amd64.exe
|
||||
curl --retry 3 -kL "%PYTHON_INSTALLER_URL%" --output python-amd64.exe
|
||||
if errorlevel 1 exit /b 1
|
||||
@ -62,30 +55,85 @@ if errorlevel 1 exit /b 1
|
||||
:: the installed Python to PATH system-wide. Even calling set PATH=%ORIG_PATH% later on won't make
|
||||
:: a change. As the builder directory will be removed after the smoke test, all subsequent non-binary
|
||||
:: jobs will fail to find any Python executable there
|
||||
start /wait "" python-amd64.exe /quiet InstallAllUsers=1 PrependPath=0 Include_test=0 %ADDITIONAL_OPTIONS% TargetDir=%CD%\Python
|
||||
start /wait "" python-amd64.exe /quiet InstallAllUsers=1 PrependPath=0 Include_test=0 TargetDir=%CD%\Python
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
set "PATH=%CD%\Python%PYTHON_VERSION%\Scripts;%CD%\Python;%PATH%"
|
||||
if "%DESIRED_PYTHON%" == "3.13t" %PYTHON_EXEC% -m pip install --pre numpy==2.2.1 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.13" %PYTHON_EXEC% -m pip install --pre numpy==2.1.2 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.12" %PYTHON_EXEC% -m pip install --pre numpy==2.0.2 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.11" %PYTHON_EXEC% -m pip install --pre numpy==2.0.2 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.10" %PYTHON_EXEC% -m pip install --pre numpy==2.0.2 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.9" %PYTHON_EXEC% -m pip install --pre numpy==2.0.2 protobuf
|
||||
|
||||
if "%DESIRED_PYTHON%" == "3.13" pip install -q --pre numpy==2.1.0 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.12" pip install -q --pre numpy==2.0.2 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.11" pip install -q --pre numpy==2.0.2 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.10" pip install -q --pre numpy==2.0.2 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.9" pip install -q --pre numpy==2.0.2 protobuf
|
||||
if "%DESIRED_PYTHON%" == "3.8" pip install -q numpy protobuf
|
||||
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do %PYTHON_EXEC% -m pip install "%%i"
|
||||
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *.whl') do pip install "%%i"
|
||||
if errorlevel 1 exit /b 1
|
||||
|
||||
goto smoke_test
|
||||
|
||||
:conda
|
||||
echo "install conda package"
|
||||
|
||||
:: Install Miniconda3
|
||||
set "CONDA_HOME=%CD%\conda"
|
||||
set "tmp_conda=%CONDA_HOME%"
|
||||
set "miniconda_exe=%CD%\miniconda.exe"
|
||||
set "CONDA_EXTRA_ARGS=cpuonly -c pytorch-nightly"
|
||||
if "%CUDA_VERSION%" == "118" (
|
||||
set "CONDA_EXTRA_ARGS=pytorch-cuda=11.8 -c nvidia -c pytorch-nightly"
|
||||
)
|
||||
if "%CUDA_VERSION%" == "121" (
|
||||
set "CONDA_EXTRA_ARGS=pytorch-cuda=12.1 -c nvidia -c pytorch-nightly"
|
||||
)
|
||||
if "%CUDA_VERSION%" == "124" (
|
||||
set "CONDA_EXTRA_ARGS=pytorch-cuda=12.4 -c nvidia -c pytorch-nightly"
|
||||
)
|
||||
if "%CUDA_VERSION%" == "126" (
|
||||
set "CONDA_EXTRA_ARGS=pytorch-cuda=12.6 -c nvidia -c pytorch-nightly"
|
||||
)
|
||||
|
||||
rmdir /s /q conda
|
||||
del miniconda.exe
|
||||
curl -k https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe -o "%miniconda_exe%"
|
||||
start /wait "" "%miniconda_exe%" /S /InstallationType=JustMe /RegisterPython=0 /AddToPath=0 /D=%tmp_conda%
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
set "PATH=%CONDA_HOME%;%CONDA_HOME%\scripts;%CONDA_HOME%\Library\bin;%PATH%"
|
||||
|
||||
conda create -qyn testenv python=%DESIRED_PYTHON%
|
||||
if errorlevel 1 exit /b 1
|
||||
call conda install -yq conda-build
|
||||
if errorlevel 1 exit /b 1
|
||||
call %CONDA_HOME%\condabin\activate.bat testenv
|
||||
if errorlevel 1 exit /b 1
|
||||
set "NO_ARCH_PATH=%PYTORCH_FINAL_PACKAGE_DIR:/=\%\noarch"
|
||||
mkdir %NO_ARCH_PATH%
|
||||
for /F "delims=" %%i in ('where /R "%PYTORCH_FINAL_PACKAGE_DIR:/=\%" *') do xcopy "%%i" %NO_ARCH_PATH% /Y
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
call conda index %PYTORCH_FINAL_PACKAGE_DIR%
|
||||
if errorlevel 1 exit /b 1
|
||||
call conda install -yq -c "file:///%PYTORCH_FINAL_PACKAGE_DIR%" pytorch==%PYTORCH_BUILD_VERSION% -c pytorch -c numba/label/dev -c nvidia
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
call conda install -yq numpy
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
set /a CUDA_VER=%CUDA_VERSION%
|
||||
set CUDA_VER_MAJOR=%CUDA_VERSION:~0,-1%
|
||||
set CUDA_VER_MINOR=%CUDA_VERSION:~-1,1%
|
||||
set CUDA_VERSION_STR=%CUDA_VER_MAJOR%.%CUDA_VER_MINOR%
|
||||
|
||||
:: Install package we just build
|
||||
|
||||
|
||||
:smoke_test
|
||||
%PYTHON_EXEC% -c "import torch"
|
||||
python -c "import torch"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
echo Checking that MKL is available
|
||||
%PYTHON_EXEC% -c "import torch; exit(0 if torch.backends.mkl.is_available() else 1)"
|
||||
python -c "import torch; exit(0 if torch.backends.mkl.is_available() else 1)"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
if "%NVIDIA_GPU_EXISTS%" == "0" (
|
||||
@ -94,24 +142,24 @@ if "%NVIDIA_GPU_EXISTS%" == "0" (
|
||||
)
|
||||
|
||||
echo Checking that CUDA archs are setup correctly
|
||||
%PYTHON_EXEC% -c "import torch; torch.randn([3,5]).cuda()"
|
||||
python -c "import torch; torch.randn([3,5]).cuda()"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
echo Checking that magma is available
|
||||
%PYTHON_EXEC% -c "import torch; torch.rand(1).cuda(); exit(0 if torch.cuda.has_magma else 1)"
|
||||
python -c "import torch; torch.rand(1).cuda(); exit(0 if torch.cuda.has_magma else 1)"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
echo Checking that CuDNN is available
|
||||
%PYTHON_EXEC% -c "import torch; exit(0 if torch.backends.cudnn.is_available() else 1)"
|
||||
python -c "import torch; exit(0 if torch.backends.cudnn.is_available() else 1)"
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
echo Checking that basic RNN works
|
||||
%PYTHON_EXEC% %PYTORCH_ROOT%\.ci\pytorch\test_example_code\rnn_smoke.py
|
||||
python %PYTORCH_ROOT%\.ci\pytorch\test_example_code\rnn_smoke.py
|
||||
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
echo Checking that basic CNN works
|
||||
%PYTHON_EXEC% %PYTORCH_ROOT%\.ci\pytorch\test_example_code\cnn_smoke.py
|
||||
python %PYTORCH_ROOT%\.ci\pytorch\test_example_code\cnn_smoke.py
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
|
||||
goto end
|
||||
@ -119,6 +167,7 @@ goto end
|
||||
:libtorch
|
||||
echo "install and test libtorch"
|
||||
|
||||
if "%VC_YEAR%" == "2019" powershell internal\vs2019_install.ps1
|
||||
if "%VC_YEAR%" == "2022" powershell internal\vs2022_install.ps1
|
||||
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
@ -130,6 +179,10 @@ pushd tmp\libtorch
|
||||
|
||||
set VC_VERSION_LOWER=17
|
||||
set VC_VERSION_UPPER=18
|
||||
IF "%VC_YEAR%" == "2019" (
|
||||
set VC_VERSION_LOWER=16
|
||||
set VC_VERSION_UPPER=17
|
||||
)
|
||||
|
||||
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
|
||||
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
|
||||
@ -70,6 +70,7 @@ echo "install and test libtorch"
|
||||
pip install cmake
|
||||
echo "installing cmake"
|
||||
|
||||
if "%VC_YEAR%" == "2019" powershell internal\vs2019_install.ps1
|
||||
if "%VC_YEAR%" == "2022" powershell internal\vs2022_install.ps1
|
||||
|
||||
if ERRORLEVEL 1 exit /b 1
|
||||
@ -82,6 +83,10 @@ pushd tmp\libtorch
|
||||
|
||||
set VC_VERSION_LOWER=17
|
||||
set VC_VERSION_UPPER=18
|
||||
IF "%VC_YEAR%" == "2019" (
|
||||
set VC_VERSION_LOWER=16
|
||||
set VC_VERSION_UPPER=17
|
||||
)
|
||||
|
||||
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
|
||||
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
if "%VC_YEAR%" == "2019" powershell windows/internal/vs2019_install.ps1
|
||||
if "%VC_YEAR%" == "2022" powershell windows/internal/vs2022_install.ps1
|
||||
|
||||
set VC_VERSION_LOWER=17
|
||||
set VC_VERSION_UPPER=18
|
||||
|
||||
if "%VC_YEAR%" == "2019" (
|
||||
set VC_VERSION_LOWER=16
|
||||
set VC_VERSION_UPPER=17
|
||||
)
|
||||
|
||||
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
|
||||
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
|
||||
|
||||
48
.ci/pytorch/windows/internal/vs2019_install.ps1
Normal file
48
.ci/pytorch/windows/internal/vs2019_install.ps1
Normal file
@ -0,0 +1,48 @@
|
||||
# https://developercommunity.visualstudio.com/t/install-specific-version-of-vs-component/1142479
|
||||
# https://docs.microsoft.com/en-us/visualstudio/releases/2019/history#release-dates-and-build-numbers
|
||||
|
||||
# 16.8.6 BuildTools
|
||||
$VS_DOWNLOAD_LINK = "https://ossci-windows.s3.us-east-1.amazonaws.com/vs16.8.6_BuildTools.exe"
|
||||
$COLLECT_DOWNLOAD_LINK = "https://aka.ms/vscollect.exe"
|
||||
$VS_INSTALL_ARGS = @("--nocache","--quiet","--wait", "--add Microsoft.VisualStudio.Workload.VCTools",
|
||||
"--add Microsoft.Component.MSBuild",
|
||||
"--add Microsoft.VisualStudio.Component.Roslyn.Compiler",
|
||||
"--add Microsoft.VisualStudio.Component.TextTemplating",
|
||||
"--add Microsoft.VisualStudio.Component.VC.CoreIde",
|
||||
"--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
|
||||
"--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
|
||||
"--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
|
||||
"--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81")
|
||||
|
||||
curl.exe --retry 3 -kL $VS_DOWNLOAD_LINK --output vs_installer.exe
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
echo "Download of the VS 2019 Version 16.8.5 installer failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe") {
|
||||
$existingPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -products "Microsoft.VisualStudio.Product.BuildTools" -version "[16, 17)" -property installationPath
|
||||
if ($existingPath -ne $null) {
|
||||
if (!${env:CIRCLECI}) {
|
||||
echo "Found correctly versioned existing BuildTools installation in $existingPath"
|
||||
exit 0
|
||||
}
|
||||
echo "Found existing BuildTools installation in $existingPath, keeping it"
|
||||
}
|
||||
}
|
||||
|
||||
$process = Start-Process "${PWD}\vs_installer.exe" -ArgumentList $VS_INSTALL_ARGS -NoNewWindow -Wait -PassThru
|
||||
Remove-Item -Path vs_installer.exe -Force
|
||||
$exitCode = $process.ExitCode
|
||||
if (($exitCode -ne 0) -and ($exitCode -ne 3010)) {
|
||||
echo "VS 2019 installer exited with code $exitCode, which should be one of [0, 3010]."
|
||||
curl.exe --retry 3 -kL $COLLECT_DOWNLOAD_LINK --output Collect.exe
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
echo "Download of the VS Collect tool failed."
|
||||
exit 1
|
||||
}
|
||||
Start-Process "${PWD}\Collect.exe" -NoNewWindow -Wait -PassThru
|
||||
New-Item -Path "C:\w\build-results" -ItemType "directory" -Force
|
||||
Copy-Item -Path "C:\Users\${env:USERNAME}\AppData\Local\Temp\vslogs.zip" -Destination "C:\w\build-results\"
|
||||
exit 1
|
||||
}
|
||||
@ -7,9 +7,6 @@ if not "%CUDA_VERSION%" == "xpu" (
|
||||
exit /b 0
|
||||
)
|
||||
|
||||
set SRC_DIR=%NIGHTLIES_PYTORCH_ROOT%
|
||||
if not exist "%SRC_DIR%\temp_build" mkdir "%SRC_DIR%\temp_build"
|
||||
|
||||
set XPU_INSTALL_MODE=%~1
|
||||
if "%XPU_INSTALL_MODE%"=="" goto xpu_bundle_install_start
|
||||
if "%XPU_INSTALL_MODE%"=="bundle" goto xpu_bundle_install_start
|
||||
@ -120,14 +117,3 @@ if errorlevel 1 exit /b 1
|
||||
del xpu_extra.exe
|
||||
|
||||
:xpu_install_end
|
||||
|
||||
if not "%XPU_ENABLE_KINETO%"=="1" goto install_end
|
||||
:: Install Level Zero SDK
|
||||
set XPU_EXTRA_LZ_URL=https://github.com/oneapi-src/level-zero/releases/download/v1.14.0/level-zero-sdk_1.14.0.zip
|
||||
curl -k -L %XPU_EXTRA_LZ_URL% --output "%SRC_DIR%\temp_build\level_zero_sdk.zip"
|
||||
echo "Installing level zero SDK..."
|
||||
7z x "%SRC_DIR%\temp_build\level_zero_sdk.zip" -o"%SRC_DIR%\temp_build\level_zero"
|
||||
set "INCLUDE=%SRC_DIR%\temp_build\level_zero\include;%INCLUDE%"
|
||||
del "%SRC_DIR%\temp_build\level_zero_sdk.zip"
|
||||
|
||||
:install_end
|
||||
|
||||
@ -28,6 +28,11 @@ call "%XPU_BUNDLE_ROOT%\compiler\latest\env\vars.bat"
|
||||
call "%XPU_BUNDLE_ROOT%\ocloc\latest\env\vars.bat"
|
||||
IF ERRORLEVEL 1 goto :eof
|
||||
|
||||
:: Workaround for https://github.com/pytorch/pytorch/issues/134989
|
||||
set CMAKE_SHARED_LINKER_FLAGS=/FORCE:MULTIPLE
|
||||
set CMAKE_MODULE_LINKER_FLAGS=/FORCE:MULTIPLE
|
||||
set CMAKE_EXE_LINKER_FLAGS=/FORCE:MULTIPLE
|
||||
|
||||
if exist "%NIGHTLIES_PYTORCH_ROOT%" cd %NIGHTLIES_PYTORCH_ROOT%\..
|
||||
call %~dp0\internal\copy_cpu.bat
|
||||
IF ERRORLEVEL 1 goto :eof
|
||||
|
||||
@ -130,19 +130,7 @@ export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
|
||||
SETUPTOOLS_PINNED_VERSION="=46.0.0"
|
||||
PYYAML_PINNED_VERSION="=5.3"
|
||||
EXTRA_CONDA_INSTALL_FLAGS=""
|
||||
CONDA_ENV_CREATE_FLAGS=""
|
||||
RENAME_WHEEL=true
|
||||
case $desired_python in
|
||||
3.13t)
|
||||
echo "Using 3.13 deps"
|
||||
SETUPTOOLS_PINNED_VERSION=">=68.0.0"
|
||||
PYYAML_PINNED_VERSION=">=6.0.1"
|
||||
NUMPY_PINNED_VERSION="=2.1.0"
|
||||
CONDA_ENV_CREATE_FLAGS="python-freethreading"
|
||||
EXTRA_CONDA_INSTALL_FLAGS="-c conda-forge"
|
||||
desired_python="3.13"
|
||||
RENAME_WHEEL=false
|
||||
;;
|
||||
3.13)
|
||||
echo "Using 3.13 deps"
|
||||
SETUPTOOLS_PINNED_VERSION=">=68.0.0"
|
||||
@ -181,15 +169,18 @@ esac
|
||||
|
||||
# Install into a fresh env
|
||||
tmp_env_name="wheel_py$python_nodot"
|
||||
conda create ${EXTRA_CONDA_INSTALL_FLAGS} -yn "$tmp_env_name" python="$desired_python" ${CONDA_ENV_CREATE_FLAGS}
|
||||
conda create ${EXTRA_CONDA_INSTALL_FLAGS} -yn "$tmp_env_name" python="$desired_python"
|
||||
source activate "$tmp_env_name"
|
||||
|
||||
pip install "numpy=${NUMPY_PINNED_VERSION}" "pyyaml${PYYAML_PINNED_VERSION}" requests ninja "setuptools${SETUPTOOLS_PINNED_VERSION}" typing_extensions
|
||||
retry pip install -r "${pytorch_rootdir}/requirements.txt" || true
|
||||
retry brew install libomp
|
||||
pip install -q "numpy=${NUMPY_PINNED_VERSION}" "pyyaml${PYYAML_PINNED_VERSION}" requests
|
||||
retry pip install -qr "${pytorch_rootdir}/requirements.txt" || true
|
||||
# TODO : Remove me later (but in the interim, use Anaconda cmake, to find Anaconda installed OpenMP)
|
||||
retry pip uninstall -y cmake
|
||||
retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq llvm-openmp=14.0.6 cmake ninja "setuptools${SETUPTOOLS_PINNED_VERSION}" typing_extensions
|
||||
|
||||
# For USE_DISTRIBUTED=1 on macOS, need libuv, which is build as part of tensorpipe submodule
|
||||
# For USE_DISTRIBUTED=1 on macOS, need libuv and pkg-config to find libuv.
|
||||
export USE_DISTRIBUTED=1
|
||||
retry conda install ${EXTRA_CONDA_INSTALL_FLAGS} -yq libuv pkg-config
|
||||
|
||||
if [[ -n "$CROSS_COMPILE_ARM64" ]]; then
|
||||
export CMAKE_OSX_ARCHITECTURES=arm64
|
||||
@ -231,13 +222,10 @@ echo "The wheel is in $(find $whl_tmp_dir -name '*.whl')"
|
||||
wheel_filename_gen=$(find $whl_tmp_dir -name '*.whl' | head -n1 | xargs -I {} basename {})
|
||||
popd
|
||||
|
||||
if [[ -z "$BUILD_PYTHONLESS" && $RENAME_WHEEL == true ]]; then
|
||||
if [[ -z "$BUILD_PYTHONLESS" ]]; then
|
||||
# Copy the whl to a final destination before tests are run
|
||||
echo "Renaming Wheel file: $wheel_filename_gen to $wheel_filename_new"
|
||||
cp "$whl_tmp_dir/$wheel_filename_gen" "$PYTORCH_FINAL_PACKAGE_DIR/$wheel_filename_new"
|
||||
elif [[ $RENAME_WHEEL == false ]]; then
|
||||
echo "Copying Wheel file: $wheel_filename_gen to $PYTORCH_FINAL_PACKAGE_DIR"
|
||||
cp "$whl_tmp_dir/$wheel_filename_gen" "$PYTORCH_FINAL_PACKAGE_DIR/$wheel_filename_gen"
|
||||
else
|
||||
pushd "$pytorch_rootdir"
|
||||
|
||||
|
||||
@ -30,7 +30,9 @@ fi
|
||||
# Pick docker image
|
||||
export DOCKER_IMAGE=${DOCKER_IMAGE:-}
|
||||
if [[ -z "$DOCKER_IMAGE" ]]; then
|
||||
if [[ "$DESIRED_CUDA" == cpu ]]; then
|
||||
if [[ "$PACKAGE_TYPE" == conda ]]; then
|
||||
export DOCKER_IMAGE="pytorch/conda-cuda"
|
||||
elif [[ "$DESIRED_CUDA" == cpu ]]; then
|
||||
export DOCKER_IMAGE="pytorch/manylinux:cpu"
|
||||
else
|
||||
export DOCKER_IMAGE="pytorch/manylinux-builder:${DESIRED_CUDA:2}"
|
||||
@ -61,7 +63,7 @@ if tagged_version >/dev/null; then
|
||||
# Turns tag v1.6.0-rc1 -> v1.6.0
|
||||
BASE_BUILD_VERSION="$(tagged_version | sed -e 's/^v//' -e 's/-.*$//')"
|
||||
fi
|
||||
if [[ "$(uname)" == 'Darwin' ]]; then
|
||||
if [[ "$(uname)" == 'Darwin' ]] || [[ "$PACKAGE_TYPE" == conda ]]; then
|
||||
export PYTORCH_BUILD_VERSION="${BASE_BUILD_VERSION}"
|
||||
else
|
||||
export PYTORCH_BUILD_VERSION="${BASE_BUILD_VERSION}+$DESIRED_CUDA"
|
||||
@ -147,6 +149,8 @@ export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${PYTORCH_EXTRA_INSTALL_REQUIREMENTS:
|
||||
|
||||
# TODO: We don't need this anymore IIUC
|
||||
export TORCH_PACKAGE_NAME='torch'
|
||||
export TORCH_CONDA_BUILD_FOLDER='pytorch-nightly'
|
||||
export ANACONDA_USER='pytorch'
|
||||
|
||||
export USE_FBGEMM=1
|
||||
export PIP_UPLOAD_FOLDER="$PIP_UPLOAD_FOLDER"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PACKAGE_TYPE=${PACKAGE_TYPE:-wheel}
|
||||
PACKAGE_TYPE=${PACKAGE_TYPE:-conda}
|
||||
|
||||
PKG_DIR=${PKG_DIR:-/tmp/workspace/final_pkgs}
|
||||
|
||||
@ -18,8 +18,10 @@ BUILD_NAME=${BUILD_NAME:-}
|
||||
|
||||
DRY_RUN=${DRY_RUN:-enabled}
|
||||
# Don't actually do work unless explicit
|
||||
ANACONDA="true anaconda"
|
||||
AWS_S3_CP="aws s3 cp --dryrun"
|
||||
if [[ "${DRY_RUN}" = "disabled" ]]; then
|
||||
ANACONDA="anaconda"
|
||||
AWS_S3_CP="aws s3 cp"
|
||||
fi
|
||||
|
||||
@ -32,6 +34,10 @@ if [[ ${BUILD_NAME} == *-full* ]]; then
|
||||
UPLOAD_SUBFOLDER="${UPLOAD_SUBFOLDER}_full"
|
||||
fi
|
||||
|
||||
# Sleep 2 minutes between retries for conda upload
|
||||
retry () {
|
||||
"$@" || (sleep 5m && "$@") || (sleep 5m && "$@") || (sleep 5m && "$@") || (sleep 5m && "$@")
|
||||
}
|
||||
|
||||
do_backup() {
|
||||
local backup_dir
|
||||
@ -43,6 +49,20 @@ do_backup() {
|
||||
)
|
||||
}
|
||||
|
||||
conda_upload() {
|
||||
(
|
||||
set -x
|
||||
retry \
|
||||
${ANACONDA} \
|
||||
upload \
|
||||
${PKG_DIR}/*.tar.bz2 \
|
||||
-u "pytorch-${UPLOAD_CHANNEL}" \
|
||||
--label main \
|
||||
--no-progress \
|
||||
--force
|
||||
)
|
||||
}
|
||||
|
||||
s3_upload() {
|
||||
local extension
|
||||
local pkg_type
|
||||
@ -58,18 +78,31 @@ s3_upload() {
|
||||
for pkg in ${PKG_DIR}/*.${extension}; do
|
||||
(
|
||||
set -x
|
||||
shm_id=$(sha256sum "${pkg}" | awk '{print $1}')
|
||||
${AWS_S3_CP} --no-progress --acl public-read "${pkg}" "${s3_upload_dir}" \
|
||||
--metadata "checksum-sha256=${shm_id}"
|
||||
${AWS_S3_CP} --no-progress --acl public-read "${pkg}" "${s3_upload_dir}"
|
||||
)
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
# Install dependencies (should be a no-op if previously installed)
|
||||
pip install -q awscli uv
|
||||
conda install -yq anaconda-client
|
||||
pip install -q awscli
|
||||
|
||||
case "${PACKAGE_TYPE}" in
|
||||
conda)
|
||||
conda_upload
|
||||
for conda_archive in ${PKG_DIR}/*.tar.bz2; do
|
||||
# Fetch platform (eg. win-64, linux-64, etc.) from index file because
|
||||
# there's no actual conda command to read this
|
||||
subdir=$(\
|
||||
tar -xOf "${conda_archive}" info/index.json \
|
||||
| grep subdir \
|
||||
| cut -d ':' -f2 \
|
||||
| sed -e 's/[[:space:]]//' -e 's/"//g' -e 's/,//' \
|
||||
)
|
||||
BACKUP_DIR="conda/${subdir}"
|
||||
done
|
||||
;;
|
||||
libtorch)
|
||||
s3_upload "zip" "libtorch"
|
||||
BACKUP_DIR="libtorch/${UPLOAD_CHANNEL}/${UPLOAD_SUBFOLDER}"
|
||||
|
||||
@ -8,9 +8,10 @@ export CUDA_VERSION="${DESIRED_CUDA/cu/}"
|
||||
export USE_SCCACHE=1
|
||||
export SCCACHE_BUCKET=ossci-compiler-cache
|
||||
export SCCACHE_IGNORE_SERVER_IO_ERROR=1
|
||||
export VC_YEAR=2022
|
||||
export VC_YEAR=2019
|
||||
|
||||
if [[ "$DESIRED_CUDA" == 'xpu' ]]; then
|
||||
export VC_YEAR=2022
|
||||
export USE_SCCACHE=0
|
||||
export XPU_VERSION=2025.0
|
||||
fi
|
||||
|
||||
@ -4,9 +4,10 @@ set -eux -o pipefail
|
||||
source "${BINARY_ENV_FILE:-/c/w/env}"
|
||||
|
||||
export CUDA_VERSION="${DESIRED_CUDA/cu/}"
|
||||
export VC_YEAR=2022
|
||||
export VC_YEAR=2019
|
||||
|
||||
if [[ "$DESIRED_CUDA" == 'xpu' ]]; then
|
||||
export VC_YEAR=2022
|
||||
export XPU_VERSION=2025.0
|
||||
fi
|
||||
|
||||
|
||||
10
.clang-tidy
10
.clang-tidy
@ -1,9 +1,8 @@
|
||||
---
|
||||
# NOTE there must be no spaces before the '-', so put the comma last.
|
||||
# The check bugprone-unchecked-optional-access is also turned on.
|
||||
# Note that it can cause clang-tidy to hang randomly. The tracking issue
|
||||
# The check bugprone-unchecked-optional-access is also turned off atm
|
||||
# because it causes clang-tidy to hang randomly. The tracking issue
|
||||
# can be found at https://github.com/llvm/llvm-project/issues/69369.
|
||||
# When that happens, we can disable it on the problematic code by NOLINT.
|
||||
InheritParentConfig: true
|
||||
Checks: '
|
||||
bugprone-*,
|
||||
@ -13,10 +12,7 @@ bugprone-*,
|
||||
-bugprone-lambda-function-name,
|
||||
-bugprone-reserved-identifier,
|
||||
-bugprone-swapped-arguments,
|
||||
clang-analyzer-core.*,
|
||||
clang-analyzer-cplusplus.*,
|
||||
clang-analyzer-nullability.*,
|
||||
clang-analyzer-deadcode.*,
|
||||
-bugprone-unchecked-optional-access,
|
||||
clang-diagnostic-missing-prototypes,
|
||||
cppcoreguidelines-*,
|
||||
-cppcoreguidelines-avoid-do-while,
|
||||
|
||||
@ -24,10 +24,6 @@ e3900d2ba5c9f91a24a9ce34520794c8366d5c54
|
||||
2e26976ad3b06ce95dd6afccfdbe124802edf28f
|
||||
# 2021-06-07 Strictly typed everything in `.github` and `tools`
|
||||
737d920b21db9b4292d056ee1329945990656304
|
||||
# 2021-08-12 [codemod][lint][fbcode/c*] Enable BLACK by default
|
||||
b0043072529b81276a69df29e00555333117646c
|
||||
# 2021-08-25 Reformat run_test.py
|
||||
67d8e7b659b19e1ee68208b28bfa7dba73375dbc
|
||||
# 2022-06-09 Apply clang-format to ATen headers
|
||||
95b15c266baaf989ef7b6bbd7c23a2d90bacf687
|
||||
# 2022-06-11 [lint] autoformat test/cpp and torch/csrc
|
||||
@ -48,57 +44,3 @@ a53cda1ddc15336dc1ff0ce1eff2a49cdc5f882e
|
||||
d80939e5e9337e8078f11489afefec59fd42f93b
|
||||
# 2024-06-28 enable UFMT in `torch.utils.data`
|
||||
7cf0b90e49689d45be91aa539fdf54cf2ea8a9a3
|
||||
# 2024-07-03 Enable UFMT on test/test_public_bindings.py (#128389)
|
||||
fe5424d0f8604f6e66d827ae9f94b05cb7119d55
|
||||
# 2024-07-03 Enable UFMT on test/test_public_bindings.py (#128389)
|
||||
c686304277f7cd72331f685605325498cff94a0b
|
||||
# 2024-07-15 Enable UFMT on all of torch/sparse (#130545)
|
||||
535016967ae65a6027f83d6b935a985996223d49
|
||||
# 2024-07-15 [BE][Easy][1/19] enforce style for empty lines in import segments (#129752)
|
||||
a3abfa5cb57203b6a8ba7dff763f4057db8282a8
|
||||
# 2024-07-15 [BE][Easy][2/19] enforce style for empty lines in import segments in `.ci/` and `.github/` (#129753)
|
||||
ba48cf653541e9160dfdefa7bfea885c22e48608
|
||||
# 2024-07-16 [BE][Easy][5/19] enforce style for empty lines in import segments in `tools/` and `torchgen/` (#129756)
|
||||
f6838d521a243dbedc50ae96575720bf2cc8a8ad
|
||||
# 2024-07-17 [BE][Easy][9/19] enforce style for empty lines in import segments in `test/[e-h]*/` (#129760)
|
||||
76169cf69184bd462b9add40f893f57675f8a057
|
||||
# 2024-07-16 [BE][Easy][3/19] enforce style for empty lines in import segments in `benchmarks/` (#129754)
|
||||
c0ed38e644aed812d76b0ec85fae2f6019bf462b
|
||||
# 2024-07-16 [BE][Easy][4/19] enforce style for empty lines in import segments in `functorch/` (#129755)
|
||||
740fb229660f388feddc288c127ab12c82e67d36
|
||||
# 2024-07-17 [BE][Easy][12/19] enforce style for empty lines in import segments in `test/i*/` (#129763)
|
||||
aecc746fccc4495313167e3a7f94210daf457e1d
|
||||
# 2024-07-18 Revert "[BE][Easy][12/19] enforce style for empty lines in import segments in `test/i*/` (#129763)"
|
||||
b732b52f1e4378f8486ceb5e7026be3321c2651c
|
||||
# 2024-07-18 [BE][Easy][12/19] enforce style for empty lines in import segments in `test/i*/` (#129763)
|
||||
134bc4fc34bb02795aa694e66b132dcea5dde1e1
|
||||
# 2024-07-26 [BE][Easy][8/19] enforce style for empty lines in import segments in `test/[k-p]*/` (#129759)
|
||||
fbe6f42dcf1834213e0baa87b87529161df3c4d7
|
||||
# 2024-07-31 [BE][Easy][14/19] enforce style for empty lines in import segments in `torch/_[a-c]*/` and `torch/_[e-h]*/` and `torch/_[j-z]*/` (#129765)
|
||||
e7eeee473c6cb45942e87de5a616b0eb635513d6
|
||||
# 2024-07-31 Fix lint after PR #130572 (#132316)
|
||||
d72e863b3ecd3de4c8ea00518e110da964583f4f
|
||||
# 2024-07-31 [BE][Easy][15/19] enforce style for empty lines in import segments in `torch/_d*/` (#129767)
|
||||
e74ba1b34a476b46e76b4e32afe2d481f97e9a47
|
||||
# 2024-07-31 [BE][Easy][18/19] enforce style for empty lines in import segments in `torch/d*/` (#129770)
|
||||
b25ef91bf158ce459d8654e33c50c8e6ed8db716
|
||||
# 2024-07-20 [BE][Easy][13/19] enforce style for empty lines in import segments in `test/j*/` (#129764)
|
||||
6ff1e43a416c43cd82b210e22ac47384494c172e
|
||||
# 2024-11-01 [Lint] Clang-format all metal kernels (#139530)
|
||||
b3ad45733bd908b7358959ca1e1f8d026f4507eb
|
||||
# 2024-11-17 [BE][MPS] Apply clang-format to mps headers (#140906)
|
||||
99014a297c179862af38ee86bac2051434d3db41
|
||||
# 2024-11-27 Apply clang-format for ATen/core/boxing headers (#141105)
|
||||
19d01a1ef0c0d65768eb0a5c97a25328eec57fbd
|
||||
# 2024-12-05 fix the lint from D66795414 (#142122)
|
||||
65c2086d452ae6966ce9d7fb3cb2eef2fd0d2add
|
||||
# 2024-12-20 Apply clang-format for ATen/core/dispatch headers (#143620)
|
||||
cee06e74eeb54994b97000a02b715a4e63a97951
|
||||
# 2024-12-22 Better fix for f-strings in set_linter for py3.12 (#143725)
|
||||
eebc93d41eeffb936cbf20c9052e1e813d0cc052
|
||||
# 2025-01-04 [mps/BE] Fix linter warning/advice. (#144199)
|
||||
0dc1e6be192b260f1c072d70e1b06a3ac8e109fa
|
||||
# 2025-01-07 Fix lint in `test_provenance_tracing.py` (#144296)
|
||||
61c0a3d1cbaf6420e40ab0f9c9019daa21145e69
|
||||
# 2025-01-09 [BE] fix ruff rule E226: add missing whitespace around operator in f-strings (#144415)
|
||||
dcc3cf7066b4d8cab63ecb73daf1e36b01220a4e
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@ -5,7 +5,7 @@ body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >
|
||||
#### Before submitting a bug, please make sure the issue hasn't been already addressed by searching through [the existing and past issues](https://github.com/pytorch/pytorch/issues?q=is%3Aissue+sort%3Acreated-desc+). Note: Please write your bug report in English to ensure it can be understood and addressed by the development team. If you are filing a bug for torch.compile, please use the [torch.compile issue template](https://github.com/pytorch/pytorch/issues/new?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen&template=pt2-bug-report.yml).
|
||||
#### Before submitting a bug, please make sure the issue hasn't been already addressed by searching through [the existing and past issues](https://github.com/pytorch/pytorch/issues?q=is%3Aissue+sort%3Acreated-desc+).
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 🐛 Describe the bug
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/disable-ci-jobs.md
vendored
2
.github/ISSUE_TEMPLATE/disable-ci-jobs.md
vendored
@ -5,7 +5,7 @@ title: "DISABLED [WORKFLOW_NAME] / [PLATFORM_NAME] / [JOB_NAME]"
|
||||
labels: "module: ci"
|
||||
---
|
||||
|
||||
> For example, DISABLED pull / win-vs2022-cpu-py3 / test (default). Once
|
||||
> For example, DISABLED pull / win-vs2019-cpu-py3 / test (default). Once
|
||||
> created, the job will be disabled within 15 minutes. You can check the
|
||||
> list of disabled jobs at https://ossci-metrics.s3.amazonaws.com/disabled-jobs.json
|
||||
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/documentation.yml
vendored
4
.github/ISSUE_TEMPLATE/documentation.yml
vendored
@ -2,10 +2,6 @@ name: 📚 Documentation
|
||||
description: Report an issue related to https://pytorch.org/docs/stable/index.html
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >
|
||||
#### Note: Please report your documentation issue in English to ensure it can be understood and addressed by the development team.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 📚 The doc issue
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
4
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
@ -2,10 +2,6 @@ name: 🚀 Feature request
|
||||
description: Submit a proposal/request for a new PyTorch feature
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >
|
||||
#### Note: Please write your feature request in English to ensure it can be understood and addressed by the development team.
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 🚀 The feature, motivation and pitch
|
||||
|
||||
6
.github/ISSUE_TEMPLATE/pt2-bug-report.yml
vendored
6
.github/ISSUE_TEMPLATE/pt2-bug-report.yml
vendored
@ -3,10 +3,6 @@ description: Create a report to help us reproduce and fix the bug
|
||||
labels: ["oncall: pt2"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >
|
||||
#### Note: Please write your bug report in English to ensure it can be understood and addressed by the development team.
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >
|
||||
@ -22,8 +18,6 @@ body:
|
||||
|
||||
- If comparing eager and torch.compile at fp16/bf16, you should use fp32 as baseline
|
||||
|
||||
- Ensure rng state used to compare results is equivalent. Use `torch._inductor.config.fallback_random=True` and reset the torch rng seed between comparisons
|
||||
|
||||
If the above requirements are met, add the label "topic: fuzzer" to your issue.
|
||||
|
||||
- type: textarea
|
||||
|
||||
4
.github/actions/diskspace-cleanup/action.yml
vendored
4
.github/actions/diskspace-cleanup/action.yml
vendored
@ -17,10 +17,6 @@ runs:
|
||||
set -ex
|
||||
diskspace_cutoff=${{ inputs.diskspace-cutoff }}
|
||||
docker_root_dir=$(docker info -f '{{.DockerRootDir}}')
|
||||
if [ ! -d "$docker_root_dir" ]; then
|
||||
echo "Docker root directory ($docker_root_dir) does not exist. Skipping disk space check."
|
||||
exit 0
|
||||
fi
|
||||
diskspace=$(df -H --output=pcent ${docker_root_dir} | sed -n 2p | sed 's/%//' | sed 's/ //')
|
||||
msg="Please file an issue on pytorch/pytorch reporting the faulty runner. Include a link to the runner logs so the runner can be identified"
|
||||
if [[ "$diskspace" -ge "$diskspace_cutoff" ]] ; then
|
||||
|
||||
30
.github/actions/setup-rocm/action.yml
vendored
30
.github/actions/setup-rocm/action.yml
vendored
@ -5,6 +5,20 @@ description: Set up ROCm host for CI
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Set DOCKER_HOST
|
||||
shell: bash
|
||||
run: echo "DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Remove leftover Docker config file
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set -ex
|
||||
|
||||
cat ~/.docker/config.json || true
|
||||
# https://stackoverflow.com/questions/64455468/error-when-logging-into-ecr-with-docker-login-error-saving-credentials-not
|
||||
rm -f ~/.docker/config.json
|
||||
|
||||
- name: Stop all running docker containers
|
||||
if: always()
|
||||
shell: bash
|
||||
@ -24,12 +38,6 @@ runs:
|
||||
cat /opt/rocm/.info/version || true
|
||||
whoami
|
||||
|
||||
- name: Runner health check amdgpu info
|
||||
if: always()
|
||||
shell: bash
|
||||
run: |
|
||||
dpkg -l | grep -E " amdgpu"
|
||||
|
||||
- name: Runner health check rocm-smi
|
||||
if: always()
|
||||
shell: bash
|
||||
@ -97,16 +105,8 @@ runs:
|
||||
shell: bash
|
||||
run: |
|
||||
# All GPUs are visible to the runner; visibility, if needed, will be set by run_test.py.
|
||||
# Add render group for container creation.
|
||||
render_gid=`cat /etc/group | grep render | cut -d: -f3`
|
||||
# Ensure GPU isolation if pod is part of kubernetes setup with DEVICE_FLAG.
|
||||
if [ -f "/etc/podinfo/gha-render-devices" ]; then
|
||||
DEVICE_FLAG=$(cat /etc/podinfo/gha-render-devices)
|
||||
else
|
||||
DEVICE_FLAG="--device /dev/dri"
|
||||
fi
|
||||
# The --group-add daemon and --group-add bin are needed in the Ubuntu 24.04 and Almalinux OSs respectively.
|
||||
# This is due to the device files (/dev/kfd & /dev/dri) being owned by video group on bare metal.
|
||||
# This video group ID maps to subgid 1 inside the docker image due to the /etc/subgid entries.
|
||||
# The group name corresponding to group ID 1 can change depending on the OS, so both are necessary.
|
||||
echo "GPU_FLAG=--device=/dev/mem --device=/dev/kfd $DEVICE_FLAG --group-add video --group-add $render_gid --group-add daemon --group-add bin --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --network=host" >> "${GITHUB_ENV}"
|
||||
echo "GPU_FLAG=--device=/dev/mem --device=/dev/kfd --device=/dev/dri --group-add video --group-add daemon --group-add bin" >> "${GITHUB_ENV}"
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
name: upload-utilization-stats
|
||||
|
||||
description: Upload utilization stats to artifacts
|
||||
|
||||
inputs:
|
||||
workflow_run_id:
|
||||
type: string
|
||||
description: 'workflow (run) id of the workflow the test is running'
|
||||
required: True
|
||||
workflow_attempt:
|
||||
type: string
|
||||
description: 'the workflow (run) attempt'
|
||||
required: True
|
||||
workflow_name:
|
||||
description: 'name of the workflow'
|
||||
type: string
|
||||
required: True
|
||||
job_id:
|
||||
type: string
|
||||
description: 'the job (run) id for the test'
|
||||
required: True
|
||||
job_name:
|
||||
type: string
|
||||
description: 'the job name of the test'
|
||||
required: True
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Print Inputs
|
||||
shell: bash
|
||||
run: |
|
||||
echo "workflow_id: ${{inputs.workflow_run_id}}"
|
||||
echo "workflow_attempt: ${{inputs.workflow_attempt}}"
|
||||
echo "workflow_Name: ${{inputs.workflow_name}}"
|
||||
echo "job_id: ${{inputs.job_id}}"
|
||||
echo "job_name: ${{inputs.job_name}}"
|
||||
- uses: nick-fields/retry@v3.0.0
|
||||
name: Setup dependencies
|
||||
with:
|
||||
shell: bash
|
||||
timeout_minutes: 5
|
||||
max_attempts: 5
|
||||
retry_wait_seconds: 30
|
||||
command: |
|
||||
set -eu
|
||||
python3 -m pip install python-dateutil==2.8.2 boto3==1.35.42 pandas==2.1.3
|
||||
- name: Upload utilizatoin stats to s3
|
||||
shell: bash
|
||||
run: |
|
||||
python3 -m tools.stats.upload_utilization_stats.upload_utilization_stats \
|
||||
--workflow-run-id "${{inputs.workflow_run_id}}" \
|
||||
--workflow-name "${{inputs.workflow_name}}" \
|
||||
--workflow-run-attempt "${{inputs.workflow_attempt}}" \
|
||||
--job-id "${{inputs.job_id}}" \
|
||||
--job-name "${{inputs.job_name}}"
|
||||
2
.github/ci_commit_pins/audio.txt
vendored
2
.github/ci_commit_pins/audio.txt
vendored
@ -1 +1 @@
|
||||
f084f34bbb743fada85f66b0ed8041387565e69c
|
||||
b6d4675c7aedc53ba04f3f55786aac1de32be6b4
|
||||
|
||||
1
.github/ci_commit_pins/fbgemm_rocm.txt
vendored
1
.github/ci_commit_pins/fbgemm_rocm.txt
vendored
@ -1 +0,0 @@
|
||||
5fb5024118e9bb9decf96c2b0b1a8f0010bf56be
|
||||
2
.github/ci_commit_pins/torchbench.txt
vendored
2
.github/ci_commit_pins/torchbench.txt
vendored
@ -1 +1 @@
|
||||
373ffb19dc470f4423a3176a4133f8f4b3cdb5bd
|
||||
766a5e3a189384659fd35a68c3b17b88c761aaac
|
||||
|
||||
9
.github/labeler.yml
vendored
9
.github/labeler.yml
vendored
@ -30,9 +30,9 @@
|
||||
- torch/fx/experimental/sym_node.py
|
||||
- torch/fx/experimental/validator.py
|
||||
- torch/fx/experimental/proxy_tensor.py
|
||||
- test/distributed/tensor/test_dtensor_compile.py
|
||||
- test/distributed/_tensor/test_dtensor_compile.py
|
||||
- test/distributed/tensor/parallel/test_fsdp_2d_parallel.py
|
||||
- torch/distributed/tensor/**
|
||||
- torch/distributed/_tensor/**
|
||||
- torch/distributed/fsdp/**
|
||||
- torch/csrc/inductor/**
|
||||
- torch/csrc/dynamo/**
|
||||
@ -107,8 +107,3 @@
|
||||
- torch/csrc/dynamo/compiled_autograd.h
|
||||
- torch/_dynamo/compiled_autograd.py
|
||||
- torch/inductor/test_compiled_autograd.py
|
||||
|
||||
"ciflow/xpu":
|
||||
- torch/csrc/inductor/aoti_include/xpu.h
|
||||
- torch/csrc/inductor/cpp_wrapper/device_internal/xpu.h
|
||||
- torch/csrc/inductor/cpp_wrapper/xpu.h
|
||||
|
||||
41
.github/merge_rules.yaml
vendored
41
.github/merge_rules.yaml
vendored
@ -79,6 +79,7 @@
|
||||
- .ci/docker/ci_commit_pins/triton.txt
|
||||
approved_by:
|
||||
- pytorchbot
|
||||
ignore_flaky_failures: false
|
||||
mandatory_checks_name:
|
||||
- EasyCLA
|
||||
- Lint
|
||||
@ -90,6 +91,7 @@
|
||||
- test/slow_tests.json
|
||||
approved_by:
|
||||
- pytorchbot
|
||||
ignore_flaky_failures: false
|
||||
mandatory_checks_name:
|
||||
- EasyCLA
|
||||
- Lint
|
||||
@ -101,10 +103,12 @@
|
||||
- .ci/docker/ci_commit_pins/executorch.txt
|
||||
approved_by:
|
||||
- pytorchbot
|
||||
ignore_flaky_failures: false
|
||||
mandatory_checks_name:
|
||||
- EasyCLA
|
||||
- Lint
|
||||
- pull
|
||||
- pull / linux-jammy-py3-clang12-executorch / build
|
||||
- pull / linux-jammy-py3-clang12-executorch / test (executorch, 1, 1, linux.2xlarge)
|
||||
|
||||
- name: OSS CI / pytorchbot / XLA
|
||||
patterns:
|
||||
@ -115,7 +119,8 @@
|
||||
mandatory_checks_name:
|
||||
- EasyCLA
|
||||
- Lint
|
||||
- pull
|
||||
- pull / linux-focal-py3_9-clang9-xla / build
|
||||
- pull / linux-focal-py3_9-clang9-xla / test (xla, 1, 1, linux.12xlarge)
|
||||
|
||||
- name: Documentation
|
||||
patterns:
|
||||
@ -242,6 +247,25 @@
|
||||
- Lint
|
||||
- pull
|
||||
|
||||
- name: XPU ATen
|
||||
patterns:
|
||||
- aten/src/ATen/xpu/**
|
||||
- c10/xpu/**
|
||||
- torch/csrc/xpu/**
|
||||
- torch/xpu/**
|
||||
- test/xpu/**
|
||||
- test/test_xpu.py
|
||||
- third_party/xpu.txt
|
||||
- .ci/docker/ci_commit_pins/triton-xpu.txt
|
||||
approved_by:
|
||||
- EikanWang
|
||||
- jgong5
|
||||
- gujinghui
|
||||
mandatory_checks_name:
|
||||
- EasyCLA
|
||||
- Lint
|
||||
- pull
|
||||
|
||||
- name: Distributions
|
||||
patterns:
|
||||
- torch/distributions/**
|
||||
@ -495,19 +519,6 @@
|
||||
- Lint
|
||||
- pull
|
||||
|
||||
- name: XPU
|
||||
patterns:
|
||||
- '**xpu**'
|
||||
- '**sycl**'
|
||||
approved_by:
|
||||
- EikanWang
|
||||
- jgong5
|
||||
- gujinghui
|
||||
mandatory_checks_name:
|
||||
- EasyCLA
|
||||
- Lint
|
||||
- pull
|
||||
|
||||
- name: superuser
|
||||
patterns:
|
||||
- '*'
|
||||
|
||||
7
.github/nitpicks.yml
vendored
7
.github/nitpicks.yml
vendored
@ -3,10 +3,3 @@
|
||||
If you are adding a new function or defaulted argument to native_functions.yaml, you cannot use it from pre-existing Python frontend code until our FC window passes (two weeks). Split your PR into two PRs, one which adds the new C++ functionality, and one that makes use of it from Python, and land them two weeks apart. See https://github.com/pytorch/pytorch/wiki/PyTorch's-Python-Frontend-Backward-and-Forward-Compatibility-Policy#forwards-compatibility-fc for more info.
|
||||
pathFilter:
|
||||
- 'aten/src/ATen/native/native_functions.yaml'
|
||||
|
||||
- markdown: |
|
||||
## Attention! PyTorch one of the C-stable API file was changed
|
||||
You MUST NOT change existing function declarations in this, as this header defines a stable C ABI. If you need to change the signature for a function, introduce a new v2 version of the function and modify code generation to target the new version of the function.
|
||||
pathFilter:
|
||||
- 'torch/csrc/inductor/aoti_torch/c/*'
|
||||
- 'torch/csrc/inductor/aoti_torch/generated/*'
|
||||
|
||||
@ -19,7 +19,8 @@ pytest-rerunfailures==10.3
|
||||
pytest-flakefinder==1.1.0
|
||||
pytest-subtests==0.13.1
|
||||
scipy==1.10.1
|
||||
sympy==1.13.3
|
||||
sympy==1.12.1 ; python_version == "3.8"
|
||||
sympy==1.13.1 ; python_version >= "3.9"
|
||||
unittest-xml-reporting<=3.2.0,>=2.0.0
|
||||
xdoctest==1.1.0
|
||||
filelock==3.6.0
|
||||
|
||||
52
.github/scripts/build_triton_wheel.py
vendored
52
.github/scripts/build_triton_wheel.py
vendored
@ -52,6 +52,7 @@ def build_triton(
|
||||
*,
|
||||
version: str,
|
||||
commit_hash: str,
|
||||
build_conda: bool = False,
|
||||
device: str = "cuda",
|
||||
py_version: Optional[str] = None,
|
||||
release: bool = False,
|
||||
@ -82,6 +83,55 @@ def build_triton(
|
||||
else:
|
||||
check_call(["git", "checkout", commit_hash], cwd=triton_basedir)
|
||||
|
||||
if build_conda:
|
||||
with open(triton_basedir / "meta.yaml", "w") as meta:
|
||||
print(
|
||||
f"package:\n name: torchtriton\n version: {version}\n",
|
||||
file=meta,
|
||||
)
|
||||
print("source:\n path: .\n", file=meta)
|
||||
print(
|
||||
"build:\n string: py{{py}}\n number: 1\n script: cd python; "
|
||||
"python setup.py install --record=record.txt\n",
|
||||
" script_env:\n - MAX_JOBS\n",
|
||||
file=meta,
|
||||
)
|
||||
print(
|
||||
"requirements:\n host:\n - python\n - setuptools\n - pybind11\n"
|
||||
" run:\n - python\n - filelock\n - pytorch\n",
|
||||
file=meta,
|
||||
)
|
||||
print(
|
||||
"about:\n home: https://github.com/openai/triton\n license: MIT\n summary:"
|
||||
" 'A language and compiler for custom Deep Learning operation'",
|
||||
file=meta,
|
||||
)
|
||||
|
||||
patch_init_py(
|
||||
triton_pythondir / "triton" / "__init__.py",
|
||||
version=f"{version}",
|
||||
)
|
||||
if py_version is None:
|
||||
py_version = f"{sys.version_info.major}.{sys.version_info.minor}"
|
||||
check_call(
|
||||
[
|
||||
"conda",
|
||||
"build",
|
||||
"--python",
|
||||
py_version,
|
||||
"-c",
|
||||
"pytorch-nightly",
|
||||
"--output-folder",
|
||||
tmpdir,
|
||||
".",
|
||||
],
|
||||
cwd=triton_basedir,
|
||||
env=env,
|
||||
)
|
||||
conda_path = next(iter(Path(tmpdir).glob("linux-64/torchtriton*.bz2")))
|
||||
shutil.copy(conda_path, Path.cwd())
|
||||
return Path.cwd() / conda_path.name
|
||||
|
||||
# change built wheel name and version
|
||||
env["TRITON_WHEEL_NAME"] = triton_pkg_name
|
||||
if with_clang_ldd:
|
||||
@ -122,6 +172,7 @@ def main() -> None:
|
||||
|
||||
parser = ArgumentParser("Build Triton binaries")
|
||||
parser.add_argument("--release", action="store_true")
|
||||
parser.add_argument("--build-conda", action="store_true")
|
||||
parser.add_argument(
|
||||
"--device", type=str, default="cuda", choices=["cuda", "rocm", "xpu"]
|
||||
)
|
||||
@ -137,6 +188,7 @@ def main() -> None:
|
||||
args.commit_hash if args.commit_hash else read_triton_pin(args.device)
|
||||
),
|
||||
version=args.triton_version,
|
||||
build_conda=args.build_conda,
|
||||
py_version=args.py_version,
|
||||
release=args.release,
|
||||
with_clang_ldd=args.with_clang_ldd,
|
||||
|
||||
10
.github/scripts/cherry_pick.py
vendored
10
.github/scripts/cherry_pick.py
vendored
@ -3,7 +3,7 @@
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from typing import Any, cast, Optional
|
||||
from typing import Any, cast, Dict, List, Optional
|
||||
from urllib.error import HTTPError
|
||||
|
||||
from github_utils import gh_fetch_url, gh_post_pr_comment, gh_query_issues_by_labels
|
||||
@ -67,7 +67,7 @@ def get_release_version(onto_branch: str) -> Optional[str]:
|
||||
|
||||
def get_tracker_issues(
|
||||
org: str, project: str, onto_branch: str
|
||||
) -> list[dict[str, Any]]:
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Find the tracker issue from the repo. The tracker issue needs to have the title
|
||||
like [VERSION] Release Tracker following the convention on PyTorch
|
||||
@ -117,7 +117,7 @@ def cherry_pick(
|
||||
continue
|
||||
|
||||
res = cast(
|
||||
dict[str, Any],
|
||||
Dict[str, Any],
|
||||
post_tracker_issue_comment(
|
||||
org,
|
||||
project,
|
||||
@ -220,7 +220,7 @@ def submit_pr(
|
||||
|
||||
def post_pr_comment(
|
||||
org: str, project: str, pr_num: int, msg: str, dry_run: bool = False
|
||||
) -> list[dict[str, Any]]:
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Post a comment on the PR itself to point to the cherry picking PR when success
|
||||
or print the error when failure
|
||||
@ -255,7 +255,7 @@ def post_tracker_issue_comment(
|
||||
classification: str,
|
||||
fixes: str,
|
||||
dry_run: bool = False,
|
||||
) -> list[dict[str, Any]]:
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Post a comment on the tracker issue (if any) to record the cherry pick
|
||||
"""
|
||||
|
||||
@ -6,7 +6,7 @@ import re
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
import requests
|
||||
from gitutils import retries_decorator
|
||||
@ -76,7 +76,7 @@ DISABLED_TESTS_JSON = (
|
||||
|
||||
|
||||
@retries_decorator()
|
||||
def query_db(query: str, params: dict[str, Any]) -> list[dict[str, Any]]:
|
||||
def query_db(query: str, params: Dict[str, Any]) -> List[Dict[str, Any]]:
|
||||
return query_clickhouse(query, params)
|
||||
|
||||
|
||||
@ -97,7 +97,7 @@ def download_log_worker(temp_dir: str, id: int, name: str) -> None:
|
||||
f.write(data)
|
||||
|
||||
|
||||
def printer(item: tuple[str, tuple[int, str, list[Any]]], extra: str) -> None:
|
||||
def printer(item: Tuple[str, Tuple[int, str, List[Any]]], extra: str) -> None:
|
||||
test, (_, link, _) = item
|
||||
print(f"{link:<55} {test:<120} {extra}")
|
||||
|
||||
@ -107,25 +107,21 @@ def close_issue(num: int) -> None:
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
"Authorization": f"token {os.environ['GITHUB_TOKEN']}",
|
||||
}
|
||||
response = requests.post(
|
||||
requests.post(
|
||||
f"https://api.github.com/repos/pytorch/pytorch/issues/{num}/comments",
|
||||
data=json.dumps({"body": CLOSING_COMMENT}),
|
||||
headers=headers,
|
||||
)
|
||||
if response.status_code != 201:
|
||||
raise RuntimeError(f"Failed to comment on issue {num}: {response.text}")
|
||||
response = requests.patch(
|
||||
requests.patch(
|
||||
f"https://api.github.com/repos/pytorch/pytorch/issues/{num}",
|
||||
data=json.dumps({"state": "closed"}),
|
||||
headers=headers,
|
||||
)
|
||||
if response.status_code != 200:
|
||||
raise RuntimeError(f"Failed to close issue {num}: {response.text}")
|
||||
|
||||
|
||||
def check_if_exists(
|
||||
item: tuple[str, tuple[int, str, list[str]]], all_logs: list[str]
|
||||
) -> tuple[bool, str]:
|
||||
item: Tuple[str, Tuple[int, str, List[str]]], all_logs: List[str]
|
||||
) -> Tuple[bool, str]:
|
||||
test, (_, link, _) = item
|
||||
# Test names should look like `test_a (module.path.classname)`
|
||||
reg = re.match(r"(\S+) \((\S*)\)", test)
|
||||
@ -194,13 +190,6 @@ if __name__ == "__main__":
|
||||
if args.dry_run:
|
||||
print("dry run, not actually closing")
|
||||
else:
|
||||
failed = False
|
||||
for item in to_be_closed:
|
||||
_, (num, _, _) = item
|
||||
try:
|
||||
close_issue(num)
|
||||
except RuntimeError as e:
|
||||
print(e)
|
||||
failed = True
|
||||
if failed:
|
||||
sys.exit(1)
|
||||
close_issue(num)
|
||||
|
||||
14
.github/scripts/collect_ciflow_labels.py
vendored
14
.github/scripts/collect_ciflow_labels.py
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, cast
|
||||
from typing import Any, cast, Dict, List, Set
|
||||
|
||||
import yaml
|
||||
|
||||
@ -10,9 +10,9 @@ import yaml
|
||||
GITHUB_DIR = Path(__file__).parent.parent
|
||||
|
||||
|
||||
def get_workflows_push_tags() -> set[str]:
|
||||
def get_workflows_push_tags() -> Set[str]:
|
||||
"Extract all known push tags from workflows"
|
||||
rc: set[str] = set()
|
||||
rc: Set[str] = set()
|
||||
for fname in (GITHUB_DIR / "workflows").glob("*.yml"):
|
||||
with fname.open("r") as f:
|
||||
wf_yml = yaml.safe_load(f)
|
||||
@ -25,19 +25,19 @@ def get_workflows_push_tags() -> set[str]:
|
||||
return rc
|
||||
|
||||
|
||||
def filter_ciflow_tags(tags: set[str]) -> list[str]:
|
||||
def filter_ciflow_tags(tags: Set[str]) -> List[str]:
|
||||
"Return sorted list of ciflow tags"
|
||||
return sorted(
|
||||
tag[:-2] for tag in tags if tag.startswith("ciflow/") and tag.endswith("/*")
|
||||
)
|
||||
|
||||
|
||||
def read_probot_config() -> dict[str, Any]:
|
||||
def read_probot_config() -> Dict[str, Any]:
|
||||
with (GITHUB_DIR / "pytorch-probot.yml").open("r") as f:
|
||||
return cast(dict[str, Any], yaml.safe_load(f))
|
||||
return cast(Dict[str, Any], yaml.safe_load(f))
|
||||
|
||||
|
||||
def update_probot_config(labels: set[str]) -> None:
|
||||
def update_probot_config(labels: Set[str]) -> None:
|
||||
orig = read_probot_config()
|
||||
orig["ciflow_push_tags"] = filter_ciflow_tags(labels)
|
||||
with (GITHUB_DIR / "pytorch-probot.yml").open("w") as f:
|
||||
|
||||
28
.github/scripts/delete_old_branches.py
vendored
28
.github/scripts/delete_old_branches.py
vendored
@ -4,7 +4,7 @@ import re
|
||||
from datetime import datetime
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable
|
||||
from typing import Any, Callable, Dict, List, Set
|
||||
|
||||
from github_utils import gh_fetch_json_dict, gh_graphql
|
||||
from gitutils import GitRepo
|
||||
@ -112,7 +112,7 @@ def convert_gh_timestamp(date: str) -> float:
|
||||
return datetime.strptime(date, "%Y-%m-%dT%H:%M:%SZ").timestamp()
|
||||
|
||||
|
||||
def get_branches(repo: GitRepo) -> dict[str, Any]:
|
||||
def get_branches(repo: GitRepo) -> Dict[str, Any]:
|
||||
# Query locally for branches, group by branch base name (e.g. gh/blah/base -> gh/blah), and get the most recent branch
|
||||
git_response = repo._run_git(
|
||||
"for-each-ref",
|
||||
@ -120,7 +120,7 @@ def get_branches(repo: GitRepo) -> dict[str, Any]:
|
||||
"--format=%(refname) %(committerdate:iso-strict)",
|
||||
"refs/remotes/origin",
|
||||
)
|
||||
branches_by_base_name: dict[str, Any] = {}
|
||||
branches_by_base_name: Dict[str, Any] = {}
|
||||
for line in git_response.splitlines():
|
||||
branch, date = line.split(" ")
|
||||
re_branch = re.match(r"refs/remotes/origin/(.*)", branch)
|
||||
@ -140,14 +140,14 @@ def get_branches(repo: GitRepo) -> dict[str, Any]:
|
||||
|
||||
def paginate_graphql(
|
||||
query: str,
|
||||
kwargs: dict[str, Any],
|
||||
termination_func: Callable[[list[dict[str, Any]]], bool],
|
||||
get_data: Callable[[dict[str, Any]], list[dict[str, Any]]],
|
||||
get_page_info: Callable[[dict[str, Any]], dict[str, Any]],
|
||||
) -> list[Any]:
|
||||
kwargs: Dict[str, Any],
|
||||
termination_func: Callable[[List[Dict[str, Any]]], bool],
|
||||
get_data: Callable[[Dict[str, Any]], List[Dict[str, Any]]],
|
||||
get_page_info: Callable[[Dict[str, Any]], Dict[str, Any]],
|
||||
) -> List[Any]:
|
||||
hasNextPage = True
|
||||
endCursor = None
|
||||
data: list[dict[str, Any]] = []
|
||||
data: List[Dict[str, Any]] = []
|
||||
while hasNextPage:
|
||||
ESTIMATED_TOKENS[0] += 1
|
||||
res = gh_graphql(query, cursor=endCursor, **kwargs)
|
||||
@ -159,11 +159,11 @@ def paginate_graphql(
|
||||
return data
|
||||
|
||||
|
||||
def get_recent_prs() -> dict[str, Any]:
|
||||
def get_recent_prs() -> Dict[str, Any]:
|
||||
now = datetime.now().timestamp()
|
||||
|
||||
# Grab all PRs updated in last CLOSED_PR_RETENTION days
|
||||
pr_infos: list[dict[str, Any]] = paginate_graphql(
|
||||
pr_infos: List[Dict[str, Any]] = paginate_graphql(
|
||||
GRAPHQL_ALL_PRS_BY_UPDATED_AT,
|
||||
{"owner": "pytorch", "repo": "pytorch"},
|
||||
lambda data: (
|
||||
@ -190,7 +190,7 @@ def get_recent_prs() -> dict[str, Any]:
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def get_open_prs() -> list[dict[str, Any]]:
|
||||
def get_open_prs() -> List[Dict[str, Any]]:
|
||||
return paginate_graphql(
|
||||
GRAPHQL_OPEN_PRS,
|
||||
{"owner": "pytorch", "repo": "pytorch"},
|
||||
@ -200,8 +200,8 @@ def get_open_prs() -> list[dict[str, Any]]:
|
||||
)
|
||||
|
||||
|
||||
def get_branches_with_magic_label_or_open_pr() -> set[str]:
|
||||
pr_infos: list[dict[str, Any]] = paginate_graphql(
|
||||
def get_branches_with_magic_label_or_open_pr() -> Set[str]:
|
||||
pr_infos: List[Dict[str, Any]] = paginate_graphql(
|
||||
GRAPHQL_NO_DELETE_BRANCH_LABEL,
|
||||
{"owner": "pytorch", "repo": "pytorch"},
|
||||
lambda data: False,
|
||||
|
||||
4
.github/scripts/file_io_utils.py
vendored
4
.github/scripts/file_io_utils.py
vendored
@ -2,7 +2,7 @@ import json
|
||||
import re
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, List
|
||||
|
||||
import boto3 # type: ignore[import]
|
||||
|
||||
@ -77,7 +77,7 @@ def upload_file_to_s3(file_name: Path, bucket: str, key: str) -> None:
|
||||
|
||||
def download_s3_objects_with_prefix(
|
||||
bucket_name: str, prefix: str, download_folder: Path
|
||||
) -> list[Path]:
|
||||
) -> List[Path]:
|
||||
s3 = boto3.resource("s3")
|
||||
bucket = s3.Bucket(bucket_name)
|
||||
|
||||
|
||||
60
.github/scripts/filter_test_configs.py
vendored
60
.github/scripts/filter_test_configs.py
vendored
@ -8,9 +8,9 @@ import subprocess
|
||||
import sys
|
||||
import warnings
|
||||
from enum import Enum
|
||||
from functools import cache
|
||||
from functools import lru_cache
|
||||
from logging import info
|
||||
from typing import Any, Callable, Optional
|
||||
from typing import Any, Callable, Dict, List, Optional, Set
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
import yaml
|
||||
@ -32,7 +32,7 @@ def is_cuda_or_rocm_job(job_name: Optional[str]) -> bool:
|
||||
|
||||
# Supported modes when running periodically. Only applying the mode when
|
||||
# its lambda condition returns true
|
||||
SUPPORTED_PERIODICAL_MODES: dict[str, Callable[[Optional[str]], bool]] = {
|
||||
SUPPORTED_PERIODICAL_MODES: Dict[str, Callable[[Optional[str]], bool]] = {
|
||||
# Memory leak check is only needed for CUDA and ROCm jobs which utilize GPU memory
|
||||
"mem_leak_check": is_cuda_or_rocm_job,
|
||||
"rerun_disabled_tests": lambda job_name: True,
|
||||
@ -102,8 +102,8 @@ def parse_args() -> Any:
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@cache
|
||||
def get_pr_info(pr_number: int) -> dict[str, Any]:
|
||||
@lru_cache(maxsize=None)
|
||||
def get_pr_info(pr_number: int) -> Dict[str, Any]:
|
||||
"""
|
||||
Dynamically get PR information
|
||||
"""
|
||||
@ -116,7 +116,7 @@ def get_pr_info(pr_number: int) -> dict[str, Any]:
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
"Authorization": f"token {github_token}",
|
||||
}
|
||||
json_response: dict[str, Any] = download_json(
|
||||
json_response: Dict[str, Any] = download_json(
|
||||
url=f"{pytorch_github_api}/issues/{pr_number}",
|
||||
headers=headers,
|
||||
)
|
||||
@ -128,7 +128,7 @@ def get_pr_info(pr_number: int) -> dict[str, Any]:
|
||||
return json_response
|
||||
|
||||
|
||||
def get_labels(pr_number: int) -> set[str]:
|
||||
def get_labels(pr_number: int) -> Set[str]:
|
||||
"""
|
||||
Dynamically get the latest list of labels from the pull request
|
||||
"""
|
||||
@ -138,14 +138,14 @@ def get_labels(pr_number: int) -> set[str]:
|
||||
}
|
||||
|
||||
|
||||
def filter_labels(labels: set[str], label_regex: Any) -> set[str]:
|
||||
def filter_labels(labels: Set[str], label_regex: Any) -> Set[str]:
|
||||
"""
|
||||
Return the list of matching labels
|
||||
"""
|
||||
return {l for l in labels if re.match(label_regex, l)}
|
||||
|
||||
|
||||
def filter(test_matrix: dict[str, list[Any]], labels: set[str]) -> dict[str, list[Any]]:
|
||||
def filter(test_matrix: Dict[str, List[Any]], labels: Set[str]) -> Dict[str, List[Any]]:
|
||||
"""
|
||||
Select the list of test config to run from the test matrix. The logic works
|
||||
as follows:
|
||||
@ -157,7 +157,7 @@ def filter(test_matrix: dict[str, list[Any]], labels: set[str]) -> dict[str, lis
|
||||
|
||||
If the PR has none of the test-config label, all tests are run as usual.
|
||||
"""
|
||||
filtered_test_matrix: dict[str, list[Any]] = {"include": []}
|
||||
filtered_test_matrix: Dict[str, List[Any]] = {"include": []}
|
||||
|
||||
for entry in test_matrix.get("include", []):
|
||||
config_name = entry.get("config", "")
|
||||
@ -185,8 +185,8 @@ def filter(test_matrix: dict[str, list[Any]], labels: set[str]) -> dict[str, lis
|
||||
|
||||
|
||||
def filter_selected_test_configs(
|
||||
test_matrix: dict[str, list[Any]], selected_test_configs: set[str]
|
||||
) -> dict[str, list[Any]]:
|
||||
test_matrix: Dict[str, List[Any]], selected_test_configs: Set[str]
|
||||
) -> Dict[str, List[Any]]:
|
||||
"""
|
||||
Keep only the selected configs if the list if not empty. Otherwise, keep all test configs.
|
||||
This filter is used when the workflow is dispatched manually.
|
||||
@ -194,7 +194,7 @@ def filter_selected_test_configs(
|
||||
if not selected_test_configs:
|
||||
return test_matrix
|
||||
|
||||
filtered_test_matrix: dict[str, list[Any]] = {"include": []}
|
||||
filtered_test_matrix: Dict[str, List[Any]] = {"include": []}
|
||||
for entry in test_matrix.get("include", []):
|
||||
config_name = entry.get("config", "")
|
||||
if not config_name:
|
||||
@ -207,12 +207,12 @@ def filter_selected_test_configs(
|
||||
|
||||
|
||||
def set_periodic_modes(
|
||||
test_matrix: dict[str, list[Any]], job_name: Optional[str]
|
||||
) -> dict[str, list[Any]]:
|
||||
test_matrix: Dict[str, List[Any]], job_name: Optional[str]
|
||||
) -> Dict[str, List[Any]]:
|
||||
"""
|
||||
Apply all periodic modes when running under a schedule
|
||||
"""
|
||||
scheduled_test_matrix: dict[str, list[Any]] = {
|
||||
scheduled_test_matrix: Dict[str, List[Any]] = {
|
||||
"include": [],
|
||||
}
|
||||
|
||||
@ -229,8 +229,8 @@ def set_periodic_modes(
|
||||
|
||||
|
||||
def mark_unstable_jobs(
|
||||
workflow: str, job_name: str, test_matrix: dict[str, list[Any]]
|
||||
) -> dict[str, list[Any]]:
|
||||
workflow: str, job_name: str, test_matrix: Dict[str, List[Any]]
|
||||
) -> Dict[str, List[Any]]:
|
||||
"""
|
||||
Check the list of unstable jobs and mark them accordingly. Note that if a job
|
||||
is unstable, all its dependents will also be marked accordingly
|
||||
@ -245,8 +245,8 @@ def mark_unstable_jobs(
|
||||
|
||||
|
||||
def remove_disabled_jobs(
|
||||
workflow: str, job_name: str, test_matrix: dict[str, list[Any]]
|
||||
) -> dict[str, list[Any]]:
|
||||
workflow: str, job_name: str, test_matrix: Dict[str, List[Any]]
|
||||
) -> Dict[str, List[Any]]:
|
||||
"""
|
||||
Check the list of disabled jobs, remove the current job and all its dependents
|
||||
if it exists in the list
|
||||
@ -261,15 +261,15 @@ def remove_disabled_jobs(
|
||||
|
||||
|
||||
def _filter_jobs(
|
||||
test_matrix: dict[str, list[Any]],
|
||||
test_matrix: Dict[str, List[Any]],
|
||||
issue_type: IssueType,
|
||||
target_cfg: Optional[str] = None,
|
||||
) -> dict[str, list[Any]]:
|
||||
) -> Dict[str, List[Any]]:
|
||||
"""
|
||||
An utility function used to actually apply the job filter
|
||||
"""
|
||||
# The result will be stored here
|
||||
filtered_test_matrix: dict[str, list[Any]] = {"include": []}
|
||||
filtered_test_matrix: Dict[str, List[Any]] = {"include": []}
|
||||
|
||||
# This is an issue to disable a CI job
|
||||
if issue_type == IssueType.DISABLED:
|
||||
@ -302,10 +302,10 @@ def _filter_jobs(
|
||||
def process_jobs(
|
||||
workflow: str,
|
||||
job_name: str,
|
||||
test_matrix: dict[str, list[Any]],
|
||||
test_matrix: Dict[str, List[Any]],
|
||||
issue_type: IssueType,
|
||||
url: str,
|
||||
) -> dict[str, list[Any]]:
|
||||
) -> Dict[str, List[Any]]:
|
||||
"""
|
||||
Both disabled and unstable jobs are in the following format:
|
||||
|
||||
@ -441,7 +441,7 @@ def process_jobs(
|
||||
return test_matrix
|
||||
|
||||
|
||||
def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any:
|
||||
def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any:
|
||||
for _ in range(num_retries):
|
||||
try:
|
||||
req = Request(url=url, headers=headers)
|
||||
@ -462,7 +462,7 @@ def set_output(name: str, val: Any) -> None:
|
||||
print(f"::set-output name={name}::{val}")
|
||||
|
||||
|
||||
def parse_reenabled_issues(s: Optional[str]) -> list[str]:
|
||||
def parse_reenabled_issues(s: Optional[str]) -> List[str]:
|
||||
# NB: When the PR body is empty, GitHub API returns a None value, which is
|
||||
# passed into this function
|
||||
if not s:
|
||||
@ -477,7 +477,7 @@ def parse_reenabled_issues(s: Optional[str]) -> list[str]:
|
||||
return issue_numbers
|
||||
|
||||
|
||||
def get_reenabled_issues(pr_body: str = "") -> list[str]:
|
||||
def get_reenabled_issues(pr_body: str = "") -> List[str]:
|
||||
default_branch = f"origin/{os.environ.get('GIT_DEFAULT_BRANCH', 'main')}"
|
||||
try:
|
||||
commit_messages = subprocess.check_output(
|
||||
@ -489,12 +489,12 @@ def get_reenabled_issues(pr_body: str = "") -> list[str]:
|
||||
return parse_reenabled_issues(pr_body) + parse_reenabled_issues(commit_messages)
|
||||
|
||||
|
||||
def check_for_setting(labels: set[str], body: str, setting: str) -> bool:
|
||||
def check_for_setting(labels: Set[str], body: str, setting: str) -> bool:
|
||||
return setting in labels or f"[{setting}]" in body
|
||||
|
||||
|
||||
def perform_misc_tasks(
|
||||
labels: set[str], test_matrix: dict[str, list[Any]], job_name: str, pr_body: str
|
||||
labels: Set[str], test_matrix: Dict[str, List[Any]], job_name: str, pr_body: str
|
||||
) -> None:
|
||||
"""
|
||||
In addition to apply the filter logic, the script also does the following
|
||||
|
||||
190
.github/scripts/generate_binary_build_matrix.py
vendored
190
.github/scripts/generate_binary_build_matrix.py
vendored
@ -12,23 +12,13 @@ architectures:
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Optional
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
|
||||
# NOTE: Also update the CUDA sources in tools/nightly.py when changing this list
|
||||
CUDA_ARCHES = ["11.8", "12.4", "12.6", "12.8"]
|
||||
CUDA_ARCHES_FULL_VERSION = {
|
||||
"11.8": "11.8.0",
|
||||
"12.4": "12.4.1",
|
||||
"12.6": "12.6.3",
|
||||
"12.8": "12.8.0",
|
||||
}
|
||||
CUDA_ARCHES_CUDNN_VERSION = {
|
||||
"11.8": "9",
|
||||
"12.4": "9",
|
||||
"12.6": "9",
|
||||
"12.8": "9",
|
||||
}
|
||||
CUDA_ARCHES = ["11.8", "12.4", "12.6"]
|
||||
CUDA_ARCHES_FULL_VERSION = {"11.8": "11.8.0", "12.4": "12.4.1", "12.6": "12.6.3"}
|
||||
CUDA_ARCHES_CUDNN_VERSION = {"11.8": "9", "12.4": "9", "12.6": "9"}
|
||||
|
||||
# NOTE: Also update the ROCm sources in tools/nightly.py when changing this list
|
||||
ROCM_ARCHES = ["6.2.4", "6.3"]
|
||||
@ -41,7 +31,7 @@ CPU_AARCH64_ARCH = ["cpu-aarch64"]
|
||||
|
||||
CPU_S390X_ARCH = ["cpu-s390x"]
|
||||
|
||||
CUDA_AARCH64_ARCHES = ["12.6-aarch64", "12.8-aarch64"]
|
||||
CUDA_AARCH64_ARCH = ["cuda-aarch64"]
|
||||
|
||||
|
||||
PYTORCH_EXTRA_INSTALL_REQUIREMENTS = {
|
||||
@ -69,7 +59,7 @@ PYTORCH_EXTRA_INSTALL_REQUIREMENTS = {
|
||||
"nvidia-cusolver-cu12==11.6.1.9; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparse-cu12==12.3.1.170; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparselt-cu12==0.6.2; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.25.1; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.21.5; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvtx-cu12==12.4.127; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvjitlink-cu12==12.4.127; platform_system == 'Linux' and platform_machine == 'x86_64'"
|
||||
),
|
||||
@ -84,26 +74,9 @@ PYTORCH_EXTRA_INSTALL_REQUIREMENTS = {
|
||||
"nvidia-cusolver-cu12==11.7.1.2; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparse-cu12==12.5.4.2; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparselt-cu12==0.6.3; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.25.1; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.21.5; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvtx-cu12==12.6.77; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvjitlink-cu12==12.6.85; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cufile-cu12==1.11.1.6; platform_system == 'Linux' and platform_machine == 'x86_64'"
|
||||
),
|
||||
"12.8": (
|
||||
"nvidia-cuda-nvrtc-cu12==12.8.61; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cuda-runtime-cu12==12.8.57; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cuda-cupti-cu12==12.8.57; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cudnn-cu12==9.7.1.26; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cublas-cu12==12.8.3.14; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cufft-cu12==11.3.3.41; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-curand-cu12==10.3.9.55; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusolver-cu12==11.7.2.55; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparse-cu12==12.5.7.53; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparselt-cu12==0.6.3; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.25.1; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvtx-cu12==12.8.55; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvjitlink-cu12==12.8.61; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cufile-cu12==1.13.0.11; platform_system == 'Linux' and platform_machine == 'x86_64'"
|
||||
"nvidia-nvjitlink-cu12==12.6.85; platform_system == 'Linux' and platform_machine == 'x86_64'"
|
||||
),
|
||||
"xpu": (
|
||||
"intel-cmplr-lib-rt==2025.0.2 | "
|
||||
@ -112,11 +85,37 @@ PYTORCH_EXTRA_INSTALL_REQUIREMENTS = {
|
||||
"intel-sycl-rt==2025.0.2 | "
|
||||
"tcmlib==1.2.0 | "
|
||||
"umf==0.9.1 | "
|
||||
"intel-pti==0.10.0"
|
||||
"intel-pti==0.10.0; platform_system == 'Linux' and platform_machine == 'x86_64'"
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def get_nccl_submodule_version() -> str:
|
||||
from pathlib import Path
|
||||
|
||||
nccl_version_mk = (
|
||||
Path(__file__).absolute().parents[2]
|
||||
/ "third_party"
|
||||
/ "nccl"
|
||||
/ "nccl"
|
||||
/ "makefiles"
|
||||
/ "version.mk"
|
||||
)
|
||||
if not nccl_version_mk.exists():
|
||||
raise RuntimeError(
|
||||
"Please make sure that nccl submodule is checked out when importing this script"
|
||||
)
|
||||
with nccl_version_mk.open("r") as f:
|
||||
content = f.read()
|
||||
d = {}
|
||||
for l in content.split("\n"):
|
||||
if not l.startswith("NCCL_"):
|
||||
continue
|
||||
(k, v) = l.split(":=")
|
||||
d[k.strip()] = v.strip()
|
||||
return f"{d['NCCL_MAJOR']}.{d['NCCL_MINOR']}.{d['NCCL_PATCH']}"
|
||||
|
||||
|
||||
def get_nccl_wheel_version(arch_version: str) -> str:
|
||||
import re
|
||||
|
||||
@ -128,26 +127,12 @@ def get_nccl_wheel_version(arch_version: str) -> str:
|
||||
]
|
||||
|
||||
|
||||
def read_nccl_pin(arch_version: str) -> str:
|
||||
from pathlib import Path
|
||||
|
||||
nccl_pin_path = os.path.join(
|
||||
Path(__file__).absolute().parents[2],
|
||||
".ci",
|
||||
"docker",
|
||||
"ci_commit_pins",
|
||||
f"nccl-cu{arch_version[:2]}.txt",
|
||||
)
|
||||
with open(nccl_pin_path) as f:
|
||||
return f.read().strip()
|
||||
|
||||
|
||||
def validate_nccl_dep_consistency(arch_version: str) -> None:
|
||||
nccl_release_tag = read_nccl_pin(arch_version)
|
||||
wheel_ver = get_nccl_wheel_version(arch_version)
|
||||
if not nccl_release_tag.startswith(f"v{wheel_ver}"):
|
||||
submodule_ver = get_nccl_submodule_version()
|
||||
if wheel_ver != submodule_ver:
|
||||
raise RuntimeError(
|
||||
f"{arch_version} NCCL release tag version {nccl_release_tag} does not correspond to wheel version {wheel_ver}"
|
||||
f"NCCL submodule version {submodule_ver} differs from wheel version {wheel_ver}"
|
||||
)
|
||||
|
||||
|
||||
@ -164,7 +149,7 @@ def arch_type(arch_version: str) -> str:
|
||||
return "cpu-aarch64"
|
||||
elif arch_version in CPU_S390X_ARCH:
|
||||
return "cpu-s390x"
|
||||
elif arch_version in CUDA_AARCH64_ARCHES:
|
||||
elif arch_version in CUDA_AARCH64_ARCH:
|
||||
return "cuda-aarch64"
|
||||
else: # arch_version should always be "cpu" in this case
|
||||
return "cpu"
|
||||
@ -178,10 +163,6 @@ WHEEL_CONTAINER_IMAGES = {
|
||||
gpu_arch: f"pytorch/manylinux2_28-builder:cuda{gpu_arch}-{DEFAULT_TAG}"
|
||||
for gpu_arch in CUDA_ARCHES
|
||||
},
|
||||
**{
|
||||
gpu_arch: f"pytorch/manylinuxaarch64-builder:cuda{gpu_arch.replace('-aarch64', '')}-{DEFAULT_TAG}"
|
||||
for gpu_arch in CUDA_AARCH64_ARCHES
|
||||
},
|
||||
**{
|
||||
gpu_arch: f"pytorch/manylinux2_28-builder:rocm{gpu_arch}-{DEFAULT_TAG}"
|
||||
for gpu_arch in ROCM_ARCHES
|
||||
@ -191,13 +172,23 @@ WHEEL_CONTAINER_IMAGES = {
|
||||
"cpu-cxx11-abi": f"pytorch/manylinuxcxx11-abi-builder:cpu-cxx11-abi-{DEFAULT_TAG}",
|
||||
"cpu-aarch64": f"pytorch/manylinux2_28_aarch64-builder:cpu-aarch64-{DEFAULT_TAG}",
|
||||
"cpu-s390x": f"pytorch/manylinuxs390x-builder:cpu-s390x-{DEFAULT_TAG}",
|
||||
"cuda-aarch64": f"pytorch/manylinuxaarch64-builder:cuda12.6-{DEFAULT_TAG}",
|
||||
}
|
||||
|
||||
|
||||
PRE_CXX11_ABI = "pre-cxx11"
|
||||
CXX11_ABI = "cxx11-abi"
|
||||
RELEASE = "release"
|
||||
DEBUG = "debug"
|
||||
|
||||
LIBTORCH_CONTAINER_IMAGES: dict[tuple[str, str], str] = {
|
||||
LIBTORCH_CONTAINER_IMAGES: Dict[Tuple[str, str], str] = {
|
||||
**{
|
||||
(
|
||||
gpu_arch,
|
||||
PRE_CXX11_ABI,
|
||||
): f"pytorch/manylinux-builder:cuda{gpu_arch}-{DEFAULT_TAG}"
|
||||
for gpu_arch in CUDA_ARCHES
|
||||
},
|
||||
**{
|
||||
(
|
||||
gpu_arch,
|
||||
@ -212,10 +203,11 @@ LIBTORCH_CONTAINER_IMAGES: dict[tuple[str, str], str] = {
|
||||
): f"pytorch/libtorch-cxx11-builder:rocm{gpu_arch}-{DEFAULT_TAG}"
|
||||
for gpu_arch in ROCM_ARCHES
|
||||
},
|
||||
("cpu", PRE_CXX11_ABI): f"pytorch/manylinux-builder:cpu-{DEFAULT_TAG}",
|
||||
("cpu", CXX11_ABI): f"pytorch/libtorch-cxx11-builder:cpu-{DEFAULT_TAG}",
|
||||
}
|
||||
|
||||
FULL_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t"]
|
||||
FULL_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
|
||||
|
||||
|
||||
def translate_desired_cuda(gpu_arch_type: str, gpu_arch_version: str) -> str:
|
||||
@ -225,35 +217,29 @@ def translate_desired_cuda(gpu_arch_type: str, gpu_arch_version: str) -> str:
|
||||
"cpu-cxx11-abi": "cpu-cxx11-abi",
|
||||
"cpu-s390x": "cpu",
|
||||
"cuda": f"cu{gpu_arch_version.replace('.', '')}",
|
||||
"cuda-aarch64": f"cu{gpu_arch_version.replace('-aarch64', '').replace('.', '')}",
|
||||
"cuda-aarch64": "cu126",
|
||||
"rocm": f"rocm{gpu_arch_version}",
|
||||
"xpu": "xpu",
|
||||
}.get(gpu_arch_type, gpu_arch_version)
|
||||
|
||||
|
||||
def list_without(in_list: list[str], without: list[str]) -> list[str]:
|
||||
def list_without(in_list: List[str], without: List[str]) -> List[str]:
|
||||
return [item for item in in_list if item not in without]
|
||||
|
||||
|
||||
def generate_libtorch_matrix(
|
||||
os: str,
|
||||
abi_version: str,
|
||||
arches: Optional[list[str]] = None,
|
||||
libtorch_variants: Optional[list[str]] = None,
|
||||
) -> list[dict[str, str]]:
|
||||
arches: Optional[List[str]] = None,
|
||||
libtorch_variants: Optional[List[str]] = None,
|
||||
) -> List[Dict[str, str]]:
|
||||
if arches is None:
|
||||
arches = ["cpu"]
|
||||
if os == "linux":
|
||||
arches += CUDA_ARCHES
|
||||
arches += ROCM_ARCHES
|
||||
# skip CUDA 12.8 builds for libtorch
|
||||
if "12.8" in arches:
|
||||
arches.remove("12.8")
|
||||
elif os == "windows":
|
||||
arches += CUDA_ARCHES
|
||||
# skip CUDA 12.8 builds on Windows
|
||||
if "12.8" in arches:
|
||||
arches.remove("12.8")
|
||||
if libtorch_variants is None:
|
||||
libtorch_variants = [
|
||||
"shared-with-deps",
|
||||
@ -262,7 +248,7 @@ def generate_libtorch_matrix(
|
||||
"static-without-deps",
|
||||
]
|
||||
|
||||
ret: list[dict[str, str]] = []
|
||||
ret: List[Dict[str, str]] = []
|
||||
for arch_version in arches:
|
||||
for libtorch_variant in libtorch_variants:
|
||||
# one of the values in the following list must be exactly
|
||||
@ -271,7 +257,9 @@ def generate_libtorch_matrix(
|
||||
gpu_arch_type = arch_type(arch_version)
|
||||
gpu_arch_version = "" if arch_version == "cpu" else arch_version
|
||||
# ROCm builds without-deps failed even in ROCm runners; skip for now
|
||||
if gpu_arch_type == "rocm" and ("without-deps" in libtorch_variant):
|
||||
if gpu_arch_type == "rocm" and (
|
||||
"without-deps" in libtorch_variant or "pre-cxx11" in abi_version
|
||||
):
|
||||
continue
|
||||
ret.append(
|
||||
{
|
||||
@ -299,17 +287,17 @@ def generate_libtorch_matrix(
|
||||
|
||||
def generate_wheels_matrix(
|
||||
os: str,
|
||||
arches: Optional[list[str]] = None,
|
||||
python_versions: Optional[list[str]] = None,
|
||||
arches: Optional[List[str]] = None,
|
||||
python_versions: Optional[List[str]] = None,
|
||||
use_split_build: bool = False,
|
||||
) -> list[dict[str, str]]:
|
||||
) -> List[Dict[str, str]]:
|
||||
package_type = "wheel"
|
||||
if os == "linux" or os == "linux-aarch64" or os == "linux-s390x":
|
||||
# NOTE: We only build manywheel packages for x86_64 and aarch64 and s390x linux
|
||||
package_type = "manywheel"
|
||||
|
||||
if python_versions is None:
|
||||
python_versions = FULL_PYTHON_VERSIONS
|
||||
python_versions = FULL_PYTHON_VERSIONS + ["3.13", "3.13t"]
|
||||
|
||||
if arches is None:
|
||||
# Define default compute archivectures
|
||||
@ -318,19 +306,16 @@ def generate_wheels_matrix(
|
||||
arches += CPU_CXX11_ABI_ARCH + CUDA_ARCHES + ROCM_ARCHES + XPU_ARCHES
|
||||
elif os == "windows":
|
||||
arches += CUDA_ARCHES + XPU_ARCHES
|
||||
# skip CUDA 12.8 builds on Windows until available
|
||||
if "12.8" in arches:
|
||||
arches.remove("12.8")
|
||||
elif os == "linux-aarch64":
|
||||
# Separate new if as the CPU type is different and
|
||||
# Only want the one arch as the CPU type is different and
|
||||
# uses different build/test scripts
|
||||
arches = CPU_AARCH64_ARCH + CUDA_AARCH64_ARCHES
|
||||
arches = ["cpu-aarch64", "cuda-aarch64"]
|
||||
elif os == "linux-s390x":
|
||||
# Only want the one arch as the CPU type is different and
|
||||
# uses different build/test scripts
|
||||
arches = ["cpu-s390x"]
|
||||
|
||||
ret: list[dict[str, str]] = []
|
||||
ret: List[Dict[str, str]] = []
|
||||
for python_version in python_versions:
|
||||
for arch_version in arches:
|
||||
gpu_arch_type = arch_type(arch_version)
|
||||
@ -340,19 +325,38 @@ def generate_wheels_matrix(
|
||||
or arch_version == "cpu-cxx11-abi"
|
||||
or arch_version == "cpu-aarch64"
|
||||
or arch_version == "cpu-s390x"
|
||||
or arch_version == "cuda-aarch64"
|
||||
or arch_version == "xpu"
|
||||
else arch_version
|
||||
)
|
||||
|
||||
# TODO: Enable python 3.13t on cpu-s390x
|
||||
if gpu_arch_type == "cpu-s390x" and python_version == "3.13t":
|
||||
# TODO: Enable python 3.13 on aarch64, windows
|
||||
if (
|
||||
os
|
||||
not in [
|
||||
"linux",
|
||||
"linux-s390x",
|
||||
"linux-aarch64",
|
||||
"macos-arm64",
|
||||
"windows",
|
||||
]
|
||||
) and python_version in ["3.13", "3.13t"]:
|
||||
continue
|
||||
|
||||
# TODO: Enable python 3.13t on xpu and cpu-s390x or MacOS or Windows
|
||||
if (
|
||||
gpu_arch_type in ["xpu", "cpu-s390x"]
|
||||
or os == "macos-arm64"
|
||||
or os == "linux-aarch64"
|
||||
or os == "windows"
|
||||
) and python_version == "3.13t":
|
||||
continue
|
||||
|
||||
if use_split_build and (
|
||||
arch_version not in ["12.6", "12.4", "11.8", "cpu"] or os != "linux"
|
||||
):
|
||||
raise RuntimeError(
|
||||
"Split build is only supported on linux with cuda 12*, 11.8, and cpu.\n"
|
||||
"Split build is only supported on linux with cuda 12.6, 12.4, 11.8, and cpu.\n"
|
||||
f"Currently attempting to build on arch version {arch_version} and os {os}.\n"
|
||||
"Please modify the matrix generation to exclude this combination."
|
||||
)
|
||||
@ -360,9 +364,9 @@ def generate_wheels_matrix(
|
||||
# cuda linux wheels require PYTORCH_EXTRA_INSTALL_REQUIREMENTS to install
|
||||
|
||||
if (
|
||||
arch_version in ["12.8", "12.6", "12.4", "11.8"]
|
||||
arch_version in ["12.6", "12.4", "11.8"]
|
||||
and os == "linux"
|
||||
or arch_version in CUDA_AARCH64_ARCHES
|
||||
or arch_version == "cuda-aarch64"
|
||||
):
|
||||
ret.append(
|
||||
{
|
||||
@ -381,12 +385,9 @@ def generate_wheels_matrix(
|
||||
if os != "linux-aarch64"
|
||||
else ""
|
||||
),
|
||||
"build_name": (
|
||||
f"{package_type}-py{python_version}-{gpu_arch_type}"
|
||||
f"{'-' if 'aarch64' in gpu_arch_type else ''}{gpu_arch_version.replace('-aarch64', '')}".replace(
|
||||
".", "_"
|
||||
)
|
||||
), # include special case for aarch64 build, remove the -aarch64 postfix
|
||||
"build_name": f"{package_type}-py{python_version}-{gpu_arch_type}{gpu_arch_version}".replace( # noqa: B950
|
||||
".", "_"
|
||||
),
|
||||
}
|
||||
)
|
||||
# Special build building to use on Colab. Python 3.11 for 12.4 CUDA
|
||||
@ -443,7 +444,6 @@ def generate_wheels_matrix(
|
||||
return ret
|
||||
|
||||
|
||||
validate_nccl_dep_consistency("12.8")
|
||||
validate_nccl_dep_consistency("12.6")
|
||||
validate_nccl_dep_consistency("12.4")
|
||||
validate_nccl_dep_consistency("11.8")
|
||||
|
||||
35
.github/scripts/generate_ci_workflows.py
vendored
35
.github/scripts/generate_ci_workflows.py
vendored
@ -2,10 +2,9 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from collections.abc import Iterable
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
from typing import Dict, Iterable, List, Literal, Set
|
||||
from typing_extensions import TypedDict # Python 3.11+
|
||||
|
||||
import generate_binary_build_matrix # type: ignore[import]
|
||||
@ -28,7 +27,7 @@ LABEL_CIFLOW_BINARIES_WHEEL = "ciflow/binaries_wheel"
|
||||
class CIFlowConfig:
|
||||
# For use to enable workflows to run on pytorch/pytorch-canary
|
||||
run_on_canary: bool = False
|
||||
labels: set[str] = field(default_factory=set)
|
||||
labels: Set[str] = field(default_factory=set)
|
||||
# Certain jobs might not want to be part of the ciflow/[all,trunk] workflow
|
||||
isolated_workflow: bool = False
|
||||
unstable: bool = False
|
||||
@ -49,7 +48,7 @@ class Config(TypedDict):
|
||||
@dataclass
|
||||
class BinaryBuildWorkflow:
|
||||
os: str
|
||||
build_configs: list[dict[str, str]]
|
||||
build_configs: List[Dict[str, str]]
|
||||
package_type: str
|
||||
|
||||
# Optional fields
|
||||
@ -143,6 +142,20 @@ LINUX_BINARY_BUILD_WORFKLOWS = [
|
||||
isolated_workflow=True,
|
||||
),
|
||||
),
|
||||
BinaryBuildWorkflow(
|
||||
os=OperatingSystem.LINUX,
|
||||
package_type="libtorch",
|
||||
abi_version=generate_binary_build_matrix.PRE_CXX11_ABI,
|
||||
build_configs=generate_binary_build_matrix.generate_libtorch_matrix(
|
||||
OperatingSystem.LINUX,
|
||||
generate_binary_build_matrix.PRE_CXX11_ABI,
|
||||
libtorch_variants=["shared-with-deps"],
|
||||
),
|
||||
ciflow_config=CIFlowConfig(
|
||||
labels={LABEL_CIFLOW_BINARIES, LABEL_CIFLOW_BINARIES_LIBTORCH},
|
||||
isolated_workflow=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
LINUX_BINARY_SMOKE_WORKFLOWS = [
|
||||
@ -151,7 +164,7 @@ LINUX_BINARY_SMOKE_WORKFLOWS = [
|
||||
package_type="manywheel",
|
||||
build_configs=generate_binary_build_matrix.generate_wheels_matrix(
|
||||
OperatingSystem.LINUX,
|
||||
arches=["11.8", "12.4", "12.6", "12.8"],
|
||||
arches=["11.8", "12.4", "12.6"],
|
||||
python_versions=["3.9"],
|
||||
),
|
||||
branches="main",
|
||||
@ -184,6 +197,18 @@ LINUX_BINARY_SMOKE_WORKFLOWS = [
|
||||
),
|
||||
branches="main",
|
||||
),
|
||||
BinaryBuildWorkflow(
|
||||
os=OperatingSystem.LINUX,
|
||||
package_type="libtorch",
|
||||
abi_version=generate_binary_build_matrix.PRE_CXX11_ABI,
|
||||
build_configs=generate_binary_build_matrix.generate_libtorch_matrix(
|
||||
OperatingSystem.LINUX,
|
||||
generate_binary_build_matrix.PRE_CXX11_ABI,
|
||||
arches=["cpu"],
|
||||
libtorch_variants=["shared-with-deps"],
|
||||
),
|
||||
branches="main",
|
||||
),
|
||||
]
|
||||
|
||||
WINDOWS_BINARY_BUILD_WORKFLOWS = [
|
||||
|
||||
@ -12,6 +12,7 @@ Will output a condensed version of the matrix. Will include fllowing:
|
||||
"""
|
||||
|
||||
import json
|
||||
from typing import Dict, List
|
||||
|
||||
import generate_binary_build_matrix
|
||||
|
||||
@ -19,8 +20,8 @@ import generate_binary_build_matrix
|
||||
DOCKER_IMAGE_TYPES = ["runtime", "devel"]
|
||||
|
||||
|
||||
def generate_docker_matrix() -> dict[str, list[dict[str, str]]]:
|
||||
ret: list[dict[str, str]] = []
|
||||
def generate_docker_matrix() -> Dict[str, List[Dict[str, str]]]:
|
||||
ret: List[Dict[str, str]] = []
|
||||
# CUDA amd64 Docker images are available as both runtime and devel while
|
||||
# CPU arm64 image is only available as runtime.
|
||||
for cuda, version in generate_binary_build_matrix.CUDA_ARCHES_FULL_VERSION.items():
|
||||
|
||||
10
.github/scripts/get_workflow_job_id.py
vendored
10
.github/scripts/get_workflow_job_id.py
vendored
@ -11,11 +11,11 @@ import sys
|
||||
import time
|
||||
import urllib
|
||||
import urllib.parse
|
||||
from typing import Any, Callable, Optional
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
|
||||
def parse_json_and_links(conn: Any) -> tuple[Any, dict[str, dict[str, str]]]:
|
||||
def parse_json_and_links(conn: Any) -> Tuple[Any, Dict[str, Dict[str, str]]]:
|
||||
links = {}
|
||||
# Extract links which GH uses for pagination
|
||||
# see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
|
||||
@ -42,7 +42,7 @@ def parse_json_and_links(conn: Any) -> tuple[Any, dict[str, dict[str, str]]]:
|
||||
def fetch_url(
|
||||
url: str,
|
||||
*,
|
||||
headers: Optional[dict[str, str]] = None,
|
||||
headers: Optional[Dict[str, str]] = None,
|
||||
reader: Callable[[Any], Any] = lambda x: x.read(),
|
||||
retries: Optional[int] = 3,
|
||||
backoff_timeout: float = 0.5,
|
||||
@ -83,7 +83,7 @@ def parse_args() -> Any:
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def fetch_jobs(url: str, headers: dict[str, str]) -> list[dict[str, str]]:
|
||||
def fetch_jobs(url: str, headers: Dict[str, str]) -> List[Dict[str, str]]:
|
||||
response, links = fetch_url(url, headers=headers, reader=parse_json_and_links)
|
||||
jobs = response["jobs"]
|
||||
assert type(jobs) is list
|
||||
@ -111,7 +111,7 @@ def fetch_jobs(url: str, headers: dict[str, str]) -> list[dict[str, str]]:
|
||||
# running.
|
||||
|
||||
|
||||
def find_job_id_name(args: Any) -> tuple[str, str]:
|
||||
def find_job_id_name(args: Any) -> Tuple[str, str]:
|
||||
# From https://docs.github.com/en/actions/learn-github-actions/environment-variables
|
||||
PYTORCH_REPO = os.environ.get("GITHUB_REPOSITORY", "pytorch/pytorch")
|
||||
PYTORCH_GITHUB_API = f"https://api.github.com/repos/{PYTORCH_REPO}"
|
||||
|
||||
54
.github/scripts/github_utils.py
vendored
54
.github/scripts/github_utils.py
vendored
@ -4,7 +4,7 @@ import json
|
||||
import os
|
||||
import warnings
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Callable, cast, Optional, Union
|
||||
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union
|
||||
from urllib.error import HTTPError
|
||||
from urllib.parse import quote
|
||||
from urllib.request import Request, urlopen
|
||||
@ -27,11 +27,11 @@ class GitHubComment:
|
||||
def gh_fetch_url_and_headers(
|
||||
url: str,
|
||||
*,
|
||||
headers: Optional[dict[str, str]] = None,
|
||||
data: Union[Optional[dict[str, Any]], str] = None,
|
||||
headers: Optional[Dict[str, str]] = None,
|
||||
data: Union[Optional[Dict[str, Any]], str] = None,
|
||||
method: Optional[str] = None,
|
||||
reader: Callable[[Any], Any] = lambda x: x.read(),
|
||||
) -> tuple[Any, Any]:
|
||||
) -> Tuple[Any, Any]:
|
||||
if headers is None:
|
||||
headers = {}
|
||||
token = os.environ.get("GITHUB_TOKEN")
|
||||
@ -70,8 +70,8 @@ def gh_fetch_url_and_headers(
|
||||
def gh_fetch_url(
|
||||
url: str,
|
||||
*,
|
||||
headers: Optional[dict[str, str]] = None,
|
||||
data: Union[Optional[dict[str, Any]], str] = None,
|
||||
headers: Optional[Dict[str, str]] = None,
|
||||
data: Union[Optional[Dict[str, Any]], str] = None,
|
||||
method: Optional[str] = None,
|
||||
reader: Callable[[Any], Any] = json.load,
|
||||
) -> Any:
|
||||
@ -82,25 +82,25 @@ def gh_fetch_url(
|
||||
|
||||
def gh_fetch_json(
|
||||
url: str,
|
||||
params: Optional[dict[str, Any]] = None,
|
||||
data: Optional[dict[str, Any]] = None,
|
||||
params: Optional[Dict[str, Any]] = None,
|
||||
data: Optional[Dict[str, Any]] = None,
|
||||
method: Optional[str] = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
) -> List[Dict[str, Any]]:
|
||||
headers = {"Accept": "application/vnd.github.v3+json"}
|
||||
if params is not None and len(params) > 0:
|
||||
url += "?" + "&".join(
|
||||
f"{name}={quote(str(val))}" for name, val in params.items()
|
||||
)
|
||||
return cast(
|
||||
list[dict[str, Any]],
|
||||
List[Dict[str, Any]],
|
||||
gh_fetch_url(url, headers=headers, data=data, reader=json.load, method=method),
|
||||
)
|
||||
|
||||
|
||||
def _gh_fetch_json_any(
|
||||
url: str,
|
||||
params: Optional[dict[str, Any]] = None,
|
||||
data: Optional[dict[str, Any]] = None,
|
||||
params: Optional[Dict[str, Any]] = None,
|
||||
data: Optional[Dict[str, Any]] = None,
|
||||
) -> Any:
|
||||
headers = {"Accept": "application/vnd.github.v3+json"}
|
||||
if params is not None and len(params) > 0:
|
||||
@ -112,21 +112,21 @@ def _gh_fetch_json_any(
|
||||
|
||||
def gh_fetch_json_list(
|
||||
url: str,
|
||||
params: Optional[dict[str, Any]] = None,
|
||||
data: Optional[dict[str, Any]] = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
return cast(list[dict[str, Any]], _gh_fetch_json_any(url, params, data))
|
||||
params: Optional[Dict[str, Any]] = None,
|
||||
data: Optional[Dict[str, Any]] = None,
|
||||
) -> List[Dict[str, Any]]:
|
||||
return cast(List[Dict[str, Any]], _gh_fetch_json_any(url, params, data))
|
||||
|
||||
|
||||
def gh_fetch_json_dict(
|
||||
url: str,
|
||||
params: Optional[dict[str, Any]] = None,
|
||||
data: Optional[dict[str, Any]] = None,
|
||||
) -> dict[str, Any]:
|
||||
return cast(dict[str, Any], _gh_fetch_json_any(url, params, data))
|
||||
params: Optional[Dict[str, Any]] = None,
|
||||
data: Optional[Dict[str, Any]] = None,
|
||||
) -> Dict[str, Any]:
|
||||
return cast(Dict[str, Any], _gh_fetch_json_any(url, params, data))
|
||||
|
||||
|
||||
def gh_graphql(query: str, **kwargs: Any) -> dict[str, Any]:
|
||||
def gh_graphql(query: str, **kwargs: Any) -> Dict[str, Any]:
|
||||
rc = gh_fetch_url(
|
||||
"https://api.github.com/graphql",
|
||||
data={"query": query, "variables": kwargs},
|
||||
@ -136,12 +136,12 @@ def gh_graphql(query: str, **kwargs: Any) -> dict[str, Any]:
|
||||
raise RuntimeError(
|
||||
f"GraphQL query {query}, args {kwargs} failed: {rc['errors']}"
|
||||
)
|
||||
return cast(dict[str, Any], rc)
|
||||
return cast(Dict[str, Any], rc)
|
||||
|
||||
|
||||
def _gh_post_comment(
|
||||
url: str, comment: str, dry_run: bool = False
|
||||
) -> list[dict[str, Any]]:
|
||||
) -> List[Dict[str, Any]]:
|
||||
if dry_run:
|
||||
print(comment)
|
||||
return []
|
||||
@ -150,7 +150,7 @@ def _gh_post_comment(
|
||||
|
||||
def gh_post_pr_comment(
|
||||
org: str, repo: str, pr_num: int, comment: str, dry_run: bool = False
|
||||
) -> list[dict[str, Any]]:
|
||||
) -> List[Dict[str, Any]]:
|
||||
return _gh_post_comment(
|
||||
f"{GITHUB_API_URL}/repos/{org}/{repo}/issues/{pr_num}/comments",
|
||||
comment,
|
||||
@ -160,7 +160,7 @@ def gh_post_pr_comment(
|
||||
|
||||
def gh_post_commit_comment(
|
||||
org: str, repo: str, sha: str, comment: str, dry_run: bool = False
|
||||
) -> list[dict[str, Any]]:
|
||||
) -> List[Dict[str, Any]]:
|
||||
return _gh_post_comment(
|
||||
f"{GITHUB_API_URL}/repos/{org}/{repo}/commits/{sha}/comments",
|
||||
comment,
|
||||
@ -220,8 +220,8 @@ def gh_update_pr_state(org: str, repo: str, pr_num: int, state: str = "open") ->
|
||||
|
||||
|
||||
def gh_query_issues_by_labels(
|
||||
org: str, repo: str, labels: list[str], state: str = "open"
|
||||
) -> list[dict[str, Any]]:
|
||||
org: str, repo: str, labels: List[str], state: str = "open"
|
||||
) -> List[Dict[str, Any]]:
|
||||
url = f"{GITHUB_API_URL}/repos/{org}/{repo}/issues"
|
||||
return gh_fetch_json(
|
||||
url, method="GET", params={"labels": ",".join(labels), "state": state}
|
||||
|
||||
42
.github/scripts/gitutils.py
vendored
42
.github/scripts/gitutils.py
vendored
@ -4,10 +4,20 @@ import os
|
||||
import re
|
||||
import tempfile
|
||||
from collections import defaultdict
|
||||
from collections.abc import Iterator
|
||||
from datetime import datetime
|
||||
from functools import wraps
|
||||
from typing import Any, Callable, cast, Optional, TypeVar, Union
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
cast,
|
||||
Dict,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
@ -25,17 +35,17 @@ def get_git_repo_dir() -> str:
|
||||
return os.getenv("GIT_REPO_DIR", str(Path(__file__).resolve().parents[2]))
|
||||
|
||||
|
||||
def fuzzy_list_to_dict(items: list[tuple[str, str]]) -> dict[str, list[str]]:
|
||||
def fuzzy_list_to_dict(items: List[Tuple[str, str]]) -> Dict[str, List[str]]:
|
||||
"""
|
||||
Converts list to dict preserving elements with duplicate keys
|
||||
"""
|
||||
rc: dict[str, list[str]] = defaultdict(list)
|
||||
rc: Dict[str, List[str]] = defaultdict(list)
|
||||
for key, val in items:
|
||||
rc[key].append(val)
|
||||
return dict(rc)
|
||||
|
||||
|
||||
def _check_output(items: list[str], encoding: str = "utf-8") -> str:
|
||||
def _check_output(items: List[str], encoding: str = "utf-8") -> str:
|
||||
from subprocess import CalledProcessError, check_output, STDOUT
|
||||
|
||||
try:
|
||||
@ -85,7 +95,7 @@ class GitCommit:
|
||||
return item in self.body or item in self.title
|
||||
|
||||
|
||||
def parse_fuller_format(lines: Union[str, list[str]]) -> GitCommit:
|
||||
def parse_fuller_format(lines: Union[str, List[str]]) -> GitCommit:
|
||||
"""
|
||||
Expect commit message generated using `--format=fuller --date=unix` format, i.e.:
|
||||
commit <sha1>
|
||||
@ -132,13 +142,13 @@ class GitRepo:
|
||||
print(f"+ git -C {self.repo_dir} {' '.join(args)}")
|
||||
return _check_output(["git", "-C", self.repo_dir] + list(args))
|
||||
|
||||
def revlist(self, revision_range: str) -> list[str]:
|
||||
def revlist(self, revision_range: str) -> List[str]:
|
||||
rc = self._run_git("rev-list", revision_range, "--", ".").strip()
|
||||
return rc.split("\n") if len(rc) > 0 else []
|
||||
|
||||
def branches_containing_ref(
|
||||
self, ref: str, *, include_remote: bool = True
|
||||
) -> list[str]:
|
||||
) -> List[str]:
|
||||
rc = (
|
||||
self._run_git("branch", "--remote", "--contains", ref)
|
||||
if include_remote
|
||||
@ -179,7 +189,7 @@ class GitRepo:
|
||||
def get_merge_base(self, from_ref: str, to_ref: str) -> str:
|
||||
return self._run_git("merge-base", from_ref, to_ref).strip()
|
||||
|
||||
def patch_id(self, ref: Union[str, list[str]]) -> list[tuple[str, str]]:
|
||||
def patch_id(self, ref: Union[str, List[str]]) -> List[Tuple[str, str]]:
|
||||
is_list = isinstance(ref, list)
|
||||
if is_list:
|
||||
if len(ref) == 0:
|
||||
@ -188,9 +198,9 @@ class GitRepo:
|
||||
rc = _check_output(
|
||||
["sh", "-c", f"git -C {self.repo_dir} show {ref}|git patch-id --stable"]
|
||||
).strip()
|
||||
return [cast(tuple[str, str], x.split(" ", 1)) for x in rc.split("\n")]
|
||||
return [cast(Tuple[str, str], x.split(" ", 1)) for x in rc.split("\n")]
|
||||
|
||||
def commits_resolving_gh_pr(self, pr_num: int) -> list[str]:
|
||||
def commits_resolving_gh_pr(self, pr_num: int) -> List[str]:
|
||||
owner, name = self.gh_owner_and_name()
|
||||
msg = f"Pull Request resolved: https://github.com/{owner}/{name}/pull/{pr_num}"
|
||||
rc = self._run_git("log", "--format=%H", "--grep", msg).strip()
|
||||
@ -209,7 +219,7 @@ class GitRepo:
|
||||
|
||||
def compute_branch_diffs(
|
||||
self, from_branch: str, to_branch: str
|
||||
) -> tuple[list[str], list[str]]:
|
||||
) -> Tuple[List[str], List[str]]:
|
||||
"""
|
||||
Returns list of commmits that are missing in each other branch since their merge base
|
||||
Might be slow if merge base is between two branches is pretty far off
|
||||
@ -301,14 +311,14 @@ class GitRepo:
|
||||
def remote_url(self) -> str:
|
||||
return self._run_git("remote", "get-url", self.remote)
|
||||
|
||||
def gh_owner_and_name(self) -> tuple[str, str]:
|
||||
def gh_owner_and_name(self) -> Tuple[str, str]:
|
||||
url = os.getenv("GIT_REMOTE_URL", None)
|
||||
if url is None:
|
||||
url = self.remote_url()
|
||||
rc = RE_GITHUB_URL_MATCH.match(url)
|
||||
if rc is None:
|
||||
raise RuntimeError(f"Unexpected url format {url}")
|
||||
return cast(tuple[str, str], rc.groups())
|
||||
return cast(Tuple[str, str], rc.groups())
|
||||
|
||||
def commit_message(self, ref: str) -> str:
|
||||
return self._run_git("log", "-1", "--format=%B", ref)
|
||||
@ -356,7 +366,7 @@ class PeekableIterator(Iterator[str]):
|
||||
return rc
|
||||
|
||||
|
||||
def patterns_to_regex(allowed_patterns: list[str]) -> Any:
|
||||
def patterns_to_regex(allowed_patterns: List[str]) -> Any:
|
||||
"""
|
||||
pattern is glob-like, i.e. the only special sequences it has are:
|
||||
- ? - matches single character
|
||||
@ -427,7 +437,7 @@ def retries_decorator(
|
||||
) -> Callable[[Callable[..., T]], Callable[..., T]]:
|
||||
def decorator(f: Callable[..., T]) -> Callable[..., T]:
|
||||
@wraps(f)
|
||||
def wrapper(*args: list[Any], **kwargs: dict[str, Any]) -> T:
|
||||
def wrapper(*args: List[Any], **kwargs: Dict[str, Any]) -> T:
|
||||
for idx in range(num_retries):
|
||||
try:
|
||||
return f(*args, **kwargs)
|
||||
|
||||
14
.github/scripts/label_utils.py
vendored
14
.github/scripts/label_utils.py
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
import json
|
||||
from functools import lru_cache
|
||||
from typing import Any, TYPE_CHECKING, Union
|
||||
from typing import Any, List, Tuple, TYPE_CHECKING, Union
|
||||
|
||||
from github_utils import gh_fetch_url_and_headers, GitHubComment
|
||||
|
||||
@ -28,14 +28,14 @@ https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for
|
||||
"""
|
||||
|
||||
|
||||
def request_for_labels(url: str) -> tuple[Any, Any]:
|
||||
def request_for_labels(url: str) -> Tuple[Any, Any]:
|
||||
headers = {"Accept": "application/vnd.github.v3+json"}
|
||||
return gh_fetch_url_and_headers(
|
||||
url, headers=headers, reader=lambda x: x.read().decode("utf-8")
|
||||
)
|
||||
|
||||
|
||||
def update_labels(labels: list[str], info: str) -> None:
|
||||
def update_labels(labels: List[str], info: str) -> None:
|
||||
labels_json = json.loads(info)
|
||||
labels.extend([x["name"] for x in labels_json])
|
||||
|
||||
@ -56,10 +56,10 @@ def get_last_page_num_from_header(header: Any) -> int:
|
||||
|
||||
|
||||
@lru_cache
|
||||
def gh_get_labels(org: str, repo: str) -> list[str]:
|
||||
def gh_get_labels(org: str, repo: str) -> List[str]:
|
||||
prefix = f"https://api.github.com/repos/{org}/{repo}/labels?per_page=100"
|
||||
header, info = request_for_labels(prefix + "&page=1")
|
||||
labels: list[str] = []
|
||||
labels: List[str] = []
|
||||
update_labels(labels, info)
|
||||
|
||||
last_page = get_last_page_num_from_header(header)
|
||||
@ -74,7 +74,7 @@ def gh_get_labels(org: str, repo: str) -> list[str]:
|
||||
|
||||
|
||||
def gh_add_labels(
|
||||
org: str, repo: str, pr_num: int, labels: Union[str, list[str]], dry_run: bool
|
||||
org: str, repo: str, pr_num: int, labels: Union[str, List[str]], dry_run: bool
|
||||
) -> None:
|
||||
if dry_run:
|
||||
print(f"Dryrun: Adding labels {labels} to PR {pr_num}")
|
||||
@ -97,7 +97,7 @@ def gh_remove_label(
|
||||
)
|
||||
|
||||
|
||||
def get_release_notes_labels(org: str, repo: str) -> list[str]:
|
||||
def get_release_notes_labels(org: str, repo: str) -> List[str]:
|
||||
return [
|
||||
label
|
||||
for label in gh_get_labels(org, repo)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user