Skip to content

[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

Merged
merged 5 commits into from
Jun 25, 2019

Conversation

sergey-semenov
Copy link
Contributor

No description provided.

romanovvlad
romanovvlad previously approved these changes Jun 24, 2019
@sergey-semenov sergey-semenov changed the title [SYCL] Reuse user ptr to host data in buffer constructors [SYCL] Reuse user ptr in buffer & fix default memory allocation Jun 24, 2019
@@ -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>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

align with specification

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

@bader bader Jun 25, 2019

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.

@sergey-semenov
Copy link
Contributor Author

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>
@sergey-semenov sergey-semenov force-pushed the reuseptr branch 4 times, most recently from 64ed221 to 3625a7b Compare June 25, 2019 12:23
@romanovvlad romanovvlad self-assigned this Jun 25, 2019
@MrSidims MrSidims self-requested a review June 25, 2019 15:36
@romanovvlad romanovvlad merged commit 83bb79e into intel:sycl Jun 25, 2019
sergey-semenov added a commit to sergey-semenov/llvm that referenced this pull request Jun 27, 2019
…on (intel#243)"

This reverts commit 83bb79e. It
introduced multiple Khronos CTS failures.

Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
romanovvlad pushed a commit that referenced this pull request Jun 27, 2019
…on (#243)"

This reverts commit 83bb79e. It
introduced multiple Khronos CTS failures.

Signed-off-by: Sergey Semenov <sergey.semenov@intel.com>
@sergey-semenov sergey-semenov deleted the reuseptr branch June 27, 2019 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants