-
Notifications
You must be signed in to change notification settings - Fork 777
[SYCL] Reuse user ptr in buffer & fix default memory allocation #243
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
Conversation
@@ -21,7 +21,7 @@ class queue; | |||
template <int dimensions> class range; | |||
|
|||
template <typename T, int dimensions = 1, | |||
typename AllocatorT = cl::sycl::buffer_allocator> | |||
typename AllocatorT = cl::sycl::detail::aligned_allocator<T>> |
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.
align with 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.
align with specification
Spec is incorrect at this point. buffer_allocator must be a template class for various of reasons, but it's not. The issue will be created, but for now I would stay with the approach made by Sergey.
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.
So, what I mean, I would approve the change unless Alexey hasn't strong objections of doing so.
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.
No objections to approve the patch from me.
Resolved conflicts. |
The type is not defined by the SYCL spec. Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Treat the argument as the number of objects instead of bytes. Fix rounding up to the next multiple of alignment to avoid allocating memory for an extra object. Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Align the allocated memory in aligned_allocator by max(64, sizeof(T). Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Use the type-specific aligned_allocator<T> for buffer host memory allocation instead of the non-template buffer_allocator (which is aligned_allocator<char>). Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
Reuse the pointer provided by the user in the buffer constructor (even if use_host_ptr wasn't specified) if its alignment is sufficient. Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
64ed221
to
3625a7b
Compare
No description provided.