Skip to content

Merge OpenAI Triton commit 4dac289 #158

Merge OpenAI Triton commit 4dac289

Merge OpenAI Triton commit 4dac289 #158

name: Build and test
on:
workflow_dispatch:
pull_request:
branches:
- llvm-target
push:
branches:
- llvm-target
env:
BASE: /home/runner
LLVM_SYSPATH: /home/runner/packages/llvm
BACKEND: XPU
TRITON_DISABLE_LINE_INFO: 1
jobs:
pre-commit:
name: Pre-commit checks
runs-on:
- glados
- spr
- cpu
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if pip cache exists
env:
# Increase this value to reset cache
CACHE_NUMBER: 1
run: |
PIP_CACHE_KEY="pip-3.9-${{ hashFiles('.pre-commit-config.yaml') }}-${{ env.CACHE_NUMBER }}"
PIP_CACHE="/cache/$PIP_CACHE_KEY"
echo "PIP_CACHE=$PIP_CACHE" >> "${GITHUB_ENV}"
if [[ -d $PIP_CACHE ]]; then
echo "Python cache found for key $PIP_CACHE_KEY"
echo $PIP_CACHE > .pip-cache
mkdir -p $HOME/.cache
ln -s $PIP_CACHE $HOME/.cache/pip
else
echo "Python cache not found for key $PIP_CACHE_KEY"
fi
- name: Install Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Run pre-commit checks
run: |
pip install --upgrade pre-commit
# TODO: ignore the first yapf failure until https://github.com/google/yapf/issues/1164 is fixed
python3 -m pre_commit run --all-files --verbose yapf &> /dev/null || true
# If first run of yapf worked and made changes reset the tree to the original state
git reset --hard
python3 -m pre_commit run --show-diff-on-failure --color=always --all-files --verbose
- name: Save pip cache
if: ${{ hashFiles('.pip-cache') == '' }}
run: |
TMPDIR=/cache/${{ github.run_id }}-$RANDOM
mkdir $TMPDIR
cp -r $HOME/.cache/pip/* $TMPDIR/
mv $TMPDIR $PIP_CACHE
integration-tests:
name: Integration tests
runs-on:
- glados
- spr
- pvc
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: Check if pip cache exists
env:
# Increase this value to reset cache
CACHE_NUMBER: 1
run: |
PIP_CACHE_KEY="pip-3.9-${{ hashFiles('python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}"
PIP_CACHE="/cache/$PIP_CACHE_KEY"
echo "PIP_CACHE=$PIP_CACHE" >> "${GITHUB_ENV}"
if [[ -d $PIP_CACHE ]]; then
echo "Python cache found for key $PIP_CACHE_KEY"
echo $PIP_CACHE > .pip-cache
mkdir -p $HOME/.cache
ln -s $PIP_CACHE $HOME/.cache/pip
else
echo "Python cache not found for key $PIP_CACHE_KEY"
fi
- name: Install Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Check if packages cache exists
env:
# Increase this value to reset cache
CACHE_NUMBER: 1
run: |
LLVM_COMMIT_ID=$(git ls-remote https://github.com/intel/llvm.git refs/heads/genx | cut -f1)
echo "Latest llvm genx commit id: $LLVM_COMMIT_ID"
COMPOSITE_KEY=$(echo $LLVM_COMMIT_ID ${{ hashFiles('scripts/compile-triton.sh') }} | sha256sum - | cut -d\ -f1)
PACKAGES_CACHE_KEY="packages-$COMPOSITE_KEY-${{ env.CACHE_NUMBER }}"
PACKAGES_CACHE="/cache/$PACKAGES_CACHE_KEY"
echo "PACKAGES_CACHE=$PACKAGES_CACHE" >> "${GITHUB_ENV}"
if [[ -d $PACKAGES_CACHE ]]; then
echo "Packages cache found for key $PACKAGES_CACHE_KEY"
echo $PACKAGES_CACHE > .packages-cache
ln -s $PACKAGES_CACHE $HOME/packages
else
echo "Packages cache not found for key $PACKAGES_CACHE_KEY"
fi
- name: Build packages
if: ${{ hashFiles('.packages-cache') == '' }}
run: |
./scripts/compile-triton.sh
- name: Save packages cache
if: ${{ hashFiles('.packages-cache') == '' }}
run: |
TMPDIR=/cache/${{ github.run_id }}-$RANDOM
mkdir $TMPDIR
cp -r $HOME/packages/* $TMPDIR/
mv $TMPDIR $PACKAGES_CACHE
- name: Build Triton
run: |
cd python
pip install wheel
pip install --no-build-isolation '.[tests]'
- name: Run lit tests
run: |
pip install lit
cd python
lit -v build/*/test
- name: Run core tests
run: |
pip install pytest pytest-xdist
pip install torch==1.13.0a0+git6c9b55e intel_extension_for_pytorch==1.13.120+xpu -f https://developer.intel.com/ipex-whl-stable-xpu
cd python/test/unit
python3 -m pytest -n 8 --verbose --device xpu language/ --ignore=language/test_line_info.py --ignore=language/test_subprocess.py
# run runtime tests serially to avoid race condition with cache handling.
python3 -m pytest runtime/
# run test_line_info.py separately with TRITON_DISABLE_LINE_INFO=0
TRITON_DISABLE_LINE_INFO=0 python3 -m pytest --verbose --device xpu language/test_line_info.py
- name: Run assert/print tests
run: |
cd python/test/unit/language
python3 assert_helper.py device_assert
python3 print_helper.py device_print float 1> /dev/null
- name: Clear cache
run: |
rm -rf ~/.triton
- name: Run interpreter tests
env:
# TRITON_INTERPRET: "1"
CUA_VISIBLE_DEVICES: ""
run: |
cd python/test/unit
python3 -m pytest -vs operators/test_flash_attention.py
- name: Run partial operators tests
run: |
cd python/test/unit
python3 -m pytest -n 8 --verbose operators
- name: Run XPU python tests
run: |
cd python/test/backend/third_party_backends
python3 -m pytest -n auto --verbose test_xpu_backend.py
- name: Run CXX unittests
run: |
cd python/build/*cmake*
ctest
- name: Save pip cache
if: ${{ hashFiles('.pip-cache') == '' }}
run: |
TMPDIR=/cache/${{ github.run_id }}-$RANDOM
mkdir $TMPDIR
cp -r $HOME/.cache/pip/* $TMPDIR/
mv $TMPDIR $PIP_CACHE