diff --git a/src/include/kompute/Algorithm.hpp b/src/include/kompute/Algorithm.hpp index e6fd0f36..beabcf2f 100644 --- a/src/include/kompute/Algorithm.hpp +++ b/src/include/kompute/Algorithm.hpp @@ -136,6 +136,16 @@ class Algorithm this->createPipeline(); } + /** + * @brief Make Algorithm uncopyable + * + */ + Algorithm(const Algorithm&) = delete; + Algorithm(const Algorithm&&) = delete; + Algorithm& operator=(const Algorithm&) = delete; + Algorithm& operator=(const Algorithm&&) = delete; + + /** * Destructor for Algorithm which is responsible for freeing and desroying * respective pipelines and owned parameter groups. diff --git a/src/include/kompute/Image.hpp b/src/include/kompute/Image.hpp index 1525c4c4..d254149e 100644 --- a/src/include/kompute/Image.hpp +++ b/src/include/kompute/Image.hpp @@ -164,6 +164,16 @@ class Image : public Memory { } + + /** + * @brief Make Image uncopyable + * + */ + Image(const Image&) = delete; + Image(const Image&&) = delete; + Image& operator=(const Image&) = delete; + Image& operator=(const Image&&) = delete; + /** * Destructor which is in charge of freeing vulkan resources unless they * have been provided externally. diff --git a/src/include/kompute/Manager.hpp b/src/include/kompute/Manager.hpp index 097f6971..8d50ba9a 100644 --- a/src/include/kompute/Manager.hpp +++ b/src/include/kompute/Manager.hpp @@ -50,6 +50,16 @@ class Manager std::shared_ptr physicalDevice, std::shared_ptr device); + + /** + * @brief Make Manager uncopyable + * + */ + Manager(const Manager&) = delete; + Manager(const Manager&&) = delete; + Manager& operator=(const Manager&) = delete; + Manager& operator=(const Manager&&) = delete; + /** * Manager destructor which would ensure all owned resources are destroyed * unless explicitly stated that resources should not be destroyed or freed. diff --git a/src/include/kompute/Memory.hpp b/src/include/kompute/Memory.hpp index f179e352..eb93e57f 100644 --- a/src/include/kompute/Memory.hpp +++ b/src/include/kompute/Memory.hpp @@ -63,6 +63,16 @@ class Memory uint32_t x, uint32_t y); + + /** + * @brief Make Memory uncopyable + * + */ + Memory(const Memory&) = delete; + Memory(const Memory&&) = delete; + Memory& operator=(const Memory&) = delete; + Memory& operator=(const Memory&&) = delete; + /** * Destructor which is in charge of freeing vulkan resources unless they * have been provided externally. diff --git a/src/include/kompute/Sequence.hpp b/src/include/kompute/Sequence.hpp index e250e246..ba0e90e6 100644 --- a/src/include/kompute/Sequence.hpp +++ b/src/include/kompute/Sequence.hpp @@ -29,6 +29,16 @@ class Sequence : public std::enable_shared_from_this std::shared_ptr computeQueue, uint32_t queueIndex, uint32_t totalTimestamps = 0) noexcept; + + /** + * @brief Make Sequence uncopyable + * + */ + Sequence(const Sequence&) = delete; + Sequence(const Sequence&&) = delete; + Sequence& operator=(const Sequence&) = delete; + Sequence& operator=(const Sequence&&) = delete; + /** * Destructor for sequence which is responsible for cleaning all subsequent * owned operations. diff --git a/src/include/kompute/Tensor.hpp b/src/include/kompute/Tensor.hpp index c8a4478f..78814e30 100644 --- a/src/include/kompute/Tensor.hpp +++ b/src/include/kompute/Tensor.hpp @@ -57,6 +57,15 @@ class Tensor : public Memory const DataTypes& dataType, const MemoryTypes& memoryType = MemoryTypes::eDevice); + /** + * @brief Make Tensor uncopyable + * + */ + Tensor(const Tensor&) = delete; + Tensor(const Tensor&&) = delete; + Tensor& operator=(const Tensor&) = delete; + Tensor& operator=(const Tensor&&) = delete; + /** * Destructor which is in charge of freeing vulkan resources unless they * have been provided externally. @@ -250,6 +259,16 @@ class TensorT : public Tensor data.size()); } + /** + * @brief Make TensorT uncopyable + * + */ + TensorT(const TensorT&) = delete; + TensorT(const TensorT&&) = delete; + TensorT& operator=(const TensorT&) = delete; + TensorT& operator=(const TensorT&&) = delete; + + ~TensorT() { KP_LOG_DEBUG("Kompute TensorT destructor"); } DataTypes dataType() { return Memory::dataType(); } diff --git a/src/include/kompute/operations/OpAlgoDispatch.hpp b/src/include/kompute/operations/OpAlgoDispatch.hpp index 89e98d29..c890bbb5 100644 --- a/src/include/kompute/operations/OpAlgoDispatch.hpp +++ b/src/include/kompute/operations/OpAlgoDispatch.hpp @@ -43,6 +43,16 @@ class OpAlgoDispatch : public OpBase } } + /** + * @brief Make OpAlgoDispatch non-copyable + * + */ + OpAlgoDispatch(const OpAlgoDispatch&) = delete; + OpAlgoDispatch(const OpAlgoDispatch&&) = delete; + OpAlgoDispatch& operator=(const OpAlgoDispatch&) = delete; + OpAlgoDispatch& operator=(const OpAlgoDispatch&&) = delete; + + /** * Default destructor, which is in charge of destroying the algorithm * components but does not destroy the underlying tensors diff --git a/src/include/kompute/operations/OpBase.hpp b/src/include/kompute/operations/OpBase.hpp index 6b3149f2..42bfa13c 100644 --- a/src/include/kompute/operations/OpBase.hpp +++ b/src/include/kompute/operations/OpBase.hpp @@ -19,6 +19,21 @@ namespace kp { class OpBase { public: + /** + * @brief Construct a new OpBase object + * + */ + OpBase() = default; + + /** + * @brief Make OpBase non-copyable + * + */ + OpBase(const OpBase&) = delete; + OpBase(const OpBase&&) = delete; + OpBase& operator=(const OpBase&) = delete; + OpBase& operator=(const OpBase&&) = delete; + /** * Default destructor for OpBase class. This OpBase destructor class should * always be called to destroy and free owned resources unless it is diff --git a/src/include/kompute/operations/OpCopy.hpp b/src/include/kompute/operations/OpCopy.hpp index e3d0b0d0..34b48b81 100644 --- a/src/include/kompute/operations/OpCopy.hpp +++ b/src/include/kompute/operations/OpCopy.hpp @@ -26,6 +26,15 @@ class OpCopy : public OpBase */ OpCopy(const std::vector>& memObjects); + /** + * @brief Make OpCopy non-copyable + * + */ + OpCopy(const OpCopy&) = delete; + OpCopy(const OpCopy&&) = delete; + OpCopy& operator=(const OpCopy&) = delete; + OpCopy& operator=(const OpCopy&&) = delete; + /** * Default destructor. This class does not manage memory so it won't be * expecting the parent to perform a release. diff --git a/src/include/kompute/operations/OpMemoryBarrier.hpp b/src/include/kompute/operations/OpMemoryBarrier.hpp index 689fca76..b0e93e3c 100644 --- a/src/include/kompute/operations/OpMemoryBarrier.hpp +++ b/src/include/kompute/operations/OpMemoryBarrier.hpp @@ -41,6 +41,15 @@ class OpMemoryBarrier : public OpBase const vk::PipelineStageFlagBits& dstStageMask, bool barrierOnPrimary = true) noexcept; + /** + * @brief Make OpMemoryBarrier non-copyable + * + */ + OpMemoryBarrier(const OpMemoryBarrier&) = delete; + OpMemoryBarrier(const OpMemoryBarrier&&) = delete; + OpMemoryBarrier& operator=(const OpMemoryBarrier&) = delete; + OpMemoryBarrier& operator=(const OpMemoryBarrier&&) = delete; + /** * Default destructor, which is in charge of destroying the reference to the * tensors and all the relevant access / stage masks created diff --git a/src/include/kompute/operations/OpMult.hpp b/src/include/kompute/operations/OpMult.hpp index 3a025054..e15d6444 100644 --- a/src/include/kompute/operations/OpMult.hpp +++ b/src/include/kompute/operations/OpMult.hpp @@ -48,6 +48,15 @@ class OpMult : public OpAlgoDispatch algorithm->rebuild<>(memObjects, spirv); } + /** + * @brief Make OpMult non-copyable + * + */ + OpMult(const OpMult&) = delete; + OpMult(const OpMult&&) = delete; + OpMult& operator=(const OpMult&) = delete; + OpMult& operator=(const OpMult&&) = delete; + /** * Default destructor, which is in charge of destroying the algorithm * components but does not destroy the underlying tensors diff --git a/src/include/kompute/operations/OpSyncDevice.hpp b/src/include/kompute/operations/OpSyncDevice.hpp index 9ef9d3f4..84f8a1a9 100644 --- a/src/include/kompute/operations/OpSyncDevice.hpp +++ b/src/include/kompute/operations/OpSyncDevice.hpp @@ -28,6 +28,16 @@ class OpSyncDevice : public OpBase */ OpSyncDevice(const std::vector>& memObjects); + /** + * @brief Make OpSyncDevice non-copyable + * + */ + OpSyncDevice(const OpSyncDevice&) = delete; + OpSyncDevice(const OpSyncDevice&&) = delete; + OpSyncDevice& operator=(const OpSyncDevice&) = delete; + OpSyncDevice& operator=(const OpSyncDevice&&) = delete; + + /** * Default destructor. This class does not manage memory so it won't be * expecting the parent to perform a release. diff --git a/src/include/kompute/operations/OpSyncLocal.hpp b/src/include/kompute/operations/OpSyncLocal.hpp index bb9d65fc..d436e53b 100644 --- a/src/include/kompute/operations/OpSyncLocal.hpp +++ b/src/include/kompute/operations/OpSyncLocal.hpp @@ -30,6 +30,15 @@ class OpSyncLocal : public OpBase */ OpSyncLocal(const std::vector>& memObjects); + /** + * @brief Make OpSyncLocal non-copyable + * + */ + OpSyncLocal(const OpSyncLocal&) = delete; + OpSyncLocal(const OpSyncLocal&&) = delete; + OpSyncLocal& operator=(const OpSyncLocal&) = delete; + OpSyncLocal& operator=(const OpSyncLocal&&) = delete; + /** * Default destructor. This class does not manage memory so it won't be * expecting the parent to perform a release.