-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Import/preprocess boost/mp11 at build time to use in SYCL headers. #5791
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
Conversation
…ers. Preprocessing adapts boost/mp11 headers for use in SYCL headers in a way that does not conflict with potential use of boost in user code. Particularly, `BOOST_*` macros are replaced with `SYCL_BOOST_*`, APIs are moved into the top-level `sycl` namespace. For example, `sycl::boost::mp11::mp_list`. Signed-off-by: Konstantin S Bobrovsky <[email protected]>
We should not pollute the |
Right, we should not. @rolandschulz also suggested |
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
1124ea5
to
e0c97c6
Compare
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
- Avoid FetchContent_MakeAvailable, as we just want to download sources, and not to import mp11's cmake files into build. - Fix dependencies to make sure mp11 preprocessed headers are produced when making higher-level targets Signed-off-by: Konstantin S Bobrovsky <[email protected]>
Signed-off-by: Konstantin S Bobrovsky <[email protected]>
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.
@alexbatashev, can you also review this please? I'm sure you'll have some good suggestions.
sycl/CMakeLists.txt
Outdated
@@ -126,6 +126,68 @@ install(DIRECTORY ${OpenCL_INCLUDE_DIR}/CL | |||
DESTINATION ${SYCL_INCLUDE_DIR}/sycl | |||
COMPONENT OpenCL-Headers) | |||
|
|||
# -------------- boost/mp11 headers import and preprocessing |
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.
sycl/CMakeLists.txt keeps growing, I would suggest to isolate external projects elsewhere. Maybe we should do something similar to opencl deps, basically have mp11 directory on top level with CMakeLists.txt alone and have add_llvm_external_project(mp11) here (see line 112)?
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.
Good point. I refactored the code. But I can't really add it as llvm project, as we talked, so I put mp11 modules into sycl/cmake/modules, leaving only include(<main_mp11_module_name>)
in the sycl CMakeLists.txt.
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.
also I fixed errors arising with cmake 3.16 used in CI
…ake 3.16. Signed-off-by: Konstantin S Bobrovsky <[email protected]>
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.
Nice, we can use Boost in the implementation? :-)
Just curious, why do you need MP11?
OUT ${OUT} | ||
SRC_PATH ${SRC_PATH} | ||
SRC_ID ${SRC_ID} | ||
) |
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.
EOL
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.
thanks, fixed
Sort of. We can only boost::mp11 in our implementation for now :) |
ping @alexbatashev |
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.
The header file path <sycl/detail/boost/mp11.hpp>
and the namespace sycl::detail::boost::mp11
both look OK tome.
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.
Looks good to me.
I advice to ask for one more reviewer to look at these CMake change.
Co-authored-by: Alexey Bader <[email protected]>
7cacacb
Fixed comment according to review comments in [7cacacb]. |
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.
Fixed comment according to review comments in [7cacacb]. @bader, @alexbatashev, @v-klochkov, @gmlueck, @pvchupin - please re-approve.
I think this typo fix won't change the status and we can consider this PR approved by all these folks. Are you still waiting for reviews from @sergey-semenov, @steffenlarsen and @rolandschulz?
No, I think I have enough reviews at this point. |
@steffenlarsen, FYI - you can now use mp11 |
Currently, compile-time properties are sorted using a hand-written implementation of merge-sort. However, this PR propose to sort compile-time properties using Boost's MP11 metaprogramming library instead. Mp11's sorting functionality is more optimized and it also improves the overall code readability (83 LOC vs just 11 LOC). PS:- This PR does not introduce any new dependency as Mp11 is already integrated into the code base (See [#5791](#5791)).
This PR reintroduces #8168 that was reverted by #8325 due to some build errors with MSVC compilers. Upon inspection, it was found that the build errors occur only in the case of incremental builds. With clean builds - i.e. completely removing the build directory and re-configuring/re-building again - there won't be any errors. -------------- Currently, compile-time properties are sorted using a hand-written implementation of merge-sort. However, this PR propose to sort compile-time properties using Boost's MP11 metaprogramming library instead. Mp11's sorting functionality is more optimized and it also improves the overall code readability (83 LOC vs just 11 LOC). PS:- This PR does not introduce any new dependency as Mp11 is already integrated into the code base (See #5791).
Preprocessing adapts boost/mp11 headers for use in SYCL headers in a way
that does not conflict with potential use of boost in user code.
Particularly,
BOOST_*
macros are replaced withSYCL_BOOST_*
, APIsare moved into the top-level
sycl::detail
namespace. For example,sycl::detail::boost::mp11::mp_list
.Signed-off-by: Konstantin S Bobrovsky [email protected]