Skip to content

Rollback #9146 to fix breakage #12437

Rollback #9146 to fix breakage

Rollback #9146 to fix breakage #12437

Workflow file for this run

name: Build and test
on:
pull_request:
branches:
- master
- r[0-9]+.[0-9]+
push:
branches:
- master
- r[0-9]+.[0-9]+
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
cancel-in-progress: true
jobs:
check_code_changes:
name: Check Code Changes
uses: ./.github/workflows/_check_code_changes.yml
with:
event_name: ${{ github.event_name }}
# For pull_request, use PR's base and head. For push, use event's before and sha.
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
head_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
get-torch-commit:
needs: [check_code_changes]
runs-on: ubuntu-24.04
outputs:
torch_commit: ${{ steps.commit.outputs.torch_commit }}
steps:
- name: Get latest torch commit
id: commit
if: needs.check_code_changes.outputs.has_code_changes == 'true'
run: |
echo "torch_commit=$(git ls-remote https://github.com/pytorch/pytorch.git HEAD | awk '{print $1}')" >> "$GITHUB_OUTPUT"
- name: Report no code changes
if: needs.check_code_changes.outputs.has_code_changes == 'false'
run: |
echo "No code changes were detected that require running the full test suite."
build-torch-xla:
name: "Build PyTorch/XLA"
uses: ./.github/workflows/_build_torch_xla.yml
needs: [check_code_changes, get-torch-commit]
with:
dev-image: us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/development:3.10_tpuvm
torch-commit: ${{needs.get-torch-commit.outputs.torch_commit}}
timeout-minutes: 240
has_code_changes: ${{ needs.check_code_changes.outputs.has_code_changes }}
runner: linux.24xlarge
secrets:
gcloud-service-key: ${{ secrets.GCLOUD_SERVICE_KEY }}
build-torch-with-cuda:
name: "Build PyTorch with CUDA"
uses: ./.github/workflows/_build_torch_with_cuda.yml
needs: [check_code_changes, get-torch-commit]
with:
# TODO: bump CUDA version to either 12.4 or 12.6 (supported by PyTorch).
# Ref: https://github.com/pytorch/xla/issues/8700
dev-image: us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/development:3.10_cuda_12.3
torch-commit: ${{needs.get-torch-commit.outputs.torch_commit}}
# note that to build a torch wheel with CUDA enabled, we do not need a GPU runner.
runner: linux.24xlarge
timeout-minutes: 120
has_code_changes: ${{ needs.check_code_changes.outputs.has_code_changes }}
build-cuda-plugin:
name: "Build XLA CUDA plugin"
uses: ./.github/workflows/_build_plugin.yml
needs: [check_code_changes]
with:
dev-image: us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/development:3.10_cuda_12.3
has_code_changes: ${{ needs.check_code_changes.outputs.has_code_changes }}
runner: linux.24xlarge
secrets:
gcloud-service-key: ${{ secrets.GCLOUD_SERVICE_KEY }}
test-python-cpu:
name: "CPU tests"
uses: ./.github/workflows/_test.yml
needs: [build-torch-xla, check_code_changes, get-torch-commit]
with:
dev-image: us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/development:3.10_tpuvm
timeout-minutes: 120
collect-coverage: false
runner: linux.24xlarge
torch-commit: ${{needs.get-torch-commit.outputs.torch_commit}}
has_code_changes: ${{ needs.check_code_changes.outputs.has_code_changes }}
secrets:
gcloud-service-key: ${{ secrets.GCLOUD_SERVICE_KEY }}
test-cuda:
name: "GPU tests"
uses: ./.github/workflows/_test.yml
needs: [build-torch-xla, build-cuda-plugin, check_code_changes, get-torch-commit]
with:
dev-image: us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/development:3.10_cuda_12.3
runner: linux.g4dn.12xlarge.nvidia.gpu
timeout-minutes: 300
collect-coverage: false
install-cuda-plugin: true
torch-commit: ${{needs.get-torch-commit.outputs.torch_commit}}
has_code_changes: ${{ needs.check_code_changes.outputs.has_code_changes }}
secrets:
gcloud-service-key: ${{ secrets.GCLOUD_SERVICE_KEY }}
test-cuda-with-pytorch-cuda-enabled:
name: "GPU tests requiring torch CUDA"
uses: ./.github/workflows/_test_requiring_torch_cuda.yml
needs: [build-torch-with-cuda, build-torch-xla, build-cuda-plugin, check_code_changes, get-torch-commit]
with:
dev-image: us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/development:3.10_cuda_12.3
runner: linux.8xlarge.nvidia.gpu
timeout-minutes: 300
collect-coverage: false
torch-commit: ${{needs.get-torch-commit.outputs.torch_commit}}
has_code_changes: ${{ needs.check_code_changes.outputs.has_code_changes }}
test-tpu:
name: "TPU tests"
uses: ./.github/workflows/_tpu_ci.yml
needs: [build-torch-xla, check_code_changes]
with:
timeout-minutes: 300
has_code_changes: ${{ needs.check_code_changes.outputs.has_code_changes }}
if: github.event_name == 'push' || github.event_name == 'pull_request'
push-docs:
name: "Build docs"
uses: ./.github/workflows/_docs.yml
needs: build-torch-xla
if: github.event_name == 'push'
with:
dev-image: us-central1-docker.pkg.dev/tpu-pytorch-releases/docker/development:3.10_tpuvm
secrets:
torchxla-bot-token: ${{ secrets.TORCH_XLA_BOT_TOKEN }}