11name : Reusable SYCL Linux build workflow 
22
3+ defaults :
4+   run :
5+     shell : bash 
6+ 
37on :
48  workflow_call :
59    inputs :
2933        type : string 
3034        required : false 
3135        default : " --hip --cuda --native_cpu" 
32-       build_artifact_suffix :
33-         type : string 
34-         required : true 
3536      build_target :
3637        type : string 
3738        required : false 
3839        default : sycl-toolchain 
39-       artifact_archive_name :
40-         type : string 
41-         default : llvm_sycl.tar.zst 
40+ 
4241      changes :
4342        type : string 
4443        description : ' Filter matches for the changed files in the PR' 
4544        default : ' [llvm, clang, sycl, llvm_spirv, xptifw, libclc]' 
4645        required : false 
46+ 
47+       #  Artifacts:
48+ 
4749      retention-days :
4850        description : ' Artifacts retention period' 
4951        type : string 
5052        default : 3 
53+ 
54+       toolchain_artifact :
55+         type : string 
56+         required : true 
57+       toolchain_artifact_filename :
58+         type : string 
59+         default : llvm_sycl.tar.zst 
60+ 
61+       pack_release :
62+         type : string 
63+         required : false 
64+ 
5165      e2e_binaries_artifact :
5266        type : string 
5367        required : false 
54-       pack_release :
68+       e2e_binaries_spirv_backend_artifact :
69+         type : string 
70+         required : false 
71+       e2e_binaries_preview_artifact :
5572        type : string 
5673        required : false 
5774
5875    outputs :
5976      build_conclusion :
6077        value : ${{ jobs.build.outputs.build_conclusion }} 
61-       artifact_archive_name :
62-         value : ${{ jobs.build.outputs.artifact_archive_name }} 
63-       artifact_decompress_command :
64-         value : ${{ jobs.build.outputs.artifact_decompress_command }} 
78+       toolchain_artifact :
79+         value : ${{ inputs.toolchain_artifact }} 
80+       toolchain_artifact_filename :
81+         value : ${{ jobs.build.outputs.toolchain_artifact_filename }} 
82+       toolchain_decompress_command :
83+         value : ${{ jobs.build.outputs.toolchain_decompress_command }} 
6584
6685  workflow_dispatch :
6786    inputs :
98117        options :
99118          - " default" 
100119
101-       build_artifact_suffix :
120+       toolchain_artifact :
102121        type : choice 
103122        options :
104-           - " default " 
123+           - " sycl_linux_default " 
105124      retention-days :
106125        type : choice 
107126        options :
@@ -122,8 +141,8 @@ jobs:
122141      options : -u 1001:1001 
123142    outputs :
124143      build_conclusion : ${{ steps.build.conclusion }} 
125-       artifact_archive_name : ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} 
126-       artifact_decompress_command : ${{ steps.artifact_info.outputs.DECOMPRESS }} 
144+       toolchain_artifact_filename : ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} 
145+       toolchain_decompress_command : ${{ steps.artifact_info.outputs.DECOMPRESS }} 
127146    env :
128147      CCACHE_DIR : ${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }} 
129148      CCACHE_MAXSIZE : 8G 
@@ -132,7 +151,7 @@ jobs:
132151      #  To reduce number of inputs parameters that is limited for manual triggers.
133152      id : artifact_info 
134153      run : | 
135-         NAME="${{inputs.artifact_archive_name }}" 
154+         NAME="${{inputs.toolchain_artifact_filename }}" 
136155        if [ -z "$NAME" ]; then 
137156          NAME=llvm_sycl.tar.zst 
138157        fi 
@@ -163,6 +182,10 @@ jobs:
163182      if : ${{ inputs.cc == 'icx' || inputs.cxx == 'icpx' }} 
164183      uses : ./devops/actions/setup_linux_oneapi_env 
165184    - name : Configure 
185+       #  Setting `CMAKE_INSTALL_PREFIX` is important because that's the location
186+       #  where `sycl-linux-run-tests.yml` unpacks the toolchain to. That location
187+       #  *must* match between build-only and run-only E2E tests runs and we might
188+       #  be creating pre-built E2E tests' binaries in this workflow.
166189      env :
167190        CC : ${{ inputs.cc }} 
168191        CXX : ${{ inputs.cxx }} 
@@ -172,26 +195,42 @@ jobs:
172195        mkdir -p $GITHUB_WORKSPACE/build 
173196        cd $GITHUB_WORKSPACE/build 
174197        python3 $GITHUB_WORKSPACE/src/buildbot/configure.py -w $GITHUB_WORKSPACE \ 
175-           -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build -t Release \ 
198+           -s $GITHUB_WORKSPACE/src -o $GITHUB_WORKSPACE/build \ 
199+           -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/toolchain \ 
200+           -t Release \ 
176201          --ci-defaults ${{ inputs.build_configure_extra_args }} \ 
177202          -DCMAKE_C_COMPILER_LAUNCHER=ccache \ 
178203          -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ 
179204          -DLLVM_INSTALL_UTILS=ON \ 
180-           -DNATIVECPU_USE_OCK=Off \ 
181-           -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SPIRV 
205+           -DNATIVECPU_USE_OCK=Off 
182206     - name : Compile 
183207      id : build 
184208      #  Emulate default value for manual dispatch as we've run out of available arguments.
185209      run : cmake --build $GITHUB_WORKSPACE/build --target ${{ inputs.build_target || 'sycl-toolchain' }} 
186210    - name : check-llvm 
187211      if : always() && !cancelled() && contains(inputs.changes, 'llvm') 
212+       env :
213+         #  Can't inline to support possible quotes inside:
214+         BUILD_CONFIGURE_EXTRA_ARGS : ${{ inputs.build_configure_extra_args }} 
188215      run : | 
216+         if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then 
217+           # https://github.com/llvm/llvm-project/issues/59429 
218+           export LIT_FILTER_OUT="ExecutionEngine/MCJIT" 
219+         fi 
220+ 
189221        cmake --build $GITHUB_WORKSPACE/build --target check-llvm 
190222     - name : check-clang 
191223      if : always() && !cancelled() && contains(inputs.changes, 'clang') 
224+       env :
225+         #  Can't inline to support possible quotes inside:
226+         BUILD_CONFIGURE_EXTRA_ARGS : ${{ inputs.build_configure_extra_args }} 
192227      run : | 
193228        # Can we move this to Dockerfile? Hopefully, noop on Windows. 
194229        export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache 
230+         if [[ "${BUILD_CONFIGURE_EXTRA_ARGS}" == *"--use-libcxx"* ]]; then 
231+           # https://github.com/llvm/llvm-project/issues/59428 
232+           export LIT_FILTER_OUT="(E|e)xception" 
233+         fi 
195234        cmake --build $GITHUB_WORKSPACE/build --target check-clang 
196235     - name : check-sycl 
197236      if : always() && !cancelled() && contains(inputs.changes, 'sycl') 
@@ -234,7 +273,7 @@ jobs:
234273
235274     - name : Pack toolchain release 
236275      if : ${{ always() && !cancelled() && steps.build.conclusion == 'success' && inputs.pack_release == 'true' }} 
237-       run : tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/build/install  . 
276+       run : tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain  . 
238277    - name : Upload toolchain release 
239278      if : ${{ always() && !cancelled() && steps.build.conclusion == 'success' && inputs.pack_release == 'true' }} 
240279      uses : actions/upload-artifact@v4 
@@ -264,24 +303,20 @@ jobs:
264303
265304     - name : Pack toolchain 
266305      if : ${{ always() && !cancelled() && steps.build.conclusion == 'success' }} 
267-       run : tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/build/install  . 
306+       run : tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain  . 
268307    - name : Upload toolchain 
269308      if : ${{ always() && !cancelled() && steps.build.conclusion == 'success' }} 
270309      uses : actions/upload-artifact@v4 
271310      with :
272-         name : sycl_linux_ ${{ inputs.build_artifact_suffix  }}
311+         name : ${{ inputs.toolchain_artifact  }} 
273312        path : ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} 
274313        retention-days : ${{ inputs.retention-days }} 
275314
276-     - name : Copy toolchain 
277-       if : ${{ inputs.e2e_binaries_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }} 
278-       #  We must have the compiler in the same location as it will be in the E2E
279-       #  run-tests job.
280-       run : cp -r $GITHUB_WORKSPACE/build/install $GITHUB_WORKSPACE/toolchain 
281315
282316    - name : Source OneAPI TBB vars.sh 
283-       if : ${{ inputs.e2e_binaries_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }} 
284-       shell : bash 
317+       #  Tasks that use the just built toolchain below, need extra environment
318+       #  setup. No harm in it if all of those tasks would get skipped.
319+       if : ${{ always() && !cancelled() && steps.build.conclusion == 'success' }} 
285320      run : | 
286321        # https://github.com/actions/runner/issues/1964 prevents us from using 
287322        # the ENTRYPOINT in the image. 
@@ -309,31 +344,31 @@ jobs:
309344        extra_lit_opts : --param sycl_build_targets="spir;nvidia;amd" 
310345
311346    - name : Remove E2E tests before spirv-backend run 
312-       if : ${{ inputs.e2e_binaries_artifact  && always() && !cancelled() && steps.build.conclusion == 'success' }} 
347+       if : ${{ inputs.e2e_binaries_spirv_backend_artifact  && always() && !cancelled() && steps.build.conclusion == 'success' }} 
313348      run : rm -rf build-e2e 
314349
315350    - name : Build E2E tests with SPIR-V Backend 
316-       if : ${{ inputs.e2e_binaries_artifact  && always() && !cancelled() && steps.build.conclusion == 'success' }} 
351+       if : ${{ inputs.e2e_binaries_spirv_backend_artifact  && always() && !cancelled() && steps.build.conclusion == 'success' }} 
317352      uses : ./devops/actions/run-tests/e2e 
318353      with :
319354        ref : ${{ inputs.ref || github.sha }} 
320355        testing_mode : build-only 
321356        target_devices : all 
322-         binaries_artifact : ${{ inputs.e2e_binaries_artifact  }}_spirv_backend  
357+         binaries_artifact : ${{ inputs.e2e_binaries_spirv_backend_artifact  }} 
323358        sycl_compiler : $GITHUB_WORKSPACE/toolchain/bin/clang++ 
324359        extra_lit_opts : --param spirv-backend=True 
325360
326361    - name : Remove E2E tests before preview-mode run 
327-       if : ${{ inputs.e2e_binaries_artifact  && always() && !cancelled() && steps.build.conclusion == 'success' }} 
362+       if : ${{ inputs.e2e_binaries_preview_artifact  && always() && !cancelled() && steps.build.conclusion == 'success' }} 
328363      run : rm -rf build-e2e 
329364
330365    - name : Build E2E tests in Preview Mode 
331-       if : ${{ inputs.e2e_binaries_artifact  && always() && !cancelled() && steps.build.conclusion == 'success' }} 
366+       if : ${{ inputs.e2e_binaries_preview_artifact  && always() && !cancelled() && steps.build.conclusion == 'success' }} 
332367      uses : ./devops/actions/run-tests/e2e 
333368      with :
334369        ref : ${{ inputs.ref || github.sha }} 
335370        testing_mode : build-only 
336371        target_devices : all 
337-         binaries_artifact : ${{ inputs.e2e_binaries_artifact  }}_preview  
372+         binaries_artifact : ${{ inputs.e2e_binaries_preview_artifact  }} 
338373        sycl_compiler : $GITHUB_WORKSPACE/toolchain/bin/clang++ 
339374        extra_lit_opts : --param test-preview-mode=True 
0 commit comments