-
Notifications
You must be signed in to change notification settings - Fork 46
360 lines (321 loc) · 11.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
name: E2E performance
on:
workflow_dispatch:
inputs:
install_ipex:
description: Install Intel PyTorch Extension
type: boolean
default: true
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
models:
description: Run all models or a subset
type: choice
options:
- all
- subset
default: subset
only_one_model:
description: Run only this one model
type: string
default: ""
runner_label:
description: Runner label, keep empty for default
type: string
default: ""
TORCH_COMPILE_DEBUG:
description: TORCH_COMPILE_DEBUG
type: string
default: ""
permissions: read-all
env:
TRITON_DISABLE_LINE_INFO: 1
USE_AOT_DEVLIST: pvc
PYTHON_VERSION: "3.10"
BENCHMARK_REPO: weishi-deng/benchmark.git
BENCHMARK_BRANCH: main
INSTALL_IPEX: ${{ inputs.install_ipex }}
TORCH_XPU_OPS_COMMIT: 39522db63ce045f52c9d61a286018c266cd00479
jobs:
setup:
name: Setup
runs-on:
- glados
- spr
- cpu
outputs:
suite: ${{ steps.set-matrix.outputs.suite }}
mode: ${{ steps.set-matrix.outputs.mode }}
dtype: ${{ steps.set-matrix.outputs.dtype }}
models: ${{ steps.set-matrix.outputs.models }}
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
if [[ -z "${{ inputs.models }}" ]]; then
models="subset"
else
models="${{ inputs.models }}"
fi
echo "suite=$suite" >> $GITHUB_OUTPUT
echo "mode=$mode" >> $GITHUB_OUTPUT
echo "dtype=$dtype" >> $GITHUB_OUTPUT
echo "models=$models" >> $GITHUB_OUTPUT
print_inputs:
name: Print inputs
needs: setup
runs-on: Linux
steps:
- name: Print inputs
run: |
echo "${{ toJSON(github.event.inputs) }}"
- name: Print setup outputs
run: |
echo "${{ toJSON(needs.setup.outputs) }}"
build:
name: Test
needs: setup
runs-on:
- ${{ inputs.runner_label || 'max1550' }}
strategy:
matrix:
suite: ${{ fromJson(needs.setup.outputs.suite) }}
mode: ${{ fromJson(needs.setup.outputs.mode) }}
dtype: ${{ fromJson(needs.setup.outputs.dtype) }}
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
run: |
LLVM_COMMIT_ID=$(<cmake/llvm-hash.txt)
echo "LLVM_COMMIT_ID=$LLVM_COMMIT_ID" >> $GITHUB_ENV
- 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
if: ${{ env.INSTALL_IPEX == 'true' }}
uses: ./.github/actions/setup-pytorch
- name: Setup PyTorch without IPEX
if: ${{ env.INSTALL_IPEX == 'false' }}
uses: ./.github/actions/setup-pytorch
with:
repository: pytorch/pytorch
torch_xpu_ops_commit: ${{ env.TORCH_XPU_OPS_COMMIT }}
- name: Install latest nightly wheels including IPEX
if: ${{ env.INSTALL_IPEX == 'true' }}
uses: ./.github/actions/install-wheels
with:
gh_token: ${{ secrets.GITHUB_TOKEN }}
python_version: ${{ env.PYTHON_VERSION }}
- name: Install latest nightly wheels excluding IPEX
if: ${{ env.INSTALL_IPEX == 'false' }}
uses: ./.github/actions/install-wheels
with:
gh_token: ${{ secrets.GITHUB_TOKEN }}
python_version: ${{ env.PYTHON_VERSION }}
wheels_pattern: "!(intel_extension_for_pytorch-*|torch-*).whl"
- name: Setup fake IPEX
if: ${{ env.INSTALL_IPEX == 'false' }}
uses: ./.github/actions/setup-fake-ipex
- name: Identify pinned versions
run: |
cd pytorch
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
if: ${{ matrix.suite == '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: 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: 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
- name: Install transformers package
if: ${{ matrix.suite == 'huggingface' }}
uses: ./.github/actions/install-dependency
with:
package: transformers
repository: huggingface/transformers
ref: ${{ env.TRANSFORMERS_VERSION }}
try-tag-prefix: v
- 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 performance benchmarks
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
# if "only_one_model" is set, then test this model
# if "models" == "subset", then test the models from .github/models/performance/{suite}.txt
# otherwise test all models
if [[ "${{ inputs.only_one_model }}" ]]; then
$GITHUB_WORKSPACE/scripts/inductor_xpu_test.sh ${{ matrix.suite }} ${{ matrix.dtype }} ${{ matrix.mode }} performance xpu 0 static 1 0 ${{ inputs.only_one_model }}
elif [[ "${{ needs.setup.outputs.models }}" == "subset" ]]; then
while read model; do
$GITHUB_WORKSPACE/scripts/inductor_xpu_test.sh ${{ matrix.suite }} ${{ matrix.dtype }} ${{ matrix.mode }} performance xpu 0 static 1 0 $model
done < $GITHUB_WORKSPACE/.github/models/performance/${{ matrix.suite }}.txt
else
$GITHUB_WORKSPACE/scripts/inductor_xpu_test.sh ${{ matrix.suite }} ${{ matrix.dtype }} ${{ matrix.mode }} performance xpu 0 static 1 0
fi
- name: Report environment details
run: |
mkdir -p inductor_log
TIMESTAMP=$(date '+%Y%m%d%H%M%S')
echo "TIMESTAMP=$TIMESTAMP" >> "${GITHUB_ENV}"
source ./scripts/capture-hw-details.sh --quiet
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/llvm-project
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
LIBIGC1_VERSION=$LIBIGC1_VERSION
LEVEL_ZERO_VERSION=$LEVEL_ZERO_VERSION
GPU_DEVICE=$GPU_DEVICE
AGAMA_VERSION=$AGAMA_VERSION
EOF
- name: Copy reports
run: |
if [[ -d torch_compile_debug ]]; then
cp -rT torch_compile_debug inductor_log
fi
- 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 }}