Triton wheels #199
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
name: Triton wheels | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "5 23 * * *" | |
permissions: read-all | |
env: | |
USE_AOT_DEVLIST: pvc | |
jobs: | |
build: | |
name: Build | |
runs-on: | |
- max1100 | |
- rolling | |
- runner-0.0.19 | |
strategy: | |
matrix: | |
python: | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
mode: | |
- pytorch | |
fail-fast: false | |
max-parallel: 2 | |
defaults: | |
run: | |
shell: bash -noprofile --norc -eo pipefail -c "source /home/runner/intel/oneapi/setvars.sh > /dev/null; source {0}" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install Python build dependencies | |
run: | | |
pip install wheel | |
- name: Setup PyTorch with IPEX | |
if: ${{ matrix.mode == 'ipex' }} | |
uses: ./.github/actions/setup-pytorch | |
with: | |
repository: Stonepia/pytorch | |
- name: Setup PyTorch without IPEX | |
if: ${{ matrix.mode == 'pytorch' }} | |
uses: ./.github/actions/setup-pytorch | |
with: | |
repository: pytorch/pytorch | |
- name: Identify pinned versions | |
run: | | |
cd pytorch | |
echo "TORCHVISION_COMMIT_ID=$(<.github/ci_commit_pins/vision.txt)" >> $GITHUB_ENV | |
echo "TORCHTEXT_COMMIT_ID=$(<.github/ci_commit_pins/text.txt)" >> $GITHUB_ENV | |
echo "TORCHAUDIO_COMMIT_ID=$(<.github/ci_commit_pins/audio.txt)" >> $GITHUB_ENV | |
- name: Setup IPEX | |
if: ${{ matrix.mode == 'ipex' }} | |
uses: ./.github/actions/setup-ipex | |
- name: Identify Triton commit id | |
run: | | |
echo "TRITON_COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Generate Triton cache key | |
id: triton-key | |
run: | | |
COMPOSITE_KEY=$(echo ${{ matrix.python }} $PYTORCH_VERSION $TRITON_COMMIT_ID | sha256sum - | cut -d\ -f1) | |
echo "key=triton-$COMPOSITE_KEY" >> $GITHUB_OUTPUT | |
- name: Load Triton wheels from a cache | |
id: triton-cache | |
uses: ./.github/actions/load | |
with: | |
path: python/dist | |
key: ${{ steps.triton-key.outputs.key }} | |
- name: Build Triton wheels | |
if: ${{ steps.triton-cache.outputs.status == 'miss' }} | |
uses: ./.github/actions/setup-triton | |
with: | |
command: > | |
DEBUG=1 | |
TRITON_WHEEL_VERSION_SUFFIX="+git$(git rev-parse --short HEAD)" | |
python setup.py bdist_wheel && pip install dist/*.whl | |
- name: Save Triton wheels to a cache | |
if: ${{ steps.triton-cache.outputs.status == 'miss' }} | |
uses: ./.github/actions/save | |
with: | |
path: ${{ steps.triton-cache.outputs.path }} | |
dest: ${{ steps.triton-cache.outputs.dest }} | |
- name: Install torchvision package | |
uses: ./.github/actions/install-dependency | |
with: | |
package: torchvision | |
repository: pytorch/vision | |
ref: ${{ env.TORCHVISION_COMMIT_ID }} | |
extra-cache-key: ${{ env.PYTORCH_VERSION }} | |
# FIXME: old PyTorch does not work with torchdata=0.8.0 | |
- name: Install torchdata package | |
if: ${{ matrix.mode == 'ipex' }} | |
run: | | |
pip install 'torchdata<0.8.0' | |
- name: Install torchtext package | |
uses: ./.github/actions/install-dependency | |
with: | |
package: torchtext | |
repository: pytorch/text | |
ref: ${{ env.TORCHTEXT_COMMIT_ID }} | |
extra-cache-key: ${{ env.PYTORCH_VERSION }} | |
- name: Install torchaudio package | |
uses: ./.github/actions/install-dependency | |
with: | |
package: torchaudio | |
repository: pytorch/audio | |
ref: ${{ env.TORCHAUDIO_COMMIT_ID }} | |
extra-cache-key: ${{ env.PYTORCH_VERSION }} | |
- name: Prepare wheels for upload | |
run: | | |
mkdir -p wheels | |
cp -L pytorch/dist/*.whl wheels/ | |
cp -L python/dist/*.whl wheels/ | |
cp -L torchvision*/dist/*.whl wheels/ | |
cp -L torchtext*/dist/*.whl wheels/ | |
cp -L torchaudio*/dist/*.whl wheels/ | |
- name: Prepare IPEX wheels for upload | |
if: ${{ matrix.mode == 'ipex' }} | |
run: | | |
mkdir -p wheels | |
cp -L intel-extension-for-pytorch/dist/*.whl wheels/ | |
- name: Report environment details | |
run: | | |
TIMESTAMP=$(date '+%Y%m%d') | |
echo "TIMESTAMP=$TIMESTAMP" >> "${GITHUB_ENV}" | |
cat <<EOF | tee wheels/.env | |
TIMESTAMP=$TIMESTAMP | |
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_REPO | |
PYTORCH_COMMIT_ID=$PYTORCH_COMMIT_ID | |
IPEX_REPO=$IPEX_REPO | |
IPEX_COMMIT_ID=$IPEX_COMMIT_ID | |
LLVM_REPO=llvm/llvm-project | |
LLVM_COMMIT_ID=$LLVM_COMMIT_ID | |
TRITON_REPO=intel/intel-xpu-backend-for-triton | |
TRITON_COMMIT_ID=$TRITON_COMMIT_ID | |
TORCHVISION_COMMIT_ID=$TORCHVISION_COMMIT_ID | |
TORCHTEXT_COMMIT_ID=$TORCHTEXT_COMMIT_ID | |
TORCHAUDIO_COMMIT_ID=$TORCHAUDIO_COMMIT_ID | |
EOF | |
- name: Upload IPEX wheels to artifacts | |
if: ${{ matrix.mode == 'ipex' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-py${{ matrix.python }}-${{ env.TIMESTAMP }} | |
path: wheels | |
- name: Upload PyTorch wheels to artifacts | |
if: ${{ matrix.mode == 'pytorch' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-pytorch-py${{ matrix.python }}-${{ env.TIMESTAMP }} | |
path: wheels |