From 03688bc5b2f63859fc5fee5450d28b972c14285f Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sat, 22 Aug 2020 11:21:34 +0100 Subject: [PATCH] Working descriptorset creation cycle --- src/Algorithm.cpp | 3 --- src/OpMult.cpp | 11 +++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Algorithm.cpp b/src/Algorithm.cpp index eb6b5786d..75faab7e0 100644 --- a/src/Algorithm.cpp +++ b/src/Algorithm.cpp @@ -90,9 +90,6 @@ void Algorithm::createParameters(std::vector>& tensorPar this->mDescriptorSetLayout.get()); SPDLOG_DEBUG("Kompute Algorithm allocating descriptor sets"); - std::vector descriptorSets = - this->mDevice->allocateDescriptorSets(descriptorSetAllocateInfo); - this->mDescriptorSet = std::make_shared(); this->mDevice->allocateDescriptorSets(&descriptorSetAllocateInfo, this->mDescriptorSet.get()); diff --git a/src/OpMult.cpp b/src/OpMult.cpp index 13949374d..19414d1bd 100644 --- a/src/OpMult.cpp +++ b/src/OpMult.cpp @@ -36,16 +36,22 @@ OpMult::init(std::vector> tensors) throw std::runtime_error( "Kompute OpMult called with less than 1 tensor"); } else if (tensors.size() > 3) { - spdlog::warn("Kompute OpMult called with more than 2 tensor"); + spdlog::warn("Kompute OpMult called with more than 3 tensors"); } this->mTensorLHS = tensors[0]; this->mTensorRHS = tensors[1]; this->mTensorOutput = tensors[2]; - this->mTensorOutputStaging= std::make_shared( + if (!(this->mTensorLHS->isInit() && this->mTensorRHS->isInit() && this->mTensorOutput->isInit())) { + throw std::runtime_error("Kompute OpMult all tensor parameters must be initialised. LHS: " + std::to_string(this->mTensorLHS->isInit()) + " RHS: " + std::to_string(this->mTensorRHS->isInit()) + " Output: " + std::to_string(this->mTensorOutput->isInit())); + } + + this->mTensorOutputStaging = std::make_shared( this->mTensorOutput->data(), Tensor::TensorTypes::eStaging); + this->mTensorOutputStaging->init(this->mPhysicalDevice, this->mDevice, this->mCommandBuffer, this->mTensorOutput->data()); + this->mAlgorithm->init( "shaders/glsl/computeheadless.comp.spv", tensors); } @@ -65,6 +71,7 @@ void OpMult::postSubmit() SPDLOG_DEBUG("Kompute OpCreateTensor postSubmit called"); this->mTensorOutputStaging->copyDataFromHostBuffer(); + this->mTensorOutput->setData(this->mTensorOutputStaging->data()); }