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.
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
RFC for zip_view implementation, for oneDPL C++20 #1931
base: main
Are you sure you want to change the base?
RFC for zip_view implementation, for oneDPL C++20 #1931
Changes from 13 commits
09bd199
b56c860
761ecb7
7ef15f4
e792b5b
786d5c5
171e5fe
f9a2e45
4a701fc
cc3eac4
52acfac
526a603
518aee0
234dbdb
c20ef9f
aec760b
9ab570b
300e13c
f51297e
4cade93
7b882fb
2e9c98d
214dcde
1f7b132
720f1d2
416010b
28aed7e
1ce2407
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This is how cppreference describes the category for
std::ranges::zip_view
:Do we want the same adaptive behavior, or do we want to require all the base ranges to be random access ranges?
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.
In my understanding our intention was to provide
zip_view
like adaptor (for C++20), which "works (is pipeable)" with C++20 ranges/views and can be passed into oneDPL algorithms, because existingexperimental::zip_view
"doesn't work (is not pipeable)" with C++20 ranges/views.As far as https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3179r2.html tells that only random access ranges are accepted for range based oneDPL algorithm, I think we want to support
zip_view
only forrandom_access_range
- to require all the base ranges to be random access ranges.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.
OK, so there is no intent to make it adaptable to different range categories and usable more widely. It needs to be clear in the documentation & specification.
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.
And we should also think of implications. If our
zip_view
cannot be used with ranges that are not random access, could it make developers hesitant to use it, possibly impacting oneDPL usage?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.
In my understanding the proposed
zip_view
is just to use with oneDPL parallel algorithms, which accept just RA ranges. The goal was not addingzip_view
for C++20 which works with any type ranges (like C++23std::zip_view
)If developers don't hesitant to use oneDPL RA Range based parallel algorithms, the don't hesitant to use the proposed RA
zip_view
as well.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 same question here: do we require base views to be device copyable, or do we say that the
zip_view
is device copyable if the base views are?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.
yes, "a device copyable view itself" - is not clear and the sentence should be rephrased.
Yes, we say that the zip_view is device copyable if the base views are.
The following sentence guarantees that:
"To provide a device copyability requirement
oneapi::dpl::__internal::tuple
is proposed as tuple-like type underhood."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.
OK. Please adjust the text to make the intent clear.
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.
done
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.
When it comes to the specification, this will need to be described as an unspecified tuple which satisfies some set of requirements, unless we want to make the move to specify our internal tuple and make it public (which I doubt we want to do).
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.
In the context of this, I was looking at the specification for our current
zip_iterator
, and noticed a couple of discrepancies as compared to our implementation with regard to std::tuple vs our unspecified internal tuple type. I believe that our implementation is intentional and the "correct" thing here and the spec should be changed, because of issues with device copyability when composing types fromzip_iterators
.std::tuple
is not trivially copyable but our internal tuple is.uxlfoundation/oneAPI-spec#605
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.
What amount of testing would be necessary to ensure the API compliance with
std::ranges::zip_view
, stated as a requirement?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 to have at least one call of each method of
oneapi::dpl::ranges::zip_view
with result checking is quite enough.As an additional test coverage we may consider to take LLVM tests for
std::ranges::zip_view
, if it is technically possible by C++23/C++20 reasons.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.
Talking about "the API compliance with std::ranges::zip_view". I mean the public methods and types are equivalent at least for underlying random sized ranges: ones are callable and result the same. And also pipeable feature is supported.
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.
Would we want a test which requires c++23 and uses
std::ranges::zip_view
itself as the ground truth here?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 guess - No, we don't. We rely on
std::ranges::zip_view
is tested within C++ standard library good enough.But we may add some test cases with oneDPL algo calls with
std::ranges::zip_view
C++23.