Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][NATIVECPU] Point oneAPI Construction Kit tag to main branch #12940

Merged
merged 12 commits into from
Mar 11, 2024
3 changes: 3 additions & 0 deletions sycl/doc/design/SYCLNativeCPU.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ python3 buildbot/configure.py \
--cmake-opt=-DNATIVECPU_USE_OCK=Off
```

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>`
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`.

The SYCL Native CPU device needs to be selected at runtime by setting the environment variable `ONEAPI_DEVICE_SELECTOR=native_cpu:cpu`.

# Supported features and current limitations
Expand Down
79 changes: 57 additions & 22 deletions sycl/plugins/native_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,67 @@ add_sycl_plugin(native_cpu
UnifiedRuntimeCommon
)

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

if(NATIVECPU_USE_OCK)
include(FetchContent)
FetchContent_Declare(oneapi-ck
GIT_REPOSITORY https://github.com/codeplaysoftware/oneapi-construction-kit.git
# commit 62090f9d469a30e0595f445ff664ea2ecfe77b44
# Merge: 6151546a af33ddfb
# Author: PietroGhg <pietro.ghiglio@codeplay.com>
# Date: Thu Feb 29 12:46:49 2024 +0100
# Merge pull request #385 from PietroGhg/pietro/multi_llvm_include
# [NATIVECPU] Avoid specifying include path manually for multi_llvm and Native CPU
GIT_TAG 62090f9d469a30e0595f445ff664ea2ecfe77b44
)
FetchContent_GetProperties(oneapi-ck)
if(NOT oneapi-ck_POPULATED)
message(STATUS "Cloning oneAPI Construction Kit")
FetchContent_Populate(oneapi-ck)
message(STATUS "oneAPI Construction Kit cloned in ${oneapi-ck_SOURCE_DIR}")
set(CA_NATIVE_CPU 1)
add_subdirectory(${oneapi-ck_SOURCE_DIR} ${oneapi-ck_BINARY_DIR} EXCLUDE_FROM_ALL)
if(NATIVECPU_OCK_USE_FETCHCONTENT)
set(OCK_GIT_INTERNAL_REPO "https://github.com/codeplaysoftware/oneapi-construction-kit.git")
# commit 342f06e2bba2ad5c3bb3773505fce1d0e3f872d9
# Merge: 51c1b31c d74b3e1a
# Author: Harald van Dijk <harald.vandijk@codeplay.com>
# Date: Thu Mar 7 14:19:58 2024 +0000
# Merge pull request #397 from hvdijk/ignore-gl_test
# Ignore test_gl test.
set(OCK_GIT_INTERNAL_TAG 342f06e2bba2ad5c3bb3773505fce1d0e3f872d9)

# Overwrite OCK_GIT_INTERNAL_REPO/OCK_GIT_INTERNAL_TAG if the corresponding options are set
if(OCK_GIT_REPO)
set(OCK_GIT_INTERNAL_REPO "${OCK_GIT_REPO}")
endif()
if(OCK_GIT_TAG)
set(OCK_GIT_INTERNAL_TAG "${OCK_GIT_TAG}")
endif()
include(FetchContent)
FetchContent_Declare(oneapi-ck
GIT_REPOSITORY "${OCK_GIT_INTERNAL_REPO}"
GIT_TAG "${OCK_GIT_INTERNAL_TAG}"
)
FetchContent_GetProperties(oneapi-ck)
if(NOT oneapi-ck_POPULATED)
message(STATUS "Cloning oneAPI Construction Kit from ${OCK_GIT_INTERNAL_REPO}, tag ${OCK_GIT_INTERNAL_TAG}")
FetchContent_Populate(oneapi-ck)
message(STATUS "oneAPI Construction Kit cloned in ${oneapi-ck_SOURCE_DIR}")
set(OCK_SOURCE_DIR_INTERNAL ${oneapi-ck_SOURCE_DIR})
set(OCK_BINARY_DIR_INTERNAL ${oneapi-ck_BINARY_DIR})
endif()
elseif(OCK_SOURCE_DIR)
set(OCK_SOURCE_DIR_INTERNAL "${OCK_SOURCE_DIR}")
set(OCK_BINARY_DIR_INTERNAL "${CMAKE_CURRENT_BINARY_DIR}/oneapi-construction-kit")
else()
message(FATAL_ERROR "NATIVECPU_OCK_USE_FETCHCONTENT is Off and OCK_SOURCE_DIR not set")
endif()
install(TARGETS multi_llvm

set(CA_ENABLE_API "cl" CACHE STRING "" FORCE)
add_subdirectory(
${OCK_SOURCE_DIR_INTERNAL}
${OCK_BINARY_DIR_INTERNAL} EXCLUDE_FROM_ALL)

install(TARGETS compiler-pipeline
EXPORT;LLVMExports
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline
RUNTIME DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline)
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS compiler-pipeline)
install(TARGETS vecz
EXPORT;LLVMExports
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT multi_llvm
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT multi_llvm
RUNTIME DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT multi_llvm)
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz
RUNTIME DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz)
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS vecz)
install(TARGETS multi_llvm EXPORT;LLVMExports)
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS multi_llvm)
target_compile_definitions(LLVMSYCLLowerIR PRIVATE NATIVECPU_USE_OCK)
target_include_directories(LLVMSYCLLowerIR PRIVATE
Expand Down
Loading