mirror of
https://github.com/pytorch/pytorch.git
synced 2025-11-19 18:14:54 +08:00
Compare commits
1 Commits
ciflow/ind
...
bf/bug-sta
| Author | SHA1 | Date | |
|---|---|---|---|
| 8cef91fb74 |
@ -7,13 +7,13 @@ ENV LC_ALL en_US.UTF-8
|
|||||||
ENV LANG en_US.UTF-8
|
ENV LANG en_US.UTF-8
|
||||||
ENV LANGUAGE en_US.UTF-8
|
ENV LANGUAGE en_US.UTF-8
|
||||||
|
|
||||||
ARG DEVTOOLSET_VERSION=13
|
ARG DEVTOOLSET_VERSION=11
|
||||||
|
|
||||||
RUN yum -y update
|
RUN yum -y update
|
||||||
RUN yum -y install epel-release
|
RUN yum -y install epel-release
|
||||||
# install glibc-langpack-en make sure en_US.UTF-8 locale is available
|
# install glibc-langpack-en make sure en_US.UTF-8 locale is available
|
||||||
RUN yum -y install glibc-langpack-en
|
RUN yum -y install glibc-langpack-en
|
||||||
RUN yum install -y sudo wget curl perl util-linux xz bzip2 git patch which perl zlib-devel openssl-devel yum-utils autoconf automake make gcc-toolset-${DEVTOOLSET_VERSION}-gcc gcc-toolset-${DEVTOOLSET_VERSION}-gcc-c++ gcc-toolset-${DEVTOOLSET_VERSION}-gcc-gfortran gcc-toolset-${DEVTOOLSET_VERSION}-gdb
|
RUN yum install -y sudo wget curl perl util-linux xz bzip2 git patch which perl zlib-devel openssl-devel yum-utils autoconf automake make gcc-toolset-${DEVTOOLSET_VERSION}-toolchain
|
||||||
# Just add everything as a safe.directory for git since these will be used in multiple places with git
|
# Just add everything as a safe.directory for git since these will be used in multiple places with git
|
||||||
RUN git config --global --add safe.directory '*'
|
RUN git config --global --add safe.directory '*'
|
||||||
ENV PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/bin:$PATH
|
ENV PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/bin:$PATH
|
||||||
@ -41,7 +41,6 @@ RUN bash ./install_conda.sh && rm install_conda.sh
|
|||||||
# Install CUDA
|
# Install CUDA
|
||||||
FROM base as cuda
|
FROM base as cuda
|
||||||
ARG CUDA_VERSION=12.6
|
ARG CUDA_VERSION=12.6
|
||||||
ARG DEVTOOLSET_VERSION=13
|
|
||||||
RUN rm -rf /usr/local/cuda-*
|
RUN rm -rf /usr/local/cuda-*
|
||||||
ADD ./common/install_cuda.sh install_cuda.sh
|
ADD ./common/install_cuda.sh install_cuda.sh
|
||||||
COPY ./common/install_nccl.sh install_nccl.sh
|
COPY ./common/install_nccl.sh install_nccl.sh
|
||||||
@ -51,8 +50,7 @@ ENV CUDA_HOME=/usr/local/cuda-${CUDA_VERSION}
|
|||||||
# Preserve CUDA_VERSION for the builds
|
# Preserve CUDA_VERSION for the builds
|
||||||
ENV CUDA_VERSION=${CUDA_VERSION}
|
ENV CUDA_VERSION=${CUDA_VERSION}
|
||||||
# Make things in our path by default
|
# Make things in our path by default
|
||||||
ENV PATH=/usr/local/cuda-${CUDA_VERSION}/bin:/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/bin:$PATH
|
ENV PATH=/usr/local/cuda-${CUDA_VERSION}/bin:$PATH
|
||||||
|
|
||||||
|
|
||||||
FROM cuda as cuda12.6
|
FROM cuda as cuda12.6
|
||||||
RUN bash ./install_cuda.sh 12.6
|
RUN bash ./install_cuda.sh 12.6
|
||||||
@ -70,22 +68,8 @@ FROM cuda as cuda13.0
|
|||||||
RUN bash ./install_cuda.sh 13.0
|
RUN bash ./install_cuda.sh 13.0
|
||||||
ENV DESIRED_CUDA=13.0
|
ENV DESIRED_CUDA=13.0
|
||||||
|
|
||||||
FROM ${ROCM_IMAGE} as rocm_base
|
FROM ${ROCM_IMAGE} as rocm
|
||||||
ARG DEVTOOLSET_VERSION=13
|
|
||||||
ENV LC_ALL en_US.UTF-8
|
|
||||||
ENV LANG en_US.UTF-8
|
|
||||||
ENV LANGUAGE en_US.UTF-8
|
|
||||||
# Install devtoolset on ROCm base image
|
|
||||||
RUN yum -y update && \
|
|
||||||
yum -y install epel-release && \
|
|
||||||
yum -y install glibc-langpack-en && \
|
|
||||||
yum install -y sudo wget curl perl util-linux xz bzip2 git patch which perl zlib-devel openssl-devel yum-utils autoconf automake make gcc-toolset-${DEVTOOLSET_VERSION}-gcc gcc-toolset-${DEVTOOLSET_VERSION}-gcc-c++ gcc-toolset-${DEVTOOLSET_VERSION}-gcc-gfortran gcc-toolset-${DEVTOOLSET_VERSION}-gdb
|
|
||||||
RUN git config --global --add safe.directory '*'
|
|
||||||
ENV PATH=/opt/rh/gcc-toolset-${DEVTOOLSET_VERSION}/root/usr/bin:$PATH
|
|
||||||
|
|
||||||
FROM rocm_base as rocm
|
|
||||||
ARG PYTORCH_ROCM_ARCH
|
ARG PYTORCH_ROCM_ARCH
|
||||||
ARG DEVTOOLSET_VERSION=13
|
|
||||||
ENV PYTORCH_ROCM_ARCH ${PYTORCH_ROCM_ARCH}
|
ENV PYTORCH_ROCM_ARCH ${PYTORCH_ROCM_ARCH}
|
||||||
ADD ./common/install_mkl.sh install_mkl.sh
|
ADD ./common/install_mkl.sh install_mkl.sh
|
||||||
RUN bash ./install_mkl.sh && rm install_mkl.sh
|
RUN bash ./install_mkl.sh && rm install_mkl.sh
|
||||||
@ -104,7 +88,6 @@ COPY --from=cuda13.0 /usr/local/cuda-13.0 /usr/local/cuda-13.0
|
|||||||
|
|
||||||
# Final step
|
# Final step
|
||||||
FROM ${BASE_TARGET} as final
|
FROM ${BASE_TARGET} as final
|
||||||
ARG DEVTOOLSET_VERSION=13
|
|
||||||
COPY --from=openssl /opt/openssl /opt/openssl
|
COPY --from=openssl /opt/openssl /opt/openssl
|
||||||
COPY --from=patchelf /patchelf /usr/local/bin/patchelf
|
COPY --from=patchelf /patchelf /usr/local/bin/patchelf
|
||||||
COPY --from=conda /opt/conda /opt/conda
|
COPY --from=conda /opt/conda /opt/conda
|
||||||
|
|||||||
@ -36,7 +36,11 @@ case ${DOCKER_TAG_PREFIX} in
|
|||||||
;;
|
;;
|
||||||
rocm*)
|
rocm*)
|
||||||
BASE_TARGET=rocm
|
BASE_TARGET=rocm
|
||||||
PYTORCH_ROCM_ARCH="gfx900;gfx906;gfx908;gfx90a;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201;gfx950;gfx1150;gfx1151"
|
PYTORCH_ROCM_ARCH="gfx900;gfx906;gfx908;gfx90a;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201"
|
||||||
|
# add gfx950, gfx115x conditionally starting in ROCm 7.0
|
||||||
|
if [[ "$ROCM_VERSION" == *"7.0"* ]]; then
|
||||||
|
PYTORCH_ROCM_ARCH="${PYTORCH_ROCM_ARCH};gfx950;gfx1150;gfx1151"
|
||||||
|
fi
|
||||||
EXTRA_BUILD_ARGS="${EXTRA_BUILD_ARGS} --build-arg PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH}"
|
EXTRA_BUILD_ARGS="${EXTRA_BUILD_ARGS} --build-arg PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -59,7 +63,7 @@ docker build \
|
|||||||
--target final \
|
--target final \
|
||||||
--progress plain \
|
--progress plain \
|
||||||
--build-arg "BASE_TARGET=${BASE_TARGET}" \
|
--build-arg "BASE_TARGET=${BASE_TARGET}" \
|
||||||
--build-arg "DEVTOOLSET_VERSION=13" \
|
--build-arg "DEVTOOLSET_VERSION=11" \
|
||||||
${EXTRA_BUILD_ARGS} \
|
${EXTRA_BUILD_ARGS} \
|
||||||
-t ${tmp_tag} \
|
-t ${tmp_tag} \
|
||||||
$@ \
|
$@ \
|
||||||
|
|||||||
@ -168,18 +168,6 @@ case "$tag" in
|
|||||||
VISION=yes
|
VISION=yes
|
||||||
TRITON=yes
|
TRITON=yes
|
||||||
;;
|
;;
|
||||||
pytorch-linux-jammy-py3.11-clang12)
|
|
||||||
ANACONDA_PYTHON_VERSION=3.11
|
|
||||||
CLANG_VERSION=12
|
|
||||||
VISION=no
|
|
||||||
TRITON=no
|
|
||||||
;;
|
|
||||||
pytorch-linux-jammy-py3.12-clang12)
|
|
||||||
ANACONDA_PYTHON_VERSION=3.12
|
|
||||||
CLANG_VERSION=12
|
|
||||||
VISION=no
|
|
||||||
TRITON=no
|
|
||||||
;;
|
|
||||||
pytorch-linux-jammy-rocm-n-py3 | pytorch-linux-jammy-rocm-n-py3-benchmarks | pytorch-linux-noble-rocm-n-py3)
|
pytorch-linux-jammy-rocm-n-py3 | pytorch-linux-jammy-rocm-n-py3-benchmarks | pytorch-linux-noble-rocm-n-py3)
|
||||||
if [[ $tag =~ "jammy" ]]; then
|
if [[ $tag =~ "jammy" ]]; then
|
||||||
ANACONDA_PYTHON_VERSION=3.10
|
ANACONDA_PYTHON_VERSION=3.10
|
||||||
@ -188,7 +176,7 @@ case "$tag" in
|
|||||||
fi
|
fi
|
||||||
GCC_VERSION=11
|
GCC_VERSION=11
|
||||||
VISION=yes
|
VISION=yes
|
||||||
ROCM_VERSION=7.1
|
ROCM_VERSION=7.0
|
||||||
NINJA_VERSION=1.9.0
|
NINJA_VERSION=1.9.0
|
||||||
TRITON=yes
|
TRITON=yes
|
||||||
KATEX=yes
|
KATEX=yes
|
||||||
@ -207,9 +195,9 @@ case "$tag" in
|
|||||||
NINJA_VERSION=1.9.0
|
NINJA_VERSION=1.9.0
|
||||||
TRITON=yes
|
TRITON=yes
|
||||||
;;
|
;;
|
||||||
pytorch-linux-noble-xpu-n-py3 | pytorch-linux-noble-xpu-n-py3-inductor-benchmarks)
|
pytorch-linux-jammy-xpu-n-py3 | pytorch-linux-jammy-xpu-n-py3-inductor-benchmarks)
|
||||||
ANACONDA_PYTHON_VERSION=3.10
|
ANACONDA_PYTHON_VERSION=3.10
|
||||||
GCC_VERSION=13
|
GCC_VERSION=11
|
||||||
VISION=yes
|
VISION=yes
|
||||||
XPU_VERSION=2025.2
|
XPU_VERSION=2025.2
|
||||||
NINJA_VERSION=1.9.0
|
NINJA_VERSION=1.9.0
|
||||||
@ -260,12 +248,6 @@ case "$tag" in
|
|||||||
HALIDE=yes
|
HALIDE=yes
|
||||||
TRITON=yes
|
TRITON=yes
|
||||||
;;
|
;;
|
||||||
pytorch-linux-jammy-cuda12.8-py3.12-pallas)
|
|
||||||
CUDA_VERSION=12.8.1
|
|
||||||
ANACONDA_PYTHON_VERSION=3.12
|
|
||||||
GCC_VERSION=11
|
|
||||||
PALLAS=yes
|
|
||||||
;;
|
|
||||||
pytorch-linux-jammy-py3.12-triton-cpu)
|
pytorch-linux-jammy-py3.12-triton-cpu)
|
||||||
CUDA_VERSION=12.6
|
CUDA_VERSION=12.6
|
||||||
ANACONDA_PYTHON_VERSION=3.12
|
ANACONDA_PYTHON_VERSION=3.12
|
||||||
@ -279,9 +261,9 @@ case "$tag" in
|
|||||||
PYTHON_VERSION=3.10
|
PYTHON_VERSION=3.10
|
||||||
CUDA_VERSION=12.8.1
|
CUDA_VERSION=12.8.1
|
||||||
;;
|
;;
|
||||||
pytorch-linux-jammy-aarch64-py3.10-gcc13)
|
pytorch-linux-jammy-aarch64-py3.10-gcc11)
|
||||||
ANACONDA_PYTHON_VERSION=3.10
|
ANACONDA_PYTHON_VERSION=3.10
|
||||||
GCC_VERSION=13
|
GCC_VERSION=11
|
||||||
ACL=yes
|
ACL=yes
|
||||||
VISION=yes
|
VISION=yes
|
||||||
OPENBLAS=yes
|
OPENBLAS=yes
|
||||||
@ -289,19 +271,9 @@ case "$tag" in
|
|||||||
# from pytorch/llvm:9.0.1 is x86 specific
|
# from pytorch/llvm:9.0.1 is x86 specific
|
||||||
SKIP_LLVM_SRC_BUILD_INSTALL=yes
|
SKIP_LLVM_SRC_BUILD_INSTALL=yes
|
||||||
;;
|
;;
|
||||||
pytorch-linux-jammy-aarch64-py3.10-clang21)
|
pytorch-linux-jammy-aarch64-py3.10-gcc11-inductor-benchmarks)
|
||||||
ANACONDA_PYTHON_VERSION=3.10
|
ANACONDA_PYTHON_VERSION=3.10
|
||||||
CLANG_VERSION=21
|
GCC_VERSION=11
|
||||||
ACL=yes
|
|
||||||
VISION=yes
|
|
||||||
OPENBLAS=yes
|
|
||||||
# snadampal: skipping llvm src build install because the current version
|
|
||||||
# from pytorch/llvm:9.0.1 is x86 specific
|
|
||||||
SKIP_LLVM_SRC_BUILD_INSTALL=yes
|
|
||||||
;;
|
|
||||||
pytorch-linux-jammy-aarch64-py3.10-gcc13-inductor-benchmarks)
|
|
||||||
ANACONDA_PYTHON_VERSION=3.10
|
|
||||||
GCC_VERSION=13
|
|
||||||
ACL=yes
|
ACL=yes
|
||||||
VISION=yes
|
VISION=yes
|
||||||
OPENBLAS=yes
|
OPENBLAS=yes
|
||||||
@ -387,7 +359,6 @@ docker build \
|
|||||||
--build-arg "INDUCTOR_BENCHMARKS=${INDUCTOR_BENCHMARKS}" \
|
--build-arg "INDUCTOR_BENCHMARKS=${INDUCTOR_BENCHMARKS}" \
|
||||||
--build-arg "EXECUTORCH=${EXECUTORCH}" \
|
--build-arg "EXECUTORCH=${EXECUTORCH}" \
|
||||||
--build-arg "HALIDE=${HALIDE}" \
|
--build-arg "HALIDE=${HALIDE}" \
|
||||||
--build-arg "PALLAS=${PALLAS}" \
|
|
||||||
--build-arg "XPU_VERSION=${XPU_VERSION}" \
|
--build-arg "XPU_VERSION=${XPU_VERSION}" \
|
||||||
--build-arg "UNINSTALL_DILL=${UNINSTALL_DILL}" \
|
--build-arg "UNINSTALL_DILL=${UNINSTALL_DILL}" \
|
||||||
--build-arg "ACL=${ACL:-}" \
|
--build-arg "ACL=${ACL:-}" \
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
0.8.0
|
|
||||||
@ -1 +1 @@
|
|||||||
bfeb066872bc1e8b2d2bc0a3b295b99dd77206e7
|
7416ffcb92cdbe98d9f97e4e6f95247e46dfc9fd
|
||||||
|
|||||||
@ -8,8 +8,8 @@ if [ -n "$CLANG_VERSION" ]; then
|
|||||||
# work around ubuntu apt-get conflicts
|
# work around ubuntu apt-get conflicts
|
||||||
sudo apt-get -y -f install
|
sudo apt-get -y -f install
|
||||||
wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||||
if [[ $CLANG_VERSION -ge 18 ]]; then
|
if [[ $CLANG_VERSION == 18 ]]; then
|
||||||
apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${CLANG_VERSION} main"
|
apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -7,11 +7,11 @@ if [ -n "$GCC_VERSION" ]; then
|
|||||||
# Need the official toolchain repo to get alternate packages
|
# Need the official toolchain repo to get alternate packages
|
||||||
add-apt-repository ppa:ubuntu-toolchain-r/test
|
add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y g++-$GCC_VERSION gfortran-$GCC_VERSION
|
apt-get install -y g++-$GCC_VERSION
|
||||||
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-"$GCC_VERSION" 50
|
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-"$GCC_VERSION" 50
|
||||||
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-"$GCC_VERSION" 50
|
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-"$GCC_VERSION" 50
|
||||||
update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-"$GCC_VERSION" 50
|
update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-"$GCC_VERSION" 50
|
||||||
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-"$GCC_VERSION" 50
|
|
||||||
|
|
||||||
# Cleanup package manager
|
# Cleanup package manager
|
||||||
apt-get autoclean && apt-get clean
|
apt-get autoclean && apt-get clean
|
||||||
|
|||||||
@ -1,40 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
source "$(dirname "${BASH_SOURCE[0]}")/common_utils.sh"
|
|
||||||
|
|
||||||
# Get the pinned JAX version (same for all CUDA versions)
|
|
||||||
JAX_VERSION=$(get_pinned_commit /ci_commit_pins/jax)
|
|
||||||
|
|
||||||
function install_jax_12() {
|
|
||||||
echo "Installing JAX ${JAX_VERSION} with CUDA 12 support"
|
|
||||||
pip_install "jax[cuda12]==${JAX_VERSION}" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
|
|
||||||
|
|
||||||
# Verify installation
|
|
||||||
python -c "import jax" # check for errors
|
|
||||||
echo "JAX ${JAX_VERSION} installation completed successfully for CUDA 12"
|
|
||||||
}
|
|
||||||
|
|
||||||
function install_jax_13() {
|
|
||||||
echo "Installing JAX ${JAX_VERSION} with CUDA 13 support"
|
|
||||||
pip_install "jax[cuda13]==${JAX_VERSION}" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
|
|
||||||
|
|
||||||
# Verify installation
|
|
||||||
python -c "import jax" # check for errors
|
|
||||||
echo "JAX ${JAX_VERSION} installation completed successfully for CUDA 13"
|
|
||||||
}
|
|
||||||
|
|
||||||
# idiomatic parameter and option handling in sh
|
|
||||||
while test $# -gt 0
|
|
||||||
do
|
|
||||||
case "$1" in
|
|
||||||
12.4|12.6|12.6.*|12.8|12.8.*|12.9|12.9.*) install_jax_12;
|
|
||||||
;;
|
|
||||||
13.0|13.0.*) install_jax_13;
|
|
||||||
;;
|
|
||||||
*) echo "bad argument $1"; exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Script used only in CD pipeline
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# install dependencies
|
|
||||||
dnf -y install gmp-devel libmpc-devel texinfo flex bison
|
|
||||||
|
|
||||||
cd /usr/local/src
|
|
||||||
# fetch source for gcc 13
|
|
||||||
git clone --depth 1 --single-branch -b releases/gcc-13.3.0 https://github.com/gcc-mirror/gcc.git gcc-13.3.0
|
|
||||||
|
|
||||||
mkdir -p gcc-13.3.0/build-gomp
|
|
||||||
cd gcc-13.3.0/build-gomp
|
|
||||||
|
|
||||||
# configure gcc build
|
|
||||||
# I got these flags by:
|
|
||||||
# 1. downloading the source rpm for gcc-11 on AlmaLinux 8 container
|
|
||||||
# dnf install -y dnf-plugins-core rpmdevtools
|
|
||||||
# dnf download --source libgomp
|
|
||||||
# 2. extracting the gcc.spec from the source.
|
|
||||||
# rpmdev-extract gcc-xx.src.rpm
|
|
||||||
# 3. extracting optflags and ld_flags from gcc.spec:
|
|
||||||
# rpm --eval '%{optflags}'
|
|
||||||
# rpm --eval '%{build_ldflags}'
|
|
||||||
#
|
|
||||||
# I had to remove the following flags because they didn't compile for this version of libgomp:
|
|
||||||
# -Werror=format-security
|
|
||||||
# -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
|
|
||||||
# -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
|
|
||||||
#
|
|
||||||
# I added -march=armv8-a -mtune=generic to make them explicit. I don't think they're strictly needed.
|
|
||||||
|
|
||||||
OPT_FLAGS='-O2 -march=armv8-a -mtune=generic'\
|
|
||||||
' -fexceptions -g -grecord-gcc-switches -pipe -Wall'\
|
|
||||||
' -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS'\
|
|
||||||
' -fstack-protector-strong -fasynchronous-unwind-tables'\
|
|
||||||
' -fstack-clash-protection'
|
|
||||||
|
|
||||||
LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now'
|
|
||||||
|
|
||||||
CFLAGS="$OPT_FLAGS" \
|
|
||||||
CXXFLAGS="$OPT_FLAGS" \
|
|
||||||
LDFLAGS="$LDFLAGS" \
|
|
||||||
../configure \
|
|
||||||
--prefix=/usr \
|
|
||||||
--libdir=/usr/lib64 \
|
|
||||||
--enable-languages=c,c++ \
|
|
||||||
--disable-multilib \
|
|
||||||
--disable-bootstrap \
|
|
||||||
--enable-libgomp
|
|
||||||
|
|
||||||
# only build libgomp
|
|
||||||
make -j$(nproc) all-target-libgomp
|
|
||||||
|
|
||||||
make install-target-libgomp
|
|
||||||
@ -10,7 +10,6 @@ git clone https://github.com/OpenMathLib/OpenBLAS.git -b "${OPENBLAS_VERSION}" -
|
|||||||
|
|
||||||
OPENBLAS_CHECKOUT_DIR="OpenBLAS"
|
OPENBLAS_CHECKOUT_DIR="OpenBLAS"
|
||||||
OPENBLAS_BUILD_FLAGS="
|
OPENBLAS_BUILD_FLAGS="
|
||||||
CC=gcc
|
|
||||||
NUM_THREADS=128
|
NUM_THREADS=128
|
||||||
USE_OPENMP=1
|
USE_OPENMP=1
|
||||||
NO_SHARED=0
|
NO_SHARED=0
|
||||||
|
|||||||
@ -60,8 +60,7 @@ EOF
|
|||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated rocm-llvm-dev
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated rocm-llvm-dev
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(ver $ROCM_VERSION) -lt $(ver 7.1) ]]; then
|
# precompiled miopen kernels added in ROCm 3.5, renamed in ROCm 5.5
|
||||||
# precompiled miopen kernels added in ROCm 3.5, renamed in ROCm 5.5, removed in ROCm 7.1
|
|
||||||
# search for all unversioned packages
|
# search for all unversioned packages
|
||||||
# if search fails it will abort this script; use true to avoid case where search fails
|
# if search fails it will abort this script; use true to avoid case where search fails
|
||||||
MIOPENHIPGFX=$(apt-cache search --names-only miopen-hip-gfx | awk '{print $1}' | grep -F -v . || true)
|
MIOPENHIPGFX=$(apt-cache search --names-only miopen-hip-gfx | awk '{print $1}' | grep -F -v . || true)
|
||||||
@ -70,7 +69,6 @@ EOF
|
|||||||
else
|
else
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ${MIOPENHIPGFX}
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ${MIOPENHIPGFX}
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# ROCm 6.0 had a regression where journal_mode was enabled on the kdb files resulting in permission errors at runtime
|
# ROCm 6.0 had a regression where journal_mode was enabled on the kdb files resulting in permission errors at runtime
|
||||||
for kdb in /opt/rocm/share/miopen/db/*.kdb
|
for kdb in /opt/rocm/share/miopen/db/*.kdb
|
||||||
|
|||||||
@ -12,8 +12,8 @@ function do_install() {
|
|||||||
|
|
||||||
rocm_version_nodot=${rocm_version//./}
|
rocm_version_nodot=${rocm_version//./}
|
||||||
|
|
||||||
# https://github.com/icl-utk-edu/magma/pull/65
|
# post merge of https://github.com/icl-utk-edu/magma/pull/65
|
||||||
MAGMA_VERSION=d6e4117bc88e73f06d26c6c2e14f064e8fc3d1ec
|
MAGMA_VERSION=c0792ae825fb36872784892ea643dd6f3456bc5f
|
||||||
magma_archive="magma-rocm${rocm_version_nodot}-${MAGMA_VERSION}-1.tar.bz2"
|
magma_archive="magma-rocm${rocm_version_nodot}-${MAGMA_VERSION}-1.tar.bz2"
|
||||||
|
|
||||||
rocm_dir="/opt/rocm"
|
rocm_dir="/opt/rocm"
|
||||||
|
|||||||
@ -9,7 +9,7 @@ set -xe
|
|||||||
|
|
||||||
function install_ubuntu() {
|
function install_ubuntu() {
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
if [[ ! " jammy noble " =~ " ${VERSION_CODENAME} " ]]; then
|
if [[ ! " jammy " =~ " ${VERSION_CODENAME} " ]]; then
|
||||||
echo "Ubuntu version ${VERSION_CODENAME} not supported"
|
echo "Ubuntu version ${VERSION_CODENAME} not supported"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -35,24 +35,25 @@ function install_ubuntu() {
|
|||||||
# The xpu-smi packages
|
# The xpu-smi packages
|
||||||
apt-get install -y flex bison xpu-smi
|
apt-get install -y flex bison xpu-smi
|
||||||
|
|
||||||
|
if [[ "${XPU_DRIVER_TYPE,,}" == "lts" ]]; then
|
||||||
# Compute and Media Runtimes
|
# Compute and Media Runtimes
|
||||||
if [[ " ${VERSION_CODENAME} " =~ " noble " ]]; then
|
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
intel-opencl-icd libze-intel-gpu1 libze1 \
|
intel-opencl-icd intel-level-zero-gpu level-zero \
|
||||||
intel-media-va-driver-non-free libmfx-gen1 libvpl2 \
|
intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2 \
|
||||||
libegl-mesa0 libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \
|
libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \
|
||||||
libglapi-mesa libgles2-mesa-dev libglx-mesa0 libigdgmm12 libxatracker2 mesa-va-drivers \
|
libglapi-mesa libgles2-mesa-dev libglx-mesa0 libigdgmm12 libxatracker2 mesa-va-drivers \
|
||||||
mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all vainfo hwinfo clinfo intel-ocloc
|
mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all vainfo hwinfo clinfo
|
||||||
else # jammy
|
# Development Packages
|
||||||
|
apt-get install -y libigc-dev intel-igc-cm libigdfcl-dev libigfxcmrt-dev level-zero-dev
|
||||||
|
else # rolling driver
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
intel-opencl-icd libze-intel-gpu1 libze1 \
|
intel-opencl-icd libze-intel-gpu1 libze1 \
|
||||||
intel-media-va-driver-non-free libmfx-gen1 libvpl2 \
|
intel-media-va-driver-non-free libmfx-gen1 libvpl2 \
|
||||||
libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \
|
libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \
|
||||||
libglapi-mesa libglx-mesa0 libigdgmm12 libxatracker2 mesa-va-drivers \
|
libglapi-mesa libglx-mesa0 libigdgmm12 libxatracker2 mesa-va-drivers \
|
||||||
mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all vainfo hwinfo clinfo intel-ocloc
|
mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all vainfo hwinfo clinfo intel-ocloc
|
||||||
fi
|
|
||||||
# Development Packages
|
|
||||||
apt-get install -y libigc-dev intel-igc-cm libigdfcl-dev libigfxcmrt-dev libze-dev
|
apt-get install -y libigc-dev intel-igc-cm libigdfcl-dev libigfxcmrt-dev libze-dev
|
||||||
|
fi
|
||||||
|
|
||||||
# Install Intel Support Packages
|
# Install Intel Support Packages
|
||||||
apt-get install -y ${XPU_PACKAGES}
|
apt-get install -y ${XPU_PACKAGES}
|
||||||
@ -65,7 +66,7 @@ function install_ubuntu() {
|
|||||||
function install_rhel() {
|
function install_rhel() {
|
||||||
. /etc/os-release
|
. /etc/os-release
|
||||||
if [[ "${ID}" == "rhel" ]]; then
|
if [[ "${ID}" == "rhel" ]]; then
|
||||||
if [[ ! " 8.8 8.10 9.0 9.2 9.3 " =~ " ${VERSION_ID} " ]]; then
|
if [[ ! " 8.8 8.9 9.0 9.2 9.3 " =~ " ${VERSION_ID} " ]]; then
|
||||||
echo "RHEL version ${VERSION_ID} not supported"
|
echo "RHEL version ${VERSION_ID} not supported"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@ -146,7 +147,7 @@ function install_sles() {
|
|||||||
XPU_DRIVER_VERSION=""
|
XPU_DRIVER_VERSION=""
|
||||||
if [[ "${XPU_DRIVER_TYPE,,}" == "lts" ]]; then
|
if [[ "${XPU_DRIVER_TYPE,,}" == "lts" ]]; then
|
||||||
# Use GPU driver LTS releases
|
# Use GPU driver LTS releases
|
||||||
XPU_DRIVER_VERSION="/lts/2523"
|
XPU_DRIVER_VERSION="/lts/2350"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Default use Intel® oneAPI Deep Learning Essentials 2025.1
|
# Default use Intel® oneAPI Deep Learning Essentials 2025.1
|
||||||
|
|||||||
@ -49,7 +49,11 @@ case ${DOCKER_TAG_PREFIX} in
|
|||||||
fi
|
fi
|
||||||
BASE_TARGET=rocm
|
BASE_TARGET=rocm
|
||||||
GPU_IMAGE=rocm/dev-ubuntu-22.04:${GPU_ARCH_VERSION}-complete
|
GPU_IMAGE=rocm/dev-ubuntu-22.04:${GPU_ARCH_VERSION}-complete
|
||||||
PYTORCH_ROCM_ARCH="gfx900;gfx906;gfx908;gfx90a;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201;gfx950;gfx1150;gfx1151"
|
PYTORCH_ROCM_ARCH="gfx900;gfx906;gfx908;gfx90a;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201"
|
||||||
|
# add gfx950, gfx115x conditionally starting in ROCm 7.0
|
||||||
|
if [[ "$GPU_ARCH_VERSION" == *"7.0"* ]]; then
|
||||||
|
PYTORCH_ROCM_ARCH="${PYTORCH_ROCM_ARCH};gfx950;gfx1150;gfx1151"
|
||||||
|
fi
|
||||||
DOCKER_GPU_BUILD_ARG="--build-arg PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH} --build-arg ROCM_VERSION=${GPU_ARCH_VERSION}"
|
DOCKER_GPU_BUILD_ARG="--build-arg PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH} --build-arg ROCM_VERSION=${GPU_ARCH_VERSION}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@ -50,10 +50,6 @@ RUN rm install_ninja.sh
|
|||||||
ENV PATH=/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/bin:$PATH
|
ENV PATH=/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/bin:$PATH
|
||||||
ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/lib64:/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/lib:$LD_LIBRARY_PATH
|
ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/lib64:/opt/rh/gcc-toolset-${GCCTOOLSET_VERSION}/root/usr/lib:$LD_LIBRARY_PATH
|
||||||
|
|
||||||
# Build a newer version of libgomp than that supported in in Almalinux 8.
|
|
||||||
COPY ./common/install_libgomp.sh install_libgomp.sh
|
|
||||||
RUN bash ./install_libgomp.sh && rm install_libgomp.sh
|
|
||||||
|
|
||||||
# git236+ would refuse to run git commands in repos owned by other users
|
# git236+ would refuse to run git commands in repos owned by other users
|
||||||
# Which causes version check to fail, as pytorch repo is bind-mounted into the image
|
# Which causes version check to fail, as pytorch repo is bind-mounted into the image
|
||||||
# Override this behaviour by treating every folder as safe
|
# Override this behaviour by treating every folder as safe
|
||||||
|
|||||||
@ -87,7 +87,11 @@ case ${image} in
|
|||||||
MANY_LINUX_VERSION="2_28"
|
MANY_LINUX_VERSION="2_28"
|
||||||
DEVTOOLSET_VERSION="11"
|
DEVTOOLSET_VERSION="11"
|
||||||
GPU_IMAGE=rocm/dev-almalinux-8:${GPU_ARCH_VERSION}-complete
|
GPU_IMAGE=rocm/dev-almalinux-8:${GPU_ARCH_VERSION}-complete
|
||||||
PYTORCH_ROCM_ARCH="gfx900;gfx906;gfx908;gfx90a;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201;gfx950;gfx1150;gfx1151"
|
PYTORCH_ROCM_ARCH="gfx900;gfx906;gfx908;gfx90a;gfx942;gfx1030;gfx1100;gfx1101;gfx1102;gfx1200;gfx1201"
|
||||||
|
# add gfx950, gfx115x conditionally starting in ROCm 7.0
|
||||||
|
if [[ "$GPU_ARCH_VERSION" == *"7.0"* ]]; then
|
||||||
|
PYTORCH_ROCM_ARCH="${PYTORCH_ROCM_ARCH};gfx950;gfx1150;gfx1151"
|
||||||
|
fi
|
||||||
DOCKER_GPU_BUILD_ARG="--build-arg ROCM_VERSION=${GPU_ARCH_VERSION} --build-arg PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH} --build-arg DEVTOOLSET_VERSION=${DEVTOOLSET_VERSION}"
|
DOCKER_GPU_BUILD_ARG="--build-arg ROCM_VERSION=${GPU_ARCH_VERSION} --build-arg PYTORCH_ROCM_ARCH=${PYTORCH_ROCM_ARCH} --build-arg DEVTOOLSET_VERSION=${DEVTOOLSET_VERSION}"
|
||||||
;;
|
;;
|
||||||
manylinux2_28-builder:xpu)
|
manylinux2_28-builder:xpu)
|
||||||
|
|||||||
@ -402,6 +402,3 @@ scikit-build==0.18.1
|
|||||||
pyre-extensions==0.0.32
|
pyre-extensions==0.0.32
|
||||||
tabulate==0.9.0
|
tabulate==0.9.0
|
||||||
#Description: These package are needed to build FBGEMM and torchrec on PyTorch CI
|
#Description: These package are needed to build FBGEMM and torchrec on PyTorch CI
|
||||||
|
|
||||||
Jinja2==3.1.6
|
|
||||||
#Description: required for torch.distributed.debug
|
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
sphinx==7.2.6
|
sphinx==5.3.0
|
||||||
#Description: This is used to generate PyTorch docs
|
#Description: This is used to generate PyTorch docs
|
||||||
#Pinned versions: 7.2.6
|
#Pinned versions: 5.3.0
|
||||||
|
|
||||||
pytorch_sphinx_theme2==0.2.0
|
standard-imghdr==3.13.0; python_version >= "3.13"
|
||||||
#Description: This is needed to generate PyTorch docs
|
#Description: This is needed by Sphinx, so it needs to be added here.
|
||||||
#Pinned versions: 0.2.0
|
# The reasons are as follows:
|
||||||
|
# 1) This module has been removed from the Python standard library since Python 3.13(https://peps.python.org/pep-0594/#imghdr);
|
||||||
|
# 2) The current version of Sphinx (5.3.0) is not compatible with Python 3.13.
|
||||||
|
# Once Sphinx is upgraded to a version compatible with Python 3.13 or later, we can remove this dependency.
|
||||||
|
|
||||||
|
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@71e55749be14ceb56e7f8211a9fb649866b87ad4#egg=pytorch_sphinx_theme2
|
||||||
# TODO: sphinxcontrib.katex 0.9.0 adds a local KaTeX server to speed up pre-rendering
|
# TODO: sphinxcontrib.katex 0.9.0 adds a local KaTeX server to speed up pre-rendering
|
||||||
# but it doesn't seem to work and hangs around idly. The initial thought that it is probably
|
# but it doesn't seem to work and hangs around idly. The initial thought that it is probably
|
||||||
# something related to Docker setup. We can investigate this later.
|
# something related to Docker setup. We can investigate this later.
|
||||||
@ -32,17 +36,17 @@ tensorboard==2.18.0 ; python_version >= "3.13"
|
|||||||
#Description: This is used to generate PyTorch docs
|
#Description: This is used to generate PyTorch docs
|
||||||
#Pinned versions: 2.13.0
|
#Pinned versions: 2.13.0
|
||||||
|
|
||||||
breathe==4.36.0
|
breathe==4.34.0
|
||||||
#Description: This is used to generate PyTorch C++ docs
|
#Description: This is used to generate PyTorch C++ docs
|
||||||
#Pinned versions: 4.36.0
|
#Pinned versions: 4.34.0
|
||||||
|
|
||||||
exhale==0.3.7
|
exhale==0.2.3
|
||||||
#Description: This is used to generate PyTorch C++ docs
|
#Description: This is used to generate PyTorch C++ docs
|
||||||
#Pinned versions: 0.3.7
|
#Pinned versions: 0.2.3
|
||||||
|
|
||||||
docutils==0.20
|
docutils==0.16
|
||||||
#Description: This is used to generate PyTorch C++ docs
|
#Description: This is used to generate PyTorch C++ docs
|
||||||
#Pinned versions: 0.20
|
#Pinned versions: 0.16
|
||||||
|
|
||||||
bs4==0.0.1
|
bs4==0.0.1
|
||||||
#Description: This is used to generate PyTorch C++ docs
|
#Description: This is used to generate PyTorch C++ docs
|
||||||
@ -52,13 +56,13 @@ IPython==8.12.0
|
|||||||
#Description: This is used to generate PyTorch functorch docs
|
#Description: This is used to generate PyTorch functorch docs
|
||||||
#Pinned versions: 8.12.0
|
#Pinned versions: 8.12.0
|
||||||
|
|
||||||
myst-nb==1.3.0
|
myst-nb==0.17.2
|
||||||
#Description: This is used to generate PyTorch functorch and torch.compile docs.
|
#Description: This is used to generate PyTorch functorch and torch.compile docs.
|
||||||
#Pinned versions: 1.3.0
|
#Pinned versions: 0.17.2
|
||||||
|
|
||||||
# The following are required to build torch.distributed.elastic.rendezvous.etcd* docs
|
# The following are required to build torch.distributed.elastic.rendezvous.etcd* docs
|
||||||
python-etcd==0.4.5
|
python-etcd==0.4.5
|
||||||
sphinx-copybutton==0.5.0
|
sphinx-copybutton==0.5.0
|
||||||
sphinx-design==0.6.1
|
sphinx-design==0.4.0
|
||||||
sphinxcontrib-mermaid==1.0.0
|
sphinxcontrib-mermaid==1.0.0
|
||||||
myst-parser==4.0.1
|
myst-parser==0.18.1
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
3.5.1
|
3.5.0
|
||||||
|
|||||||
@ -143,15 +143,6 @@ COPY ci_commit_pins/halide.txt halide.txt
|
|||||||
RUN if [ -n "${HALIDE}" ]; then bash ./install_halide.sh; fi
|
RUN if [ -n "${HALIDE}" ]; then bash ./install_halide.sh; fi
|
||||||
RUN rm install_halide.sh common_utils.sh halide.txt
|
RUN rm install_halide.sh common_utils.sh halide.txt
|
||||||
|
|
||||||
ARG PALLAS
|
|
||||||
ARG CUDA_VERSION
|
|
||||||
# Install JAX with CUDA support (for Pallas)
|
|
||||||
COPY ./common/install_jax.sh install_jax.sh
|
|
||||||
COPY ./common/common_utils.sh common_utils.sh
|
|
||||||
COPY ./ci_commit_pins/jax.txt /ci_commit_pins/jax.txt
|
|
||||||
RUN if [ -n "${PALLAS}" ]; then bash ./install_jax.sh ${CUDA_VERSION}; fi
|
|
||||||
RUN rm -f install_jax.sh common_utils.sh /ci_commit_pins/jax.txt
|
|
||||||
|
|
||||||
ARG ONNX
|
ARG ONNX
|
||||||
# Install ONNX dependencies
|
# Install ONNX dependencies
|
||||||
COPY ./common/install_onnx.sh ./common/common_utils.sh ./
|
COPY ./common/install_onnx.sh ./common/common_utils.sh ./
|
||||||
|
|||||||
@ -8,11 +8,9 @@ from abc import ABC, abstractmethod
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from collections.abc import Callable # Python 3.11+
|
from typing import Any, Callable, Required, TypedDict # Python 3.11+
|
||||||
from typing import Any, Required, TypedDict
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from collections.abc import Callable
|
from typing import Any, Callable, TypedDict
|
||||||
from typing import Any, TypedDict
|
|
||||||
|
|
||||||
from typing_extensions import Required # Fallback for Python <3.11
|
from typing_extensions import Required # Fallback for Python <3.11
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ into a tarball, with the following structure:
|
|||||||
More specifically, `build_magma.sh` copies over the relevant files from the `package_files` directory depending on the ROCm version.
|
More specifically, `build_magma.sh` copies over the relevant files from the `package_files` directory depending on the ROCm version.
|
||||||
Outputted binaries should be in the `output` folder.
|
Outputted binaries should be in the `output` folder.
|
||||||
|
|
||||||
|
|
||||||
## Pushing
|
## Pushing
|
||||||
|
|
||||||
Packages can be uploaded to an S3 bucket using:
|
Packages can be uploaded to an S3 bucket using:
|
||||||
|
|||||||
@ -6,8 +6,8 @@ set -eou pipefail
|
|||||||
# The script expects DESIRED_CUDA and PACKAGE_NAME to be set
|
# The script expects DESIRED_CUDA and PACKAGE_NAME to be set
|
||||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
|
||||||
# https://github.com/icl-utk-edu/magma/pull/65
|
# post merge of https://github.com/icl-utk-edu/magma/pull/65
|
||||||
MAGMA_VERSION=d6e4117bc88e73f06d26c6c2e14f064e8fc3d1ec
|
MAGMA_VERSION=c0792ae825fb36872784892ea643dd6f3456bc5f
|
||||||
|
|
||||||
# Folders for the build
|
# Folders for the build
|
||||||
PACKAGE_FILES=${ROOT_DIR}/magma-rocm/package_files # metadata
|
PACKAGE_FILES=${ROOT_DIR}/magma-rocm/package_files # metadata
|
||||||
@ -20,7 +20,7 @@ mkdir -p ${PACKAGE_DIR} ${PACKAGE_OUTPUT}/linux-64 ${PACKAGE_BUILD} ${PACKAGE_RE
|
|||||||
|
|
||||||
# Fetch magma sources and verify checksum
|
# Fetch magma sources and verify checksum
|
||||||
pushd ${PACKAGE_DIR}
|
pushd ${PACKAGE_DIR}
|
||||||
git clone https://github.com/jeffdaily/magma
|
git clone https://github.com/icl-utk-edu/magma
|
||||||
pushd magma
|
pushd magma
|
||||||
git checkout ${MAGMA_VERSION}
|
git checkout ${MAGMA_VERSION}
|
||||||
popd
|
popd
|
||||||
|
|||||||
@ -21,87 +21,3 @@ if [[ "${BUILD_ENVIRONMENT}" == *rocm* ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$pytest_reports_dir" || true
|
mkdir -p "$pytest_reports_dir" || true
|
||||||
|
|
||||||
##########################################
|
|
||||||
# copied from .ci/pytorch/common_utils.sh
|
|
||||||
##########################################
|
|
||||||
|
|
||||||
function get_pinned_commit() {
|
|
||||||
cat .github/ci_commit_pins/"${1}".txt
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
function pip_build_and_install() {
|
|
||||||
local build_target=$1
|
|
||||||
local wheel_dir=$2
|
|
||||||
|
|
||||||
local found_whl=0
|
|
||||||
for file in "${wheel_dir}"/*.whl
|
|
||||||
do
|
|
||||||
if [[ -f "${file}" ]]; then
|
|
||||||
found_whl=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Build the wheel if it doesn't exist
|
|
||||||
if [ "${found_whl}" == "0" ]; then
|
|
||||||
python3 -m pip wheel \
|
|
||||||
--no-build-isolation \
|
|
||||||
--no-deps \
|
|
||||||
-w "${wheel_dir}" \
|
|
||||||
"${build_target}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for file in "${wheel_dir}"/*.whl
|
|
||||||
do
|
|
||||||
pip_install_whl "${file}"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function install_torchvision() {
|
|
||||||
local orig_preload
|
|
||||||
local commit
|
|
||||||
commit=$(get_pinned_commit vision)
|
|
||||||
orig_preload=${LD_PRELOAD}
|
|
||||||
if [ -n "${LD_PRELOAD}" ]; then
|
|
||||||
# Silence dlerror to work-around glibc ASAN bug, see https://sourceware.org/bugzilla/show_bug.cgi?id=27653#c9
|
|
||||||
echo 'char* dlerror(void) { return "";}'|gcc -fpic -shared -o "${HOME}/dlerror.so" -x c -
|
|
||||||
LD_PRELOAD=${orig_preload}:${HOME}/dlerror.so
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${BUILD_ENVIRONMENT}" == *cuda* ]]; then
|
|
||||||
# Not sure if both are needed, but why not
|
|
||||||
export FORCE_CUDA=1
|
|
||||||
export WITH_CUDA=1
|
|
||||||
fi
|
|
||||||
pip_build_and_install "git+https://github.com/pytorch/vision.git@${commit}" dist/vision
|
|
||||||
|
|
||||||
if [ -n "${LD_PRELOAD}" ]; then
|
|
||||||
LD_PRELOAD=${orig_preload}
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ git config --global --add safe.directory /var/lib/jenkins/workspace
|
|||||||
|
|
||||||
if [[ "$BUILD_ENVIRONMENT" == *onnx* ]]; then
|
if [[ "$BUILD_ENVIRONMENT" == *onnx* ]]; then
|
||||||
# TODO: This can be removed later once vision is also part of the Docker image
|
# TODO: This can be removed later once vision is also part of the Docker image
|
||||||
install_torchvision
|
pip install -q --no-use-pep517 "git+https://github.com/pytorch/vision.git@$(cat .github/ci_commit_pins/vision.txt)"
|
||||||
# JIT C++ extensions require ninja, so put it into PATH.
|
# JIT C++ extensions require ninja, so put it into PATH.
|
||||||
export PATH="/var/lib/jenkins/.local/bin:$PATH"
|
export PATH="/var/lib/jenkins/.local/bin:$PATH"
|
||||||
# NB: ONNX test is fast (~15m) so it's ok to retry it few more times to avoid any flaky issue, we
|
# NB: ONNX test is fast (~15m) so it's ok to retry it few more times to avoid any flaky issue, we
|
||||||
|
|||||||
@ -168,16 +168,14 @@ if [[ "$BUILD_ENVIRONMENT" == *xpu* ]]; then
|
|||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source /opt/intel/oneapi/compiler/latest/env/vars.sh
|
source /opt/intel/oneapi/compiler/latest/env/vars.sh
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source /opt/intel/oneapi/umf/latest/env/vars.sh
|
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /opt/intel/oneapi/ccl/latest/env/vars.sh
|
source /opt/intel/oneapi/ccl/latest/env/vars.sh
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source /opt/intel/oneapi/mpi/latest/env/vars.sh
|
source /opt/intel/oneapi/mpi/latest/env/vars.sh
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /opt/intel/oneapi/pti/latest/env/vars.sh
|
|
||||||
# Enable XCCL build
|
# Enable XCCL build
|
||||||
export USE_XCCL=1
|
export USE_XCCL=1
|
||||||
export USE_MPI=0
|
export USE_MPI=0
|
||||||
|
# XPU kineto feature dependencies are not fully ready, disable kineto build as temp WA
|
||||||
|
export USE_KINETO=0
|
||||||
export TORCH_XPU_ARCH_LIST=pvc
|
export TORCH_XPU_ARCH_LIST=pvc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -96,6 +96,7 @@ function pip_build_and_install() {
|
|||||||
python3 -m pip wheel \
|
python3 -m pip wheel \
|
||||||
--no-build-isolation \
|
--no-build-isolation \
|
||||||
--no-deps \
|
--no-deps \
|
||||||
|
--no-use-pep517 \
|
||||||
-w "${wheel_dir}" \
|
-w "${wheel_dir}" \
|
||||||
"${build_target}"
|
"${build_target}"
|
||||||
fi
|
fi
|
||||||
@ -307,28 +308,6 @@ function install_torchao() {
|
|||||||
pip_build_and_install "git+https://github.com/pytorch/ao.git@${commit}" dist/ao
|
pip_build_and_install "git+https://github.com/pytorch/ao.git@${commit}" dist/ao
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_flash_attn_cute() {
|
|
||||||
echo "Installing FlashAttention CuTe from GitHub..."
|
|
||||||
# Grab latest main til we have a pinned commit
|
|
||||||
local flash_attn_commit
|
|
||||||
flash_attn_commit=$(git ls-remote https://github.com/Dao-AILab/flash-attention.git HEAD | cut -f1)
|
|
||||||
|
|
||||||
# Clone the repo to a temporary directory
|
|
||||||
rm -rf flash-attention-build
|
|
||||||
git clone --depth 1 --recursive https://github.com/Dao-AILab/flash-attention.git flash-attention-build
|
|
||||||
|
|
||||||
pushd flash-attention-build
|
|
||||||
git checkout "${flash_attn_commit}"
|
|
||||||
|
|
||||||
# Install only the 'cute' sub-directory
|
|
||||||
pip_install -e flash_attn/cute/
|
|
||||||
popd
|
|
||||||
|
|
||||||
# remove the local repo
|
|
||||||
rm -rf flash-attention-build
|
|
||||||
echo "FlashAttention CuTe installation complete."
|
|
||||||
}
|
|
||||||
|
|
||||||
function print_sccache_stats() {
|
function print_sccache_stats() {
|
||||||
echo 'PyTorch Build Statistics'
|
echo 'PyTorch Build Statistics'
|
||||||
sccache --show-stats
|
sccache --show-stats
|
||||||
|
|||||||
@ -89,41 +89,23 @@ if [ "$is_main_doc" = true ]; then
|
|||||||
|
|
||||||
make coverage
|
make coverage
|
||||||
# Now we have the coverage report, we need to make sure it is empty.
|
# Now we have the coverage report, we need to make sure it is empty.
|
||||||
# Sphinx 7.2.6+ format: python.txt contains a statistics table with a TOTAL row
|
# Count the number of lines in the file and turn that number into a variable
|
||||||
# showing the undocumented count in the third column.
|
# $lines. The `cut -f1 ...` is to only parse the number, not the filename
|
||||||
# Example: | TOTAL | 99.83% | 2 |
|
# Skip the report header by subtracting 2: the header will be output even if
|
||||||
|
# there are no undocumented items.
|
||||||
#
|
#
|
||||||
# Also: see docs/source/conf.py for "coverage_ignore*" items, which should
|
# Also: see docs/source/conf.py for "coverage_ignore*" items, which should
|
||||||
# be documented then removed from there.
|
# be documented then removed from there.
|
||||||
|
lines=$(wc -l build/coverage/python.txt 2>/dev/null |cut -f1 -d' ')
|
||||||
# Extract undocumented count from TOTAL row in Sphinx 7.2.6 statistics table
|
undocumented=$((lines - 2))
|
||||||
# The table format is: | Module | Coverage | Undocumented |
|
if [ $undocumented -lt 0 ]; then
|
||||||
# Extract the third column (undocumented count) from the TOTAL row
|
|
||||||
undocumented=$(grep "| TOTAL" build/coverage/python.txt | awk -F'|' '{print $4}' | tr -d ' ')
|
|
||||||
|
|
||||||
if [ -z "$undocumented" ] || ! [[ "$undocumented" =~ ^[0-9]+$ ]]; then
|
|
||||||
echo coverage output not found
|
echo coverage output not found
|
||||||
exit 1
|
exit 1
|
||||||
elif [ "$undocumented" -gt 0 ]; then
|
elif [ $undocumented -gt 0 ]; then
|
||||||
set +x # Disable command echoing for cleaner output
|
echo undocumented objects found:
|
||||||
echo ""
|
|
||||||
echo "====================="
|
|
||||||
echo "UNDOCUMENTED OBJECTS:"
|
|
||||||
echo "====================="
|
|
||||||
echo ""
|
|
||||||
# Find the line number of the TOTAL row and print only what comes after it
|
|
||||||
total_line=$(grep -n "| TOTAL" build/coverage/python.txt | cut -d: -f1)
|
|
||||||
if [ -n "$total_line" ]; then
|
|
||||||
# Print only the detailed list (skip the statistics table)
|
|
||||||
tail -n +$((total_line + 2)) build/coverage/python.txt
|
|
||||||
else
|
|
||||||
# Fallback to showing entire file if TOTAL line not found
|
|
||||||
cat build/coverage/python.txt
|
cat build/coverage/python.txt
|
||||||
fi
|
|
||||||
echo ""
|
|
||||||
echo "Make sure you've updated relevant .rsts in docs/source!"
|
echo "Make sure you've updated relevant .rsts in docs/source!"
|
||||||
echo "You can reproduce locally by running 'cd docs && make coverage && tail -n +\$((grep -n \"| TOTAL\" build/coverage/python.txt | cut -d: -f1) + 2)) build/coverage/python.txt'"
|
echo "You can reproduce locally by running 'cd docs && make coverage && cat build/coverage/python.txt'"
|
||||||
set -x # Re-enable command echoing
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|||||||
@ -353,17 +353,6 @@ def test_linalg(device="cpu") -> None:
|
|||||||
torch.linalg.svd(A)
|
torch.linalg.svd(A)
|
||||||
|
|
||||||
|
|
||||||
def test_sdpa(device="cpu", dtype=torch.float16) -> None:
|
|
||||||
"""Regression test for https://github.com/pytorch/pytorch/issues/167602
|
|
||||||
Without nvrtc_builtins on CuDNN-9.13 on CUDA-13 fails with ` No valid execution plans built.`
|
|
||||||
"""
|
|
||||||
print(f"Testing SDPA on {device} using type {dtype}")
|
|
||||||
k, q, v = torch.rand(3, 1, 16, 77, 64, dtype=dtype, device=device).unbind(0)
|
|
||||||
attn = torch.rand(1, 1, 77, 77, dtype=dtype, device=device)
|
|
||||||
rc = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn)
|
|
||||||
assert rc.isnan().any().item() is False
|
|
||||||
|
|
||||||
|
|
||||||
def smoke_test_compile(device: str = "cpu") -> None:
|
def smoke_test_compile(device: str = "cpu") -> None:
|
||||||
supported_dtypes = [torch.float16, torch.float32, torch.float64]
|
supported_dtypes = [torch.float16, torch.float32, torch.float64]
|
||||||
|
|
||||||
@ -500,12 +489,10 @@ def main() -> None:
|
|||||||
smoke_test_conv2d()
|
smoke_test_conv2d()
|
||||||
test_linalg()
|
test_linalg()
|
||||||
test_numpy()
|
test_numpy()
|
||||||
test_sdpa()
|
|
||||||
|
|
||||||
if is_cuda_system:
|
if is_cuda_system:
|
||||||
test_linalg("cuda")
|
test_linalg("cuda")
|
||||||
test_cuda_gds_errors_captured()
|
test_cuda_gds_errors_captured()
|
||||||
test_sdpa("cuda")
|
|
||||||
|
|
||||||
if options.package == "all":
|
if options.package == "all":
|
||||||
smoke_test_modules()
|
smoke_test_modules()
|
||||||
|
|||||||
@ -208,8 +208,6 @@ if [[ "$BUILD_ENVIRONMENT" == *xpu* ]]; then
|
|||||||
source /opt/intel/oneapi/ccl/latest/env/vars.sh
|
source /opt/intel/oneapi/ccl/latest/env/vars.sh
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source /opt/intel/oneapi/mpi/latest/env/vars.sh
|
source /opt/intel/oneapi/mpi/latest/env/vars.sh
|
||||||
# shellcheck disable=SC1091
|
|
||||||
source /opt/intel/oneapi/pti/latest/env/vars.sh
|
|
||||||
# Check XPU status before testing
|
# Check XPU status before testing
|
||||||
timeout 30 xpu-smi discovery || true
|
timeout 30 xpu-smi discovery || true
|
||||||
fi
|
fi
|
||||||
@ -344,18 +342,8 @@ test_python_smoke() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test_python_smoke_b200() {
|
test_python_smoke_b200() {
|
||||||
# Targeted smoke tests for B200 including FlashAttention CuTe coverage
|
# Targeted smoke tests for B200 - staged approach to avoid too many failures
|
||||||
install_flash_attn_cute
|
time python test/run_test.py --include test_matmul_cuda test_scaled_matmul_cuda inductor/test_fp8 $PYTHON_TEST_EXTRA_OPTION --upload-artifacts-while-running
|
||||||
time python test/run_test.py \
|
|
||||||
--include \
|
|
||||||
test_matmul_cuda \
|
|
||||||
test_scaled_matmul_cuda \
|
|
||||||
inductor/test_fp8 \
|
|
||||||
nn/attention/test_fa4 \
|
|
||||||
nn/attention/test_open_registry \
|
|
||||||
inductor/test_flex_flash \
|
|
||||||
$PYTHON_TEST_EXTRA_OPTION \
|
|
||||||
--upload-artifacts-while-running
|
|
||||||
assert_git_not_dirty
|
assert_git_not_dirty
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,13 +377,6 @@ test_lazy_tensor_meta_reference_disabled() {
|
|||||||
export -n TORCH_DISABLE_FUNCTIONALIZATION_META_REFERENCE
|
export -n TORCH_DISABLE_FUNCTIONALIZATION_META_REFERENCE
|
||||||
}
|
}
|
||||||
|
|
||||||
test_dynamo_core() {
|
|
||||||
time python test/run_test.py \
|
|
||||||
--include-dynamo-core-tests \
|
|
||||||
--verbose \
|
|
||||||
--upload-artifacts-while-running
|
|
||||||
assert_git_not_dirty
|
|
||||||
}
|
|
||||||
|
|
||||||
test_dynamo_wrapped_shard() {
|
test_dynamo_wrapped_shard() {
|
||||||
if [[ -z "$NUM_TEST_SHARDS" ]]; then
|
if [[ -z "$NUM_TEST_SHARDS" ]]; then
|
||||||
@ -843,11 +824,6 @@ test_inductor_halide() {
|
|||||||
assert_git_not_dirty
|
assert_git_not_dirty
|
||||||
}
|
}
|
||||||
|
|
||||||
test_inductor_pallas() {
|
|
||||||
python test/run_test.py --include inductor/test_pallas.py --verbose
|
|
||||||
assert_git_not_dirty
|
|
||||||
}
|
|
||||||
|
|
||||||
test_inductor_triton_cpu() {
|
test_inductor_triton_cpu() {
|
||||||
python test/run_test.py --include inductor/test_triton_cpu_backend.py inductor/test_torchinductor_strided_blocks.py --verbose
|
python test/run_test.py --include inductor/test_triton_cpu_backend.py inductor/test_torchinductor_strided_blocks.py --verbose
|
||||||
assert_git_not_dirty
|
assert_git_not_dirty
|
||||||
@ -1250,97 +1226,6 @@ test_custom_script_ops() {
|
|||||||
assert_git_not_dirty
|
assert_git_not_dirty
|
||||||
}
|
}
|
||||||
|
|
||||||
test_libtorch_agnostic_targetting() {
|
|
||||||
echo "Testing libtorch_agnostic runs correctly on TORCH_TARGET_VERSION"
|
|
||||||
|
|
||||||
REPO_DIR=$(pwd)
|
|
||||||
WHEEL_DIR="${REPO_DIR}/test/cpp_extensions/.wheels"
|
|
||||||
|
|
||||||
# Build wheel with current PyTorch (this has TORCH_TARGET_VERSION 2_9_0)
|
|
||||||
echo "Building 2.9 extension wheel with current PyTorch..."
|
|
||||||
pushd test/cpp_extensions/libtorch_agnostic_2_9_extension
|
|
||||||
time python setup.py bdist_wheel
|
|
||||||
|
|
||||||
# Save the wheel
|
|
||||||
mkdir -p "$WHEEL_DIR"
|
|
||||||
cp dist/*.whl "$WHEEL_DIR/"
|
|
||||||
WHEEL_FILE=$(find "$WHEEL_DIR" -maxdepth 1 -name "*.whl" -type f | head -1)
|
|
||||||
echo "Built wheel: $(basename "$WHEEL_FILE")"
|
|
||||||
popd
|
|
||||||
|
|
||||||
# Create venv and install PyTorch 2.9
|
|
||||||
python -m venv venv_pytorch_2_9
|
|
||||||
# shellcheck disable=SC1091
|
|
||||||
. venv_pytorch_2_9/bin/activate
|
|
||||||
|
|
||||||
# Clear PYTHONPATH to avoid using the development PyTorch
|
|
||||||
echo "Clearing PYTHONPATH to use only venv packages..."
|
|
||||||
unset PYTHONPATH
|
|
||||||
|
|
||||||
# Upgrade pip to latest version
|
|
||||||
echo "Upgrading pip to latest version..."
|
|
||||||
pip install --upgrade pip
|
|
||||||
pip --version
|
|
||||||
|
|
||||||
echo "Installing PyTorch 2.9..."
|
|
||||||
|
|
||||||
# Install from release channel only
|
|
||||||
PYTORCH_VERSION="2.9.0"
|
|
||||||
|
|
||||||
# Extract CUDA version from BUILD_ENVIRONMENT (e.g., "cuda12.1" -> "cu121")
|
|
||||||
if [[ "$BUILD_ENVIRONMENT" =~ cuda([0-9]+)\.([0-9]+) ]]; then
|
|
||||||
CUDA_MAJOR="${BASH_REMATCH[1]}"
|
|
||||||
CUDA_MINOR="${BASH_REMATCH[2]}"
|
|
||||||
CUDA_VERSION="cu${CUDA_MAJOR}${CUDA_MINOR}"
|
|
||||||
echo " Detected CUDA ${CUDA_MAJOR}.${CUDA_MINOR} from BUILD_ENVIRONMENT, using ${CUDA_VERSION}"
|
|
||||||
else
|
|
||||||
# Default to CPU build
|
|
||||||
CUDA_VERSION="cpu"
|
|
||||||
echo " No CUDA detected in BUILD_ENVIRONMENT, using CPU build"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if pip install torch=="${PYTORCH_VERSION}" --index-url https://download.pytorch.org/whl/${CUDA_VERSION}/; then
|
|
||||||
echo "Installed PyTorch ${PYTORCH_VERSION} from release channel (${CUDA_VERSION})"
|
|
||||||
else
|
|
||||||
echo " FAILED to install PyTorch 2.9.0 from release channel"
|
|
||||||
echo " URL: https://download.pytorch.org/whl/${CUDA_VERSION}/"
|
|
||||||
deactivate
|
|
||||||
rm -rf venv_pytorch_2_9
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
INSTALLED_VERSION=$(python -c "import torch; print(torch.__version__)" 2>/dev/null || echo "unknown")
|
|
||||||
echo " Installed version: $INSTALLED_VERSION"
|
|
||||||
|
|
||||||
# Install test dependencies
|
|
||||||
echo "Installing test dependencies..."
|
|
||||||
pip install expecttest numpy unittest-xml-reporting
|
|
||||||
|
|
||||||
# Install the pre-built wheel
|
|
||||||
echo ""
|
|
||||||
echo "Installing pre-built 2.9 extension wheel (built with PyTorch 2.10)..."
|
|
||||||
pip install "$WHEEL_FILE"
|
|
||||||
echo "Installed $(basename "$WHEEL_FILE") into PyTorch 2.9 environment"
|
|
||||||
|
|
||||||
# Run tests with PyTorch 2.9 runtime (2.10 tests will be skipped automatically)
|
|
||||||
echo ""
|
|
||||||
echo "Running tests with PyTorch 2.9 runtime (using wheel built on PyTorch 2.10)..."
|
|
||||||
if time python test/cpp_extensions/test_libtorch_agnostic.py -v; then
|
|
||||||
echo ""
|
|
||||||
echo " Wheel built with current torch and TORCH_TARGET_VERSION 2_9_0 works with PyTorch 2.9 runtime!"
|
|
||||||
else
|
|
||||||
echo "targeting test failed"
|
|
||||||
deactivate
|
|
||||||
rm -rf venv_pytorch_2_9 "$WHEEL_DIR"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
deactivate
|
|
||||||
rm -rf venv_pytorch_2_9 "$WHEEL_DIR"
|
|
||||||
|
|
||||||
assert_git_not_dirty
|
|
||||||
}
|
|
||||||
|
|
||||||
test_jit_hooks() {
|
test_jit_hooks() {
|
||||||
echo "Testing jit hooks in cpp"
|
echo "Testing jit hooks in cpp"
|
||||||
HOOK_BUILD="${CUSTOM_TEST_ARTIFACT_BUILD_DIR}/jit-hook-build"
|
HOOK_BUILD="${CUSTOM_TEST_ARTIFACT_BUILD_DIR}/jit-hook-build"
|
||||||
@ -1778,22 +1663,6 @@ test_operator_microbenchmark() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
test_attention_microbenchmark() {
|
|
||||||
TEST_REPORTS_DIR=$(pwd)/test/test-reports
|
|
||||||
mkdir -p "$TEST_REPORTS_DIR"
|
|
||||||
TEST_DIR=$(pwd)
|
|
||||||
|
|
||||||
# Install attention-gym dependency
|
|
||||||
echo "Installing attention-gym..."
|
|
||||||
python -m pip install git+https://github.com/meta-pytorch/attention-gym.git@main
|
|
||||||
pip show triton
|
|
||||||
|
|
||||||
cd "${TEST_DIR}"/benchmarks/transformer
|
|
||||||
|
|
||||||
$TASKSET python score_mod.py --config configs/config_basic.yaml \
|
|
||||||
--output-json-for-dashboard "${TEST_REPORTS_DIR}/attention_microbenchmark.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
if ! [[ "${BUILD_ENVIRONMENT}" == *libtorch* || "${BUILD_ENVIRONMENT}" == *-bazel-* ]]; then
|
if ! [[ "${BUILD_ENVIRONMENT}" == *libtorch* || "${BUILD_ENVIRONMENT}" == *-bazel-* ]]; then
|
||||||
(cd test && python -c "import torch; print(torch.__config__.show())")
|
(cd test && python -c "import torch; print(torch.__config__.show())")
|
||||||
(cd test && python -c "import torch; print(torch.__config__.parallel_info())")
|
(cd test && python -c "import torch; print(torch.__config__.parallel_info())")
|
||||||
@ -1813,8 +1682,6 @@ elif [[ "${BUILD_ENVIRONMENT}" == *aarch64* && "${TEST_CONFIG}" == 'default' ]];
|
|||||||
elif [[ "${TEST_CONFIG}" == *backward* ]]; then
|
elif [[ "${TEST_CONFIG}" == *backward* ]]; then
|
||||||
test_forward_backward_compatibility
|
test_forward_backward_compatibility
|
||||||
# Do NOT add tests after bc check tests, see its comment.
|
# Do NOT add tests after bc check tests, see its comment.
|
||||||
elif [[ "${TEST_CONFIG}" == *libtorch_agnostic_targetting* ]]; then
|
|
||||||
test_libtorch_agnostic_targetting
|
|
||||||
elif [[ "${TEST_CONFIG}" == *xla* ]]; then
|
elif [[ "${TEST_CONFIG}" == *xla* ]]; then
|
||||||
install_torchvision
|
install_torchvision
|
||||||
build_xla
|
build_xla
|
||||||
@ -1853,14 +1720,10 @@ elif [[ "${TEST_CONFIG}" == *operator_benchmark* ]]; then
|
|||||||
fi
|
fi
|
||||||
elif [[ "${TEST_CONFIG}" == *operator_microbenchmark* ]]; then
|
elif [[ "${TEST_CONFIG}" == *operator_microbenchmark* ]]; then
|
||||||
test_operator_microbenchmark
|
test_operator_microbenchmark
|
||||||
elif [[ "${TEST_CONFIG}" == *attention_microbenchmark* ]]; then
|
|
||||||
test_attention_microbenchmark
|
|
||||||
elif [[ "${TEST_CONFIG}" == *inductor_distributed* ]]; then
|
elif [[ "${TEST_CONFIG}" == *inductor_distributed* ]]; then
|
||||||
test_inductor_distributed
|
test_inductor_distributed
|
||||||
elif [[ "${TEST_CONFIG}" == *inductor-halide* ]]; then
|
elif [[ "${TEST_CONFIG}" == *inductor-halide* ]]; then
|
||||||
test_inductor_halide
|
test_inductor_halide
|
||||||
elif [[ "${TEST_CONFIG}" == *inductor-pallas* ]]; then
|
|
||||||
test_inductor_pallas
|
|
||||||
elif [[ "${TEST_CONFIG}" == *inductor-triton-cpu* ]]; then
|
elif [[ "${TEST_CONFIG}" == *inductor-triton-cpu* ]]; then
|
||||||
test_inductor_triton_cpu
|
test_inductor_triton_cpu
|
||||||
elif [[ "${TEST_CONFIG}" == *inductor-micro-benchmark* ]]; then
|
elif [[ "${TEST_CONFIG}" == *inductor-micro-benchmark* ]]; then
|
||||||
@ -1914,8 +1777,6 @@ elif [[ "${TEST_CONFIG}" == *inductor* ]]; then
|
|||||||
test_inductor_shard "${SHARD_NUMBER}"
|
test_inductor_shard "${SHARD_NUMBER}"
|
||||||
elif [[ "${TEST_CONFIG}" == *einops* ]]; then
|
elif [[ "${TEST_CONFIG}" == *einops* ]]; then
|
||||||
test_einops
|
test_einops
|
||||||
elif [[ "${TEST_CONFIG}" == *dynamo_core* ]]; then
|
|
||||||
test_dynamo_core
|
|
||||||
elif [[ "${TEST_CONFIG}" == *dynamo_wrapped* ]]; then
|
elif [[ "${TEST_CONFIG}" == *dynamo_wrapped* ]]; then
|
||||||
install_torchvision
|
install_torchvision
|
||||||
test_dynamo_wrapped_shard "${SHARD_NUMBER}"
|
test_dynamo_wrapped_shard "${SHARD_NUMBER}"
|
||||||
|
|||||||
@ -70,7 +70,7 @@ sccache --zero-stats
|
|||||||
sccache --show-stats
|
sccache --show-stats
|
||||||
|
|
||||||
# Build the wheel
|
# Build the wheel
|
||||||
python -m build --wheel --no-isolation
|
python -m build --wheel --no-build-isolation
|
||||||
if ($LASTEXITCODE -ne 0) { exit 1 }
|
if ($LASTEXITCODE -ne 0) { exit 1 }
|
||||||
|
|
||||||
# Install the wheel locally
|
# Install the wheel locally
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
name: 🚀 New Feature for Release
|
name: 🚀 Release highlight for proposed Feature
|
||||||
description: Submit a Release highlight for proposed Feature
|
description: Submit a Release highlight for proposed Feature
|
||||||
labels: ["release-feature-request"]
|
labels: ["release-feature-request"]
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: New Feature for Release
|
label: Release highlight for proposed Feature
|
||||||
description: >
|
description: >
|
||||||
Example: “A torch.special module, analogous to SciPy's special module.”
|
Example: “A torch.special module, analogous to SciPy's special module.”
|
||||||
- type: input
|
- type: input
|
||||||
|
|||||||
2
.github/actionlint.yaml
vendored
2
.github/actionlint.yaml
vendored
@ -63,7 +63,7 @@ self-hosted-runner:
|
|||||||
- linux.rocm.gpu.gfx942.1
|
- linux.rocm.gpu.gfx942.1
|
||||||
- linux.rocm.gpu.gfx942.2
|
- linux.rocm.gpu.gfx942.2
|
||||||
- linux.rocm.gpu.gfx942.4
|
- linux.rocm.gpu.gfx942.4
|
||||||
- linux.rocm.gfx942.docker-cache
|
- rocm-docker
|
||||||
# Org wise AWS `mac2.metal` runners (2020 Mac mini hardware powered by Apple silicon M1 processors)
|
# Org wise AWS `mac2.metal` runners (2020 Mac mini hardware powered by Apple silicon M1 processors)
|
||||||
- macos-m1-stable
|
- macos-m1-stable
|
||||||
- macos-m1-14
|
- macos-m1-14
|
||||||
|
|||||||
12
.github/actions/pytest-cache-download/action.yml
vendored
12
.github/actions/pytest-cache-download/action.yml
vendored
@ -38,9 +38,9 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
python3 .github/scripts/pytest_cache.py \
|
python3 .github/scripts/pytest_cache.py \
|
||||||
--download \
|
--download \
|
||||||
--cache_dir "$GITHUB_WORKSPACE/$CACHE_DIR" \
|
--cache_dir $GITHUB_WORKSPACE/$CACHE_DIR \
|
||||||
--pr_identifier "$GITHUB_REF" \
|
--pr_identifier $GITHUB_REF \
|
||||||
--job_identifier "$JOB_IDENTIFIER" \
|
--job_identifier $JOB_IDENTIFIER \
|
||||||
--temp_dir "$RUNNER_TEMP" \
|
--temp_dir $RUNNER_TEMP \
|
||||||
--repo "$REPO" \
|
--repo $REPO \
|
||||||
--bucket "$BUCKET" \
|
--bucket $BUCKET \
|
||||||
|
|||||||
16
.github/actions/pytest-cache-upload/action.yml
vendored
16
.github/actions/pytest-cache-upload/action.yml
vendored
@ -47,11 +47,11 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
python3 .github/scripts/pytest_cache.py \
|
python3 .github/scripts/pytest_cache.py \
|
||||||
--upload \
|
--upload \
|
||||||
--cache_dir "$GITHUB_WORKSPACE/$CACHE_DIR" \
|
--cache_dir $GITHUB_WORKSPACE/$CACHE_DIR \
|
||||||
--pr_identifier "$GITHUB_REF" \
|
--pr_identifier $GITHUB_REF \
|
||||||
--job_identifier "$JOB_IDENTIFIER" \
|
--job_identifier $JOB_IDENTIFIER \
|
||||||
--sha "$SHA" \
|
--sha $SHA \
|
||||||
--test_config "$TEST_CONFIG" \
|
--test_config $TEST_CONFIG \
|
||||||
--shard "$SHARD" \
|
--shard $SHARD \
|
||||||
--repo "$REPO" \
|
--repo $REPO \
|
||||||
--temp_dir "$RUNNER_TEMP" \
|
--temp_dir $RUNNER_TEMP \
|
||||||
|
|||||||
2
.github/ci_commit_pins/audio.txt
vendored
2
.github/ci_commit_pins/audio.txt
vendored
@ -1 +1 @@
|
|||||||
ee1a1350eb37804b94334768f328144f058f14e9
|
3b0e7a6f192ca2715e7e6cbe5db007aea7165fe2
|
||||||
|
|||||||
2
.github/ci_commit_pins/vision.txt
vendored
2
.github/ci_commit_pins/vision.txt
vendored
@ -1 +1 @@
|
|||||||
2d82dc5caa336d179d9b46ac4a0fb8c43d84c5cc
|
cfbc5c2f1c798991715a6b06bb3ce46478c4487c
|
||||||
|
|||||||
2
.github/ci_commit_pins/xla.txt
vendored
2
.github/ci_commit_pins/xla.txt
vendored
@ -1 +1 @@
|
|||||||
94631807d22c09723dd006f7be5beb649d5f88d0
|
c8b09f5f77d6bf6fb7ed7a9aa83e5d8156b3a5e9
|
||||||
|
|||||||
125
.github/copilot-instructions.md
vendored
125
.github/copilot-instructions.md
vendored
@ -1,125 +0,0 @@
|
|||||||
# PyTorch Copilot Instructions
|
|
||||||
|
|
||||||
This is the PyTorch machine learning framework codebase. These instructions help AI agents navigate and contribute effectively.
|
|
||||||
|
|
||||||
## Architecture Overview
|
|
||||||
|
|
||||||
### Core Components
|
|
||||||
|
|
||||||
- **c10/** - Core library (C++-10 compatible) for essential, binary-size-conscious functionality
|
|
||||||
- **aten/** - ATen tensor library (C++), PyTorch's foundation without autograd
|
|
||||||
- `aten/src/ATen/native/` - Modern operator implementations (CPU/CUDA/MPS/sparse)
|
|
||||||
- `aten/src/ATen/native/native_functions.yaml` - **Critical**: Declarative operator registry
|
|
||||||
- **torch/** - Python bindings and public API
|
|
||||||
- `torch/csrc/` - C++ Python bindings (hand-written and generated)
|
|
||||||
- `torch/csrc/autograd/` - Reverse-mode automatic differentiation
|
|
||||||
- `torch/csrc/jit/` - TorchScript JIT compiler
|
|
||||||
- **torchgen/** - Code generation tooling that reads `native_functions.yaml`
|
|
||||||
- **tools/** - Build scripts, autograd derivatives, code generation
|
|
||||||
|
|
||||||
### The Code Generation Workflow
|
|
||||||
|
|
||||||
**Most operator changes require editing `native_functions.yaml`**, not direct C++ files. This YAML file:
|
|
||||||
1. Declares operator signatures, variants (function/method), and dispatch behavior
|
|
||||||
2. Gets processed by `torchgen/` to generate C++/Python bindings
|
|
||||||
3. Produces headers in `build/aten/src/ATen/` during compilation
|
|
||||||
|
|
||||||
Example entry structure:
|
|
||||||
```yaml
|
|
||||||
- func: my_op(Tensor self, Scalar alpha=1) -> Tensor
|
|
||||||
variants: function, method
|
|
||||||
dispatch:
|
|
||||||
CPU: my_op_cpu
|
|
||||||
CUDA: my_op_cuda
|
|
||||||
```
|
|
||||||
|
|
||||||
After editing `native_functions.yaml`, implement kernels in `aten/src/ATen/native/` (see `aten/src/ATen/native/README.md`).
|
|
||||||
|
|
||||||
## Development Workflows
|
|
||||||
|
|
||||||
### Building from Source
|
|
||||||
|
|
||||||
**Never run `setup.py` directly** - use pip with editable install:
|
|
||||||
```bash
|
|
||||||
python -m pip install --no-build-isolation -v -e .
|
|
||||||
```
|
|
||||||
|
|
||||||
Speed up builds:
|
|
||||||
- `DEBUG=1` - Debug symbols with `-g -O0`
|
|
||||||
- `USE_CUDA=0` - Skip CUDA compilation
|
|
||||||
- `BUILD_TEST=0` - Skip C++ test binaries
|
|
||||||
- Install `ninja` (`pip install ninja`) for faster builds
|
|
||||||
- Use `ccache` for incremental compilation caching
|
|
||||||
|
|
||||||
Rebuild specific targets: `(cd build && ninja <target>)`
|
|
||||||
|
|
||||||
### Testing
|
|
||||||
|
|
||||||
**Critical**: DO NOT run entire test suites. Run specific tests only:
|
|
||||||
```bash
|
|
||||||
python test/test_torch.py TestTorch.test_specific_case
|
|
||||||
```
|
|
||||||
|
|
||||||
**Test structure**: All tests use `torch.testing._internal.common_utils`:
|
|
||||||
```python
|
|
||||||
from torch.testing._internal.common_utils import run_tests, TestCase
|
|
||||||
|
|
||||||
class TestFeature(TestCase):
|
|
||||||
def test_something(self):
|
|
||||||
# Use self.assertEqual for tensor comparisons
|
|
||||||
pass
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
run_tests()
|
|
||||||
```
|
|
||||||
|
|
||||||
**For bug fixes**: Create a standalone reproduction script first, verify it fails, then fix and add to appropriate test file.
|
|
||||||
|
|
||||||
### Linting
|
|
||||||
|
|
||||||
Run linter (not pre-commit): `lintrunner -a` (auto-applies fixes)
|
|
||||||
|
|
||||||
## Project-Specific Conventions
|
|
||||||
|
|
||||||
### Memory and Storage
|
|
||||||
- **Storage is never nullptr** (but `StorageImpl.data` may be nullptr for unallocated outputs)
|
|
||||||
- CUDA device info lives in storage objects
|
|
||||||
|
|
||||||
### Python-C++ Integration (`torch/csrc/`)
|
|
||||||
- Always include `Python.h` **first** to avoid `_XOPEN_SOURCE` redefinition errors
|
|
||||||
- Use `pybind11::gil_scoped_acquire` before calling Python API or using `THPObjectPtr`
|
|
||||||
- Wrap entry points with `HANDLE_TH_ERRORS` / `END_HANDLE_TH_ERRORS` for exception conversion
|
|
||||||
|
|
||||||
### Dispatch System
|
|
||||||
- PyTorch uses operator dispatch to route calls to backend-specific kernels
|
|
||||||
- Prefer `CompositeExplicitAutograd` dispatch when writing device-agnostic compound ops
|
|
||||||
- See `aten/src/ATen/native/README.md` for dispatch keyword guidance
|
|
||||||
|
|
||||||
## Git Workflow (AI Agent Specific)
|
|
||||||
|
|
||||||
When preparing PRs from this environment:
|
|
||||||
```bash
|
|
||||||
git stash -u
|
|
||||||
git reset --hard $(cat /tmp/orig_work.txt) # Reset to LOCAL branch
|
|
||||||
git stash pop
|
|
||||||
# Resolve conflicts if necessary
|
|
||||||
```
|
|
||||||
|
|
||||||
## Common Gotchas
|
|
||||||
|
|
||||||
1. **Editing generated files** - If it's in `build/`, don't edit it. Edit the source template or `native_functions.yaml`
|
|
||||||
2. **NVCC template compilation** - NVCC is stricter about C++ than gcc/clang; code working on Linux may fail Windows CI
|
|
||||||
3. **Windows symbol visibility** - Use `TORCH_API` macros for exported symbols (required on Windows, optional on Linux)
|
|
||||||
4. **No internet access** - DO NOT attempt to install dependencies during development
|
|
||||||
|
|
||||||
## Key Files Reference
|
|
||||||
|
|
||||||
- `AGENTS.md` - Instructions specific to AI coding agents
|
|
||||||
- `CONTRIBUTING.md` - Comprehensive human contributor guide
|
|
||||||
- `GLOSSARY.md` - Terminology (ATen, kernels, operations, JIT, TorchScript)
|
|
||||||
- `aten/src/ATen/native/README.md` - Operator implementation guide
|
|
||||||
- `tools/autograd/derivatives.yaml` - Gradient definitions for autograd
|
|
||||||
|
|
||||||
## Performance Debugging
|
|
||||||
|
|
||||||
Use `TORCH_SHOW_CPP_STACKTRACES=1` for C++ traces in Python errors. For profiling, prefer `py-spy` over manual instrumentation.
|
|
||||||
29
.github/labeler.yml
vendored
29
.github/labeler.yml
vendored
@ -91,6 +91,13 @@
|
|||||||
"ciflow/trunk":
|
"ciflow/trunk":
|
||||||
- .ci/docker/ci_commit_pins/triton.txt
|
- .ci/docker/ci_commit_pins/triton.txt
|
||||||
|
|
||||||
|
"oncall: distributed":
|
||||||
|
- torch/csrc/distributed/**
|
||||||
|
- torch/distributed/**
|
||||||
|
- torch/nn/parallel/**
|
||||||
|
- test/distributed/**
|
||||||
|
- torch/testing/_internal/distributed/**
|
||||||
|
|
||||||
"release notes: distributed (checkpoint)":
|
"release notes: distributed (checkpoint)":
|
||||||
- torch/distributed/checkpoint/**
|
- torch/distributed/checkpoint/**
|
||||||
- test/distributed/checkpoint/**
|
- test/distributed/checkpoint/**
|
||||||
@ -131,8 +138,7 @@
|
|||||||
- test/test_matmul_cuda.py
|
- test/test_matmul_cuda.py
|
||||||
- test/test_scaled_matmul_cuda.py
|
- test/test_scaled_matmul_cuda.py
|
||||||
- test/inductor/test_fp8.py
|
- test/inductor/test_fp8.py
|
||||||
- aten/src/ATen/native/cuda/*Blas.cpp
|
- aten/src/ATen/native/cuda/Blas.cpp
|
||||||
- aten/src/ATen/cuda/CUDA*Blas.*
|
|
||||||
- torch/**/*cublas*
|
- torch/**/*cublas*
|
||||||
- torch/_inductor/kernel/mm.py
|
- torch/_inductor/kernel/mm.py
|
||||||
- test/inductor/test_max_autotune.py
|
- test/inductor/test_max_autotune.py
|
||||||
@ -142,8 +148,7 @@
|
|||||||
- test/test_matmul_cuda.py
|
- test/test_matmul_cuda.py
|
||||||
- test/test_scaled_matmul_cuda.py
|
- test/test_scaled_matmul_cuda.py
|
||||||
- test/inductor/test_fp8.py
|
- test/inductor/test_fp8.py
|
||||||
- aten/src/ATen/native/cuda/*Blas.cpp
|
- aten/src/ATen/native/cuda/Blas.cpp
|
||||||
- aten/src/ATen/cuda/CUDA*Blas.*
|
|
||||||
- torch/**/*cublas*
|
- torch/**/*cublas*
|
||||||
- torch/_inductor/kernel/mm.py
|
- torch/_inductor/kernel/mm.py
|
||||||
- test/inductor/test_max_autotune.py
|
- test/inductor/test_max_autotune.py
|
||||||
@ -153,21 +158,7 @@
|
|||||||
- test/test_matmul_cuda.py
|
- test/test_matmul_cuda.py
|
||||||
- test/test_scaled_matmul_cuda.py
|
- test/test_scaled_matmul_cuda.py
|
||||||
- test/inductor/test_fp8.py
|
- test/inductor/test_fp8.py
|
||||||
- aten/src/ATen/native/cuda/*Blas.cpp
|
- aten/src/ATen/native/cuda/Blas.cpp
|
||||||
- aten/src/ATen/cuda/CUDA*Blas.*
|
|
||||||
- torch/_inductor/kernel/mm.py
|
- torch/_inductor/kernel/mm.py
|
||||||
- test/inductor/test_max_autotune.py
|
- test/inductor/test_max_autotune.py
|
||||||
- third_party/fbgemm
|
- third_party/fbgemm
|
||||||
|
|
||||||
"ciflow/mps":
|
|
||||||
- aten/src/ATen/mps/**
|
|
||||||
- aten/src/ATen/native/mps/**
|
|
||||||
- torch/_inductor/codegen/mps.py
|
|
||||||
- test/test_mps.py
|
|
||||||
- test/inductor/test_mps_basic.py
|
|
||||||
|
|
||||||
"ciflow/h100-symm-mem":
|
|
||||||
- torch/csrc/distributed/c10d/symm_mem/**
|
|
||||||
- torch/distributed/_symmetric_memory/**
|
|
||||||
- test/distributed/**/*mem*
|
|
||||||
- test/distributed/**/*mem*/**
|
|
||||||
|
|||||||
1
.github/nitpicks.yml
vendored
1
.github/nitpicks.yml
vendored
@ -10,4 +10,3 @@
|
|||||||
pathFilter:
|
pathFilter:
|
||||||
- 'torch/csrc/inductor/aoti_torch/c/*'
|
- 'torch/csrc/inductor/aoti_torch/c/*'
|
||||||
- 'torch/csrc/inductor/aoti_torch/generated/*'
|
- 'torch/csrc/inductor/aoti_torch/generated/*'
|
||||||
- 'torch/csrc/stable/c/*'
|
|
||||||
|
|||||||
7
.github/pytorch-probot.yml
vendored
7
.github/pytorch-probot.yml
vendored
@ -2,12 +2,11 @@ tracking_issue: 24422
|
|||||||
ciflow_tracking_issue: 64124
|
ciflow_tracking_issue: 64124
|
||||||
ciflow_push_tags:
|
ciflow_push_tags:
|
||||||
- ciflow/b200
|
- ciflow/b200
|
||||||
- ciflow/b200-distributed
|
|
||||||
- ciflow/b200-symm-mem
|
- ciflow/b200-symm-mem
|
||||||
|
- ciflow/b200-distributed
|
||||||
- ciflow/binaries
|
- ciflow/binaries
|
||||||
- ciflow/binaries_libtorch
|
- ciflow/binaries_libtorch
|
||||||
- ciflow/binaries_wheel
|
- ciflow/binaries_wheel
|
||||||
- ciflow/dynamo
|
|
||||||
- ciflow/h100
|
- ciflow/h100
|
||||||
- ciflow/h100-cutlass-backend
|
- ciflow/h100-cutlass-backend
|
||||||
- ciflow/h100-distributed
|
- ciflow/h100-distributed
|
||||||
@ -23,8 +22,6 @@ ciflow_push_tags:
|
|||||||
- ciflow/inductor-perf-test-nightly-xpu
|
- ciflow/inductor-perf-test-nightly-xpu
|
||||||
- ciflow/inductor-periodic
|
- ciflow/inductor-periodic
|
||||||
- ciflow/inductor-rocm
|
- ciflow/inductor-rocm
|
||||||
- ciflow/inductor-rocm-mi200
|
|
||||||
- ciflow/inductor-rocm-mi300
|
|
||||||
- ciflow/linux-aarch64
|
- ciflow/linux-aarch64
|
||||||
- ciflow/mps
|
- ciflow/mps
|
||||||
- ciflow/nightly
|
- ciflow/nightly
|
||||||
@ -36,13 +33,11 @@ ciflow_push_tags:
|
|||||||
- ciflow/quantization-periodic
|
- ciflow/quantization-periodic
|
||||||
- ciflow/riscv64
|
- ciflow/riscv64
|
||||||
- ciflow/rocm
|
- ciflow/rocm
|
||||||
- ciflow/rocm-mi200
|
|
||||||
- ciflow/rocm-mi300
|
- ciflow/rocm-mi300
|
||||||
- ciflow/rocm-mi355
|
- ciflow/rocm-mi355
|
||||||
- ciflow/rocm-navi31
|
- ciflow/rocm-navi31
|
||||||
- ciflow/s390
|
- ciflow/s390
|
||||||
- ciflow/slow
|
- ciflow/slow
|
||||||
- ciflow/slow-rocm-mi200
|
|
||||||
- ciflow/torchbench
|
- ciflow/torchbench
|
||||||
- ciflow/triton_binaries
|
- ciflow/triton_binaries
|
||||||
- ciflow/trunk
|
- ciflow/trunk
|
||||||
|
|||||||
3
.github/scripts/delete_old_branches.py
vendored
3
.github/scripts/delete_old_branches.py
vendored
@ -1,11 +1,10 @@
|
|||||||
# Delete old branches
|
# Delete old branches
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from collections.abc import Callable
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any, Callable
|
||||||
|
|
||||||
from github_utils import gh_fetch_json_dict, gh_graphql
|
from github_utils import gh_fetch_json_dict, gh_graphql
|
||||||
from gitutils import GitRepo
|
from gitutils import GitRepo
|
||||||
|
|||||||
3
.github/scripts/filter_test_configs.py
vendored
3
.github/scripts/filter_test_configs.py
vendored
@ -8,11 +8,10 @@ import re
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
from collections.abc import Callable
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from functools import cache
|
from functools import cache
|
||||||
from logging import info
|
from logging import info
|
||||||
from typing import Any, Optional
|
from typing import Any, Callable, Optional
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|||||||
2
.github/scripts/generate_pytorch_version.py
vendored
2
.github/scripts/generate_pytorch_version.py
vendored
@ -50,7 +50,7 @@ def get_tag() -> str:
|
|||||||
|
|
||||||
def get_base_version() -> str:
|
def get_base_version() -> str:
|
||||||
root = get_pytorch_root()
|
root = get_pytorch_root()
|
||||||
dirty_version = Path(root / "version.txt").read_text().strip()
|
dirty_version = open(root / "version.txt").read().strip()
|
||||||
# Strips trailing a0 from version.txt, not too sure why it's there in the
|
# Strips trailing a0 from version.txt, not too sure why it's there in the
|
||||||
# first place
|
# first place
|
||||||
return re.sub(LEGACY_BASE_VERSION_SUFFIX_PATTERN, "", dirty_version)
|
return re.sub(LEGACY_BASE_VERSION_SUFFIX_PATTERN, "", dirty_version)
|
||||||
|
|||||||
3
.github/scripts/get_workflow_job_id.py
vendored
3
.github/scripts/get_workflow_job_id.py
vendored
@ -11,8 +11,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import urllib
|
import urllib
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from collections.abc import Callable
|
from typing import Any, Callable, Optional
|
||||||
from typing import Any, Optional
|
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
3
.github/scripts/github_utils.py
vendored
3
.github/scripts/github_utils.py
vendored
@ -3,9 +3,8 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import warnings
|
import warnings
|
||||||
from collections.abc import Callable
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, cast, Optional, Union
|
from typing import Any, Callable, cast, Optional, Union
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
|
|||||||
4
.github/scripts/gitutils.py
vendored
4
.github/scripts/gitutils.py
vendored
@ -4,10 +4,10 @@ import os
|
|||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Callable, Iterator
|
from collections.abc import Iterator
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing import Any, cast, Optional, TypeVar, Union
|
from typing import Any, Callable, cast, Optional, TypeVar, Union
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|||||||
3
.github/scripts/lintrunner.sh
vendored
3
.github/scripts/lintrunner.sh
vendored
@ -34,9 +34,6 @@ python3 torch/utils/data/datapipes/gen_pyi.py
|
|||||||
# Also check generated pyi files
|
# Also check generated pyi files
|
||||||
find torch -name '*.pyi' -exec git add --force -- "{}" +
|
find torch -name '*.pyi' -exec git add --force -- "{}" +
|
||||||
|
|
||||||
# Print current environment
|
|
||||||
python3 -m pip freeze
|
|
||||||
|
|
||||||
RC=0
|
RC=0
|
||||||
# Run lintrunner on all files
|
# Run lintrunner on all files
|
||||||
if ! lintrunner --force-color --tee-json=lint.json ${ADDITIONAL_LINTRUNNER_ARGS} 2> /dev/null; then
|
if ! lintrunner --force-color --tee-json=lint.json ${ADDITIONAL_LINTRUNNER_ARGS} 2> /dev/null; then
|
||||||
|
|||||||
4
.github/scripts/trymerge.py
vendored
4
.github/scripts/trymerge.py
vendored
@ -17,12 +17,12 @@ import re
|
|||||||
import time
|
import time
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Callable, Iterable
|
from collections.abc import Iterable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from functools import cache
|
from functools import cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from re import Pattern
|
from re import Pattern
|
||||||
from typing import Any, cast, NamedTuple, Optional
|
from typing import Any, Callable, cast, NamedTuple, Optional
|
||||||
from warnings import warn
|
from warnings import warn
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|||||||
2
.github/workflows/_linux-test.yml
vendored
2
.github/workflows/_linux-test.yml
vendored
@ -326,7 +326,7 @@ jobs:
|
|||||||
SCCACHE_BUCKET: ${{ !contains(matrix.runner, 'b200') && 'ossci-compiler-cache-circleci-v2' || '' }}
|
SCCACHE_BUCKET: ${{ !contains(matrix.runner, 'b200') && 'ossci-compiler-cache-circleci-v2' || '' }}
|
||||||
SCCACHE_REGION: ${{ !contains(matrix.runner, 'b200') && 'us-east-1' || '' }}
|
SCCACHE_REGION: ${{ !contains(matrix.runner, 'b200') && 'us-east-1' || '' }}
|
||||||
SHM_SIZE: ${{ contains(inputs.build-environment, 'cuda') && '2g' || '1g' }}
|
SHM_SIZE: ${{ contains(inputs.build-environment, 'cuda') && '2g' || '1g' }}
|
||||||
DOCKER_IMAGE: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
DOCKER_IMAGE: ${{ inputs.docker-image }}
|
||||||
XLA_CUDA: ${{ contains(inputs.build-environment, 'xla') && '0' || '' }}
|
XLA_CUDA: ${{ contains(inputs.build-environment, 'xla') && '0' || '' }}
|
||||||
XLA_CLANG_CACHE_S3_BUCKET_NAME: ossci-compiler-clang-cache-circleci-xla
|
XLA_CLANG_CACHE_S3_BUCKET_NAME: ossci-compiler-clang-cache-circleci-xla
|
||||||
PYTORCH_TEST_CUDA_MEM_LEAK_CHECK: ${{ matrix.mem_leak_check && '1' || '0' }}
|
PYTORCH_TEST_CUDA_MEM_LEAK_CHECK: ${{ matrix.mem_leak_check && '1' || '0' }}
|
||||||
|
|||||||
4
.github/workflows/_rocm-test.yml
vendored
4
.github/workflows/_rocm-test.yml
vendored
@ -97,8 +97,8 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
ngpu=$(rocminfo | grep -c -E 'Name:.*\sgfx')
|
ngpu=$(rocminfo | grep -c -E 'Name:.*\sgfx')
|
||||||
if [[ $ngpu -lt 2 ]]; then #We are temporarily reducing this down to 2 from 4 so that we can run tests on nodes with less gpus.
|
if [[ $ngpu -lt 4 ]]; then
|
||||||
echo "Error: only $ngpu GPU(s) detected, at least 2 GPUs are needed for distributed jobs"
|
echo "Error: only $ngpu GPU(s) detected, at least 4 GPUs are needed for distributed jobs"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
16
.github/workflows/_xpu-test.yml
vendored
16
.github/workflows/_xpu-test.yml
vendored
@ -344,21 +344,5 @@ jobs:
|
|||||||
if-no-files-found: ignore
|
if-no-files-found: ignore
|
||||||
path: ./**/core.[1-9]*
|
path: ./**/core.[1-9]*
|
||||||
|
|
||||||
- name: Authenticate with AWS
|
|
||||||
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
|
|
||||||
with:
|
|
||||||
role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_upload-benchmark-results
|
|
||||||
# The max duration enforced by the server side
|
|
||||||
role-duration-seconds: 18000
|
|
||||||
aws-region: us-east-1
|
|
||||||
|
|
||||||
- name: Upload the benchmark results
|
|
||||||
uses: pytorch/test-infra/.github/actions/upload-benchmark-results@main
|
|
||||||
with:
|
|
||||||
benchmark-results-dir: test/test-reports
|
|
||||||
dry-run: false
|
|
||||||
schema-version: v3
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Teardown XPU
|
- name: Teardown XPU
|
||||||
uses: ./.github/actions/teardown-xpu
|
uses: ./.github/actions/teardown-xpu
|
||||||
|
|||||||
@ -1,73 +0,0 @@
|
|||||||
name: attention_op_microbenchmark
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- ciflow/op-benchmark/*
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
# Run at 06:00 UTC everyday
|
|
||||||
- cron: 0 7 * * *
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
attn-microbenchmark-build:
|
|
||||||
if: github.repository_owner == 'pytorch'
|
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
|
||||||
with:
|
|
||||||
runner: linux.12xlarge.memory
|
|
||||||
build-environment: linux-jammy-cuda12.8-py3.10-gcc9-sm80
|
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
|
||||||
cuda-arch-list: '8.0 9.0'
|
|
||||||
test-matrix: |
|
|
||||||
{ include: [
|
|
||||||
{ config: "attention_microbenchmark_test", shard: 1, num_shards: 1, runner: "linux.aws.a100" },
|
|
||||||
{ config: "attention_microbenchmark_test", shard: 1, num_shards: 1, runner: "linux.aws.h100" },
|
|
||||||
]}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
attn-microbenchmark-test:
|
|
||||||
name: attn-microbenchmark-test
|
|
||||||
uses: ./.github/workflows/_linux-test.yml
|
|
||||||
needs: attn-microbenchmark-build
|
|
||||||
with:
|
|
||||||
timeout-minutes: 500
|
|
||||||
build-environment: linux-jammy-cuda12.8-py3.10-gcc9-sm80
|
|
||||||
docker-image: ${{ needs.attn-microbenchmark-build.outputs.docker-image }}
|
|
||||||
test-matrix: ${{ needs.attn-microbenchmark-build.outputs.test-matrix }}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
# B200 runner
|
|
||||||
opmicrobenchmark-build-b200:
|
|
||||||
if: github.repository_owner == 'pytorch'
|
|
||||||
name: opmicrobenchmark-build-b200
|
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
|
||||||
with:
|
|
||||||
runner: linux.12xlarge.memory
|
|
||||||
build-environment: linux-jammy-cuda12.8-py3.10-gcc9-sm100
|
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
|
||||||
cuda-arch-list: '10.0'
|
|
||||||
test-matrix: |
|
|
||||||
{ include: [
|
|
||||||
{ config: "operator_microbenchmark_test", shard: 1, num_shards: 1, runner: "linux.dgx.b200" },
|
|
||||||
]}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
opmicrobenchmark-test-b200:
|
|
||||||
name: opmicrobenchmark-test-b200
|
|
||||||
uses: ./.github/workflows/_linux-test.yml
|
|
||||||
needs: opmicrobenchmark-build-b200
|
|
||||||
with:
|
|
||||||
timeout-minutes: 500
|
|
||||||
build-environment: linux-jammy-cuda12.8-py3.10-gcc9-sm100
|
|
||||||
docker-image: ${{ needs.opmicrobenchmark-build-b200.outputs.docker-image }}
|
|
||||||
test-matrix: ${{ needs.opmicrobenchmark-build-b200.outputs.test-matrix }}
|
|
||||||
aws-role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_s3_and_ecr_read_only
|
|
||||||
secrets: inherit
|
|
||||||
32
.github/workflows/docker-builds.yml
vendored
32
.github/workflows/docker-builds.yml
vendored
@ -56,8 +56,6 @@ jobs:
|
|||||||
pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc9,
|
pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc9,
|
||||||
pytorch-linux-jammy-cuda12.4-cudnn9-py3-gcc11,
|
pytorch-linux-jammy-cuda12.4-cudnn9-py3-gcc11,
|
||||||
pytorch-linux-jammy-py3.10-clang12,
|
pytorch-linux-jammy-py3.10-clang12,
|
||||||
pytorch-linux-jammy-py3.11-clang12,
|
|
||||||
pytorch-linux-jammy-py3.12-clang12,
|
|
||||||
pytorch-linux-jammy-py3.13-clang12,
|
pytorch-linux-jammy-py3.13-clang12,
|
||||||
pytorch-linux-jammy-py3.14-clang12,
|
pytorch-linux-jammy-py3.14-clang12,
|
||||||
pytorch-linux-jammy-rocm-n-py3,
|
pytorch-linux-jammy-rocm-n-py3,
|
||||||
@ -67,25 +65,21 @@ jobs:
|
|||||||
pytorch-linux-jammy-py3.10-gcc11,
|
pytorch-linux-jammy-py3.10-gcc11,
|
||||||
pytorch-linux-jammy-py3-gcc11-inductor-benchmarks,
|
pytorch-linux-jammy-py3-gcc11-inductor-benchmarks,
|
||||||
pytorch-linux-jammy-py3.12-halide,
|
pytorch-linux-jammy-py3.12-halide,
|
||||||
pytorch-linux-jammy-cuda12.8-py3.12-pallas,
|
|
||||||
pytorch-linux-jammy-xpu-n-1-py3,
|
pytorch-linux-jammy-xpu-n-1-py3,
|
||||||
pytorch-linux-noble-xpu-n-py3,
|
pytorch-linux-jammy-xpu-n-py3,
|
||||||
pytorch-linux-noble-xpu-n-py3-inductor-benchmarks,
|
pytorch-linux-jammy-xpu-n-py3-inductor-benchmarks,
|
||||||
pytorch-linux-jammy-py3-clang18-asan,
|
pytorch-linux-jammy-py3-clang18-asan,
|
||||||
pytorch-linux-jammy-py3-clang12-onnx,
|
pytorch-linux-jammy-py3-clang12-onnx,
|
||||||
pytorch-linux-jammy-linter,
|
pytorch-linux-jammy-linter,
|
||||||
pytorch-linux-jammy-cuda12.8-cudnn9-py3.10-linter,
|
pytorch-linux-jammy-cuda12.8-cudnn9-py3.10-linter,
|
||||||
# TODO: Re-enable me when docker pin update happens
|
pytorch-linux-jammy-py3-clang12-executorch,
|
||||||
# pytorch-linux-jammy-py3-clang12-executorch,
|
|
||||||
pytorch-linux-jammy-py3.12-triton-cpu,
|
pytorch-linux-jammy-py3.12-triton-cpu,
|
||||||
pytorch-linux-noble-riscv64-py3.12-gcc14
|
pytorch-linux-noble-riscv64-py3.12-gcc14
|
||||||
]
|
]
|
||||||
include:
|
include:
|
||||||
- docker-image-name: pytorch-linux-jammy-aarch64-py3.10-gcc13
|
- docker-image-name: pytorch-linux-jammy-aarch64-py3.10-gcc11
|
||||||
runner: linux.arm64.m7g.4xlarge
|
runner: linux.arm64.m7g.4xlarge
|
||||||
- docker-image-name: pytorch-linux-jammy-aarch64-py3.10-clang21
|
- docker-image-name: pytorch-linux-jammy-aarch64-py3.10-gcc11-inductor-benchmarks
|
||||||
runner: linux.arm64.m7g.4xlarge
|
|
||||||
- docker-image-name: pytorch-linux-jammy-aarch64-py3.10-gcc13-inductor-benchmarks
|
|
||||||
runner: linux.arm64.m7g.4xlarge
|
runner: linux.arm64.m7g.4xlarge
|
||||||
timeout-minutes: 600
|
timeout-minutes: 600
|
||||||
# Docker uploads fail from LF runners, see https://github.com/pytorch/pytorch/pull/137358
|
# Docker uploads fail from LF runners, see https://github.com/pytorch/pytorch/pull/137358
|
||||||
@ -120,22 +114,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
docker-image: ${{ steps.build-docker-image.outputs.docker-image }}
|
docker-image: ${{ steps.build-docker-image.outputs.docker-image }}
|
||||||
|
|
||||||
- name: Generate output
|
|
||||||
if: contains(matrix.docker-image-name, 'rocm')
|
|
||||||
id: generate_output
|
|
||||||
run: |
|
|
||||||
docker_image_name="${{ matrix.docker-image-name }}"
|
|
||||||
docker_image_tag="${{ steps.build-docker-image.outputs.docker-image }}"
|
|
||||||
echo "${docker_image_name}=${docker_image_tag}" >> docker-builds-output-${docker_image_name}.txt
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@v4.4.0
|
|
||||||
if: contains(matrix.docker-image-name, 'rocm')
|
|
||||||
with:
|
|
||||||
name: docker-builds-artifacts-${{ matrix.docker-image-name }}
|
|
||||||
retention-days: 14
|
|
||||||
path: ./docker-builds-output-${{ matrix.docker-image-name }}.txt
|
|
||||||
|
|
||||||
- uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
|
- uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
|
||||||
name: Push to https://ghcr.io/
|
name: Push to https://ghcr.io/
|
||||||
id: push-to-ghcr-io
|
id: push-to-ghcr-io
|
||||||
|
|||||||
55
.github/workflows/docker-cache-mi300.yml
vendored
Normal file
55
.github/workflows/docker-cache-mi300.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
name: docker-cache-mi300
|
||||||
|
|
||||||
|
on:
|
||||||
|
# run every 6 hours
|
||||||
|
schedule:
|
||||||
|
- cron: 0 0,6,12,18 * * *
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker-cache:
|
||||||
|
if: github.repository_owner == 'pytorch'
|
||||||
|
runs-on: rocm-docker
|
||||||
|
steps:
|
||||||
|
- name: Checkout PyTorch
|
||||||
|
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main
|
||||||
|
with:
|
||||||
|
no-sudo: true
|
||||||
|
|
||||||
|
- name: configure aws credentials
|
||||||
|
id: aws_creds
|
||||||
|
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
|
||||||
|
with:
|
||||||
|
role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_s3_and_ecr_read_only
|
||||||
|
aws-region: us-east-1
|
||||||
|
role-duration-seconds: 18000
|
||||||
|
|
||||||
|
- name: Login to Amazon ECR
|
||||||
|
id: login-ecr
|
||||||
|
continue-on-error: false
|
||||||
|
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
|
||||||
|
|
||||||
|
- name: Calculate docker image
|
||||||
|
id: calculate-docker-image
|
||||||
|
uses: pytorch/test-infra/.github/actions/calculate-docker-image@main
|
||||||
|
with:
|
||||||
|
docker-image-name: ci-image:pytorch-linux-jammy-rocm-n-py3
|
||||||
|
push: false
|
||||||
|
|
||||||
|
- name: Pull docker image
|
||||||
|
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
||||||
|
with:
|
||||||
|
docker-image: ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||||
|
|
||||||
|
- name: Tar and upload to S3 bucket
|
||||||
|
run: |
|
||||||
|
sudo docker save -o ~/docker-data/pytorch/pytorch_docker_image.tar ${{ steps.calculate-docker-image.outputs.docker-image }}
|
||||||
|
sudo rclone copy -P --s3-upload-concurrency 64 --s3-chunk-size 200M --s3-upload-cutoff 300M ~/docker-data/pytorch/pytorch_docker_image.tar oci:pytorchbucket0002/pytorch_docker_image --progress
|
||||||
105
.github/workflows/docker-cache-rocm.yml
vendored
105
.github/workflows/docker-cache-rocm.yml
vendored
@ -1,105 +0,0 @@
|
|||||||
name: docker-cache-rocm
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_run:
|
|
||||||
workflows: [docker-builds]
|
|
||||||
branches: [main, release]
|
|
||||||
types:
|
|
||||||
- completed
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
actions: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
download-docker-builds-artifacts:
|
|
||||||
if: github.repository_owner == 'pytorch'
|
|
||||||
name: download-docker-builds-artifacts
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
pytorch-linux-jammy-rocm-n-py3: ${{ steps.process-artifacts.outputs.pytorch-linux-jammy-rocm-n-py3 }}
|
|
||||||
pytorch-linux-noble-rocm-n-py3: ${{ steps.process-artifacts.outputs.pytorch-linux-noble-rocm-n-py3 }}
|
|
||||||
pytorch-linux-jammy-rocm-n-py3-benchmarks: ${{ steps.process-artifacts.outputs.pytorch-linux-jammy-rocm-n-py3-benchmarks }}
|
|
||||||
steps:
|
|
||||||
- name: Download artifacts
|
|
||||||
uses: actions/download-artifact@v4.1.7
|
|
||||||
with:
|
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
|
||||||
path: ./docker-builds-artifacts
|
|
||||||
merge-multiple: true
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Process artifacts
|
|
||||||
id: process-artifacts
|
|
||||||
run: |
|
|
||||||
ls -R ./docker-builds-artifacts
|
|
||||||
cat ./docker-builds-artifacts/*txt >> "${GITHUB_OUTPUT}"
|
|
||||||
cat "${GITHUB_OUTPUT}"
|
|
||||||
|
|
||||||
docker-cache:
|
|
||||||
if: github.repository_owner == 'pytorch'
|
|
||||||
needs: download-docker-builds-artifacts
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
runner: [linux.rocm.gfx942.docker-cache]
|
|
||||||
docker-image: [
|
|
||||||
"${{ needs.download-docker-builds-artifacts.outputs.pytorch-linux-jammy-rocm-n-py3 }}",
|
|
||||||
"${{ needs.download-docker-builds-artifacts.outputs.pytorch-linux-noble-rocm-n-py3 }}",
|
|
||||||
"${{ needs.download-docker-builds-artifacts.outputs.pytorch-linux-jammy-rocm-n-py3-benchmarks }}"
|
|
||||||
]
|
|
||||||
runs-on: "${{ matrix.runner }}"
|
|
||||||
steps:
|
|
||||||
- name: debug
|
|
||||||
run: |
|
|
||||||
JSON_STRINGIFIED="${{ toJSON(needs.download-docker-builds-artifacts.outputs) }}"
|
|
||||||
echo "Outputs of download-docker-builds-artifacts job: ${JSON_STRINGIFIED}"
|
|
||||||
|
|
||||||
- name: configure aws credentials
|
|
||||||
id: aws_creds
|
|
||||||
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
|
|
||||||
with:
|
|
||||||
role-to-assume: arn:aws:iam::308535385114:role/gha_workflow_s3_and_ecr_read_only
|
|
||||||
aws-region: us-east-1
|
|
||||||
role-duration-seconds: 18000
|
|
||||||
|
|
||||||
- name: Login to Amazon ECR
|
|
||||||
id: login-ecr
|
|
||||||
continue-on-error: false
|
|
||||||
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
|
|
||||||
|
|
||||||
- name: Generate ghrc.io tag
|
|
||||||
id: ghcr-io-tag
|
|
||||||
run: |
|
|
||||||
ecr_image="${{ matrix.docker-image }}"
|
|
||||||
ghcr_image="ghcr.io/pytorch/ci-image:${ecr_image##*:}"
|
|
||||||
echo "ghcr_image=${ghcr_image}" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Pull docker image
|
|
||||||
uses: pytorch/test-infra/.github/actions/pull-docker-image@main
|
|
||||||
with:
|
|
||||||
docker-image: ${{ steps.ghcr-io-tag.outputs.ghcr_image }}
|
|
||||||
|
|
||||||
- name: Save as tarball
|
|
||||||
run: |
|
|
||||||
docker_image_tag=${{ matrix.docker-image }}
|
|
||||||
docker_image_tag="${docker_image_tag#*:}" # Remove everything before and including first ":"
|
|
||||||
docker_image_tag="${docker_image_tag%-*}" # Remove everything after and including last "-"
|
|
||||||
ref_name=${{ github.event.workflow_run.head_branch }}
|
|
||||||
if [[ $ref_name =~ "release/" ]]; then
|
|
||||||
ref_suffix="release"
|
|
||||||
elif [[ $ref_name == "main" ]]; then
|
|
||||||
ref_suffix="main"
|
|
||||||
else
|
|
||||||
echo "Unexpected branch in ref_name: ${ref_name}" && exit 1
|
|
||||||
fi
|
|
||||||
docker tag ${{ steps.ghcr-io-tag.outputs.ghcr_image }} ${{ matrix.docker-image }}
|
|
||||||
# mv is atomic operation, so we use intermediate tar.tmp file to prevent read-write contention
|
|
||||||
docker save -o ~/pytorch-data/docker/${docker_image_tag}.tar.tmp ${{ matrix.docker-image }}
|
|
||||||
mv ~/pytorch-data/docker/${docker_image_tag}.tar.tmp ~/pytorch-data/docker/${docker_image_tag}_${ref_suffix}.tar
|
|
||||||
70
.github/workflows/dynamo-unittest.yml
vendored
70
.github/workflows/dynamo-unittest.yml
vendored
@ -1,70 +0,0 @@
|
|||||||
# Workflow: Dynamo Unit Test
|
|
||||||
# runs unit tests for dynamo.
|
|
||||||
name: dynamo-unittest
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- ciflow/dynamo/*
|
|
||||||
workflow_call:
|
|
||||||
schedule:
|
|
||||||
- cron: 29 8 * * * # about 1:29am PDT
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
get-label-type:
|
|
||||||
name: get-label-type
|
|
||||||
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
|
|
||||||
if: ${{ (github.event_name != 'schedule' || github.repository == 'pytorch/pytorch') && github.repository_owner == 'pytorch' }}
|
|
||||||
with:
|
|
||||||
triggering_actor: ${{ github.triggering_actor }}
|
|
||||||
issue_owner: ${{ github.event.pull_request.user.login || github.event.issue.user.login }}
|
|
||||||
curr_branch: ${{ github.head_ref || github.ref_name }}
|
|
||||||
curr_ref_type: ${{ github.ref_type }}
|
|
||||||
opt_out_experiments: lf
|
|
||||||
|
|
||||||
dynamo-build:
|
|
||||||
name: dynamo-build
|
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
|
||||||
needs: get-label-type
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: ['3.11', '3.12']
|
|
||||||
with:
|
|
||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
|
||||||
build-environment: linux-jammy-py${{ matrix.python-version }}-clang12
|
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-py${{ matrix.python-version }}-clang12
|
|
||||||
test-matrix: |
|
|
||||||
{ include: [
|
|
||||||
{ config: "dynamo_core", shard: 1, num_shards: 1, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
|
||||||
{ config: "dynamo_wrapped", shard: 1, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
|
||||||
{ config: "dynamo_wrapped", shard: 2, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
|
||||||
{ config: "dynamo_wrapped", shard: 3, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
|
||||||
]}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
dynamo-test:
|
|
||||||
name: dynamo-test
|
|
||||||
uses: ./.github/workflows/_linux-test.yml
|
|
||||||
needs: [get-label-type, dynamo-build]
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: ['3.11', '3.12']
|
|
||||||
with:
|
|
||||||
build-environment: linux-jammy-py${{ matrix.python-version }}-clang12
|
|
||||||
docker-image: ci-image:pytorch-linux-jammy-py${{ matrix.python-version }}-clang12
|
|
||||||
test-matrix: |
|
|
||||||
{ include: [
|
|
||||||
{ config: "dynamo_core", shard: 1, num_shards: 1, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
|
||||||
{ config: "dynamo_wrapped", shard: 1, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
|
||||||
{ config: "dynamo_wrapped", shard: 2, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
|
||||||
{ config: "dynamo_wrapped", shard: 3, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
|
||||||
]}
|
|
||||||
secrets: inherit
|
|
||||||
1
.github/workflows/h100-distributed.yml
vendored
1
.github/workflows/h100-distributed.yml
vendored
@ -37,6 +37,7 @@ jobs:
|
|||||||
needs: get-label-type
|
needs: get-label-type
|
||||||
with:
|
with:
|
||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||||
|
runner: "linux.c7i.12xlarge"
|
||||||
build-environment: linux-jammy-cuda12.8-py3.10-gcc11-sm90-dist
|
build-environment: linux-jammy-cuda12.8-py3.10-gcc11-sm90-dist
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||||
cuda-arch-list: '9.0'
|
cuda-arch-list: '9.0'
|
||||||
|
|||||||
@ -72,7 +72,7 @@ jobs:
|
|||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||||
runner: linux.arm64.m7g.4xlarge
|
runner: linux.arm64.m7g.4xlarge
|
||||||
build-environment: linux-jammy-aarch64-py3.10
|
build-environment: linux-jammy-aarch64-py3.10
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-aarch64-py3.10-gcc13-inductor-benchmarks
|
docker-image-name: ci-image:pytorch-linux-jammy-aarch64-py3.10-gcc11-inductor-benchmarks
|
||||||
test-matrix: |
|
test-matrix: |
|
||||||
{ include: [
|
{ include: [
|
||||||
{ config: "inductor_huggingface_perf_cpu_aarch64", shard: 1, num_shards: 9, runner: "linux.arm64.m7g.metal" },
|
{ config: "inductor_huggingface_perf_cpu_aarch64", shard: 1, num_shards: 9, runner: "linux.arm64.m7g.metal" },
|
||||||
|
|||||||
@ -83,8 +83,8 @@ jobs:
|
|||||||
needs: get-label-type
|
needs: get-label-type
|
||||||
with:
|
with:
|
||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||||
build-environment: linux-noble-xpu-n-py3.10
|
build-environment: linux-jammy-xpu-n-py3.10
|
||||||
docker-image-name: ci-image:pytorch-linux-noble-xpu-n-py3-inductor-benchmarks
|
docker-image-name: ci-image:pytorch-linux-jammy-xpu-n-py3-inductor-benchmarks
|
||||||
runner: linux.c7i.12xlarge
|
runner: linux.c7i.12xlarge
|
||||||
test-matrix: |
|
test-matrix: |
|
||||||
{ include: [
|
{ include: [
|
||||||
@ -117,7 +117,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/_xpu-test.yml
|
uses: ./.github/workflows/_xpu-test.yml
|
||||||
needs: xpu-n-py3_10-inductor-benchmark-build
|
needs: xpu-n-py3_10-inductor-benchmark-build
|
||||||
with:
|
with:
|
||||||
build-environment: linux-noble-xpu-n-py3.10
|
build-environment: linux-jammy-xpu-n-py3.10
|
||||||
dashboard-tag: training-true-inference-true-default-true-dynamic-true-cudagraphs-false-cppwrapper-true-aotinductor-true-freezing_cudagraphs-false-cudagraphs_low_precision-false
|
dashboard-tag: training-true-inference-true-default-true-dynamic-true-cudagraphs-false-cppwrapper-true-aotinductor-true-freezing_cudagraphs-false-cudagraphs_low_precision-false
|
||||||
docker-image: ${{ needs.xpu-n-py3_10-inductor-benchmark-build.outputs.docker-image }}
|
docker-image: ${{ needs.xpu-n-py3_10-inductor-benchmark-build.outputs.docker-image }}
|
||||||
test-matrix: ${{ needs.xpu-n-py3_10-inductor-benchmark-build.outputs.test-matrix }}
|
test-matrix: ${{ needs.xpu-n-py3_10-inductor-benchmark-build.outputs.test-matrix }}
|
||||||
@ -137,7 +137,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/_xpu-test.yml
|
uses: ./.github/workflows/_xpu-test.yml
|
||||||
needs: xpu-n-py3_10-inductor-benchmark-build
|
needs: xpu-n-py3_10-inductor-benchmark-build
|
||||||
with:
|
with:
|
||||||
build-environment: linux-noble-xpu-n-py3.10
|
build-environment: linux-jammy-xpu-n-py3.10
|
||||||
dashboard-tag: training-${{ inputs.training }}-inference-${{ inputs.inference }}-default-${{ inputs.default }}-dynamic-${{ inputs.dynamic }}-cudagraphs-${{ inputs.cudagraphs }}-cppwrapper-${{ inputs.cppwrapper }}-aotinductor-${{ inputs.aotinductor }}-maxautotune-${{ inputs.maxautotune }}-freezing_cudagraphs-${{ inputs.freezing_cudagraphs }}-cudagraphs_low_precision-${{ inputs.cudagraphs }}
|
dashboard-tag: training-${{ inputs.training }}-inference-${{ inputs.inference }}-default-${{ inputs.default }}-dynamic-${{ inputs.dynamic }}-cudagraphs-${{ inputs.cudagraphs }}-cppwrapper-${{ inputs.cppwrapper }}-aotinductor-${{ inputs.aotinductor }}-maxautotune-${{ inputs.maxautotune }}-freezing_cudagraphs-${{ inputs.freezing_cudagraphs }}-cudagraphs_low_precision-${{ inputs.cudagraphs }}
|
||||||
docker-image: ${{ needs.xpu-n-py3_10-inductor-benchmark-build.outputs.docker-image }}
|
docker-image: ${{ needs.xpu-n-py3_10-inductor-benchmark-build.outputs.docker-image }}
|
||||||
test-matrix: ${{ needs.xpu-n-py3_10-inductor-benchmark-build.outputs.test-matrix }}
|
test-matrix: ${{ needs.xpu-n-py3_10-inductor-benchmark-build.outputs.test-matrix }}
|
||||||
|
|||||||
1
.github/workflows/inductor-rocm-mi300.yml
vendored
1
.github/workflows/inductor-rocm-mi300.yml
vendored
@ -7,7 +7,6 @@ on:
|
|||||||
- release/*
|
- release/*
|
||||||
tags:
|
tags:
|
||||||
- ciflow/inductor-rocm/*
|
- ciflow/inductor-rocm/*
|
||||||
- ciflow/inductor-rocm-mi300/*
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
name: inductor-rocm-mi200
|
name: inductor-rocm
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: 0 */3 * * *
|
- cron: 0 * * * *
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- release/*
|
- release/*
|
||||||
tags:
|
tags:
|
||||||
- ciflow/inductor-rocm-mi200/*
|
- ciflow/inductor-rocm/*
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
26
.github/workflows/inductor-unittest.yml
vendored
26
.github/workflows/inductor-unittest.yml
vendored
@ -81,32 +81,6 @@ jobs:
|
|||||||
test-matrix: ${{ needs.inductor-halide-build.outputs.test-matrix }}
|
test-matrix: ${{ needs.inductor-halide-build.outputs.test-matrix }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
inductor-pallas-build:
|
|
||||||
name: inductor-pallas-build
|
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
|
||||||
needs: get-label-type
|
|
||||||
with:
|
|
||||||
build-environment: linux-jammy-cuda12.8-py3.12-gcc11
|
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-py3.12-pallas
|
|
||||||
cuda-arch-list: '8.9'
|
|
||||||
runner: linux.8xlarge.memory
|
|
||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
|
||||||
test-matrix: |
|
|
||||||
{ include: [
|
|
||||||
{ config: "inductor-pallas", shard: 1, num_shards: 1, runner: "${{ needs.get-label-type.outputs.label-type }}linux.g5.12xlarge.nvidia.gpu" },
|
|
||||||
]}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
inductor-pallas-test:
|
|
||||||
name: inductor-pallas-test
|
|
||||||
uses: ./.github/workflows/_linux-test.yml
|
|
||||||
needs: inductor-pallas-build
|
|
||||||
with:
|
|
||||||
build-environment: linux-jammy-py3.12-gcc11
|
|
||||||
docker-image: ${{ needs.inductor-pallas-build.outputs.docker-image }}
|
|
||||||
test-matrix: ${{ needs.inductor-pallas-build.outputs.test-matrix }}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
inductor-triton-cpu-build:
|
inductor-triton-cpu-build:
|
||||||
name: inductor-triton-cpu-build
|
name: inductor-triton-cpu-build
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
uses: ./.github/workflows/_linux-build.yml
|
||||||
|
|||||||
2
.github/workflows/linux-aarch64.yml
vendored
2
.github/workflows/linux-aarch64.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
runner_prefix: ${{ needs.get-label-type.outputs.label-type }}
|
runner_prefix: ${{ needs.get-label-type.outputs.label-type }}
|
||||||
build-environment: linux-jammy-aarch64-py3.10
|
build-environment: linux-jammy-aarch64-py3.10
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-aarch64-py3.10-gcc13
|
docker-image-name: ci-image:pytorch-linux-jammy-aarch64-py3.10-gcc11
|
||||||
runner: linux.arm64.m7g.4xlarge
|
runner: linux.arm64.m7g.4xlarge
|
||||||
test-matrix: |
|
test-matrix: |
|
||||||
{ include: [
|
{ include: [
|
||||||
|
|||||||
8
.github/workflows/nightly.yml
vendored
8
.github/workflows/nightly.yml
vendored
@ -5,11 +5,9 @@ on:
|
|||||||
- cron: 0 0 * * *
|
- cron: 0 0 * * *
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
# NOTE: Doc build pipelines should only get triggered on:
|
# NOTE: Doc build pipelines should only get triggered on release candidate builds
|
||||||
# Major or minor release candidates builds
|
# Release candidate tags look like: v1.11.0-rc1
|
||||||
- v[0-9]+.[0-9]+.0+-rc[0-9]+
|
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
|
||||||
# Final RC for major, minor and patch releases
|
|
||||||
- v[0-9]+.[0-9]+.[0-9]+
|
|
||||||
- ciflow/nightly/*
|
- ciflow/nightly/*
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/operator_benchmark.yml
vendored
2
.github/workflows/operator_benchmark.yml
vendored
@ -60,7 +60,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
build-environment: linux-jammy-aarch64-py3.10
|
build-environment: linux-jammy-aarch64-py3.10
|
||||||
runner: linux.arm64.m7g.4xlarge
|
runner: linux.arm64.m7g.4xlarge
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-aarch64-py3.10-gcc13
|
docker-image-name: ci-image:pytorch-linux-jammy-aarch64-py3.10-gcc11
|
||||||
test-matrix: |
|
test-matrix: |
|
||||||
{ include: [
|
{ include: [
|
||||||
{ config: "cpu_operator_benchmark_short", shard: 1, num_shards: 1, runner: "linux.arm64.m8g.4xlarge" },
|
{ config: "cpu_operator_benchmark_short", shard: 1, num_shards: 1, runner: "linux.arm64.m8g.4xlarge" },
|
||||||
|
|||||||
1
.github/workflows/periodic-rocm-mi200.yml
vendored
1
.github/workflows/periodic-rocm-mi200.yml
vendored
@ -11,6 +11,7 @@ on:
|
|||||||
- cron: 29 8 * * * # about 1:29am PDT, for mem leak check and rerun disabled tests
|
- cron: 29 8 * * * # about 1:29am PDT, for mem leak check and rerun disabled tests
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
|
- ciflow/periodic/*
|
||||||
- ciflow/periodic-rocm-mi200/*
|
- ciflow/periodic-rocm-mi200/*
|
||||||
branches:
|
branches:
|
||||||
- release/*
|
- release/*
|
||||||
|
|||||||
1
.github/workflows/periodic-rocm-mi300.yml
vendored
1
.github/workflows/periodic-rocm-mi300.yml
vendored
@ -11,7 +11,6 @@ on:
|
|||||||
- cron: 29 8 * * * # about 1:29am PDT, for mem leak check and rerun disabled tests
|
- cron: 29 8 * * * # about 1:29am PDT, for mem leak check and rerun disabled tests
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- ciflow/periodic/*
|
|
||||||
- ciflow/periodic-rocm-mi300/*
|
- ciflow/periodic-rocm-mi300/*
|
||||||
branches:
|
branches:
|
||||||
- release/*
|
- release/*
|
||||||
|
|||||||
9
.github/workflows/pull.yml
vendored
9
.github/workflows/pull.yml
vendored
@ -70,7 +70,6 @@ jobs:
|
|||||||
{ config: "distributed", shard: 1, num_shards: 2, runner: "${{ needs.get-label-type.outputs.label-type }}linux.2xlarge" },
|
{ config: "distributed", shard: 1, num_shards: 2, runner: "${{ needs.get-label-type.outputs.label-type }}linux.2xlarge" },
|
||||||
{ config: "distributed", shard: 2, num_shards: 2, runner: "${{ needs.get-label-type.outputs.label-type }}linux.2xlarge" },
|
{ config: "distributed", shard: 2, num_shards: 2, runner: "${{ needs.get-label-type.outputs.label-type }}linux.2xlarge" },
|
||||||
{ config: "numpy_2_x", shard: 1, num_shards: 1, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
{ config: "numpy_2_x", shard: 1, num_shards: 1, runner: "${{ needs.get-label-type.outputs.label-type }}linux.c7i.2xlarge" },
|
||||||
{ config: "libtorch_agnostic_targetting", shard: 1, num_shards: 1, runner: "${{ needs.get-label-type.outputs.label-type }}linux.2xlarge" },
|
|
||||||
]}
|
]}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
@ -343,16 +342,16 @@ jobs:
|
|||||||
test-matrix: ${{ needs.linux-jammy-cuda12_8-py3_10-gcc9-inductor-build.outputs.test-matrix }}
|
test-matrix: ${{ needs.linux-jammy-cuda12_8-py3_10-gcc9-inductor-build.outputs.test-matrix }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
linux-noble-xpu-n-py3_10-build:
|
linux-jammy-xpu-n-py3_10-build:
|
||||||
name: linux-noble-xpu-n-py3.10
|
name: linux-jammy-xpu-n-py3.10
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
uses: ./.github/workflows/_linux-build.yml
|
||||||
needs: get-label-type
|
needs: get-label-type
|
||||||
with:
|
with:
|
||||||
# This should sync with the build in xpu.yml but xpu uses a larger runner
|
# This should sync with the build in xpu.yml but xpu uses a larger runner
|
||||||
# sync-tag: linux-xpu-n-build
|
# sync-tag: linux-xpu-n-build
|
||||||
runner_prefix: ${{ needs.get-label-type.outputs.label-type }}
|
runner_prefix: ${{ needs.get-label-type.outputs.label-type }}
|
||||||
build-environment: linux-noble-xpu-n-py3.10
|
build-environment: linux-jammy-xpu-n-py3.10
|
||||||
docker-image-name: ci-image:pytorch-linux-noble-xpu-n-py3
|
docker-image-name: ci-image:pytorch-linux-jammy-xpu-n-py3
|
||||||
test-matrix: |
|
test-matrix: |
|
||||||
{ include: [
|
{ include: [
|
||||||
{ config: "default", shard: 1, num_shards: 4, runner: "linux.idc.xpu" },
|
{ config: "default", shard: 1, num_shards: 4, runner: "linux.idc.xpu" },
|
||||||
|
|||||||
1
.github/workflows/rocm-mi300.yml
vendored
1
.github/workflows/rocm-mi300.yml
vendored
@ -6,7 +6,6 @@ on:
|
|||||||
- main
|
- main
|
||||||
- release/*
|
- release/*
|
||||||
tags:
|
tags:
|
||||||
- ciflow/rocm/*
|
|
||||||
- ciflow/rocm-mi300/*
|
- ciflow/rocm-mi300/*
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
|
|||||||
@ -1,16 +1,15 @@
|
|||||||
name: rocm-mi200
|
name: rocm
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- release/*
|
- release/*
|
||||||
tags:
|
tags:
|
||||||
- ciflow/rocm-mi200/*
|
- ciflow/rocm/*
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: 29 8 * * * # about 1:29am PDT
|
- cron: 29 8 * * * # about 1:29am PDT
|
||||||
- cron: 0 */3 * * *
|
- cron: 0 * * * *
|
||||||
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
|
||||||
81
.github/workflows/slow-rocm-mi200.yml
vendored
81
.github/workflows/slow-rocm-mi200.yml
vendored
@ -1,81 +0,0 @@
|
|||||||
# This workflow is dedicated to host slow jobs that are run only periodically because
|
|
||||||
# they are too slow to run in every commit. The list of slow tests can be found in
|
|
||||||
# https://github.com/pytorch/test-infra/blob/generated-stats/stats/slow-tests.json
|
|
||||||
name: slow-rocm-mi200
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- release/*
|
|
||||||
tags:
|
|
||||||
- ciflow/slow/*
|
|
||||||
- ciflow/slow-rocm-mi200/*
|
|
||||||
schedule:
|
|
||||||
- cron: 0 */3 * * *
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}-${{ github.event.schedule }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
llm-td:
|
|
||||||
if: github.repository_owner == 'pytorch'
|
|
||||||
name: before-test
|
|
||||||
uses: ./.github/workflows/llm_td_retrieval.yml
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
target-determination:
|
|
||||||
name: before-test
|
|
||||||
uses: ./.github/workflows/target_determination.yml
|
|
||||||
needs: llm-td
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
get-label-type:
|
|
||||||
name: get-label-type
|
|
||||||
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
|
|
||||||
if: ${{ (github.event_name != 'schedule' || github.repository == 'pytorch/pytorch') && github.repository_owner == 'pytorch' }}
|
|
||||||
with:
|
|
||||||
triggering_actor: ${{ github.triggering_actor }}
|
|
||||||
issue_owner: ${{ github.event.pull_request.user.login || github.event.issue.user.login }}
|
|
||||||
curr_branch: ${{ github.head_ref || github.ref_name }}
|
|
||||||
curr_ref_type: ${{ github.ref_type }}
|
|
||||||
|
|
||||||
linux-jammy-rocm-py3_10-build:
|
|
||||||
name: linux-jammy-rocm-py3.10
|
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
|
||||||
needs: get-label-type
|
|
||||||
with:
|
|
||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
|
||||||
build-environment: linux-jammy-rocm-py3.10
|
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-rocm-n-py3
|
|
||||||
sync-tag: rocm-build
|
|
||||||
test-matrix: |
|
|
||||||
{ include: [
|
|
||||||
{ config: "slow", shard: 1, num_shards: 2, runner: "linux.rocm.gpu.2", owners: ["module:rocm"] },
|
|
||||||
{ config: "slow", shard: 2, num_shards: 2, runner: "linux.rocm.gpu.2", owners: ["module:rocm"] },
|
|
||||||
]}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
linux-jammy-rocm-py3_10-test:
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
name: linux-jammy-rocm-py3.10
|
|
||||||
uses: ./.github/workflows/_rocm-test.yml
|
|
||||||
needs:
|
|
||||||
- linux-jammy-rocm-py3_10-build
|
|
||||||
- target-determination
|
|
||||||
with:
|
|
||||||
build-environment: linux-jammy-rocm-py3.10
|
|
||||||
docker-image: ${{ needs.linux-jammy-rocm-py3_10-build.outputs.docker-image }}
|
|
||||||
test-matrix: ${{ needs.linux-jammy-rocm-py3_10-build.outputs.test-matrix }}
|
|
||||||
secrets: inherit
|
|
||||||
30
.github/workflows/slow.yml
vendored
30
.github/workflows/slow.yml
vendored
@ -105,6 +105,36 @@ jobs:
|
|||||||
test-matrix: ${{ needs.linux-jammy-py3_10-clang12-build.outputs.test-matrix }}
|
test-matrix: ${{ needs.linux-jammy-py3_10-clang12-build.outputs.test-matrix }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
linux-jammy-rocm-py3_10-build:
|
||||||
|
name: linux-jammy-rocm-py3.10
|
||||||
|
uses: ./.github/workflows/_linux-build.yml
|
||||||
|
needs: get-label-type
|
||||||
|
with:
|
||||||
|
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||||
|
build-environment: linux-jammy-rocm-py3.10
|
||||||
|
docker-image-name: ci-image:pytorch-linux-jammy-rocm-n-py3
|
||||||
|
test-matrix: |
|
||||||
|
{ include: [
|
||||||
|
{ config: "slow", shard: 1, num_shards: 2, runner: "linux.rocm.gpu.2", owners: ["module:rocm"] },
|
||||||
|
{ config: "slow", shard: 2, num_shards: 2, runner: "linux.rocm.gpu.2", owners: ["module:rocm"] },
|
||||||
|
]}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
|
linux-jammy-rocm-py3_10-test:
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
name: linux-jammy-rocm-py3.10
|
||||||
|
uses: ./.github/workflows/_rocm-test.yml
|
||||||
|
needs:
|
||||||
|
- linux-jammy-rocm-py3_10-build
|
||||||
|
- target-determination
|
||||||
|
with:
|
||||||
|
build-environment: linux-jammy-rocm-py3.10
|
||||||
|
docker-image: ${{ needs.linux-jammy-rocm-py3_10-build.outputs.docker-image }}
|
||||||
|
test-matrix: ${{ needs.linux-jammy-rocm-py3_10-build.outputs.test-matrix }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
linux-jammy-py3_10-clang18-asan-build:
|
linux-jammy-py3_10-clang18-asan-build:
|
||||||
name: linux-jammy-py3.10-clang18-asan
|
name: linux-jammy-py3.10-clang18-asan
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
uses: ./.github/workflows/_linux-build.yml
|
||||||
|
|||||||
4
.github/workflows/test-b200.yml
vendored
4
.github/workflows/test-b200.yml
vendored
@ -5,9 +5,7 @@
|
|||||||
# Flow:
|
# Flow:
|
||||||
# 1. Builds PyTorch with CUDA 12.8+ and sm100 architecture for B200
|
# 1. Builds PyTorch with CUDA 12.8+ and sm100 architecture for B200
|
||||||
# 2. Runs smoke tests on linux.dgx.b200 runner
|
# 2. Runs smoke tests on linux.dgx.b200 runner
|
||||||
# 3. Tests executed are defined in .ci/pytorch/test.sh -> test_python_smoke_b200() function
|
# 3. Tests executed are defined in .ci/pytorch/test.sh -> test_python_smoke() function
|
||||||
# - Includes matmul, scaled_matmul, FP8, and FlashAttention CuTe tests
|
|
||||||
# - FlashAttention CuTe DSL is installed as part of test execution
|
|
||||||
#
|
#
|
||||||
# Triggered by:
|
# Triggered by:
|
||||||
# - Pull requests modifying this workflow file
|
# - Pull requests modifying this workflow file
|
||||||
|
|||||||
1
.github/workflows/test-h100.yml
vendored
1
.github/workflows/test-h100.yml
vendored
@ -41,6 +41,7 @@ jobs:
|
|||||||
needs: get-label-type
|
needs: get-label-type
|
||||||
with:
|
with:
|
||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||||
|
runner: linux.12xlarge.memory
|
||||||
build-environment: linux-jammy-cuda12.8-py3.10-gcc11-sm90
|
build-environment: linux-jammy-cuda12.8-py3.10-gcc11-sm90
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
docker-image-name: ci-image:pytorch-linux-jammy-cuda12.8-cudnn9-py3-gcc11
|
||||||
cuda-arch-list: '9.0'
|
cuda-arch-list: '9.0'
|
||||||
|
|||||||
83
.github/workflows/trunk-rocm-mi300.yml
vendored
83
.github/workflows/trunk-rocm-mi300.yml
vendored
@ -1,83 +0,0 @@
|
|||||||
name: trunk-rocm-mi300
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- release/*
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: 29 8 * * * # about 1:29am PDT
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
llm-td:
|
|
||||||
if: github.repository_owner == 'pytorch'
|
|
||||||
name: before-test
|
|
||||||
uses: ./.github/workflows/llm_td_retrieval.yml
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
target-determination:
|
|
||||||
name: before-test
|
|
||||||
uses: ./.github/workflows/target_determination.yml
|
|
||||||
needs: llm-td
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
get-label-type:
|
|
||||||
name: get-label-type
|
|
||||||
uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@main
|
|
||||||
if: ${{ (github.event_name != 'schedule' || github.repository == 'pytorch/pytorch') && github.repository_owner == 'pytorch' }}
|
|
||||||
with:
|
|
||||||
triggering_actor: ${{ github.triggering_actor }}
|
|
||||||
issue_owner: ${{ github.event.pull_request.user.login || github.event.issue.user.login }}
|
|
||||||
curr_branch: ${{ github.head_ref || github.ref_name }}
|
|
||||||
curr_ref_type: ${{ github.ref_type }}
|
|
||||||
|
|
||||||
linux-jammy-rocm-py3_10-build:
|
|
||||||
name: linux-jammy-rocm-py3.10
|
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
|
||||||
needs: get-label-type
|
|
||||||
with:
|
|
||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
|
||||||
build-environment: linux-jammy-rocm-py3.10
|
|
||||||
docker-image-name: ci-image:pytorch-linux-jammy-rocm-n-py3
|
|
||||||
sync-tag: rocm-build
|
|
||||||
test-matrix: |
|
|
||||||
{ include: [
|
|
||||||
{ config: "default", shard: 1, num_shards: 6, runner: "linux.rocm.gpu.gfx942.1.b" },
|
|
||||||
{ config: "default", shard: 2, num_shards: 6, runner: "linux.rocm.gpu.gfx942.1.b" },
|
|
||||||
{ config: "default", shard: 3, num_shards: 6, runner: "linux.rocm.gpu.gfx942.1.b" },
|
|
||||||
{ config: "default", shard: 4, num_shards: 6, runner: "linux.rocm.gpu.gfx942.1.b" },
|
|
||||||
{ config: "default", shard: 5, num_shards: 6, runner: "linux.rocm.gpu.gfx942.1.b" },
|
|
||||||
{ config: "default", shard: 6, num_shards: 6, runner: "linux.rocm.gpu.gfx942.1.b" },
|
|
||||||
{ config: "distributed", shard: 1, num_shards: 3, runner: "linux.rocm.gpu.gfx942.4.b" },
|
|
||||||
{ config: "distributed", shard: 2, num_shards: 3, runner: "linux.rocm.gpu.gfx942.4.b" },
|
|
||||||
{ config: "distributed", shard: 3, num_shards: 3, runner: "linux.rocm.gpu.gfx942.4.b" },
|
|
||||||
]}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
linux-jammy-rocm-py3_10-test:
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
name: linux-jammy-rocm-py3.10
|
|
||||||
uses: ./.github/workflows/_rocm-test.yml
|
|
||||||
needs:
|
|
||||||
- linux-jammy-rocm-py3_10-build
|
|
||||||
- target-determination
|
|
||||||
with:
|
|
||||||
build-environment: linux-jammy-rocm-py3.10
|
|
||||||
docker-image: ${{ needs.linux-jammy-rocm-py3_10-build.outputs.docker-image }}
|
|
||||||
test-matrix: ${{ needs.linux-jammy-rocm-py3_10-build.outputs.test-matrix }}
|
|
||||||
secrets: inherit
|
|
||||||
2
.github/workflows/trunk.yml
vendored
2
.github/workflows/trunk.yml
vendored
@ -83,7 +83,6 @@ jobs:
|
|||||||
{ config: "distributed", shard: 2, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.g4dn.12xlarge.nvidia.gpu" },
|
{ config: "distributed", shard: 2, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.g4dn.12xlarge.nvidia.gpu" },
|
||||||
{ config: "distributed", shard: 3, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.g4dn.12xlarge.nvidia.gpu" },
|
{ config: "distributed", shard: 3, num_shards: 3, runner: "${{ needs.get-label-type.outputs.label-type }}linux.g4dn.12xlarge.nvidia.gpu" },
|
||||||
{ config: "pr_time_benchmarks", shard: 1, num_shards: 1, runner: "linux.g4dn.metal.nvidia.gpu" },
|
{ config: "pr_time_benchmarks", shard: 1, num_shards: 1, runner: "linux.g4dn.metal.nvidia.gpu" },
|
||||||
{ config: "libtorch_agnostic_targetting", shard: 1, num_shards: 1, runner: "linux.g4dn.metal.nvidia.gpu" },
|
|
||||||
]}
|
]}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
@ -283,7 +282,6 @@ jobs:
|
|||||||
name: linux-jammy-py3-clang12-executorch
|
name: linux-jammy-py3-clang12-executorch
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
uses: ./.github/workflows/_linux-build.yml
|
||||||
needs: get-label-type
|
needs: get-label-type
|
||||||
if: false # Has been broken for a while
|
|
||||||
with:
|
with:
|
||||||
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
runner_prefix: "${{ needs.get-label-type.outputs.label-type }}"
|
||||||
build-environment: linux-jammy-py3-clang12-executorch
|
build-environment: linux-jammy-py3-clang12-executorch
|
||||||
|
|||||||
6
.github/workflows/upload-test-stats.yml
vendored
6
.github/workflows/upload-test-stats.yml
vendored
@ -5,23 +5,21 @@ on:
|
|||||||
workflows:
|
workflows:
|
||||||
- pull
|
- pull
|
||||||
- trunk
|
- trunk
|
||||||
- trunk-rocm-mi300
|
|
||||||
- periodic
|
- periodic
|
||||||
- periodic-rocm-mi200
|
- periodic-rocm-mi200
|
||||||
- periodic-rocm-mi300
|
- periodic-rocm-mi300
|
||||||
- inductor
|
- inductor
|
||||||
- unstable
|
- unstable
|
||||||
- slow
|
- slow
|
||||||
- slow-rocm-mi200
|
|
||||||
- unstable-periodic
|
- unstable-periodic
|
||||||
- inductor-periodic
|
- inductor-periodic
|
||||||
- rocm-mi200
|
- rocm
|
||||||
- rocm-mi300
|
- rocm-mi300
|
||||||
- rocm-mi355
|
- rocm-mi355
|
||||||
- inductor-micro-benchmark
|
- inductor-micro-benchmark
|
||||||
- inductor-micro-benchmark-x86
|
- inductor-micro-benchmark-x86
|
||||||
- inductor-cu124
|
- inductor-cu124
|
||||||
- inductor-rocm-mi200
|
- inductor-rocm
|
||||||
- inductor-rocm-mi300
|
- inductor-rocm-mi300
|
||||||
- mac-mps
|
- mac-mps
|
||||||
- linux-aarch64
|
- linux-aarch64
|
||||||
|
|||||||
20
.github/workflows/xpu.yml
vendored
20
.github/workflows/xpu.yml
vendored
@ -47,15 +47,15 @@ jobs:
|
|||||||
]}
|
]}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
linux-noble-xpu-n-py3_10-build:
|
linux-jammy-xpu-n-py3_10-build:
|
||||||
name: linux-noble-xpu-n-py3.10
|
name: linux-jammy-xpu-n-py3.10
|
||||||
uses: ./.github/workflows/_linux-build.yml
|
uses: ./.github/workflows/_linux-build.yml
|
||||||
needs: get-label-type
|
needs: get-label-type
|
||||||
with:
|
with:
|
||||||
sync-tag: linux-xpu-n-build
|
sync-tag: linux-xpu-n-build
|
||||||
runner_prefix: ${{ needs.get-label-type.outputs.label-type }}
|
runner_prefix: ${{ needs.get-label-type.outputs.label-type }}
|
||||||
build-environment: linux-noble-xpu-n-py3.10
|
build-environment: linux-jammy-xpu-n-py3.10
|
||||||
docker-image-name: ci-image:pytorch-linux-noble-xpu-n-py3
|
docker-image-name: ci-image:pytorch-linux-jammy-xpu-n-py3
|
||||||
runner: linux.c7i.12xlarge
|
runner: linux.c7i.12xlarge
|
||||||
test-matrix: |
|
test-matrix: |
|
||||||
{ include: [
|
{ include: [
|
||||||
@ -74,17 +74,17 @@ jobs:
|
|||||||
]}
|
]}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
linux-noble-xpu-n-py3_10-test:
|
linux-jammy-xpu-n-py3_10-test:
|
||||||
name: linux-noble-xpu-n-py3.10
|
name: linux-jammy-xpu-n-py3.10
|
||||||
uses: ./.github/workflows/_xpu-test.yml
|
uses: ./.github/workflows/_xpu-test.yml
|
||||||
needs: linux-noble-xpu-n-py3_10-build
|
needs: linux-jammy-xpu-n-py3_10-build
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
contents: read
|
contents: read
|
||||||
with:
|
with:
|
||||||
build-environment: linux-noble-xpu-n-py3.10
|
build-environment: linux-jammy-xpu-n-py3.10
|
||||||
docker-image: ${{ needs.linux-noble-xpu-n-py3_10-build.outputs.docker-image }}
|
docker-image: ${{ needs.linux-jammy-xpu-n-py3_10-build.outputs.docker-image }}
|
||||||
test-matrix: ${{ needs.linux-noble-xpu-n-py3_10-build.outputs.test-matrix }}
|
test-matrix: ${{ needs.linux-jammy-xpu-n-py3_10-build.outputs.test-matrix }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
windows-xpu-n-1-build:
|
windows-xpu-n-1-build:
|
||||||
|
|||||||
@ -143,8 +143,7 @@ init_command = [
|
|||||||
'tools/linter/adapters/pip_init.py',
|
'tools/linter/adapters/pip_init.py',
|
||||||
'--dry-run={{DRYRUN}}',
|
'--dry-run={{DRYRUN}}',
|
||||||
'numpy==1.26.4 ; python_version >= "3.10" and python_version <= "3.11"',
|
'numpy==1.26.4 ; python_version >= "3.10" and python_version <= "3.11"',
|
||||||
'numpy==2.1.0 ; python_version >= "3.12" and python_version <= "3.13"',
|
'numpy==2.1.0 ; python_version >= "3.12"',
|
||||||
'numpy==2.3.4 ; python_version >= "3.14"',
|
|
||||||
'expecttest==0.3.0',
|
'expecttest==0.3.0',
|
||||||
'pyrefly==0.36.2',
|
'pyrefly==0.36.2',
|
||||||
'sympy==1.13.3',
|
'sympy==1.13.3',
|
||||||
@ -186,8 +185,6 @@ include_patterns = [
|
|||||||
'aten/src/ATen/native/nested/cuda/*.h',
|
'aten/src/ATen/native/nested/cuda/*.h',
|
||||||
'aten/src/ATen/native/nested/*.cpp',
|
'aten/src/ATen/native/nested/*.cpp',
|
||||||
'aten/src/ATen/native/nested/*.h',
|
'aten/src/ATen/native/nested/*.h',
|
||||||
'aten/src/ATen/xpu/**/*.h',
|
|
||||||
'aten/src/ATen/xpu/**/*.cpp',
|
|
||||||
'c10/**/*.cpp',
|
'c10/**/*.cpp',
|
||||||
'c10/**/*.h',
|
'c10/**/*.h',
|
||||||
'torch/*.h',
|
'torch/*.h',
|
||||||
@ -1404,7 +1401,7 @@ init_command = [
|
|||||||
'--dry-run={{DRYRUN}}',
|
'--dry-run={{DRYRUN}}',
|
||||||
'usort==1.0.8.post1',
|
'usort==1.0.8.post1',
|
||||||
'isort==6.0.1',
|
'isort==6.0.1',
|
||||||
'ruff==0.14.4', # sync with RUFF
|
'ruff==0.13.1', # sync with RUFF
|
||||||
]
|
]
|
||||||
is_formatter = true
|
is_formatter = true
|
||||||
|
|
||||||
@ -1539,7 +1536,7 @@ init_command = [
|
|||||||
'python3',
|
'python3',
|
||||||
'tools/linter/adapters/pip_init.py',
|
'tools/linter/adapters/pip_init.py',
|
||||||
'--dry-run={{DRYRUN}}',
|
'--dry-run={{DRYRUN}}',
|
||||||
'ruff==0.14.4', # sync with PYFMT
|
'ruff==0.13.1', # sync with PYFMT
|
||||||
]
|
]
|
||||||
is_formatter = true
|
is_formatter = true
|
||||||
|
|
||||||
|
|||||||
330
.spin/cmds.py
330
.spin/cmds.py
@ -1,330 +0,0 @@
|
|||||||
import hashlib
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import click
|
|
||||||
import spin
|
|
||||||
|
|
||||||
|
|
||||||
def file_digest(file, algorithm: str):
|
|
||||||
try:
|
|
||||||
return hashlib.file_digest(file, algorithm)
|
|
||||||
except AttributeError:
|
|
||||||
pass # Fallback to manual implementation below
|
|
||||||
hash = hashlib.new(algorithm)
|
|
||||||
while chunk := file.read(8192):
|
|
||||||
hash.update(chunk)
|
|
||||||
return hash
|
|
||||||
|
|
||||||
|
|
||||||
def _hash_file(file):
|
|
||||||
with open(file, "rb") as f:
|
|
||||||
hash = file_digest(f, "sha256")
|
|
||||||
return hash.hexdigest()
|
|
||||||
|
|
||||||
|
|
||||||
def _hash_files(files):
|
|
||||||
hashes = {file: _hash_file(file) for file in files}
|
|
||||||
return hashes
|
|
||||||
|
|
||||||
|
|
||||||
def _read_hashes(hash_file: Path):
|
|
||||||
if not hash_file.exists():
|
|
||||||
return {}
|
|
||||||
with hash_file.open("r") as f:
|
|
||||||
lines = f.readlines()
|
|
||||||
hashes = {}
|
|
||||||
for line in lines:
|
|
||||||
hash = line[:64]
|
|
||||||
file = line[66:].strip()
|
|
||||||
hashes[file] = hash
|
|
||||||
return hashes
|
|
||||||
|
|
||||||
|
|
||||||
def _updated_hashes(hash_file, files_to_hash):
|
|
||||||
old_hashes = _read_hashes(hash_file)
|
|
||||||
new_hashes = _hash_files(files_to_hash)
|
|
||||||
if new_hashes != old_hashes:
|
|
||||||
return new_hashes
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
def regenerate_version():
|
|
||||||
"""Regenerate version.py."""
|
|
||||||
cmd = [
|
|
||||||
sys.executable,
|
|
||||||
"-m",
|
|
||||||
"tools.generate_torch_version",
|
|
||||||
"--is-debug=false",
|
|
||||||
]
|
|
||||||
spin.util.run(cmd)
|
|
||||||
|
|
||||||
|
|
||||||
TYPE_STUBS = [
|
|
||||||
(
|
|
||||||
"Pytorch type stubs",
|
|
||||||
Path(".lintbin/.pytorch-type-stubs.sha256"),
|
|
||||||
[
|
|
||||||
"aten/src/ATen/native/native_functions.yaml",
|
|
||||||
"aten/src/ATen/native/tags.yaml",
|
|
||||||
"tools/autograd/deprecated.yaml",
|
|
||||||
],
|
|
||||||
[
|
|
||||||
sys.executable,
|
|
||||||
"-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",
|
|
||||||
],
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"Datapipes type stubs",
|
|
||||||
None,
|
|
||||||
[],
|
|
||||||
[
|
|
||||||
sys.executable,
|
|
||||||
"torch/utils/data/datapipes/gen_pyi.py",
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
def regenerate_type_stubs():
|
|
||||||
"""Regenerate type stubs."""
|
|
||||||
for name, hash_file, files_to_hash, cmd in TYPE_STUBS:
|
|
||||||
if hash_file:
|
|
||||||
if hashes := _updated_hashes(hash_file, files_to_hash):
|
|
||||||
click.echo(
|
|
||||||
f"Changes detected in type stub files for {name}. Regenerating..."
|
|
||||||
)
|
|
||||||
spin.util.run(cmd)
|
|
||||||
hash_file.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
with hash_file.open("w") as f:
|
|
||||||
for file, hash in hashes.items():
|
|
||||||
f.write(f"{hash} {file}\n")
|
|
||||||
click.echo("Type stubs and hashes updated.")
|
|
||||||
else:
|
|
||||||
click.echo(f"No changes detected in type stub files for {name}.")
|
|
||||||
else:
|
|
||||||
click.echo(f"No hash file for {name}. Regenerating...")
|
|
||||||
spin.util.run(cmd)
|
|
||||||
click.echo("Type stubs regenerated.")
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
def regenerate_clangtidy_files():
|
|
||||||
"""Regenerate clang-tidy files."""
|
|
||||||
cmd = [
|
|
||||||
sys.executable,
|
|
||||||
"-m",
|
|
||||||
"tools.linter.clang_tidy.generate_build_files",
|
|
||||||
]
|
|
||||||
spin.util.run(cmd)
|
|
||||||
|
|
||||||
|
|
||||||
#: These linters are expected to need less than 3s cpu time total
|
|
||||||
VERY_FAST_LINTERS = {
|
|
||||||
"ATEN_CPU_GPU_AGNOSTIC",
|
|
||||||
"BAZEL_LINTER",
|
|
||||||
"C10_NODISCARD",
|
|
||||||
"C10_UNUSED",
|
|
||||||
"CALL_ONCE",
|
|
||||||
"CMAKE_MINIMUM_REQUIRED",
|
|
||||||
"CONTEXT_DECORATOR",
|
|
||||||
"COPYRIGHT",
|
|
||||||
"CUBINCLUDE",
|
|
||||||
"DEPLOY_DETECTION",
|
|
||||||
"ERROR_PRONE_ISINSTANCE",
|
|
||||||
"EXEC",
|
|
||||||
"HEADER_ONLY_LINTER",
|
|
||||||
"IMPORT_LINTER",
|
|
||||||
"INCLUDE",
|
|
||||||
"LINTRUNNER_VERSION",
|
|
||||||
"MERGE_CONFLICTLESS_CSV",
|
|
||||||
"META_NO_CREATE_UNBACKED",
|
|
||||||
"NEWLINE",
|
|
||||||
"NOQA",
|
|
||||||
"NO_WORKFLOWS_ON_FORK",
|
|
||||||
"ONCE_FLAG",
|
|
||||||
"PYBIND11_INCLUDE",
|
|
||||||
"PYBIND11_SPECIALIZATION",
|
|
||||||
"PYPIDEP",
|
|
||||||
"PYPROJECT",
|
|
||||||
"RAWCUDA",
|
|
||||||
"RAWCUDADEVICE",
|
|
||||||
"ROOT_LOGGING",
|
|
||||||
"TABS",
|
|
||||||
"TESTOWNERS",
|
|
||||||
"TYPEIGNORE",
|
|
||||||
"TYPENOSKIP",
|
|
||||||
"WORKFLOWSYNC",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#: These linters are expected to take a few seconds, but less than 10s cpu time total
|
|
||||||
FAST_LINTERS = {
|
|
||||||
"CMAKE",
|
|
||||||
"DOCSTRING_LINTER",
|
|
||||||
"GHA",
|
|
||||||
"NATIVEFUNCTIONS",
|
|
||||||
"RUFF",
|
|
||||||
"SET_LINTER",
|
|
||||||
"SHELLCHECK",
|
|
||||||
"SPACES",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#: These linters are expected to take more than 10s cpu time total;
|
|
||||||
#: some need more than 1 hour.
|
|
||||||
SLOW_LINTERS = {
|
|
||||||
"ACTIONLINT",
|
|
||||||
"CLANGFORMAT",
|
|
||||||
"CLANGTIDY",
|
|
||||||
"CODESPELL",
|
|
||||||
"FLAKE8",
|
|
||||||
"GB_REGISTRY",
|
|
||||||
"PYFMT",
|
|
||||||
"PYREFLY",
|
|
||||||
"TEST_DEVICE_BIAS",
|
|
||||||
"TEST_HAS_MAIN",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ALL_LINTERS = VERY_FAST_LINTERS | FAST_LINTERS | SLOW_LINTERS
|
|
||||||
|
|
||||||
|
|
||||||
LINTRUNNER_CACHE_INFO = (
|
|
||||||
Path(".lintbin/.lintrunner.sha256"),
|
|
||||||
[
|
|
||||||
"requirements.txt",
|
|
||||||
"pyproject.toml",
|
|
||||||
".lintrunner.toml",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
LINTRUNNER_BASE_CMD = [
|
|
||||||
"uvx",
|
|
||||||
"--python",
|
|
||||||
"3.10",
|
|
||||||
"lintrunner@0.12.7",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
def setup_lint():
|
|
||||||
"""Set up lintrunner with current CI version."""
|
|
||||||
cmd = LINTRUNNER_BASE_CMD + ["init"]
|
|
||||||
subprocess.run(cmd, check=True, capture_output=True, text=True)
|
|
||||||
|
|
||||||
|
|
||||||
def _check_linters():
|
|
||||||
cmd = LINTRUNNER_BASE_CMD + ["list"]
|
|
||||||
ret = spin.util.run(cmd, output=False, stderr=subprocess.PIPE)
|
|
||||||
linters = {l.strip() for l in ret.stdout.decode().strip().split("\n")[1:]}
|
|
||||||
unknown_linters = linters - ALL_LINTERS
|
|
||||||
missing_linters = ALL_LINTERS - linters
|
|
||||||
if unknown_linters:
|
|
||||||
click.secho(
|
|
||||||
f"Unknown linters found; please add them to the correct category "
|
|
||||||
f"in .spin/cmds.py: {', '.join(unknown_linters)}",
|
|
||||||
fg="yellow",
|
|
||||||
)
|
|
||||||
if missing_linters:
|
|
||||||
click.secho(
|
|
||||||
f"Missing linters found; please update the corresponding category "
|
|
||||||
f"in .spin/cmds.py: {', '.join(missing_linters)}",
|
|
||||||
fg="yellow",
|
|
||||||
)
|
|
||||||
return unknown_linters, missing_linters
|
|
||||||
|
|
||||||
|
|
||||||
@spin.util.extend_command(
|
|
||||||
setup_lint,
|
|
||||||
doc=f"""
|
|
||||||
If configuration has changed, update lintrunner.
|
|
||||||
|
|
||||||
Compares the stored old hashes of configuration files with new ones and
|
|
||||||
performs setup via setup-lint if the hashes have changed.
|
|
||||||
Hashes are stored in {LINTRUNNER_CACHE_INFO[0]}; the following files are
|
|
||||||
considered: {", ".join(LINTRUNNER_CACHE_INFO[1])}.
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
@click.pass_context
|
|
||||||
def lazy_setup_lint(ctx, parent_callback, **kwargs):
|
|
||||||
if hashes := _updated_hashes(*LINTRUNNER_CACHE_INFO):
|
|
||||||
click.echo(
|
|
||||||
"Changes detected in lint configuration files. Setting up linting tools..."
|
|
||||||
)
|
|
||||||
parent_callback(**kwargs)
|
|
||||||
hash_file = LINTRUNNER_CACHE_INFO[0]
|
|
||||||
hash_file.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
with hash_file.open("w") as f:
|
|
||||||
for file, hash in hashes.items():
|
|
||||||
f.write(f"{hash} {file}\n")
|
|
||||||
click.echo("Linting tools set up and hashes updated.")
|
|
||||||
else:
|
|
||||||
click.echo("No changes detected in lint configuration files. Skipping setup.")
|
|
||||||
click.echo("Regenerating version...")
|
|
||||||
ctx.invoke(regenerate_version)
|
|
||||||
click.echo("Regenerating type stubs...")
|
|
||||||
ctx.invoke(regenerate_type_stubs)
|
|
||||||
click.echo("Done.")
|
|
||||||
_check_linters()
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.option("-a", "--apply-patches", is_flag=True)
|
|
||||||
@click.pass_context
|
|
||||||
def lint(ctx, apply_patches, **kwargs):
|
|
||||||
"""Lint all files."""
|
|
||||||
ctx.invoke(lazy_setup_lint)
|
|
||||||
all_files_linters = VERY_FAST_LINTERS | FAST_LINTERS
|
|
||||||
changed_files_linters = SLOW_LINTERS
|
|
||||||
cmd = LINTRUNNER_BASE_CMD
|
|
||||||
if apply_patches:
|
|
||||||
cmd += ["--apply-patches"]
|
|
||||||
all_files_cmd = cmd + [
|
|
||||||
"--take",
|
|
||||||
",".join(all_files_linters),
|
|
||||||
"--all-files",
|
|
||||||
]
|
|
||||||
spin.util.run(all_files_cmd)
|
|
||||||
changed_files_cmd = cmd + [
|
|
||||||
"--take",
|
|
||||||
",".join(changed_files_linters),
|
|
||||||
]
|
|
||||||
spin.util.run(changed_files_cmd)
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.pass_context
|
|
||||||
def fixlint(ctx, **kwargs):
|
|
||||||
"""Autofix all files."""
|
|
||||||
ctx.invoke(lint, apply_patches=True)
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.option("-a", "--apply-patches", is_flag=True)
|
|
||||||
@click.pass_context
|
|
||||||
def quicklint(ctx, apply_patches, **kwargs):
|
|
||||||
"""Lint changed files."""
|
|
||||||
ctx.invoke(lazy_setup_lint)
|
|
||||||
cmd = LINTRUNNER_BASE_CMD
|
|
||||||
if apply_patches:
|
|
||||||
cmd += ["--apply-patches"]
|
|
||||||
spin.util.run(cmd)
|
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
|
||||||
@click.pass_context
|
|
||||||
def quickfix(ctx, **kwargs):
|
|
||||||
"""Autofix changed files."""
|
|
||||||
ctx.invoke(quicklint, apply_patches=True)
|
|
||||||
106
CMakeLists.txt
106
CMakeLists.txt
@ -234,17 +234,7 @@ option(USE_COLORIZE_OUTPUT "Colorize output during compilation" ON)
|
|||||||
option(USE_ASAN "Use Address+Undefined Sanitizers" OFF)
|
option(USE_ASAN "Use Address+Undefined Sanitizers" OFF)
|
||||||
option(USE_LSAN "Use Leak Sanitizer" OFF)
|
option(USE_LSAN "Use Leak Sanitizer" OFF)
|
||||||
option(USE_TSAN "Use Thread Sanitizer" OFF)
|
option(USE_TSAN "Use Thread Sanitizer" OFF)
|
||||||
|
|
||||||
# Track whether USE_CUDA was explicitly set by the user (before option() is called)
|
|
||||||
# If USE_CUDA is already defined in cache, it means user explicitly set it
|
|
||||||
if(DEFINED CACHE{USE_CUDA})
|
|
||||||
set(_USE_CUDA_EXPLICITLY_SET TRUE)
|
|
||||||
else()
|
|
||||||
set(_USE_CUDA_EXPLICITLY_SET FALSE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
option(USE_CUDA "Use CUDA" ON)
|
option(USE_CUDA "Use CUDA" ON)
|
||||||
|
|
||||||
option(USE_XPU "Use XPU" ON)
|
option(USE_XPU "Use XPU" ON)
|
||||||
cmake_dependent_option(
|
cmake_dependent_option(
|
||||||
BUILD_LAZY_CUDA_LINALG "Build cuda linalg ops as separate library" ON
|
BUILD_LAZY_CUDA_LINALG "Build cuda linalg ops as separate library" ON
|
||||||
@ -736,44 +726,6 @@ if(NOT DEFINED USE_BLAS)
|
|||||||
set(USE_BLAS ON)
|
set(USE_BLAS ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Prioritized Text Linker Optimization
|
|
||||||
if(USE_PRIORITIZED_TEXT_FOR_LD)
|
|
||||||
|
|
||||||
set(LINKER_SCRIPT_FILE_IN "${CMAKE_SOURCE_DIR}/cmake/prioritized_text.txt")
|
|
||||||
set(LINKER_SCRIPT_FILE_OUT "${CMAKE_SOURCE_DIR}/cmake/linker_script.ld")
|
|
||||||
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${Python_EXECUTABLE}
|
|
||||||
${CMAKE_SOURCE_DIR}/tools/setup_helpers/generate_linker_script.py
|
|
||||||
--filein "${LINKER_SCRIPT_FILE_IN}"
|
|
||||||
--fout "${LINKER_SCRIPT_FILE_OUT}"
|
|
||||||
RESULT_VARIABLE _gen_result
|
|
||||||
OUTPUT_VARIABLE _gen_output
|
|
||||||
ERROR_VARIABLE _gen_error
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT _gen_result EQUAL 0)
|
|
||||||
message(FATAL_ERROR
|
|
||||||
"Failed to generate linker script:\n${_gen_output}\n${_gen_error}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
append_cxx_flag_if_supported("-ffunction-sections" CMAKE_CXX_FLAGS)
|
|
||||||
append_cxx_flag_if_supported("-fdata-sections" CMAKE_CXX_FLAGS)
|
|
||||||
append_c_flag_if_supported("-ffunction-sections" CMAKE_C_FLAGS)
|
|
||||||
append_c_flag_if_supported("-fdata-sections" CMAKE_C_FLAGS)
|
|
||||||
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -T${LINKER_SCRIPT_FILE_OUT}")
|
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -T${LINKER_SCRIPT_FILE_OUT}")
|
|
||||||
|
|
||||||
else()
|
|
||||||
if(LINUX AND CPU_AARCH64)
|
|
||||||
message(WARNING [[
|
|
||||||
It is strongly recommend to enable linker script optimization for all AArch64 Linux builds.
|
|
||||||
To do so please export USE_PRIORITIZED_TEXT_FOR_LD=1
|
|
||||||
]])
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Build libtorch mobile library, which contains ATen/TH ops and native support
|
# Build libtorch mobile library, which contains ATen/TH ops and native support
|
||||||
# for TorchScript model, but doesn't contain not-yet-unified caffe2 ops;
|
# for TorchScript model, but doesn't contain not-yet-unified caffe2 ops;
|
||||||
if(INTERN_BUILD_MOBILE)
|
if(INTERN_BUILD_MOBILE)
|
||||||
@ -1440,6 +1392,9 @@ if(BUILD_JNI)
|
|||||||
add_subdirectory(android/pytorch_android)
|
add_subdirectory(android/pytorch_android)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(cmake/Summary.cmake)
|
||||||
|
caffe2_print_configuration_summary()
|
||||||
|
|
||||||
# Parse custom debug info
|
# Parse custom debug info
|
||||||
if(DEFINED USE_CUSTOM_DEBINFO)
|
if(DEFINED USE_CUSTOM_DEBINFO)
|
||||||
string(REPLACE ";" " " SOURCE_FILES "${USE_CUSTOM_DEBINFO}")
|
string(REPLACE ";" " " SOURCE_FILES "${USE_CUSTOM_DEBINFO}")
|
||||||
@ -1479,5 +1434,56 @@ if(BUILD_BUNDLE_PTXAS AND USE_CUDA)
|
|||||||
DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(cmake/Summary.cmake)
|
if(USE_PRIORITIZED_TEXT_FOR_LD)
|
||||||
caffe2_print_configuration_summary()
|
add_compile_options(
|
||||||
|
$<$<COMPILE_LANGUAGE:C,CXX>:-ffunction-sections>
|
||||||
|
$<$<COMPILE_LANGUAGE:C,CXX>:-fdata-sections>
|
||||||
|
)
|
||||||
|
set(LINKER_SCRIPT_FILE_OUT "${CMAKE_SOURCE_DIR}/cmake/linker_script.ld")
|
||||||
|
set(LINKER_SCRIPT_FILE_IN "${CMAKE_SOURCE_DIR}/cmake/prioritized_text.txt")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${LINKER_SCRIPT_FILE_OUT}"
|
||||||
|
COMMAND ${Python_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/setup_helpers/generate_linker_script.py --filein "${LINKER_SCRIPT_FILE_IN}" --fout "${LINKER_SCRIPT_FILE_OUT}"
|
||||||
|
DEPENDS ${CMAKE_SOURCE_DIR}/tools/setup_helpers/generate_linker_script.py "${LINKER_SCRIPT_FILE_IN}"
|
||||||
|
COMMENT "Generating prioritized text linker files"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(generate_linker_script DEPENDS "${LINKER_SCRIPT_FILE_OUT}")
|
||||||
|
|
||||||
|
if(BUILD_PYTHON)
|
||||||
|
set(LINKER_OPT_TARGETS torch_python)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT BUILD_LIBTORCHLESS)
|
||||||
|
list(APPEND LINKER_OPT_TARGETS torch_cpu c10)
|
||||||
|
if(USE_CUDA)
|
||||||
|
list(APPEND LINKER_OPT_TARGETS torch_cuda c10_cuda)
|
||||||
|
endif()
|
||||||
|
if(USE_XPU)
|
||||||
|
list(APPEND LINKER_OPT_TARGETS torch_xpu c10_xpu)
|
||||||
|
endif()
|
||||||
|
if(USE_ROCM)
|
||||||
|
list(APPEND LINKER_OPT_TARGETS torch_hip c10_hip)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(tgt IN LISTS LINKER_OPT_TARGETS)
|
||||||
|
if(TARGET ${tgt})
|
||||||
|
add_dependencies("${tgt}" generate_linker_script)
|
||||||
|
target_link_options_if_supported(${tgt} "-T,${LINKER_SCRIPT_FILE_OUT}")
|
||||||
|
set_property(TARGET ${tgt} APPEND PROPERTY LINK_DEPENDS "${LINKER_SCRIPT_FILE_OUT}")
|
||||||
|
else()
|
||||||
|
message(WARNING "Requested target '${tgt}' for linker script optimization was not found.")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
else()
|
||||||
|
if(LINUX AND CPU_AARCH64)
|
||||||
|
message(WARNING [[
|
||||||
|
It is strongly recommend to enable linker script optimization for all AArch64 Linux builds.
|
||||||
|
To do so please export USE_PRIORITIZED_TEXT_FOR_LD=1
|
||||||
|
]])
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|||||||
@ -210,12 +210,8 @@ torch/backends/cudnn/ @eqy @syed-ahmed @Aidyn-A
|
|||||||
/test/inductor/test_flex_attention.py @drisspg
|
/test/inductor/test_flex_attention.py @drisspg
|
||||||
/test/inductor/test_flex_decoding.py @drisspg
|
/test/inductor/test_flex_decoding.py @drisspg
|
||||||
|
|
||||||
# Low Precision & Grouped GEMMs
|
# Low Precision GEMMs
|
||||||
/aten/src/ATen/native/cuda/Blas.cpp @drisspg @slayton58
|
/aten/src/ATen/native/cuda/Blas.cpp @drisspg @slayton58
|
||||||
/aten/src/ATen/native/cuda/GroupedBlas.cpp @drisspg @slayton58
|
|
||||||
/aten/src/ATen/native/cuda/ScaledBlas.cpp @drisspg @slayton58
|
|
||||||
/aten/src/ATen/cuda/CUDABlas.cpp @drisspg @slayton58
|
/aten/src/ATen/cuda/CUDABlas.cpp @drisspg @slayton58
|
||||||
/aten/src/ATen/cuda/CUDABlas.h @drisspg @slayton58
|
/aten/src/ATen/cuda/CUDABlas.h @drisspg @slayton58
|
||||||
/aten/src/ATen/cuda/CUDAScaledBlas.cpp @drisspg @slayton58
|
|
||||||
/aten/src/ATen/cuda/CUDAScaledBlas.h @drisspg @slayton58
|
|
||||||
/test/test_scaled_matmul_cuda.py @drisspg @slayton58
|
/test/test_scaled_matmul_cuda.py @drisspg @slayton58
|
||||||
|
|||||||
@ -18,7 +18,7 @@ aspects of contributing to PyTorch.
|
|||||||
- [Python Unit Testing](#python-unit-testing)
|
- [Python Unit Testing](#python-unit-testing)
|
||||||
- [Better local unit tests with `pytest`](#better-local-unit-tests-with-pytest)
|
- [Better local unit tests with `pytest`](#better-local-unit-tests-with-pytest)
|
||||||
- [Local linting](#local-linting)
|
- [Local linting](#local-linting)
|
||||||
- [Running `pyrefly`](#running-pyrefly)
|
- [Running `mypy`](#running-mypy)
|
||||||
- [C++ Unit Testing](#c-unit-testing)
|
- [C++ Unit Testing](#c-unit-testing)
|
||||||
- [Run Specific CI Jobs](#run-specific-ci-jobs)
|
- [Run Specific CI Jobs](#run-specific-ci-jobs)
|
||||||
- [Merging your Change](#merging-your-change)
|
- [Merging your Change](#merging-your-change)
|
||||||
@ -281,7 +281,7 @@ dependencies as well as the nightly binaries into the repo directory.
|
|||||||
**Prerequisites**:
|
**Prerequisites**:
|
||||||
The following packages should be installed with `pip`:
|
The following packages should be installed with `pip`:
|
||||||
- `expecttest` and `hypothesis` - required to run tests
|
- `expecttest` and `hypothesis` - required to run tests
|
||||||
- `pyrefly` - recommended for type checking. [Pyrefly](https://pyrefly.org/)
|
- `mypy` - recommended for linting
|
||||||
- `pytest` - recommended to run tests more selectively
|
- `pytest` - recommended to run tests more selectively
|
||||||
Running
|
Running
|
||||||
```
|
```
|
||||||
@ -350,32 +350,15 @@ make lint
|
|||||||
|
|
||||||
Learn more about the linter on the [lintrunner wiki page](https://github.com/pytorch/pytorch/wiki/lintrunner)
|
Learn more about the linter on the [lintrunner wiki page](https://github.com/pytorch/pytorch/wiki/lintrunner)
|
||||||
|
|
||||||
#### Running `pyrefly`
|
#### Running `mypy`
|
||||||
|
|
||||||
[Pyrefly](https://pyrefly.org/) is a high-performance static type checker for Python. It provides fast type checking along with IDE features like autocomplete and instant error feedback.
|
`mypy` is an optional static type checker for Python. We have multiple `mypy`
|
||||||
|
configs for the PyTorch codebase that are automatically validated against whenever the linter is run.
|
||||||
PyTorch uses Pyrefly for type checking across the codebase. The configuration is managed in `pyrefly.toml` at the root of the repository.
|
|
||||||
|
|
||||||
**Getting Started with Pyrefly:**
|
|
||||||
|
|
||||||
To run type checking on the PyTorch codebase:
|
|
||||||
```bash
|
|
||||||
pyrefly check
|
|
||||||
```
|
|
||||||
|
|
||||||
For more detailed error information with summaries:
|
|
||||||
```bash
|
|
||||||
pyrefly check --summarize-errors
|
|
||||||
```
|
|
||||||
|
|
||||||
**Learn More:**
|
|
||||||
- [Pyrefly Configuration](https://pyrefly.org/en/docs/configuration/) - Detailed configuration options
|
|
||||||
- [Pyrefly IDE Features](https://pyrefly.org/en/docs/IDE-features/) - Set up Pyrefly in your editor for real-time type checking
|
|
||||||
- [Python Typing Tutorial](https://pyrefly.org/en/docs/typing-for-python-developers/) - Learn about Python type annotations
|
|
||||||
|
|
||||||
See [Guide for adding type annotations to
|
See [Guide for adding type annotations to
|
||||||
PyTorch](https://github.com/pytorch/pytorch/wiki/Guide-for-adding-type-annotations-to-PyTorch)
|
PyTorch](https://github.com/pytorch/pytorch/wiki/Guide-for-adding-type-annotations-to-PyTorch)
|
||||||
for PyTorch-specific guidance on how to set up `pyrefly` and tackle type annotation tasks in this codebase.
|
for more information on how to set up `mypy` and tackle type annotation
|
||||||
|
tasks.
|
||||||
|
|
||||||
### C++ Unit Testing
|
### C++ Unit Testing
|
||||||
|
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@ -37,7 +37,7 @@ Copyright (c) 2024 Tri Dao.
|
|||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
All contributions by Arm:
|
All contributions by Arm:
|
||||||
Copyright (c) 2021, 2023-2025 Arm Limited and/or its affiliates
|
Copyright (c) 2021, 2023-2024 Arm Limited and/or its affiliates
|
||||||
|
|
||||||
All contributions from Caffe:
|
All contributions from Caffe:
|
||||||
Copyright(c) 2013, 2014, 2015, the respective contributors
|
Copyright(c) 2013, 2014, 2015, the respective contributors
|
||||||
|
|||||||
22
SECURITY.md
22
SECURITY.md
@ -1,7 +1,7 @@
|
|||||||
# Security Policy
|
# Security Policy
|
||||||
|
|
||||||
- [**Reporting a Vulnerability**](#reporting-a-vulnerability)
|
- [**Reporting a Vulnerability**](#reporting-a-vulnerability)
|
||||||
- [**Using PyTorch Securely**](#using-pytorch-securely)
|
- [**Using Pytorch Securely**](#using-pytorch-securely)
|
||||||
- [Untrusted models](#untrusted-models)
|
- [Untrusted models](#untrusted-models)
|
||||||
- [TorchScript models](#torchscript-models)
|
- [TorchScript models](#torchscript-models)
|
||||||
- [Untrusted inputs](#untrusted-inputs)
|
- [Untrusted inputs](#untrusted-inputs)
|
||||||
@ -10,30 +10,28 @@
|
|||||||
- [**CI/CD security principles**](#cicd-security-principles)
|
- [**CI/CD security principles**](#cicd-security-principles)
|
||||||
## Reporting Security Issues
|
## Reporting Security Issues
|
||||||
|
|
||||||
Beware that none of the topics under [Using PyTorch Securely](#using-pytorch-securely) are considered vulnerabilities of PyTorch.
|
Beware that none of the topics under [Using Pytorch Securely](#using-pytorch-securely) are considered vulnerabilities of Pytorch.
|
||||||
|
|
||||||
However, if you believe you have found a security vulnerability in PyTorch, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem.
|
However, if you believe you have found a security vulnerability in PyTorch, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem.
|
||||||
|
|
||||||
Please report security issues using https://github.com/pytorch/pytorch/security/advisories/new
|
Please report security issues using https://github.com/pytorch/pytorch/security/advisories/new
|
||||||
|
|
||||||
All reports submitted through the security advisories mechanism would **either be made public or dismissed by the team within 90 days of the submission**. If advisory has been closed on the grounds that it is not a security issue, please do not hesitate to create an [new issue](https://github.com/pytorch/pytorch/issues/new?template=bug-report.yml) as it is still likely a valid issue within the framework.
|
All reports submitted thru the security advisories mechanism would **either be made public or dismissed by the team within 90 days of the submission**. If advisory has been closed on the grounds that it is not a security issue, please do not hesitate to create an [new issue](https://github.com/pytorch/pytorch/issues/new?template=bug-report.yml) as it is still likely a valid issue within the framework.
|
||||||
|
|
||||||
**Note on crashes and out of bounds access**: PyTorch is a computational framework that performs operations on behalf of the caller. Like many low-level libraries, PyTorch generally does not validate all inputs to every function—the responsibility for providing valid arguments lies with the calling code. While crashes and out of bounds memory access should be reported as bugs, they are generally not considered security vulnerabilities in PyTorch's threat model.
|
|
||||||
|
|
||||||
Please refer to the following page for our responsible disclosure policy, reward guidelines, and those things that should not be reported:
|
Please refer to the following page for our responsible disclosure policy, reward guidelines, and those things that should not be reported:
|
||||||
|
|
||||||
https://www.facebook.com/whitehat
|
https://www.facebook.com/whitehat
|
||||||
|
|
||||||
|
|
||||||
## Using PyTorch Securely
|
## Using Pytorch Securely
|
||||||
**PyTorch models are programs**, so treat its security seriously -- running untrusted models is equivalent to running untrusted code. In general we recommend that model weights and the python code for the model are distributed independently. That said, be careful about where you get the python code from and who wrote it (preferentially check for a provenance or checksums, do not run any pip installed package).
|
**Pytorch models are programs**, so treat its security seriously -- running untrusted models is equivalent to running untrusted code. In general we recommend that model weights and the python code for the model are distributed independently. That said, be careful about where you get the python code from and who wrote it (preferentially check for a provenance or checksums, do not run any pip installed package).
|
||||||
|
|
||||||
### Untrusted models
|
### Untrusted models
|
||||||
Be careful when running untrusted models. This classification includes models created by unknown developers or utilizing data obtained from unknown sources[^data-poisoning-sources].
|
Be careful when running untrusted models. This classification includes models created by unknown developers or utilizing data obtained from unknown sources[^data-poisoning-sources].
|
||||||
|
|
||||||
**Prefer to execute untrusted models within a secure, isolated environment such as a sandbox** (e.g., containers, virtual machines). This helps protect your system from potentially malicious code. You can find further details and instructions in [this page](https://developers.google.com/code-sandboxing).
|
**Prefer to execute untrusted models within a secure, isolated environment such as a sandbox** (e.g., containers, virtual machines). This helps protect your system from potentially malicious code. You can find further details and instructions in [this page](https://developers.google.com/code-sandboxing).
|
||||||
|
|
||||||
**Be mindful of risky model formats**. Give preference to share and load weights with the appropriate format for your use case. [Safetensors](https://huggingface.co/docs/safetensors/en/index) gives the most safety but is the most restricted in what it supports. [`torch.load`](https://pytorch.org/docs/stable/generated/torch.load.html#torch.load) has a significantly larger surface of attack but is more flexible in what it can serialize. See the documentation for more details.
|
**Be mindful of risky model formats**. Give preference to share and load weights with the appropriate format for your use case. [safetensors](https://huggingface.co/docs/safetensors/en/index) gives the most safety but is the most restricted in what it supports. [`torch.load`](https://pytorch.org/docs/stable/generated/torch.load.html#torch.load) has a significantly larger surface of attack but is more flexible in what it can serialize. See the documentation for more details.
|
||||||
|
|
||||||
Even for more secure serialization formats, unexpected inputs to the downstream system can cause diverse security threats (e.g. denial of service, out of bound reads/writes) and thus we recommend extensive validation of any untrusted inputs.
|
Even for more secure serialization formats, unexpected inputs to the downstream system can cause diverse security threats (e.g. denial of service, out of bound reads/writes) and thus we recommend extensive validation of any untrusted inputs.
|
||||||
|
|
||||||
@ -45,7 +43,7 @@ Important Note: The trustworthiness of a model is not binary. You must always de
|
|||||||
|
|
||||||
### TorchScript models
|
### TorchScript models
|
||||||
|
|
||||||
TorchScript models should be treated the same way as locally executable code from an unknown source. Only run TorchScript models if you trust the provider. Please note, that tools for introspecting TorchScript models (such as `torch.utils.model_dump`) may also execute partial or full code stored in those models, therefore they should be used only if you trust the provider of the binary you are about to load.
|
TorchScript models should treated the same way as locally executable code from an unknown source. Only run TorchScript models if you trust the provider. Please note, that tools for introspecting TorchScript models (such as `torch.utils.model_dump`) may also execute partial or full code stored in those models, therefore they should be used only if you trust the provider of the binary you are about to load.
|
||||||
|
|
||||||
### Untrusted inputs during training and prediction
|
### Untrusted inputs during training and prediction
|
||||||
|
|
||||||
@ -61,9 +59,9 @@ If applicable, prepare your model against bad inputs and prompt injections. Some
|
|||||||
|
|
||||||
### Data privacy
|
### Data privacy
|
||||||
|
|
||||||
**Take special security measures if you train your models with sensitive data**. Prioritize [sandboxing](https://developers.google.com/code-sandboxing) your models and:
|
**Take special security measures if your model if you train models with sensitive data**. Prioritize [sandboxing](https://developers.google.com/code-sandboxing) your models and:
|
||||||
- Do not feed sensitive data to an untrusted model (even if runs in a sandboxed environment)
|
- Do not feed sensitive data to untrusted model (even if runs in a sandboxed environment)
|
||||||
- If you consider publishing a model that was partially trained with sensitive data, be aware that data can potentially be recovered from the trained weights (especially if the model overfits).
|
- If you consider publishing a model that was partially trained with sensitive data, be aware that data can potentially be recovered from the trained weights (especially if model overfits).
|
||||||
|
|
||||||
### Using distributed features
|
### Using distributed features
|
||||||
|
|
||||||
|
|||||||
@ -174,12 +174,6 @@ class TORCH_API Context {
|
|||||||
static long versionCuDNN() {
|
static long versionCuDNN() {
|
||||||
return detail::getCUDAHooks().versionCuDNN();
|
return detail::getCUDAHooks().versionCuDNN();
|
||||||
}
|
}
|
||||||
static long versionRuntimeCuDNN() {
|
|
||||||
return detail::getCUDAHooks().versionRuntimeCuDNN();
|
|
||||||
}
|
|
||||||
static long versionCuDNNFrontend() {
|
|
||||||
return detail::getCUDAHooks().versionCuDNNFrontend();
|
|
||||||
}
|
|
||||||
static bool hasCuSOLVER() {
|
static bool hasCuSOLVER() {
|
||||||
return detail::getCUDAHooks().hasCuSOLVER();
|
return detail::getCUDAHooks().hasCuSOLVER();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,11 +94,6 @@ TORCH_API inline void resetPeakStats(c10::DeviceIndex device_index) {
|
|||||||
at::getDeviceAllocator(device_type)->resetPeakStats(device_index);
|
at::getDeviceAllocator(device_type)->resetPeakStats(device_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
TORCH_API inline std::pair<size_t, size_t> getMemoryInfo(
|
|
||||||
c10::DeviceIndex device_index) {
|
|
||||||
const auto device_type = getAccelerator(true).value();
|
|
||||||
return at::getDeviceAllocator(device_type)->getMemoryInfo(device_index);
|
|
||||||
}
|
|
||||||
} // namespace at::accelerator
|
} // namespace at::accelerator
|
||||||
|
|
||||||
namespace at {
|
namespace at {
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
#include <c10/util/Half.h>
|
#include <c10/util/Half.h>
|
||||||
#include <c10/util/Metaprogramming.h>
|
#include <c10/util/Metaprogramming.h>
|
||||||
#include <c10/util/complex.h>
|
#include <c10/util/complex.h>
|
||||||
#include <torch/headeronly/core/Dispatch.h>
|
|
||||||
|
|
||||||
#ifdef __CUDACC__
|
#ifdef __CUDACC__
|
||||||
#include <cuda.h> // For CUDA_VERSION
|
#include <cuda.h> // For CUDA_VERSION
|
||||||
@ -63,8 +62,11 @@ TORCH_API void record_kernel_function_dtype(std::string name);
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, HINT, ...) \
|
#define AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, HINT, ...) \
|
||||||
THO_PRIVATE_CASE_TYPE_USING_HINT_TMPL( \
|
case enum_type: { \
|
||||||
AT_PRIVATE_CHECK_SELECTIVE_BUILD, enum_type, HINT, __VA_ARGS__)
|
AT_PRIVATE_CHECK_SELECTIVE_BUILD(enum_type); \
|
||||||
|
using HINT [[maybe_unused]] = c10::impl::ScalarTypeToCPPTypeT<enum_type>; \
|
||||||
|
return __VA_ARGS__(); \
|
||||||
|
}
|
||||||
|
|
||||||
#define AT_DISPATCH_CASE(enum_type, ...) \
|
#define AT_DISPATCH_CASE(enum_type, ...) \
|
||||||
AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, __VA_ARGS__)
|
AT_PRIVATE_CASE_TYPE_USING_HINT(enum_type, scalar_t, __VA_ARGS__)
|
||||||
@ -93,6 +95,14 @@ TORCH_API void record_kernel_function_dtype(std::string name);
|
|||||||
return __VA_ARGS__(); \
|
return __VA_ARGS__(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
|
||||||
|
inline at::ScalarType scalar_type(at::ScalarType s) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
// The AT_DISPATCH_* family of macros provides the ability to
|
// The AT_DISPATCH_* family of macros provides the ability to
|
||||||
// conveniently generate specializations of a kernel over all of the
|
// conveniently generate specializations of a kernel over all of the
|
||||||
// dtypes we care about in PyTorch. We call it "dispatch" because
|
// dtypes we care about in PyTorch. We call it "dispatch" because
|
||||||
@ -181,12 +191,26 @@ TORCH_API void record_kernel_function_dtype(std::string name);
|
|||||||
// use it to shut up warnings about unused store.
|
// use it to shut up warnings about unused store.
|
||||||
|
|
||||||
#define AT_DISPATCH_SWITCH(TYPE, NAME, ...) \
|
#define AT_DISPATCH_SWITCH(TYPE, NAME, ...) \
|
||||||
THO_DISPATCH_SWITCH_TMPL( \
|
[&] { \
|
||||||
RECORD_KERNEL_FUNCTION_DTYPE, \
|
const auto& the_type = TYPE; \
|
||||||
TORCH_CHECK_NOT_IMPLEMENTED, \
|
constexpr const char* at_dispatch_name = NAME; \
|
||||||
TYPE, \
|
/* don't use TYPE again in case it is an expensive or side-effect op */ \
|
||||||
NAME, \
|
at::ScalarType _st = ::detail::scalar_type(the_type); \
|
||||||
__VA_ARGS__)
|
RECORD_KERNEL_FUNCTION_DTYPE(at_dispatch_name, _st); \
|
||||||
|
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wswitch-enum") \
|
||||||
|
switch (_st) { \
|
||||||
|
__VA_ARGS__ \
|
||||||
|
default: \
|
||||||
|
TORCH_CHECK_NOT_IMPLEMENTED( \
|
||||||
|
false, \
|
||||||
|
'"', \
|
||||||
|
at_dispatch_name, \
|
||||||
|
"\" not implemented for '", \
|
||||||
|
toString(_st), \
|
||||||
|
"'"); \
|
||||||
|
} \
|
||||||
|
C10_DIAGNOSTIC_POP() \
|
||||||
|
}()
|
||||||
|
|
||||||
#define AT_DISPATCH_CASE_FLOATING_TYPES(...) \
|
#define AT_DISPATCH_CASE_FLOATING_TYPES(...) \
|
||||||
AT_DISPATCH_CASE(at::ScalarType::Double, __VA_ARGS__) \
|
AT_DISPATCH_CASE(at::ScalarType::Double, __VA_ARGS__) \
|
||||||
|
|||||||
@ -1,8 +1,3 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <torch/headeronly/core/Dispatch_v2.h>
|
|
||||||
|
|
||||||
// Get AT_DISPATCH_SWITCH and AT_DISPATCH_CASE:
|
|
||||||
#include <ATen/Dispatch.h>
|
#include <ATen/Dispatch.h>
|
||||||
|
|
||||||
// This is a new implementation of the AT_DISPATCH macro family from
|
// This is a new implementation of the AT_DISPATCH macro family from
|
||||||
@ -79,19 +74,41 @@
|
|||||||
// macro expansion occurs, mediated with AT_EXPAND and AT_GUARD. I mostly
|
// macro expansion occurs, mediated with AT_EXPAND and AT_GUARD. I mostly
|
||||||
// relied on GPT4 to help me get it right.
|
// relied on GPT4 to help me get it right.
|
||||||
|
|
||||||
|
// Public API macros
|
||||||
|
|
||||||
// See documentation above
|
// See documentation above
|
||||||
#define AT_DISPATCH_V2(TYPE, NAME, BODY, ...) \
|
#define AT_DISPATCH_V2(TYPE, NAME, BODY, ...) \
|
||||||
THO_DISPATCH_V2_TMPL( \
|
AT_DISPATCH_SWITCH(TYPE, NAME, AT_AP_VAR(AT_WRAP(BODY), TYPE, __VA_ARGS__))
|
||||||
AT_DISPATCH_SWITCH, \
|
|
||||||
AT_DISPATCH_CASE, \
|
// This macro lets you pass an arbitrary expression that may contain internal
|
||||||
TYPE, \
|
// commas to another macro without having the commas causing the expression
|
||||||
NAME, \
|
// to be interpreted as being multiple arguments
|
||||||
AT_WRAP(BODY), \
|
#define AT_WRAP(...) __VA_ARGS__
|
||||||
__VA_ARGS__)
|
|
||||||
|
#define AT_FLOAT8_TYPES \
|
||||||
|
c10::kFloat8_e5m2, c10::kFloat8_e5m2fnuz, c10::kFloat8_e4m3fn, \
|
||||||
|
c10::kFloat8_e4m3fnuz, c10::kFloat8_e8m0fnu
|
||||||
|
|
||||||
|
#define AT_INTEGRAL_TYPES \
|
||||||
|
c10::kByte, c10::kChar, c10::kInt, c10::kLong, c10::kShort
|
||||||
|
#define AT_FLOATING_TYPES c10::kDouble, c10::kFloat
|
||||||
|
#define AT_BAREBONES_UNSIGNED_TYPES c10::kUInt16, c10::kUInt32, c10::kUInt64
|
||||||
|
#define AT_INTEGRAL_TYPES_V2 \
|
||||||
|
AT_EXPAND(AT_INTEGRAL_TYPES), AT_EXPAND(AT_BAREBONES_UNSIGNED_TYPES)
|
||||||
|
#define AT_COMPLEX_TYPES c10::kComplexDouble, c10::kComplexFloat
|
||||||
|
#define AT_QINT_TYPES c10::kQInt8, c10::kQUInt8, c10::kQInt32
|
||||||
|
// NB: not *actually* all types
|
||||||
|
#define AT_ALL_TYPES AT_EXPAND(AT_INTEGRAL_TYPES), AT_EXPAND(AT_FLOATING_TYPES)
|
||||||
|
#define AT_ALL_TYPES_AND_COMPLEX \
|
||||||
|
AT_EXPAND(AT_ALL_TYPES), AT_EXPAND(AT_COMPLEX_TYPES)
|
||||||
|
|
||||||
|
// Helper macros
|
||||||
|
|
||||||
// Unused helper macros, kept for BC:
|
|
||||||
#define AT_AP_VAR(N, T, ...) \
|
#define AT_AP_VAR(N, T, ...) \
|
||||||
AT_EXPAND(AT_CONCAT(AT_AP, AT_NUM_ARGS(__VA_ARGS__))(AT_WRAP(N), __VA_ARGS__))
|
AT_EXPAND(AT_CONCAT(AT_AP, AT_NUM_ARGS(__VA_ARGS__))(AT_WRAP(N), __VA_ARGS__))
|
||||||
|
#define AT_CONCAT(a, b) AT_CONCAT_AUX(a, b)
|
||||||
|
#define AT_CONCAT_AUX(a, b) a##b
|
||||||
|
#define AT_EXPAND(X) X
|
||||||
|
|
||||||
// Ensure we never have too many scalar types for the expansion here to
|
// Ensure we never have too many scalar types for the expansion here to
|
||||||
// support. To bump this, you must regenerate the macros below.
|
// support. To bump this, you must regenerate the macros below.
|
||||||
@ -102,6 +119,12 @@ static_assert(static_cast<int>(c10::ScalarType::NumOptions) < 60);
|
|||||||
|
|
||||||
num_args = 60
|
num_args = 60
|
||||||
|
|
||||||
|
nums = ', '.join(str(i) for i in reversed(range(num_args+1)))
|
||||||
|
args = ', '.join(f'_{i}' for i in range(1, num_args+1))
|
||||||
|
|
||||||
|
print(f'#define AT_NUM_ARGS(...) AT_EXPAND(AT_NUM_ARGS_AUX(__VA_ARGS__, {nums}))')
|
||||||
|
print(f'#define AT_NUM_ARGS_AUX({args}, N, ...) N')
|
||||||
|
|
||||||
for i in range(1, num_args+1):
|
for i in range(1, num_args+1):
|
||||||
args = ', '.join(f'_{i}' for i in range(1, i+1))
|
args = ', '.join(f'_{i}' for i in range(1, i+1))
|
||||||
cases = ' '.join([f'AT_DISPATCH_CASE(_{j}, N)' for j in range(1, i+1)])
|
cases = ' '.join([f'AT_DISPATCH_CASE(_{j}, N)' for j in range(1, i+1)])
|
||||||
@ -112,6 +135,8 @@ for i in range(1, num_args+1):
|
|||||||
// Begin generated code
|
// Begin generated code
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
|
#define AT_NUM_ARGS(...) AT_EXPAND(AT_NUM_ARGS_AUX(__VA_ARGS__, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0))
|
||||||
|
#define AT_NUM_ARGS_AUX(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, N, ...) N
|
||||||
#define AT_AP1(N, _1) AT_DISPATCH_CASE(_1, N)
|
#define AT_AP1(N, _1) AT_DISPATCH_CASE(_1, N)
|
||||||
#define AT_AP2(N, _1, _2) AT_DISPATCH_CASE(_1, N) AT_DISPATCH_CASE(_2, N)
|
#define AT_AP2(N, _1, _2) AT_DISPATCH_CASE(_1, N) AT_DISPATCH_CASE(_2, N)
|
||||||
#define AT_AP3(N, _1, _2, _3) AT_DISPATCH_CASE(_1, N) AT_DISPATCH_CASE(_2, N) AT_DISPATCH_CASE(_3, N)
|
#define AT_AP3(N, _1, _2, _3) AT_DISPATCH_CASE(_1, N) AT_DISPATCH_CASE(_2, N) AT_DISPATCH_CASE(_3, N)
|
||||||
|
|||||||
@ -144,7 +144,7 @@ inline std::bitset<kVmapNumLevels> createVmapLevelsBitset(BatchDimsRef bdims) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline std::ostream& operator<<(std::ostream& out, const BatchDim& bdim) {
|
inline std::ostream& operator<<(std::ostream& out, const BatchDim& bdim) {
|
||||||
out << "(lvl=" << bdim.level() << ", dim=" << bdim.dim() << ')';
|
out << "(lvl=" << bdim.level() << ", dim=" << bdim.dim() << ")";
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace indexing {
|
|||||||
const EllipsisIndexType Ellipsis = EllipsisIndexType();
|
const EllipsisIndexType Ellipsis = EllipsisIndexType();
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, const Slice& slice) {
|
std::ostream& operator<<(std::ostream& stream, const Slice& slice) {
|
||||||
stream << slice.start() << ':' << slice.stop() << ':' << slice.step();
|
stream << slice.start() << ":" << slice.stop() << ":" << slice.step();
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,12 +31,12 @@ std::ostream& operator<<(std::ostream& stream, const TensorIndex& tensor_index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& stream, const std::vector<TensorIndex>& tensor_indices) {
|
std::ostream& operator<<(std::ostream& stream, const std::vector<TensorIndex>& tensor_indices) {
|
||||||
stream << '(';
|
stream << "(";
|
||||||
for (const auto i : c10::irange(tensor_indices.size())) {
|
for (const auto i : c10::irange(tensor_indices.size())) {
|
||||||
stream << tensor_indices[i];
|
stream << tensor_indices[i];
|
||||||
if (i < tensor_indices.size() - 1) stream << ", ";
|
if (i < tensor_indices.size() - 1) stream << ", ";
|
||||||
}
|
}
|
||||||
stream << ')';
|
stream << ")";
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -113,7 +113,7 @@ void TensorNames::checkUnique(const char* op_name) const {
|
|||||||
std::ostream& operator<<(std::ostream& out, const TensorName& tensorname) {
|
std::ostream& operator<<(std::ostream& out, const TensorName& tensorname) {
|
||||||
out << tensorname.name_ << " (index ";
|
out << tensorname.name_ << " (index ";
|
||||||
out << tensorname.origin_idx_ << " of ";
|
out << tensorname.origin_idx_ << " of ";
|
||||||
out << tensorname.origin_ << ')';
|
out << tensorname.origin_ << ")";
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,9 +13,9 @@ std::ostream& operator<<(std::ostream & out, const TensorGeometryArg& t) {
|
|||||||
if (t.pos == 0) {
|
if (t.pos == 0) {
|
||||||
// 0 is distinguished; it usually indicates 'self' or the return
|
// 0 is distinguished; it usually indicates 'self' or the return
|
||||||
// tensor
|
// tensor
|
||||||
out << '\'' << t.name << '\'';
|
out << "'" << t.name << "'";
|
||||||
} else {
|
} else {
|
||||||
out << "argument #" << t.pos << " '" << t.name << '\'';
|
out << "argument #" << t.pos << " '" << t.name << "'";
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ void checkSameGPU(CheckedFrom c, const TensorArg& t1, const TensorArg& t2) {
|
|||||||
oss << "Tensor for " << t2 << " is on CPU, ";
|
oss << "Tensor for " << t2 << " is on CPU, ";
|
||||||
}
|
}
|
||||||
oss << "but expected " << ((!t1->is_cpu() && !t2->is_cpu()) ? "them" : "it")
|
oss << "but expected " << ((!t1->is_cpu() && !t2->is_cpu()) ? "them" : "it")
|
||||||
<< " to be on GPU (while checking arguments for " << c << ')';
|
<< " to be on GPU (while checking arguments for " << c << ")";
|
||||||
TORCH_CHECK(false, oss.str());
|
TORCH_CHECK(false, oss.str());
|
||||||
}
|
}
|
||||||
TORCH_CHECK(
|
TORCH_CHECK(
|
||||||
@ -199,7 +199,7 @@ void checkScalarTypes(CheckedFrom c, const TensorArg& t,
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
oss << "; but got " << t->toString()
|
oss << "; but got " << t->toString()
|
||||||
<< " instead (while checking arguments for " << c << ')';
|
<< " instead (while checking arguments for " << c << ")";
|
||||||
TORCH_CHECK(false, oss.str());
|
TORCH_CHECK(false, oss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,8 +43,8 @@ std::string get_mkldnn_version() {
|
|||||||
// https://github.com/intel/ideep/issues/29
|
// https://github.com/intel/ideep/issues/29
|
||||||
{
|
{
|
||||||
const dnnl_version_t* ver = dnnl_version();
|
const dnnl_version_t* ver = dnnl_version();
|
||||||
ss << "Intel(R) MKL-DNN v" << ver->major << '.' << ver->minor << '.' << ver->patch
|
ss << "Intel(R) MKL-DNN v" << ver->major << "." << ver->minor << "." << ver->patch
|
||||||
<< " (Git Hash " << ver->hash << ')';
|
<< " (Git Hash " << ver->hash << ")";
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ss << "MKLDNN not found";
|
ss << "MKLDNN not found";
|
||||||
@ -81,7 +81,7 @@ std::string get_openmp_version() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ver_str) {
|
if (ver_str) {
|
||||||
ss << " (a.k.a. OpenMP " << ver_str << ')';
|
ss << " (a.k.a. OpenMP " << ver_str << ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -135,38 +135,38 @@ std::string show_config() {
|
|||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
{
|
{
|
||||||
ss << " - GCC " << __GNUC__ << '.' << __GNUC_MINOR__ << '\n';
|
ss << " - GCC " << __GNUC__ << "." << __GNUC_MINOR__ << "\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
{
|
{
|
||||||
ss << " - C++ Version: " << __cplusplus << '\n';
|
ss << " - C++ Version: " << __cplusplus << "\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__clang_major__)
|
#if defined(__clang_major__)
|
||||||
{
|
{
|
||||||
ss << " - clang " << __clang_major__ << '.' << __clang_minor__ << '.' << __clang_patchlevel__ << '\n';
|
ss << " - clang " << __clang_major__ << "." << __clang_minor__ << "." << __clang_patchlevel__ << "\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
{
|
{
|
||||||
ss << " - MSVC " << _MSC_FULL_VER << '\n';
|
ss << " - MSVC " << _MSC_FULL_VER << "\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AT_MKL_ENABLED()
|
#if AT_MKL_ENABLED()
|
||||||
ss << " - " << get_mkl_version() << '\n';
|
ss << " - " << get_mkl_version() << "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AT_MKLDNN_ENABLED()
|
#if AT_MKLDNN_ENABLED()
|
||||||
ss << " - " << get_mkldnn_version() << '\n';
|
ss << " - " << get_mkldnn_version() << "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
ss << " - " << get_openmp_version() << '\n';
|
ss << " - " << get_openmp_version() << "\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AT_BUILD_WITH_LAPACK()
|
#if AT_BUILD_WITH_LAPACK()
|
||||||
@ -183,7 +183,7 @@ std::string show_config() {
|
|||||||
ss << " - Cross compiling on MacOSX\n";
|
ss << " - Cross compiling on MacOSX\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ss << " - "<< used_cpu_capability() << '\n';
|
ss << " - "<< used_cpu_capability() << "\n";
|
||||||
|
|
||||||
if (hasCUDA()) {
|
if (hasCUDA()) {
|
||||||
ss << detail::getCUDAHooks().showConfig();
|
ss << detail::getCUDAHooks().showConfig();
|
||||||
@ -200,10 +200,10 @@ std::string show_config() {
|
|||||||
ss << " - Build settings: ";
|
ss << " - Build settings: ";
|
||||||
for (const auto& pair : caffe2::GetBuildOptions()) {
|
for (const auto& pair : caffe2::GetBuildOptions()) {
|
||||||
if (!pair.second.empty()) {
|
if (!pair.second.empty()) {
|
||||||
ss << pair.first << '=' << pair.second << ", ";
|
ss << pair.first << "=" << pair.second << ", ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ss << '\n';
|
ss << "\n";
|
||||||
|
|
||||||
// TODO: do HIP
|
// TODO: do HIP
|
||||||
// TODO: do XLA
|
// TODO: do XLA
|
||||||
|
|||||||
@ -209,7 +209,7 @@ struct CodeTemplate {
|
|||||||
// to indent correctly in the context.
|
// to indent correctly in the context.
|
||||||
void emitIndent(std::ostream& out, size_t indent) const {
|
void emitIndent(std::ostream& out, size_t indent) const {
|
||||||
for ([[maybe_unused]] const auto i : c10::irange(indent)) {
|
for ([[maybe_unused]] const auto i : c10::irange(indent)) {
|
||||||
out << ' ';
|
out << " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void emitStringWithIndents(
|
void emitStringWithIndents(
|
||||||
|
|||||||
@ -226,8 +226,8 @@ template <
|
|||||||
typename B = HostBlock<S>>
|
typename B = HostBlock<S>>
|
||||||
struct CachingHostAllocatorImpl {
|
struct CachingHostAllocatorImpl {
|
||||||
virtual ~CachingHostAllocatorImpl() {
|
virtual ~CachingHostAllocatorImpl() {
|
||||||
if (active_) {
|
|
||||||
active_ = false;
|
active_ = false;
|
||||||
|
if (pinned_use_background_threads()) {
|
||||||
getBackgroundThreadPool()->waitWorkComplete();
|
getBackgroundThreadPool()->waitWorkComplete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +260,6 @@ struct CachingHostAllocatorImpl {
|
|||||||
if (pinned_use_background_threads()) {
|
if (pinned_use_background_threads()) {
|
||||||
// Launch the background thread and process events in a loop.
|
// Launch the background thread and process events in a loop.
|
||||||
static bool background_thread_flag [[maybe_unused]] = [this] {
|
static bool background_thread_flag [[maybe_unused]] = [this] {
|
||||||
active_ = true;
|
|
||||||
getBackgroundThreadPool()->run([&]() {
|
getBackgroundThreadPool()->run([&]() {
|
||||||
while (active_) {
|
while (active_) {
|
||||||
process_events();
|
process_events();
|
||||||
@ -684,9 +683,9 @@ struct CachingHostAllocatorImpl {
|
|||||||
alignas(hardware_destructive_interference_size) std::mutex events_mutex_;
|
alignas(hardware_destructive_interference_size) std::mutex events_mutex_;
|
||||||
std::deque<std::pair<E, B*>> events_; // event queue paired with block
|
std::deque<std::pair<E, B*>> events_; // event queue paired with block
|
||||||
|
|
||||||
// Indicates whether the event-processing thread pool is active.
|
// Indicates whether the object is active.
|
||||||
// Set to false in the destructor to signal background threads to stop.
|
// Set to false in the destructor to signal background threads to stop.
|
||||||
std::atomic<bool> active_{false};
|
std::atomic<bool> active_{true};
|
||||||
protected:
|
protected:
|
||||||
alignas(hardware_destructive_interference_size) HostStatsStaged stats_;
|
alignas(hardware_destructive_interference_size) HostStatsStaged stats_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -10,7 +10,7 @@ std::ostream& operator<<(std::ostream& out, const Dimname& dimname) {
|
|||||||
if (dimname.type() == NameType::WILDCARD) {
|
if (dimname.type() == NameType::WILDCARD) {
|
||||||
out << "None";
|
out << "None";
|
||||||
} else {
|
} else {
|
||||||
out << '\'' << dimname.symbol().toUnqualString() << '\'';
|
out << "'" << dimname.symbol().toUnqualString() << "'";
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
namespace at {
|
namespace at {
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& out, const Range& range) {
|
std::ostream& operator<<(std::ostream& out, const Range& range) {
|
||||||
out << "Range[" << range.begin << ", " << range.end << ']';
|
out << "Range[" << range.begin << ", " << range.end << "]";
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user