-
Notifications
You must be signed in to change notification settings - Fork 44
199 lines (174 loc) · 6.4 KB
/
build_and_test_2.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
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