-
Notifications
You must be signed in to change notification settings - Fork 44
246 lines (210 loc) · 8.05 KB
/
nightly-wheels.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
name: Triton wheels
on:
workflow_dispatch:
schedule:
- cron: "5 23 * * *"
permissions: read-all
env:
BASE: /home/runner
LLVM_SYSPATH: /home/runner/packages/llvm
USE_AOT_DEVLIST: pvc
LLVM_REPO: intel/llvm.git
LLVM_BRANCH: genx
jobs:
build:
name: Build
runs-on:
- glados
- spr
- runner-0.0.6
strategy:
matrix:
python:
- "3.9"
- "3.10"
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: Install Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- 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
- name: Setup IPEX
uses: ./.github/actions/setup-ipex
- name: Identify LLVM commit id
run: |
echo "LLVM_COMMIT_ID=$(git ls-remote https://github.com/$LLVM_REPO refs/heads/$LLVM_BRANCH | cut -f1)" >> $GITHUB_ENV
- name: Identify Triton commit id
run: |
echo "TRITON_COMMIT_ID=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Generate Triton cache key
id: triton-key
run: |
COMPOSITE_KEY=$(echo ${{ matrix.python }} $LLVM_COMMIT_ID $TRITON_COMMIT_ID | 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: Load torchvision from a cache
id: torchvision-cache
uses: ./.github/actions/load
with:
path: vision
key: torchvision-$PYTHON_VERSION-$TORCHVISION_COMMIT_ID
- name: Build torchvision wheels
if: ${{ 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
run: |
pip install vision/dist/*.whl
python -c "import torchvision; print(torchvision.__version__)"
- name: Save torchvision to a cache
if: ${{ 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
id: torchtext-cache
uses: ./.github/actions/load
with:
path: text
key: torchtext-$PYTHON_VERSION-$TORCHTEXT_COMMIT_ID
- name: Build torchtext wheels
if: ${{ 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
run: |
pip install text/dist/*.whl
python -c "import torchtext; print(torchtext.__version__)"
- name: Save torchtext to a cache
if: ${{ 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
id: torchaudio-cache
uses: ./.github/actions/load
with:
path: audio
key: torchaudio-$PYTHON_VERSION-$TORCHAUDIO_COMMIT_ID
- name: Build torchaudio wheels
if: ${{ 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
run: |
pip install audio/dist/*.whl
python -c "import torchaudio; print(torchaudio.__version__)"
- name: Save torchaudio to a cache
if: ${{ steps.torchaudio-cache.outputs.status == 'miss' }}
uses: ./.github/actions/save
with:
path: ${{ steps.torchaudio-cache.outputs.path }}
dest: ${{ steps.torchaudio-cache.outputs.dest }}
- name: Prepare wheels for upload
run: |
mkdir -p wheels
cp -L pytorch/dist/*.whl wheels/
cp -L intel-extension-for-pytorch/dist/*.whl wheels/
cp -L python/dist/*.whl wheels/
cp -L vision/dist/*.whl wheels/
cp -L text/dist/*.whl wheels/
cp -L audio/dist/*.whl wheels/
- name: Report environment details
run: |
TIMESTAMP=$(date '+%Y%m%d')
echo "TIMESTAMP=$TIMESTAMP" >> "${GITHUB_ENV}"
cat <<EOF | tee wheels/.env
TIMESTAMP=$TIMESTAMP
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
TRITON_REPO=intel/intel-xpu-backend-for-triton
TRITON_COMMIT_ID=$TRITON_COMMIT_ID
TORCHVISION_COMMIT_ID=$TORCHVISION_COMMIT_ID
TORCHTEXT_COMMIT_ID=$TORCHTEXT_COMMIT_ID
TORCHAUDIO_COMMIT_ID=$TORCHAUDIO_COMMIT_ID
EOF
- name: Upload wheels to artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-py${{ matrix.python }}-${{ env.TIMESTAMP }}
path: wheels