Skip to content

Commit 0733abb

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (6 commits)
2 parents be4866c + 542a00b commit 0733abb

File tree

20 files changed

+398
-167
lines changed

20 files changed

+398
-167
lines changed

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ on:
3737

3838
repo_ref:
3939
type: string
40-
required: True
40+
required: False
4141
description: |
4242
Commit SHA or branch to checkout the intel/llvm repo.
4343
tests_ref:
@@ -60,9 +60,10 @@ on:
6060

6161
e2e_binaries_artifact:
6262
description: |
63-
Must be set if `e2e_testing_mode` is equal to `run-only` and the
64-
artifact must exist. Can be set in other modes resulting in artifact
65-
upload.
63+
When set in modes other than `run-only` results in artifact upload.
64+
For `run-only` mode, if specified, means downloading pre-built
65+
binaries from the artifact, otherwise they are expected to be part of
66+
the container.
6667
type: string
6768
default: ''
6869
required: False
@@ -156,6 +157,7 @@ on:
156157
type: choice
157158
options:
158159
- 'ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest'
160+
- 'ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_2'
159161
- 'ghcr.io/intel/llvm/ubuntu2404_intel_drivers:alldeps'
160162
image_options:
161163
description: |
@@ -205,6 +207,7 @@ on:
205207
options:
206208
- "full"
207209
- "build-only"
210+
- "run-only"
208211

209212
permissions:
210213
contents: read
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Create container with pre-built tests
2+
3+
# The purpose of this is to build E2E tests with the latest release toolchain
4+
# and then run them with the trunk SYCL RT (libsycl.so and friends) to verify
5+
# that ABI compatibility hasn't been broken.
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
ref:
11+
type: string
12+
description: tag/sha
13+
required: true
14+
default:
15+
16+
push:
17+
branches:
18+
- sycl-rel-**
19+
20+
permissions: read-all
21+
22+
jobs:
23+
build:
24+
uses: ./.github/workflows/sycl-linux-build.yml
25+
with:
26+
build_ref: ${{ inputs.ref || github.sha }}
27+
build_cache_root: "/__w/"
28+
29+
build_image: "ghcr.io/intel/llvm/sycl_ubuntu2404_nightly:latest"
30+
cc: clang
31+
cxx: clang++
32+
33+
changes: '[]'
34+
35+
toolchain_artifact: toolchain
36+
toolchain_artifact_filename: toolchain.tar.zst
37+
e2e_binaries_artifact: e2e_bin
38+
39+
# Couldn't make it work from inside the container, so have to use an extra job
40+
# and pass an artifact.
41+
docker:
42+
runs-on: [Linux, build]
43+
needs: build
44+
permissions:
45+
packages: write
46+
if: always()
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
sparse-checkout: |
51+
devops/
52+
53+
- name: Checkout E2E tests
54+
uses: actions/checkout@v4
55+
with:
56+
ref: ${{ inputs.ref || github.sha }}
57+
path: llvm
58+
sparse-checkout: |
59+
llvm/utils/lit
60+
sycl/test-e2e
61+
- name: Pack sources
62+
run: |
63+
tar -I 'zstd -9' -cf devops/e2e_sources.tar.zst -C ./llvm .
64+
65+
- name: Download toolchain
66+
uses: actions/download-artifact@v4
67+
with:
68+
name: toolchain
69+
path: devops/
70+
- name: Download E2E binaries
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: e2e_bin
74+
path: devops/
75+
76+
77+
- name: Build container
78+
uses: ./devops/actions/build_container
79+
with:
80+
push: true
81+
file: release_tests_binaries
82+
username: ${{ github.repository_owner }}
83+
password: ${{ secrets.GITHUB_TOKEN }}
84+
tags: |
85+
ghcr.io/${{ github.repository }}/sycl_prebuilt_tests:${{ inputs.ref || github.ref_name }}
86+
87+
run-e2e:
88+
# Ensure those tests can actually pass with the toolchain they were built
89+
# with, otherwise testing compatibility with those binaries is pointless.
90+
# This job should be aligned with how the image will be used in trunk CI.
91+
#
92+
# I'll start with just a single configuration, but this might be extended
93+
# with a matrix in future (e.g., to run on cpu/CUDA/AMDGPU).
94+
name: Run E2E tests with SYCL RT they were built with
95+
runs-on: [Linux, pvc]
96+
needs: [docker, build]
97+
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
98+
container:
99+
image: ghcr.io/${{ github.repository }}/sycl_prebuilt_tests:${{ inputs.ref || github.ref_name }}
100+
options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
101+
steps:
102+
- uses: actions/checkout@v4
103+
with:
104+
sparse-checkout: |
105+
devops
106+
- run: |
107+
mkdir toolchain
108+
tar -I 'zstd' -xf /sycl-prebuilt/toolchain.tar.zst -C toolchain
109+
echo LD_LIBRARY_PATH=$PWD/toolchain/lib:$LD_LIBRARY_PATH >> $GITHUB_ENV
110+
echo PATH=$PWD/toolchain/bin:$PATH >> $GITHUB_ENV
111+
- run: |
112+
sycl-ls
113+
- name: Run E2E tests
114+
uses: ./devops/actions/run-tests/e2e
115+
timeout-minutes: 20
116+
with:
117+
testing_mode: run-only
118+
target_devices: level_zero:gpu

devops/actions/run-tests/e2e/action.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,34 @@ runs:
2424
using: "composite"
2525
steps:
2626
- name: Checkout E2E tests
27+
if: ${{ !(inputs.testing_mode == 'run-only' && inputs.binaries_artifact == '') }}
2728
uses: actions/checkout@v4
2829
with:
2930
path: llvm
3031
ref: ${{ inputs.ref || github.sha }}
3132
sparse-checkout: |
3233
llvm/utils/lit
3334
sycl/test-e2e
34-
3535
- name: Download E2E Binaries
36-
if: inputs.testing_mode == 'run-only'
36+
if: ${{ inputs.testing_mode == 'run-only' && inputs.binaries_artifact != '' }}
3737
uses: actions/download-artifact@v4
3838
with:
3939
name: ${{ inputs.binaries_artifact }}
4040
- name: Extract E2E Binaries
41-
if: inputs.testing_mode == 'run-only'
41+
if: ${{ inputs.testing_mode == 'run-only' && inputs.binaries_artifact != '' }}
4242
shell: bash
4343
run: |
4444
mkdir build-e2e
4545
tar -I 'zstd' -xf e2e_binaries.tar.zst -C build-e2e
4646
47+
- name: Extract E2E tests from container image
48+
if: ${{ inputs.testing_mode == 'run-only' && inputs.binaries_artifact == '' }}
49+
shell: bash
50+
run: |
51+
mkdir build-e2e llvm
52+
tar -I 'zstd' -xf /sycl-prebuilt/e2e_binaries.tar.zst -C build-e2e
53+
tar -I 'zstd' -xf /sycl-prebuilt/e2e_sources.tar.zst -C llvm
54+
4755
- name: Deduce E2E CMake options
4856
if: inputs.testing_mode != 'run-only'
4957
id: cmake_opts
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
ARG base_tag=alldeps
2+
ARG base_image=ghcr.io/intel/llvm/ubuntu2404_intel_drivers
3+
4+
FROM $base_image:$base_tag
5+
6+
# Actual CI maps volumes via something like "/runner/host/path":"/__w/", so
7+
# these won't be visible there. They can be used when manually reproducing
8+
# issues though. Path `/__w/llvm/llvm` is the property of Github Actions and
9+
# when CMake configures E2E tests this path is hardcoded in both CMake files and
10+
# e2e binaries themselve. As such, it's useful to have these in the image for
11+
# local manual experiments.
12+
#
13+
# One can map volumes as "/host/system/new/toolchain":"/__w/llvm/llvm/toolchain"
14+
# to override the toolchain in order to run the tests with local SYCL RT instead
15+
# of using the release RT included in this image.
16+
ADD --chown=sycl:sycl toolchain.tar.zst /__w/llvm/llvm/toolchain
17+
ADD --chown=sycl:sycl e2e_binaries.tar.zst /__w/llvm/llvm/build-e2e
18+
ADD --chown=sycl:sycl e2e_sources.tar.zst /__w/llvm/llvm/llvm
19+
20+
# Since `/__w/llvm/llvm` above is overriden by GHA, need to provide the
21+
# following for using in CI:
22+
COPY e2e_binaries.tar.zst /sycl-prebuilt/
23+
COPY e2e_sources.tar.zst /sycl-prebuilt/
24+
COPY toolchain.tar.zst /sycl-prebuilt/
25+
26+
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
27+
28+
USER sycl

llvm/lib/SYCLNativeCPUUtils/CMakeLists.txt

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ add_llvm_component_library(LLVMSYCLNativeCPUUtils
1919
ipo
2020
)
2121

22-
set(OCK_SOURCE_DIR "" CACHE PATH "Root of the local checkout of the oneAPI Construction Kit")
23-
set(OCK_GIT_REPO "" CACHE STRING "Git repository for the oneAPI Construction Kit FetchContent")
24-
set(OCK_GIT_TAG "" CACHE STRING "Git tag for the oneAPI Construction Kit FetchContent")
25-
option(NATIVECPU_OCK_USE_FETCHCONTENT "Use FetchContent to acquire oneAPI Construction Kit source code" On)
2622
option(NATIVECPU_USE_OCK "Use the oneAPI Construction Kit for Native CPU" ON)
2723

2824
# Don't fetch OCK if Native CPU is not enabled.
@@ -31,8 +27,16 @@ if(NOT "native_cpu" IN_LIST SYCL_ENABLE_BACKENDS)
3127
endif()
3228

3329
if(NATIVECPU_USE_OCK)
34-
if(NATIVECPU_OCK_USE_FETCHCONTENT)
35-
set(OCK_GIT_INTERNAL_REPO "https://github.com/uxlfoundation/oneapi-construction-kit.git")
30+
set(OCK_SEARCH_LOC "oneapi-construction-kit/compiler_passes")
31+
if(NOT FETCHCONTENT_SOURCE_DIR_ONEAPI-CK)
32+
find_path(OCK_SOURCE_DIR ${OCK_SEARCH_LOC} PATHS ${CMAKE_PREFIX_PATH})
33+
endif()
34+
if(OCK_SOURCE_DIR)
35+
message(STATUS "Found system source location of oneAPI Construction Kit in ${OCK_SOURCE_DIR}")
36+
set(OCK_SOURCE_DIR "${OCK_SOURCE_DIR}/${OCK_SEARCH_LOC}")
37+
set(OCK_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/oneapi-construction-kit")
38+
else()
39+
set(OCK_GIT_REPO "https://github.com/uxlfoundation/oneapi-construction-kit.git")
3640
# commit d0a32d701e34b3285de7ce776ea36abfec673df7
3741
# Merge: a9f848e0e8 56473a8c25
3842
# Author: Harald van Dijk <[email protected]>
@@ -41,39 +45,31 @@ if(NATIVECPU_USE_OCK)
4145
# Merge pull request #878 from hvdijk/specify-fuse-ld-lld
4246
#
4347
# [RefSi] Explicitly specify -fuse-ld=lld.
44-
set(OCK_GIT_INTERNAL_TAG d0a32d701e34b3285de7ce776ea36abfec673df7)
45-
46-
# Overwrite OCK_GIT_INTERNAL_REPO/OCK_GIT_INTERNAL_TAG if the corresponding options are set
47-
if(OCK_GIT_REPO)
48-
set(OCK_GIT_INTERNAL_REPO "${OCK_GIT_REPO}")
49-
endif()
50-
if(OCK_GIT_TAG)
51-
set(OCK_GIT_INTERNAL_TAG "${OCK_GIT_TAG}")
52-
endif()
48+
set(OCK_GIT_TAG d0a32d701e34b3285de7ce776ea36abfec673df7)
49+
5350
include(FetchContent)
5451
FetchContent_Declare(oneapi-ck
55-
GIT_REPOSITORY "${OCK_GIT_INTERNAL_REPO}"
56-
GIT_TAG "${OCK_GIT_INTERNAL_TAG}"
52+
GIT_REPOSITORY "${OCK_GIT_REPO}"
53+
GIT_TAG "${OCK_GIT_TAG}"
5754
)
5855
FetchContent_GetProperties(oneapi-ck)
5956
if(NOT oneapi-ck_POPULATED)
60-
message(STATUS "Cloning oneAPI Construction Kit from ${OCK_GIT_INTERNAL_REPO}, tag ${OCK_GIT_INTERNAL_TAG}")
57+
if(FETCHCONTENT_SOURCE_DIR_ONEAPI-CK)
58+
message(STATUS "Using specified oneAPI Construction Kit repo location at ${FETCHCONTENT_SOURCE_DIR_ONEAPI-CK}")
59+
else()
60+
message(STATUS "Cloning oneAPI Construction Kit from ${OCK_GIT_REPO}, tag ${OCK_GIT_TAG}")
61+
endif()
6162
FetchContent_Populate(oneapi-ck)
6263
message(STATUS "oneAPI Construction Kit cloned in ${oneapi-ck_SOURCE_DIR}")
63-
set(OCK_SOURCE_DIR_INTERNAL ${oneapi-ck_SOURCE_DIR}/compiler_passes)
64-
set(OCK_BINARY_DIR_INTERNAL ${oneapi-ck_BINARY_DIR})
64+
set(OCK_SOURCE_DIR ${oneapi-ck_SOURCE_DIR}/compiler_passes)
65+
set(OCK_BINARY_DIR ${oneapi-ck_BINARY_DIR})
6566
endif()
66-
elseif(OCK_SOURCE_DIR)
67-
set(OCK_SOURCE_DIR_INTERNAL "${OCK_SOURCE_DIR}/compiler_passes")
68-
set(OCK_BINARY_DIR_INTERNAL "${CMAKE_CURRENT_BINARY_DIR}/oneapi-construction-kit")
69-
else()
70-
message(FATAL_ERROR "NATIVECPU_OCK_USE_FETCHCONTENT is Off and OCK_SOURCE_DIR not set")
7167
endif()
7268

7369
set(CA_ENABLE_API "cl" CACHE STRING "" FORCE)
7470
add_subdirectory(
75-
${OCK_SOURCE_DIR_INTERNAL}
76-
${OCK_BINARY_DIR_INTERNAL} EXCLUDE_FROM_ALL)
71+
${OCK_SOURCE_DIR}
72+
${OCK_BINARY_DIR} EXCLUDE_FROM_ALL)
7773

7874
install(TARGETS compiler-pipeline
7975
EXPORT;LLVMExports

opencl/CMakeLists.txt

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11,71 +11,12 @@ if (MSVC)
1111
)
1212
endif()
1313

14-
# Repo URLs
15-
16-
set(OCL_HEADERS_REPO
17-
"https://github.com/KhronosGroup/OpenCL-Headers.git")
18-
set(OCL_LOADER_REPO
19-
"https://github.com/KhronosGroup/OpenCL-ICD-Loader.git")
20-
21-
# Repo tags/hashes
22-
23-
set(OCL_HEADERS_TAG 6eabe90aa7b6cff9c67800a2fe25a0cd88d8b749)
24-
set(OCL_LOADER_TAG ddf6c70230a79cdb8fcccfd3c775b09e6820f42e)
25-
26-
# OpenCL Headers
27-
if(NOT OpenCL_HEADERS)
28-
message(STATUS "Will fetch OpenCL headers from ${OCL_HEADERS_REPO}")
29-
30-
FetchContent_Declare(ocl-headers
31-
GIT_REPOSITORY ${OCL_HEADERS_REPO}
32-
GIT_TAG ${OCL_HEADERS_TAG}
33-
)
34-
else()
35-
message(STATUS "OpenCL headers are added manually ${OpenCL_HEADERS}")
36-
37-
FetchContent_Declare(ocl-headers
38-
URL ${OpenCL_HEADERS}
39-
)
40-
endif()
41-
42-
FetchContent_MakeAvailable(ocl-headers)
43-
FetchContent_GetProperties(ocl-headers)
44-
set(OpenCL_INCLUDE_DIR
45-
${ocl-headers_SOURCE_DIR} CACHE PATH "Path to OpenCL Headers")
46-
47-
target_compile_definitions(Headers INTERFACE -DCL_TARGET_OPENCL_VERSION=300)
48-
add_library(OpenCL-Headers ALIAS Headers)
49-
50-
# OpenCL Library (ICD Loader)
51-
52-
# Set OPENCL_ICD_LOADER_HEADERS_DIR, as prerequisite for ICD build
53-
set(OPENCL_ICD_LOADER_HEADERS_DIR
54-
${OpenCL_INCLUDE_DIR} CACHE PATH "Path to OpenCL Headers")
55-
5614
# LLVM build sets this OFF by default, but we need OpenCL to be built as shared
5715
# library.
5816
set(BUILD_SHARED_LIBS ON)
5917

60-
if(NOT OpenCL_LIBRARY_SRC)
61-
message(STATUS "Will fetch OpenCL ICD Loader from ${OCL_LOADER_REPO}")
62-
63-
FetchContent_Declare(ocl-icd
64-
GIT_REPOSITORY ${OCL_LOADER_REPO}
65-
GIT_TAG ${OCL_LOADER_TAG}
66-
)
67-
else()
68-
# TODO: add possibility to use prebuilt OpenCL library rather than building
69-
# together with llvm.
70-
message(STATUS
71-
"OpenCL ICD Loader sources added manually ${OpenCL_LIBRARY_SRC}")
72-
73-
FetchContent_Declare(ocl-icd
74-
URL ${OpenCL_LIBRARY_SRC}
75-
)
76-
endif()
18+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../unified-runtime/cmake")
7719

78-
FetchContent_MakeAvailable(ocl-icd)
79-
add_library(OpenCL-ICD ALIAS OpenCL)
20+
include(FetchOpenCL)
8021

8122
add_subdirectory(opencl-aot)

opencl/opencl-aot/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ endif()
2525
target_link_libraries(${OPENCL_AOT_PROJECT_NAME}
2626
PRIVATE
2727
OpenCL-Headers
28-
OpenCL-ICD)
28+
${OpenCL_LIBRARY})

0 commit comments

Comments
 (0)