Skip to content

Commit 824a21c

Browse files
sarnexigcbot
authored andcommitted
Fix build IGC action
Fix build IGC action used in CI. Every job has been failing for over a week. The CI got into a bad state, in the newer IGC releases the package names changed to use dashes instead of underscores, this caused a curl command downloading the packages to fail, which then got saved to a build cache that's used on every build. So right now, every build is failing because it's retrieving that invalid build cache result. In this PR, I both workaround the build cache issue, prevent this from happening in the future by erroring in multiple places, and fix the curl script. The build cache issue can only be worked around because the cache is non-writable, the bad result would need to be manually deleted by a repo admin. What we can do is just use a new cache key if the cache result is bad, redownload and store based on the new cache key, and use the new cache result in the actual IGC build. I also fixed a CMake issue related to the new shared library name. I reproduced the exact state of the repo in my fork and verified this fixes it, [here](https://github.com/sarnex/intel-graphics-compiler/actions/runs/12186673537/job/33995744349). The LLVM 16 build failures are a separate issue.
1 parent 50b9827 commit 824a21c

File tree

2 files changed

+51
-10
lines changed

2 files changed

+51
-10
lines changed

.github/workflows/build-IGC.yml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,58 @@ jobs:
2020
download-OpenCL-Clang: # openCL Clang is downloaded from intel/intel-graphics-compiler releases
2121
if: github.repository == 'intel/intel-graphics-compiler'
2222
runs-on: ubuntu-latest
23+
env:
24+
CLANG_CACHE_VALID: true
25+
CLANG_CACHE_KEY: none
26+
ORIGINAL_CLANG_CACHE_KEY: none
27+
outputs:
28+
CLANG_CACHE_KEY: ${{ env.CLANG_CACHE_KEY }}
2329
steps:
2430
- uses: oprypin/find-latest-tag@v1
2531
with:
2632
repository: intel/intel-graphics-compiler
2733
releases-only: true
2834
id: get-latest-IGC-release-tag
35+
- name: set initial cache key
36+
run: |
37+
LOC_CLANG_CACHE_KEY="${{ steps.get-latest-IGC-release-tag.outputs.tag }}"
38+
echo "CLANG_CACHE_KEY=$LOC_CLANG_CACHE_KEY" >> $GITHUB_ENV
39+
echo "ORIGINAL_CLANG_CACHE_KEY=$LOC_CLANG_CACHE_KEY" >> $GITHUB_ENV
2940
- name: caching downloaded OpenCL Clang # Downloading a new OpenCL Clang only after the new IGC is released
3041
id: cache-igc-release
3142
uses: actions/cache@v3
3243
with:
3344
path: ./igc-official-release
34-
key: ${{ steps.get-latest-IGC-release-tag.outputs.tag }}
45+
key: ${{ env.CLANG_CACHE_KEY }}
46+
- name: checking for valid cache hit
47+
if: steps.cache-igc-release.outputs.cache-hit == 'true'
48+
run: |
49+
if [[ $(ls ./igc-official-release | wc -c) == "0" ]]; then
50+
echo "CLANG_CACHE_VALID=false" >> $GITHUB_ENV
51+
echo "CLANG_CACHE_KEY=${{ steps.get-latest-IGC-release-tag.outputs.tag }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_ENV
52+
fi
3553
- name: creating a folder for downloaded deb files
36-
if: steps.cache-igc-release.outputs.cache-hit != 'true'
37-
run: mkdir igc-official-release
54+
if: ${{ steps.cache-igc-release.outputs.cache-hit != 'true' || env.CLANG_CACHE_VALID != 'true' }}
55+
run: mkdir -p igc-official-release
3856
- name: download latest igc release
39-
if: steps.cache-igc-release.outputs.cache-hit != 'true'
57+
if: ${{ steps.cache-igc-release.outputs.cache-hit != 'true' || env.CLANG_CACHE_VALID != 'true' }}
4058
working-directory: ./igc-official-release
4159
# To install openCL clang from Deb package, IGC must also be installed. Therefore, the last IGC release is also downloaded.
42-
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 -
60+
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 -
4361
- name: checking if downloaded deb files are here
44-
run: ls ./igc-official-release
62+
run: |
63+
ls ./igc-official-release
64+
if [[ $(ls ./igc-official-release | wc -c) == "0" ]]; then
65+
exit 1
66+
fi
67+
- name: force redownload if invalid cache
68+
if: env.CLANG_CACHE_VALID != 'true'
69+
id: force-redownload
70+
uses: actions/cache@v3
71+
with:
72+
path: ./igc-official-release
73+
key: ${{ env.CLANG_CACHE_KEY }}
74+
restore-keys: ${{ env.ORIGINAL_CLANG_CACHE_KEY }}
4575

4676
build-SPIRV-LLVM-Translator:
4777
if: github.repository == 'intel/intel-graphics-compiler'
@@ -113,10 +143,13 @@ jobs:
113143
uses: actions/cache@v3
114144
with:
115145
path: ./igc-official-release
116-
key: ${{ steps.get-latest-IGC-release-tag.outputs.tag }}
146+
key: ${{ needs.download-OpenCL-Clang.outputs.CLANG_CACHE_KEY }}
117147
- name: checking if deb files are here
118-
run: ls ./igc-official-release
119-
148+
run: |
149+
ls ./igc-official-release
150+
if [[ $(ls ./igc-official-release | wc -c) == "0" ]]; then
151+
exit 1
152+
fi
120153
#Get SPIRV-LLVM-Translator
121154
- name: cloning SPIRV-LLVM-Translator repository
122155
run: git clone --branch llvm_release_${{ matrix.llvm_ver }}0 https://github.com/KhronosGroup/SPIRV-LLVM-Translator

IGC/BiFModule/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ if(UNIX)
3737
if("${CCLANG_SONAME_VERSION}" VERSION_GREATER "5.0.0")
3838
set_property(TARGET opencl-clang-lib PROPERTY "IMPORTED_SONAME" "${COMMON_CLANG_LIB_FULL_NAME}.${CCLANG_SONAME_VERSION}")
3939
else()
40-
message(FATAL_ERROR "[IGC\\BiFModule] : Version ${CCLANG_SONAME_VERSION} of library ${COMMON_CLANG_LIB_FULL_NAME} is below version 5.0.0 (where it's starts support of SPIR-V), please upgrade this library at least to version 5.0.0")
40+
# Handle libopencl-clang2.so
41+
string(REPLACE "-clang${CMAKE_SHARED_LIBRARY_SUFFIX}" "-clang2${CMAKE_SHARED_LIBRARY_SUFFIX}" TEST_COMMON_CLANG_LIB_FULL_NAME ${COMMON_CLANG_LIB_FULL_NAME})
42+
string(REGEX MATCH "\\[${TEST_COMMON_CLANG_LIB_FULL_NAME}\\.([0-9](\\.[0-9]*)*[a-zA-Z0-9]*)\\]" CCLANG_SONAME_VERSION "${CCLANG_READELF_CALL}")
43+
set(CCLANG_SONAME_VERSION "${CMAKE_MATCH_1}")
44+
if(NOT CCLANG_SONAME_VERSION STREQUAL "")
45+
set_property(TARGET opencl-clang-lib PROPERTY "IMPORTED_SONAME" "${TEST_COMMON_CLANG_LIB_FULL_NAME}.${CCLANG_SONAME_VERSION}")
46+
else()
47+
message(FATAL_ERROR "[IGC\\BiFModule] : Version ${CCLANG_SONAME_VERSION} of library ${COMMON_CLANG_LIB_FULL_NAME} is below version 5.0.0 (where it's starts support of SPIR-V), please upgrade this library at least to version 5.0.0")
48+
endif()
4149
endif()
4250
endif()
4351
if (NOT CCLANG_FROM_SYSTEM)

0 commit comments

Comments
 (0)