Skip to content

Commit 6b0066a

Browse files
authored
[SYCL][NATIVECPU] Point oneAPI Construction Kit tag to main branch (#12940)
This PR changes the git tag for the oneAPI Construction Kit, pointing to a commit in the `main` branch. It also adds CMake variables to either use a local checkout of the OCK, or overwrite the git repo/tag used by `FetchContent`.
1 parent 33e5b10 commit 6b0066a

File tree

2 files changed

+60
-22
lines changed

2 files changed

+60
-22
lines changed

sycl/doc/design/SYCLNativeCPU.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ python3 buildbot/configure.py \
4646
--cmake-opt=-DNATIVECPU_USE_OCK=Off
4747
```
4848

49+
By default the oneAPI Construction Kit is pulled at the project's configure time using CMake `FetchContent`. This behaviour can be overridden by setting `NATIVECPU_OCK_USE_FETCHCONTENT=Off` and `OCK_SOURCE_DIR=<path>`
50+
in order to use a local checkout of the oneAPI Construction Kit. The CMake variables `OCK_GIT_TAG` and `OCK_GIT_REPO` can be used to override the default git tag and repository used by `FetchContent`.
51+
4952
The SYCL Native CPU device needs to be selected at runtime by setting the environment variable `ONEAPI_DEVICE_SELECTOR=native_cpu:cpu`.
5053

5154
# Supported features and current limitations

sycl/plugins/native_cpu/CMakeLists.txt

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,67 @@ add_sycl_plugin(native_cpu
2323
UnifiedRuntimeCommon
2424
)
2525

26+
set(OCK_SOURCE_DIR "" CACHE PATH "Root of the local checkout of the oneAPI Construction Kit")
27+
set(OCK_GIT_REPO "" CACHE STRING "Git repository for the oneAPI Construction Kit FetchContent")
28+
set(OCK_GIT_TAG "" CACHE STRING "Git tag for the oneAPI Construction Kit FetchContent")
29+
option(NATIVECPU_OCK_USE_FETCHCONTENT "Use FetchContent to acquire oneAPI Construction Kit source code" On)
2630

2731
if(NATIVECPU_USE_OCK)
28-
include(FetchContent)
29-
FetchContent_Declare(oneapi-ck
30-
GIT_REPOSITORY https://github.com/codeplaysoftware/oneapi-construction-kit.git
31-
# commit 62090f9d469a30e0595f445ff664ea2ecfe77b44
32-
# Merge: 6151546a af33ddfb
33-
# Author: PietroGhg <[email protected]>
34-
# Date: Thu Feb 29 12:46:49 2024 +0100
35-
# Merge pull request #385 from PietroGhg/pietro/multi_llvm_include
36-
# [NATIVECPU] Avoid specifying include path manually for multi_llvm and Native CPU
37-
GIT_TAG 62090f9d469a30e0595f445ff664ea2ecfe77b44
38-
)
39-
FetchContent_GetProperties(oneapi-ck)
40-
if(NOT oneapi-ck_POPULATED)
41-
message(STATUS "Cloning oneAPI Construction Kit")
42-
FetchContent_Populate(oneapi-ck)
43-
message(STATUS "oneAPI Construction Kit cloned in ${oneapi-ck_SOURCE_DIR}")
44-
set(CA_NATIVE_CPU 1)
45-
add_subdirectory(${oneapi-ck_SOURCE_DIR} ${oneapi-ck_BINARY_DIR} EXCLUDE_FROM_ALL)
32+
if(NATIVECPU_OCK_USE_FETCHCONTENT)
33+
set(OCK_GIT_INTERNAL_REPO "https://github.com/codeplaysoftware/oneapi-construction-kit.git")
34+
# commit 342f06e2bba2ad5c3bb3773505fce1d0e3f872d9
35+
# Merge: 51c1b31c d74b3e1a
36+
# Author: Harald van Dijk <[email protected]>
37+
# Date: Thu Mar 7 14:19:58 2024 +0000
38+
# Merge pull request #397 from hvdijk/ignore-gl_test
39+
# Ignore test_gl test.
40+
set(OCK_GIT_INTERNAL_TAG 342f06e2bba2ad5c3bb3773505fce1d0e3f872d9)
41+
42+
# Overwrite OCK_GIT_INTERNAL_REPO/OCK_GIT_INTERNAL_TAG if the corresponding options are set
43+
if(OCK_GIT_REPO)
44+
set(OCK_GIT_INTERNAL_REPO "${OCK_GIT_REPO}")
45+
endif()
46+
if(OCK_GIT_TAG)
47+
set(OCK_GIT_INTERNAL_TAG "${OCK_GIT_TAG}")
48+
endif()
49+
include(FetchContent)
50+
FetchContent_Declare(oneapi-ck
51+
GIT_REPOSITORY "${OCK_GIT_INTERNAL_REPO}"
52+
GIT_TAG "${OCK_GIT_INTERNAL_TAG}"
53+
)
54+
FetchContent_GetProperties(oneapi-ck)
55+
if(NOT oneapi-ck_POPULATED)
56+
message(STATUS "Cloning oneAPI Construction Kit from ${OCK_GIT_INTERNAL_REPO}, tag ${OCK_GIT_INTERNAL_TAG}")
57+
FetchContent_Populate(oneapi-ck)
58+
message(STATUS "oneAPI Construction Kit cloned in ${oneapi-ck_SOURCE_DIR}")
59+
set(OCK_SOURCE_DIR_INTERNAL ${oneapi-ck_SOURCE_DIR})
60+
set(OCK_BINARY_DIR_INTERNAL ${oneapi-ck_BINARY_DIR})
61+
endif()
62+
elseif(OCK_SOURCE_DIR)
63+
set(OCK_SOURCE_DIR_INTERNAL "${OCK_SOURCE_DIR}")
64+
set(OCK_BINARY_DIR_INTERNAL "${CMAKE_CURRENT_BINARY_DIR}/oneapi-construction-kit")
65+
else()
66+
message(FATAL_ERROR "NATIVECPU_OCK_USE_FETCHCONTENT is Off and OCK_SOURCE_DIR not set")
4667
endif()
47-
install(TARGETS multi_llvm
68+
69+
set(CA_ENABLE_API "cl" CACHE STRING "" FORCE)
70+
add_subdirectory(
71+
${OCK_SOURCE_DIR_INTERNAL}
72+
${OCK_BINARY_DIR_INTERNAL} EXCLUDE_FROM_ALL)
73+
74+
install(TARGETS compiler-pipeline
75+
EXPORT;LLVMExports
76+
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline
77+
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline
78+
RUNTIME DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline)
79+
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS compiler-pipeline)
80+
install(TARGETS vecz
4881
EXPORT;LLVMExports
49-
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT multi_llvm
50-
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT multi_llvm
51-
RUNTIME DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT multi_llvm)
82+
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz
83+
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz
84+
RUNTIME DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz)
85+
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS vecz)
86+
install(TARGETS multi_llvm EXPORT;LLVMExports)
5287
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS multi_llvm)
5388
target_compile_definitions(LLVMSYCLLowerIR PRIVATE NATIVECPU_USE_OCK)
5489
target_include_directories(LLVMSYCLLowerIR PRIVATE

0 commit comments

Comments
 (0)