Add proper bounded output support to set-algorithms from oneapi::dpl::ranges namespace with CPU policies#2569
Add proper bounded output support to set-algorithms from oneapi::dpl::ranges namespace with CPU policies#2569SergeyKopienko wants to merge 748 commits intomainfrom
oneapi::dpl::ranges namespace with CPU policies#2569Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for bounded output ranges in range-based set algorithms (set_union, set_intersection, set_difference, set_symmetric_difference) and enables host policy execution for these algorithms. The changes include:
Changes:
- Implements bounded output range handling for set algorithms to properly truncate results when output capacity is insufficient
- Adds parallel execution policy support (par, unseq, par_unseq) for range-based set algorithms
- Removes libc++ workaround macro that was addressing a now-resolved bug
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test/support/utils.h | Adds logging utilities and SetDataItem structure for set algorithm testing |
| test/support/test_config.h | Removes _PSTL_LIBCPP_RANGE_SET_BROKEN macro workaround |
| test/parallel_api/ranges/std_ranges_test.h | Adds bounded output testing infrastructure with padding validation |
| test/parallel_api/ranges/std_ranges_set_union.pass.cpp | Updates tests to use bounded checkers and removes workaround checks |
| test/parallel_api/ranges/std_ranges_set_symmetric_difference.pass.cpp | Updates tests with bounded output support and custom checker implementation |
| test/parallel_api/ranges/std_ranges_set_intersection.pass.cpp | Updates tests with bounded checker and removes workaround dependencies |
| test/parallel_api/ranges/std_ranges_set_difference.pass.cpp | Adds bounded output handling and custom checker |
| test/general/implementation_details/test_set_op_details.pass.cpp | New comprehensive test file for set operation implementation details |
| include/oneapi/dpl/pstl/utils_ranges.h | Adds helper functions to extract range bounds |
| include/oneapi/dpl/pstl/parallel_backend_utils.h | Implements mask-based tracking and bounded output support for parallel set operations |
| include/oneapi/dpl/pstl/algorithm_ranges_impl.h | Implements serial bounded versions and parallel support for all range-based set algorithms |
| include/oneapi/dpl/pstl/algorithm_impl.h | Major refactoring of parallel set operations to support bounded outputs with mask tracking |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7611a17 to
48e8b25
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fac271b to
c2d06d9
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
oneapi::dpl::ranges::set_union, oneapi::dpl::ranges::set_difference, oneapi::dpl::ranges::set_symmetric_difference and , oneapi::dpl::ranges::set_intersection with CPU policies
b177063 to
3ff4c96
Compare
…ienko/serial-set_fresh_to_dev
# Conflicts: # test/parallel_api/ranges/std_ranges_test.h # test/support/test_config.h
…e extra TODO from __pattern_set_intersection + __hetero_tag<_BackendTag>
…art::is_output_size_reached()
…tions in __pattern_set_difference + __parallel_tag
…P23_RESULT (OFF by default)
…T_DIFFERENCE_CPP23_RESULT
…ence_return_t based on ONEDPL_RANGES_SET_DIFFERENCE_CPP23_RESULT state
…set_difference_result()
… of __internal namespace
…ition of __set_difference_return_t + __create_set_difference_result() in the codeinclude/oneapi/dpl/pstl/algorithm_ranges_impl.h
…definition of __set_difference_return_t + __create_set_difference_result() in the code
… the new definition of __set_difference_return_t + __create_set_difference_result() in the code
…t_operations_result::__get_reached_in1_out() as unused anymore
…test to support new/old formats of oneapi::dpl::ranges::set_difference() return type
…/std_ranges_set_difference.pass.cpp to check correctness for std::ranges::set_difference with C++23 compatibility mode
…P23_RESULT (OFF by default)
…rt avoid test errors for std::ranges::set_difference + hetero-policy
…rror in __pattern_set_difference + __hetero_tag : do not forward __r2 because we using iterator from it later
This PR adds support for bounded output ranges in range-based set algorithms for the
seq,par,unseqandpar_unseqexecution policies:oneapi::dpl::ranges::set_union;oneapi::dpl::ranges::set_difference;oneapi::dpl::ranges::set_symmetric_difference;oneapi::dpl::ranges::set_intersection.Required behavior of these algorithms described at:
Changes:
_PSTL_LIBCPP_RANGE_SET_BROKENworkaround macro that was addressing a now-resolved bug: this is correct because now we have our own serial implementations for range-based set algorithms and our own checkers in tests.The main idea
std::uint8_ttype: the size of this buffer is equal to the sum of both input range sizes;__set_union_construct,__set_intersection_construct,__set_difference_constructand__set_symmetric_difference_constructwe fill this mask:range1and in therange2by calculate prefix sum in these masks and than processing data on the position corresponded with the output range size.(this idea was designed together with @akukanov)
STD_RANGES_SET_INTERSECTION_BROKEN_FOR_HETERO_POLICYbroken test macro to avoid test forstd::ranges::set_intersectionwith hetero policy due the proper logic not implemented for this algorithm for now.