Skip to content

Commit

Permalink
Merge branch 'main' into IFU-main-2024-02-22
Browse files Browse the repository at this point in the history
  • Loading branch information
jithunnair-amd committed Feb 22, 2024
2 parents 6987207 + af4827c commit 216031d
Show file tree
Hide file tree
Showing 87 changed files with 2,581 additions and 2,150 deletions.
24 changes: 22 additions & 2 deletions .github/scripts/validate_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@ if [[ ${MATRIX_PACKAGE_TYPE} == "libtorch" ]]; then
curl ${MATRIX_INSTALLATION} -o libtorch.zip
unzip libtorch.zip
else

# Conda pinned see issue: https://github.com/ContinuumIO/anaconda-issues/issues/13350
conda install -y conda=23.11.0
# Please note ffmpeg is required for torchaudio, see https://github.com/pytorch/pytorch/issues/96159
conda create -y -n ${ENV_NAME} python=${MATRIX_PYTHON_VERSION} numpy ffmpeg
conda activate ${ENV_NAME}
INSTALLATION=${MATRIX_INSTALLATION/"conda install"/"conda install -y"}
TEST_SUFFIX=""
if [[ ${TORCH_ONLY} == 'true' ]]; then
INSTALLATION=${INSTALLATION/"torchvision torchaudio"/""}
TEST_SUFFIX=" --package torchonly"
fi

# if RELESE version is passed as parameter - install speific version
if [[ ! -z ${RELEASE_VERSION} ]]; then
INSTALLATION=${INSTALLATION/"torch "/"torch==${RELEASE_VERSION} "}
INSTALLATION=${INSTALLATION/"-y pytorch "/"-y pytorch==${RELEASE_VERSION} "}
INSTALLATION=${INSTALLATION/"::pytorch "/"::pytorch==${RELEASE_VERSION} "}
fi

export OLD_PATH=${PATH}
# Workaround macos-arm64 runners. Issue: https://github.com/pytorch/test-infra/issues/4342
Expand All @@ -26,15 +41,20 @@ else
fi

if [[ ${TARGET_OS} == 'windows' ]]; then
python ./test/smoke_test/smoke_test.py
python ./test/smoke_test/smoke_test.py ${TEST_SUFFIX}
else
python3 ./test/smoke_test/smoke_test.py
python3 ./test/smoke_test/smoke_test.py ${TEST_SUFFIX}
fi

if [[ ${TARGET_OS} == 'macos-arm64' ]]; then
export PATH=${OLD_PATH}
fi

# We are only interested in CUDA tests and Python 3.8-3.11. Not all requirement libraries are available for 3.12 yet.
if [[ ${INCLUDE_TEST_OPS:-} == 'true' && ${MATRIX_GPU_ARCH_TYPE} == 'cuda' && ${MATRIX_PYTHON_VERSION} != "3.12" ]]; then
source ./.github/scripts/validate_test_ops.sh
fi

conda deactivate
conda env remove -n ${ENV_NAME}
fi
20 changes: 14 additions & 6 deletions .github/scripts/validate_pipy.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
conda create -yp ${ENV_NAME}_pypi python=${MATRIX_PYTHON_VERSION} numpy ffmpeg
conda create -yn ${ENV_NAME}_pypi python=${MATRIX_PYTHON_VERSION} numpy ffmpeg
conda activate ${ENV_NAME}_pypi

if [[ ${MATRIX_CHANNEL} != "release" ]]; then
conda run -p ${ENV_NAME}_pypi pip3 install --pre torch --index-url "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}_pypi_cudnn"
conda run -p ${ENV_NAME}_pypi pip3 install --pre torchvision torchaudio --index-url "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}"
TEST_SUFFIX=""
RELEASE_SUFFIX=""
# if RELESE version is passed as parameter - install speific version
if [[ ! -z ${RELEASE_VERSION} ]]; then
RELEASE_SUFFIX="==${RELEASE_VERSION}"
fi

if [[ ${TORCH_ONLY} == 'true' ]]; then
TEST_SUFFIX=" --package torchonly"
pip3 install torch${RELEASE_SUFFIX}
else
conda run -p ${ENV_NAME}_pypi pip3 install torch torchvision torchaudio
pip3 install torch${RELEASE_SUFFIX} torchvision torchaudio
fi

conda run -p ${ENV_NAME}_pypi python ./test/smoke_test/smoke_test.py
python ./test/smoke_test/smoke_test.py ${TEST_SUFFIX} --runtime-error-check disabled
conda deactivate
conda env remove -p ${ENV_NAME}_pypi
26 changes: 15 additions & 11 deletions .github/scripts/validate_poetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,24 @@ poetry --version
poetry new test_poetry
cd test_poetry

if [[ ${MATRIX_CHANNEL} != "release" ]]; then
# Installing poetry from our custom repo. We need to configure it before use and disable authentication
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
poetry source add --priority=explicit domains "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}"
poetry source add --priority=supplemental pytorch-nightly "https://download.pytorch.org/whl/${MATRIX_CHANNEL}"
poetry source add --priority=supplemental pytorch "https://download.pytorch.org/whl/${MATRIX_CHANNEL}/${MATRIX_DESIRED_CUDA}_pypi_cudnn"
poetry --quiet add --source pytorch torch
poetry --quiet add --source domains torchvision torchaudio
TEST_SUFFIX=""
if [[ ${TORCH_ONLY} == 'true' ]]; then
TEST_SUFFIX=" --package torchonly"
fi

RELEASE_SUFFIX=""
# if RELESE version is passed as parameter - install speific version
if [[ ! -z ${RELEASE_VERSION} ]]; then
RELEASE_SUFFIX="@${RELEASE_VERSION}"
fi

if [[ ${TORCH_ONLY} == 'true' ]]; then
poetry --quiet add torch${RELEASE_SUFFIX}
else
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
poetry --quiet add torch torchaudio torchvision
poetry --quiet add torch${RELEASE_SUFFIX} torchaudio torchvision
fi

python ../test/smoke_test/smoke_test.py
python ../test/smoke_test/smoke_test.py ${TEST_SUFFIX} --runtime-error-check disabled
conda deactivate
conda env remove -p ${ENV_NAME}_poetry
cd ..
38 changes: 38 additions & 0 deletions .github/scripts/validate_test_ops.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

set -eux -o pipefail

retry () {
$* || (sleep 1 && $*) || (sleep 2 && $*) || (sleep 4 && $*) || (sleep 8 && $*)
}

BRANCH=""
if [[ ${MATRIX_CHANNEL} == "test" || ${MATRIX_CHANNEL} == "release" ]]; then
SHORT_VERSION=${MATRIX_STABLE_VERSION%.*}
BRANCH="--branch release/${SHORT_VERSION}"
fi


# Clone the Pytorch branch
retry git clone ${BRANCH} --depth 1 https://github.com/pytorch/pytorch.git
retry git submodule update --init --recursive
pushd pytorch

pip install expecttest numpy pyyaml jinja2 packaging hypothesis unittest-xml-reporting scipy

# Run pytorch cuda wheels validation
# Detect ReduceLogicKernel (ReduceOp and kernel) IMA
python test/test_ops.py -k test_dtypes_all_cuda
# Detect BinaryMulKernel (elementwise binary functor internal mul) IMA
python test/test_torch.py -k test_index_reduce_reduce_prod_cuda_int32
# Detect BinaryBitwiseOpsKernels (at::native::BitwiseAndFunctor) IMA
python test/test_binary_ufuncs.py -k test_contig_vs_every_other___rand___cuda_int32
# Detect MaxMinElementwiseKernel (maximum) IMA
python test/test_schema_check.py -k test_schema_correctness_clamp_cuda_int8

pushd /tmp
# Detect StepKernel (nextafter) IMA
python -c "import torch; print(torch.nextafter(torch.tensor([-4.5149, -5.9053, -0.9516, -2.3615, 1.5591], device='cuda:0'), torch.tensor(3.8075, device='cuda:0')))"
# Detect BinaryGeometricKernels (atan2) IMA
python -c "import torch; x = (torch.randn((2,1,1), dtype=torch.float, device='cuda')*5).to(torch.float32); y=(torch.randn((), dtype=torch.float, device='cuda')*5).to(torch.float32); print(torch.atan2(x,y))"
popd
2 changes: 1 addition & 1 deletion .github/workflows/build-conda-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:

jobs:
build-docker:
runs-on: ubuntu-22.04
runs-on: linux.12xlarge.ephemeral
strategy:
matrix:
cuda_version: ["11.8", "12.1", "cpu"]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-libtorch-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ env:

jobs:
build-docker-cuda:
runs-on: ubuntu-22.04
runs-on: linux.12xlarge.ephemeral
strategy:
matrix:
cuda_version: ["12.1", "11.8"]
Expand All @@ -52,7 +52,7 @@ jobs:
runs-on: linux.12xlarge
strategy:
matrix:
rocm_version: ["5.5", "5.6"]
rocm_version: ["5.7", "6.0"]
env:
GPU_ARCH_TYPE: rocm
GPU_ARCH_VERSION: ${{ matrix.rocm_version }}
Expand Down
23 changes: 21 additions & 2 deletions .github/workflows/build-manywheel-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ on:
paths:
- .github/workflows/build-manywheel-images.yml
- manywheel/Dockerfile
- manywheel/Dockerfile_aarch64
- manywheel/Dockerfile_cxx11-abi
- manywheel/build_docker.sh
- 'common/*'
pull_request:
paths:
- .github/workflows/build-manywheel-images.yml
- manywheel/Dockerfile
- manywheel/Dockerfile_aarch64
- manywheel/Dockerfile_cxx11-abi
- 'common/*'
- manywheel/build_docker.sh
Expand All @@ -32,14 +34,16 @@ env:

jobs:
build-docker-cuda:
runs-on: ubuntu-22.04
runs-on: linux.12xlarge.ephemeral
strategy:
matrix:
cuda_version: ["12.1", "11.8"]
env:
GPU_ARCH_TYPE: cuda
GPU_ARCH_VERSION: ${{ matrix.cuda_version }}
steps:
- name: Purge tools folder (free space for build)
run: rm -rf /opt/hostedtoolcache
- name: Checkout PyTorch builder
uses: actions/checkout@v3
- name: Authenticate if WITH_PUSH
Expand All @@ -54,7 +58,7 @@ jobs:
runs-on: linux.12xlarge
strategy:
matrix:
rocm_version: ["5.5", "5.6"]
rocm_version: ["5.7", "6.0"]
env:
GPU_ARCH_TYPE: rocm
GPU_ARCH_VERSION: ${{ matrix.rocm_version }}
Expand Down Expand Up @@ -82,6 +86,21 @@ jobs:
- name: Build Docker Image
run: |
manywheel/build_docker.sh
build-docker-cpu-aarch64:
runs-on: linux.arm64.2xlarge
env:
GPU_ARCH_TYPE: cpu-aarch64
steps:
- name: Checkout PyTorch
uses: actions/checkout@v3
- name: Authenticate if WITH_PUSH
run: |
if [[ "${WITH_PUSH}" == true ]]; then
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_ID}" --password-stdin
fi
- name: Build Docker Image
run: |
manywheel/build_docker.sh
build-docker-cpu-cxx11-abi:
runs-on: ubuntu-22.04
env:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Lint

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
lintrunner:
name: lintrunner

runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Lintrunner
run: |
pip install lintrunner
lintrunner init
- name: Run lintrunner on all files - Linux
run: |
set +e
if ! lintrunner -v --force-color --all-files --tee-json=lint.json; then
echo ""
echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner -m main\`.\e[0m"
exit 1
fi
37 changes: 37 additions & 0 deletions .github/workflows/test-check-binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test check_binary

on:
push:
branches:
- main
pull_request:
paths:
- .github/workflows/test-check-binary.yml
- check_binary.sh
- test/smoke_test/smoke_test.py

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
cancel-in-progress: true

jobs:
check_binary_linux_cpu:
name: Test check_binary.sh for Linux CPU
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: "pytorch/builder"
docker-image: python:3.11
script: |
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
DESIRED_PYTHON=3.11 DESIRED_CUDA=cpu PACKAGE_TYPE=manywheel ./check_binary.sh
check_binary_linux_cuda:
name: Test check_binary.sh for Linux CUDA
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
repository: "pytorch/builder"
runner: linux.4xlarge.nvidia.gpu
docker-image: python:3.11
script: |
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121
DESIRED_PYTHON=3.11 DESIRED_CUDA=cu121 PACKAGE_TYPE=manywheel ./check_binary.sh
Loading

0 comments on commit 216031d

Please sign in to comment.