Skip to content

Commit

Permalink
Add noexcept to all constructors to explicitly state no exception thr…
Browse files Browse the repository at this point in the history
…own #44 (#411)

* Sequence con/destructor is noexcept

Signed-off-by: Andrea Calabrese <[email protected]>
Signed-off-by: Andrea Calabrese <[email protected]>

* Operations are noexcept

Signed-off-by: Andrea Calabrese <[email protected]>
Signed-off-by: Andrea Calabrese <[email protected]>

* Algorithm is noexcept

Signed-off-by: Andrea Calabrese <[email protected]>
Signed-off-by: Andrea Calabrese <[email protected]>

---------

Signed-off-by: Andrea Calabrese <[email protected]>
Signed-off-by: Andrea Calabrese <[email protected]>
  • Loading branch information
ThePseudo authored Feb 11, 2025
1 parent 48c127d commit 11c0b99
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace kp {

Algorithm::~Algorithm()
Algorithm::~Algorithm() noexcept
{
KP_LOG_DEBUG("Kompute Algorithm Destructor started");

Expand Down
2 changes: 1 addition & 1 deletion src/OpAlgoDispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace kp {

OpAlgoDispatch::~OpAlgoDispatch()
OpAlgoDispatch::~OpAlgoDispatch() noexcept
{
KP_LOG_DEBUG("Kompute OpAlgoDispatch destructor started");

Expand Down
2 changes: 1 addition & 1 deletion src/OpCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ OpCopy::OpCopy(const std::vector<std::shared_ptr<Memory>>& memObjects)
this->mMemObjects = memObjects;
}

OpCopy::~OpCopy()
OpCopy::~OpCopy() noexcept
{
KP_LOG_DEBUG("Kompute OpCopy destructor started");
}
Expand Down
4 changes: 2 additions & 2 deletions src/OpMemoryBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OpMemoryBarrier::OpMemoryBarrier(
const vk::AccessFlagBits& dstAccessMask,
const vk::PipelineStageFlagBits& srcStageMask,
const vk::PipelineStageFlagBits& dstStageMask,
bool barrierOnPrimary)
bool barrierOnPrimary) noexcept
: mSrcAccessMask(srcAccessMask)
, mDstAccessMask(dstAccessMask)
, mSrcStageMask(srcStageMask)
Expand All @@ -21,7 +21,7 @@ OpMemoryBarrier::OpMemoryBarrier(
KP_LOG_DEBUG("Kompute OpMemoryBarrier constructor");
}

OpMemoryBarrier::~OpMemoryBarrier()
OpMemoryBarrier::~OpMemoryBarrier() noexcept
{
KP_LOG_DEBUG("Kompute OpMemoryBarrier destructor started");
}
Expand Down
2 changes: 1 addition & 1 deletion src/OpSyncDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ OpSyncDevice::OpSyncDevice(
this->mMemObjects = memObjects;
}

OpSyncDevice::~OpSyncDevice()
OpSyncDevice::~OpSyncDevice() noexcept
{
KP_LOG_DEBUG("Kompute OpSyncDevice destructor started");

Expand Down
2 changes: 1 addition & 1 deletion src/OpSyncLocal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ OpSyncLocal::OpSyncLocal(const std::vector<std::shared_ptr<Memory>>& memObjects)
this->mMemObjects = memObjects;
}

OpSyncLocal::~OpSyncLocal()
OpSyncLocal::~OpSyncLocal() noexcept
{
KP_LOG_DEBUG("Kompute OpSyncLocal destructor started");
}
Expand Down
4 changes: 2 additions & 2 deletions src/Sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Sequence::Sequence(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
std::shared_ptr<vk::Device> device,
std::shared_ptr<vk::Queue> computeQueue,
uint32_t queueIndex,
uint32_t totalTimestamps)
uint32_t totalTimestamps) noexcept
{
KP_LOG_DEBUG("Kompute Sequence Constructor with existing device & queue");

Expand All @@ -25,7 +25,7 @@ Sequence::Sequence(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
1); //+1 for the first one
}

Sequence::~Sequence()
Sequence::~Sequence() noexcept
{
KP_LOG_DEBUG("Kompute Sequence Destructor started");

Expand Down
4 changes: 2 additions & 2 deletions src/include/kompute/Algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Algorithm
const std::vector<uint32_t>& spirv = {},
const Workgroup& workgroup = {},
const std::vector<S>& specializationConstants = {},
const std::vector<P>& pushConstants = {})
const std::vector<P>& pushConstants = {}) noexcept
{
KP_LOG_DEBUG("Kompute Algorithm Constructor with device");

Expand Down Expand Up @@ -140,7 +140,7 @@ class Algorithm
* Destructor for Algorithm which is responsible for freeing and desroying
* respective pipelines and owned parameter groups.
*/
~Algorithm();
~Algorithm() noexcept;

/**
* Records the dispatch function with the provided template parameters or
Expand Down
4 changes: 2 additions & 2 deletions src/include/kompute/Sequence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Sequence : public std::enable_shared_from_this<Sequence>
std::shared_ptr<vk::Device> device,
std::shared_ptr<vk::Queue> computeQueue,
uint32_t queueIndex,
uint32_t totalTimestamps = 0);
uint32_t totalTimestamps = 0) noexcept;
/**
* Destructor for sequence which is responsible for cleaning all subsequent
* owned operations.
*/
~Sequence();
~Sequence() noexcept;

/**
* Record function for operation to be added to the GPU queue in batch. This
Expand Down
4 changes: 2 additions & 2 deletions src/include/kompute/operations/OpAlgoDispatch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class OpAlgoDispatch : public OpBase
*/
template<typename T = float>
OpAlgoDispatch(const std::shared_ptr<kp::Algorithm>& algorithm,
const std::vector<T>& pushConstants = {})
const std::vector<T>& pushConstants = {}) noexcept
{
KP_LOG_DEBUG("Kompute OpAlgoDispatch constructor");

Expand All @@ -47,7 +47,7 @@ class OpAlgoDispatch : public OpBase
* Default destructor, which is in charge of destroying the algorithm
* components but does not destroy the underlying tensors
*/
virtual ~OpAlgoDispatch() override;
virtual ~OpAlgoDispatch() noexcept override;

/**
* This records the commands that are to be sent to the GPU. This includes
Expand Down
2 changes: 1 addition & 1 deletion src/include/kompute/operations/OpBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class OpBase
* always be called to destroy and free owned resources unless it is
* intended to destroy the resources in the parent class.
*/
virtual ~OpBase() { KP_LOG_DEBUG("Kompute OpBase destructor started"); }
virtual ~OpBase() noexcept { KP_LOG_DEBUG("Kompute OpBase destructor started"); }

/**
* The record function is intended to only send a record command or run
Expand Down
2 changes: 1 addition & 1 deletion src/include/kompute/operations/OpCopy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class OpCopy : public OpBase
* Default destructor. This class does not manage memory so it won't be
* expecting the parent to perform a release.
*/
~OpCopy() override;
~OpCopy() noexcept override;

/**
* Records the copy commands from the first memory object into all the other
Expand Down
2 changes: 1 addition & 1 deletion src/include/kompute/operations/OpMemoryBarrier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class OpMemoryBarrier : public OpBase
const vk::AccessFlagBits& dstAccessMask,
const vk::PipelineStageFlagBits& srcStageMask,
const vk::PipelineStageFlagBits& dstStageMask,
bool barrierOnPrimary = true);
bool barrierOnPrimary = true) noexcept;

/**
* Default destructor, which is in charge of destroying the reference to the
Expand Down
2 changes: 1 addition & 1 deletion src/include/kompute/operations/OpMult.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class OpMult : public OpAlgoDispatch
* Default destructor, which is in charge of destroying the algorithm
* components but does not destroy the underlying tensors
*/
~OpMult() override { KP_LOG_DEBUG("Kompute OpMult destructor started"); }
~OpMult() noexcept override { KP_LOG_DEBUG("Kompute OpMult destructor started"); }
};

} // End namespace kp
2 changes: 1 addition & 1 deletion src/include/kompute/operations/OpSyncDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class OpSyncDevice : public OpBase
* Default destructor. This class does not manage memory so it won't be
* expecting the parent to perform a release.
*/
~OpSyncDevice() override;
~OpSyncDevice() noexcept override;

/**
* For device memory objects, it records the copy command for the memory
Expand Down
2 changes: 1 addition & 1 deletion src/include/kompute/operations/OpSyncLocal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class OpSyncLocal : public OpBase
* Default destructor. This class does not manage memory so it won't be
* expecting the parent to perform a release.
*/
~OpSyncLocal() override;
~OpSyncLocal() noexcept override;

/**
* For device memory objects, it records the copy command for the tensor to
Expand Down

0 comments on commit 11c0b99

Please sign in to comment.