2023-03-13 18:14:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
# Updates Triton to the pinned version for this copy of PyTorch
|
2024-03-05 13:53:53 +00:00
|
|
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
2024-08-23 07:36:34 +00:00
|
|
|
DOWNLOAD_PYTORCH_ORG="https://download.pytorch.org/whl"
|
2024-03-05 13:53:53 +00:00
|
|
|
|
2024-06-07 06:25:44 +00:00
|
|
|
if [[ -z "${USE_XPU}" ]]; then
|
|
|
|
|
# Default install from PyTorch source
|
|
|
|
|
|
|
|
|
|
TRITON_VERSION="pytorch-triton==$(cat .ci/docker/triton_version.txt)"
|
|
|
|
|
if [[ "$BRANCH" =~ .*release.* ]]; then
|
|
|
|
|
pip install --index-url ${DOWNLOAD_PYTORCH_ORG}/test/ $TRITON_VERSION
|
|
|
|
|
else
|
2024-11-25 18:14:13 +00:00
|
|
|
pip install --index-url ${DOWNLOAD_PYTORCH_ORG}/nightly/ $TRITON_VERSION+git$(head -c 8 .ci/docker/ci_commit_pins/triton.txt)
|
2024-06-07 06:25:44 +00:00
|
|
|
fi
|
2024-03-05 13:53:53 +00:00
|
|
|
else
|
2024-08-23 07:36:34 +00:00
|
|
|
# The Triton xpu logic is as follows:
|
|
|
|
|
# 1. By default, install pre-built whls.
|
|
|
|
|
# 2. [Not exposed to user] If the user set `TRITON_XPU_BUILD_FROM_SOURCE=1` flag,
|
|
|
|
|
# it will install Triton from the source.
|
2024-06-07 06:25:44 +00:00
|
|
|
|
2024-08-23 07:36:34 +00:00
|
|
|
TRITON_VERSION="pytorch-triton-xpu==$(cat .ci/docker/triton_version.txt)"
|
2025-01-11 13:11:55 +00:00
|
|
|
TRITON_XPU_COMMIT_ID="$(head -c 8 .ci/docker/ci_commit_pins/triton-xpu.txt)"
|
2024-08-23 07:36:34 +00:00
|
|
|
if [[ -z "${TRITON_XPU_BUILD_FROM_SOURCE}" ]]; then
|
2025-01-11 13:11:55 +00:00
|
|
|
pip install --index-url ${DOWNLOAD_PYTORCH_ORG}/nightly/ ${TRITON_VERSION}+git${TRITON_XPU_COMMIT_ID}
|
2024-08-23 07:36:34 +00:00
|
|
|
else
|
|
|
|
|
TRITON_XPU_REPO="https://github.com/intel/intel-xpu-backend-for-triton"
|
2024-06-07 06:25:44 +00:00
|
|
|
|
2024-08-23 07:36:34 +00:00
|
|
|
# force-reinstall to ensure the pinned version is installed
|
|
|
|
|
pip install --force-reinstall "git+${TRITON_XPU_REPO}@${TRITON_XPU_COMMIT_ID}#subdirectory=python"
|
|
|
|
|
fi
|
2024-03-05 13:53:53 +00:00
|
|
|
fi
|