1*da0073e9SAndroid Build Coastguard Worker#!/bin/bash 2*da0073e9SAndroid Build Coastguard Worker# Updates Triton to the pinned version for this copy of PyTorch 3*da0073e9SAndroid Build Coastguard WorkerBRANCH=$(git rev-parse --abbrev-ref HEAD) 4*da0073e9SAndroid Build Coastguard WorkerDOWNLOAD_PYTORCH_ORG="https://download.pytorch.org/whl" 5*da0073e9SAndroid Build Coastguard Worker 6*da0073e9SAndroid Build Coastguard Workerif [[ -z "${USE_XPU}" ]]; then 7*da0073e9SAndroid Build Coastguard Worker # Default install from PyTorch source 8*da0073e9SAndroid Build Coastguard Worker 9*da0073e9SAndroid Build Coastguard Worker TRITON_VERSION="pytorch-triton==$(cat .ci/docker/triton_version.txt)" 10*da0073e9SAndroid Build Coastguard Worker if [[ "$BRANCH" =~ .*release.* ]]; then 11*da0073e9SAndroid Build Coastguard Worker pip install --index-url ${DOWNLOAD_PYTORCH_ORG}/test/ $TRITON_VERSION 12*da0073e9SAndroid Build Coastguard Worker else 13*da0073e9SAndroid Build Coastguard Worker pip install --index-url ${DOWNLOAD_PYTORCH_ORG}/nightly/ $TRITON_VERSION+$(head -c 10 .ci/docker/ci_commit_pins/triton.txt) 14*da0073e9SAndroid Build Coastguard Worker fi 15*da0073e9SAndroid Build Coastguard Workerelse 16*da0073e9SAndroid Build Coastguard Worker # The Triton xpu logic is as follows: 17*da0073e9SAndroid Build Coastguard Worker # 1. By default, install pre-built whls. 18*da0073e9SAndroid Build Coastguard Worker # 2. [Not exposed to user] If the user set `TRITON_XPU_BUILD_FROM_SOURCE=1` flag, 19*da0073e9SAndroid Build Coastguard Worker # it will install Triton from the source. 20*da0073e9SAndroid Build Coastguard Worker 21*da0073e9SAndroid Build Coastguard Worker TRITON_VERSION="pytorch-triton-xpu==$(cat .ci/docker/triton_version.txt)" 22*da0073e9SAndroid Build Coastguard Worker TRITON_XPU_COMMIT_ID="$(head -c 10 .ci/docker/ci_commit_pins/triton-xpu.txt)" 23*da0073e9SAndroid Build Coastguard Worker if [[ -z "${TRITON_XPU_BUILD_FROM_SOURCE}" ]]; then 24*da0073e9SAndroid Build Coastguard Worker pip install --index-url ${DOWNLOAD_PYTORCH_ORG}/nightly/ ${TRITON_VERSION}+${TRITON_XPU_COMMIT_ID} 25*da0073e9SAndroid Build Coastguard Worker else 26*da0073e9SAndroid Build Coastguard Worker TRITON_XPU_REPO="https://github.com/intel/intel-xpu-backend-for-triton" 27*da0073e9SAndroid Build Coastguard Worker 28*da0073e9SAndroid Build Coastguard Worker # force-reinstall to ensure the pinned version is installed 29*da0073e9SAndroid Build Coastguard Worker pip install --force-reinstall "git+${TRITON_XPU_REPO}@${TRITON_XPU_COMMIT_ID}#subdirectory=python" 30*da0073e9SAndroid Build Coastguard Worker fi 31*da0073e9SAndroid Build Coastguard Workerfi 32