From 0f3ea7d297286e40e7f6c2576971317f1ffc9e65 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: Thu, 6 Dec 2018 14:38:07 +0900 Subject: [PATCH] [enco] Build ANN IR from ANNDepthConcatF instruction (#2521) ANN IRGen Pass now generates ANN IR from ANNDepthConcatF instruction. Signed-off-by: Jonghyun Park --- contrib/enco/core/src/Transforms/Split.cpp | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/contrib/enco/core/src/Transforms/Split.cpp b/contrib/enco/core/src/Transforms/Split.cpp index c233547..9f3d26a 100644 --- a/contrib/enco/core/src/Transforms/Split.cpp +++ b/contrib/enco/core/src/Transforms/Split.cpp @@ -17,6 +17,7 @@ #include "Split.h" #include "Usage.h" #include "Session.h" +#include "coex/IR.h" #include @@ -827,6 +828,30 @@ public: namespace { +std::unique_ptr make_appender(coco::Instr *ins) +{ + ANNOpBuilder op_builder; + + if (auto eval = coco::safe_cast(ins)) + { + return eval->accept(op_builder); + } + + if (auto depth_concat = coco::safe_cast(ins)) + { + auto app = make_unique(); + + app->out(depth_concat->out()->asFeature()); + + app->left(depth_concat->fst()->asFeature()); + app->right(depth_concat->snd()->asFeature()); + + return std::move(app); + } + + return nullptr; +} + enum Compatibility { COMPATIBLE, @@ -867,8 +892,6 @@ void ANNGroupBuilder::build(enco::Code *code) const auto m = code->module(); auto d = code->data(); - ANNOpBuilder op_builder; - // ANNGroupBuilder will construct a sequence of blocks from the original block sequence, and // a destination block (that dst_blk points to) is the tail of the generated sequence. coco::Block *dst_blk = nullptr; @@ -907,7 +930,7 @@ void ANNGroupBuilder::build(enco::Code *code) const ins = cur_ins->next(); cur_ins->detach(); - auto cur_append = cur_ins->accept(op_builder); + auto cur_append = make_appender(cur_ins); // Create a new compatible block and use it as a destination block if the current // destination block is absent or incompatible with the instruction of intereset. -- 2.7.4