-
Notifications
You must be signed in to change notification settings - Fork 162
218 lines (209 loc) · 9.39 KB
/
build-IGC.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
#=========================== begin_copyright_notice ============================
#
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
#============================ end_copyright_notice =============================
name: Build IGC
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions: read-all
jobs:
download-OpenCL-Clang: # openCL Clang is downloaded from intel/intel-graphics-compiler releases
if: github.repository == 'intel/intel-graphics-compiler'
runs-on: ubuntu-latest
env:
CLANG_CACHE_VALID: true
CLANG_CACHE_KEY: none
ORIGINAL_CLANG_CACHE_KEY: none
outputs:
CLANG_CACHE_KEY: ${{ env.CLANG_CACHE_KEY }}
steps:
- uses: oprypin/find-latest-tag@v1
with:
repository: intel/intel-graphics-compiler
releases-only: true
id: get-latest-IGC-release-tag
- name: set initial cache key
run: |
LOC_CLANG_CACHE_KEY="${{ steps.get-latest-IGC-release-tag.outputs.tag }}"
echo "CLANG_CACHE_KEY=$LOC_CLANG_CACHE_KEY" >> $GITHUB_ENV
echo "ORIGINAL_CLANG_CACHE_KEY=$LOC_CLANG_CACHE_KEY" >> $GITHUB_ENV
- name: caching downloaded OpenCL Clang # Downloading a new OpenCL Clang only after the new IGC is released
id: cache-igc-release
uses: actions/cache@v3
with:
path: ./igc-official-release
key: ${{ env.CLANG_CACHE_KEY }}
- name: checking for valid cache hit
if: steps.cache-igc-release.outputs.cache-hit == 'true'
run: |
if [[ $(ls ./igc-official-release | wc -c) == "0" ]]; then
echo "CLANG_CACHE_VALID=false" >> $GITHUB_ENV
echo "CLANG_CACHE_KEY=${{ steps.get-latest-IGC-release-tag.outputs.tag }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_ENV
fi
- name: creating a folder for downloaded deb files
if: ${{ steps.cache-igc-release.outputs.cache-hit != 'true' || env.CLANG_CACHE_VALID != 'true' }}
run: mkdir -p igc-official-release
- name: download latest igc release
if: ${{ steps.cache-igc-release.outputs.cache-hit != 'true' || env.CLANG_CACHE_VALID != 'true' }}
working-directory: ./igc-official-release
# To install openCL clang from Deb package, IGC must also be installed. Therefore, the last IGC release is also downloaded.
run: curl -s https://api.github.com/repos/intel/intel-graphics-compiler/releases/latest | grep browser_download_url | egrep 'opencl-|core-' | cut -d '"' -f 4 | wget -qi -
- name: checking if downloaded deb files are here
run: |
ls ./igc-official-release
if [[ $(ls ./igc-official-release | wc -c) == "0" ]]; then
exit 1
fi
- name: force redownload if invalid cache
if: env.CLANG_CACHE_VALID != 'true'
id: force-redownload
uses: actions/cache@v3
with:
path: ./igc-official-release
key: ${{ env.CLANG_CACHE_KEY }}
restore-keys: ${{ env.ORIGINAL_CLANG_CACHE_KEY }}
build-SPIRV-LLVM-Translator:
if: github.repository == 'intel/intel-graphics-compiler'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ubuntu_version: [ '24.04' ]
llvm_ver: [ 14, 15, 16 ]
steps:
- uses: actions/checkout@v3
- name: cloning SPIRV-LLVM-Translator repository
run: git clone --branch llvm_release_${{ matrix.llvm_ver }}0 https://github.com/KhronosGroup/SPIRV-LLVM-Translator
- name: getting latest commit hash from SPIRV-LLVM-Translator repository
id: SPIRV-LLVM-Translator-hash
working-directory: ./SPIRV-LLVM-Translator
run: |
SPIRV_TRANSLATOR_SHA_SHORT=$(git log -1 --pretty=format:"%h")
echo "This is SPIRV-LLVM-Translator repository latest commit hash = ${SPIRV_TRANSLATOR_SHA_SHORT}"
echo "spirv_translator_sha_short=$SPIRV_TRANSLATOR_SHA_SHORT" >> $GITHUB_OUTPUT
- name: caching SPIRV-LLVM-Translator deb files
id: cache-spirv-llvm-translator
uses: actions/cache@v3
with:
path: ./build-SPIRV-LLVM-Translator
key: ${{ steps.SPIRV-LLVM-Translator-hash.outputs.spirv_translator_sha_short }}-ubuntu${{ matrix.ubuntu_version }}-llvm${{ matrix.llvm_ver }}
- name: run Docker
if: steps.cache-spirv-llvm-translator.outputs.cache-hit != 'true'
run: |
docker run --name=buildslt \
-v $(pwd)/scripts/buildSLT.sh:/buildSLT.sh \
--env DEBIAN_FRONTEND="noninteractive" \
--env UBUNTU_VERSION=${{ matrix.ubuntu_version }} \
--env LLVM_VERSION=${{ matrix.llvm_ver }} \
ubuntu:${{ matrix.ubuntu_version }} \
sh /buildSLT.sh
- name: creating folders to store SPIRV-LLVM-Translator build outputs
if: steps.cache-spirv-llvm-translator.outputs.cache-hit != 'true'
run: mkdir build-SPIRV-LLVM-Translator && mkdir temp-SPIRV-LLVM-Translator-build
- name: copying artifact from docker to github host
if: steps.cache-spirv-llvm-translator.outputs.cache-hit != 'true'
run: sudo docker cp buildslt:/SPIRV-LLVM-Translator/build ./temp-SPIRV-LLVM-Translator-build
- name: copy deb file to main artifact folder
if: steps.cache-spirv-llvm-translator.outputs.cache-hit != 'true'
run: sudo cp ./temp-SPIRV-LLVM-Translator-build/build/*.deb ./build-SPIRV-LLVM-Translator
build-IGC:
needs: [build-SPIRV-LLVM-Translator, download-OpenCL-Clang]
if: github.repository == 'intel/intel-graphics-compiler'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ubuntu_version: [ '24.04' ]
llvm_ver: [ 14, 15, 16 ]
compiler: [ gcc, clang ]
steps:
- uses: actions/checkout@v3
#Get OpenCL Clang
- uses: oprypin/find-latest-tag@v1
with:
repository: intel/intel-graphics-compiler
releases-only: true
id: get-latest-IGC-release-tag
- name: getting OpenCL Clang from cache from the previous job
id: cache-igc-release
uses: actions/cache@v3
with:
path: ./igc-official-release
key: ${{ needs.download-OpenCL-Clang.outputs.CLANG_CACHE_KEY }}
- name: checking if deb files are here
run: |
ls ./igc-official-release
if [[ $(ls ./igc-official-release | wc -c) == "0" ]]; then
exit 1
fi
#Get SPIRV-LLVM-Translator
- name: cloning SPIRV-LLVM-Translator repository
run: git clone --branch llvm_release_${{ matrix.llvm_ver }}0 https://github.com/KhronosGroup/SPIRV-LLVM-Translator
- name: getting latest commit hash from SPIRV-LLVM-Translator repository
id: SPIRV-LLVM-Translator-hash
working-directory: ./SPIRV-LLVM-Translator
run: |
SPIRV_TRANSLATOR_SHA_SHORT=$(git log -1 --pretty=format:"%h")
echo "This is SPIRV-LLVM-Translator hash = ${SPIRV_TRANSLATOR_SHA_SHORT}"
echo "spirv_translator_sha_short=$SPIRV_TRANSLATOR_SHA_SHORT" >> $GITHUB_OUTPUT
- name: getting SPIRV-LLVM-Translator deb files from cache from the previous job
id: cache-spirv-llvm-translator
uses: actions/cache@v3
with:
path: ./build-SPIRV-LLVM-Translator
key: ${{ steps.SPIRV-LLVM-Translator-hash.outputs.spirv_translator_sha_short }}-ubuntu${{ matrix.ubuntu_version }}-llvm${{ matrix.llvm_ver }}
#Build IGC
- name: Checkout IGC sources
uses: actions/checkout@v3
with:
path: workspace/igc
- name: Checkout vc-intrinsics sources
uses: actions/checkout@v3
with:
repository: intel/vc-intrinsics
ref: master
path: workspace/vc-intrinsics
- name: Checkout SPIRV-Headers sources
uses: actions/checkout@v3
with:
repository: KhronosGroup/SPIRV-Headers
ref: main
path: workspace/SPIRV-Headers
- name: Checkout the SPIRV-Headers
uses: actions/checkout@v3
with:
repository: KhronosGroup/SPIRV-Tools
ref: main
path: workspace/SPIRV-Tools
- name: get short hash
id: igc-current-short-Hash
run: echo "sha_short=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
- name: run Docker
run: |
docker run --name=buildigc \
-v $(pwd)/scripts/buildIGC.sh:/buildIGC.sh \
-v $(pwd)/igc-official-release:/igc-official-release \
-v $(pwd)/build-SPIRV-LLVM-Translator:/build-SPIRV-LLVM-Translator \
-v $(pwd)/workspace:/workspace \
--env DEBIAN_FRONTEND="noninteractive" \
--env UBUNTU_VERSION=${{ matrix.ubuntu_version }} \
--env LLVM_VERSION=${{ matrix.llvm_ver }} \
--env COMPILER=${{ matrix.compiler }} \
--env IGC_SHA=${{ steps.igc-current-short-Hash.outputs.sha_short }} \
ubuntu:${{ matrix.ubuntu_version }} \
sh /buildIGC.sh
- name: creating folder to store output artifacts
run: mkdir Artifacts
- name: copying artifact from docker to github host
run: sudo docker cp buildigc:/workspace/igc/build/DEB-FILES ./Artifacts
- uses: actions/upload-artifact@v4
with:
name: IGC_Ubuntu${{ matrix.ubuntu_version }}_llvm${{ matrix.llvm_ver }}_${{ matrix.compiler }}-${{ steps.igc-current-short-Hash.outputs.sha_short }}
path: ./Artifacts/DEB-FILES/*.deb
retention-days: 7