Skip to content

Commit fea7b5c

Browse files
committed
fix l0 loader version
Signed-off-by: Mateusz P. Nowak <[email protected]>
1 parent a0c26b3 commit fea7b5c

File tree

3 files changed

+89
-26
lines changed

3 files changed

+89
-26
lines changed

devops/dependencies.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
2020
},
2121
"level_zero": {
22-
"github_tag": "v1.24.2",
22+
"github_commit": "5187acd1c0f34097658f6ed890f1e5a65bdc35b9",
2323
"version": "v1.24.2",
24-
"url": "https://github.com/oneapi-src/level-zero/releases/tag/v1.24.2",
24+
"url": "https://github.com/oneapi-src/level-zero/commit/5187acd1c0f34097658f6ed890f1e5a65bdc35b9",
2525
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
2626
},
2727
"tbb": {
@@ -56,4 +56,4 @@
5656
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclcpu"
5757
}
5858
}
59-
}
59+
}

devops/scripts/install_drivers.sh

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if [ -f "$1" ]; then
1010
CR_TAG=$(jq -r '.linux.compute_runtime.github_tag' $CONFIG_FILE)
1111
IGC_TAG=$(jq -r '.linux.igc.github_tag' $CONFIG_FILE)
1212
CM_TAG=$(jq -r '.linux.cm.github_tag' $CONFIG_FILE)
13-
L0_TAG=$(jq -r '.linux.level_zero.github_tag' $CONFIG_FILE)
13+
L0_TAG=$(jq -r '.linux.level_zero.github_tag // .linux.level_zero.github_commit' $CONFIG_FILE)
1414
TBB_TAG=$(jq -r '.linux.tbb.github_tag' $CONFIG_FILE)
1515
FPGA_TAG=$(jq -r '.linux.fpgaemu.github_tag' $CONFIG_FILE)
1616
CPU_TAG=$(jq -r '.linux.oclcpu.github_tag' $CONFIG_FILE)
@@ -56,6 +56,43 @@ function get_pre_release_igfx() {
5656
unzip $HASH.zip && rm $HASH.zip
5757
}
5858

59+
function get_commit_artifacts() {
60+
REPO=$1
61+
COMMIT=$2
62+
HEADER=""
63+
if [ "$GITHUB_TOKEN" != "" ]; then
64+
HEADER="Authorization: Bearer $GITHUB_TOKEN"
65+
fi
66+
# Get artifacts from GitHub Actions for the specific commit
67+
curl -s -L -H "$HEADER" -H "Accept: application/vnd.github.v3+json" \
68+
"https://api.github.com/repos/${REPO}/actions/runs?head_sha=${COMMIT}&status=completed&per_page=1" \
69+
| jq -r '.workflow_runs[0] | select(.conclusion == "success") | .id' \
70+
| head -1 \
71+
| xargs -I {} curl -s -L -H "$HEADER" -H "Accept: application/vnd.github.v3+json" \
72+
"https://api.github.com/repos/${REPO}/actions/runs/{}/artifacts" \
73+
| jq -r '.artifacts[] | select(.name | test(".*deb.*")) | .archive_download_url'
74+
}
75+
76+
function download_commit_artifacts() {
77+
REPO=$1
78+
COMMIT=$2
79+
UBUNTU_VER=$3
80+
HEADER=""
81+
if [ "$GITHUB_TOKEN" != "" ]; then
82+
HEADER="Authorization: Bearer $GITHUB_TOKEN"
83+
fi
84+
85+
echo "Downloading artifacts for commit $COMMIT from $REPO"
86+
get_commit_artifacts $REPO $COMMIT | while read -r artifact_url; do
87+
if [ -n "$artifact_url" ]; then
88+
echo "Downloading artifact: $artifact_url"
89+
curl -L -H "$HEADER" "$artifact_url" -o "artifact-$(basename $artifact_url).zip"
90+
unzip -j "artifact-$(basename $artifact_url).zip" "*.deb" 2>/dev/null || true
91+
rm "artifact-$(basename $artifact_url).zip"
92+
fi
93+
done
94+
}
95+
5996
TBB_INSTALLED=false
6097

6198
if [[ -v INSTALL_LOCATION ]]; then
@@ -96,6 +133,16 @@ CheckIGCdevTag() {
96133
fi
97134
}
98135

136+
CheckIfCommitHash() {
137+
local arg="$1"
138+
# Check if it's a 40-character hex string (SHA-1 commit hash)
139+
if [[ $arg =~ ^[a-f0-9]{40}$ ]]; then
140+
echo "Yes"
141+
else
142+
echo "No"
143+
fi
144+
}
145+
99146
InstallIGFX () {
100147
echo "Installing Intel Graphics driver..."
101148
echo "Compute Runtime version $CR_TAG"
@@ -122,9 +169,25 @@ InstallIGFX () {
122169
| grep ".*deb" \
123170
| grep -v "u18" \
124171
| wget -qi -
125-
get_release oneapi-src/level-zero $L0_TAG \
126-
| grep ".*$UBUNTU_VER.*deb$" \
127-
| wget -qi -
172+
173+
# Check if L0_TAG is a commit hash or a regular tag
174+
IS_L0_COMMIT=$(CheckIfCommitHash $L0_TAG)
175+
if [ "$IS_L0_COMMIT" == "Yes" ]; then
176+
echo "Level Zero is using commit hash, attempting to download artifacts..."
177+
download_commit_artifacts oneapi-src/level-zero $L0_TAG $UBUNTU_VER
178+
# If no artifacts found, try direct source download
179+
if [ ! -f *.deb ] || [ $(ls -1 *.deb 2>/dev/null | wc -l) -eq 0 ]; then
180+
echo "No deb artifacts found for commit, downloading source..."
181+
curl -L "https://github.com/oneapi-src/level-zero/archive/$L0_TAG.tar.gz" -o level-zero-$L0_TAG.tar.gz
182+
# For now, skip building from source as it requires additional setup
183+
echo "WARNING: Level-zero source download completed but building from source is not implemented"
184+
echo "Please ensure level-zero packages are available or use a tagged release"
185+
fi
186+
else
187+
get_release oneapi-src/level-zero $L0_TAG \
188+
| grep ".*$UBUNTU_VER.*deb$" \
189+
| wget -qi -
190+
fi
128191
dpkg -i --force-all *.deb && rm *.deb *.sum
129192
mkdir -p /usr/local/lib/igc/
130193
echo "$IGC_TAG" > /usr/local/lib/igc/IGCTAG.txt

unified-runtime/cmake/FetchLevelZero.cmake

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ find_package(PkgConfig QUIET)
1212
# LevelZero doesn't install a CMake config target, just PkgConfig,
1313
# so try using that to find the install and if it's not available
1414
# just try to search for the path.
15-
if(PkgConfig_FOUND)
16-
pkg_check_modules(level-zero level-zero>=1.24.3)
17-
if(level-zero_FOUND)
18-
set(LEVEL_ZERO_INCLUDE_DIR "${level-zero_INCLUDEDIR}/level_zero")
19-
set(LEVEL_ZERO_LIBRARY_SRC "${level-zero_LIBDIR}")
20-
set(LEVEL_ZERO_LIB_NAME "${level-zero_LIBRARIES}")
21-
message(STATUS "Level Zero Adapter: Using preinstalled level zero loader at ${level-zero_LINK_LIBRARIES}")
22-
endif()
23-
else()
24-
set(L0_HEADER_PATH "loader/ze_loader.h")
25-
find_path(L0_HEADER ${L0_HEADER_PATH} ${CMAKE_PREFIX_PATH} PATH_SUFFIXES "level_zero")
26-
find_library(ZE_LOADER NAMES ze_loader HINTS /usr ${CMAKE_PREFIX_PATH})
27-
if(L0_HEADER AND ZE_LOADER)
28-
set(LEVEL_ZERO_INCLUDE_DIR "${L0_HEADER}")
29-
set(LEVEL_ZERO_LIBRARY "${ZE_LOADER}")
30-
message(STATUS "Level Zero Adapter: Using preinstalled level zero loader at ${LEVEL_ZERO_LIBRARY}")
31-
add_library(ze_loader INTERFACE)
32-
endif()
33-
endif()
15+
# if(PkgConfig_FOUND)
16+
# pkg_check_modules(level-zero level-zero>1.24.3)
17+
# if(level-zero_FOUND)
18+
# set(LEVEL_ZERO_INCLUDE_DIR "${level-zero_INCLUDEDIR}/level_zero")
19+
# set(LEVEL_ZERO_LIBRARY_SRC "${level-zero_LIBDIR}")
20+
# set(LEVEL_ZERO_LIB_NAME "${level-zero_LIBRARIES}")
21+
# message(STATUS "Level Zero Adapter: Using preinstalled level zero loader at ${level-zero_LINK_LIBRARIES}")
22+
# endif()
23+
# else()
24+
# set(L0_HEADER_PATH "loader/ze_loader.h")
25+
# find_path(L0_HEADER ${L0_HEADER_PATH} ${CMAKE_PREFIX_PATH} PATH_SUFFIXES "level_zero")
26+
# find_library(ZE_LOADER NAMES ze_loader HINTS /usr ${CMAKE_PREFIX_PATH})
27+
# if(L0_HEADER AND ZE_LOADER)
28+
# set(LEVEL_ZERO_INCLUDE_DIR "${L0_HEADER}")
29+
# set(LEVEL_ZERO_LIBRARY "${ZE_LOADER}")
30+
# message(STATUS "Level Zero Adapter: Using preinstalled level zero loader at ${LEVEL_ZERO_LIBRARY}")
31+
# add_library(ze_loader INTERFACE)
32+
# endif()
33+
# endif()
3434

3535
if(NOT LEVEL_ZERO_LIB_NAME AND NOT LEVEL_ZERO_LIBRARY)
3636
message(STATUS "Level Zero Adapter: Download Level Zero loader and headers from github.com")

0 commit comments

Comments
 (0)