-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add more forward declarations to sycl_traits.h #1497
Conversation
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.
Should we forward declare everything what is used in that file?
For example, there are entities, which miss their declarations:
- predicates/functors defined in a block starting with
oneapi::dpl::__internal::__not_pred
zip_iterator
,transform_iterator
,permutation_iterator
That's a good question. I can certainly add forward declarations to all of the structs in this file, but I am not clear on the original design intent as it was introduced in #1394. I believe it was a design decision to only include some of the forward declarations in this file with the intent that the other structs will already be defined before including this header. With that in mind, it might be better for the original author @MikeDvorskiy to answer that question. |
Why the PR is still draft? |
@MikeDvorskiy, do you confirm that it is everything besides what is declared in "binary_search_extension_defs.h" (a single include file here)? I just what to get an explicit answer to #1497 (review) regarding addition of the forward declarations listed there. |
I really don't like the maintenance problem that #1394 presents. We discussed it back when #1394 was proposed and decided that it was the lesser of two evils to keep all these device_copyable definitions in one place rather than infect the rest of the code with device_copyable (SYCL specific) stuff. However, the problems this has presented, and the need for all the forward declarations is making me reconsider that. Would we be better off to just define the device copyable macro stuff in one place like this header or some other central header, and embed the For non-dpcpp backends, the macro could be a no-op. It would reduce our maintenance burden by not having these duplicate declarations which need to be updated anytime something is changed. It will also make it more likely that when someone adds a similar functor or type to one which requires device copyable that they realize that they may need to add the new functor or type as |
24399e2
to
5094d6d
Compare
This PR was waiting on #1496 to be merged. It is no longer a draft now. I also removed the changes to binary search so there are no longer any additional includes. |
@adamfidel I think you need to rebase / resolve conflicts to fix the diff for this PR after merging #1496. |
5094d6d
to
79dede0
Compare
@MikeDvorskiy and I discussed a couple other issues we found with device copyable, and he is working on a PR which would likely supersede this PR by embedding the "device copyable" specializations with the types themselves, rather than having them in this I've created this issue #1505 to represent that, until a PR exists. |
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.
After all investigations and prototypes made, it seems the current approach is still preferable, despite its shortcomings. Yes it's bad at maintenance, but another possible solution is not much better in this aspect and quite worse in others, and a solution which would really be better either needs to be supported by the implementation of sycl::is_device_copyable or requires C++20 concepts.
Therefore I think for now it's best to proceed with this patch.
I need to catch up on the discussion of the other approach(es), but the version we were working on also addresses 2 additional issues which were not covered by this approach. If we continue with this approach, we still need more than this PR to address the issues. Where the specializations live is a related but separate decision. I'd hold on merging this until we have a plan for all the issues we currently face.
|
That's simple - remove the macro, declare each specialization of |
@adamfidel I've created a PR targeting this PR #1520 to add some more missing fwd declarations. With those I think the list is complete. Please merge into this PR if you agree with that patch. As mentioned in that PR, I think we still need to convert to the original proposal from #1513 (This commit), to allow a subset of types to be specified, and convert to that method at least for types which require a subset. I've double checked the existing fwd declarations from this PR that they match the definition. |
Signed-off-by: Dan Hoeflinger <[email protected]>
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.
LGTM but please get a second approval since I added code here. (and wait for green CI)
I spoke with @MikeDvorskiy and we decided its best to merge this first then address the rest in a separate PR.
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.
LGTM
The kernel template tests no longer compile after #1394 due to missing forward declarations. This PR gets the tests to compile again.