@@ -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,94 @@ 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+ 
96+ function  build_level_zero_from_source()  {
97+     COMMIT=$1 
98+ 
99+     echo  " Building Level Zero from source at commit $COMMIT " 
100+ 
101+     #  Create temporary build directory
102+     BUILD_DIR=" /tmp/level-zero-build" 
103+     INSTALL_DIR=" /tmp/level-zero-install" 
104+     rm -rf $BUILD_DIR  $INSTALL_DIR 
105+     mkdir -p $BUILD_DIR  $INSTALL_DIR 
106+     cd  $BUILD_DIR 
107+ 
108+     #  Clone and checkout specific commit
109+     echo  " Cloning Level Zero repository..." 
110+     git clone https://github.com/oneapi-src/level-zero.git
111+     cd  level-zero
112+     git checkout $COMMIT 
113+ 
114+     #  Create build directory
115+     mkdir build
116+     cd  build
117+ 
118+     #  Configure build
119+     echo  " Configuring Level Zero build..." 
120+     cmake .. \
121+         -DCMAKE_BUILD_TYPE=Release \
122+         -DCMAKE_INSTALL_PREFIX=/usr/local \
123+         -DLEVEL_ZERO_BUILD_TESTS=OFF \
124+         -DLEVEL_ZERO_BUILD_SAMPLES=OFF
125+     
126+     #  Build
127+     echo  " Building Level Zero..." 
128+     make -j$( nproc) 
129+ 
130+     #  Staged install (doesn't affect system)
131+     echo  " Creating staged installation..." 
132+     make install DESTDIR=$INSTALL_DIR 
133+ 
134+     #  Copy files to their final destinations
135+     echo  " Installing Level Zero to system..." 
136+     cp -r $INSTALL_DIR /usr/local/*  /usr/local/
137+ 
138+     #  Update library cache
139+     ldconfig
140+ 
141+     #  Clean up build and install directories
142+     rm -rf $BUILD_DIR  $INSTALL_DIR 
143+ 
144+     echo  " Level Zero built and installed successfully from commit $COMMIT " 
145+ }
146+ 
59147TBB_INSTALLED=false
60148
61149if  [[ -v INSTALL_LOCATION ]];  then 
@@ -96,6 +184,16 @@ CheckIGCdevTag() {
96184    fi 
97185}
98186
187+ CheckIfCommitHash () {
188+     local  arg=" $1 " 
189+     #  Check if it's a 40-character hex string (SHA-1 commit hash)
190+     if  [[ $arg  =~  ^[a-f0-9]{40}$ ]];  then 
191+         echo  " Yes" 
192+     else 
193+         echo  " No" 
194+     fi 
195+ }
196+ 
99197InstallIGFX  () {
100198  echo  " Installing Intel Graphics driver..." 
101199  echo  " Compute Runtime version $CR_TAG " 
@@ -122,9 +220,19 @@ InstallIGFX () {
122220    |  grep " .*deb"   \
123221    |  grep -v " u18"   \
124222    |  wget -qi -
125-   get_release oneapi-src/level-zero $L0_TAG  \
126-     |  grep " .*$UBUNTU_VER .*deb$"   \
127-     |  wget -qi -
223+   
224+   #  Check if L0_TAG is a commit hash or a regular tag
225+   IS_L0_COMMIT=$( CheckIfCommitHash $L0_TAG ) 
226+   if  [ " $IS_L0_COMMIT "   ==  " Yes"   ];  then 
227+     echo  " Level Zero is using commit hash, building from source..." 
228+     build_level_zero_from_source $L0_TAG 
229+     #  Install other packages (Level Zero was already installed from source)
230+     dpkg -i --force-all * .deb &&  rm * .deb * .sum
231+   else 
232+     get_release oneapi-src/level-zero $L0_TAG  \
233+       |  grep " .*$UBUNTU_VER .*deb$"   \
234+       |  wget -qi -
235+   fi 
128236  dpkg -i --force-all * .deb &&  rm * .deb * .sum
129237  mkdir -p /usr/local/lib/igc/
130238  echo  " $IGC_TAG "   >  /usr/local/lib/igc/IGCTAG.txt
0 commit comments