-
Notifications
You must be signed in to change notification settings - Fork 113
[oneDPL] Add memory parallel range algorithms #631
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
dmitriy-sobolev
wants to merge
14
commits into
uxlfoundation:main
Choose a base branch
from
dmitriy-sobolev:add-range-memory-algorithms
base: main
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.
+82
−1
Open
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bbed8e1
[oneDPL] Add memory parallel range algorithms
dmitriy-sobolev a4516c2
Add a note about destroy and noexcept
dmitriy-sobolev b69247a
Keep only nothrow-random-access-range and its semantic requirements
dmitriy-sobolev 8ccc7ed
Fix formatting
dmitriy-sobolev 8323daa
Add more details about destroy and noexcept
dmitriy-sobolev 1316e0f
range_reference_t -> range_rvalue_reference_t
dmitriy-sobolev f3d2408
Extract iterators in nothrow-random-access-range
dmitriy-sobolev ceffff7
Formatting
dmitriy-sobolev 25a162c
Remove std::sized_sentinel_for
dmitriy-sobolev 2ceea7e
Compare added destroy with serial interface
dmitriy-sobolev 4ae1b0b
Apply some suggestions from code review
dmitriy-sobolev 4e0f1e7
Shorten long signatures lines
dmitriy-sobolev 01087a3
Simplify nothrow* concept
dmitriy-sobolev ee35282
Simplify nothrow* concept - fix
dmitriy-sobolev 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 |
---|---|---|
|
@@ -33,6 +33,7 @@ The following differences to the standard C++ range algorithms apply: | |
In that case, the returned value contains iterators pointing to the positions past the last elements | ||
processed according to the algorithm semantics. | ||
- ``for_each`` does not return its function object. | ||
- ``destroy`` is not marked with ``noexcept``. | ||
|
||
Except for these differences, the signatures of parallel range algorithms correspond to the working draft | ||
of the next edition of the C++ standard (C++26). | ||
|
@@ -46,9 +47,22 @@ of parallel range algorithms. | |
.. code:: cpp | ||
// C++20 analogue of std::projected_value_t; exposition only | ||
template<typename I, typename Proj> | ||
template <typename I, typename Proj> | ||
using /*projected-value-type*/ = std::remove_cvref_t<std::invoke_result_t<Proj&, std::iter_value_t<I>&>>; | ||
// C++20 analogue of nothrow-random-access-range in the C++26 working draft; exposition only | ||
// Semantic requirements are listed further below | ||
template <typename R> | ||
concept nothrow-random-access-range = | ||
std::ranges::random_access_range<R> && | ||
std::is_lvalue_reference_v<std::iter_reference_t<std::ranges::iterator_t<R>>> && | ||
std::same_as<std::remove_cvref_t<std::iter_reference_t<std::ranges::iterator_t<R>>>, | ||
std::iter_value_t<std::ranges::iterator_t<R>>>; | ||
A type ``R`` models ``nothrow-random-access-range`` if no exceptions are thrown from | ||
any operation on an object of type ``std::ranges::iterator_t<R>`` | ||
required by the ``std::random_access_iterator`` concept. | ||
|
||
Whole Sequence Operations | ||
+++++++++++++++++++++++++ | ||
|
||
|
@@ -526,5 +540,69 @@ In-place Mutating Operations | |
} | ||
Uninitialized Memory Algorithms | ||
+++++++++++++++++++++++++++++++ | ||
|
||
.. code:: cpp | ||
// Defined in <oneapi/dpl/memory> | ||
namespace oneapi::dpl::ranges { | ||
// uninitialized_default_construct | ||
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R> | ||
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> && | ||
std::ranges::sized_range<R> && | ||
std::default_initializable<std::ranges::range_value_t<R>> | ||
std::ranges::borrowed_iterator_t<R> | ||
uninitialized_default_construct (ExecutionPolicy&& pol, R&& r); | ||
// uninitialized_value_construct | ||
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R> | ||
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> && | ||
std::ranges::sized_range<R> && | ||
std::default_initializable<std::ranges::range_value_t<R>> | ||
std::ranges::borrowed_iterator_t<R> | ||
uninitialized_value_construct (ExecutionPolicy&& pol, R&& r); | ||
// uninitialized_copy | ||
template <typename ExecutionPolicy, std::random_access_range IR, | ||
/*nothrow-random-access-range*/ OR> | ||
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> && | ||
std::ranges::sized_range<IR> && std::ranges::sized_range<OR> && | ||
std::constructible_from<std::ranges::range_value_t<OR>, | ||
std::ranges::range_reference_t<IR>> | ||
std::ranges::uninitialized_copy_result<std::ranges::borrowed_iterator_t<IR>, | ||
std::ranges::borrowed_iterator_t<OR>> | ||
uninitialized_copy (ExecutionPolicy&& pol, IR&& in_range, OR&& out_range); | ||
// uninitialized_move | ||
template <typename ExecutionPolicy, std::ranges::random_access_range IR, | ||
/*nothrow-random-access-range*/ OR> | ||
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> && | ||
std::ranges::sized_range<IR> && std::ranges::sized_range<OR> && | ||
std::constructible_from<std::ranges::range_value_t<OR>, | ||
std::ranges::range_rvalue_reference_t<IR>> | ||
std::ranges::uninitialized_move_result<std::ranges::borrowed_iterator_t<IR>, | ||
std::ranges::borrowed_iterator_t<OR>> | ||
uninitialized_move (ExecutionPolicy&& pol, IR&& in_range, OR&& out_range); | ||
// uninitialized_fill | ||
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R, typename T> | ||
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> && | ||
std::ranges::sized_range<R> && | ||
std::constructible_from<std::ranges::range_value_t<R>, const T&> | ||
std::ranges::borrowed_iterator_t<R> | ||
uninitialized_fill (ExecutionPolicy&& pol, R&& r, const T& value); | ||
Comment on lines
+593
to
+599
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For |
||
// destroy | ||
template <typename ExecutionPolicy, /*nothrow-random-access-range*/ R> | ||
requires oneapi::dpl::is_execution_policy_v<std::remove_cvref_t<ExecutionPolicy>> && | ||
std::ranges::sized_range<R> && | ||
std::destructible<std::ranges::range_value_t<R>> | ||
std::ranges::borrowed_iterator_t<R> | ||
destroy (ExecutionPolicy&& pol, R&& r); | ||
akukanov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
.. _`C++ Standard`: https://isocpp.org/std/the-standard | ||
.. _`SYCL`: https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html |
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.
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.
why did we decide to "copy" this concept instead of
nothrow-sized-random-access-range
?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 think for consistency with the other signatures, where
sized_range
comes underrequires
clauses.