-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[GenVectorX] Prototype SYCL support for 2,3,4-dim vector classes #18461
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
mdessole
wants to merge
11
commits into
root-project:master
Choose a base branch
from
mdessole:genvectorx-2.0
base: master
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.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ca1e32e
[AdaptiveCpp] Add adaptivecpp
devajithvs d89e249
[GenVectorX] Add adaptivecpp helper functions in cmake
mdessole 9f4476d
[GenVectorX] Add source code in experimental
mdessole 024d0c2
[GenVectorX] Create MathX
mdessole e246514
Add acpp-rt and acpp-common in ROOTExports
devajithvs 3e84f67
[CI] Enable GenVectorX on some linux machines
devajithvs fb87aba
[AdaptiveCpp] Remove redundant functions
mdessole d0b3404
[GenVectorX] Update documentation
mdessole 40203c3
[GenVectorX] Remove Math namespace
mdessole 62e76cf
[GenVectorX] Update tests
mdessole c8fc174
[GenVectorX] Fix doc groups
mdessole 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 |
---|---|---|
|
@@ -2,3 +2,5 @@ builtin_zstd=ON | |
builtin_zlib=ON | ||
builtin_vdt=On | ||
ccache=On | ||
experimental_adaptivecpp=ON | ||
experimental_genvectorx=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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
builtin_zlib=ON | ||
builtin_zstd=ON | ||
ccache=ON | ||
experimental_adaptivecpp=ON | ||
experimental_genvectorx=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,3 +1,5 @@ | ||
ccache=ON | ||
experimental_adaptivecpp=ON | ||
experimental_genvectorx=ON | ||
pythia8=OFF | ||
tmva-sofie=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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
experimental_adaptivecpp=ON | ||
experimental_genvectorx=ON | ||
ccache=ON | ||
pythia8=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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. | ||
# All rights reserved. | ||
# | ||
# For the licensing terms see $ROOTSYS/LICENSE. | ||
# For the list of contributors see $ROOTSYS/README/CREDITS. | ||
|
||
############################################################################ | ||
# CMakeLists.txt file for building ROOT math/genvector package | ||
############################################################################ | ||
|
||
message(STATUS "Experimental GenVectorX") | ||
|
||
ROOT_LINKER_LIBRARY(GenVectorSYCL | ||
src/3DConversions.cxx | ||
src/3DDistances.cxx | ||
src/AxisAngle.cxx | ||
src/AxisAngleXother.cxx | ||
src/BitReproducible.cxx | ||
src/Boost.cxx | ||
src/BoostX.cxx | ||
src/BoostY.cxx | ||
src/BoostZ.cxx | ||
src/EulerAngles.cxx | ||
src/LorentzRotation.cxx | ||
src/Quaternion.cxx | ||
src/QuaternionXaxial.cxx | ||
src/Rotation3D.cxx | ||
src/Rotation3DxAxial.cxx | ||
src/RotationZYX.cxx | ||
src/VectorUtil.cxx | ||
DEPENDENCIES | ||
Core | ||
MathCore | ||
) | ||
|
||
add_sycl_to_root_target( | ||
TARGET | ||
GenVectorSYCL | ||
SOURCES | ||
src/3DConversions.cxx | ||
src/3DDistances.cxx | ||
src/AxisAngle.cxx | ||
src/AxisAngleXother.cxx | ||
src/BitReproducible.cxx | ||
src/Boost.cxx | ||
src/BoostX.cxx | ||
src/BoostY.cxx | ||
src/BoostZ.cxx | ||
src/EulerAngles.cxx | ||
src/LorentzRotation.cxx | ||
src/Quaternion.cxx | ||
src/QuaternionXaxial.cxx | ||
src/Rotation3D.cxx | ||
src/Rotation3DxAxial.cxx | ||
src/RotationZYX.cxx | ||
src/VectorUtil.cxx | ||
COMPILE_DEFINITIONS | ||
ROOT_MATH_SYCL | ||
) | ||
|
||
set(ACPP_EXPORTS acpp-rt acpp-common) | ||
|
||
foreach(target IN LISTS ACPP_EXPORTS) | ||
install(TARGETS ${target} EXPORT ROOTExports) | ||
endforeach() | ||
|
||
target_link_libraries(GenVectorSYCL PUBLIC m stdc++) | ||
|
||
target_compile_definitions(GenVectorSYCL PUBLIC ROOT_MATH_SYCL) | ||
|
||
ROOT_ADD_TEST_SUBDIRECTORY(test) | ||
|
||
ROOT_INSTALL_HEADERS() |
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,14 @@ | ||
\defgroup GenVectorX Physics Vectors | ||
\ingroup Math | ||
\brief Vector classes (2D, 3D and 4D / Lorentz vector) and their transformations to be used in SYCL or CUDA kernels for heterogeneous computing. | ||
|
||
These classes represent vectors and their operations and transformations, such as rotations and Lorentz transformations, in two, three and four dimensions. | ||
The 4D space-time is used for physics vectors representing relativistic particles in [Minkowski-space](https://en.wikipedia.org/wiki/Minkowski_space). | ||
These vectors are different from Linear Algebra vectors or `std::vector` which describe generic N-dimensional vectors. | ||
|
||
Hint: the most commonly used Lorentz vector class is ROOT::MathSYCL::PtEtaPhiMVector or ROOT::MathCUDA::PtEtaPhiMVector, respectively a typedef to ROOT::MathSYCL::LorentzVector < ROOT::MathSYCL::PtEtaPhiM4D < double > > and ROOT::MathCUDA::LorentzVector < ROOT::MathCUDA::PtEtaPhiM4D < double > >. | ||
|
||
|
||
## Additional Documentation | ||
|
||
A more detailed description of the GenVectorX package is available in this [document](https://arxiv.org/pdf/2312.02756). |
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,9 @@ | ||
// @(#)root/mathcore:$Id$ | ||
// Authors: W. Brown, M. Fischler, L. Moneta 2005 | ||
|
||
#ifndef ROOT_MathX_AxisAngle | ||
#define ROOT_MathX_AxisAngle | ||
|
||
#include "MathX/GenVectorX/AxisAngle.h" | ||
|
||
#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,9 @@ | ||
// @(#)root/mathcore:$Id$ | ||
// Authors: W. Brown, M. Fischler, L. Moneta 2005 | ||
|
||
#ifndef ROOT_MathX_Boost | ||
#define ROOT_MathX_Boost | ||
|
||
#include "MathX/GenVectorX/Boost.h" | ||
|
||
#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,9 @@ | ||
// @(#)root/mathcore:$Id$ | ||
// Authors: W. Brown, M. Fischler, L. Moneta 2005 | ||
|
||
#ifndef ROOT_MathX_BoostX | ||
#define ROOT_MathX_BoostX | ||
|
||
#include "MathX/GenVectorX/BoostX.h" | ||
|
||
#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,9 @@ | ||
// @(#)root/mathcore:$Id$ | ||
// Authors: W. Brown, M. Fischler, L. Moneta 2005 | ||
|
||
#ifndef ROOT_MathX_BoostY | ||
#define ROOT_MathX_BoostY | ||
|
||
#include "MathX/GenVectorX/BoostY.h" | ||
|
||
#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,9 @@ | ||
// @(#)root/mathcore:$Id$ | ||
// Authors: W. Brown, M. Fischler, L. Moneta 2005 | ||
|
||
#ifndef ROOT_MathX_BoostZ | ||
#define ROOT_MathX_BoostZ | ||
|
||
#include "MathX/GenVectorX/BoostZ.h" | ||
|
||
#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,9 @@ | ||
// @(#)root/mathcore:$Id$ | ||
// Authors: W. Brown, M. Fischler, L. Moneta 2005 | ||
|
||
#ifndef ROOT_MathX_Cartesian2D | ||
#define ROOT_MathX_Cartesian2D | ||
|
||
#include "MathX/GenVectorX/Cartesian2D.h" | ||
|
||
#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,9 @@ | ||
// @(#)root/mathcore:$Id$ | ||
// Authors: W. Brown, M. Fischler, L. Moneta 2005 | ||
|
||
#ifndef ROOT_MathX_Cartesian3D | ||
#define ROOT_MathX_Cartesian3D | ||
|
||
#include "MathX/GenVectorX/Cartesian3D.h" | ||
|
||
#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,9 @@ | ||
// @(#)root/mathcore:$Id$ | ||
// Authors: W. Brown, M. Fischler, L. Moneta 2005 | ||
|
||
#ifndef ROOT_MathX_Cylindrical3D | ||
#define ROOT_MathX_Cylindrical3D | ||
|
||
#include "MathX/GenVectorX/Cylindrical3D.h" | ||
|
||
#endif |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit confused.
If that PR is merged does it mean that ROOT will be fetching ROOT?Replying to self: AdaptiveCpp seems some runtime that we need. Any clue what would it take to depend on llvm only and what would it take to move the minimal set of infrastructure we need of AdaptiveCpp in llvm?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Root will be fetching
AdaptiveCpp
at configure time if-Dexperimental_adaptivecpp
is enabled.AdaptiveCpp
upstream uses dynamic LLVM (we need a few patches to get it building statically, so a separate fork. This can potentially be up-streamed)