-
Notifications
You must be signed in to change notification settings - Fork 798
[SYCL] Follow rule of three in sycl headers #16080
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
Changes from 1 commit
4b9584b
570661a
44ae82a
434ad03
1f9120c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,8 @@ template <typename T> struct TempAssignGuard { | |
| TempAssignGuard(T &fld, T tempVal) : field(fld), restoreValue(fld) { | ||
| field = tempVal; | ||
| } | ||
| TempAssignGuard(const TempAssignGuard<T> &) = delete; | ||
| TempAssignGuard operator=(const TempAssignGuard<T> &) = delete; | ||
|
Comment on lines
+45
to
+46
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whole point of this class is to use the constructor to temporary assign a value. Since the copy assignment/copy constructor cant take an extra assignment for the temp value to assign these functions are not useful. |
||
| ~TempAssignGuard() { field = restoreValue; } | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,8 @@ namespace experimental { | |
| class pipe_base { | ||
|
|
||
| protected: | ||
| pipe_base(); | ||
| ~pipe_base(); | ||
| pipe_base() = default; | ||
| ~pipe_base() = default; | ||
|
Comment on lines
+46
to
+47
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exists so derived classes can instantiate pipe_base, so just marking as default explicitly. |
||
|
|
||
| __SYCL_EXPORT static std::string get_pipe_name(const void *HostPipePtr); | ||
| __SYCL_EXPORT static bool wait_non_blocking(const event &E); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,9 @@ class image_mem_impl { | |
| const context &syclContext); | ||
| __SYCL_EXPORT ~image_mem_impl(); | ||
|
|
||
| image_mem_impl(const image_mem_impl&) = delete; | ||
| image_mem_impl& operator=(const image_mem_impl&) = delete; | ||
|
||
|
|
||
| raw_handle_type get_handle() const { return handle; } | ||
| const image_descriptor &get_descriptor() const { return descriptor; } | ||
| sycl::device get_device() const { return syclDevice; } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ class barrier { | |
| barrier(barrier &&other) noexcept = delete; | ||
| barrier &operator=(const barrier &other) = delete; | ||
| barrier &operator=(barrier &&other) noexcept = delete; | ||
| ~barrier() = default; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this class only has a state member variable, so the default destructor should be fine. |
||
|
|
||
| void initialize(uint32_t expected_count) { | ||
| #ifdef __SYCL_DEVICE_ONLY__ | ||
|
|
||
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.
This class just has the
MLocalScopemember variable, so default works fine hereThere 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.
I think this should be
deleteinstead. One of the main jobs oftls_code_loc_tis to maintain the global state inGCodeLocTLS. If we copy object, we could end up with the copy resetting the global state before the top-level copy of it.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.
ok, fixed in the latest commit