mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-26 16:44:54 +08:00
Compare commits
26 Commits
inlining
...
v2.4.0-rc6
| Author | SHA1 | Date | |
|---|---|---|---|
| 699c056479 | |||
| 49d2eec960 | |||
| 165e09874b | |||
| 93c51dc84b | |||
| 67a815abd2 | |||
| d2e4cc71f1 | |||
| 0233f8df5b | |||
| 434bf9559f | |||
| 50e57d4f3f | |||
| edcc77dadb | |||
| 0e0a9c5a5c | |||
| 4af5000bff | |||
| 562cdc2084 | |||
| b1d53f07b2 | |||
| 86271445d6 | |||
| d71de3c95c | |||
| e7dde73d43 | |||
| 9ad8a5b657 | |||
| ed624a0483 | |||
| 082c4f7e64 | |||
| 459e2aa454 | |||
| 6be0234f07 | |||
| 24a3885ef6 | |||
| 62417c6ca9 | |||
| 1cd41997e9 | |||
| c85e2cacd3 |
@ -1,5 +1,5 @@
|
||||
0.6b
|
||||
manylinux_2_17
|
||||
rocm6.1
|
||||
7f07e8a1cb1f99627eb6d77f5c0e9295c775f3c7
|
||||
77c29fa3f3b614e187d7213d745e989a92708cee2bc6020419ab49019af399d1
|
||||
rocm6
|
||||
04b5df8c8123f90cba3ede7e971e6fbc6040d506
|
||||
3db6ecbc915893ff967abd6e1b43bd5f54949868873be60dc802086c3863e648
|
||||
|
||||
@ -373,13 +373,6 @@ case "$image" in
|
||||
CONDA_CMAKE=yes
|
||||
EXECUTORCH=yes
|
||||
;;
|
||||
pytorch-linux-jammy-py3.12-halide)
|
||||
CUDA_VERSION=12.4
|
||||
ANACONDA_PYTHON_VERSION=3.12
|
||||
GCC_VERSION=11
|
||||
CONDA_CMAKE=yes
|
||||
HALIDE=yes
|
||||
;;
|
||||
pytorch-linux-focal-linter)
|
||||
# TODO: Use 3.9 here because of this issue https://github.com/python/mypy/issues/13627.
|
||||
# We will need to update mypy version eventually, but that's for another day. The task
|
||||
@ -497,7 +490,6 @@ docker build \
|
||||
--build-arg "DOCS=${DOCS}" \
|
||||
--build-arg "INDUCTOR_BENCHMARKS=${INDUCTOR_BENCHMARKS}" \
|
||||
--build-arg "EXECUTORCH=${EXECUTORCH}" \
|
||||
--build-arg "HALIDE=${HALIDE}" \
|
||||
--build-arg "XPU_VERSION=${XPU_VERSION}" \
|
||||
--build-arg "ACL=${ACL:-}" \
|
||||
--build-arg "SKIP_SCCACHE_INSTALL=${SKIP_SCCACHE_INSTALL:-}" \
|
||||
|
||||
@ -1 +1 @@
|
||||
c572f9e509b5ec5d56f4d218271e36269bba244f
|
||||
d4b3e5cc607e97afdba79dc90f8ef968142f347c
|
||||
|
||||
@ -1 +0,0 @@
|
||||
340136fec6d3ebc73e7a19eba1663e9b0ba8ab2d
|
||||
@ -1 +1 @@
|
||||
1b2f15840e0d70eec50d84c7a0575cb835524def
|
||||
aac14a3b93f11d781d1d5ebc5400b15ae8df5185
|
||||
|
||||
@ -1 +1 @@
|
||||
dedb7bdf339a3546896d4820366ca562c586bfa0
|
||||
45fff310c891f5a92d55445adf8cc9d29df5841e
|
||||
|
||||
@ -9,7 +9,7 @@ TARBALL='aotriton.tar.bz2'
|
||||
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.bz2"
|
||||
AOTRITON_URL="https://github.com/ROCm/aotriton/releases/download/${VER}/aotriton-${VER}-${MANYLINUX}_${ARCH}-${ROCMBASE}.tar.bz2"
|
||||
|
||||
cd "${AOTRITON_INSTALL_PREFIX}"
|
||||
# Must use -L to follow redirects
|
||||
|
||||
@ -85,7 +85,7 @@ fi
|
||||
else
|
||||
CONDA_COMMON_DEPS="astunparse pyyaml mkl=2021.4.0 mkl-include=2021.4.0 setuptools"
|
||||
|
||||
if [ "$ANACONDA_PYTHON_VERSION" = "3.11" ] || [ "$ANACONDA_PYTHON_VERSION" = "3.12" ] || [ "$ANACONDA_PYTHON_VERSION" = "3.13" ]; then
|
||||
if [ "$ANACONDA_PYTHON_VERSION" = "3.11" ] || [ "$ANACONDA_PYTHON_VERSION" = "3.12" ]; then
|
||||
conda_install numpy=1.26.0 ${CONDA_COMMON_DEPS}
|
||||
else
|
||||
conda_install numpy=1.21.2 ${CONDA_COMMON_DEPS}
|
||||
|
||||
@ -37,9 +37,6 @@ install_conda_dependencies() {
|
||||
|
||||
install_pip_dependencies() {
|
||||
pushd executorch/.ci/docker
|
||||
# Install PyTorch CPU build beforehand to avoid installing the much bigger CUDA
|
||||
# binaries later, ExecuTorch only needs CPU
|
||||
pip_install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
|
||||
# Install all Python dependencies
|
||||
pip_install -r requirements-ci.txt
|
||||
popd
|
||||
@ -47,14 +44,13 @@ install_pip_dependencies() {
|
||||
|
||||
setup_executorch() {
|
||||
pushd executorch
|
||||
# Setup swiftshader and Vulkan SDK which are required to build the Vulkan delegate
|
||||
as_jenkins bash .ci/scripts/setup-vulkan-linux-deps.sh
|
||||
source .ci/scripts/utils.sh
|
||||
|
||||
export PYTHON_EXECUTABLE=python
|
||||
export EXECUTORCH_BUILD_PYBIND=ON
|
||||
export CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON"
|
||||
install_flatc_from_source
|
||||
pip_install .
|
||||
|
||||
as_jenkins .ci/scripts/setup-linux.sh cmake
|
||||
# Make sure that all the newly generate files are owned by Jenkins
|
||||
chown -R jenkins .
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/common_utils.sh"
|
||||
|
||||
COMMIT=$(get_pinned_commit halide)
|
||||
test -n "$COMMIT"
|
||||
|
||||
# activate conda to populate CONDA_PREFIX
|
||||
test -n "$ANACONDA_PYTHON_VERSION"
|
||||
eval "$(conda shell.bash hook)"
|
||||
conda activate py_$ANACONDA_PYTHON_VERSION
|
||||
|
||||
if [ -n "${UBUNTU_VERSION}" ];then
|
||||
apt update
|
||||
apt-get install -y lld liblld-15-dev libpng-dev libjpeg-dev libgl-dev \
|
||||
libopenblas-dev libeigen3-dev libatlas-base-dev libzstd-dev
|
||||
fi
|
||||
|
||||
conda_install numpy scipy imageio cmake ninja
|
||||
|
||||
git clone --depth 1 --branch release/16.x --recursive https://github.com/llvm/llvm-project.git
|
||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_ENABLE_PROJECTS="clang" \
|
||||
-DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \
|
||||
-DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ASSERTIONS=ON \
|
||||
-DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_BUILD_32_BITS=OFF \
|
||||
-S llvm-project/llvm -B llvm-build -G Ninja
|
||||
cmake --build llvm-build
|
||||
cmake --install llvm-build --prefix llvm-install
|
||||
export LLVM_ROOT=`pwd`/llvm-install
|
||||
export LLVM_CONFIG=$LLVM_ROOT/bin/llvm-config
|
||||
|
||||
git clone https://github.com/halide/Halide.git
|
||||
pushd Halide
|
||||
git checkout ${COMMIT} && git submodule update --init --recursive
|
||||
pip_install -r requirements.txt
|
||||
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S . -B build
|
||||
cmake --build build
|
||||
test -e ${CONDA_PREFIX}/lib/python3 || ln -s python${ANACONDA_PYTHON_VERSION} ${CONDA_PREFIX}/lib/python3
|
||||
cmake --install build --prefix ${CONDA_PREFIX}
|
||||
chown -R jenkins ${CONDA_PREFIX}
|
||||
popd
|
||||
rm -rf Halide llvm-build llvm-project llvm-install
|
||||
|
||||
python -c "import halide" # check for errors
|
||||
@ -33,9 +33,7 @@ pip_install coloredlogs packaging
|
||||
pip_install onnxruntime==1.18
|
||||
pip_install onnx==1.16.0
|
||||
# pip_install "onnxscript@git+https://github.com/microsoft/onnxscript@3e869ef8ccf19b5ebd21c10d3e9c267c9a9fa729" --no-deps
|
||||
pip_install onnxscript==0.1.0.dev20240613 --no-deps
|
||||
# required by onnxscript
|
||||
pip_install ml_dtypes
|
||||
pip_install onnxscript==0.1.0.dev20240523 --no-deps
|
||||
|
||||
# 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/
|
||||
|
||||
@ -85,10 +85,10 @@ librosa>=0.6.2 ; python_version < "3.11"
|
||||
#Pinned versions:
|
||||
#test that import:
|
||||
|
||||
mypy==1.10.0
|
||||
mypy==1.9.0
|
||||
# Pin MyPy version because new errors are likely to appear with each release
|
||||
#Description: linter
|
||||
#Pinned versions: 1.10.0
|
||||
#Pinned versions: 1.9.0
|
||||
#test that import: test_typing.py, test_type_hints.py
|
||||
|
||||
networkx==2.8.8
|
||||
@ -306,7 +306,7 @@ pywavelets==1.5.0 ; python_version >= "3.12"
|
||||
#Pinned versions: 1.4.1
|
||||
#test that import:
|
||||
|
||||
lxml==5.0.0
|
||||
lxml==5.0.0.
|
||||
#Description: This is a requirement of unittest-xml-reporting
|
||||
|
||||
# Python-3.9 binaries
|
||||
|
||||
@ -103,14 +103,6 @@ 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
|
||||
|
||||
ARG HALIDE
|
||||
# Build and install halide
|
||||
COPY ./common/install_halide.sh install_halide.sh
|
||||
COPY ./common/common_utils.sh common_utils.sh
|
||||
COPY ci_commit_pins/halide.txt halide.txt
|
||||
RUN if [ -n "${HALIDE}" ]; then bash ./install_halide.sh; fi
|
||||
RUN rm install_halide.sh common_utils.sh halide.txt
|
||||
|
||||
# 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
|
||||
|
||||
@ -155,14 +155,6 @@ COPY ci_commit_pins/executorch.txt executorch.txt
|
||||
RUN if [ -n "${EXECUTORCH}" ]; then bash ./install_executorch.sh; fi
|
||||
RUN rm install_executorch.sh common_utils.sh executorch.txt
|
||||
|
||||
ARG HALIDE
|
||||
# Build and install halide
|
||||
COPY ./common/install_halide.sh install_halide.sh
|
||||
COPY ./common/common_utils.sh common_utils.sh
|
||||
COPY ci_commit_pins/halide.txt halide.txt
|
||||
RUN if [ -n "${HALIDE}" ]; then bash ./install_halide.sh; fi
|
||||
RUN rm install_halide.sh common_utils.sh halide.txt
|
||||
|
||||
ARG ONNX
|
||||
# Install ONNX dependencies
|
||||
COPY ./common/install_onnx.sh ./common/common_utils.sh ./
|
||||
|
||||
@ -230,10 +230,6 @@ if [[ "${BUILD_ENVIRONMENT}" != *android* && "${BUILD_ENVIRONMENT}" != *cuda* ]]
|
||||
export BUILD_STATIC_RUNTIME_BENCHMARK=ON
|
||||
fi
|
||||
|
||||
if [[ "$BUILD_ENVIRONMENT" == *-debug* ]]; then
|
||||
export CMAKE_BUILD_TYPE=RelWithAssert
|
||||
fi
|
||||
|
||||
# Do not change workspace permissions for ROCm CI jobs
|
||||
# as it can leave workspace with bad permissions for cancelled jobs
|
||||
if [[ "$BUILD_ENVIRONMENT" != *rocm* ]]; then
|
||||
@ -288,26 +284,12 @@ else
|
||||
# Which should be backward compatible with Numpy-1.X
|
||||
python -mpip install --pre numpy==2.0.0rc1
|
||||
fi
|
||||
|
||||
WERROR=1 python setup.py clean
|
||||
|
||||
if [[ "$USE_SPLIT_BUILD" == "true" ]]; then
|
||||
BUILD_LIBTORCH_WHL=1 BUILD_PYTHON_ONLY=0 python setup.py bdist_wheel
|
||||
BUILD_LIBTORCH_WHL=0 BUILD_PYTHON_ONLY=1 python setup.py bdist_wheel --cmake
|
||||
else
|
||||
WERROR=1 python setup.py bdist_wheel
|
||||
fi
|
||||
WERROR=1 python setup.py bdist_wheel
|
||||
else
|
||||
python setup.py clean
|
||||
if [[ "$BUILD_ENVIRONMENT" == *xla* ]]; then
|
||||
source .ci/pytorch/install_cache_xla.sh
|
||||
fi
|
||||
if [[ "$USE_SPLIT_BUILD" == "true" ]]; then
|
||||
echo "USE_SPLIT_BUILD cannot be used with xla or rocm"
|
||||
exit 1
|
||||
else
|
||||
python setup.py bdist_wheel
|
||||
fi
|
||||
python setup.py bdist_wheel
|
||||
fi
|
||||
pip_install_whl "$(echo dist/*.whl)"
|
||||
|
||||
@ -346,10 +328,9 @@ else
|
||||
CUSTOM_OP_TEST="$PWD/test/custom_operator"
|
||||
python --version
|
||||
SITE_PACKAGES="$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
|
||||
|
||||
mkdir -p "$CUSTOM_OP_BUILD"
|
||||
pushd "$CUSTOM_OP_BUILD"
|
||||
cmake "$CUSTOM_OP_TEST" -DCMAKE_PREFIX_PATH="$SITE_PACKAGES/torch;$SITE_PACKAGES" -DPython_EXECUTABLE="$(which python)" \
|
||||
cmake "$CUSTOM_OP_TEST" -DCMAKE_PREFIX_PATH="$SITE_PACKAGES/torch" -DPython_EXECUTABLE="$(which python)" \
|
||||
-DCMAKE_MODULE_PATH="$CUSTOM_TEST_MODULE_PATH" -DUSE_ROCM="$CUSTOM_TEST_USE_ROCM"
|
||||
make VERBOSE=1
|
||||
popd
|
||||
@ -362,7 +343,7 @@ else
|
||||
SITE_PACKAGES="$(python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
|
||||
mkdir -p "$JIT_HOOK_BUILD"
|
||||
pushd "$JIT_HOOK_BUILD"
|
||||
cmake "$JIT_HOOK_TEST" -DCMAKE_PREFIX_PATH="$SITE_PACKAGES/torch;$SITE_PACKAGES" -DPython_EXECUTABLE="$(which python)" \
|
||||
cmake "$JIT_HOOK_TEST" -DCMAKE_PREFIX_PATH="$SITE_PACKAGES/torch" -DPython_EXECUTABLE="$(which python)" \
|
||||
-DCMAKE_MODULE_PATH="$CUSTOM_TEST_MODULE_PATH" -DUSE_ROCM="$CUSTOM_TEST_USE_ROCM"
|
||||
make VERBOSE=1
|
||||
popd
|
||||
@ -374,7 +355,7 @@ else
|
||||
python --version
|
||||
mkdir -p "$CUSTOM_BACKEND_BUILD"
|
||||
pushd "$CUSTOM_BACKEND_BUILD"
|
||||
cmake "$CUSTOM_BACKEND_TEST" -DCMAKE_PREFIX_PATH="$SITE_PACKAGES/torch;$SITE_PACKAGES" -DPython_EXECUTABLE="$(which python)" \
|
||||
cmake "$CUSTOM_BACKEND_TEST" -DCMAKE_PREFIX_PATH="$SITE_PACKAGES/torch" -DPython_EXECUTABLE="$(which python)" \
|
||||
-DCMAKE_MODULE_PATH="$CUSTOM_TEST_MODULE_PATH" -DUSE_ROCM="$CUSTOM_TEST_USE_ROCM"
|
||||
make VERBOSE=1
|
||||
popd
|
||||
|
||||
@ -56,29 +56,9 @@ function assert_git_not_dirty() {
|
||||
function pip_install_whl() {
|
||||
# This is used to install PyTorch and other build artifacts wheel locally
|
||||
# without using any network connection
|
||||
|
||||
# Convert the input arguments into an array
|
||||
local args=("$@")
|
||||
|
||||
# Check if the first argument contains multiple paths separated by spaces
|
||||
if [[ "${args[0]}" == *" "* ]]; then
|
||||
# Split the string by spaces into an array
|
||||
IFS=' ' read -r -a paths <<< "${args[0]}"
|
||||
# Loop through each path and install individually
|
||||
for path in "${paths[@]}"; do
|
||||
echo "Installing $path"
|
||||
python3 -mpip install --no-index --no-deps "$path"
|
||||
done
|
||||
else
|
||||
# Loop through each argument and install individually
|
||||
for path in "${args[@]}"; do
|
||||
echo "Installing $path"
|
||||
python3 -mpip install --no-index --no-deps "$path"
|
||||
done
|
||||
fi
|
||||
python3 -mpip install --no-index --no-deps "$@"
|
||||
}
|
||||
|
||||
|
||||
function pip_install() {
|
||||
# retry 3 times
|
||||
# old versions of pip don't have the "--progress-bar" flag
|
||||
@ -198,7 +178,7 @@ function install_torchrec_and_fbgemm() {
|
||||
|
||||
function clone_pytorch_xla() {
|
||||
if [[ ! -d ./xla ]]; then
|
||||
git clone --recursive --quiet https://github.com/pytorch/xla.git
|
||||
git clone --recursive -b r2.4 https://github.com/pytorch/xla.git
|
||||
pushd xla
|
||||
# pin the xla hash so that we don't get broken by changes to xla
|
||||
git checkout "$(cat ../.github/ci_commit_pins/xla.txt)"
|
||||
@ -208,6 +188,28 @@ function clone_pytorch_xla() {
|
||||
fi
|
||||
}
|
||||
|
||||
function checkout_install_torchdeploy() {
|
||||
local commit
|
||||
commit=$(get_pinned_commit multipy)
|
||||
pushd ..
|
||||
git clone --recurse-submodules https://github.com/pytorch/multipy.git
|
||||
pushd multipy
|
||||
git checkout "${commit}"
|
||||
python multipy/runtime/example/generate_examples.py
|
||||
BUILD_CUDA_TESTS=1 pip install -e .
|
||||
popd
|
||||
popd
|
||||
}
|
||||
|
||||
function test_torch_deploy(){
|
||||
pushd ..
|
||||
pushd multipy
|
||||
./multipy/runtime/build/test_deploy
|
||||
./multipy/runtime/build/test_deploy_gpu
|
||||
popd
|
||||
popd
|
||||
}
|
||||
|
||||
function checkout_install_torchbench() {
|
||||
local commit
|
||||
commit=$(get_pinned_commit torchbench)
|
||||
@ -222,8 +224,6 @@ function checkout_install_torchbench() {
|
||||
# to install and test other models
|
||||
python install.py --continue_on_fail
|
||||
fi
|
||||
echo "Print all dependencies after TorchBench is installed"
|
||||
python -mpip freeze
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@ from cryptography.hazmat.primitives import hashes, serialization
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.x509.oid import NameOID
|
||||
|
||||
|
||||
temp_dir = mkdtemp()
|
||||
print(temp_dir)
|
||||
|
||||
|
||||
@ -18,9 +18,8 @@ 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_cuda_p2p
|
||||
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
|
||||
|
||||
@ -3,7 +3,6 @@ import json
|
||||
import math
|
||||
import sys
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--test-name", dest="test_name", action="store", required=True, help="test name"
|
||||
|
||||
@ -3,7 +3,6 @@ import sys
|
||||
|
||||
import numpy
|
||||
|
||||
|
||||
sample_data_list = sys.argv[1:]
|
||||
sample_data_list = [float(v.strip()) for v in sample_data_list]
|
||||
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
data_file_path = sys.argv[1]
|
||||
commit_hash = sys.argv[2]
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import sys
|
||||
|
||||
|
||||
log_file_path = sys.argv[1]
|
||||
|
||||
with open(log_file_path) as f:
|
||||
|
||||
@ -249,7 +249,9 @@ fi
|
||||
# This tests that the debug asserts are working correctly.
|
||||
if [[ "$BUILD_ENVIRONMENT" == *-debug* ]]; then
|
||||
echo "We are in debug mode: $BUILD_ENVIRONMENT. Expect the python assertion to fail"
|
||||
(cd test && ! get_exit_code python -c "import torch; torch._C._crash_if_debug_asserts_fail(424242)")
|
||||
# TODO: Enable the check after we setup the build to run debug asserts without having
|
||||
# to do a full (and slow) debug build
|
||||
# (cd test && ! get_exit_code python -c "import torch; torch._C._crash_if_debug_asserts_fail(424242)")
|
||||
elif [[ "$BUILD_ENVIRONMENT" != *-bazel-* ]]; then
|
||||
# Noop when debug is disabled. Skip bazel jobs because torch isn't available there yet.
|
||||
echo "We are not in debug mode: $BUILD_ENVIRONMENT. Expect the assertion to pass"
|
||||
@ -262,6 +264,18 @@ elif [[ $TEST_CONFIG == 'nogpu_AVX512' ]]; then
|
||||
export ATEN_CPU_CAPABILITY=avx2
|
||||
fi
|
||||
|
||||
# temp workarounds for https://github.com/pytorch/pytorch/issues/126692, remove when fixed
|
||||
if [[ "$BUILD_ENVIRONMENT" != *-bazel-* ]]; then
|
||||
pushd test
|
||||
CUDA_VERSION=$(python -c "import torch; print(torch.version.cuda)")
|
||||
if [ "$CUDA_VERSION" == "12.4" ]; then
|
||||
ISCUDA124="cu124"
|
||||
else
|
||||
ISCUDA124=""
|
||||
fi
|
||||
popd
|
||||
fi
|
||||
|
||||
test_python_legacy_jit() {
|
||||
time python test/run_test.py --include test_jit_legacy test_jit_fuser_legacy --verbose
|
||||
assert_git_not_dirty
|
||||
@ -275,9 +289,6 @@ test_python_shard() {
|
||||
|
||||
# Bare --include flag is not supported and quoting for lint ends up with flag not being interpreted correctly
|
||||
# shellcheck disable=SC2086
|
||||
|
||||
# modify LD_LIBRARY_PATH to ensure it has the conda env.
|
||||
# This set of tests has been shown to be buggy without it for the split-build
|
||||
time python test/run_test.py --exclude-jit-executor --exclude-distributed-tests $INCLUDE_CLAUSE --shard "$1" "$NUM_TEST_SHARDS" --verbose $PYTHON_TEST_EXTRA_OPTION
|
||||
|
||||
assert_git_not_dirty
|
||||
@ -336,31 +347,17 @@ test_inductor_distributed() {
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
test_inductor_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() {
|
||||
python tools/dynamo/verify_dynamo.py
|
||||
python test/run_test.py --inductor \
|
||||
--include test_modules test_ops test_ops_gradients test_torch \
|
||||
--shard "$1" "$NUM_TEST_SHARDS" \
|
||||
--verbose
|
||||
|
||||
python test/run_test.py --inductor --include test_modules test_ops test_ops_gradients test_torch --verbose
|
||||
# Do not add --inductor for the following inductor unit tests, otherwise we will fail because of nested dynamo state
|
||||
python test/run_test.py \
|
||||
--include inductor/test_torchinductor inductor/test_torchinductor_opinfo inductor/test_aot_inductor \
|
||||
--shard "$1" "$NUM_TEST_SHARDS" \
|
||||
--verbose
|
||||
}
|
||||
python test/run_test.py --include inductor/test_torchinductor inductor/test_torchinductor_opinfo inductor/test_aot_inductor --verbose
|
||||
|
||||
test_inductor_aoti() {
|
||||
# docker build uses bdist_wheel which does not work with test_aot_inductor
|
||||
# TODO: need a faster way to build
|
||||
if [[ "$BUILD_ENVIRONMENT" != *rocm* ]]; then
|
||||
BUILD_AOT_INDUCTOR_TEST=1 python setup.py develop
|
||||
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
|
||||
BUILD_AOT_INDUCTOR_TEST=1 python setup.py develop
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
@ -379,7 +376,7 @@ test_inductor_cpp_wrapper_abi_compatible() {
|
||||
--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/inductor_timm_training.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${ISCUDA124}/inductor_timm_training.csv"
|
||||
}
|
||||
|
||||
# "Global" flags for inductor benchmarking controlled by TEST_CONFIG
|
||||
@ -404,7 +401,7 @@ if [[ "${TEST_CONFIG}" == *dynamic* ]]; then
|
||||
DYNAMO_BENCHMARK_FLAGS+=(--dynamic-shapes --dynamic-batch-only)
|
||||
fi
|
||||
|
||||
if [[ "${TEST_CONFIG}" == *cpu_inductor* || "${TEST_CONFIG}" == *cpu_aot_inductor* ]]; then
|
||||
if [[ "${TEST_CONFIG}" == *cpu_inductor* ]]; then
|
||||
DYNAMO_BENCHMARK_FLAGS+=(--device cpu)
|
||||
else
|
||||
DYNAMO_BENCHMARK_FLAGS+=(--device cuda)
|
||||
@ -529,10 +526,9 @@ test_single_dynamo_benchmark() {
|
||||
test_perf_for_dashboard "$suite" \
|
||||
"${DYNAMO_BENCHMARK_FLAGS[@]}" "$@" "${partition_flags[@]}"
|
||||
else
|
||||
if [[ "${TEST_CONFIG}" == *aot_inductor* && "${TEST_CONFIG}" != *cpu_aot_inductor* ]]; then
|
||||
if [[ "${TEST_CONFIG}" == *aot_inductor* ]]; then
|
||||
# Test AOTInductor with the ABI-compatible mode on CI
|
||||
# This can be removed once the ABI-compatible mode becomes default.
|
||||
# For CPU device, we perfer non ABI-compatible mode on CI when testing AOTInductor.
|
||||
export TORCHINDUCTOR_ABI_COMPATIBLE=1
|
||||
fi
|
||||
python "benchmarks/dynamo/$suite.py" \
|
||||
@ -542,10 +538,10 @@ test_single_dynamo_benchmark() {
|
||||
--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/${TEST_CONFIG}_${name}.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${ISCUDA124}/${TEST_CONFIG}_${name}.csv"
|
||||
python benchmarks/dynamo/check_graph_breaks.py \
|
||||
--actual "$TEST_REPORTS_DIR/${name}_$suite.csv" \
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${TEST_CONFIG}_${name}.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${ISCUDA124}/${TEST_CONFIG}_${name}.csv"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -554,11 +550,6 @@ test_inductor_micro_benchmark() {
|
||||
python benchmarks/gpt_fast/benchmark.py --output "${TEST_REPORTS_DIR}/gpt_fast_benchmark.csv"
|
||||
}
|
||||
|
||||
test_inductor_halide() {
|
||||
python test/run_test.py --include inductor/test_halide.py --verbose
|
||||
assert_git_not_dirty
|
||||
}
|
||||
|
||||
test_dynamo_benchmark() {
|
||||
# Usage: test_dynamo_benchmark huggingface 0
|
||||
TEST_REPORTS_DIR=$(pwd)/test/test-reports
|
||||
@ -573,15 +564,11 @@ test_dynamo_benchmark() {
|
||||
elif [[ "${TEST_CONFIG}" == *perf* ]]; then
|
||||
test_single_dynamo_benchmark "dashboard" "$suite" "$shard_id" "$@"
|
||||
else
|
||||
if [[ "${TEST_CONFIG}" == *cpu_inductor* || "${TEST_CONFIG}" == *cpu_aot_inductor* ]]; then
|
||||
local dt="float32"
|
||||
if [[ "${TEST_CONFIG}" == *amp* ]]; then
|
||||
dt="amp"
|
||||
fi
|
||||
if [[ "${TEST_CONFIG}" == *cpu_inductor* ]]; then
|
||||
if [[ "${TEST_CONFIG}" == *freezing* ]]; then
|
||||
test_single_dynamo_benchmark "inference" "$suite" "$shard_id" --inference --"$dt" --freezing "$@"
|
||||
test_single_dynamo_benchmark "inference" "$suite" "$shard_id" --inference --float32 --freezing "$@"
|
||||
else
|
||||
test_single_dynamo_benchmark "inference" "$suite" "$shard_id" --inference --"$dt" "$@"
|
||||
test_single_dynamo_benchmark "inference" "$suite" "$shard_id" --inference --float32 "$@"
|
||||
fi
|
||||
elif [[ "${TEST_CONFIG}" == *aot_inductor* ]]; then
|
||||
test_single_dynamo_benchmark "inference" "$suite" "$shard_id" --inference --bfloat16 "$@"
|
||||
@ -605,7 +592,7 @@ test_inductor_torchbench_smoketest_perf() {
|
||||
--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/inductor_torchbench_inference.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${ISCUDA124}/inductor_torchbench_inference.csv"
|
||||
|
||||
python benchmarks/dynamo/torchbench.py --device cuda --performance --backend inductor --float16 --training \
|
||||
--batch-size-file "$(realpath benchmarks/dynamo/torchbench_models_list.txt)" --only hf_Bert \
|
||||
@ -620,8 +607,13 @@ test_inductor_torchbench_smoketest_perf() {
|
||||
# https://github.com/pytorch/pytorch/actions/runs/7158691360/job/19491437314,
|
||||
# and thus we lower its threshold to reduce flakiness. If this continues to be a problem,
|
||||
# we switch to use some other model.
|
||||
# lowering threshold from 4.9 to 4.7 for cu124. Will bump it up after cuda 12.4.0->12.4.1 update
|
||||
python benchmarks/dynamo/check_perf_csv.py -f "$TEST_REPORTS_DIR/inductor_inference_smoketest.csv" -t 4.7
|
||||
# Use 4.7 for cuda 12.4, change back to 4.9 after fixing https://github.com/pytorch/pytorch/issues/126692
|
||||
if [ "$CUDA_VERSION" == "12.4" ]; then
|
||||
THRESHOLD=4.7
|
||||
else
|
||||
THRESHOLD=4.9
|
||||
fi
|
||||
python benchmarks/dynamo/check_perf_csv.py -f "$TEST_REPORTS_DIR/inductor_inference_smoketest.csv" -t $THRESHOLD
|
||||
|
||||
# Check memory compression ratio for a few models
|
||||
for test in hf_Albert timm_vision_transformer; do
|
||||
@ -640,7 +632,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/inductor_huggingface_training.csv"
|
||||
--expected "benchmarks/dynamo/ci_expected_accuracy/${ISCUDA124}/inductor_huggingface_training.csv"
|
||||
done
|
||||
}
|
||||
|
||||
@ -1177,21 +1169,15 @@ test_executorch() {
|
||||
|
||||
pushd /executorch
|
||||
|
||||
export PYTHON_EXECUTABLE=python
|
||||
export EXECUTORCH_BUILD_PYBIND=ON
|
||||
export CMAKE_ARGS="-DEXECUTORCH_BUILD_XNNPACK=ON -DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON"
|
||||
|
||||
# NB: We need to rebuild ExecuTorch runner here because it depends on PyTorch
|
||||
# from the PR
|
||||
# NB: We need to build ExecuTorch runner here and not inside the Docker image
|
||||
# because it depends on PyTorch
|
||||
# shellcheck disable=SC1091
|
||||
source .ci/scripts/setup-linux.sh cmake
|
||||
|
||||
echo "Run ExecuTorch unit tests"
|
||||
pytest -v -n auto
|
||||
# shellcheck disable=SC1091
|
||||
LLVM_PROFDATA=llvm-profdata-12 LLVM_COV=llvm-cov-12 bash test/run_oss_cpp_tests.sh
|
||||
source .ci/scripts/utils.sh
|
||||
build_executorch_runner "cmake"
|
||||
|
||||
echo "Run ExecuTorch regression tests for some models"
|
||||
# NB: This is a sample model, more can be added here
|
||||
export PYTHON_EXECUTABLE=python
|
||||
# TODO(huydhn): Add more coverage here using ExecuTorch's gather models script
|
||||
# shellcheck disable=SC1091
|
||||
source .ci/scripts/test.sh mv3 cmake xnnpack-quantization-delegation ''
|
||||
@ -1251,10 +1237,11 @@ elif [[ "$TEST_CONFIG" == distributed ]]; then
|
||||
if [[ "${SHARD_NUMBER}" == 1 ]]; then
|
||||
test_rpc
|
||||
fi
|
||||
elif [[ "$TEST_CONFIG" == deploy ]]; then
|
||||
checkout_install_torchdeploy
|
||||
test_torch_deploy
|
||||
elif [[ "${TEST_CONFIG}" == *inductor_distributed* ]]; then
|
||||
test_inductor_distributed
|
||||
elif [[ "${TEST_CONFIG}" == *inductor-halide* ]]; then
|
||||
test_inductor_halide
|
||||
elif [[ "${TEST_CONFIG}" == *inductor-micro-benchmark* ]]; then
|
||||
test_inductor_micro_benchmark
|
||||
elif [[ "${TEST_CONFIG}" == *huggingface* ]]; then
|
||||
@ -1266,14 +1253,13 @@ elif [[ "${TEST_CONFIG}" == *timm* ]]; then
|
||||
id=$((SHARD_NUMBER-1))
|
||||
test_dynamo_benchmark timm_models "$id"
|
||||
elif [[ "${TEST_CONFIG}" == *torchbench* ]]; then
|
||||
if [[ "${TEST_CONFIG}" == *cpu_inductor* || "${TEST_CONFIG}" == *cpu_aot_inductor* ]]; then
|
||||
if [[ "${TEST_CONFIG}" == *cpu_inductor* ]]; then
|
||||
install_torchaudio cpu
|
||||
else
|
||||
install_torchaudio cuda
|
||||
fi
|
||||
install_torchtext
|
||||
install_torchvision
|
||||
TORCH_CUDA_ARCH_LIST="8.0;8.6" pip_install git+https://github.com/pytorch/ao.git
|
||||
id=$((SHARD_NUMBER-1))
|
||||
# https://github.com/opencv/opencv-python/issues/885
|
||||
pip_install opencv-python==4.8.0.74
|
||||
@ -1292,7 +1278,7 @@ elif [[ "${TEST_CONFIG}" == *torchbench* ]]; then
|
||||
checkout_install_torchbench
|
||||
# Do this after checkout_install_torchbench to ensure we clobber any
|
||||
# nightlies that torchbench may pull in
|
||||
if [[ "${TEST_CONFIG}" != *cpu_inductor* && "${TEST_CONFIG}" != *cpu_aot_inductor* ]]; then
|
||||
if [[ "${TEST_CONFIG}" != *cpu_inductor* ]]; then
|
||||
install_torchrec_and_fbgemm
|
||||
fi
|
||||
PYTHONPATH=$(pwd)/torchbench test_dynamo_benchmark torchbench "$id"
|
||||
@ -1300,19 +1286,17 @@ elif [[ "${TEST_CONFIG}" == *torchbench* ]]; then
|
||||
elif [[ "${TEST_CONFIG}" == *inductor_cpp_wrapper_abi_compatible* ]]; then
|
||||
install_torchvision
|
||||
test_inductor_cpp_wrapper_abi_compatible
|
||||
elif [[ "${TEST_CONFIG}" == *inductor* ]]; then
|
||||
elif [[ "${TEST_CONFIG}" == *inductor* && "${SHARD_NUMBER}" == 1 ]]; then
|
||||
install_torchvision
|
||||
test_inductor_shard "${SHARD_NUMBER}"
|
||||
if [[ "${SHARD_NUMBER}" == 1 ]]; then
|
||||
test_inductor_aoti
|
||||
test_inductor_distributed
|
||||
fi
|
||||
elif [[ "${TEST_CONFIG}" == *dynamo* ]]; then
|
||||
test_inductor
|
||||
test_inductor_distributed
|
||||
elif [[ "${TEST_CONFIG}" == *dynamo* && "${SHARD_NUMBER}" == 1 && $NUM_TEST_SHARDS -gt 1 ]]; then
|
||||
install_torchvision
|
||||
test_dynamo_shard 1
|
||||
test_aten
|
||||
elif [[ "${TEST_CONFIG}" == *dynamo* && $SHARD_NUMBER -gt 1 && $NUM_TEST_SHARDS -gt 1 ]]; then
|
||||
install_torchvision
|
||||
test_dynamo_shard "${SHARD_NUMBER}"
|
||||
if [[ "${SHARD_NUMBER}" == 1 ]]; then
|
||||
test_aten
|
||||
fi
|
||||
elif [[ "${BUILD_ENVIRONMENT}" == *rocm* && -n "$TESTS_TO_INCLUDE" ]]; then
|
||||
install_torchvision
|
||||
test_python_shard "$SHARD_NUMBER"
|
||||
|
||||
@ -4,7 +4,6 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
COMMON_TESTS = [
|
||||
(
|
||||
"Checking that torch is available",
|
||||
|
||||
@ -5,7 +5,6 @@ import sys
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
# Need to import modules that lie on an upward-relative path
|
||||
sys.path.append(os.path.join(sys.path[0], ".."))
|
||||
|
||||
|
||||
@ -97,16 +97,8 @@ if [[ "$PACKAGE_TYPE" == conda ]]; then
|
||||
)
|
||||
elif [[ "$PACKAGE_TYPE" != libtorch ]]; then
|
||||
if [[ "\$BUILD_ENVIRONMENT" != *s390x* ]]; then
|
||||
if [[ "$USE_SPLIT_BUILD" == "true" ]]; then
|
||||
pkg_no_python="$(ls -1 /final_pkgs/torch_no_python* | sort |tail -1)"
|
||||
pkg_torch="$(ls -1 /final_pkgs/torch-* | sort |tail -1)"
|
||||
# todo: after folder is populated use the pypi_pkg channel instead
|
||||
pip install "\$pkg_no_python" "\$pkg_torch" --index-url "https://download.pytorch.org/whl/\${CHANNEL}/${DESIRED_CUDA}_pypi_pkg"
|
||||
retry pip install -q numpy protobuf typing-extensions
|
||||
else
|
||||
pip install "\$pkg" --index-url "https://download.pytorch.org/whl/\${CHANNEL}/${DESIRED_CUDA}"
|
||||
retry pip install -q numpy protobuf typing-extensions
|
||||
fi
|
||||
pip install "\$pkg" --index-url "https://download.pytorch.org/whl/\${CHANNEL}/${DESIRED_CUDA}"
|
||||
retry pip install -q numpy protobuf typing-extensions
|
||||
else
|
||||
pip install "\$pkg"
|
||||
retry pip install -q numpy protobuf typing-extensions
|
||||
@ -118,18 +110,9 @@ if [[ "$PACKAGE_TYPE" == libtorch ]]; then
|
||||
cd /tmp/libtorch
|
||||
fi
|
||||
|
||||
if [[ "$GPU_ARCH_TYPE" == xpu ]]; then
|
||||
# Workaround for __mkl_tmp_MOD unbound variable issue, refer https://github.com/pytorch/pytorch/issues/130543
|
||||
set +u
|
||||
source /opt/intel/oneapi/pytorch-gpu-dev-0.5/oneapi-vars.sh
|
||||
fi
|
||||
|
||||
# Test the package
|
||||
/builder/check_binary.sh
|
||||
|
||||
# Clean temp files
|
||||
cd /builder && git clean -ffdx
|
||||
|
||||
# =================== The above code will be executed inside Docker container ===================
|
||||
EOL
|
||||
echo
|
||||
|
||||
@ -33,9 +33,9 @@ if [[ -z "$DOCKER_IMAGE" ]]; then
|
||||
if [[ "$PACKAGE_TYPE" == conda ]]; then
|
||||
export DOCKER_IMAGE="pytorch/conda-cuda"
|
||||
elif [[ "$DESIRED_CUDA" == cpu ]]; then
|
||||
export DOCKER_IMAGE="pytorch/manylinux:cpu"
|
||||
export DOCKER_IMAGE="pytorch/manylinux-cpu"
|
||||
else
|
||||
export DOCKER_IMAGE="pytorch/manylinux-builder:${DESIRED_CUDA:2}"
|
||||
export DOCKER_IMAGE="pytorch/manylinux-cuda${DESIRED_CUDA:2}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -77,8 +77,7 @@ TRITON_VERSION=$(cat $PYTORCH_ROOT/.ci/docker/triton_version.txt)
|
||||
# Here PYTORCH_EXTRA_INSTALL_REQUIREMENTS is already set for the all the wheel builds hence append TRITON_CONSTRAINT
|
||||
TRITON_CONSTRAINT="platform_system == 'Linux' and platform_machine == 'x86_64' and python_version < '3.13'"
|
||||
if [[ "$PACKAGE_TYPE" =~ .*wheel.* && -n "${PYTORCH_EXTRA_INSTALL_REQUIREMENTS:-}" ]]; then
|
||||
# Only linux Python < 3.13 are supported wheels for triton
|
||||
TRITON_REQUIREMENT="triton==${TRITON_VERSION}; ${TRITON_CONSTRAINT}"
|
||||
TRITON_REQUIREMENT="pytorch-triton==${TRITON_VERSION}; ${TRITON_CONSTRAINT}"
|
||||
if [[ -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_BUILD_VERSION" =~ .*dev.* ]]; then
|
||||
TRITON_SHORTHASH=$(cut -c1-10 $PYTORCH_ROOT/.ci/docker/ci_commit_pins/triton.txt)
|
||||
TRITON_REQUIREMENT="pytorch-triton==${TRITON_VERSION}+${TRITON_SHORTHASH}; ${TRITON_CONSTRAINT}"
|
||||
@ -100,18 +99,30 @@ if [[ "$PACKAGE_TYPE" =~ .*wheel.* && -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_B
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set triton via PYTORCH_EXTRA_INSTALL_REQUIREMENTS for triton xpu package
|
||||
if [[ "$PACKAGE_TYPE" =~ .*wheel.* && -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_BUILD_VERSION" =~ .*xpu.* && $(uname) == "Linux" ]]; then
|
||||
TRITON_REQUIREMENT="pytorch-triton-xpu==${TRITON_VERSION}"
|
||||
if [[ -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_BUILD_VERSION" =~ .*dev.* ]]; then
|
||||
TRITON_SHORTHASH=$(cut -c1-10 $PYTORCH_ROOT/.ci/docker/ci_commit_pins/triton-xpu.txt)
|
||||
TRITON_REQUIREMENT="pytorch-triton-xpu==${TRITON_VERSION}+${TRITON_SHORTHASH}"
|
||||
fi
|
||||
if [[ -z "${PYTORCH_EXTRA_INSTALL_REQUIREMENTS:-}" ]]; then
|
||||
export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${TRITON_REQUIREMENT}"
|
||||
else
|
||||
export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${PYTORCH_EXTRA_INSTALL_REQUIREMENTS} | ${TRITON_REQUIREMENT}"
|
||||
JAVA_HOME=
|
||||
BUILD_JNI=OFF
|
||||
if [[ "$PACKAGE_TYPE" == libtorch ]]; then
|
||||
POSSIBLE_JAVA_HOMES=()
|
||||
POSSIBLE_JAVA_HOMES+=(/usr/local)
|
||||
POSSIBLE_JAVA_HOMES+=(/usr/lib/jvm/java-8-openjdk-amd64)
|
||||
POSSIBLE_JAVA_HOMES+=(/Library/Java/JavaVirtualMachines/*.jdk/Contents/Home)
|
||||
# Add the Windows-specific JNI path
|
||||
POSSIBLE_JAVA_HOMES+=("$PWD/pytorch/.circleci/windows-jni/")
|
||||
for JH in "${POSSIBLE_JAVA_HOMES[@]}" ; do
|
||||
if [[ -e "$JH/include/jni.h" ]] ; then
|
||||
# Skip if we're not on Windows but haven't found a JAVA_HOME
|
||||
if [[ "$JH" == "$PWD/pytorch/.circleci/windows-jni/" && "$OSTYPE" != "msys" ]] ; then
|
||||
break
|
||||
fi
|
||||
echo "Found jni.h under $JH"
|
||||
JAVA_HOME="$JH"
|
||||
BUILD_JNI=ON
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
echo "Did not find jni.h"
|
||||
fi
|
||||
fi
|
||||
|
||||
cat >"$envfile" <<EOL
|
||||
@ -124,7 +135,6 @@ export DESIRED_PYTHON="${DESIRED_PYTHON:-}"
|
||||
export DESIRED_CUDA="$DESIRED_CUDA"
|
||||
export LIBTORCH_VARIANT="${LIBTORCH_VARIANT:-}"
|
||||
export BUILD_PYTHONLESS="${BUILD_PYTHONLESS:-}"
|
||||
export USE_SPLIT_BUILD="${USE_SPLIT_BUILD:-}"
|
||||
if [[ "${OSTYPE}" == "msys" ]]; then
|
||||
export LIBTORCH_CONFIG="${LIBTORCH_CONFIG:-}"
|
||||
if [[ "${LIBTORCH_CONFIG:-}" == 'debug' ]]; then
|
||||
@ -148,6 +158,8 @@ export TORCH_CONDA_BUILD_FOLDER='pytorch-nightly'
|
||||
export ANACONDA_USER='pytorch'
|
||||
|
||||
export USE_FBGEMM=1
|
||||
export JAVA_HOME=$JAVA_HOME
|
||||
export BUILD_JNI=$BUILD_JNI
|
||||
export PIP_UPLOAD_FOLDER="$PIP_UPLOAD_FOLDER"
|
||||
export DOCKER_IMAGE="$DOCKER_IMAGE"
|
||||
|
||||
|
||||
@ -25,15 +25,6 @@ if [[ "${DRY_RUN}" = "disabled" ]]; then
|
||||
AWS_S3_CP="aws s3 cp"
|
||||
fi
|
||||
|
||||
if [[ "${USE_SPLIT_BUILD:-false}" == "true" ]]; then
|
||||
UPLOAD_SUBFOLDER="${UPLOAD_SUBFOLDER}_pypi_pkg"
|
||||
fi
|
||||
|
||||
# this is special build with all dependencies packaged
|
||||
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 && "$@")
|
||||
|
||||
@ -8,7 +8,6 @@ import time
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
AZURE_PIPELINE_BASE_URL = "https://aiinfra.visualstudio.com/PyTorch/"
|
||||
AZURE_DEVOPS_PAT_BASE64 = os.environ.get("AZURE_DEVOPS_PAT_BASE64_SECRET", "")
|
||||
PIPELINE_ID = "911"
|
||||
|
||||
@ -62,6 +62,4 @@ readability-string-compare,
|
||||
'
|
||||
HeaderFilterRegex: '^(aten/|c10/|torch/).*$'
|
||||
WarningsAsErrors: '*'
|
||||
CheckOptions:
|
||||
misc-header-include-cycle.IgnoredFilesList: 'format.h;ivalue.h;custom_class.h;Dict.h;List.h'
|
||||
...
|
||||
|
||||
2
.flake8
2
.flake8
@ -2,7 +2,7 @@
|
||||
# NOTE: **Mirror any changes** to this file the [tool.ruff] config in pyproject.toml
|
||||
# before we can fully move to use ruff
|
||||
enable-extensions = G
|
||||
select = B,C,E,F,G,P,SIM1,SIM911,T4,W,B9,TOR0,TOR1,TOR2,TOR9
|
||||
select = B,C,E,F,G,P,SIM1,T4,W,B9,TOR0,TOR1,TOR2,TOR9
|
||||
max-line-length = 120
|
||||
# C408 ignored because we like the dict keyword argument syntax
|
||||
# E501 is not flexible enough, we're using B950 instead
|
||||
|
||||
@ -40,7 +40,3 @@ e6ec0efaf87703c5f889cfc20b29be455885d58d
|
||||
a53cda1ddc15336dc1ff0ce1eff2a49cdc5f882e
|
||||
# 2024-01-02 clangformat: fused adam #116583
|
||||
9dc68d1aa9e554d09344a10fff69f7b50b2d23a0
|
||||
# 2024-06-28 enable UFMT in `torch/storage.py`
|
||||
d80939e5e9337e8078f11489afefec59fd42f93b
|
||||
# 2024-06-28 enable UFMT in `torch.utils.data`
|
||||
7cf0b90e49689d45be91aa539fdf54cf2ea8a9a3
|
||||
|
||||
2
.github/actionlint.yaml
vendored
2
.github/actionlint.yaml
vendored
@ -47,5 +47,3 @@ self-hosted-runner:
|
||||
- macos-latest-xlarge
|
||||
- macos-13-xlarge
|
||||
- macos-14-xlarge
|
||||
# Organization-wide Intel hosted XPU runners
|
||||
- linux.idc.xpu
|
||||
|
||||
6
.github/actions/diskspace-cleanup/action.yml
vendored
6
.github/actions/diskspace-cleanup/action.yml
vendored
@ -14,14 +14,12 @@ runs:
|
||||
- name: Cleans up diskspace
|
||||
shell: bash
|
||||
run: |
|
||||
set -ex
|
||||
diskspace_cutoff=${{ inputs.diskspace-cutoff }}
|
||||
docker_root_dir=$(docker info -f '{{.DockerRootDir}}')
|
||||
diskspace=$(df -H --output=pcent ${docker_root_dir} | sed -n 2p | sed 's/%//' | sed 's/ //')
|
||||
diskspace=$(df -H / --output=pcent | 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
|
||||
docker system prune -af
|
||||
diskspace_new=$(df -H --output=pcent ${docker_root_dir} | sed -n 2p | sed 's/%//' | sed 's/ //')
|
||||
diskspace_new=$(df -H / --output=pcent | sed -n 2p | sed 's/%//' | sed 's/ //')
|
||||
if [[ "$diskspace_new" -gt "$diskspace_cutoff" ]] ; then
|
||||
echo "Error: Available diskspace is less than $diskspace_cutoff percent. Not enough diskspace."
|
||||
echo "$msg"
|
||||
|
||||
21
.github/actions/linux-build/action.yml
vendored
21
.github/actions/linux-build/action.yml
vendored
@ -52,13 +52,6 @@ inputs:
|
||||
description: Hugging Face Hub token
|
||||
required: false
|
||||
default: ""
|
||||
use_split_build:
|
||||
description: |
|
||||
[Experimental] Build a libtorch only wheel and build pytorch such that
|
||||
are built from the libtorch wheel.
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
outputs:
|
||||
docker-image:
|
||||
value: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
@ -151,7 +144,6 @@ runs:
|
||||
DEBUG: ${{ inputs.build-with-debug == 'true' && '1' || '0' }}
|
||||
OUR_GITHUB_JOB_ID: ${{ steps.get-job-id.outputs.job-id }}
|
||||
HUGGING_FACE_HUB_TOKEN: ${{ inputs.HUGGING_FACE_HUB_TOKEN }}
|
||||
USE_SPLIT_BUILD: ${{ inputs.use_split_build }}
|
||||
shell: bash
|
||||
run: |
|
||||
# detached container should get cleaned up by teardown_ec2_linux
|
||||
@ -171,7 +163,6 @@ runs:
|
||||
-e PR_LABELS \
|
||||
-e OUR_GITHUB_JOB_ID \
|
||||
-e HUGGING_FACE_HUB_TOKEN \
|
||||
-e USE_SPLIT_BUILD \
|
||||
--env-file="/tmp/github_env_${GITHUB_RUN_ID}" \
|
||||
--security-opt seccomp=unconfined \
|
||||
--cap-add=SYS_PTRACE \
|
||||
@ -192,7 +183,7 @@ runs:
|
||||
|
||||
- name: Store PyTorch Build Artifacts on S3
|
||||
uses: seemethere/upload-artifact-s3@v5
|
||||
if: inputs.build-generates-artifacts == 'true' && steps.build.outcome != 'skipped' && inputs.use_split_build != 'true'
|
||||
if: inputs.build-generates-artifacts == 'true' && steps.build.outcome != 'skipped'
|
||||
with:
|
||||
name: ${{ inputs.build-environment }}
|
||||
retention-days: 14
|
||||
@ -200,16 +191,6 @@ runs:
|
||||
path: artifacts.zip
|
||||
s3-bucket: ${{ inputs.s3-bucket }}
|
||||
|
||||
- name: Store PyTorch Build Artifacts on S3 for split build
|
||||
uses: seemethere/upload-artifact-s3@v5
|
||||
if: inputs.build-generates-artifacts == 'true' && steps.build.outcome != 'skipped' && inputs.use_split_build == 'true'
|
||||
with:
|
||||
name: ${{ inputs.build-environment }}-experimental-split-build
|
||||
retention-days: 14
|
||||
if-no-files-found: error
|
||||
path: artifacts.zip
|
||||
s3-bucket: ${{ inputs.s3-bucket }}
|
||||
|
||||
- name: Upload sccache stats
|
||||
if: steps.build.outcome != 'skipped'
|
||||
uses: seemethere/upload-artifact-s3@v5
|
||||
|
||||
11
.github/actions/test-pytorch-binary/action.yml
vendored
11
.github/actions/test-pytorch-binary/action.yml
vendored
@ -26,7 +26,6 @@ runs:
|
||||
-e PYTORCH_FINAL_PACKAGE_DIR \
|
||||
-e PYTORCH_ROOT \
|
||||
-e SKIP_ALL_TESTS \
|
||||
-e USE_SPLIT_BUILD \
|
||||
--tty \
|
||||
--detach \
|
||||
-v "${GITHUB_WORKSPACE}/pytorch:/pytorch" \
|
||||
@ -36,8 +35,7 @@ runs:
|
||||
"${DOCKER_IMAGE}"
|
||||
)
|
||||
|
||||
echo "CONTAINER_NAME=${container_name}" >> "$GITHUB_ENV"
|
||||
if [[ "${GPU_ARCH_TYPE}" != "rocm" && "${BUILD_ENVIRONMENT}" != "linux-aarch64-binary-manywheel" && "${BUILD_ENVIRONMENT}" != "linux-s390x-binary-manywheel" && "${GPU_ARCH_TYPE}" != "xpu" ]]; then
|
||||
if [[ "${GPU_ARCH_TYPE}" != "rocm" && "${BUILD_ENVIRONMENT}" != "linux-aarch64-binary-manywheel" && "${BUILD_ENVIRONMENT}" != "linux-s390x-binary-manywheel" ]]; then
|
||||
# Propagate download.pytorch.org IP to container. This is only needed on Linux non aarch64 runner
|
||||
grep download.pytorch.org /etc/hosts | docker exec -i "${container_name}" bash -c "/bin/cat >> /etc/hosts"
|
||||
fi
|
||||
@ -48,9 +46,10 @@ runs:
|
||||
docker exec -t "${container_name}" bash -c "source ${BINARY_ENV_FILE} && bash -x /run.sh"
|
||||
|
||||
- name: Cleanup docker
|
||||
if: always() && (env.BUILD_ENVIRONMENT == 'linux-s390x-binary-manywheel' || env.GPU_ARCH_TYPE == 'xpu')
|
||||
if: always() && env.BUILD_ENVIRONMENT == 'linux-s390x-binary-manywheel'
|
||||
shell: bash
|
||||
run: |
|
||||
# on s390x or xpu stop the container for clean worker stop
|
||||
# on s390x stop the container for clean worker stop
|
||||
# ignore expansion of "docker ps -q" since it could be empty
|
||||
# shellcheck disable=SC2046
|
||||
docker stop "${{ env.CONTAINER_NAME }}" || true
|
||||
docker stop $(docker ps -q) || true
|
||||
|
||||
2
.github/ci_commit_pins/audio.txt
vendored
2
.github/ci_commit_pins/audio.txt
vendored
@ -1 +1 @@
|
||||
69b2a0adc2ec03ab99990d7e8be3d4510438c148
|
||||
b829e936f7cc61b48149f5f957a451a38bf2a178
|
||||
|
||||
2
.github/ci_commit_pins/xla.txt
vendored
2
.github/ci_commit_pins/xla.txt
vendored
@ -1 +1 @@
|
||||
6f0b61e5d782913a0fc7743812f2a8e522189111
|
||||
r2.4
|
||||
|
||||
33
.github/merge_rules.yaml
vendored
33
.github/merge_rules.yaml
vendored
@ -27,9 +27,11 @@
|
||||
- third_party/onnx
|
||||
- caffe2/python/onnx/**
|
||||
approved_by:
|
||||
- BowenBao
|
||||
- justinchuby
|
||||
- liqunfu
|
||||
- shubhambhokare1
|
||||
- thiagocrepaldi
|
||||
- titaiwangms
|
||||
- wschin
|
||||
- xadupre
|
||||
@ -242,7 +244,6 @@
|
||||
- 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:
|
||||
@ -286,7 +287,6 @@
|
||||
- test/cpp/dist_autograd/**
|
||||
- test/cpp/rpc/**
|
||||
approved_by:
|
||||
- wconstab
|
||||
- mrshenli
|
||||
- pritamdamania87
|
||||
- zhaojuanmao
|
||||
@ -313,25 +313,6 @@
|
||||
- Lint
|
||||
- pull
|
||||
|
||||
- name: DCP
|
||||
patterns:
|
||||
- torch/distributed/checkpoint/**
|
||||
approved_by:
|
||||
- LucasLLC
|
||||
- fegin
|
||||
- wz337
|
||||
- saumishr
|
||||
- daulet-askarov
|
||||
- pradeepdfb
|
||||
- kirtiteja
|
||||
- mhorowitz
|
||||
- saiteja64
|
||||
mandatory_checks_name:
|
||||
- EasyCLA
|
||||
- Lint
|
||||
- pull
|
||||
|
||||
|
||||
- name: IDEEP
|
||||
patterns:
|
||||
- third_party/ideep
|
||||
@ -395,21 +376,13 @@
|
||||
|
||||
- name: CPU inductor
|
||||
patterns:
|
||||
- torch/_inductor/mkldnn_ir.py
|
||||
- torch/_inductor/mkldnn_lowerings.py
|
||||
- torch/_inductor/fx_passes/mkldnn_fusion.py
|
||||
- torch/_inductor/fx_passes/quantization.py
|
||||
- torch/_inductor/codegen/cpp_prefix.h
|
||||
- torch/_inductor/codegen/cpp.py
|
||||
- torch/_inductor/codegen/cpp_utils.py
|
||||
- torch/_inductor/codegen/cpp_micro_gemm.py
|
||||
- torch/_inductor/codegen/cpp_template_kernel.py
|
||||
- torch/_inductor/codegen/cpp_template.py
|
||||
- torch/_inductor/codegen/cpp_gemm_template.py
|
||||
- test/inductor/test_mkldnn_pattern_matcher.py
|
||||
- test/inductor/test_cpu_repro.py
|
||||
- test/inductor/test_cpu_repo.py
|
||||
- test/inductor/test_cpu_cpp_wrapper.py
|
||||
- test/inductor/test_cpu_select_algorithm.py
|
||||
- aten/src/ATen/cpu/**
|
||||
- aten/src/ATen/native/quantized/cpu/**
|
||||
- test/quantization/core/test_quantized_op.py
|
||||
|
||||
1
.github/pytorch-probot.yml
vendored
1
.github/pytorch-probot.yml
vendored
@ -26,4 +26,3 @@ retryable_workflows:
|
||||
- windows-binary
|
||||
labeler_config: labeler.yml
|
||||
label_to_label_config: label_to_label.yml
|
||||
mergebot: True
|
||||
|
||||
31
.github/scripts/build_triton_wheel.py
vendored
31
.github/scripts/build_triton_wheel.py
vendored
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
@ -8,17 +7,12 @@ from subprocess import check_call
|
||||
from tempfile import TemporaryDirectory
|
||||
from typing import Optional
|
||||
|
||||
|
||||
SCRIPT_DIR = Path(__file__).parent
|
||||
REPO_DIR = SCRIPT_DIR.parent.parent
|
||||
|
||||
|
||||
def read_triton_pin(device: str = "cuda") -> str:
|
||||
triton_file = "triton.txt"
|
||||
if device == "rocm":
|
||||
triton_file = "triton-rocm.txt"
|
||||
elif device == "xpu":
|
||||
triton_file = "triton-xpu.txt"
|
||||
def read_triton_pin(rocm_hash: bool = False) -> str:
|
||||
triton_file = "triton.txt" if not rocm_hash else "triton-rocm.txt"
|
||||
with open(REPO_DIR / ".ci" / "docker" / "ci_commit_pins" / triton_file) as f:
|
||||
return f.read().strip()
|
||||
|
||||
@ -55,7 +49,7 @@ def build_triton(
|
||||
version: str,
|
||||
commit_hash: str,
|
||||
build_conda: bool = False,
|
||||
device: str = "cuda",
|
||||
build_rocm: bool = False,
|
||||
py_version: Optional[str] = None,
|
||||
release: bool = False,
|
||||
) -> Path:
|
||||
@ -75,14 +69,11 @@ def build_triton(
|
||||
triton_basedir = Path(tmpdir) / "triton"
|
||||
triton_pythondir = triton_basedir / "python"
|
||||
triton_repo = "https://github.com/openai/triton"
|
||||
if device == "rocm":
|
||||
if build_rocm:
|
||||
triton_pkg_name = "pytorch-triton-rocm"
|
||||
elif device == "xpu":
|
||||
triton_pkg_name = "pytorch-triton-xpu"
|
||||
triton_repo = "https://github.com/intel/intel-xpu-backend-for-triton"
|
||||
else:
|
||||
triton_pkg_name = "pytorch-triton"
|
||||
check_call(["git", "clone", triton_repo, "triton"], cwd=tmpdir)
|
||||
check_call(["git", "clone", triton_repo], cwd=tmpdir)
|
||||
if release:
|
||||
ver, rev, patch = version.split(".")
|
||||
check_call(
|
||||
@ -149,7 +140,7 @@ def build_triton(
|
||||
expected_version=None,
|
||||
)
|
||||
|
||||
if device == "rocm":
|
||||
if build_rocm:
|
||||
check_call(
|
||||
[f"{SCRIPT_DIR}/amd/package_triton_wheel.sh"],
|
||||
cwd=triton_basedir,
|
||||
@ -164,7 +155,7 @@ def build_triton(
|
||||
whl_path = next(iter((triton_pythondir / "dist").glob("*.whl")))
|
||||
shutil.copy(whl_path, Path.cwd())
|
||||
|
||||
if device == "rocm":
|
||||
if build_rocm:
|
||||
check_call(
|
||||
[f"{SCRIPT_DIR}/amd/patch_triton_wheel.sh", Path.cwd()],
|
||||
cwd=triton_basedir,
|
||||
@ -179,19 +170,17 @@ 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"]
|
||||
)
|
||||
parser.add_argument("--build-rocm", action="store_true")
|
||||
parser.add_argument("--py-version", type=str)
|
||||
parser.add_argument("--commit-hash", type=str)
|
||||
parser.add_argument("--triton-version", type=str, default=read_triton_version())
|
||||
args = parser.parse_args()
|
||||
|
||||
build_triton(
|
||||
device=args.device,
|
||||
build_rocm=args.build_rocm,
|
||||
commit_hash=args.commit_hash
|
||||
if args.commit_hash
|
||||
else read_triton_pin(args.device),
|
||||
else read_triton_pin(args.build_rocm),
|
||||
version=args.triton_version,
|
||||
build_conda=args.build_conda,
|
||||
py_version=args.py_version,
|
||||
|
||||
1
.github/scripts/check_labels.py
vendored
1
.github/scripts/check_labels.py
vendored
@ -5,6 +5,7 @@ import sys
|
||||
from typing import Any
|
||||
|
||||
from github_utils import gh_delete_comment, gh_post_pr_comment
|
||||
|
||||
from gitutils import get_git_remote_name, get_git_repo_dir, GitRepo
|
||||
from label_utils import has_required_labels, is_label_err_comment, LABEL_ERR_MSG
|
||||
from trymerge import GitHubPR
|
||||
|
||||
116
.github/scripts/cherry_pick.py
vendored
116
.github/scripts/cherry_pick.py
vendored
@ -3,10 +3,12 @@
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from typing import Any, cast, Dict, List, Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from urllib.error import HTTPError
|
||||
|
||||
from github_utils import gh_fetch_url, gh_post_pr_comment, gh_query_issues_by_labels
|
||||
from github_utils import gh_fetch_url, gh_post_pr_comment
|
||||
|
||||
from gitutils import get_git_remote_name, get_git_repo_dir, GitRepo
|
||||
from trymerge import get_pr_commit_sha, GitHubPR
|
||||
|
||||
@ -17,7 +19,6 @@ REQUIRES_ISSUE = {
|
||||
"critical",
|
||||
"fixnewfeature",
|
||||
}
|
||||
RELEASE_BRANCH_REGEX = re.compile(r"release/(?P<version>.+)")
|
||||
|
||||
|
||||
def parse_args() -> Any:
|
||||
@ -57,33 +58,6 @@ def get_merge_commit_sha(repo: GitRepo, pr: GitHubPR) -> Optional[str]:
|
||||
return commit_sha if pr.is_closed() else None
|
||||
|
||||
|
||||
def get_release_version(onto_branch: str) -> Optional[str]:
|
||||
"""
|
||||
Return the release version if the target branch is a release branch
|
||||
"""
|
||||
m = re.match(RELEASE_BRANCH_REGEX, onto_branch)
|
||||
return m.group("version") if m else ""
|
||||
|
||||
|
||||
def get_tracker_issues(
|
||||
org: str, project: str, onto_branch: str
|
||||
) -> 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
|
||||
"""
|
||||
version = get_release_version(onto_branch)
|
||||
if not version:
|
||||
return []
|
||||
|
||||
tracker_issues = gh_query_issues_by_labels(org, project, labels=["release tracker"])
|
||||
if not tracker_issues:
|
||||
return []
|
||||
|
||||
# Figure out the tracker issue from the list by looking at the title
|
||||
return [issue for issue in tracker_issues if version in issue.get("title", "")]
|
||||
|
||||
|
||||
def cherry_pick(
|
||||
github_actor: str,
|
||||
repo: GitRepo,
|
||||
@ -103,49 +77,17 @@ def cherry_pick(
|
||||
)
|
||||
|
||||
try:
|
||||
org, project = repo.gh_owner_and_name()
|
||||
|
||||
cherry_pick_pr = ""
|
||||
if not dry_run:
|
||||
org, project = repo.gh_owner_and_name()
|
||||
cherry_pick_pr = submit_pr(repo, pr, cherry_pick_branch, onto_branch)
|
||||
|
||||
tracker_issues_comments = []
|
||||
tracker_issues = get_tracker_issues(org, project, onto_branch)
|
||||
for issue in tracker_issues:
|
||||
issue_number = int(str(issue.get("number", "0")))
|
||||
if not issue_number:
|
||||
continue
|
||||
msg = f"The cherry pick PR is at {cherry_pick_pr}"
|
||||
if fixes:
|
||||
msg += f" and it is linked with issue {fixes}"
|
||||
elif classification in REQUIRES_ISSUE:
|
||||
msg += f" and it is recommended to link a {classification} cherry pick PR with an issue"
|
||||
|
||||
res = cast(
|
||||
Dict[str, Any],
|
||||
post_tracker_issue_comment(
|
||||
org,
|
||||
project,
|
||||
issue_number,
|
||||
pr.pr_num,
|
||||
cherry_pick_pr,
|
||||
classification,
|
||||
fixes,
|
||||
dry_run,
|
||||
),
|
||||
)
|
||||
|
||||
comment_url = res.get("html_url", "")
|
||||
if comment_url:
|
||||
tracker_issues_comments.append(comment_url)
|
||||
|
||||
msg = f"The cherry pick PR is at {cherry_pick_pr}"
|
||||
if fixes:
|
||||
msg += f" and it is linked with issue {fixes}."
|
||||
elif classification in REQUIRES_ISSUE:
|
||||
msg += f" and it is recommended to link a {classification} cherry pick PR with an issue."
|
||||
|
||||
if tracker_issues_comments:
|
||||
msg += " The following tracker issues are updated:\n"
|
||||
for tracker_issues_comment in tracker_issues_comments:
|
||||
msg += f"* {tracker_issues_comment}\n"
|
||||
|
||||
post_pr_comment(org, project, pr.pr_num, msg, dry_run)
|
||||
post_comment(org, project, pr.pr_num, msg)
|
||||
|
||||
finally:
|
||||
if current_branch:
|
||||
@ -217,9 +159,7 @@ def submit_pr(
|
||||
raise RuntimeError(msg) from error
|
||||
|
||||
|
||||
def post_pr_comment(
|
||||
org: str, project: str, pr_num: int, msg: str, dry_run: bool = False
|
||||
) -> List[Dict[str, Any]]:
|
||||
def post_comment(org: str, project: str, pr_num: int, msg: str) -> None:
|
||||
"""
|
||||
Post a comment on the PR itself to point to the cherry picking PR when success
|
||||
or print the error when failure
|
||||
@ -242,35 +182,7 @@ def post_pr_comment(
|
||||
comment = "\n".join(
|
||||
(f"### Cherry picking #{pr_num}", f"{msg}", "", f"{internal_debugging}")
|
||||
)
|
||||
return gh_post_pr_comment(org, project, pr_num, comment, dry_run)
|
||||
|
||||
|
||||
def post_tracker_issue_comment(
|
||||
org: str,
|
||||
project: str,
|
||||
issue_num: int,
|
||||
pr_num: int,
|
||||
cherry_pick_pr: str,
|
||||
classification: str,
|
||||
fixes: str,
|
||||
dry_run: bool = False,
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""
|
||||
Post a comment on the tracker issue (if any) to record the cherry pick
|
||||
"""
|
||||
comment = "\n".join(
|
||||
(
|
||||
"Link to landed trunk PR (if applicable):",
|
||||
f"* https://github.com/{org}/{project}/pull/{pr_num}",
|
||||
"",
|
||||
"Link to release branch PR:",
|
||||
f"* {cherry_pick_pr}",
|
||||
"",
|
||||
"Criteria Category:",
|
||||
" - ".join((classification.capitalize(), fixes.capitalize())),
|
||||
)
|
||||
)
|
||||
return gh_post_pr_comment(org, project, issue_num, comment, dry_run)
|
||||
gh_post_pr_comment(org, project, pr_num, comment)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
@ -302,7 +214,7 @@ def main() -> None:
|
||||
|
||||
except RuntimeError as error:
|
||||
if not args.dry_run:
|
||||
post_pr_comment(org, project, pr_num, str(error))
|
||||
post_comment(org, project, pr_num, str(error))
|
||||
else:
|
||||
raise error
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ import requests
|
||||
import rockset # type: ignore[import]
|
||||
from gitutils import retries_decorator
|
||||
|
||||
|
||||
LOGS_QUERY = """
|
||||
with
|
||||
shas as (
|
||||
|
||||
2
.github/scripts/collect_ciflow_labels.py
vendored
2
.github/scripts/collect_ciflow_labels.py
vendored
@ -1,12 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, cast, Dict, List, Set
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
GITHUB_DIR = Path(__file__).parent.parent
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import NamedTuple, Optional
|
||||
|
||||
1
.github/scripts/delete_old_branches.py
vendored
1
.github/scripts/delete_old_branches.py
vendored
@ -9,7 +9,6 @@ from typing import Any, Callable, Dict, List, Set
|
||||
from github_utils import gh_fetch_json_dict, gh_graphql
|
||||
from gitutils import GitRepo
|
||||
|
||||
|
||||
SEC_IN_DAY = 24 * 60 * 60
|
||||
CLOSED_PR_RETENTION = 30 * SEC_IN_DAY
|
||||
NO_PR_RETENTION = 1.5 * 365 * SEC_IN_DAY
|
||||
|
||||
BIN
.github/scripts/drci_mocks.json.gz
vendored
BIN
.github/scripts/drci_mocks.json.gz
vendored
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
1
.github/scripts/export_pytorch_labels.py
vendored
1
.github/scripts/export_pytorch_labels.py
vendored
@ -14,6 +14,7 @@ import json
|
||||
from typing import Any
|
||||
|
||||
import boto3 # type: ignore[import]
|
||||
|
||||
from label_utils import gh_get_labels
|
||||
|
||||
|
||||
|
||||
5
.github/scripts/filter_test_configs.py
vendored
5
.github/scripts/filter_test_configs.py
vendored
@ -15,7 +15,6 @@ from urllib.request import Request, urlopen
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
REENABLE_TEST_REGEX = "(?i)(Close(d|s)?|Resolve(d|s)?|Fix(ed|es)?) (#|https://github.com/pytorch/pytorch/issues/)([0-9]+)"
|
||||
|
||||
PREFIX = "test-config/"
|
||||
@ -39,9 +38,9 @@ SUPPORTED_PERIODICAL_MODES: Dict[str, Callable[[Optional[str]], bool]] = {
|
||||
}
|
||||
|
||||
# The link to the published list of disabled jobs
|
||||
DISABLED_JOBS_URL = "https://ossci-metrics.s3.amazonaws.com/disabled-jobs.json"
|
||||
DISABLED_JOBS_URL = "https://ossci-metrics.s3.amazonaws.com/disabled-jobs.json?versionId=tIl0Qo224T_NDVw0dtG4hU1cZJM97inV"
|
||||
# and unstable jobs
|
||||
UNSTABLE_JOBS_URL = "https://ossci-metrics.s3.amazonaws.com/unstable-jobs.json"
|
||||
UNSTABLE_JOBS_URL = "https://ossci-metrics.s3.amazonaws.com/unstable-jobs.json?versionId=GPyRZRsOo26Gfk_WjAoNNxEMGXkIxIes"
|
||||
|
||||
# Some constants used to handle disabled and unstable jobs
|
||||
JOB_NAME_SEP = "/"
|
||||
|
||||
71
.github/scripts/generate_binary_build_matrix.py
vendored
71
.github/scripts/generate_binary_build_matrix.py
vendored
@ -8,13 +8,11 @@ architectures:
|
||||
* CPU
|
||||
* Latest CUDA
|
||||
* Latest ROCM
|
||||
* Latest XPU
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Dict, List, Optional, Tuple
|
||||
|
||||
|
||||
CUDA_ARCHES = ["11.8", "12.1", "12.4"]
|
||||
|
||||
|
||||
@ -26,7 +24,6 @@ CUDA_ARCHES_CUDNN_VERSION = {"11.8": "9", "12.1": "9", "12.4": "9"}
|
||||
|
||||
ROCM_ARCHES = ["6.0", "6.1"]
|
||||
|
||||
XPU_ARCHES = ["xpu"]
|
||||
|
||||
CPU_CXX11_ABI_ARCH = ["cpu-cxx11-abi"]
|
||||
|
||||
@ -51,7 +48,7 @@ PYTORCH_EXTRA_INSTALL_REQUIREMENTS = {
|
||||
"nvidia-curand-cu11==10.3.0.86; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusolver-cu11==11.4.1.48; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparse-cu11==11.7.5.86; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu11==2.21.5; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu11==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvtx-cu11==11.8.86; platform_system == 'Linux' and platform_machine == 'x86_64'"
|
||||
),
|
||||
"12.1": (
|
||||
@ -64,7 +61,7 @@ PYTORCH_EXTRA_INSTALL_REQUIREMENTS = {
|
||||
"nvidia-curand-cu12==10.3.2.106; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusolver-cu12==11.4.5.107; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparse-cu12==12.1.0.106; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.21.5; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvtx-cu12==12.1.105; platform_system == 'Linux' and platform_machine == 'x86_64'"
|
||||
),
|
||||
"12.4": (
|
||||
@ -77,7 +74,7 @@ PYTORCH_EXTRA_INSTALL_REQUIREMENTS = {
|
||||
"nvidia-curand-cu12==10.3.5.119; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusolver-cu12==11.6.0.99; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-cusparse-cu12==12.3.0.142; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.21.5; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nccl-cu12==2.20.5; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvtx-cu12==12.4.99; platform_system == 'Linux' and platform_machine == 'x86_64' | "
|
||||
"nvidia-nvjitlink-cu12==12.4.99; platform_system == 'Linux' and platform_machine == 'x86_64'"
|
||||
),
|
||||
@ -135,8 +132,6 @@ def arch_type(arch_version: str) -> str:
|
||||
return "cuda"
|
||||
elif arch_version in ROCM_ARCHES:
|
||||
return "rocm"
|
||||
elif arch_version in XPU_ARCHES:
|
||||
return "xpu"
|
||||
elif arch_version in CPU_CXX11_ABI_ARCH:
|
||||
return "cpu-cxx11-abi"
|
||||
elif arch_version in CPU_AARCH64_ARCH:
|
||||
@ -161,7 +156,6 @@ WHEEL_CONTAINER_IMAGES = {
|
||||
gpu_arch: f"pytorch/manylinux-builder:rocm{gpu_arch}-{DEFAULT_TAG}"
|
||||
for gpu_arch in ROCM_ARCHES
|
||||
},
|
||||
"xpu": f"pytorch/manylinux2_28-builder:xpu-{DEFAULT_TAG}",
|
||||
"cpu": f"pytorch/manylinux-builder:cpu-{DEFAULT_TAG}",
|
||||
"cpu-cxx11-abi": f"pytorch/manylinuxcxx11-abi-builder:cpu-cxx11-abi-{DEFAULT_TAG}",
|
||||
"cpu-aarch64": f"pytorch/manylinuxaarch64-builder:cpu-aarch64-{DEFAULT_TAG}",
|
||||
@ -227,7 +221,6 @@ def translate_desired_cuda(gpu_arch_type: str, gpu_arch_version: str) -> str:
|
||||
"cuda": f"cu{gpu_arch_version.replace('.', '')}",
|
||||
"cuda-aarch64": "cu124",
|
||||
"rocm": f"rocm{gpu_arch_version}",
|
||||
"xpu": "xpu",
|
||||
}.get(gpu_arch_type, gpu_arch_version)
|
||||
|
||||
|
||||
@ -332,13 +325,13 @@ def generate_wheels_matrix(
|
||||
package_type = "manywheel"
|
||||
|
||||
if python_versions is None:
|
||||
python_versions = FULL_PYTHON_VERSIONS + ["3.13"]
|
||||
python_versions = FULL_PYTHON_VERSIONS
|
||||
|
||||
if arches is None:
|
||||
# Define default compute archivectures
|
||||
arches = ["cpu"]
|
||||
if os == "linux":
|
||||
arches += CPU_CXX11_ABI_ARCH + CUDA_ARCHES + ROCM_ARCHES + XPU_ARCHES
|
||||
arches += CPU_CXX11_ABI_ARCH + CUDA_ARCHES + ROCM_ARCHES
|
||||
elif os == "windows":
|
||||
arches += CUDA_ARCHES
|
||||
elif os == "linux-aarch64":
|
||||
@ -361,16 +354,9 @@ def generate_wheels_matrix(
|
||||
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.13 on rocm, xpu, aarch64, windows
|
||||
if (
|
||||
gpu_arch_type in ["rocm", "xpu"] or os != "linux"
|
||||
) and python_version == "3.13":
|
||||
continue
|
||||
|
||||
# 12.1 linux wheels require PYTORCH_EXTRA_INSTALL_REQUIREMENTS to install
|
||||
if (
|
||||
arch_version in ["12.4", "12.1", "11.8"]
|
||||
@ -400,49 +386,6 @@ def generate_wheels_matrix(
|
||||
),
|
||||
}
|
||||
)
|
||||
if arch_version != "cuda-aarch64":
|
||||
ret.append(
|
||||
{
|
||||
"python_version": python_version,
|
||||
"gpu_arch_type": gpu_arch_type,
|
||||
"gpu_arch_version": gpu_arch_version,
|
||||
"desired_cuda": translate_desired_cuda(
|
||||
gpu_arch_type, gpu_arch_version
|
||||
),
|
||||
"use_split_build": "True",
|
||||
"devtoolset": "",
|
||||
"container_image": WHEEL_CONTAINER_IMAGES[arch_version],
|
||||
"package_type": package_type,
|
||||
"pytorch_extra_install_requirements": (
|
||||
PYTORCH_EXTRA_INSTALL_REQUIREMENTS[arch_version] # fmt: skip
|
||||
if os != "linux-aarch64"
|
||||
else ""
|
||||
),
|
||||
"build_name": f"{package_type}-py{python_version}-{gpu_arch_type}{gpu_arch_version}-split".replace( # noqa: B950
|
||||
".", "_"
|
||||
),
|
||||
}
|
||||
)
|
||||
# Special build building to use on Colab. PyThon 3.10 for 12.1 CUDA
|
||||
if python_version == "3.10" and arch_version == "12.1":
|
||||
ret.append(
|
||||
{
|
||||
"python_version": python_version,
|
||||
"gpu_arch_type": gpu_arch_type,
|
||||
"gpu_arch_version": gpu_arch_version,
|
||||
"desired_cuda": translate_desired_cuda(
|
||||
gpu_arch_type, gpu_arch_version
|
||||
),
|
||||
"use_split_build": "False",
|
||||
"devtoolset": "",
|
||||
"container_image": WHEEL_CONTAINER_IMAGES[arch_version],
|
||||
"package_type": package_type,
|
||||
"pytorch_extra_install_requirements": "",
|
||||
"build_name": f"{package_type}-py{python_version}-{gpu_arch_type}{gpu_arch_version}-full".replace( # noqa: B950
|
||||
".", "_"
|
||||
),
|
||||
}
|
||||
)
|
||||
else:
|
||||
ret.append(
|
||||
{
|
||||
@ -453,9 +396,7 @@ def generate_wheels_matrix(
|
||||
gpu_arch_type, gpu_arch_version
|
||||
),
|
||||
"devtoolset": (
|
||||
"cxx11-abi"
|
||||
if arch_version in ["cpu-cxx11-abi", "xpu"]
|
||||
else ""
|
||||
"cxx11-abi" if arch_version == "cpu-cxx11-abi" else ""
|
||||
),
|
||||
"container_image": WHEEL_CONTAINER_IMAGES[arch_version],
|
||||
"package_type": package_type,
|
||||
|
||||
2
.github/scripts/generate_ci_workflows.py
vendored
2
.github/scripts/generate_ci_workflows.py
vendored
@ -8,8 +8,8 @@ from typing import Dict, Iterable, List, Literal, Set
|
||||
from typing_extensions import TypedDict # Python 3.11+
|
||||
|
||||
import generate_binary_build_matrix # type: ignore[import]
|
||||
import jinja2
|
||||
|
||||
import jinja2
|
||||
|
||||
Arch = Literal["windows", "linux", "macos"]
|
||||
|
||||
|
||||
@ -16,7 +16,6 @@ from typing import Dict, List
|
||||
|
||||
import generate_binary_build_matrix
|
||||
|
||||
|
||||
DOCKER_IMAGE_TYPES = ["runtime", "devel"]
|
||||
|
||||
|
||||
|
||||
2
.github/scripts/generate_pytorch_version.py
vendored
2
.github/scripts/generate_pytorch_version.py
vendored
@ -4,11 +4,11 @@ import argparse
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
from datetime import datetime
|
||||
from distutils.util import strtobool
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
LEADING_V_PATTERN = re.compile("^v")
|
||||
TRAILING_RC_PATTERN = re.compile("-rc[0-9]*$")
|
||||
LEGACY_BASE_VERSION_SUFFIX_PATTERN = re.compile("a0$")
|
||||
|
||||
1
.github/scripts/get_workflow_job_id.py
vendored
1
.github/scripts/get_workflow_job_id.py
vendored
@ -11,6 +11,7 @@ import sys
|
||||
import time
|
||||
import urllib
|
||||
import urllib.parse
|
||||
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple
|
||||
from urllib.request import Request, urlopen
|
||||
|
||||
|
||||
99
.github/scripts/get_workflow_type.py
vendored
Normal file
99
.github/scripts/get_workflow_type.py
vendored
Normal file
@ -0,0 +1,99 @@
|
||||
import json
|
||||
from argparse import ArgumentParser
|
||||
from typing import Any
|
||||
|
||||
from github import Auth, Github
|
||||
from github.Issue import Issue
|
||||
|
||||
|
||||
WORKFLOW_TYPE_LABEL = "label"
|
||||
WORKFLOW_TYPE_RG = "rg"
|
||||
WORKFLOW_TYPE_BOTH = "both"
|
||||
|
||||
|
||||
def parse_args() -> Any:
|
||||
parser = ArgumentParser("Get dynamic rollout settings")
|
||||
parser.add_argument("--github-token", type=str, required=True, help="GitHub token")
|
||||
parser.add_argument(
|
||||
"--github-repo",
|
||||
type=str,
|
||||
required=False,
|
||||
default="pytorch/test-infra",
|
||||
help="GitHub repo to get the issue",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-issue", type=int, required=True, help="GitHub issue umber"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-user", type=str, required=True, help="GitHub username"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-branch", type=str, required=True, help="Current GitHub branch"
|
||||
)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def get_gh_client(github_token: str) -> Github:
|
||||
auth = Auth.Token(github_token)
|
||||
return Github(auth=auth)
|
||||
|
||||
|
||||
def get_issue(gh: Github, repo: str, issue_num: int) -> Issue:
|
||||
repo = gh.get_repo(repo)
|
||||
return repo.get_issue(number=issue_num)
|
||||
|
||||
|
||||
def is_exception_branch(branch: str) -> bool:
|
||||
return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"}
|
||||
|
||||
|
||||
def get_workflow_type(issue: Issue, username: str) -> str:
|
||||
user_list = issue.get_comments()[0].body.split("\r\n")
|
||||
try:
|
||||
run_option = issue.get_comments()[1].body.split("\r\n")[0]
|
||||
except Exception as e:
|
||||
run_option = "single"
|
||||
|
||||
if user_list[0] == "!":
|
||||
# Use old runners for everyone
|
||||
return WORKFLOW_TYPE_LABEL
|
||||
elif user_list[1] == "*":
|
||||
if run_option == WORKFLOW_TYPE_BOTH:
|
||||
# Use ARC runners and old runners for everyone
|
||||
return WORKFLOW_TYPE_BOTH
|
||||
else:
|
||||
# Use only ARC runners for everyone
|
||||
return WORKFLOW_TYPE_RG
|
||||
elif username in user_list:
|
||||
if run_option == WORKFLOW_TYPE_BOTH:
|
||||
# Use ARC runners and old runners for a specific user
|
||||
return WORKFLOW_TYPE_BOTH
|
||||
else:
|
||||
# Use only ARC runners for a specific user
|
||||
return WORKFLOW_TYPE_RG
|
||||
else:
|
||||
# Use old runners by default
|
||||
return WORKFLOW_TYPE_LABEL
|
||||
|
||||
|
||||
def main() -> None:
|
||||
args = parse_args()
|
||||
|
||||
if is_exception_branch(args.github_branch):
|
||||
output = {"workflow_type": WORKFLOW_TYPE_LABEL}
|
||||
else:
|
||||
try:
|
||||
gh = get_gh_client(args.github_token)
|
||||
issue = get_issue(gh, args.github_repo, args.github_issue)
|
||||
|
||||
output = {"workflow_type": get_workflow_type(issue, args.github_user)}
|
||||
except Exception as e:
|
||||
output = {"workflow_type": WORKFLOW_TYPE_LABEL}
|
||||
|
||||
json_output = json.dumps(output)
|
||||
print(json_output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
10
.github/scripts/github_utils.py
vendored
10
.github/scripts/github_utils.py
vendored
@ -3,6 +3,7 @@
|
||||
import json
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Callable, cast, Dict, List, Optional, Tuple, Union
|
||||
from urllib.error import HTTPError
|
||||
@ -201,12 +202,3 @@ def gh_update_pr_state(org: str, repo: str, pr_num: int, state: str = "open") ->
|
||||
)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def gh_query_issues_by_labels(
|
||||
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}
|
||||
)
|
||||
|
||||
1
.github/scripts/gitutils.py
vendored
1
.github/scripts/gitutils.py
vendored
@ -19,7 +19,6 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
RE_GITHUB_URL_MATCH = re.compile("^https://.*@?github.com/(.+)/(.+)$")
|
||||
|
||||
BIN
.github/scripts/gql_mocks.json.gz
vendored
BIN
.github/scripts/gql_mocks.json.gz
vendored
Binary file not shown.
2
.github/scripts/label_utils.py
vendored
2
.github/scripts/label_utils.py
vendored
@ -1,12 +1,12 @@
|
||||
"""GitHub Label Utilities."""
|
||||
|
||||
import json
|
||||
|
||||
from functools import lru_cache
|
||||
from typing import Any, List, Tuple, TYPE_CHECKING, Union
|
||||
|
||||
from github_utils import gh_fetch_url_and_headers, GitHubComment
|
||||
|
||||
|
||||
# TODO: this is a temp workaround to avoid circular dependencies,
|
||||
# and should be removed once GitHubPR is refactored out of trymerge script.
|
||||
if TYPE_CHECKING:
|
||||
|
||||
1
.github/scripts/lintrunner.sh
vendored
1
.github/scripts/lintrunner.sh
vendored
@ -29,7 +29,6 @@ python3 -m tools.pyi.gen_pyi \
|
||||
--native-functions-path aten/src/ATen/native/native_functions.yaml \
|
||||
--tags-path aten/src/ATen/native/tags.yaml \
|
||||
--deprecated-functions-path "tools/autograd/deprecated.yaml"
|
||||
python3 torch/utils/data/datapipes/gen_pyi.py
|
||||
|
||||
RC=0
|
||||
# Run lintrunner on all files
|
||||
|
||||
1
.github/scripts/pytest_cache.py
vendored
1
.github/scripts/pytest_cache.py
vendored
@ -9,7 +9,6 @@ from pytest_caching_utils import (
|
||||
upload_pytest_cache,
|
||||
)
|
||||
|
||||
|
||||
TEMP_DIR = "./tmp" # a backup location in case one isn't provided
|
||||
|
||||
|
||||
|
||||
1
.github/scripts/pytest_caching_utils.py
vendored
1
.github/scripts/pytest_caching_utils.py
vendored
@ -14,7 +14,6 @@ from file_io_utils import (
|
||||
zip_folder,
|
||||
)
|
||||
|
||||
|
||||
PYTEST_CACHE_KEY_PREFIX = "pytest_cache"
|
||||
PYTEST_CACHE_DIR_NAME = ".pytest_cache"
|
||||
BUCKET = "gha-artifacts"
|
||||
|
||||
210
.github/scripts/runner_determinator.py
vendored
210
.github/scripts/runner_determinator.py
vendored
@ -1,210 +0,0 @@
|
||||
# flake8: noqa: G004
|
||||
|
||||
import logging
|
||||
import os
|
||||
from argparse import ArgumentParser
|
||||
from logging import LogRecord
|
||||
from typing import Any, Iterable
|
||||
|
||||
from github import Auth, Github
|
||||
from github.Issue import Issue
|
||||
|
||||
|
||||
WORKFLOW_LABEL_META = "" # use meta runners
|
||||
WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation
|
||||
|
||||
GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "")
|
||||
GH_OUTPUT_KEY_LABEL_TYPE = "label-type"
|
||||
|
||||
|
||||
class ColorFormatter(logging.Formatter):
|
||||
"""Color codes the log messages based on the log level"""
|
||||
|
||||
COLORS = {
|
||||
"WARNING": "\033[33m", # Yellow
|
||||
"ERROR": "\033[31m", # Red
|
||||
"CRITICAL": "\033[31m", # Red
|
||||
"INFO": "\033[0m", # Reset
|
||||
"DEBUG": "\033[0m", # Reset
|
||||
}
|
||||
|
||||
def format(self, record: LogRecord) -> str:
|
||||
log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset
|
||||
record.msg = f"{log_color}{record.msg}\033[0m"
|
||||
return super().format(record)
|
||||
|
||||
|
||||
handler = logging.StreamHandler()
|
||||
handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s"))
|
||||
|
||||
log = logging.getLogger(os.path.basename(__file__))
|
||||
log.addHandler(handler)
|
||||
log.setLevel(logging.INFO)
|
||||
|
||||
|
||||
def set_github_output(key: str, value: str) -> None:
|
||||
"""
|
||||
Defines outputs of the github action that invokes this script
|
||||
"""
|
||||
if not GITHUB_OUTPUT:
|
||||
# See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice
|
||||
log.warning(
|
||||
"No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method."
|
||||
)
|
||||
print(f"::set-output name={key}::{value}")
|
||||
return
|
||||
|
||||
with open(GITHUB_OUTPUT, "a") as f:
|
||||
log.info(f"Setting output: {key}='{value}'")
|
||||
f.write(f"{key}={value}\n")
|
||||
|
||||
|
||||
def parse_args() -> Any:
|
||||
parser = ArgumentParser("Get dynamic rollout settings")
|
||||
parser.add_argument("--github-token", type=str, required=True, help="GitHub token")
|
||||
parser.add_argument(
|
||||
"--github-issue-repo",
|
||||
type=str,
|
||||
required=False,
|
||||
default="pytorch/test-infra",
|
||||
help="GitHub repo to get the issue",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-repo",
|
||||
type=str,
|
||||
required=True,
|
||||
help="GitHub repo where CI is running",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-issue", type=int, required=True, help="GitHub issue number"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-actor", type=str, required=True, help="GitHub triggering_actor"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-issue-owner", type=str, required=True, help="GitHub issue owner"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-branch", type=str, required=True, help="Current GitHub branch or tag"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-ref-type",
|
||||
type=str,
|
||||
required=True,
|
||||
help="Current GitHub ref type, branch or tag",
|
||||
)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def get_gh_client(github_token: str) -> Github:
|
||||
auth = Auth.Token(github_token)
|
||||
return Github(auth=auth)
|
||||
|
||||
|
||||
def get_issue(gh: Github, repo: str, issue_num: int) -> Issue:
|
||||
repo = gh.get_repo(repo)
|
||||
return repo.get_issue(number=issue_num)
|
||||
|
||||
|
||||
def get_potential_pr_author(
|
||||
gh: Github, repo: str, username: str, ref_type: str, ref_name: str
|
||||
) -> str:
|
||||
# If the trigger was a new tag added by a bot, this is a ciflow case
|
||||
# Fetch the actual username from the original PR. The PR number is
|
||||
# embedded in the tag name: ciflow/<name>/<pr-number>
|
||||
if username == "pytorch-bot[bot]" and ref_type == "tag":
|
||||
split_tag = ref_name.split("/")
|
||||
if (
|
||||
len(split_tag) == 3
|
||||
and split_tag[0] == "ciflow"
|
||||
and split_tag[2].isnumeric()
|
||||
):
|
||||
pr_number = split_tag[2]
|
||||
try:
|
||||
repository = gh.get_repo(repo)
|
||||
pull = repository.get_pull(number=int(pr_number))
|
||||
except Exception as e:
|
||||
raise Exception( # noqa: TRY002
|
||||
f"issue with pull request {pr_number} from repo {repository}"
|
||||
) from e
|
||||
return pull.user.login
|
||||
# In all other cases, return the original input username
|
||||
return username
|
||||
|
||||
|
||||
def is_exception_branch(branch: str) -> bool:
|
||||
return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"}
|
||||
|
||||
|
||||
def get_workflow_type(issue: Issue, workflow_requestors: Iterable[str]) -> str:
|
||||
try:
|
||||
first_comment = issue.get_comments()[0].body.strip("\n\t ")
|
||||
|
||||
if first_comment[0] == "!":
|
||||
log.info("LF Workflows are disabled for everyone. Using meta runners.")
|
||||
return WORKFLOW_LABEL_META
|
||||
elif first_comment[0] == "*":
|
||||
log.info("LF Workflows are enabled for everyone. Using LF runners.")
|
||||
return WORKFLOW_LABEL_LF
|
||||
else:
|
||||
all_opted_in_users = {
|
||||
usr_raw.strip("\n\t@ ") for usr_raw in first_comment.split()
|
||||
}
|
||||
opted_in_requestors = {
|
||||
usr for usr in workflow_requestors if usr in all_opted_in_users
|
||||
}
|
||||
if opted_in_requestors:
|
||||
log.info(
|
||||
f"LF Workflows are enabled for {', '.join(opted_in_requestors)}. Using LF runners."
|
||||
)
|
||||
return WORKFLOW_LABEL_LF
|
||||
else:
|
||||
log.info(
|
||||
f"LF Workflows are disabled for {', '.join(workflow_requestors)}. Using meta runners."
|
||||
)
|
||||
return WORKFLOW_LABEL_META
|
||||
|
||||
except Exception as e:
|
||||
log.error(
|
||||
f"Failed to get determine workflow type. Falling back to meta runners. Exception: {e}"
|
||||
)
|
||||
return WORKFLOW_LABEL_META
|
||||
|
||||
|
||||
def main() -> None:
|
||||
args = parse_args()
|
||||
|
||||
if args.github_ref_type == "branch" and is_exception_branch(args.github_branch):
|
||||
log.info(f"Exception branch: '{args.github_branch}', using meta runners")
|
||||
label_type = WORKFLOW_LABEL_META
|
||||
else:
|
||||
try:
|
||||
gh = get_gh_client(args.github_token)
|
||||
# The default issue we use - https://github.com/pytorch/test-infra/issues/5132
|
||||
issue = get_issue(gh, args.github_issue_repo, args.github_issue)
|
||||
username = get_potential_pr_author(
|
||||
gh,
|
||||
args.github_repo,
|
||||
args.github_actor,
|
||||
args.github_ref_type,
|
||||
args.github_branch,
|
||||
)
|
||||
label_type = get_workflow_type(
|
||||
issue,
|
||||
(
|
||||
args.github_issue_owner,
|
||||
username,
|
||||
),
|
||||
)
|
||||
except Exception as e:
|
||||
log.error(
|
||||
f"Failed to get issue. Falling back to meta runners. Exception: {e}"
|
||||
)
|
||||
label_type = WORKFLOW_LABEL_META
|
||||
|
||||
set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, label_type)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
set -eoux pipefail
|
||||
|
||||
SYNC_BRANCH=pytorch-stable-prototype
|
||||
SYNC_BRANCH=fbcode/pytorch-stable-prototype
|
||||
|
||||
git config user.email "fake@example.com"
|
||||
git config user.name "PyTorch Stable Bot"
|
||||
@ -11,9 +11,7 @@ git fetch origin main
|
||||
git fetch origin "$SYNC_BRANCH"
|
||||
git checkout "$SYNC_BRANCH"
|
||||
|
||||
# Using a hardcoded SHA here is a massive speedup as we can skip the entire history of the pytorch GitHub repo.
|
||||
# This specific SHA was chosen as it was before the "branch point" of the stable branch
|
||||
for SHA in $(git log ba3b05fdf37ddbc3c301294d6a560a816335e717..origin/main --pretty="%h" --reverse -- torch/distributed torch/csrc/distributed test/distributed test/cpp/c10d benchmarks/distributed)
|
||||
for SHA in $(git log 4333e122d4b74cdf84351ed2907045c6a767b4cd..origin/main --pretty="%h" --reverse -- torch/distributed torch/csrc/distributed test/distributed test/cpp/c10d benchmarks/distributed)
|
||||
do
|
||||
# `git merge-base --is-ancestor` exits with code 0 if the given SHA is an ancestor, and non-0 otherwise
|
||||
if git merge-base --is-ancestor $SHA HEAD || [[ $(git log --grep="(cherry picked from commit $SHA") ]]
|
||||
@ -22,12 +20,7 @@ do
|
||||
continue
|
||||
fi
|
||||
echo "Copying $SHA"
|
||||
git cherry-pick -x "$SHA" -X theirs
|
||||
git reset --soft HEAD~1
|
||||
git add torch/distributed torch/csrc/distributed test/distributed test/cpp/c10d benchmarks/distributed
|
||||
git checkout .
|
||||
git commit --reuse-message=HEAD@{1}
|
||||
git clean -f
|
||||
git cherry-pick -x "$SHA"
|
||||
done
|
||||
|
||||
if [[ "${WITH_PUSH}" == true ]]; then
|
||||
|
||||
@ -41,7 +41,7 @@ def main() -> None:
|
||||
)
|
||||
|
||||
options = parser.parse_args()
|
||||
tagged_images: Dict[str, bool] = {}
|
||||
tagged_images: Dict[str, bool] = dict()
|
||||
platform_images = [
|
||||
generate_binary_build_matrix.WHEEL_CONTAINER_IMAGES,
|
||||
generate_binary_build_matrix.LIBTORCH_CONTAINER_IMAGES,
|
||||
|
||||
1
.github/scripts/td_llm_indexer.sh
vendored
1
.github/scripts/td_llm_indexer.sh
vendored
@ -7,7 +7,6 @@ cd llm-target-determinator
|
||||
pip install -q -r requirements.txt
|
||||
cd ../codellama
|
||||
pip install -e .
|
||||
pip install numpy==1.26.0
|
||||
|
||||
# Run indexer
|
||||
cd ../llm-target-determinator
|
||||
|
||||
27
.github/scripts/test_trymerge.py
vendored
27
.github/scripts/test_trymerge.py
vendored
@ -17,7 +17,9 @@ from unittest import main, mock, skip, TestCase
|
||||
from urllib.error import HTTPError
|
||||
|
||||
from github_utils import gh_graphql
|
||||
|
||||
from gitutils import get_git_remote_name, get_git_repo_dir, GitRepo
|
||||
|
||||
from trymerge import (
|
||||
categorize_checks,
|
||||
DRCI_CHECKRUN_NAME,
|
||||
@ -37,7 +39,6 @@ from trymerge import (
|
||||
validate_revert,
|
||||
)
|
||||
|
||||
|
||||
if "GIT_REMOTE_URL" not in os.environ:
|
||||
os.environ["GIT_REMOTE_URL"] = "https://github.com/pytorch/pytorch"
|
||||
|
||||
@ -179,9 +180,6 @@ def mock_gh_get_info() -> Any:
|
||||
return {
|
||||
"closed": False,
|
||||
"isCrossRepository": False,
|
||||
"headRefName": "foo",
|
||||
"baseRefName": "bar",
|
||||
"baseRepository": {"defaultBranchRef": {"name": "bar"}},
|
||||
"files": {"nodes": [], "pageInfo": {"hasNextPage": False}},
|
||||
"changedFiles": 0,
|
||||
}
|
||||
@ -396,7 +394,6 @@ class TestTryMerge(TestCase):
|
||||
# self.assertGreater(len(pr.get_checkrun_conclusions()), 3)
|
||||
self.assertGreater(pr.get_commit_count(), 60)
|
||||
|
||||
@skip("GitHub doesn't keep this data anymore")
|
||||
def test_gql_retrieve_checksuites(self, *args: Any) -> None:
|
||||
"Fetch comments and conclusions for PR with 60 commits"
|
||||
pr = GitHubPR("pytorch", "pytorch", 94787)
|
||||
@ -894,24 +891,6 @@ class TestBypassFailures(TestCase):
|
||||
self.assertTrue(len(ignorable["FLAKY"]) == 1)
|
||||
self.assertTrue(len(ignorable["BROKEN_TRUNK"]) == 0)
|
||||
|
||||
def test_ignore_failures_older_run_same_workflow(self, *args: Any) -> None:
|
||||
pr = GitHubPR("pytorch", "pytorch", 129013)
|
||||
checks = pr.get_checkrun_conclusions()
|
||||
checks = get_classifications(
|
||||
pr.pr_num,
|
||||
pr.project,
|
||||
checks,
|
||||
[],
|
||||
)
|
||||
pending, failed, ignorable = categorize_checks(
|
||||
checks,
|
||||
list(checks.keys()),
|
||||
)
|
||||
self.assertTrue(len(pending) == 0)
|
||||
self.assertTrue(len(failed) == 0)
|
||||
self.assertTrue(len(ignorable["FLAKY"]) == 2)
|
||||
self.assertTrue(len(ignorable["UNSTABLE"]) == 13)
|
||||
|
||||
@mock.patch("trymerge.read_merge_rules", side_effect=xla_merge_rules)
|
||||
def test_dont_ignore_flaky_failures(self, *args: Any) -> None:
|
||||
"""
|
||||
@ -1040,7 +1019,7 @@ class TestGitHubPRGhstackDependencies(TestCase):
|
||||
)
|
||||
|
||||
@skip(
|
||||
reason="This test is run against a mutable PR that has changed, so it no longer works. The test should be changed"
|
||||
reason="This test is run against a mutalbe PR that has changed, so it no longer works. The test should be changed"
|
||||
)
|
||||
@mock.patch("trymerge.read_merge_rules")
|
||||
@mock.patch("trymerge.GitRepo")
|
||||
|
||||
121
.github/scripts/trymerge.py
vendored
121
.github/scripts/trymerge.py
vendored
@ -45,6 +45,7 @@ from github_utils import (
|
||||
gh_update_pr_state,
|
||||
GitHubComment,
|
||||
)
|
||||
|
||||
from gitutils import (
|
||||
are_ghstack_branches_in_sync,
|
||||
get_git_remote_name,
|
||||
@ -61,7 +62,6 @@ from label_utils import (
|
||||
)
|
||||
from trymerge_explainer import get_revert_message, TryMergeExplainer
|
||||
|
||||
|
||||
# labels
|
||||
MERGE_IN_PROGRESS_LABEL = "merging"
|
||||
MERGE_COMPLETE_LABEL = "merged"
|
||||
@ -81,10 +81,9 @@ JobNameToStateDict = Dict[str, JobCheckState]
|
||||
|
||||
|
||||
class WorkflowCheckState:
|
||||
def __init__(self, name: str, url: str, run_id: int, status: Optional[str]):
|
||||
def __init__(self, name: str, url: str, status: Optional[str]):
|
||||
self.name: str = name
|
||||
self.url: str = url
|
||||
self.run_id: int = run_id
|
||||
self.status: Optional[str] = status
|
||||
self.jobs: JobNameToStateDict = {}
|
||||
|
||||
@ -123,7 +122,6 @@ fragment PRCheckSuites on CheckSuiteConnection {
|
||||
workflowRun {
|
||||
workflow {
|
||||
name
|
||||
databaseId
|
||||
}
|
||||
databaseId
|
||||
url
|
||||
@ -514,7 +512,7 @@ def add_workflow_conclusions(
|
||||
workflows: Dict[str, WorkflowCheckState] = {}
|
||||
|
||||
# for the jobs that don't have a workflow
|
||||
no_workflow_obj: WorkflowCheckState = WorkflowCheckState("", "", 0, None)
|
||||
no_workflow_obj: WorkflowCheckState = WorkflowCheckState("", "", None)
|
||||
|
||||
def add_conclusions(edges: Any) -> None:
|
||||
for edge_idx, edge in enumerate(edges):
|
||||
@ -525,30 +523,18 @@ def add_workflow_conclusions(
|
||||
workflow_obj: WorkflowCheckState = no_workflow_obj
|
||||
|
||||
if workflow_run is not None:
|
||||
# This is the usual workflow run ID we see on GitHub
|
||||
workflow_run_id = workflow_run["databaseId"]
|
||||
# While this is the metadata name and ID of the workflow itself
|
||||
workflow_name = workflow_run["workflow"]["name"]
|
||||
workflow_id = workflow_run["workflow"]["databaseId"]
|
||||
|
||||
workflow_conclusion = node["conclusion"]
|
||||
# Do not override existing status with cancelled
|
||||
if workflow_conclusion == "CANCELLED" and workflow_name in workflows:
|
||||
continue
|
||||
|
||||
# Only keep the latest workflow run for each workflow, heuristically,
|
||||
# it's the run with largest run ID
|
||||
if (
|
||||
workflow_id not in workflows
|
||||
or workflows[workflow_id].run_id < workflow_run_id
|
||||
):
|
||||
workflows[workflow_id] = WorkflowCheckState(
|
||||
if workflow_name not in workflows:
|
||||
workflows[workflow_name] = WorkflowCheckState(
|
||||
name=workflow_name,
|
||||
status=workflow_conclusion,
|
||||
url=workflow_run["url"],
|
||||
run_id=workflow_run_id,
|
||||
)
|
||||
workflow_obj = workflows[workflow_id]
|
||||
workflow_obj = workflows[workflow_name]
|
||||
|
||||
while checkruns is not None:
|
||||
for checkrun_node in checkruns["nodes"]:
|
||||
@ -586,12 +572,12 @@ def add_workflow_conclusions(
|
||||
# the jobs in but don't put the workflow in. We care more about the jobs in
|
||||
# the workflow that ran than the container workflow.
|
||||
res: JobNameToStateDict = {}
|
||||
for workflow in workflows.values():
|
||||
for workflow_name, workflow in workflows.items():
|
||||
if len(workflow.jobs) > 0:
|
||||
for job_name, job in workflow.jobs.items():
|
||||
res[job_name] = job
|
||||
else:
|
||||
res[workflow.name] = JobCheckState(
|
||||
res[workflow_name] = JobCheckState(
|
||||
workflow.name,
|
||||
workflow.url,
|
||||
workflow.status,
|
||||
@ -1177,6 +1163,7 @@ class GitHubPR:
|
||||
# Finally, upload the record to Rockset. The list of pending and failed
|
||||
# checks are at the time of the merge
|
||||
save_merge_record(
|
||||
collection=ROCKSET_MERGES_COLLECTION,
|
||||
comment_id=comment_id,
|
||||
pr_num=self.pr_num,
|
||||
owner=self.org,
|
||||
@ -1192,8 +1179,10 @@ class GitHubPR:
|
||||
merge_base_sha=self.get_merge_base(),
|
||||
merge_commit_sha=merge_commit_sha,
|
||||
is_failed=False,
|
||||
dry_run=dry_run,
|
||||
skip_mandatory_checks=skip_mandatory_checks,
|
||||
ignore_current=bool(ignore_current_checks),
|
||||
workspace=ROCKSET_MERGES_WORKSPACE,
|
||||
)
|
||||
else:
|
||||
print("Missing comment ID or PR number, couldn't upload to Rockset")
|
||||
@ -1500,6 +1489,7 @@ def checks_to_markdown_bullets(
|
||||
|
||||
@retries_decorator()
|
||||
def save_merge_record(
|
||||
collection: str,
|
||||
comment_id: int,
|
||||
pr_num: int,
|
||||
owner: str,
|
||||
@ -1515,44 +1505,59 @@ def save_merge_record(
|
||||
merge_base_sha: str,
|
||||
merge_commit_sha: str = "",
|
||||
is_failed: bool = False,
|
||||
dry_run: bool = False,
|
||||
skip_mandatory_checks: bool = False,
|
||||
ignore_current: bool = False,
|
||||
error: str = "",
|
||||
workspace: str = "commons",
|
||||
) -> None:
|
||||
"""
|
||||
This saves the merge records as a json, which can later be uploaded to s3
|
||||
This saves the merge records into Rockset, so we can query them (for fun and profit)
|
||||
"""
|
||||
if dry_run:
|
||||
# Decide not to save the record to Rockset if dry-run is set to not pollute
|
||||
# the collection
|
||||
return
|
||||
|
||||
# Prepare the record to be written into Rockset
|
||||
data = [
|
||||
{
|
||||
"comment_id": comment_id,
|
||||
"pr_num": pr_num,
|
||||
"owner": owner,
|
||||
"project": project,
|
||||
"author": author,
|
||||
"pending_checks": pending_checks,
|
||||
"failed_checks": failed_checks,
|
||||
"ignore_current_checks": ignore_current_checks,
|
||||
"broken_trunk_checks": broken_trunk_checks,
|
||||
"flaky_checks": flaky_checks,
|
||||
"unstable_checks": unstable_checks,
|
||||
"last_commit_sha": last_commit_sha,
|
||||
"merge_base_sha": merge_base_sha,
|
||||
"merge_commit_sha": merge_commit_sha,
|
||||
"is_failed": is_failed,
|
||||
"skip_mandatory_checks": skip_mandatory_checks,
|
||||
"ignore_current": ignore_current,
|
||||
"error": error,
|
||||
# This is a unique identifier for the record for deduping purposes
|
||||
# in rockset. Any unique string would work
|
||||
"_id": f"{project}-{pr_num}-{comment_id}-{os.environ.get('GITHUB_RUN_ID')}",
|
||||
}
|
||||
]
|
||||
repo_root = Path(__file__).resolve().parent.parent.parent
|
||||
try:
|
||||
import rockset # type: ignore[import]
|
||||
|
||||
with open(repo_root / "merge_record.json", "w") as f:
|
||||
json.dump(data, f)
|
||||
# Prepare the record to be written into Rockset
|
||||
data = [
|
||||
{
|
||||
"comment_id": comment_id,
|
||||
"pr_num": pr_num,
|
||||
"owner": owner,
|
||||
"project": project,
|
||||
"author": author,
|
||||
"pending_checks": pending_checks,
|
||||
"failed_checks": failed_checks,
|
||||
"ignore_current_checks": ignore_current_checks,
|
||||
"broken_trunk_checks": broken_trunk_checks,
|
||||
"flaky_checks": flaky_checks,
|
||||
"unstable_checks": unstable_checks,
|
||||
"last_commit_sha": last_commit_sha,
|
||||
"merge_base_sha": merge_base_sha,
|
||||
"merge_commit_sha": merge_commit_sha,
|
||||
"is_failed": is_failed,
|
||||
"skip_mandatory_checks": skip_mandatory_checks,
|
||||
"ignore_current": ignore_current,
|
||||
"error": error,
|
||||
}
|
||||
]
|
||||
|
||||
client = rockset.RocksetClient(
|
||||
host="api.usw2a1.rockset.com", api_key=os.environ["ROCKSET_API_KEY"]
|
||||
)
|
||||
client.Documents.add_documents(
|
||||
collection=collection,
|
||||
data=data,
|
||||
workspace=workspace,
|
||||
)
|
||||
|
||||
except ModuleNotFoundError:
|
||||
print("Rockset is missing, no record will be saved")
|
||||
return
|
||||
|
||||
|
||||
@retries_decorator(rc=[])
|
||||
@ -2325,15 +2330,6 @@ def main() -> None:
|
||||
dry_run=args.dry_run,
|
||||
)
|
||||
return
|
||||
if not pr.is_ghstack_pr() and pr.base_ref() != pr.default_branch():
|
||||
gh_post_pr_comment(
|
||||
org,
|
||||
project,
|
||||
args.pr_num,
|
||||
f"PR targets {pr.base_ref()} rather than {pr.default_branch()}, refusing merge request",
|
||||
dry_run=args.dry_run,
|
||||
)
|
||||
return
|
||||
|
||||
if args.check_mergeability:
|
||||
if pr.is_ghstack_pr():
|
||||
@ -2369,6 +2365,7 @@ def main() -> None:
|
||||
# list of pending and failed checks here, but they are not really
|
||||
# needed at the moment
|
||||
save_merge_record(
|
||||
collection=ROCKSET_MERGES_COLLECTION,
|
||||
comment_id=args.comment_id,
|
||||
pr_num=args.pr_num,
|
||||
owner=org,
|
||||
@ -2383,9 +2380,11 @@ def main() -> None:
|
||||
last_commit_sha=pr.last_commit().get("oid", ""),
|
||||
merge_base_sha=pr.get_merge_base(),
|
||||
is_failed=True,
|
||||
dry_run=args.dry_run,
|
||||
skip_mandatory_checks=args.force,
|
||||
ignore_current=args.ignore_current,
|
||||
error=str(e),
|
||||
workspace=ROCKSET_MERGES_WORKSPACE,
|
||||
)
|
||||
else:
|
||||
print("Missing comment ID or PR number, couldn't upload to Rockset")
|
||||
|
||||
1
.github/scripts/tryrebase.py
vendored
1
.github/scripts/tryrebase.py
vendored
@ -11,7 +11,6 @@ from github_utils import gh_post_pr_comment as gh_post_comment
|
||||
from gitutils import get_git_remote_name, get_git_repo_dir, GitRepo
|
||||
from trymerge import GitHubPR
|
||||
|
||||
|
||||
SAME_SHA_ERROR = (
|
||||
"\n```\nAborting rebase because rebasing the branch resulted in the same sha as the target branch.\n"
|
||||
+ "This usually happens because the PR has already been merged. Please rebase locally and push.\n```"
|
||||
|
||||
2
.github/templates/common.yml.j2
vendored
2
.github/templates/common.yml.j2
vendored
@ -8,7 +8,7 @@
|
||||
# NOTE: If testing pytorch/builder changes you can change this variable to change what pytorch/builder reference
|
||||
# the binary builds will check out
|
||||
{%- set builder_repo = "pytorch/builder" -%}
|
||||
{%- set builder_branch = "main" -%}
|
||||
{%- set builder_branch = "release/2.4" -%}
|
||||
|
||||
{%- macro concurrency(build_environment) -%}
|
||||
concurrency:
|
||||
|
||||
@ -81,7 +81,7 @@ jobs:
|
||||
!{{ config["build_name"] }}-test: # Testing
|
||||
if: ${{ github.repository_owner == 'pytorch' }}
|
||||
needs: !{{ config["build_name"] }}-build
|
||||
{%- if config["gpu_arch_type"] not in ["rocm", "xpu"] %}
|
||||
{%- if config["gpu_arch_type"] != "rocm" %}
|
||||
uses: ./.github/workflows/_binary-test-linux.yml
|
||||
with:!{{ upload.binary_env_as_input(config) }}
|
||||
build_name: !{{ config["build_name"] }}
|
||||
@ -101,40 +101,6 @@ jobs:
|
||||
{%- endif %}
|
||||
secrets:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
{%- elif config["gpu_arch_type"] == "xpu" %}
|
||||
runs-on: linux.idc.xpu
|
||||
timeout-minutes: !{{ common.timeout_minutes }}
|
||||
!{{ upload.binary_env(config) }}
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Setup XPU
|
||||
uses: ./.github/actions/setup-xpu
|
||||
- name: configure aws credentials
|
||||
id: aws_creds
|
||||
uses: aws-actions/configure-aws-credentials@v1.7.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_s3_and_ecr_read_only
|
||||
aws-region: us-east-1
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v2
|
||||
- uses: !{{ common.download_artifact_action }}
|
||||
name: Download Build Artifacts
|
||||
with:
|
||||
name: !{{ config["build_name"] }}
|
||||
path: "${{ runner.temp }}/artifacts/"
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch") }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch) }}
|
||||
- name: Pull Docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
with:
|
||||
docker-image: !{{ config["container_image"] }}
|
||||
- name: Test Pytorch binary
|
||||
uses: ./pytorch/.github/actions/test-pytorch-binary
|
||||
- name: Teardown XPU
|
||||
uses: ./.github/actions/teardown-xpu
|
||||
{%- else %}
|
||||
runs-on: linux.rocm.gpu
|
||||
timeout-minutes: !{{ common.timeout_minutes }}
|
||||
@ -147,8 +113,8 @@ jobs:
|
||||
with:
|
||||
name: !{{ config["build_name"] }}
|
||||
path: "${{ runner.temp }}/artifacts/"
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch") }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch) }}
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch", checkout_pr_head=False) }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch, checkout_pr_head=False) }}
|
||||
- name: ROCm set GPU_FLAG
|
||||
run: |
|
||||
echo "GPU_FLAG=--device=/dev/mem --device=/dev/kfd --device=/dev/dri --group-add video --group-add daemon" >> "${GITHUB_ENV}"
|
||||
|
||||
@ -81,8 +81,8 @@ jobs:
|
||||
elif [ -d "/Applications/Xcode_13.3.1.app" ]; then
|
||||
echo "DEVELOPER_DIR=/Applications/Xcode_13.3.1.app/Contents/Developer" >> "${GITHUB_ENV}"
|
||||
fi
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch") }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch) }}
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch", checkout_pr_head=False) }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch, checkout_pr_head=False) }}
|
||||
- name: Install sccache (only for non-forked PRs, and pushes to trunk)
|
||||
uses: nick-fields/retry@v2.8.2
|
||||
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
|
||||
|
||||
4
.github/templates/upload.yml.j2
vendored
4
.github/templates/upload.yml.j2
vendored
@ -30,9 +30,6 @@
|
||||
{%- if config["devtoolset"] %}
|
||||
DESIRED_DEVTOOLSET: !{{ config["devtoolset"] }}
|
||||
{%- endif %}
|
||||
{%- if config.use_split_build is defined %}
|
||||
use_split_build: !{{ config["use_split_build"] }}
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
{%- if config["package_type"] == "libtorch" %}
|
||||
{%- if config["libtorch_config"] %}
|
||||
@ -47,7 +44,6 @@
|
||||
# without this value pip does not get installed for some reason
|
||||
DESIRED_PYTHON: "3.8"
|
||||
{%- endif %}
|
||||
|
||||
{%- else %}
|
||||
DESIRED_PYTHON: "!{{ config["python_version"] }}"
|
||||
{%- endif %}
|
||||
|
||||
@ -65,8 +65,8 @@ jobs:
|
||||
steps:
|
||||
!{{ common.setup_ec2_windows() }}
|
||||
!{{ set_runner_specific_vars() }}
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch") }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch) }}
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch", checkout_pr_head=False) }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch, checkout_pr_head=False) }}
|
||||
- name: Populate binary env
|
||||
shell: bash
|
||||
run: |
|
||||
@ -105,8 +105,8 @@ jobs:
|
||||
with:
|
||||
name: !{{ config["build_name"] }}
|
||||
path: "${{ env.PYTORCH_FINAL_PACKAGE_DIR }}"
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch") }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch) }}
|
||||
!{{ common.checkout(deep_clone=False, directory="pytorch", checkout_pr_head=False) }}
|
||||
!{{ common.checkout(deep_clone=False, directory="builder", repository=common.builder_repo, branch=common.builder_branch, checkout_pr_head=False) }}
|
||||
- name: Populate binary env
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
12
.github/workflows/_android-build-test.yml
vendored
12
.github/workflows/_android-build-test.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
keep-going: ${{ steps.filter.outputs.keep-going }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
@ -59,25 +59,25 @@ jobs:
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Setup Linux
|
||||
uses: ./.github/actions/setup-linux
|
||||
|
||||
- name: Calculate docker image
|
||||
id: calculate-docker-image
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@release/2.4
|
||||
with:
|
||||
docker-image-name: ${{ inputs.docker-image-name }}
|
||||
|
||||
- name: Pull docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
|
||||
@ -141,5 +141,5 @@ jobs:
|
||||
if: always()
|
||||
|
||||
- name: Teardown Linux
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@release/2.4
|
||||
if: always()
|
||||
|
||||
12
.github/workflows/_android-full-build-test.yml
vendored
12
.github/workflows/_android-full-build-test.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
keep-going: ${{ steps.filter.outputs.keep-going }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
@ -59,25 +59,25 @@ jobs:
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Setup Linux
|
||||
uses: ./.github/actions/setup-linux
|
||||
|
||||
- name: Calculate docker image
|
||||
id: calculate-docker-image
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@release/2.4
|
||||
with:
|
||||
docker-image-name: ${{ inputs.docker-image-name }}
|
||||
|
||||
- name: Pull docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
|
||||
@ -186,5 +186,5 @@ jobs:
|
||||
if: always()
|
||||
|
||||
- name: Teardown Linux
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@release/2.4
|
||||
if: always()
|
||||
|
||||
21
.github/workflows/_bazel-build-test.yml
vendored
21
.github/workflows/_bazel-build-test.yml
vendored
@ -27,11 +27,6 @@ on:
|
||||
type: string
|
||||
description: |
|
||||
A JSON description of what configs to run later on.
|
||||
runner:
|
||||
required: false
|
||||
type: string
|
||||
default: "linux.large"
|
||||
description: Runner type
|
||||
|
||||
env:
|
||||
GIT_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
@ -39,7 +34,7 @@ env:
|
||||
jobs:
|
||||
filter:
|
||||
if: github.repository_owner == 'pytorch'
|
||||
runs-on: ${{ inputs.runner }}
|
||||
runs-on: [self-hosted, linux.large]
|
||||
outputs:
|
||||
test-matrix: ${{ steps.filter.outputs.test-matrix }}
|
||||
is-test-matrix-empty: ${{ steps.filter.outputs.is-test-matrix-empty }}
|
||||
@ -47,7 +42,7 @@ jobs:
|
||||
reenabled-issues: ${{ steps.filter.outputs.reenabled-issues }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
@ -69,25 +64,25 @@ jobs:
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Setup Linux
|
||||
uses: ./.github/actions/setup-linux
|
||||
|
||||
- name: Calculate docker image
|
||||
id: calculate-docker-image
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@release/2.4
|
||||
with:
|
||||
docker-image-name: ${{ inputs.docker-image-name }}
|
||||
|
||||
- name: Pull docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
|
||||
@ -97,7 +92,7 @@ jobs:
|
||||
run: echo "IN_ARC_RUNNER=$([ -f /.inarc ] && echo true || echo false)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Install nvidia driver, nvidia-docker runtime, set GPU_FLAG
|
||||
uses: pytorch/test-infra/.github/actions/setup-nvidia@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-nvidia@release/2.4
|
||||
if: ${{ inputs.cuda-version != 'cpu' && steps.check_arc_runner.outputs.IN_ARC_RUNNER == 'false' }}
|
||||
|
||||
- name: Output disk space left
|
||||
@ -206,5 +201,5 @@ jobs:
|
||||
file-suffix: bazel-${{ github.job }}_${{ steps.get-job-id.outputs.job-id }}
|
||||
|
||||
- name: Teardown Linux
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@release/2.4
|
||||
if: always()
|
||||
|
||||
21
.github/workflows/_binary-build-linux.yml
vendored
21
.github/workflows/_binary-build-linux.yml
vendored
@ -21,13 +21,6 @@ on:
|
||||
default: 210
|
||||
type: number
|
||||
description: timeout for the job
|
||||
use_split_build:
|
||||
description: |
|
||||
[Experimental] Build a libtorch only wheel and build pytorch such that
|
||||
are built from the libtorch wheel.
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
ALPINE_IMAGE:
|
||||
required: false
|
||||
type: string
|
||||
@ -117,7 +110,6 @@ jobs:
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
PYTORCH_FINAL_PACKAGE_DIR: /artifacts
|
||||
SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
USE_SPLIT_BUILD: ${{ inputs.use_split_build }}
|
||||
steps:
|
||||
- name: Make the env permanent during this workflow (but not the secrets)
|
||||
shell: bash
|
||||
@ -145,7 +137,6 @@ jobs:
|
||||
echo "PR_NUMBER=${{ env.PR_NUMBER }}"
|
||||
echo "PYTORCH_FINAL_PACKAGE_DIR=${{ env.PYTORCH_FINAL_PACKAGE_DIR }}"
|
||||
echo "SHA1=${{ env.SHA1 }}"
|
||||
echo "USE_SPLIT_BUILD=${{ env.use_split_build }}"
|
||||
} >> "${GITHUB_ENV} }}"
|
||||
|
||||
- name: List the env
|
||||
@ -154,13 +145,13 @@ jobs:
|
||||
|
||||
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
|
||||
if: inputs.build_environment != 'linux-s390x-binary-manywheel'
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
continue-on-error: true
|
||||
with:
|
||||
github-secret: ${{ secrets.github-token }}
|
||||
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
no-sudo: ${{ inputs.build_environment == 'linux-aarch64-binary-manywheel' || inputs.build_environment == 'linux-s390x-binary-manywheel' }}
|
||||
|
||||
@ -190,7 +181,6 @@ jobs:
|
||||
- name: Checkout PyTorch to pytorch dir
|
||||
uses: malfet/checkout@silent-checkout
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
submodules: recursive
|
||||
path: pytorch
|
||||
quiet-checkout: true
|
||||
@ -204,7 +194,7 @@ jobs:
|
||||
- name: Checkout pytorch/builder to builder dir
|
||||
uses: malfet/checkout@silent-checkout
|
||||
with:
|
||||
ref: main
|
||||
ref: release/2.4
|
||||
submodules: recursive
|
||||
repository: pytorch/builder
|
||||
path: builder
|
||||
@ -230,7 +220,7 @@ jobs:
|
||||
|
||||
- name: Pull Docker image
|
||||
if: ${{ steps.filter.outputs.is-test-matrix-empty == 'False' && inputs.build_environment != 'linux-s390x-binary-manywheel' }}
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ inputs.DOCKER_IMAGE }}
|
||||
|
||||
@ -255,7 +245,6 @@ jobs:
|
||||
-e PYTORCH_ROOT \
|
||||
-e SKIP_ALL_TESTS \
|
||||
-e PYTORCH_EXTRA_INSTALL_REQUIREMENTS \
|
||||
-e USE_SPLIT_BUILD \
|
||||
--tty \
|
||||
--detach \
|
||||
-v "${GITHUB_WORKSPACE}/pytorch:/pytorch" \
|
||||
@ -288,7 +277,7 @@ jobs:
|
||||
|
||||
- name: Teardown Linux
|
||||
if: always() && inputs.build_environment != 'linux-s390x-binary-manywheel'
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@release/2.4
|
||||
|
||||
- name: Chown workspace
|
||||
if: always() && inputs.build_environment != 'linux-s390x-binary-manywheel'
|
||||
|
||||
22
.github/workflows/_binary-test-linux.yml
vendored
22
.github/workflows/_binary-test-linux.yml
vendored
@ -63,13 +63,6 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
description: Hardware to run this job on. Valid values are linux.4xlarge, linux.4xlarge.nvidia.gpu, linux.arm64.2xlarge, and linux.rocm.gpu
|
||||
use_split_build:
|
||||
description: |
|
||||
[Experimental] Build a libtorch only wheel and build pytorch such that
|
||||
are built from the libtorch wheel.
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
secrets:
|
||||
github-token:
|
||||
required: true
|
||||
@ -104,7 +97,6 @@ jobs:
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
PYTORCH_FINAL_PACKAGE_DIR: /artifacts
|
||||
SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
USE_SPLIT_BUILD: ${{ inputs.use_split_build }}
|
||||
steps:
|
||||
- name: Make the env permanent during this workflow (but not the secrets)
|
||||
shell: bash
|
||||
@ -132,19 +124,18 @@ jobs:
|
||||
echo "PR_NUMBER=${{ env.PR_NUMBER }}"
|
||||
echo "PYTORCH_FINAL_PACKAGE_DIR=${{ env.PYTORCH_FINAL_PACKAGE_DIR }}"
|
||||
echo "SHA1=${{ env.SHA1 }}"
|
||||
echo "USE_SPLIT_BUILD=${{ env.USE_SPLIT_BUILD }}"
|
||||
} >> "${GITHUB_ENV} }}"
|
||||
|
||||
- name: "[FB EMPLOYEES] Enable SSH (Click me for login details)"
|
||||
if: inputs.build_environment != 'linux-s390x-binary-manywheel'
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
continue-on-error: true
|
||||
with:
|
||||
github-secret: ${{ secrets.github-token }}
|
||||
|
||||
# Setup the environment
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
no-sudo: ${{ inputs.build_environment == 'linux-aarch64-binary-manywheel' || inputs.build_environment == 'linux-s390x-binary-manywheel' }}
|
||||
|
||||
@ -167,7 +158,6 @@ jobs:
|
||||
- name: Checkout PyTorch to pytorch dir
|
||||
uses: malfet/checkout@silent-checkout
|
||||
with:
|
||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
|
||||
submodules: recursive
|
||||
path: pytorch
|
||||
|
||||
@ -180,7 +170,7 @@ jobs:
|
||||
- name: Checkout pytorch/builder to builder dir
|
||||
uses: malfet/checkout@silent-checkout
|
||||
with:
|
||||
ref: main
|
||||
ref: release/2.4
|
||||
submodules: recursive
|
||||
repository: pytorch/builder
|
||||
path: builder
|
||||
@ -211,12 +201,12 @@ jobs:
|
||||
path: "${{ runner.temp }}/artifacts/"
|
||||
|
||||
- name: Install nvidia driver, nvidia-docker runtime, set GPU_FLAG
|
||||
uses: pytorch/test-infra/.github/actions/setup-nvidia@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-nvidia@release/2.4
|
||||
if: ${{ inputs.GPU_ARCH_TYPE == 'cuda' && steps.filter.outputs.is-test-matrix-empty == 'False' }}
|
||||
|
||||
- name: Pull Docker image
|
||||
if: ${{ steps.filter.outputs.is-test-matrix-empty == 'False' && inputs.build_environment != 'linux-s390x-binary-manywheel' }}
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ inputs.DOCKER_IMAGE }}
|
||||
|
||||
@ -226,7 +216,7 @@ jobs:
|
||||
|
||||
- name: Teardown Linux
|
||||
if: always() && inputs.build_environment != 'linux-s390x-binary-manywheel'
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@release/2.4
|
||||
|
||||
- name: Chown workspace
|
||||
if: always() && inputs.build_environment != 'linux-s390x-binary-manywheel'
|
||||
|
||||
10
.github/workflows/_binary-upload.yml
vendored
10
.github/workflows/_binary-upload.yml
vendored
@ -55,13 +55,6 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
description: Desired python version
|
||||
use_split_build:
|
||||
description: |
|
||||
[Experimental] Build a libtorch only wheel and build pytorch such that
|
||||
are built from the libtorch wheel.
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
secrets:
|
||||
github-token:
|
||||
required: true
|
||||
@ -100,10 +93,9 @@ jobs:
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
PYTORCH_FINAL_PACKAGE_DIR: /artifacts
|
||||
SHA1: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
USE_SPLIT_BUILD: ${{ inputs.use_split_build }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
no-sudo: true
|
||||
|
||||
|
||||
6
.github/workflows/_buck-build-test.yml
vendored
6
.github/workflows/_buck-build-test.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
keep-going: ${{ steps.filter.outputs.keep-going }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
@ -44,7 +44,7 @@ jobs:
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
@ -53,7 +53,7 @@ jobs:
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Setup miniconda
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@release/2.4
|
||||
with:
|
||||
python-version: 3.8
|
||||
environment-file: .github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }}
|
||||
|
||||
10
.github/workflows/_docs.yml
vendored
10
.github/workflows/_docs.yml
vendored
@ -80,7 +80,7 @@ jobs:
|
||||
name: build-docs-${{ matrix.docs_type }}-${{ inputs.push }}
|
||||
steps:
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
instructions: |
|
||||
@ -91,7 +91,7 @@ jobs:
|
||||
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Setup Linux
|
||||
uses: ./.github/actions/setup-linux
|
||||
@ -106,12 +106,12 @@ jobs:
|
||||
|
||||
- name: Calculate docker image
|
||||
id: calculate-docker-image
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@release/2.4
|
||||
with:
|
||||
docker-image-name: ${{ inputs.docker-image }}
|
||||
|
||||
- name: Pull docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
|
||||
@ -218,5 +218,5 @@ jobs:
|
||||
s3-prefix: pytorch/pytorch/${{ github.event.pull_request.number }}/functorchdocs
|
||||
|
||||
- name: Teardown Linux
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@release/2.4
|
||||
if: always()
|
||||
|
||||
6
.github/workflows/_ios-build-test.yml
vendored
6
.github/workflows/_ios-build-test.yml
vendored
@ -46,7 +46,7 @@ jobs:
|
||||
keep-going: ${{ steps.filter.outputs.keep-going }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
@ -80,7 +80,7 @@ jobs:
|
||||
steps:
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Populate CI build options
|
||||
shell: bash
|
||||
@ -102,7 +102,7 @@ jobs:
|
||||
brew install libtool
|
||||
|
||||
- name: Setup miniconda for iOS
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@release/2.4
|
||||
with:
|
||||
python-version: "3.9"
|
||||
environment-file: .github/requirements/conda-env-iOS.txt
|
||||
|
||||
12
.github/workflows/_linux-build-label.yml
vendored
12
.github/workflows/_linux-build-label.yml
vendored
@ -56,13 +56,6 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
use_split_build:
|
||||
description: |
|
||||
[Experimental] Build a libtorch only wheel and build pytorch such that
|
||||
are built from the libtorch wheel.
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
secrets:
|
||||
HUGGING_FACE_HUB_TOKEN:
|
||||
required: false
|
||||
@ -88,7 +81,7 @@ jobs:
|
||||
test-matrix: ${{ steps.linux-build.outputs.test-matrix }}
|
||||
steps:
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@ -97,7 +90,7 @@ jobs:
|
||||
# checkout because when we run this action we don't *have* a local
|
||||
# checkout. In other cases you should prefer a local checkout.
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Linux Build
|
||||
id: linux-build
|
||||
@ -114,4 +107,3 @@ jobs:
|
||||
aws-role-to-assume: ${{ inputs.aws-role-to-assume }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
|
||||
use_split_build: ${{ inputs.use_split_build }}
|
||||
|
||||
105
.github/workflows/_linux-build-rg.yml
vendored
Normal file
105
.github/workflows/_linux-build-rg.yml
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
name: linux-build-rg
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build-environment:
|
||||
required: true
|
||||
type: string
|
||||
description: Top-level label for what's being built/tested.
|
||||
docker-image-name:
|
||||
required: true
|
||||
type: string
|
||||
description: Name of the base docker image to build with.
|
||||
build-generates-artifacts:
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
description: If set, upload generated build artifacts.
|
||||
build-with-debug:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
description: If set, build in debug mode.
|
||||
sync-tag:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
description: |
|
||||
If this is set, our linter will use this to make sure that every other
|
||||
job with the same `sync-tag` is identical.
|
||||
cuda-arch-list:
|
||||
required: false
|
||||
type: string
|
||||
default: "5.2"
|
||||
description: |
|
||||
List of CUDA architectures CI build should target.
|
||||
runner-group:
|
||||
required: false
|
||||
type: string
|
||||
default: "arc-lf-linux.2xlarge"
|
||||
description: Runner group to select group type
|
||||
test-matrix:
|
||||
required: false
|
||||
type: string
|
||||
description: |
|
||||
An option JSON description of what test configs to run later on. This
|
||||
is moved here from the Linux test workflow so that we can apply filter
|
||||
logic using test-config labels earlier and skip unnecessary builds
|
||||
s3-bucket:
|
||||
description: S3 bucket to download artifact
|
||||
required: false
|
||||
type: string
|
||||
default: "gha-artifacts"
|
||||
aws-role-to-assume:
|
||||
description: role to assume for downloading artifacts
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
secrets:
|
||||
HUGGING_FACE_HUB_TOKEN:
|
||||
required: false
|
||||
description: |
|
||||
HF Auth token to avoid rate limits when downloading models or datasets from hub
|
||||
|
||||
outputs:
|
||||
docker-image:
|
||||
value: ${{ jobs.build.outputs.docker-image }}
|
||||
description: The docker image containing the built PyTorch.
|
||||
test-matrix:
|
||||
value: ${{ jobs.build.outputs.test-matrix }}
|
||||
description: An optional JSON description of what test configs to run later on.
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# Don't run on forked repos
|
||||
if: github.repository_owner == 'pytorch'
|
||||
runs-on:
|
||||
group: ${{ inputs.runner-group }}
|
||||
timeout-minutes: 240
|
||||
outputs:
|
||||
docker-image: ${{ steps.linux-build.outputs.docker-image }}
|
||||
test-matrix: ${{ steps.linux-build.outputs.test-matrix }}
|
||||
steps:
|
||||
# [pytorch repo ref]
|
||||
# Use a pytorch/pytorch reference instead of a reference to the local
|
||||
# checkout because when we run this action we don't *have* a local
|
||||
# checkout. In other cases you should prefer a local checkout.
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Linux Build
|
||||
id: linux-build
|
||||
uses: ./.github/actions/linux-build
|
||||
with:
|
||||
build-environment: ${{ inputs.build-environment }}
|
||||
docker-image-name: ${{ inputs.docker-image-name }}
|
||||
build-generates-artifacts: ${{ inputs.build-generates-artifacts }}
|
||||
build-with-debug: ${{ inputs.build-with-debug }}
|
||||
sync-tag: ${{ inputs.sync-tag }}
|
||||
cuda-arch-list: ${{ inputs.cuda-arch-list }}
|
||||
test-matrix: ${{ inputs.test-matrix }}
|
||||
s3-bucket: ${{ inputs.s3-bucket }}
|
||||
aws-role-to-assume: ${{ inputs.aws-role-to-assume }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
|
||||
34
.github/workflows/_linux-build.yml
vendored
34
.github/workflows/_linux-build.yml
vendored
@ -39,7 +39,7 @@ on:
|
||||
type: string
|
||||
default: "linux.2xlarge"
|
||||
description: |
|
||||
Label of the runner this job should run on.
|
||||
List of CUDA architectures CI build should target.
|
||||
test-matrix:
|
||||
required: false
|
||||
type: string
|
||||
@ -64,14 +64,6 @@ on:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
use_split_build:
|
||||
description: |
|
||||
[Experimental] Build a libtorch only wheel and build pytorch such that
|
||||
are built from the libtorch wheel.
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
secrets:
|
||||
HUGGING_FACE_HUB_TOKEN:
|
||||
required: false
|
||||
@ -98,7 +90,7 @@ jobs:
|
||||
test-matrix: ${{ steps.filter.outputs.test-matrix }}
|
||||
steps:
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@ -107,7 +99,7 @@ jobs:
|
||||
# checkout because when we run this action we don't *have* a local
|
||||
# checkout. In other cases you should prefer a local checkout.
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Setup Linux
|
||||
uses: ./.github/actions/setup-linux
|
||||
@ -122,7 +114,7 @@ jobs:
|
||||
|
||||
- name: Calculate docker image
|
||||
id: calculate-docker-image
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@release/2.4
|
||||
with:
|
||||
docker-image-name: ${{ inputs.docker-image-name }}
|
||||
|
||||
@ -136,7 +128,7 @@ jobs:
|
||||
echo "docker pull ghcr.io/pytorch/ci-image:${tag/:/-}"
|
||||
|
||||
- name: Pull docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
|
||||
@ -189,7 +181,6 @@ jobs:
|
||||
DEBUG: ${{ inputs.build-with-debug && '1' || '0' }}
|
||||
OUR_GITHUB_JOB_ID: ${{ steps.get-job-id.outputs.job-id }}
|
||||
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
|
||||
USE_SPLIT_BUILD: ${{ inputs.use_split_build }}
|
||||
run: |
|
||||
# detached container should get cleaned up by teardown_ec2_linux
|
||||
container_name=$(docker run \
|
||||
@ -208,7 +199,6 @@ jobs:
|
||||
-e PR_LABELS \
|
||||
-e OUR_GITHUB_JOB_ID \
|
||||
-e HUGGING_FACE_HUB_TOKEN \
|
||||
-e USE_SPLIT_BUILD \
|
||||
--env-file="/tmp/github_env_${GITHUB_RUN_ID}" \
|
||||
--security-opt seccomp=unconfined \
|
||||
--cap-add=SYS_PTRACE \
|
||||
@ -228,7 +218,7 @@ jobs:
|
||||
|
||||
- name: Store PyTorch Build Artifacts on S3
|
||||
uses: seemethere/upload-artifact-s3@v5
|
||||
if: inputs.build-generates-artifacts && steps.build.outcome != 'skipped' && inputs.use_split_build != 'true'
|
||||
if: inputs.build-generates-artifacts && steps.build.outcome != 'skipped'
|
||||
with:
|
||||
name: ${{ inputs.build-environment }}
|
||||
retention-days: 14
|
||||
@ -236,16 +226,6 @@ jobs:
|
||||
path: artifacts.zip
|
||||
s3-bucket: ${{ inputs.s3-bucket }}
|
||||
|
||||
- name: Store PyTorch Build Artifacts on S3
|
||||
uses: seemethere/upload-artifact-s3@v5
|
||||
if: inputs.build-generates-artifacts && steps.build.outcome != 'skipped' && inputs.use_split_build == 'true'
|
||||
with:
|
||||
name: ${{ inputs.build-environment }}-experimental-split-build
|
||||
retention-days: 14
|
||||
if-no-files-found: error
|
||||
path: artifacts.zip
|
||||
s3-bucket: ${{ inputs.s3-bucket }}
|
||||
|
||||
- name: Upload sccache stats
|
||||
if: steps.build.outcome != 'skipped'
|
||||
uses: seemethere/upload-artifact-s3@v5
|
||||
@ -258,5 +238,5 @@ jobs:
|
||||
s3-bucket: ${{ inputs.s3-bucket }}
|
||||
|
||||
- name: Teardown Linux
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@release/2.4
|
||||
if: always()
|
||||
|
||||
85
.github/workflows/_linux-test-label.yml
vendored
Normal file
85
.github/workflows/_linux-test-label.yml
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
name: linux-test-rg
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build-environment:
|
||||
required: true
|
||||
type: string
|
||||
description: Top-level label for what's being built/tested.
|
||||
test-matrix:
|
||||
required: true
|
||||
type: string
|
||||
description: JSON description of what test configs to run.
|
||||
docker-image:
|
||||
required: true
|
||||
type: string
|
||||
description: Docker image to run in.
|
||||
sync-tag:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
description: |
|
||||
If this is set, our linter will use this to make sure that every other
|
||||
job with the same `sync-tag` is identical.
|
||||
timeout-minutes:
|
||||
required: false
|
||||
type: number
|
||||
default: 240
|
||||
description: |
|
||||
Set the maximum (in minutes) how long the workflow should take to finish
|
||||
use-gha:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
description: If set to any value, upload to GHA. Otherwise upload to S3.
|
||||
dashboard-tag:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
s3-bucket:
|
||||
description: S3 bucket to download artifact
|
||||
required: false
|
||||
type: string
|
||||
default: "gha-artifacts"
|
||||
aws-role-to-assume:
|
||||
description: role to assume for downloading artifacts
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
secrets:
|
||||
HUGGING_FACE_HUB_TOKEN:
|
||||
required: false
|
||||
description: |
|
||||
HF Auth token to avoid rate limits when downloading models or datasets from hub
|
||||
|
||||
env:
|
||||
GIT_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
# Don't run on forked repos or empty test matrix
|
||||
if: github.repository_owner == 'pytorch' && toJSON(fromJSON(inputs.test-matrix).include) != '[]'
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(inputs.test-matrix) }}
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: ${{ matrix.mem_leak_check == 'mem_leak_check' && 600 || inputs.timeout-minutes }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Linux Test
|
||||
id: linux-test
|
||||
uses: ./.github/actions/linux-test
|
||||
with:
|
||||
build-environment: ${{ inputs.build-environment }}
|
||||
test-matrix: ${{ inputs.test-matrix }}
|
||||
docker-image: ${{ inputs.docker-image }}
|
||||
sync-tag: ${{ inputs.sync-tag }}
|
||||
use-gha: ${{ inputs.use-gha }}
|
||||
dashboard-tag: ${{ inputs.dashboard-tag }}
|
||||
s3-bucket: ${{ inputs.s3-bucket }}
|
||||
aws-role-to-assume: ${{ inputs.aws-role-to-assume }}
|
||||
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
86
.github/workflows/_linux-test-rg.yml
vendored
Normal file
86
.github/workflows/_linux-test-rg.yml
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
name: linux-test-label
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build-environment:
|
||||
required: true
|
||||
type: string
|
||||
description: Top-level label for what's being built/tested.
|
||||
test-matrix:
|
||||
required: true
|
||||
type: string
|
||||
description: JSON description of what test configs to run.
|
||||
docker-image:
|
||||
required: true
|
||||
type: string
|
||||
description: Docker image to run in.
|
||||
sync-tag:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
description: |
|
||||
If this is set, our linter will use this to make sure that every other
|
||||
job with the same `sync-tag` is identical.
|
||||
timeout-minutes:
|
||||
required: false
|
||||
type: number
|
||||
default: 240
|
||||
description: |
|
||||
Set the maximum (in minutes) how long the workflow should take to finish
|
||||
use-gha:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
description: If set to any value, upload to GHA. Otherwise upload to S3.
|
||||
dashboard-tag:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
s3-bucket:
|
||||
description: S3 bucket to download artifact
|
||||
required: false
|
||||
type: string
|
||||
default: "gha-artifacts"
|
||||
aws-role-to-assume:
|
||||
description: role to assume for downloading artifacts
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
secrets:
|
||||
HUGGING_FACE_HUB_TOKEN:
|
||||
required: false
|
||||
description: |
|
||||
HF Auth token to avoid rate limits when downloading models or datasets from hub
|
||||
|
||||
env:
|
||||
GIT_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
# Don't run on forked repos or empty test matrix
|
||||
if: github.repository_owner == 'pytorch' && toJSON(fromJSON(inputs.test-matrix).include) != '[]'
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(inputs.test-matrix) }}
|
||||
fail-fast: false
|
||||
runs-on:
|
||||
group: ${{ matrix.runner }}
|
||||
timeout-minutes: ${{ matrix.mem_leak_check == 'mem_leak_check' && 600 || inputs.timeout-minutes }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Linux Test
|
||||
id: linux-test
|
||||
uses: ./.github/actions/linux-test
|
||||
with:
|
||||
build-environment: ${{ inputs.build-environment }}
|
||||
test-matrix: ${{ inputs.test-matrix }}
|
||||
docker-image: ${{ inputs.docker-image }}
|
||||
sync-tag: ${{ inputs.sync-tag }}
|
||||
use-gha: ${{ inputs.use-gha }}
|
||||
dashboard-tag: ${{ inputs.dashboard-tag }}
|
||||
s3-bucket: ${{ inputs.s3-bucket }}
|
||||
aws-role-to-assume: ${{ inputs.aws-role-to-assume }}
|
||||
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
12
.github/workflows/_linux-test.yml
vendored
12
.github/workflows/_linux-test.yml
vendored
@ -67,7 +67,7 @@ jobs:
|
||||
timeout-minutes: ${{ matrix.mem_leak_check == 'mem_leak_check' && 600 || inputs.timeout-minutes }}
|
||||
steps:
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
if: ${{ !contains(matrix.runner, 'gcp.a100') }}
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -76,7 +76,7 @@ jobs:
|
||||
docker exec -it $(docker container ps --format '{{.ID}}') bash
|
||||
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Setup Linux
|
||||
uses: ./.github/actions/setup-linux
|
||||
@ -91,7 +91,7 @@ jobs:
|
||||
|
||||
- name: Calculate docker image
|
||||
id: calculate-docker-image
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@release/2.4
|
||||
with:
|
||||
docker-image-name: ${{ inputs.docker-image }}
|
||||
|
||||
@ -105,7 +105,7 @@ jobs:
|
||||
echo "docker pull ghcr.io/pytorch/ci-image:${tag/:/-}"
|
||||
|
||||
- name: Pull docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
|
||||
@ -116,7 +116,7 @@ jobs:
|
||||
|
||||
- name: Install nvidia driver, nvidia-docker runtime, set GPU_FLAG
|
||||
id: install-nvidia-driver
|
||||
uses: pytorch/test-infra/.github/actions/setup-nvidia@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-nvidia@release/2.4
|
||||
if: ${{ contains(inputs.build-environment, 'cuda') && !contains(matrix.config, 'nogpu') && steps.check_arc_runner.outputs.IN_ARC_RUNNER == 'false' }}
|
||||
|
||||
- name: Lock NVIDIA A100 40GB Frequency
|
||||
@ -333,7 +333,7 @@ jobs:
|
||||
path: ./**/core.[1-9]*
|
||||
|
||||
- name: Teardown Linux
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@main
|
||||
uses: pytorch/test-infra/.github/actions/teardown-linux@release/2.4
|
||||
if: always()
|
||||
|
||||
# NB: We are currently having an intermittent GPU-related issue on G5 runners with
|
||||
|
||||
10
.github/workflows/_mac-build.yml
vendored
10
.github/workflows/_mac-build.yml
vendored
@ -71,11 +71,11 @@ jobs:
|
||||
test-matrix: ${{ steps.filter.outputs.test-matrix }}
|
||||
steps:
|
||||
- name: Clean up disk space before running MacOS workflow
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@main
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@release/2.4
|
||||
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Set xcode version
|
||||
env:
|
||||
@ -87,7 +87,7 @@ jobs:
|
||||
|
||||
- name: Setup miniconda
|
||||
if: inputs.environment-file == ''
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@release/2.4
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
environment-file: .github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }}
|
||||
@ -97,7 +97,7 @@ jobs:
|
||||
# environment even though the arch is x86-64
|
||||
- name: Setup miniconda using the provided environment file
|
||||
if: inputs.environment-file != ''
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@release/2.4
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
environment-file: ${{ inputs.environment-file }}
|
||||
@ -207,4 +207,4 @@ jobs:
|
||||
- name: Clean up disk space
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@main
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@release/2.4
|
||||
|
||||
6
.github/workflows/_mac-test-mps.yml
vendored
6
.github/workflows/_mac-test-mps.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
||||
reenabled-issues: ${{ steps.filter.outputs.reenabled-issues }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
submodules: false
|
||||
|
||||
@ -81,7 +81,7 @@ jobs:
|
||||
use-gha: true
|
||||
|
||||
- name: Setup miniconda
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@release/2.4
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
environment-file: .github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }}
|
||||
@ -159,4 +159,4 @@ jobs:
|
||||
- name: Clean up disk space
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@main
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@release/2.4
|
||||
|
||||
8
.github/workflows/_mac-test.yml
vendored
8
.github/workflows/_mac-test.yml
vendored
@ -74,11 +74,11 @@ jobs:
|
||||
done
|
||||
|
||||
- name: Clean up disk space before running MacOS workflow
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@main
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@release/2.4
|
||||
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: ./.github/actions/download-build-artifacts
|
||||
@ -93,7 +93,7 @@ jobs:
|
||||
use-gha: true
|
||||
|
||||
- name: Setup miniconda
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@release/2.4
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
environment-file: .github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }}
|
||||
@ -216,4 +216,4 @@ jobs:
|
||||
- name: Clean up disk space
|
||||
if: always()
|
||||
continue-on-error: true
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@main
|
||||
uses: pytorch/test-infra/.github/actions/check-disk-space@release/2.4
|
||||
|
||||
6
.github/workflows/_rocm-test.yml
vendored
6
.github/workflows/_rocm-test.yml
vendored
@ -58,7 +58,7 @@ jobs:
|
||||
steps:
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
no-sudo: true
|
||||
|
||||
@ -80,12 +80,12 @@ jobs:
|
||||
|
||||
- name: Calculate docker image
|
||||
id: calculate-docker-image
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@release/2.4
|
||||
with:
|
||||
docker-image-name: ${{ inputs.docker-image }}
|
||||
|
||||
- name: Pull docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
|
||||
|
||||
6
.github/workflows/_run_android_tests.yml
vendored
6
.github/workflows/_run_android_tests.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
keep-going: ${{ steps.filter.outputs.keep-going }}
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: false
|
||||
@ -54,10 +54,10 @@ jobs:
|
||||
SUPPORT_ABI: '${{ matrix.support_abi }}'
|
||||
steps:
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Setup miniconda
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-miniconda@release/2.4
|
||||
with:
|
||||
python-version: 3.8
|
||||
environment-file: .github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }}.txt
|
||||
|
||||
273
.github/workflows/_runner-determinator.yml
vendored
273
.github/workflows/_runner-determinator.yml
vendored
@ -3,273 +3,39 @@ name: Check whether the workflow owner can use ARC runners
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
triggering_actor:
|
||||
user_name:
|
||||
required: true
|
||||
type: string
|
||||
description: The triggering_actor for the workflow. Use github.triggering_actor
|
||||
issue_owner:
|
||||
required: true
|
||||
type: string
|
||||
description: The owner of the issue. Use github.event.pull_request.user.login || github.event.issue.user.login
|
||||
description: The name of the workflow owner.
|
||||
curr_branch:
|
||||
required: true
|
||||
type: string
|
||||
description: Current branch or tag.
|
||||
curr_ref_type:
|
||||
required: false
|
||||
type: string
|
||||
default: branch
|
||||
description: The value of "github.ref_type", "branch" or "tag"
|
||||
description: Current branch.
|
||||
issue_number:
|
||||
required: false
|
||||
type: string
|
||||
default: "5132"
|
||||
description: |
|
||||
Fetch's GitHub Issue from pytorch/test-infra
|
||||
Example: https://github.com/pytorch/test-infra/issues/5132
|
||||
|
||||
outputs:
|
||||
label-type:
|
||||
workflow-type:
|
||||
description: Type of runners to use
|
||||
value: ${{ jobs.runner-determinator.outputs.label-type }}
|
||||
value: ${{ jobs.runner-determinator.outputs.workflow-type }}
|
||||
|
||||
jobs:
|
||||
runner-determinator:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: linux.4xlarge
|
||||
outputs:
|
||||
label-type: ${{ steps.set-condition.outputs.label-type }}
|
||||
workflow-type: ${{ steps.set-condition.outputs.workflow-type }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ inputs.issue_number }}
|
||||
TRIGGERING_ACTOR: ${{ inputs.triggering_actor }}
|
||||
ISSUE_OWNER: ${{ inputs.issue_owner }}
|
||||
USERNAME: ${{ inputs.user_name }}
|
||||
steps:
|
||||
# - name: Checkout PyTorch
|
||||
# uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
# with:
|
||||
# fetch-depth: 1
|
||||
# submodules: true
|
||||
|
||||
# TODO: Remove the hardcoded step below
|
||||
# Hardcoding below is temporary for testing ALI runners
|
||||
# This file below should match the script found in .github/scripts/runner_determinator.py
|
||||
- name: Hardcode runner-determinator script
|
||||
id: hardcode-script
|
||||
run: |
|
||||
cat <<EOF > runner_determinator.py
|
||||
# flake8: noqa: G004
|
||||
|
||||
import logging
|
||||
import os
|
||||
from argparse import ArgumentParser
|
||||
from logging import LogRecord
|
||||
from typing import Any, Iterable
|
||||
|
||||
from github import Auth, Github
|
||||
from github.Issue import Issue
|
||||
|
||||
|
||||
WORKFLOW_LABEL_META = "" # use meta runners
|
||||
WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation
|
||||
|
||||
GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "")
|
||||
GH_OUTPUT_KEY_LABEL_TYPE = "label-type"
|
||||
|
||||
|
||||
class ColorFormatter(logging.Formatter):
|
||||
"""Color codes the log messages based on the log level"""
|
||||
|
||||
COLORS = {
|
||||
"WARNING": "\033[33m", # Yellow
|
||||
"ERROR": "\033[31m", # Red
|
||||
"CRITICAL": "\033[31m", # Red
|
||||
"INFO": "\033[0m", # Reset
|
||||
"DEBUG": "\033[0m", # Reset
|
||||
}
|
||||
|
||||
def format(self, record: LogRecord) -> str:
|
||||
log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset
|
||||
record.msg = f"{log_color}{record.msg}\033[0m"
|
||||
return super().format(record)
|
||||
|
||||
|
||||
handler = logging.StreamHandler()
|
||||
handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s"))
|
||||
|
||||
log = logging.getLogger(os.path.basename(__file__))
|
||||
log.addHandler(handler)
|
||||
log.setLevel(logging.INFO)
|
||||
|
||||
|
||||
def set_github_output(key: str, value: str) -> None:
|
||||
"""
|
||||
Defines outputs of the github action that invokes this script
|
||||
"""
|
||||
if not GITHUB_OUTPUT:
|
||||
# See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice
|
||||
log.warning(
|
||||
"No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method."
|
||||
)
|
||||
print(f"::set-output name={key}::{value}")
|
||||
return
|
||||
|
||||
with open(GITHUB_OUTPUT, "a") as f:
|
||||
log.info(f"Setting output: {key}='{value}'")
|
||||
f.write(f"{key}={value}\n")
|
||||
|
||||
|
||||
def parse_args() -> Any:
|
||||
parser = ArgumentParser("Get dynamic rollout settings")
|
||||
parser.add_argument("--github-token", type=str, required=True, help="GitHub token")
|
||||
parser.add_argument(
|
||||
"--github-issue-repo",
|
||||
type=str,
|
||||
required=False,
|
||||
default="pytorch/test-infra",
|
||||
help="GitHub repo to get the issue",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-repo",
|
||||
type=str,
|
||||
required=True,
|
||||
help="GitHub repo where CI is running",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-issue", type=int, required=True, help="GitHub issue number"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-actor", type=str, required=True, help="GitHub triggering_actor"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-issue-owner", type=str, required=True, help="GitHub issue owner"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-branch", type=str, required=True, help="Current GitHub branch or tag"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--github-ref-type",
|
||||
type=str,
|
||||
required=True,
|
||||
help="Current GitHub ref type, branch or tag",
|
||||
)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def get_gh_client(github_token: str) -> Github:
|
||||
auth = Auth.Token(github_token)
|
||||
return Github(auth=auth)
|
||||
|
||||
|
||||
def get_issue(gh: Github, repo: str, issue_num: int) -> Issue:
|
||||
repo = gh.get_repo(repo)
|
||||
return repo.get_issue(number=issue_num)
|
||||
|
||||
|
||||
def get_potential_pr_author(
|
||||
gh: Github, repo: str, username: str, ref_type: str, ref_name: str
|
||||
) -> str:
|
||||
# If the trigger was a new tag added by a bot, this is a ciflow case
|
||||
# Fetch the actual username from the original PR. The PR number is
|
||||
# embedded in the tag name: ciflow/<name>/<pr-number>
|
||||
if username == "pytorch-bot[bot]" and ref_type == "tag":
|
||||
split_tag = ref_name.split("/")
|
||||
if (
|
||||
len(split_tag) == 3
|
||||
and split_tag[0] == "ciflow"
|
||||
and split_tag[2].isnumeric()
|
||||
):
|
||||
pr_number = split_tag[2]
|
||||
try:
|
||||
repository = gh.get_repo(repo)
|
||||
pull = repository.get_pull(number=int(pr_number))
|
||||
except Exception as e:
|
||||
raise Exception( # noqa: TRY002
|
||||
f"issue with pull request {pr_number} from repo {repository}"
|
||||
) from e
|
||||
return pull.user.login
|
||||
# In all other cases, return the original input username
|
||||
return username
|
||||
|
||||
|
||||
def is_exception_branch(branch: str) -> bool:
|
||||
return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"}
|
||||
|
||||
|
||||
def get_workflow_type(issue: Issue, workflow_requestors: Iterable[str]) -> str:
|
||||
try:
|
||||
first_comment = issue.get_comments()[0].body.strip("\n\t ")
|
||||
|
||||
if first_comment[0] == "!":
|
||||
log.info("LF Workflows are disabled for everyone. Using meta runners.")
|
||||
return WORKFLOW_LABEL_META
|
||||
elif first_comment[0] == "*":
|
||||
log.info("LF Workflows are enabled for everyone. Using LF runners.")
|
||||
return WORKFLOW_LABEL_LF
|
||||
else:
|
||||
all_opted_in_users = {
|
||||
usr_raw.strip("\n\t@ ") for usr_raw in first_comment.split()
|
||||
}
|
||||
opted_in_requestors = {
|
||||
usr for usr in workflow_requestors if usr in all_opted_in_users
|
||||
}
|
||||
if opted_in_requestors:
|
||||
log.info(
|
||||
f"LF Workflows are enabled for {', '.join(opted_in_requestors)}. Using LF runners."
|
||||
)
|
||||
return WORKFLOW_LABEL_LF
|
||||
else:
|
||||
log.info(
|
||||
f"LF Workflows are disabled for {', '.join(workflow_requestors)}. Using meta runners."
|
||||
)
|
||||
return WORKFLOW_LABEL_META
|
||||
|
||||
except Exception as e:
|
||||
log.error(
|
||||
f"Failed to get determine workflow type. Falling back to meta runners. Exception: {e}"
|
||||
)
|
||||
return WORKFLOW_LABEL_META
|
||||
|
||||
|
||||
def main() -> None:
|
||||
args = parse_args()
|
||||
|
||||
if args.github_ref_type == "branch" and is_exception_branch(args.github_branch):
|
||||
log.info(f"Exception branch: '{args.github_branch}', using meta runners")
|
||||
label_type = WORKFLOW_LABEL_META
|
||||
else:
|
||||
try:
|
||||
gh = get_gh_client(args.github_token)
|
||||
# The default issue we use - https://github.com/pytorch/test-infra/issues/5132
|
||||
issue = get_issue(gh, args.github_issue_repo, args.github_issue)
|
||||
username = get_potential_pr_author(
|
||||
gh,
|
||||
args.github_repo,
|
||||
args.github_actor,
|
||||
args.github_ref_type,
|
||||
args.github_branch,
|
||||
)
|
||||
label_type = get_workflow_type(
|
||||
issue,
|
||||
(
|
||||
args.github_issue_owner,
|
||||
username,
|
||||
),
|
||||
)
|
||||
except Exception as e:
|
||||
log.error(
|
||||
f"Failed to get issue. Falling back to meta runners. Exception: {e}"
|
||||
)
|
||||
label_type = WORKFLOW_LABEL_META
|
||||
|
||||
set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, label_type)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
EOF
|
||||
|
||||
cat runner_determinator.py
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
submodules: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0
|
||||
@ -278,14 +44,15 @@ jobs:
|
||||
id: set-condition
|
||||
run: |
|
||||
curr_branch="${{ inputs.curr_branch }}"
|
||||
curr_ref_type="${{ inputs.curr_ref_type }}"
|
||||
echo "Current branch is '$curr_branch'"
|
||||
|
||||
python3 runner_determinator.py \
|
||||
output="$(python3 .github/scripts/get_workflow_type.py \
|
||||
--github-token "$GITHUB_TOKEN" \
|
||||
--github-issue "$ISSUE_NUMBER" \
|
||||
--github-branch "$curr_branch" \
|
||||
--github-actor "$TRIGGERING_ACTOR" \
|
||||
--github-issue-owner "$ISSUE_OWNER" \
|
||||
--github-ref-type "$curr_ref_type" \
|
||||
--github-repo "$GITHUB_REPOSITORY"
|
||||
--github-user "$USERNAME")"
|
||||
|
||||
echo "Output: '${output}'"
|
||||
|
||||
WORKFLOW_TYPE=$(echo "${output}" | jq -r '.workflow_type')
|
||||
echo "workflow-type=$WORKFLOW_TYPE" >> "$GITHUB_OUTPUT"
|
||||
|
||||
18
.github/workflows/_win-build.yml
vendored
18
.github/workflows/_win-build.yml
vendored
@ -30,12 +30,6 @@ on:
|
||||
An option JSON description of what test configs to run later on. This
|
||||
is moved here from the Linux test workflow so that we can apply filter
|
||||
logic using test-config labels earlier and skip unnecessary builds
|
||||
runner:
|
||||
required: false
|
||||
type: string
|
||||
default: "windows.4xlarge.nonephemeral"
|
||||
description: |
|
||||
Label of the runner this job should run on.
|
||||
|
||||
outputs:
|
||||
test-matrix:
|
||||
@ -49,13 +43,10 @@ jobs:
|
||||
build:
|
||||
# Don't run on forked repos.
|
||||
if: github.repository_owner == 'pytorch'
|
||||
runs-on: ${{ inputs.runner }}
|
||||
runs-on: [self-hosted, windows.4xlarge.nonephemeral]
|
||||
timeout-minutes: 240
|
||||
outputs:
|
||||
test-matrix: ${{ steps.filter.outputs.test-matrix }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
# Duplicated in win-test because this MUST go before a checkout
|
||||
- name: Enable git symlinks on Windows and disable fsmonitor daemon
|
||||
@ -69,10 +60,10 @@ jobs:
|
||||
git config --global core.fsmonitor false
|
||||
|
||||
- name: Clean up leftover processes on non-ephemeral Windows runner
|
||||
uses: pytorch/test-infra/.github/actions/cleanup-runner@main
|
||||
uses: pytorch/test-infra/.github/actions/cleanup-runner@release/2.4
|
||||
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
instructions: |
|
||||
@ -87,7 +78,7 @@ jobs:
|
||||
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
no-sudo: true
|
||||
|
||||
@ -98,7 +89,6 @@ jobs:
|
||||
|
||||
- name: Parse ref
|
||||
id: parse-ref
|
||||
shell: bash
|
||||
run: python3 .github/scripts/parse_ref.py
|
||||
|
||||
- name: Get workflow job id
|
||||
|
||||
10
.github/workflows/_win-test.yml
vendored
10
.github/workflows/_win-test.yml
vendored
@ -41,9 +41,6 @@ jobs:
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: ${{ matrix.mem_leak_check == 'mem_leak_check' && 600 || inputs.timeout-minutes }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
# Duplicated in win-build because this MUST go before a checkout
|
||||
- name: Enable git symlinks on Windows and disable fsmonitor daemon
|
||||
@ -57,10 +54,10 @@ jobs:
|
||||
git config --global core.fsmonitor false
|
||||
|
||||
- name: Clean up leftover processes on non-ephemeral Windows runner
|
||||
uses: pytorch/test-infra/.github/actions/cleanup-runner@main
|
||||
uses: pytorch/test-infra/.github/actions/cleanup-runner@release/2.4
|
||||
|
||||
- name: Setup SSH (Click me for login details)
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@main
|
||||
uses: pytorch/test-infra/.github/actions/setup-ssh@release/2.4
|
||||
with:
|
||||
github-secret: ${{ secrets.GITHUB_TOKEN }}
|
||||
instructions: |
|
||||
@ -76,7 +73,7 @@ jobs:
|
||||
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
with:
|
||||
no-sudo: true
|
||||
|
||||
@ -227,7 +224,6 @@ jobs:
|
||||
|
||||
- name: Parse ref
|
||||
id: parse-ref
|
||||
shell: bash
|
||||
run: python3 .github/scripts/parse_ref.py
|
||||
|
||||
- name: Uninstall PyTorch
|
||||
|
||||
6
.github/workflows/_xpu-test.yml
vendored
6
.github/workflows/_xpu-test.yml
vendored
@ -54,7 +54,7 @@ jobs:
|
||||
steps:
|
||||
# [see note: pytorch repo ref]
|
||||
- name: Checkout PyTorch
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4
|
||||
|
||||
- name: Setup XPU
|
||||
uses: ./.github/actions/setup-xpu
|
||||
@ -72,12 +72,12 @@ jobs:
|
||||
|
||||
- name: Calculate docker image
|
||||
id: calculate-docker-image
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/calculate-docker-image@release/2.4
|
||||
with:
|
||||
docker-image-name: ${{ inputs.docker-image }}
|
||||
|
||||
- name: Pull docker image
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@release/2.4
|
||||
with:
|
||||
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user