Initial base set of tests aligned with new interface

This commit is contained in:
Alejandro Saucedo 2021-02-25 23:09:54 +00:00
parent 6378583a23
commit fb617d1722
16 changed files with 908 additions and 1071 deletions

View file

@ -23,7 +23,7 @@ Sequence::~Sequence()
{
KP_LOG_DEBUG("Kompute Sequence Destructor started");
this->freeMemoryDestroyGPUResources();
this->destroy();
}
void
@ -112,6 +112,15 @@ Sequence::evalAsync()
return shared_from_this();
}
std::shared_ptr<Sequence>
Sequence::evalAsync(std::shared_ptr<OpBase> op)
{
this->clear();
this->record(op);
this->evalAsync();
return shared_from_this();
}
std::shared_ptr<Sequence>
Sequence::evalAwait(uint64_t waitFor)
{
@ -162,10 +171,10 @@ Sequence::isInit() {
void
Sequence::destroy()
{
KP_LOG_DEBUG("Kompute Sequence freeMemoryDestroyGPUResources called");
KP_LOG_DEBUG("Kompute Sequence destroy called");
if (!this->mDevice) {
KP_LOG_ERROR("Kompute Sequence freeMemoryDestroyGPUResources called "
KP_LOG_ERROR("Kompute Sequence destroy called "
"with null Device pointer");
return;
}
@ -174,7 +183,7 @@ Sequence::destroy()
KP_LOG_INFO("Freeing CommandBuffer");
if (!this->mCommandBuffer) {
KP_LOG_ERROR(
"Kompute Sequence freeMemoryDestroyGPUResources called with null "
"Kompute Sequence destroy called with null "
"CommandPool pointer");
return;
}
@ -191,7 +200,7 @@ Sequence::destroy()
KP_LOG_INFO("Destroying CommandPool");
if (this->mCommandPool == nullptr) {
KP_LOG_ERROR(
"Kompute Sequence freeMemoryDestroyGPUResources called with null "
"Kompute Sequence destroy called with null "
"CommandPool pointer");
return;
}

View file

@ -23,7 +23,7 @@ Tensor::~Tensor()
KP_LOG_DEBUG("Kompute Tensor destructor started. Type: {}",
this->tensorType());
this->freeMemoryDestroyGPUResources();
this->destroy();
KP_LOG_DEBUG("Kompute Tensor destructor success");
}
@ -40,7 +40,7 @@ Tensor::rebuild(const std::vector<float>& data,
if (this->mPrimaryBuffer || this->mPrimaryMemory) {
KP_LOG_DEBUG("Kompute Tensor destroying existing resources before rebuild");
this->freeMemoryDestroyGPUResources();
this->destroy();
}
this->allocateMemoryCreateGPUResources();
@ -440,7 +440,7 @@ Tensor::allocateBindMemory(std::shared_ptr<vk::Buffer> buffer,
void
Tensor::destroy()
{
KP_LOG_DEBUG("Kompute Tensor started freeMemoryDestroyGPUResources()");
KP_LOG_DEBUG("Kompute Tensor started destroy()");
if (!this->mDevice) {
KP_LOG_ERROR(
@ -508,7 +508,7 @@ Tensor::destroy()
this->mDevice = nullptr;
}
KP_LOG_DEBUG("Kompute Tensor successful freeMemoryDestroyGPUResources()");
KP_LOG_DEBUG("Kompute Tensor successful destroy()");
}
}

View file

@ -138,6 +138,7 @@ class Sequence: public std::enable_shared_from_this<Sequence>
* @return Boolean stating whether execution was successful.
*/
std::shared_ptr<Sequence> evalAsync();
std::shared_ptr<Sequence> evalAsync(std::shared_ptr<OpBase> op);
/**
* Eval sends all the recorded and stored operations in the vector of

View file

@ -33,7 +33,7 @@ class OpMult : public OpAlgoDispatch
* @param komputeWorkgroup Optional parameter to specify the layout for processing
*/
OpMult(std::vector<std::shared_ptr<Tensor>> tensors, std::shared_ptr<Algorithm> algorithm)
: OpAlgoDispatch(tensors, algorithm)
: OpAlgoDispatch(algorithm)
{
KP_LOG_DEBUG("Kompute OpMult constructor with params");
@ -46,7 +46,7 @@ class OpMult : public OpAlgoDispatch
(uint32_t*)(shader_data::shaders_glsl_opmult_comp_spv +
kp::shader_data::shaders_glsl_opmult_comp_spv_len));
algorithm->rebuild(tensors, spirv, Workgroup({tensors[0]->size()}));
algorithm->rebuild(tensors, spirv);
}
/**