Added baseline functionality including new memory models

This commit is contained in:
Alejandro Saucedo 2021-02-24 22:26:02 +00:00
parent 9aae5d69db
commit 635fdb02be
22 changed files with 283 additions and 1919 deletions

View file

@ -3,42 +3,21 @@
namespace kp {
OpTensorCopy::OpTensorCopy(std::vector<std::shared_ptr<Tensor>> tensors)
: OpBase(tensors, nullptr)
OpTensorCopy::OpTensorCopy(const std::vector<std::shared_ptr<Tensor>>& tensors)
{
KP_LOG_DEBUG("Kompute OpTensorCopy constructor with params");
this->mManagesTensors = false;
this->mManagesAlgorithm = false;
}
OpTensorCopy::~OpTensorCopy()
{
KP_LOG_DEBUG("Kompute OpTensorCopy destructor started");
}
void
OpTensorCopy::init(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
std::shared_ptr<vk::Device> device)
{
KP_LOG_DEBUG("Kompute OpTensorCopy init called");
if (this->mTensors.size() < 2) {
throw std::runtime_error(
"Kompute OpTensorCopy called with less than 2 tensor");
}
for (std::shared_ptr<Tensor> tensor : this->mTensors) {
if (!tensor->isInit()) {
throw std::runtime_error(
"Kompute OpTensorCopy tensor parameter has not been initialized");
}
if (tensor->tensorType() == Tensor::TensorTypes::eStorage) {
throw std::runtime_error("Kompute OpTensorCopy tensor parameter is "
"of TensorTypes::eStorage and hence "
"cannot be used to receive or pass data.");
}
}
this->mTensors = tensors;
}
OpTensorCopy::~OpTensorCopy()
{
KP_LOG_DEBUG("Kompute OpTensorCopy destructor started");
}
void