Skip to content

[SYCL] Make kernel impl non copyable and non movable. #2050

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 3 commits into from
Jul 22, 2020

Conversation

sarathnandu
Copy link
Contributor

This change delete the copy constructor and move constructor
from the kernel impl classes.

Signed-off-by: sarathnandu [email protected]

@sarathnandu sarathnandu requested a review from a team as a code owner July 6, 2020 20:04
@sarathnandu sarathnandu requested a review from v-klochkov July 6, 2020 20:04
@v-klochkov
Copy link
Contributor

Hi, what is the motivation for this change? Why kernel_impl must not be copied/moved? Thanks.

@sarathnandu
Copy link
Contributor Author

The destructor for the kernel_impl class assumes that the proper constructor is called. If the object was created using a default copy constructor, it would call the destructor which expected the complementary PI_CALL in the constructor.

Comment on lines 150 to 151
// This section means the object is non-movable and non-copyable
kernel_impl(const kernel_impl &) = delete;
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest 2 things:

  1. to move this section to the place right after the kernel_impl constructors declarations
  2. to add a simple comment explaining why they are non-movable. For example:
Suggested change
// This section means the object is non-movable and non-copyable
kernel_impl(const kernel_impl &) = delete;
// There is no need in move and copy constructors.
// If they are even needed they must call piKernelRetain method for MKernel.
kernel_impl(const kernel_impl &) = delete;

sarathnandu added 2 commits July 16, 2020 08:46
This change delete the copy constructor and move constructor
from the kernel impl classes.

Signed-off-by: sarathnandu <[email protected]>
Signed-off-by: sarathnandu <[email protected]>
@bader bader merged commit 5155bf9 into intel:sycl Jul 22, 2020
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.

3 participants