-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
128 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: xla-test | ||
on: | ||
workflow_call: | ||
inputs: | ||
dev-image: | ||
required: true | ||
type: string | ||
description: Base image for builds | ||
runner: | ||
required: false | ||
type: string | ||
description: Runner type for the test | ||
default: linux.12xlarge | ||
timeout-minutes: | ||
required: false | ||
type: number | ||
default: 270 | ||
description: | | ||
Set the maximum (in minutes) how long the workflow should take to finish | ||
timeout-minutes: | ||
install-cuda-plugin: | ||
required: false | ||
type: boolean | ||
default: false | ||
description: Whether to install CUDA plugin package | ||
|
||
secrets: | ||
gcloud-service-key: | ||
required: true | ||
description: Secret to access Bazel build cache | ||
jobs: | ||
test: | ||
runs-on: ${{ inputs.runner }} | ||
container: | ||
image: ${{ inputs.dev-image }} | ||
options: "${{ inputs.install-cuda-plugin && '--gpus all' || '' }} --shm-size 16g" | ||
steps: | ||
# See https://github.com/actions/checkout/issues/1014#issuecomment-1906802802 | ||
- name: Clean up workspace | ||
run: | | ||
ls -la | ||
rm -rvf ${GITHUB_WORKSPACE}/* | ||
- name: Setup gcloud | ||
shell: bash | ||
run: | | ||
echo "${GCLOUD_SERVICE_KEY}" > $GOOGLE_APPLICATION_CREDENTIALS | ||
- name: Fetch wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: torch-xla-wheels | ||
path: /tmp/wheels/ | ||
- name: Fetch CUDA plugin | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: cuda-plugin | ||
path: /tmp/wheels/ | ||
if: ${{ inputs.install-cuda-plugin }} | ||
- name: Setup CUDA environment | ||
shell: bash | ||
run: | | ||
# TODO: Make PJRT_DEVICE=CPU work with XLA_REGISTER_INSTALLED_PLUGINS=1 | ||
echo "XLA_REGISTER_INSTALLED_PLUGINS=1" >> $GITHUB_ENV | ||
echo "PATH=$PATH:/usr/local/cuda-12.1/bin" >> $GITHUB_ENV | ||
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.1/lib64" >> $GITHUB_ENV | ||
if: ${{ inputs.install-cuda-plugin }} | ||
- name: Check GPU | ||
run: nvidia-smi | ||
if: ${{ inputs.install-cuda-plugin }} | ||
- name: Install wheels | ||
shell: bash | ||
run: | | ||
pip install /tmp/wheels/*.whl | ||
# TODO: Add these in setup.py | ||
pip install fsspec | ||
pip install rich | ||
echo "Import check..." | ||
python -c "import torch_xla" | ||
- name: Record PyTorch commit | ||
run: | | ||
# Don't just pipe output in shell because imports may do extra logging | ||
python -c " | ||
import torch_xla.version | ||
with open('$GITHUB_ENV', 'a') as f: | ||
f.write(f'PYTORCH_COMMIT={torch_xla.version.__torch_gitrev__}\n') | ||
" | ||
- name: Checkout PyTorch Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: pytorch/pytorch | ||
path: pytorch | ||
ref: ${{ env.PYTORCH_COMMIT }} | ||
- name: Checkout PyTorch/XLA Repo | ||
uses: actions/checkout@v4 | ||
with: | ||
path: pytorch/xla | ||
- name: Install test dependencies | ||
shell: bash | ||
run: | | ||
# TODO: Add these in setup.py | ||
pip install fsspec | ||
pip install rich | ||
# Jax nightly is needed for Triton tests. | ||
pip install --upgrade "jax[cuda12]" | ||
- name: Run Tests | ||
env: | ||
PJRT_DEVICE: CUDA | ||
TRITON_PTXAS_PATH: /usr/local/cuda/bin/ptxas | ||
run: | | ||
cd pytorch/xla | ||
python test/test_triton.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,4 @@ def ptxla_cc_test( | |
"@torch//:libtorch_python", | ||
], | ||
**kwargs | ||
) | ||
) |