-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[SYCL] Add libsycl, a SYCL RT library implementation project #144372
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
Open
KseniyaTikhomirova
wants to merge
14
commits into
llvm:main
Choose a base branch
from
sergey-semenov:reviewed_addlibsycl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+771
−2
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5bbfeca
[SYCL] Add libsycl, a SYCL RT library implementation project (#3)
KseniyaTikhomirova fdf4ddb
address comments
KseniyaTikhomirova fb11e68
rename detail folder
KseniyaTikhomirova e901d30
fix clang format, update docs
KseniyaTikhomirova 2caf523
fix more comments
KseniyaTikhomirova 83458d1
cmake files update
KseniyaTikhomirova 97752d6
Merge branch 'main' into reviewed_addlibsycl
bader 8811e0d
Merge branch 'llvm:main' into reviewed_addlibsycl
KseniyaTikhomirova 6e47300
fix cmake related comments
KseniyaTikhomirova 2573733
fix win build
KseniyaTikhomirova 554decd
remove version from win library name
KseniyaTikhomirova e8e2ca9
Merge branch 'main' into reviewed_addlibsycl
KseniyaTikhomirova b824da0
rest of the changes for version removal
KseniyaTikhomirova 81c9efd
remove extra code for implib name
KseniyaTikhomirova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
BasedOnStyle: LLVM | ||
|
||
KseniyaTikhomirova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Preferred indentions of preprocessor statements. | ||
IndentPPDirectives: AfterHash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Checks: > | ||
-*, | ||
clang-analyzer-*, | ||
clang-diagnostic-*, | ||
cppcoreguidelines-*, | ||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay, | ||
-cppcoreguidelines-pro-bounds-constant-array-index, | ||
-cppcoreguidelines-pro-bounds-pointer-arithmetic, | ||
-cppcoreguidelines-pro-type-member-init, | ||
-cppcoreguidelines-pro-type-union-access, | ||
google-*, | ||
-google-build-using-namespace, | ||
-google-explicit-constructor, | ||
-google-runtime-references, | ||
misc-*, | ||
-misc-macro-parentheses, | ||
-misc-unused-parameters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#=============================================================================== | ||
# Setup Project | ||
#=============================================================================== | ||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
set(LLVM_SUBPROJECT_TITLE "libsycl") | ||
|
||
set(LIBSYCL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | ||
set(LIBSYCL_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED YES) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
#=============================================================================== | ||
# Limitations | ||
#=============================================================================== | ||
|
||
if (CMAKE_SYSTEM_NAME STREQUAL Windows AND NOT MSVC) | ||
# Build with other compilers is not configured, not guaranteed and not tested. | ||
message( FATAL_ERROR | ||
"On Windows libsycl supports compiler which is some version of Microsoft" | ||
" Visual C++ or another compiler simulating the Visual C++ cl" | ||
" command-line syntax" ) | ||
endif() | ||
|
||
#=============================================================================== | ||
# Setup CMake Options | ||
#=============================================================================== | ||
|
||
option(LIBSYCL_ENABLE_WERROR "Treat all warnings as errors in the libsycl project" OFF) | ||
option(LIBSYCL_ENABLE_PEDANTIC "Compile with pedantic enabled." OFF) | ||
|
||
#=============================================================================== | ||
# Configure System | ||
#=============================================================================== | ||
|
||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
|
||
set(LIBSYCL_SHARED_OUTPUT_NAME "sycl" CACHE STRING "Output name for the shared libsycl runtime library.") | ||
|
||
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE) | ||
set(LIBSYCL_TARGET_SUBDIR ${LLVM_DEFAULT_TARGET_TRIPLE}) | ||
if(LIBSYCL_LIBDIR_SUBDIR) | ||
string(APPEND LIBSYCL_TARGET_SUBDIR /${LIBSYCL_LIBDIR_SUBDIR}) | ||
endif() | ||
cmake_path(NORMAL_PATH LIBSYCL_TARGET_SUBDIR) | ||
set(LIBSYCL_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LIBSYCL_TARGET_SUBDIR}) | ||
set(LIBSYCL_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LIBSYCL_TARGET_SUBDIR} CACHE STRING | ||
"Path where built libsycl libraries should be installed.") | ||
unset(LIBSYCL_TARGET_SUBDIR) | ||
else() | ||
if(LLVM_LIBRARY_OUTPUT_INTDIR) | ||
set(LIBSYCL_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) | ||
else() | ||
set(LIBSYCL_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBSYCL_LIBDIR_SUFFIX}) | ||
endif() | ||
set(LIBSYCL_INSTALL_LIBRARY_DIR lib${LIBSYCL_LIBDIR_SUFFIX} CACHE STRING | ||
"Path where built libsycl libraries should be installed.") | ||
endif() | ||
|
||
set(LIBSYCL_INCLUDE_DIR include) | ||
set(LIBSYCL_BUILD_INCLUDE_DIR ${LLVM_BINARY_DIR}/${LIBSYCL_INCLUDE_DIR}) | ||
set(LIBSYCL_SOURCE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBSYCL_LIBRARY_DIR}) | ||
KseniyaTikhomirova marked this conversation as resolved.
Show resolved
Hide resolved
|
||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIBSYCL_LIBRARY_DIR}) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LIBSYCL_LIBRARY_DIR}) | ||
|
||
set(LIBSYCL_MAJOR_VERSION 0) | ||
philnik777 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
set(LIBSYCL_MINOR_VERSION 1) | ||
set(LIBSYCL_PATCH_VERSION 0) | ||
set(LIBSYCL_VERSION_STRING "${LIBSYCL_MAJOR_VERSION}.${LIBSYCL_MINOR_VERSION}.${LIBSYCL_PATCH_VERSION}") | ||
set(LIBSYCL_ABI_NAMESPACE "V${LIBSYCL_MAJOR_VERSION}" CACHE STRING | ||
"The inline ABI namespace used by libsycl. It defaults to Vn where `n` is the current ABI version.") | ||
|
||
#=============================================================================== | ||
# Setup build & install rules | ||
#=============================================================================== | ||
|
||
# Generate headers | ||
configure_file("${LIBSYCL_SOURCE_DIR}/src/version.hpp.in" "${LIBSYCL_BUILD_INCLUDE_DIR}/sycl/version.hpp") | ||
|
||
# Install generated headers. | ||
install(FILES | ||
"${LIBSYCL_BUILD_INCLUDE_DIR}/sycl/version.hpp" | ||
DESTINATION "${LIBSYCL_INCLUDE_DIR}/sycl" | ||
COMPONENT sycl-headers) | ||
|
||
# This is a workaround to detect changes (add or modify) in subtree which | ||
# are not detected by copy_directory command. | ||
file(GLOB_RECURSE HEADERS_IN_SYCL_DIR CONFIGURE_DEPENDS "${LIBSYCL_SOURCE_INCLUDE_DIR}/sycl/*") | ||
|
||
string(REPLACE "${LIBSYCL_SOURCE_INCLUDE_DIR}" "${LIBSYCL_BUILD_INCLUDE_DIR}" | ||
OUT_HEADERS_IN_SYCL_DIR "${HEADERS_IN_SYCL_DIR}") | ||
|
||
# Copy SYCL headers from sources to build directory | ||
add_custom_target(sycl-headers | ||
DEPENDS ${OUT_HEADERS_IN_SYCL_DIR}) | ||
|
||
add_custom_command( | ||
OUTPUT ${OUT_HEADERS_IN_SYCL_DIR} | ||
DEPENDS ${HEADERS_IN_SYCL_DIR} | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBSYCL_SOURCE_INCLUDE_DIR}/sycl ${LIBSYCL_BUILD_INCLUDE_DIR}/sycl | ||
COMMENT "Copying SYCL headers...") | ||
|
||
install(DIRECTORY "${LIBSYCL_SOURCE_INCLUDE_DIR}/sycl" DESTINATION ${LIBSYCL_INCLUDE_DIR} COMPONENT sycl-headers) | ||
|
||
set(LIBSYCL_RT_LIBS ${LIBSYCL_SHARED_OUTPUT_NAME}) | ||
|
||
add_subdirectory(src) | ||
|
||
add_custom_target(libsycl-runtime-libraries | ||
DEPENDS ${LIBSYCL_RT_LIBS} | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.