Added logic to clean memory on operations
This commit is contained in:
parent
fbe5947a19
commit
4e2ef636c9
8 changed files with 94 additions and 35 deletions
|
|
@ -18,7 +18,7 @@ class Manager
|
|||
|
||||
~Manager();
|
||||
|
||||
Sequence constructSequence();
|
||||
std::weak_ptr<Sequence> managedSequence();
|
||||
|
||||
template<typename T, typename... TArgs>
|
||||
void evalOp(std::vector<std::shared_ptr<Tensor>> tensors)
|
||||
|
|
@ -49,6 +49,9 @@ class Manager
|
|||
uint32_t mComputeQueueFamilyIndex = -1;
|
||||
std::shared_ptr<vk::Queue> mComputeQueue = nullptr;
|
||||
|
||||
// Always owned resources
|
||||
std::vector<std::shared_ptr<Sequence>> mManagedSequences;
|
||||
|
||||
#if DEBUG
|
||||
vk::DebugReportCallbackEXT mDebugReportCallback;
|
||||
vk::DispatchLoaderDynamic mDebugDispatcher;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ class OpCreateTensor : public OpBase
|
|||
|
||||
private:
|
||||
std::shared_ptr<Tensor> mPrimaryTensor;
|
||||
bool mFreePrimaryTensorResources = false;
|
||||
std::shared_ptr<Tensor> mStagingTensor;
|
||||
bool mFreeStagingTensorResources = false;
|
||||
};
|
||||
|
||||
} // End namespace kp
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ class Tensor
|
|||
// Create functions
|
||||
void createBuffer();
|
||||
|
||||
// Destroy/Free functions
|
||||
void freeMemoryDestroyGPUResources();
|
||||
|
||||
// Getter functions
|
||||
std::vector<uint32_t> data();
|
||||
uint32_t size();
|
||||
|
|
@ -54,6 +57,7 @@ class Tensor
|
|||
void mapDataFromHostMemory();
|
||||
void mapDataIntoHostMemory();
|
||||
|
||||
|
||||
private:
|
||||
std::shared_ptr<vk::PhysicalDevice> mPhysicalDevice;
|
||||
std::shared_ptr<vk::Device> mDevice;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue