Skip to content

Commit 5155bf9

Browse files
authored
[SYCL] Make kernel impl non copyable and non movable. (#2050)
This change deletes the copy constructor and move constructor from the kernel impl classes. 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. Signed-off-by: sarathnandu <[email protected]>
1 parent 1b9f026 commit 5155bf9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sycl/source/detail/kernel_impl.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ class kernel_impl {
6262
/// \param ProgramImpl is a valid instance of program_impl
6363
kernel_impl(ContextImplPtr Context, ProgramImplPtr ProgramImpl);
6464

65+
// This section means the object is non-movable and non-copyable
66+
// There is no need of move and copy constructors in kernel_impl.
67+
// If they need to be added, piKernelRetain method for MKernel
68+
// should be present.
69+
kernel_impl(const kernel_impl &) = delete;
70+
kernel_impl(kernel_impl &&) = delete;
71+
kernel_impl &operator=(const kernel_impl &) = delete;
72+
kernel_impl &operator=(kernel_impl &&) = delete;
73+
6574
~kernel_impl();
6675

6776
/// Gets a valid OpenCL kernel handle

0 commit comments

Comments
 (0)