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.
This commit is contained in:
Sarnie, Nick
2024-12-05 20:13:48 +00:00
committed by igcbot
parent 50b9827913
commit 824a21c756
2 changed files with 51 additions and 10 deletions

View File

@ -20,28 +20,58 @@ 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: ${{ steps.get-latest-IGC-release-tag.outputs.tag }}
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'
run: mkdir igc-official-release
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'
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 -
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
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'
@ -113,10 +143,13 @@ jobs:
uses: actions/cache@v3
with:
path: ./igc-official-release
key: ${{ steps.get-latest-IGC-release-tag.outputs.tag }}
key: ${{ needs.download-OpenCL-Clang.outputs.CLANG_CACHE_KEY }}
- name: checking if deb files are here
run: ls ./igc-official-release
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

View File

@ -37,7 +37,15 @@ if(UNIX)
if("${CCLANG_SONAME_VERSION}" VERSION_GREATER "5.0.0")
set_property(TARGET opencl-clang-lib PROPERTY "IMPORTED_SONAME" "${COMMON_CLANG_LIB_FULL_NAME}.${CCLANG_SONAME_VERSION}")
else()
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")
# Handle libopencl-clang2.so
string(REPLACE "-clang${CMAKE_SHARED_LIBRARY_SUFFIX}" "-clang2${CMAKE_SHARED_LIBRARY_SUFFIX}" TEST_COMMON_CLANG_LIB_FULL_NAME ${COMMON_CLANG_LIB_FULL_NAME})
string(REGEX MATCH "\\[${TEST_COMMON_CLANG_LIB_FULL_NAME}\\.([0-9](\\.[0-9]*)*[a-zA-Z0-9]*)\\]" CCLANG_SONAME_VERSION "${CCLANG_READELF_CALL}")
set(CCLANG_SONAME_VERSION "${CMAKE_MATCH_1}")
if(NOT CCLANG_SONAME_VERSION STREQUAL "")
set_property(TARGET opencl-clang-lib PROPERTY "IMPORTED_SONAME" "${TEST_COMMON_CLANG_LIB_FULL_NAME}.${CCLANG_SONAME_VERSION}")
else()
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")
endif()
endif()
endif()
if (NOT CCLANG_FROM_SYSTEM)