forked from CHIP-SPV/chipStar
-
Notifications
You must be signed in to change notification settings - Fork 0
281 lines (274 loc) · 12 KB
/
presubmit.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
name: pocl-cpu
on:
push:
paths-ignore: "docs/**"
pull_request:
paths-ignore: "docs/**"
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
paths_ignore: '["docs/**"]'
do_not_skip: '["pull_request"]'
spirv-tools:
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
name: Build and cache spirv-tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: spirv-tools
env:
cache-name: cache-spirv-tools
with:
path: ~/opt/SPIRV-Tools/v2023.2
key: ${{ runner.os }}-build-${{ env.cache-name }}
- run: sudo apt update; sudo apt install -y gcc cmake python3
if: steps.spirv-tools.outputs.cache-hit != 'true'
- uses: actions/checkout@v3
with:
repository: KhronosGroup/SPIRV-Tools
ref: v2023.2
path: SPIRV-Tools
fetch-depth: 0
if: steps.spirv-tools.outputs.cache-hit != 'true'
- run: python3 utils/git-sync-deps
working-directory: SPIRV-Tools/
if: steps.spirv-tools.outputs.cache-hit != 'true'
- run: mkdir -p SPIRV-Tools/build
if: steps.spirv-tools.outputs.cache-hit != 'true'
- run: cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/opt/SPIRV-Tools/v2023.2 -DSPIRV_SKIP_TESTS=ON
working-directory: SPIRV-Tools/build
if: steps.spirv-tools.outputs.cache-hit != 'true'
- run: cmake --build . --parallel 4
working-directory: SPIRV-Tools/build
if: steps.spirv-tools.outputs.cache-hit != 'true'
- run: cmake --install .
working-directory: SPIRV-Tools/build
if: steps.spirv-tools.outputs.cache-hit != 'true'
llvm:
needs: [pre_job, spirv-tools]
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
name: Build and cache llvm-${{ matrix.llvm-version }}
runs-on: ubuntu-latest
strategy:
matrix:
llvm-version: [15, 16, 17]
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: spirv-tools
env:
cache-name: cache-spirv-tools
with:
path: ~/opt/SPIRV-Tools/v2023.2
key: ${{ runner.os }}-build-${{ env.cache-name }}
fail-on-cache-miss: true
- id: get-shas
uses: ./.github/actions/get-shas
with:
pocl-version: ${{ matrix.pocl-version }}
llvm-version: ${{ matrix.llvm-version }}
- uses: actions/cache@v3
id: llvm
env:
cache-name: cache-llvm-${{ matrix.llvm-version }}
with:
path: ~/opt/llvm/${{ matrix.llvm-version }}
key: ${{ steps.get-shas.outputs.llvm-cache-key }}
- run: sudo apt update; sudo apt install -y gcc cmake
if: steps.llvm.outputs.cache-hit != 'true'
- uses: actions/checkout@v3
with:
repository: CHIP-SPV/llvm-project
ref: ${{ steps.get-shas.outputs.llvm-sha }}
path: llvm-${{ matrix.llvm-version }}
if: steps.llvm.outputs.cache-hit != 'true'
- uses: actions/checkout@v3
with:
repository: KhronosGroup/SPIRV-LLVM-Translator
ref: ${{ steps.get-shas.outputs.spirv-llvm-sha }}
path: llvm-${{ matrix.llvm-version }}/llvm/projects/SPIRV-LLVM-Translator
if: steps.llvm.outputs.cache-hit != 'true'
- run: mkdir -p llvm-${{ matrix.llvm-version }}/build
if: steps.llvm.outputs.cache-hit != 'true'
- run: cmake -S llvm -B build -DLLVM_ENABLE_PROJECTS="clang;openmp" -DCMAKE_INSTALL_PREFIX=$HOME/opt/llvm/${{ matrix.llvm-version }} -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_SPIRV_INCLUDE_TESTS=OFF
env:
PKG_CONFIG_PATH: ~/opt/SPIRV-Tools/v2023.2/lib/pkgconfig/
working-directory: llvm-${{ matrix.llvm-version }}
if: steps.llvm.outputs.cache-hit != 'true'
- run: cmake --build . --parallel 4
working-directory: llvm-${{ matrix.llvm-version }}/build
if: steps.llvm.outputs.cache-hit != 'true'
- run: cmake --install .
working-directory: llvm-${{ matrix.llvm-version }}/build
if: steps.llvm.outputs.cache-hit != 'true'
pocl:
needs: [pre_job, llvm, spirv-tools]
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
name: Build and cache pocl ${{ matrix.pocl-version }} (llvm-${{ matrix.llvm-version }})
runs-on: ubuntu-latest
strategy:
matrix:
pocl-version: [4, 5]
llvm-version: [15, 16, 17]
exclude:
- pocl-version: 4
llvm-version: 17
fail-fast: false
steps:
- uses: actions/checkout@v3
- id: get-shas
uses: ./.github/actions/get-shas
with:
pocl-version: ${{ matrix.pocl-version }}
llvm-version: ${{ matrix.llvm-version }}
- uses: actions/cache@v3
id: pocl
env:
cache-name: cache-pocl-${{ matrix.pocl-version }}-llvm-${{ matrix.llvm-version }}
with:
path: ~/opt/pocl/${{ matrix.pocl-version }}.0-${{ matrix.llvm-version }}
key: ${{ steps.get-shas.outputs.pocl-cache-key }}
- name: Check PoCL Key
run: echo ${{ steps.get-shas.outputs.pocl-cache-key }}
- uses: actions/cache@v3
id: spirv-tools
env:
cache-name: cache-spirv-tools
with:
path: ~/opt/SPIRV-Tools/v2023.2
key: ${{ runner.os }}-build-${{ env.cache-name }}
fail-on-cache-miss: true
if: steps.pocl.outputs.cache-hit != 'true'
- uses: actions/cache@v3
id: llvm
env:
cache-name: cache-llvm-${{ matrix.llvm-version }}
with:
path: ~/opt/llvm/${{ matrix.llvm-version }}
key: ${{ steps.get-shas.outputs.llvm-cache-key }}
fail-on-cache-miss: true
if: steps.pocl.outputs.cache-hit != 'true'
- run: sudo add-apt-repository ppa:ocl-icd/ppa; sudo apt update
if: steps.pocl.outputs.cache-hit != 'true'
- run: sudo apt install -y python3-dev libpython3-dev build-essential cmake git pkg-config make ninja-build ocl-icd-libopencl1 ocl-icd-dev ocl-icd-opencl-dev libhwloc-dev zlib1g zlib1g-dev clinfo dialog apt-utils libxml2-dev
if: steps.pocl.outputs.cache-hit != 'true'
- uses: actions/checkout@v3
with:
repository: pocl/pocl
ref: ${{ steps.get-shas.outputs.pocl-sha }}
path: pocl
if: steps.pocl.outputs.cache-hit != 'true'
- run: mkdir -p pocl/build
if: steps.pocl.outputs.cache-hit != 'true'
- run: cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/opt/pocl/${{ matrix.pocl-version }}.0-${{ matrix.llvm-version }} -DCMAKE_BUILD_TYPE=Release -DWITH_LLVM_CONFIG=$HOME/opt/llvm/${{ matrix.llvm-version }}/bin/llvm-config -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF -DSTATIC_LLVM=ON -DKERNELLIB_HOST_CPU_VARIANTS=distro
working-directory: pocl/build
if: steps.pocl.outputs.cache-hit != 'true'
- run: cmake --build . --parallel $(nproc)
working-directory: pocl/build
if: steps.pocl.outputs.cache-hit != 'true'
- run: cmake --install .
working-directory: pocl/build
if: steps.pocl.outputs.cache-hit != 'true'
- name: Check PoCL Installation
run: ls $HOME/opt/pocl/${{ matrix.pocl-version }}.0-${{ matrix.llvm-version }}/etc/OpenCL/vendors/
chipstar:
needs: [pre_job, llvm, spirv-tools, pocl]
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
name: Build and test chipStar on ${{ matrix.backend }} ${{matrix.pocl-version }} (llvm-${{ matrix.llvm-version }})
runs-on: ubuntu-latest
env:
EXCLUDE: ${{ matrix.backend == 'intel' && '"`cat ./test_lists/OPENCL_POCL.txt`|`cat ./test_lists/ALL.txt`"' || '"`cat ./test_lists/OPENCL_POCL.txt`|`cat ./test_lists/ALL.txt`"' }}
strategy:
matrix:
pocl-version: [4, 5]
llvm-version: [15, 16, 17]
backend: [pocl, intel]
exclude:
- backend: pocl
pocl-version: 4
llvm-version: 17
- backend: intel
pocl-version: 4
- backend: intel
pocl-version: 5
fail-fast: false
steps:
- name: Set OPENCL_ENV for intel
if: matrix.backend == 'intel'
run: echo "OPENCL_ENV=LD_LIBRARY_PATH=$(dirname $(find /opt/intel -name libsvml.so)):$(dirname $(find /opt/intel/oneapi/tbb -name libtbb.so* -print -quit)):$LD_LIBRARY_PATH OCL_ICD_FILENAMES=$(cat /etc/OpenCL/vendors/intel64.icd)" >> $GITHUB_ENV
- name: Set OPENCL_ENV for other
if: matrix.backend == 'pocl'
run: echo "OPENCL_ENV=OPENCL_VENDOR_PATH=$HOME/opt/pocl/${{ matrix.pocl-version }}.0-${{ matrix.llvm-version }}/etc/OpenCL/vendors/" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/cache@v3
id: spirv-tools
env:
cache-name: cache-spirv-tools
with:
path: ~/opt/SPIRV-Tools/v2023.2
key: ${{ runner.os }}-build-${{ env.cache-name }}
fail-on-cache-miss: true
- id: get-shas
uses: ./.github/actions/get-shas
with:
pocl-version: ${{ matrix.pocl-version }}
llvm-version: ${{ matrix.llvm-version }}
- uses: actions/cache@v3
id: llvm
env:
cache-name: cache-llvm-${{ matrix.llvm-version }}
with:
path: ~/opt/llvm/${{ matrix.llvm-version }}
key: ${{ steps.get-shas.outputs.llvm-cache-key }}
fail-on-cache-miss: true
- uses: actions/cache@v3
id: pocl
env:
cache-name: cache-pocl-${{ matrix.pocl-version }}-llvm-${{ matrix.llvm-version }}
with:
path: ~/opt/pocl/${{ matrix.pocl-version }}.0-${{ matrix.llvm-version }}
key: ${{ steps.get-shas.outputs.pocl-cache-key }}
fail-on-cache-miss: true
- name: Check PoCL Installation
run: ls $HOME/opt/pocl/${{ matrix.pocl-version }}.0-${{ matrix.llvm-version }}
if: ${{ matrix.backend == 'pocl' }}
- run: wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
if: ${{ matrix.backend == 'intel' }}
- run: echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
if: ${{ matrix.backend == 'intel' }}
- run: sudo add-apt-repository ppa:ocl-icd/ppa
if: ${{ matrix.backend == 'pocl' }}
- run: sudo apt update
- run: sudo apt install -y python3-dev libpython3-dev build-essential cmake git pkg-config make ninja-build libhwloc-dev zlib1g zlib1g-dev clinfo dialog apt-utils libxml2-dev ${{ matrix.backend == 'intel' && 'intel-oneapi-compiler-dpcpp-cpp intel-oneapi-runtime-opencl' || 'ocl-icd-libopencl1 ocl-icd-dev ocl-icd-opencl-dev' }}
- run: ${{ env.OPENCL_ENV }} clinfo
- run: mkdir -p build
- name: CMake
run: ${{ env.OPENCL_ENV }} cmake .. -DLLVM_CONFIG_BIN=$HOME/opt/llvm/${{ matrix.llvm-version }}/bin/llvm-config -DCMAKE_BUILD_TYPE=Release
working-directory: build
- name: Build
run: ${{ env.OPENCL_ENV }} cmake --build . --parallel 4
working-directory: build
- name: Build Tests
run: ${{ env.OPENCL_ENV }} CHIP_DEVICE_TYPE=cpu cmake --build . --parallel 4 --target build_tests
working-directory: build
- name: Test OpenCL
run: ${{ env.OPENCL_ENV }} POCL_KERNEL_CACHE=0 CHIP_DEVICE_TYPE=cpu ctest --timeout 180 --output-on-failure -E ${{ env.EXCLUDE }}
working-directory: build
- uses: actions/upload-artifact@v3
if: failure()
with:
name: build-and-check-${{ matrix.backend }}-llvm-${{ matrix.llvm-version }}
path: build/Testing/Temporary/LastTest.log