-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Move buffer_impl and image_impl to the source directory #6600
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
[SYCL] Move buffer_impl and image_impl to the source directory #6600
Conversation
The patch moves impl parts of buffer and image classes to the library to give more freedom to modify their contents without breaking ABI. To achieve this the patch: 1. Introduces buffer_plain and image_plain as a base classes for buffer and image respectively in order to introduce non-template proxy which can access impl parts. 2. Introduces initialization and finalization callbacks which are passed from headers to the library for the cases when source or destination heavily depends on the template parameters. 3. Adds several private methods which are accessed by "friend" classes.
Expect at list windows symbols check test to fail. |
Please, let me know if it makes to split it to 2 PRs: one which introduces *_plain classes and another which does the move. |
Also removed a couple of "remove when ABI break is possible" related functions to avoid writing new in N-weeks dead code for them. |
Likely more for my education than anything else - why do we need both I think some outline of the design and interactions in the docs/comments would be of great help. |
We have a separation for runtime classes: impl part and "wrapper/face" part. Wrapper part implements public SYCL API(including reference semantic) and usually contains just a pointer to the impl part only. This was not the case for the buffer and image. We haven't done this initially due to template nature of these classes - we cannot write an implementation of a template method of a template class, where template parameters can be custom user types, in the .cpp files. This patch tries to resolve this issue by introducing "plain"/non-templated base classes for them, so original templated classes can redirect all the calls to these base classes. |
I'm still not sure about that answer
Why can't we call the whole box an impl and make it a single class? Maybe it's not exactly what "impl" means in implementations of other classes, but still. What is the purpose of separating plain from impl? |
Probably I do not fully understand the idea
Not sure I understand the proposal. The idea is that Consider we have this in public headers:
How can we write an implementation of the |
So the answer to my question is this: We need to separate interface and implementation of the That actually suggests what an alternative approach might be:
|
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
Just in case. Please do not merge so far. |
This reverts commit ad5c57c.
|
||
template <typename DataT> | ||
using EnableIfOutputIteratorT = detail::enable_if_t< | ||
/*is_output_iterator<DataT>::value &&*/ !std::is_pointer<DataT>::value>; |
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 the commented-out conjunction there because of the TODO or can they be removed?
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.
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!
#6600 changed behavior of sycl::image::get_size() to return number of elements rather than number of bytes which an image uses. This is not correct. Changing it back and ename the internal method so it's more clear about what it returns.
The patch moves impl parts of buffer and image classes to the library to
give more freedom to modify their contents without breaking ABI.
To achieve this the patch:
and image respectively in order to introduce non-template proxy which
can access impl parts.
from headers to the library for the cases when source or destination
heavily depends on the template parameters.