Skip to content
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

[onedpl][ranges][productization] Range API productization, MVP plan, Part 2 #1471

Merged
merged 379 commits into from
Sep 4, 2024

Conversation

MikeDvorskiy
Copy link
Contributor

@MikeDvorskiy MikeDvorskiy commented Mar 28, 2024

[onedpl][ranges][productization] Range API productization, MVP plan, Part 2: count, count_if, equal, is_sorted, sort, stable_sort, min_element, max_element, copy, copy_if, merge.

@MikeDvorskiy MikeDvorskiy marked this pull request as draft March 28, 2024 15:07
@MikeDvorskiy MikeDvorskiy changed the base branch from main to dev/mdvorski/std_ranges_support_mvp March 28, 2024 15:07
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch 2 times, most recently from b35c967 to c081adf Compare April 3, 2024 13:35
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp branch from dac7c2a to 5d60dee Compare April 4, 2024 13:19
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch 2 times, most recently from 18e86e4 to 1502c28 Compare April 4, 2024 13:35
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp branch from 1ffbab0 to 87b43a3 Compare April 5, 2024 14:36
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch 2 times, most recently from 5cfde5d to 946e7aa Compare April 5, 2024 14:40
@MikeDvorskiy MikeDvorskiy marked this pull request as ready for review April 5, 2024 14:41
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch from 946e7aa to a403829 Compare April 5, 2024 16:18
@MikeDvorskiy MikeDvorskiy added this to the 2022.6.0 milestone Apr 8, 2024
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp branch from c199049 to 0f656ba Compare April 8, 2024 16:46
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch from a403829 to f79d560 Compare April 8, 2024 16:46
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp branch from 0f656ba to fbe0434 Compare April 12, 2024 12:41
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch 2 times, most recently from 18a81d5 to 8ea5db8 Compare April 12, 2024 14:48
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp branch from 72e28c8 to 850b408 Compare April 15, 2024 10:44
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch from 8ea5db8 to 4e8aa56 Compare April 15, 2024 10:45
@ValentinaKats ValentinaKats modified the milestones: 2022.6.0, 2022.7.0 Apr 15, 2024
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp branch from 850b408 to 212af8f Compare May 7, 2024 15:42
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch from 4e8aa56 to b968c95 Compare May 7, 2024 15:42
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp branch from 212af8f to 153c036 Compare May 17, 2024 12:47
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch from b968c95 to 1b60415 Compare May 17, 2024 12:48
@MikeDvorskiy MikeDvorskiy force-pushed the dev/mdvorski/std_ranges_support_mvp branch from 106fe1b to 4baf3c6 Compare May 22, 2024 09:13
@dmitriy-sobolev dmitriy-sobolev force-pushed the dev/mdvorski/std_ranges_support_mvp branch from cb43237 to f6aaaa4 Compare September 1, 2024 11:40
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
@dmitriy-sobolev dmitriy-sobolev force-pushed the dev/mdvorski/std_ranges_support_mvp2 branch from 59fa835 to c942acc Compare September 1, 2024 16:02
dmitriy-sobolev and others added 2 commits September 1, 2024 11:30
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
@dmitriy-sobolev
Copy link
Contributor

dmitriy-sobolev commented Sep 1, 2024

I've found that the tests for ranges fail for clang++14 when using libstdc++. This issue llvm/llvm-project#52696 looks the same. Basing on the reproducer from the issue, it affects clang++15 and older. I was not about to find a workaround after a quick look.

With libc++ I got this issue:

/oneDPL/test/parallel_api/ranges/std_ranges_transform.pass.cpp:77:28: error: use of undeclared identifier '__cpp_lib_ranges'
    return TestUtils::done(_ENABLE_STD_RANGES_TESTING);
                           ^
/oneDPL/test/support/test_config.h:120:36: note: expanded from macro '_ENABLE_STD_RANGES_TESTING'
#define _ENABLE_STD_RANGES_TESTING _ONEDPL_CPP20_RANGES_PRESENT
                                   ^
/oneDPL/include/oneapi/dpl/internal/../pstl/onedpl_config.h:307:43: note: expanded from macro '_ONEDPL_CPP20_RANGES_PRESENT'
#    define _ONEDPL_CPP20_RANGES_PRESENT (__cpp_lib_ranges >= 201911L)

This definitely should be fixable.

Upd. the first issue is related to the fact that clang++15 and older do not support range adapters. Reproducer: https://godbolt.org/z/hqd9qrfch. I've turned off the ranges with these compilers in MVP1.

Upd. the second issue is fixed in MVP1

@@ -652,6 +757,19 @@ __pattern_sort(__hetero_tag<_BackendTag>, _ExecutionPolicy&& __exec, _Range&& __
.__deferrable_wait();
}

#if _ONEDPL_CPP20_RANGES_PRESENT
template <typename _BackendTag, typename _ExecutionPolicy, typename _R, typename _Proj, typename _Comp>
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor suggestion: align template parameter order with the function argument order.

Suggested change
template <typename _BackendTag, typename _ExecutionPolicy, typename _R, typename _Proj, typename _Comp>
template <typename _BackendTag, typename _ExecutionPolicy, typename _R, typename _Comp, typename _Proj>

Comment on lines 346 to 347
oneapi::dpl::__internal::__pattern_sort(__tag, std::forward<_ExecutionPolicy>(__exec), std::ranges::begin(__r),
std::ranges::begin(__r) + std::ranges::size(__r), __comp_2);
Copy link
Contributor

@dmitriy-sobolev dmitriy-sobolev Sep 3, 2024

Choose a reason for hiding this comment

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

We need separate patterns for std::ranges::sort due to std::indirectly_swappable requirement, which implies the use of std::ranges::iter_swap, which can be customized externally.

oneapi::dpl::__internal::__pattern_sort will use std::sort as a brick, which uses std::sort as a brick instead of std::range::sort.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've added such patterns in this patch:
add_sort_ranges_patterns.patch

@rarutyun, lets discuss whether we want to include this patch in this PR or not.

Copy link
Contributor

@dmitriy-sobolev dmitriy-sobolev Sep 3, 2024

Choose a reason for hiding this comment

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

I've created a branch containing these changes: #1815

Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Signed-off-by: Dmitriy Sobolev <dmitriy.sobolev@intel.com>
Base automatically changed from dev/mdvorski/std_ranges_support_mvp to main September 3, 2024 21:23
Copy link
Contributor

@rarutyun rarutyun left a comment

Choose a reason for hiding this comment

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

Assuming the CI (except clang-format) is green I am totally for merging this PR. There might be some small improvements/fixes before code freeze but we definitely don't have enough time to make any significant improvements

@rarutyun rarutyun merged commit 594a758 into main Sep 4, 2024
21 of 22 checks passed
@rarutyun rarutyun deleted the dev/mdvorski/std_ranges_support_mvp2 branch September 4, 2024 06:01
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.

6 participants