-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[cling] Prototype SYCL support in ROOT #17209
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
Merged
devajithvs
merged 3 commits into
root-project:master
from
devajithvs:dev.adaptivecpp-proto
Sep 10, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| builtin_zlib=ON | ||
| builtin_zstd=ON | ||
| experimental_adaptivecpp=ON | ||
| pythia8=ON | ||
| vdt=OFF |
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
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 |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| tmva-sofie=ON | ||
| experimental_adaptivecpp=ON |
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
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
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
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,116 @@ | ||
| message(STATUS "Building AdaptiveCpp for SYCL support.") | ||
|
|
||
| include(FetchContent) | ||
|
|
||
| if(NOT DEFINED ADAPTIVE_CPP_SOURCE_DIR) | ||
| FetchContent_Declare( | ||
| AdaptiveCpp | ||
| GIT_REPOSITORY https://github.com/root-project/AdaptiveCpp.git | ||
| GIT_TAG ROOT-acpp-v25.02.0-20250615-01) | ||
| FetchContent_GetProperties(AdaptiveCpp) | ||
| if(NOT AdaptiveCpp_POPULATED) | ||
| FetchContent_Populate(AdaptiveCpp) | ||
| endif() | ||
| set(ADAPTIVE_CPP_SOURCE_DIR ${adaptivecpp_SOURCE_DIR}) | ||
| message(STATUS "Fetched AdaptiveCpp source to: ${ADAPTIVE_CPP_SOURCE_DIR}") | ||
| else() | ||
| message( | ||
| STATUS "ADAPTIVE_CPP_SOURCE_DIR already defined: ${ADAPTIVE_CPP_SOURCE_DIR}" | ||
| ) | ||
| endif() | ||
|
|
||
| set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR}/interpreter/llvm-project/llvm) | ||
| set(CLANG_EXECUTABLE_PATH ${LLVM_BINARY_DIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}) | ||
|
|
||
| set(ACPP_CLANG | ||
| ${CLANG_EXECUTABLE_PATH} | ||
| CACHE STRING "Clang compiler executable used for compilation." FORCE) | ||
|
|
||
| set(ADAPTIVE_CPP_BINARY_DIR ${CMAKE_BINARY_DIR}) | ||
| message(STATUS "AdaptiveCpp will be built in: ${ADAPTIVE_CPP_BINARY_DIR}") | ||
|
|
||
| set(ADAPTIVECPP_INSTALL_CMAKE_DIR | ||
| lib/cmake/AdaptiveCpp | ||
| CACHE PATH "Install path for CMake config files") | ||
|
|
||
| # Set relative paths for install root in the following variables so that | ||
| # configure_package_config_file will generate paths relative whatever is the | ||
| # future install root | ||
| set(ADAPTIVECPP_INSTALL_COMPILER_DIR bin) | ||
| set(ACPP_CONFIG_FILE_INSTALL_DIR etc/AdaptiveCpp) | ||
| set(ADAPTIVECPP_INSTALL_LAUNCHER_DIR ${ADAPTIVECPP_INSTALL_CMAKE_DIR}) | ||
| set(ADAPTIVECPP_INSTALL_LAUNCHER_RULE_DIR ${ADAPTIVECPP_INSTALL_CMAKE_DIR}) | ||
|
|
||
| install(FILES ${ADAPTIVE_CPP_BINARY_DIR}/lib/libacpp-rt.so DESTINATION lib) | ||
| install(DIRECTORY ${ADAPTIVE_CPP_BINARY_DIR}/lib/hipSYCL/bitcode/ | ||
| DESTINATION lib/hipSYCL/bitcode) | ||
| install(DIRECTORY ${ADAPTIVE_CPP_BINARY_DIR}/include/AdaptiveCpp/ | ||
| DESTINATION include/AdaptiveCpp) | ||
|
|
||
| file( | ||
| COPY ${ADAPTIVE_CPP_SOURCE_DIR}/cmake/syclcc-launcher | ||
| DESTINATION ${ADAPTIVE_CPP_BINARY_DIR}/${ADAPTIVECPP_INSTALL_LAUNCHER_DIR}) | ||
| file( | ||
| COPY ${ADAPTIVE_CPP_SOURCE_DIR}/cmake/syclcc-launch.rule.in | ||
| DESTINATION ${ADAPTIVE_CPP_BINARY_DIR}/${ADAPTIVECPP_INSTALL_LAUNCHER_RULE_DIR}) | ||
|
|
||
| list(APPEND CMAKE_PREFIX_PATH ${ADAPTIVE_CPP_BINARY_DIR}/${ADAPTIVECPP_INSTALL_CMAKE_DIR}) | ||
| message(STATUS "Added ${ADAPTIVE_CPP_BINARY_DIR}/${ADAPTIVECPP_INSTALL_CMAKE_DIR} to CMAKE_PREFIX_PATH.") | ||
|
|
||
| install(PROGRAMS ${ADAPTIVE_CPP_BINARY_DIR}/bin/acpp | ||
| DESTINATION ${ADAPTIVECPP_INSTALL_COMPILER_DIR}) | ||
| install(FILES ${ADAPTIVE_CPP_SOURCE_DIR}/cmake/syclcc-launcher | ||
| DESTINATION ${ADAPTIVECPP_INSTALL_LAUNCHER_DIR}) | ||
| install(FILES ${ADAPTIVE_CPP_SOURCE_DIR}/cmake/syclcc-launch.rule.in | ||
| DESTINATION ${ADAPTIVECPP_INSTALL_LAUNCHER_RULE_DIR}) | ||
|
|
||
| file(GLOB CLANG_EXECUTABLES "${LLVM_BINARY_DIR}/bin/clang*") | ||
| install(PROGRAMS ${CLANG_EXECUTABLES} | ||
| DESTINATION ${ADAPTIVECPP_INSTALL_COMPILER_DIR}) | ||
|
|
||
| file(GLOB CONFIG_FILES "${ADAPTIVE_CPP_BINARY_DIR}/etc/AdaptiveCpp/*") | ||
| install(FILES ${CONFIG_FILES} DESTINATION ${ACPP_CONFIG_FILE_INSTALL_DIR}) | ||
|
|
||
| # Create imported target AdaptiveCpp::acpp-common | ||
| add_library(AdaptiveCpp::acpp-common STATIC IMPORTED) | ||
|
|
||
| set_target_properties(AdaptiveCpp::acpp-common PROPERTIES | ||
| INTERFACE_INCLUDE_DIRECTORIES "${ADAPTIVE_CPP_BINARY_DIR}/include;${ADAPTIVE_CPP_BINARY_DIR}/include/AdaptiveCpp" | ||
| INTERFACE_LINK_LIBRARIES "-Wl,-Bsymbolic-functions;\$<LINK_ONLY:dl>" | ||
| ) | ||
|
|
||
| # Create imported target AdaptiveCpp::acpp-rt | ||
| add_library(AdaptiveCpp::acpp-rt SHARED IMPORTED) | ||
|
|
||
| set_target_properties(AdaptiveCpp::acpp-rt PROPERTIES | ||
| INTERFACE_INCLUDE_DIRECTORIES "${ADAPTIVE_CPP_BINARY_DIR}/include;${ADAPTIVE_CPP_BINARY_DIR}/include/AdaptiveCpp" | ||
| INTERFACE_LINK_LIBRARIES "AdaptiveCpp::acpp-common" | ||
| ) | ||
|
|
||
| # Import target "AdaptiveCpp::acpp-common" for configuration "Release" | ||
| set_property(TARGET AdaptiveCpp::acpp-common APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) | ||
| set_target_properties(AdaptiveCpp::acpp-common PROPERTIES | ||
| IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" | ||
| IMPORTED_LOCATION_RELEASE "${ADAPTIVE_CPP_BINARY_DIR}/lib/libacpp-common.a" | ||
| ) | ||
|
|
||
| # Import target "AdaptiveCpp::acpp-rt" for configuration "Release" | ||
| set_property(TARGET AdaptiveCpp::acpp-rt APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) | ||
| set_target_properties(AdaptiveCpp::acpp-rt PROPERTIES | ||
| IMPORTED_LOCATION_RELEASE "${ADAPTIVE_CPP_BINARY_DIR}/lib/libacpp-rt.so" | ||
| IMPORTED_SONAME_RELEASE "libacpp-rt.so" | ||
| ) | ||
|
|
||
| # Make a config file to make this usable as a CMake Package | ||
| # Start by adding the version in a CMake understandable way | ||
| include(CMakePackageConfigHelpers) | ||
|
|
||
| configure_package_config_file( | ||
| ${ADAPTIVE_CPP_SOURCE_DIR}/cmake/adaptivecpp-config.cmake.in | ||
| ${ADAPTIVE_CPP_BINARY_DIR}/lib/cmake/AdaptiveCpp/adaptivecpp-config.cmake | ||
| INSTALL_DESTINATION ${ADAPTIVECPP_INSTALL_CMAKE_DIR} | ||
| PATH_VARS | ||
| ADAPTIVECPP_INSTALL_COMPILER_DIR | ||
| ADAPTIVECPP_INSTALL_LAUNCHER_DIR | ||
| ADAPTIVECPP_INSTALL_LAUNCHER_RULE_DIR | ||
| ) |
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
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
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
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
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
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
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
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
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,7 @@ | ||
| if(experimental_adaptivecpp) | ||
| ROOTTEST_ADD_TEST(syclbasic | ||
| MACRO syclbasic.C | ||
| LABELS roottest regression cling sycl) | ||
| set_property(TEST roottest-cling-sycl-syclbasic PROPERTY ENVIRONMENT "ACPP_DEBUG_LEVEL=1") | ||
| endif() | ||
|
|
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,16 @@ | ||
| #include <sycl/sycl.hpp> | ||
| #include <iostream> | ||
|
|
||
| void syclbasic() | ||
| { | ||
| sycl::queue q{sycl::cpu_selector_v}; // Only openMP CPU backend is supported right now | ||
| std::cout << "Running on: " << q.get_device().get_info<sycl::info::device::name>() << "\n"; | ||
|
|
||
| int a = 2, b = 3; | ||
| int *sum = sycl::malloc_shared<int>(1, q); | ||
|
|
||
| q.single_task([=] { *sum = a + b; }).wait(); | ||
| std::cout << "Sum = " << *sum << '\n'; | ||
|
|
||
| sycl::free(sum, q); | ||
| } |
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,3 @@ | ||
|
|
||
| Running on: AdaptiveCpp OpenMP host device | ||
| Sum = 5 |
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
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.