-
Notifications
You must be signed in to change notification settings - Fork 115
Replace oneapi::dpl::__internal::__no_op
by oneapi::dpl::identity
#2294
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?
Conversation
This LGTM, but I think you need to rebase with main. |
@@ -18,6 +18,7 @@ | |||
|
|||
#include "../async_extension_defs.h" | |||
#include "async_impl_hetero.h" | |||
#include "oneapi/dpl/functional" // for oneapi::dpl::identity |
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 am concerned about including a public header file from internal files. As far as I can tell, there is no precedent of that yet.
Perhaps it's not an immediate problem, because now oneapi/dpl/functional
and its dependencies do not include any internal headers, Nevertheless, maybe it makes sense to move the actual implementation to an internal header, separate from the public header, and use that for internal purposes.
What do others 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.
Good point. I think it makes sense to move these functional definitions to an internal header.
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.
It's not a big deal to move this implementation into internal header.
But as far as this oneapi::dpl::identity
was public before, my understanding that it should be public after move into internal header too, in oneapi::dpl
namespace.
Correct?
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 am concerned about including a public header file from internal files. As far as I can tell, there is no precedent of that yet. Perhaps it's not an immediate problem, because now
oneapi/dpl/functional
and its dependencies do not include any internal headers, Nevertheless, maybe it makes sense to move the actual implementation to an internal header, separate from the public header, and use that for internal purposes.What do others think?
Practically we had this include before but in a little bit another form, I found: https://github.com/search?q=repo%3Auxlfoundation%2FoneDPL%20%23include%20%22..%2Ffunctional%22&type=code
Example from
#include "../../functional" |
#include "../../functional"
If we allow and prefer this form instead of #include "oneapi/dpl/functional"
I will fix my changes.
May be it's also one of options for us?
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.
maybe it makes sense to move the actual implementation to an internal header
Am I right that oneapi::dpl::identity
remains in Public API , and we are talking about the implementation moving? And in the functional public header will contain just using oneapi::dpl::__internal::identity;
? (and for the other function objects - minimum
, maximum
) ?
In that case we are breaking the spec a little bit, where it is saying "The oneDPL function objects are defined in the <oneapi/dpl/functional> header."
References:
oneDPL spec
oneDPL doc
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.
```c++ #include "../../functional"If we allow and prefer this form instead of #include "oneapi/dpl/functional" I will fix my changes.
May be it's also one of options for us?
That one "include" case is again for usage of oneapi::dpl::identity
. So, we will not need #include "../../functional"
if we decide to use a kind of oneapi::dpl::__internal::identity
.
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.
My opinion - I would prefer to save changes as is, without move our own struct identity
into some another places.
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.
Its too bad the spec was written in that way...
I think it would probably be a benefit to adjusting the spec to use language more similar to the guide, where it doesn't specify where they are defined, but rather how you can get access to them. I would be incredibly surprised if moving them to an internal namespace and using an alias broke any user code.
I'm really not sure the best course here though, I'd be interested in @akukanov opinion.
49c37ae
to
52d9b64
Compare
…o_op as unused anymore
…nctional> header from standard library: they already included through <oneapi/dpl/functional>
…entity instead of self implemented noop
…- using oneapi::dpl::identity instead of self implemented noop
099dfbb
to
9b6142d
Compare
# Conflicts: # include/oneapi/dpl/pstl/hetero/dpcpp/parallel_backend_sycl.h
# Conflicts: # test/parallel_api/iterator/input_data_sweep.h
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.
Pull Request Overview
This PR removes the internal __no_op functor and replaces its usages with the public oneapi::dpl::identity, eliminating duplicate implementations and ensuring consistent behavior across tests and library headers.
- Replace all instances of oneapi::dpl::__internal::__no_op with oneapi::dpl::identity
- Add necessary includes for functional support in affected files
- Remove the now-unused __no_op definition from utils.h
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/parallel_api/iterator/transform_iterator_constructible.pass.cpp | Updated functor typedefs and test instantiations to use oneapi::dpl::identity |
test/parallel_api/iterator/input_data_sweep.h | Added include for functional header and updated local functor usage |
test/general/interface_check.pass.cpp | Removed unused include |
include/oneapi/dpl/pstl/utils.h | Removed the __no_op struct definition |
All other updated source files | Replaced internal __no_op usages with oneapi::dpl::identity and adjusted includes accordingly |
Comments suppressed due to low confidence (3)
test/parallel_api/iterator/transform_iterator_constructible.pass.cpp:27
- [nitpick] Consider verifying that inheriting from oneapi::dpl::identity in noop_nodefault preserves the intended behavior; if custom behavior is needed, using composition rather than inheritance might be more appropriate.
struct noop_nodefault : oneapi::dpl::identity
include/oneapi/dpl/pstl/hetero/dpcpp/unseq_backend_sycl.h:27
- [nitpick] Verify that using the relative include path for the functional header remains robust across different build environments; consider using a canonical include path if available.
#include "../../../functional" // for oneapi::dpl::identity
include/oneapi/dpl/pstl/glue_numeric_impl.h:19
- [nitpick] Ensure the relative include path for the functional header adheres to the project-wide conventions to prevent future maintenance issues.
#include "../functional" // for oneapi::dpl::identity
This PR replaces the internal
__no_op
functor with the publiconeapi::dpl::identity
across tests and library headers, and removes the now-unused__no_op
definition.oneapi::dpl::__internal::__no_op
foroneapi::dpl::identity
#include <functional>
(or the library’sfunctional
) whereoneapi::dpl::identity
is used__no_op
struct fromutils.h