From 4b9584b1da62ed468ecb02ee434c5cdd90971afc Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Wed, 13 Nov 2024 13:36:32 -0800 Subject: [PATCH 1/5] Follow rule of three in sycl headers --- sycl/include/sycl/detail/common.hpp | 2 ++ sycl/include/sycl/detail/util.hpp | 2 ++ sycl/include/sycl/ext/intel/experimental/pipes.hpp | 4 ++-- sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp | 3 +++ sycl/include/sycl/ext/oneapi/experimental/cuda/barrier.hpp | 1 + 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sycl/include/sycl/detail/common.hpp b/sycl/include/sycl/detail/common.hpp index bde3d96f32356..81436edd8b6c8 100644 --- a/sycl/include/sycl/detail/common.hpp +++ b/sycl/include/sycl/detail/common.hpp @@ -131,6 +131,8 @@ class __SYCL_EXPORT tls_code_loc_t { /// @details If a previous populated TLS entry exists, this constructor will /// capture the informationa and allow you to query the information later. tls_code_loc_t(); + tls_code_loc_t(const tls_code_loc_t &TLSCodeLoc) = default; + tls_code_loc_t &operator=(const tls_code_loc_t &TLSCodeLoc) = default; /// @brief Iniitializes TLS with CodeLoc if a TLS entry not present /// @param CodeLoc The code location information to set up the TLS slot with. tls_code_loc_t(const detail::code_location &CodeLoc); diff --git a/sycl/include/sycl/detail/util.hpp b/sycl/include/sycl/detail/util.hpp index d858aba279f41..b8928c4c076e6 100644 --- a/sycl/include/sycl/detail/util.hpp +++ b/sycl/include/sycl/detail/util.hpp @@ -42,6 +42,8 @@ template struct TempAssignGuard { TempAssignGuard(T &fld, T tempVal) : field(fld), restoreValue(fld) { field = tempVal; } + TempAssignGuard(const TempAssignGuard &) = delete; + TempAssignGuard operator=(const TempAssignGuard &) = delete; ~TempAssignGuard() { field = restoreValue; } }; diff --git a/sycl/include/sycl/ext/intel/experimental/pipes.hpp b/sycl/include/sycl/ext/intel/experimental/pipes.hpp index 3311d7cd66e07..9555e8a609a3b 100644 --- a/sycl/include/sycl/ext/intel/experimental/pipes.hpp +++ b/sycl/include/sycl/ext/intel/experimental/pipes.hpp @@ -43,8 +43,8 @@ namespace experimental { class pipe_base { protected: - pipe_base(); - ~pipe_base(); + pipe_base() = default; + ~pipe_base() = default; __SYCL_EXPORT static std::string get_pipe_name(const void *HostPipePtr); __SYCL_EXPORT static bool wait_non_blocking(const event &E); diff --git a/sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp b/sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp index fa5cf7d396871..3dcd558945de1 100644 --- a/sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp +++ b/sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp @@ -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; } diff --git a/sycl/include/sycl/ext/oneapi/experimental/cuda/barrier.hpp b/sycl/include/sycl/ext/oneapi/experimental/cuda/barrier.hpp index 0bc63859bb579..4c473fb88a8f1 100644 --- a/sycl/include/sycl/ext/oneapi/experimental/cuda/barrier.hpp +++ b/sycl/include/sycl/ext/oneapi/experimental/cuda/barrier.hpp @@ -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; void initialize(uint32_t expected_count) { #ifdef __SYCL_DEVICE_ONLY__ From 570661a32d3644084613b13d4c230cdcf64291da Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Mon, 18 Nov 2024 14:01:45 -0800 Subject: [PATCH 2/5] clang format --- sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp b/sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp index 3dcd558945de1..da3e254036baa 100644 --- a/sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp +++ b/sycl/include/sycl/ext/oneapi/bindless_images_memory.hpp @@ -39,8 +39,8 @@ 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; + 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; } From 44ae82aebd8aed2f2fb87474a8719aff9b837a1d Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Tue, 19 Nov 2024 06:05:36 -0800 Subject: [PATCH 3/5] delete copy constructor for `tls_code_loc_t` --- sycl/include/sycl/detail/common.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sycl/include/sycl/detail/common.hpp b/sycl/include/sycl/detail/common.hpp index 81436edd8b6c8..965d9ba58e28e 100644 --- a/sycl/include/sycl/detail/common.hpp +++ b/sycl/include/sycl/detail/common.hpp @@ -131,11 +131,12 @@ class __SYCL_EXPORT tls_code_loc_t { /// @details If a previous populated TLS entry exists, this constructor will /// capture the informationa and allow you to query the information later. tls_code_loc_t(); - tls_code_loc_t(const tls_code_loc_t &TLSCodeLoc) = default; - tls_code_loc_t &operator=(const tls_code_loc_t &TLSCodeLoc) = default; /// @brief Iniitializes TLS with CodeLoc if a TLS entry not present /// @param CodeLoc The code location information to set up the TLS slot with. tls_code_loc_t(const detail::code_location &CodeLoc); + // Used to maintain global state, so we do not want to copy + tls_code_loc_t(const tls_code_loc_t &) = delete; + tls_code_loc_t &operator=(const tls_code_loc_t &) = delete; /// If the code location is set up by this instance, reset it. ~tls_code_loc_t(); /// @brief Query the information in the TLS slot From 434ad03a3ffc197d4a4aff081a9356ed33e36b78 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Tue, 19 Nov 2024 08:50:16 -0800 Subject: [PATCH 4/5] Replace deletion of copy constructor with comment --- sycl/include/sycl/detail/common.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sycl/include/sycl/detail/common.hpp b/sycl/include/sycl/detail/common.hpp index 965d9ba58e28e..35b0ed6c657ce 100644 --- a/sycl/include/sycl/detail/common.hpp +++ b/sycl/include/sycl/detail/common.hpp @@ -134,9 +134,11 @@ class __SYCL_EXPORT tls_code_loc_t { /// @brief Iniitializes TLS with CodeLoc if a TLS entry not present /// @param CodeLoc The code location information to set up the TLS slot with. tls_code_loc_t(const detail::code_location &CodeLoc); - // Used to maintain global state, so we do not want to copy - tls_code_loc_t(const tls_code_loc_t &) = delete; - tls_code_loc_t &operator=(const tls_code_loc_t &) = delete; + + // TODO: delete copy constructor and copy assignment operator during next + // ABI breaking window + // Used to maintain global state (GCodeLocTLS), so we do not want to copy + /// If the code location is set up by this instance, reset it. ~tls_code_loc_t(); /// @brief Query the information in the TLS slot From 1f9120cc17c96cb8cc7194bba76418c3cd196555 Mon Sep 17 00:00:00 2001 From: "Garcia Orozco, David" Date: Wed, 20 Nov 2024 06:17:28 -0800 Subject: [PATCH 5/5] delete copy ctor inside preview breaking changes --- sycl/include/sycl/detail/common.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sycl/include/sycl/detail/common.hpp b/sycl/include/sycl/detail/common.hpp index 35b0ed6c657ce..19f4d85ab30d3 100644 --- a/sycl/include/sycl/detail/common.hpp +++ b/sycl/include/sycl/detail/common.hpp @@ -135,9 +135,11 @@ class __SYCL_EXPORT tls_code_loc_t { /// @param CodeLoc The code location information to set up the TLS slot with. tls_code_loc_t(const detail::code_location &CodeLoc); - // TODO: delete copy constructor and copy assignment operator during next - // ABI breaking window +#ifdef __INTEL_PREVIEW_BREAKING_CHANGES // Used to maintain global state (GCodeLocTLS), so we do not want to copy + tls_code_loc_t(const tls_code_loc_t &) = delete; + tls_code_loc_t &operator=(const tls_code_loc_t &) = delete; +#endif // __INTEL_PREVIEW_BREAKING_CHANGES /// If the code location is set up by this instance, reset it. ~tls_code_loc_t();