Updated base compile functionality

This commit is contained in:
Alejandro Saucedo 2020-08-19 06:56:39 +01:00
parent 150e986982
commit 62d614b29f
3 changed files with 49 additions and 33 deletions

View file

@ -4,32 +4,30 @@
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG
#endif
#include <spdlog/spdlog.h>
#include "BaseOp.hpp"
namespace kp {
template<class T>
BaseOp<T>::BaseOp()
{}
template<class T>
BaseOp<T>::BaseOp(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
std::shared_ptr<vk::Device> device,
std::shared_ptr<vk::CommandBuffer> commandBuffer)
{
SPDLOG_DEBUG("Compute BaseOp constructor started");
this->mPhysicalDevice = physicalDevice;
this->mDevice = device;
this->mCommandBuffer = commandBuffer;
}
template<class T>
BaseOp<T>::~BaseOp()
{
SPDLOG_DEBUG("Compute BaseOp destructor started");
}
}
//namespace kp {
//
//template<class T>
//BaseOp<T>::BaseOp()
//{}
//
//template<class T>
//BaseOp<T>::BaseOp(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
// std::shared_ptr<vk::Device> device,
// std::shared_ptr<vk::CommandBuffer> commandBuffer)
//{
// SPDLOG_DEBUG("Compute BaseOp constructor started");
//
// this->mPhysicalDevice = physicalDevice;
// this->mDevice = device;
// this->mCommandBuffer = commandBuffer;
//}
//
//template<class T>
//BaseOp<T>::~BaseOp()
//{
// SPDLOG_DEBUG("Compute BaseOp destructor started");
//}
//
//}

View file

@ -19,11 +19,22 @@ class BaseOp
{
private:
public:
BaseOp();
BaseOp() {}
BaseOp(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
std::shared_ptr<vk::Device> device,
std::shared_ptr<vk::CommandBuffer> commandBuffer);
virtual ~BaseOp();
std::shared_ptr<vk::CommandBuffer> commandBuffer) {
SPDLOG_DEBUG("Compute BaseOp constructor started");
this->mPhysicalDevice = physicalDevice;
this->mDevice = device;
this->mCommandBuffer = commandBuffer;
}
~BaseOp()
{
SPDLOG_DEBUG("Compute BaseOp destructor started");
}
template<typename... TArgs>
void init(TArgs&&... args)
@ -46,3 +57,4 @@ class BaseOp
};
} // End namespace kp

View file

@ -5,23 +5,27 @@
namespace kp {
OpCreateTensor::OpCreateTensor() {}
OpCreateTensor::OpCreateTensor() {
SPDLOG_DEBUG("Kompute OpCreateTensor constructor base");
}
OpCreateTensor::OpCreateTensor(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
std::shared_ptr<vk::Device> device,
std::shared_ptr<vk::CommandBuffer> commandBuffer)
: BaseOp(physicalDevice, device, commandBuffer)
{
SPDLOG_DEBUG("Kompute OpCreateTensor constructor with params");
}
OpCreateTensor::~OpCreateTensor() {
SPDLOG_DEBUG("Kompute OpCreateTensor destructor started");
}
void
OpCreateTensor::init(std::shared_ptr<Tensor> tensor, std::vector<uint32_t> data)
{
SPDLOG_DEBUG("Kompute OpCreateTensor init called");
this->mPrimaryTensor = tensor;
if (tensor->tensorType() == Tensor::TensorTypes::eDevice) {
@ -40,6 +44,8 @@ OpCreateTensor::init(std::shared_ptr<Tensor> tensor, std::vector<uint32_t> data)
void
OpCreateTensor::record()
{
SPDLOG_DEBUG("Kompute OpCreateTensor record called");
if (this->mPrimaryTensor->tensorType() == Tensor::TensorTypes::eDevice) {
this->mPrimaryTensor->recordCopyFrom(this->mStagingTensor);
}