Skip to content

Add proper bounded output support to set-algorithms from oneapi::dpl::ranges namespace with CPU policies#2569

Open
SergeyKopienko wants to merge 727 commits intomainfrom
dev/skopienko/serial-set_fresh_to_dev
Open

Add proper bounded output support to set-algorithms from oneapi::dpl::ranges namespace with CPU policies#2569
SergeyKopienko wants to merge 727 commits intomainfrom
dev/skopienko/serial-set_fresh_to_dev

Conversation

@SergeyKopienko
Copy link
Copy Markdown
Contributor

@SergeyKopienko SergeyKopienko commented Jan 30, 2026

This PR adds support for bounded output ranges in range-based set algorithms for the seq, par, unseq and par_unseq execution 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:

  • 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++ _PSTL_LIBCPP_RANGE_SET_BROKEN workaround 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

  • introducing separate mask buffer of std::uint8_t type: the size of this buffer is equal to the sum of both input range sizes;
  • in the each of __set_union_construct, __set_intersection_construct, __set_difference_construct and __set_symmetric_difference_construct we fill this mask:
enum class __parallel_set_op_mask : std::uint8_t
{
    eNone = 0x00,    // initial state
    eData1 = 0x01,   // mask for first input data item usage
    eData2 = 0x02,   // mask for second input data item usage
    eDataOut = 0x04, // mask for output data item usage

   //...
};
  • in the cases when output range is less than expected size for this specified algorithm, we calculate result positions of iterators in the range1 and in the range2 by 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)
  • also added STD_RANGES_SET_INTERSECTION_BROKEN_FOR_HETERO_POLICY broken test macro to avoid test for std::ranges::set_intersection with hetero policy due the proper logic not implemented for this algorithm for now.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/serial-set_fresh_to_dev branch from 7611a17 to 48e8b25 Compare January 30, 2026 16:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/serial-set_fresh_to_dev branch 3 times, most recently from fac271b to c2d06d9 Compare January 30, 2026 17:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@SergeyKopienko SergeyKopienko changed the title Support of bounded output ranges for range-based set algorithms + host policies Add proper bounded output support to 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 Feb 2, 2026
@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/serial-set_fresh_to_dev branch from b177063 to 3ff4c96 Compare February 3, 2026 11:52
@SergeyKopienko SergeyKopienko force-pushed the dev/skopienko/serial-set_fresh_to_dev branch from bf30e36 to dda021c Compare March 5, 2026 18:30
@timmiesmith timmiesmith modified the milestones: 2022.12.0, 2022.13.0 Mar 5, 2026
…ce test_set_difference_checker() function to check and demonstrate current oneapi::dpl::ranges::set_difference logic
…duce test_set_intersection_checker() function to check and demonstrate current oneapi::dpl::ranges::set_intersection logic
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants