From 0d3cdac8ea1bf63da95711fd16e0c934e6003f20 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EA=B9=80=EC=9A=A9=EC=84=AD/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 25 Jul 2019 17:33:03 +0900 Subject: [PATCH] [neurun] Append preVisit and postVisit to ITensorBuilder (#5879) Append preVisit and postVisit to ITensorBuilder for #5642 Signed-off-by: Yongseop Kim --- runtimes/neurun/backend/acl_common/TemplTensorBuilder.h | 7 +++++-- runtimes/neurun/backend/cpu/TensorBuilder.h | 7 ++++--- runtimes/neurun/core/include/backend/ITensorBuilder.h | 11 +++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/runtimes/neurun/backend/acl_common/TemplTensorBuilder.h b/runtimes/neurun/backend/acl_common/TemplTensorBuilder.h index 3da55cb..c0160d7e 100644 --- a/runtimes/neurun/backend/acl_common/TemplTensorBuilder.h +++ b/runtimes/neurun/backend/acl_common/TemplTensorBuilder.h @@ -67,12 +67,15 @@ public: std::shared_ptr wrapTensor(const model::OperandIndex &ind) override; void iterate(const IterateFunction &fn) override; + // TODO Fill these and remember that these will be for the linear executor for a while + void preVisit(const model::Operation &) override {} + void postVisit(const model::Operation &) override {} + + // TODO Consider removing after #5642 fixes void registerModelObject(const model::OperandIndex &ind, const model::Operand &obj) override; void markConstant(const model::OperandIndex &ind) override; bool isConstant(const model::OperandIndex &ind) override; - void deallocateConstants(void) override; - void notifyFirstUseIf(const model::OperandIndex &ind) override; void notifyLastUseIf(const model::OperandIndex &ind) override; diff --git a/runtimes/neurun/backend/cpu/TensorBuilder.h b/runtimes/neurun/backend/cpu/TensorBuilder.h index 87c3a63..463cbd6 100644 --- a/runtimes/neurun/backend/cpu/TensorBuilder.h +++ b/runtimes/neurun/backend/cpu/TensorBuilder.h @@ -68,13 +68,14 @@ public: void iterate(const IterateFunction &fn) override; + void preVisit(const model::Operation &) override {} + void postVisit(const model::Operation &) override {} + + // TODO Consider removing after #5642 fixes void registerModelObject(const model::OperandIndex &ind, const model::Operand &obj) override; void markConstant(const model::OperandIndex &ind) override; bool isConstant(const model::OperandIndex &ind) override; - void deallocateConstants(void) override; - - // Only act on the linear executor on acl void notifyFirstUseIf(const model::OperandIndex &) override; void notifyLastUseIf(const model::OperandIndex &) override; diff --git a/runtimes/neurun/core/include/backend/ITensorBuilder.h b/runtimes/neurun/core/include/backend/ITensorBuilder.h index cc5427c..f2650b1 100644 --- a/runtimes/neurun/core/include/backend/ITensorBuilder.h +++ b/runtimes/neurun/core/include/backend/ITensorBuilder.h @@ -21,10 +21,11 @@ #include "model/Index.h" #include "model/OperandInfo.h" +#include "model/Operation.h" +#include "model/Layout.h" #include "operand/IObject.h" -#include "compiler/SubTensorInfo.h" #include "operand/ITensor.h" -#include "model/Layout.h" +#include "compiler/SubTensorInfo.h" #include "IMemoryManager.h" namespace neurun @@ -61,12 +62,14 @@ struct ITensorBuilder virtual std::shared_ptr wrapTensor(const model::OperandIndex &ind) = 0; virtual void iterate(const IterateFunction &fn) = 0; + virtual void preVisit(const model::Operation &) = 0; + virtual void postVisit(const model::Operation &) = 0; + + // TODO Consider removing after #5642 fixes virtual void registerModelObject(const model::OperandIndex &, const model::Operand &) = 0; virtual void markConstant(const model::OperandIndex &) = 0; virtual bool isConstant(const model::OperandIndex &) = 0; - virtual void deallocateConstants(void) = 0; - virtual void notifyFirstUseIf(const model::OperandIndex &) = 0; virtual void notifyLastUseIf(const model::OperandIndex &) = 0; -- 2.7.4