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.
[oneDPL] Indirectly Device Accessible Iterator Customization Point and Public Trait #620
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
base: main
Are you sure you want to change the base?
[oneDPL] Indirectly Device Accessible Iterator Customization Point and Public Trait #620
Changes from 14 commits
d90682b
24b879d
ff940e8
0c0804b
8cff3e4
a36a006
cb102cb
bc32ce2
e7ffb99
913d555
29e209f
180a500
a852f0f
41b9828
96b1b45
dd71fdf
21b8d0f
7c76593
250aed2
696d925
b250e77
8928a06
1fff43d
59c147a
0fe3101
1d44b35
a918a45
25edb0b
b4aeaf0
4967f43
583fd52
b8a6018
311f2cb
8676878
ef67c3d
0f64be0
780f501
a57c7d7
6114c2c
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 sentence sounds a bit awkward to me. ADL last letter already means lookup. Also, "valid search locations" is a sort of unusual. How about this:
You may leave this part, if you think it's useful: "... , which includes the
namespace of the definition of the iterator type
IteratorT
" but it also might be removed, I think. They choice is yours.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.
Taken, I removed the second part. It doesn't really make sense after the edit. Its more something for the documentation than the spec.
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.
Is it ever a case?
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 practice, with a good amount of certainty with some compilers, yes. However, its a good question if its worth mentioning in the specification, since it is not always knowable (and not 100% knowable I believe).
uxlfoundation/oneDPL#1438 (comment)
uxlfoundation/oneDPL#1438 (comment)
How it looks in the oneDPL's implementation currently:
https://github.com/uxlfoundation/oneDPL/blob/1625f6a2dcc981a537c65fdc3b40951cb63b7326/include/oneapi/dpl/pstl/hetero/dpcpp/sycl_iterator.h#L154-L179
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.
Think of that as of specification, not as of documentation.
If we want to require that
std::vector
with USM allocators is used without excessive copying, then it is a part of the spec. Otherwise, it can be mentioned as an implementation-specific or completely omitted.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 practice, oneDPL's implementation is relying upon standard library implementation details which are not part of the C++ standard library specification of
std::vector::iterator
to enable handling of usm allocator vector iterators when it can confidently guess that the allocator type is knowable from the iterator type. From purely the C++ standard specification, I don't think it is possible to definitively know anything about the allocator from the type of astd::vector::iterator
.In practice, it would be quite unlikely that a standard library implementation could / would have a
std::vector::iterator
type which "tricks" the current oneDPL implementation's detection of a knowable "USM shared allocator", but I do think you could technically contrive such an implementation if you really wanted to.From a specification perspective, it doesn't belong, I think.
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've removed the line for now, but I'm open to discussion of course.
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.
Yeah, if we speak about
Allocator
we should write an iterator type slightly differently:std::vector<T, Allocator>::iterator
.As you can see
Allocator
is a part of specializedvector
type, not aniterator
type. I don't know a way in C++ do deduce a outer type by inner type: in this concrete example: deducevector<T, Allocator>
type from nestediterator
typeThere 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.
If we re-introduce something like this, we can describe it with
std::vector<T,Allocator>::iterator
, but I think its not a requirement that makes a lot of sense in the specification, because I don't can't be achieved for a generic implementation of the standard library with 100% certainty.