-
Notifications
You must be signed in to change notification settings - Fork 46
400 lines (356 loc) · 13.8 KB
/
e2e-performance.yml
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
name: E2E performance mode
on:
workflow_dispatch:
inputs:
suite:
description: Test suite
type: choice
options:
- all
- huggingface
- timm_models
- torchbench
default: all
mode:
description: Inference/Training
type: choice
options:
- all
- inference
- training
default: all
dtype:
description: Data type
type: choice
options:
- all
- amp_bf16
- amp_fp16
- bfloat16
- float16
- float32
default: all
TORCH_COMPILE_DEBUG:
description: TORCH_COMPILE_DEBUG
type: string
default: ""
# schedule:
# - cron: "5 1 * * *"
permissions: read-all
env:
BASE: /home/runner
LLVM_SYSPATH: /home/runner/packages/llvm
BACKEND: XPU
TRITON_DISABLE_LINE_INFO: 1
USE_AOT_DEVLIST: pvc
PYTHON_VERSION: "3.10"
LLVM_REPO: intel/llvm.git
LLVM_BRANCH: genx
BENCHMARK_REPO: weishi-deng/benchmark.git
BENCHMARK_BRANCH: main
jobs:
matrix:
name: Matrix
runs-on:
- glados
- spr
- cpu
outputs:
suite: ${{ steps.set-matrix.outputs.suite }}
mode: ${{ steps.set-matrix.outputs.mode }}
dtype: ${{ steps.set-matrix.outputs.dtype }}
timeout-minutes: 10
steps:
- name: Set matrix
id: set-matrix
run: |
if [[ -z "${{ inputs.suite }}" || "${{ inputs.suite }}" == "all" ]]; then
suite='["huggingface", "timm_models", "torchbench"]'
else
suite='["${{ inputs.suite }}"]'
fi
if [[ -z "${{ inputs.mode }}" || "${{ inputs.mode }}" == "all" ]]; then
mode='["inference", "training"]'
else
mode='["${{ inputs.mode }}"]'
fi
if [[ -z "${{ inputs.dtype }}" || "${{ inputs.dtype }}" == "all" ]]; then
dtype='["amp_bf16", "amp_fp16", "bfloat16", "float16", "float32"]'
else
dtype='["${{ inputs.dtype }}"]'
fi
echo "suite=$suite" >> $GITHUB_OUTPUT
echo "mode=$mode" >> $GITHUB_OUTPUT
echo "dtype=$dtype" >> $GITHUB_OUTPUT
build:
name: Test
needs: matrix
runs-on:
- glados
- spr
- runner-0.0.7
strategy:
matrix:
suite: ${{ fromJson(needs.matrix.outputs.suite) }}
mode: ${{ fromJson(needs.matrix.outputs.mode) }}
dtype: ${{ fromJson(needs.matrix.outputs.dtype) }}
max-parallel: 2
fail-fast: false
timeout-minutes: 720
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: Get LLVM commit id
uses: ./.github/actions/get-commit-id
with:
repository: ${{ env.LLVM_REPO }}
branch: ${{ env.LLVM_BRANCH }}
variable: LLVM_COMMIT_ID
- name: Get benchmark commit id
uses: ./.github/actions/get-commit-id
with:
repository: ${{ env.BENCHMARK_REPO }}
branch: ${{ env.BENCHMARK_BRANCH }}
variable: BENCHMARK_COMMIT_ID
- name: Load pip cache
id: pip-cache
uses: ./.github/actions/load
with:
path: $HOME/.cache/pip
# pip cache per commit id just to minimize network traffic
key: pip-$PYTHON_VERSION-$GITHUB_SHA
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Python build dependencies
run: |
pip install wheel
- name: Setup PyTorch
uses: ./.github/actions/setup-pytorch
- name: Identify pinned versions
run: |
cd pytorch
echo "TORCHVISION_COMMIT_ID=$(<.github/ci_commit_pins/vision.txt)" >> "${GITHUB_ENV}"
echo "TORCHTEXT_COMMIT_ID=$(<.github/ci_commit_pins/text.txt)" >> "${GITHUB_ENV}"
echo "TORCHAUDIO_COMMIT_ID=$(<.github/ci_commit_pins/audio.txt)" >> "${GITHUB_ENV}"
echo "TRANSFORMERS_VERSION=$(<.ci/docker/ci_commit_pins/huggingface.txt)" >> "${GITHUB_ENV}"
echo "TIMM_COMMIT_ID=$(<.ci/docker/ci_commit_pins/timm.txt)" >> "${GITHUB_ENV}"
# TIMM depends on torch and torchvision, so, in general, it needs to be installed before
# installing custom torch and torchvision, but instead we install its dependencies except
# torch and torchvision.
- name: Install TIMM Models
run: |
# install timm without dependencies
pip install --no-deps git+https://github.com/huggingface/pytorch-image-models@$TIMM_COMMIT_ID
# install timm dependencies without torch and torchvision
pip install $(curl -sSL https://raw.githubusercontent.com/huggingface/pytorch-image-models/$TIMM_COMMIT_ID/requirements.txt | grep -vE torch)
- name: Setup IPEX
uses: ./.github/actions/setup-ipex
- name: Generate Triton cache key
id: triton-key
run: |
COMPOSITE_KEY=$(echo $PYTHON_VERSION $LLVM_COMMIT_ID $GITHUB_SHA | sha256sum - | cut -d\ -f1)
echo "key=triton-$COMPOSITE_KEY" >> $GITHUB_OUTPUT
- name: Load Triton wheels from a cache
id: triton-cache
uses: ./.github/actions/load
with:
path: python/dist
key: ${{ steps.triton-key.outputs.key }}
- name: Generate packages cache key
if: ${{ steps.triton-cache.outputs.status == 'miss' }}
id: packages-key
env:
# Increase this value to reset cache
CACHE_NUMBER: 1
run: |
COMPOSITE_KEY=$(echo $LLVM_COMMIT_ID ${{ hashFiles('scripts/compile-triton.sh') }} | sha256sum - | cut -d\ -f1)
echo "key=packages-$COMPOSITE_KEY-$CACHE_NUMBER" >> $GITHUB_OUTPUT
- name: Load packages from a cache
if: ${{ steps.triton-cache.outputs.status == 'miss' }}
id: packages-cache
uses: ./.github/actions/load
with:
path: $HOME/packages
key: ${{ steps.packages-key.outputs.key }}
- name: Build packages
if: ${{ steps.triton-cache.outputs.status == 'miss' && steps.packages-cache.outputs.status == 'miss' }}
run: |
./scripts/compile-triton.sh --llvm
- name: Save packages to a cache
if: ${{ steps.triton-cache.outputs.status == 'miss' && steps.packages-cache.outputs.status == 'miss' }}
uses: ./.github/actions/save
with:
path: ${{ steps.packages-cache.outputs.path }}
dest: ${{ steps.packages-cache.outputs.dest }}
- name: Build Triton wheels
if: ${{ steps.triton-cache.outputs.status == 'miss' }}
run: |
export DEBUG=1
cd python
python setup.py bdist_wheel
- name: Install Triton
run: |
pip install python/dist/*.whl
- name: Save Triton wheels to a cache
if: ${{ steps.triton-cache.outputs.status == 'miss' }}
uses: ./.github/actions/save
with:
path: ${{ steps.triton-cache.outputs.path }}
dest: ${{ steps.triton-cache.outputs.dest }}
- name: Install python test dependencies
run: |
pip install pyyaml pandas scipy numpy psutil pyre_extensions torchrec transformers==$TRANSFORMERS_VERSION
- name: Load torchvision from a cache
if: ${{ matrix.suite == 'timm_models' || matrix.suite == 'torchbench' }}
id: torchvision-cache
uses: ./.github/actions/load
with:
path: vision
key: torchvision-$PYTHON_VERSION-$TORCHVISION_COMMIT_ID
- name: Build torchvision wheels
if: ${{ (matrix.suite == 'timm_models' || matrix.suite == 'torchbench') && steps.torchvision-cache.outputs.status == 'miss' }}
run: |
git clone --single-branch -b main https://github.com/pytorch/vision.git
cd vision
git checkout $TORCHVISION_COMMIT_ID
python setup.py bdist_wheel
- name: Install torchvision
if: ${{ matrix.suite == 'timm_models' || matrix.suite == 'torchbench' }}
run: |
pip install vision/dist/*.whl
python -c "import torchvision; print(torchvision.__version__)"
- name: Save torchvision to a cache
if: ${{ (matrix.suite == 'timm_models' || matrix.suite == 'torchbench') && steps.torchvision-cache.outputs.status == 'miss' }}
uses: ./.github/actions/save
with:
path: ${{ steps.torchvision-cache.outputs.path }}
dest: ${{ steps.torchvision-cache.outputs.dest }}
- name: Load torchtext from a cache
if: ${{ matrix.suite == 'torchbench' }}
id: torchtext-cache
uses: ./.github/actions/load
with:
path: text
key: torchtext-$PYTHON_VERSION-$TORCHTEXT_COMMIT_ID
- name: Build torchtext wheels
if: ${{ matrix.suite == 'torchbench' && steps.torchtext-cache.outputs.status == 'miss'}}
run: |
git clone --recurse-submodules --jobs 8 --single-branch -b main https://github.com/pytorch/text.git
cd text
git checkout $TORCHTEXT_COMMIT_ID
python setup.py bdist_wheel
- name: Install torchtext
if: ${{ matrix.suite == 'torchbench' }}
run: |
pip install text/dist/*.whl
python -c "import torchtext; print(torchtext.__version__)"
- name: Save torchtext to a cache
if: ${{ matrix.suite == 'torchbench' && steps.torchtext-cache.outputs.status == 'miss' }}
uses: ./.github/actions/save
with:
path: ${{ steps.torchtext-cache.outputs.path }}
dest: ${{ steps.torchtext-cache.outputs.dest }}
- name: Load torchaudio from a cache
if: ${{ matrix.suite == 'torchbench' }}
id: torchaudio-cache
uses: ./.github/actions/load
with:
path: audio
key: torchaudio-$PYTHON_VERSION-$TORCHAUDIO_COMMIT_ID
- name: Build torchaudio wheels
if: ${{ matrix.suite == 'torchbench' && steps.torchaudio-cache.outputs.status == 'miss' }}
run: |
git clone --single-branch -b main https://github.com/pytorch/audio.git
cd audio
git checkout $TORCHAUDIO_COMMIT_ID
python setup.py bdist_wheel
- name: Install torchaudio
if: ${{ matrix.suite == 'torchbench' }}
run: |
pip install audio/dist/*.whl
python -c "import torchaudio; print(torchaudio.__version__)"
- name: Save torchaudio to a cache
if: ${{ matrix.suite == 'torchbench' && steps.torchaudio-cache.outputs.status == 'miss' }}
uses: ./.github/actions/save
with:
path: ${{ steps.torchaudio-cache.outputs.path }}
dest: ${{ steps.torchaudio-cache.outputs.dest }}
- name: Clone pytorch benchmark
if: ${{ matrix.suite == 'torchbench' }}
uses: actions/checkout@v4
with:
repository: ${{ env.BENCHMARK_REPO }}
ref: ${{ env.BENCHMARK_BRANCH }}
submodules: recursive
path: benchmark
- name: Install pytorch benchmark
if: ${{ matrix.suite == 'torchbench' }}
run: |
cd benchmark
python install.py
pip install -e .
- name: Run e2e tests
env:
HUGGING_FACE_HUB_TOKEN: ${{ secrets.HUGGING_FACE_HUB_TOKEN }}
run: |
export WORKSPACE=$GITHUB_WORKSPACE
if [[ "${{ inputs.TORCH_COMPILE_DEBUG }}" == "1" ]] ; then
export TORCH_COMPILE_DEBUG="1"
# torch will save debug logs to $TORCH_COMPILE_DEBUG_DIR/torch_compile_debug
export TORCH_COMPILE_DEBUG_DIR=$GITHUB_WORKSPACE
fi
cd pytorch
$GITHUB_WORKSPACE/scripts/inductor_xpu_test.sh ${{ matrix.suite }} ${{ matrix.dtype }} ${{ matrix.mode }} performance xpu 0
- name: Report environment details
run: |
mkdir -p inductor_log
TIMESTAMP=$(date '+%Y%m%d%H%M%S')
echo "TIMESTAMP=$TIMESTAMP" >> "${GITHUB_ENV}"
cat <<EOF | tee inductor_log/.env
TIMESTAMP=$TIMESTAMP
JOB_NAME=${{ join(matrix.*, '-') }}
GITHUB_RUN_ID=$GITHUB_RUN_ID
GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER
GITHUB_RUN_ATTEMPT=$GITHUB_RUN_ATTEMPT
PYTHON_VERSION=$PYTHON_VERSION
PYTORCH_REPO=$PYTORCH_REPO
PYTORCH_COMMIT_ID=$PYTORCH_COMMIT_ID
IPEX_REPO=$IPEX_REPO
IPEX_COMMIT_ID=$IPEX_COMMIT_ID
LLVM_REPO=$LLVM_REPO
LLVM_COMMIT_ID=$LLVM_COMMIT_ID
BENCHMARK_REPO=$BENCHMARK_REPO
BENCHMARK_COMMIT_ID=$BENCHMARK_COMMIT_ID
TRITON_REPO=$GITHUB_REPOSITORY
TRITON_COMMIT_ID=$GITHUB_SHA
TORCHVISION_COMMIT_ID=$TORCHVISION_COMMIT_ID
TORCHTEXT_COMMIT_ID=$TORCHTEXT_COMMIT_ID
TORCHAUDIO_COMMIT_ID=$TORCHAUDIO_COMMIT_ID
TRANSFORMERS_VERSION=$TRANSFORMERS_VERSION
TIMM_COMMIT_ID=$TIMM_COMMIT_ID
EOF
- name: Copy reports
run: |
if [[ -d torch_compile_debug ]]; then
cp -rT torch_compile_debug inductor_log
fi
mkdir -p /cache/reports/e2e-performance
TMPDIR=$(mktemp -d -p /cache/reports/e2e-performance XXXXXXXXX.tmp)
cp -rT $GITHUB_WORKSPACE/inductor_log $TMPDIR
mv -T $TMPDIR /cache/reports/e2e-performance/$TIMESTAMP-${{ join(matrix.*, '-') }} || rm -rf $TMPDIR
- name: Upload test logs
uses: actions/upload-artifact@v4
with:
name: logs-${{ join(matrix.*, '-') }}
path: inductor_log
- name: Save pip cache
if: ${{ steps.pip-cache.outputs.status == 'miss' }}
uses: ./.github/actions/save
with:
path: ${{ steps.pip-cache.outputs.path }}
dest: ${{ steps.pip-cache.outputs.dest }}