Build and test A770, Windows #1842
This file contains hidden or 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
name: Build and test on Windows | |
run-name: ${{ inputs.run_name }} | |
on: | |
workflow_dispatch: | |
inputs: | |
runner_label: | |
description: Runner label | |
type: string | |
default: a770 | |
skip_list: | |
description: Skip list | |
type: string | |
default: a770 | |
run_name: | |
description: Custom run name | |
type: string | |
default: Build and test on Windows | |
permissions: read-all | |
env: | |
PYTHONIOENCODING: utf-8 | |
PYTHON_VERSION: "3.10" | |
NEW_WORKSPACE: C:\gh${{ github.run_id }} | |
SKIPLIST: --skip-list scripts/skiplist/${{ inputs.skip_list }} | |
TRITON_TEST_CMD: bash -x scripts/test-triton.sh --skip-pytorch-install --skip-pip-install --skip-list scripts/skiplist/${{ inputs.skip_list }} --reports-dir reports --ignore-errors | |
jobs: | |
build: | |
name: Build and test | |
runs-on: | |
- windows | |
- ${{ inputs.runner_label }} | |
# Building PyTorch can take up to 4 hours on certain machines, increasing the timeout to 8 hours. | |
timeout-minutes: 720 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
- name: Setup Python | |
uses: actions/setup-python@v6 | |
with: | |
python-version: '3.10' | |
- name: Clean up old workspaces | |
shell: bash | |
run: | | |
rm -rf /c/gh* | |
# Copy workspace to a temporary location with a shorter name. | |
- name: Copy workspace | |
run: | | |
Copy-Item -Path ${{ github.workspace }} -Destination ${{ env.NEW_WORKSPACE }} -Recurse | |
- name: Create venv | |
run: | |
python -m venv .venv | |
- name: Install PyTorch (source) | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
# Required to build on Windows | |
$env:CMAKE_SHARED_LINKER_FLAGS = "/FORCE:MULTIPLE" | |
$env:CMAKE_MODULE_LINKER_FLAGS = "/FORCE:MULTIPLE" | |
$env:CMAKE_EXE_LINKER_FLAGS = "/FORCE:MULTIPLE" | |
$env:TORCH_XPU_ARCH_LIST = "bmg,dg2,arl-h,mtl-h" | |
bash -c "PYTORCH_PROJ=/c/pytorch ./scripts/install-pytorch.sh --source --check-wheel" | |
- name: PyTorch version | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
python -c 'import torch; print(torch.__version__)' | Tee-Object -Variable PYTORCH_VERSION | |
echo "PYTORCH_VERSION=$PYTORCH_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Identify GPU | |
run: | | |
# Initializing oneAPI to enable sycl-ls, which is used in capture-hw-details.sh on Windows. | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
bash -c './scripts/capture-hw-details.sh | tee -a $GITHUB_ENV' | |
- name: Report environment details | |
shell: bash | |
run: | | |
cd /c/gh${{ github.run_id }} | |
mkdir -p reports | |
cat <<EOF | tee /c/gh${{ github.run_id }}/reports/.env | |
TIMESTAMP=$(date '+%Y%m%d%H%M%S') | |
GITHUB_RUN_ID=$GITHUB_RUN_ID | |
GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER | |
GITHUB_RUN_ATTEMPT=$GITHUB_RUN_ATTEMPT | |
PYTHON_VERSION=$PYTHON_VERSION | |
PYTORCH_REPO=pytorch/pytorch | |
PYTORCH_COMMIT_ID=$(<.github/pins/pytorch.txt)" | |
PYTORCH_VERSION=$PYTORCH_VERSION | |
TRITON_REPO=$GITHUB_REPOSITORY | |
TRITON_COMMIT_ID=$GITHUB_SHA | |
TRITON_BRANCH=$GITHUB_REF_NAME | |
OS=${{ runner.os }} | |
LIBIGC1_VERSION=$LIBIGC1_VERSION | |
LEVEL_ZERO_VERSION=$LEVEL_ZERO_VERSION | |
AGAMA_VERSION=$AGAMA_VERSION | |
GPU_DEVICE=$GPU_DEVICE | |
EOF | |
- name: Clean up Triton cache | |
shell: bash | |
run: | | |
rm -rf ~/.triton/cache | |
# We need ninja >= 1.12.0 to support long names on Windows. At the moment there is no required | |
# version in pypi, so instead of installing ninja with pip we use a preinstalled 1.12.1 on the | |
# runner. | |
- name: Setup Triton | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 | |
cd ${{ env.NEW_WORKSPACE }} | |
pip install -U wheel pybind11 cython cmake | |
pip install -v '.[build,tests,tutorials]' | |
- name: Triton version | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
python -c 'import triton; print(triton.__version__)' | |
- name: Install test dependencies | |
run: | | |
.venv\Scripts\activate.ps1 | |
pip install -r scripts\requirements-test.txt | |
pip uninstall pytest_forked -y | |
- name: Run unit tests | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
cd ${{ env.NEW_WORKSPACE }} | |
${{ env.TRITON_TEST_CMD }} --unit | |
- name: Run core tests | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
cd ${{ env.NEW_WORKSPACE }} | |
${{ env.TRITON_TEST_CMD }} --core | |
- name: Run gluon tests | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
cd ${{ env.NEW_WORKSPACE }} | |
${{ env.TRITON_TEST_CMD }} --gluon | |
- name: Run triton kernels tests | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
cd ${{ env.NEW_WORKSPACE }} | |
${{ env.TRITON_TEST_CMD }} --triton-kernels | |
- name: Run interpreter tests | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
cd ${{ env.NEW_WORKSPACE }} | |
${{ env.TRITON_TEST_CMD }} --interpreter | |
- name: Run tutorials | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
# Disable interactive plot window | |
$env:MPLBACKEND = "Agg" | |
cd ${{ env.NEW_WORKSPACE }} | |
${{ env.TRITON_TEST_CMD }} --tutorial | |
- name: Run instrumentation tests | |
run: | | |
.venv\Scripts\activate.ps1 | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
cd ${{ env.NEW_WORKSPACE }} | |
${{ env.TRITON_TEST_CMD }} --instrumentation | |
- name: Pass rate | |
run: | | |
.venv\Scripts\activate.ps1 | |
# oneAPI is required for sycl-ls, which is used by scripts/capture-hw-details.sh | |
Invoke-BatchFile "C:\Program Files (x86)\Intel\oneAPI\setvars.bat" | |
cd ${{ env.NEW_WORKSPACE }} | |
pip install defusedxml | |
bash -c "\ | |
source ./scripts/capture-hw-details.sh; \ | |
python scripts/pass_rate.py --reports reports; \ | |
python scripts/pass_rate.py --reports reports --json > pass_rate.json; \ | |
python scripts/pass_rate.py --reports reports --suite tutorials --json > pass_rate_tutorials.json; \ | |
" | |
- name: Upload pass rate report | |
# upload reports only for the default branch | |
if: github.ref_name == 'main' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pass_rate | |
path: ${{ env.NEW_WORKSPACE }}\pass_rate*.json | |
- name: Upload tutorial performance | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tutorials-report | |
if-no-files-found: warn | |
include-hidden-files: true | |
path: | | |
${{ env.NEW_WORKSPACE }}\reports\*\*.csv | |
${{ env.NEW_WORKSPACE }}\reports\.env | |
- name: Clean up workspace | |
if: ${{ always() }} | |
run: | | |
Remove-Item -LiteralPath ${{ env.NEW_WORKSPACE }} -Force -Recurse -ErrorAction Ignore | |
- name: Clear previous PyTorch build | |
if: ${{ always() }} | |
shell: bash | |
run: | | |
rm -rf /c/pytorch/build | |
- name: Clean up temporary files | |
if: ${{ always() }} | |
shell: bash | |
run: | | |
rm -rf rm -rf /tmp/triton-* /tmp/tmp* |