virtual void allocate(void) override
{
- VERBOSE(AclLinearMemoryManager) << "allocate" << std::endl;
-
_allocator = std::make_shared<T_Allocator>();
_internal_manager->populate(*_allocator, 1);
_io_manager->populate(*_allocator, 1);
virtual void deallocate(void) override
{
- VERBOSE(AclLinearMemoryManager) << "deallocate" << std::endl;
-
_io_group->release();
_io_manager->clear();
_internal_manager->clear();
virtual void startLifetime(const model::OperandIndex &ind) override
{
- VERBOSE(AclLinearMemoryManager) << "startLifetime for tensor #" << ind.value() << std::endl;
-
auto &tensors = this->tensors();
assert(tensors.find(ind) != tensors.end());
assert(tensor->handle());
_io_group->manage(tensor->handle());
-
- _lifetime_done.insert({ind, false});
}
virtual void finishLifetime(const model::OperandIndex &ind) override
{
- VERBOSE(AclLinearMemoryManager) << "finishLifetime for tensor #" << ind.value() << std::endl;
-
auto &tensors = this->tensors();
assert(tensors.find(ind) != tensors.end());
assert(tensor->allocator());
tensor->allocator()->allocate();
-
- _lifetime_done.at(ind) = true;
}
virtual std::shared_ptr<::arm_compute::IMemoryManager> internal_buffer_manager() override
std::shared_ptr<T_MemoryManager> _io_manager;
std::shared_ptr<T_MemoryGroup> _io_group;
std::shared_ptr<T_MemoryManager> _internal_manager;
- model::OperandIndexMap<bool> _lifetime_done;
};
} // namespace acl_common
model::OperandIndexMap<std::shared_ptr<T_Object>> _objects;
};
-// TODO Replace this with AclLinearMemoryManager
-template <typename T_Tensor, typename T_SubTensor, typename T_Object>
-class LinearAclMemoryManager : public AclMemoryManager<T_Tensor, T_SubTensor, T_Object>
-{
- // void allocate(void) override { }
- // void deallocate(void) override { }
- void startLifetime(const model::OperandIndex &) override {}
- void finishLifetime(const model::OperandIndex &) override {}
- std::shared_ptr<::arm_compute::IMemoryManager> internal_buffer_manager() override
- {
- return nullptr;
- }
-};
-
} // namespace acl_common
} // namespace backend
} // namespace neurun