Skip to content

[UPDATE]: update to oneapi toolkit 2024 and torch version 2.1.0 #92

[UPDATE]: update to oneapi toolkit 2024 and torch version 2.1.0

[UPDATE]: update to oneapi toolkit 2024 and torch version 2.1.0 #92

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 --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
- oneapi-2024.0.1
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==2.1.0a0+cxx11.abi intel_extension_for_pytorch==2.1.10+xpu -f https://developer.intel.com/ipex-whl-stable-xpu
cd python/test/unit/language
python3 -m pytest --verbose --device xpu --ignore=test_line_info.py --ignore=test_subprocess.py
# run test_line_info.py separately with TRITON_DISABLE_LINE_INFO=0
TRITON_DISABLE_LINE_INFO=0 python3 -m pytest 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: Run XPU python tests
run: |
cd python/test/backend/third_party_backends
python3 -m pytest --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