From 926b3abd42a17243f9711122dba43aeb33e1d651 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Tue, 14 Aug 2018 16:44:36 +0900 Subject: [PATCH] [coco] Pass ObjectLink to Op/Instr Manager (#1002) This commit revises Op/Instr manager to take ObjectLink as an arugment of their constructor. Note that this link is not used, yet. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/InstrManager.h | 9 +++++++-- contrib/coco/core/include/coco/IR/OpManager.h | 6 +++++- contrib/coco/core/src/IR/Instr.test.cpp | 2 +- contrib/coco/core/src/IR/InstrManager.test.cpp | 3 ++- contrib/coco/core/src/IR/Module.cpp | 5 +++-- contrib/coco/core/src/IR/OpManager.cpp | 3 ++- contrib/coco/core/src/IR/OpManager.test.cpp | 3 ++- 7 files changed, 22 insertions(+), 9 deletions(-) diff --git a/contrib/coco/core/include/coco/IR/InstrManager.h b/contrib/coco/core/include/coco/IR/InstrManager.h index 87a3f36..919d6e0 100644 --- a/contrib/coco/core/include/coco/IR/InstrManager.h +++ b/contrib/coco/core/include/coco/IR/InstrManager.h @@ -4,6 +4,9 @@ #include "coco/IR/Instr.h" #include "coco/IR/Op.forward.h" +#include "coco/IR/Object.forward.h" +#include "coco/IR/ObjectInfo.forward.h" + #include "coco/ADT/PtrManager.h" #include "coco/ADT/PtrLink.h" @@ -13,8 +16,9 @@ namespace coco class InstrManager final : public PtrManager { public: - InstrManager(PtrLink *op_link, const PtrLink *instr_link) - : _op_link{op_link}, _instr_link{instr_link} + InstrManager(PtrLink *op_link, const PtrLink *instr_link, + const PtrLink *obj_link) + : _op_link{op_link}, _instr_link{instr_link}, _obj_link{obj_link} { // DO NOTHING } @@ -25,6 +29,7 @@ public: private: PtrLink *const _op_link; const PtrLink *const _instr_link; + const PtrLink *const _obj_link; }; } // namespace coco diff --git a/contrib/coco/core/include/coco/IR/OpManager.h b/contrib/coco/core/include/coco/IR/OpManager.h index bd6f1b4..2f6921e 100644 --- a/contrib/coco/core/include/coco/IR/OpManager.h +++ b/contrib/coco/core/include/coco/IR/OpManager.h @@ -4,6 +4,9 @@ #include "coco/IR/Op.h" #include "coco/IR/Instr.forward.h" +#include "coco/IR/Object.forward.h" +#include "coco/IR/ObjectInfo.forward.h" + #include "coco/ADT/PtrManager.h" #include "coco/ADT/PtrLink.h" @@ -13,13 +16,14 @@ namespace coco struct OpManager : public PtrManager { public: - OpManager(const PtrLink *op_link); + OpManager(const PtrLink *op_link, const PtrLink *obj_link); public: Conv2D *create(const Conv2D::Param &); private: const PtrLink *const _op_link; + const PtrLink *const _obj_link; }; } // namespace coco diff --git a/contrib/coco/core/src/IR/Instr.test.cpp b/contrib/coco/core/src/IR/Instr.test.cpp index db33e03..fdd2bb2 100644 --- a/contrib/coco/core/src/IR/Instr.test.cpp +++ b/contrib/coco/core/src/IR/Instr.test.cpp @@ -20,7 +20,7 @@ protected: coco::PtrLink link; coco::ObjectManager obj_mgr{&obj_link, &bag_link}; - coco::OpManager op_mgr{&op_link}; + coco::OpManager op_mgr{&op_link, &obj_link}; }; } // namespace diff --git a/contrib/coco/core/src/IR/InstrManager.test.cpp b/contrib/coco/core/src/IR/InstrManager.test.cpp index 63befd0..3fbcd83 100644 --- a/contrib/coco/core/src/IR/InstrManager.test.cpp +++ b/contrib/coco/core/src/IR/InstrManager.test.cpp @@ -7,7 +7,8 @@ TEST(IR_INSTR_MANAGER, create_UnitF) { coco::PtrLink op_link; coco::PtrLink link; - coco::InstrManager mgr{&op_link, &link}; + coco::PtrLink obj_link; + coco::InstrManager mgr{&op_link, &link, &obj_link}; // Conv2D { diff --git a/contrib/coco/core/src/IR/Module.cpp b/contrib/coco/core/src/IR/Module.cpp index bdde7e5..3c2b2ef 100644 --- a/contrib/coco/core/src/IR/Module.cpp +++ b/contrib/coco/core/src/IR/Module.cpp @@ -120,8 +120,9 @@ std::unique_ptr Module::create(void) mgr->_bag = nncc::foundation::make_unique(bag_link.get()); mgr->_object = nncc::foundation::make_unique(obj_link.get(), bag_link.get()); - mgr->_op = nncc::foundation::make_unique(op_link.get()); - mgr->_instr = nncc::foundation::make_unique(op_link.get(), ins_link.get()); + mgr->_op = nncc::foundation::make_unique(op_link.get(), obj_link.get()); + mgr->_instr = nncc::foundation::make_unique(op_link.get(), ins_link.get(), + obj_link.get()); mgr->_block = nncc::foundation::make_unique(blk_link.get(), ins_link.get()); mgr->_input = nncc::foundation::make_unique(bag_link.get()); mgr->_output = nncc::foundation::make_unique(bag_link.get()); diff --git a/contrib/coco/core/src/IR/OpManager.cpp b/contrib/coco/core/src/IR/OpManager.cpp index 4754726..d534567 100644 --- a/contrib/coco/core/src/IR/OpManager.cpp +++ b/contrib/coco/core/src/IR/OpManager.cpp @@ -7,7 +7,8 @@ using nncc::foundation::make_unique; namespace coco { -OpManager::OpManager(const PtrLink *op_link) : _op_link{op_link} +OpManager::OpManager(const PtrLink *op_link, const PtrLink *obj_link) + : _op_link{op_link}, _obj_link{obj_link} { // DO NOTHING } diff --git a/contrib/coco/core/src/IR/OpManager.test.cpp b/contrib/coco/core/src/IR/OpManager.test.cpp index 74c14bd..bc5874f 100644 --- a/contrib/coco/core/src/IR/OpManager.test.cpp +++ b/contrib/coco/core/src/IR/OpManager.test.cpp @@ -5,7 +5,8 @@ TEST(IR_OP_MANAGER, create_Conv2D) { coco::PtrLink op_link; - coco::OpManager mgr{&op_link}; + coco::PtrLink obj_link; + coco::OpManager mgr{&op_link, &obj_link}; coco::Conv2D::Param param; auto obj = mgr.create(param); -- 2.7.4