[enco] Introduce AvgPoolLoweringPass (#3049)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Thu, 7 Mar 2019 03:36:55 +0000 (12:36 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 7 Mar 2019 03:36:55 +0000 (12:36 +0900)
Let's access lower_avgpool through AvgPoolLoweringPass.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/enco/core/src/Backend.cpp
contrib/enco/core/src/Transforms/AvgPoolLowering.h

index 423527c..1581333 100644 (file)
@@ -104,6 +104,7 @@ void BackendImpl::compile(coco::Module *m, coco::Data *d)
   // BagDuplicationPass creates a copy of such bags in order to eliminate such a pair.
   pipeline.append(make_unique<BagDuplicationPass>());
   pipeline.append(make_unique<FeatureUnificationPass>());
+  pipeline.append(make_unique<AvgPoolLoweringPass>());
 
   // Apply transforms in the pipeline
   for (uint32_t n = 0; n < pipeline.size(); ++n)
@@ -122,8 +123,6 @@ void BackendImpl::compile(coco::Module *m, coco::Data *d)
   // that share the same bag as their underlying bag
   assert(!has_inout_bag(code(sess)->module()));
 
-  lower_avgpool(code(sess));
-
   // Select Intrinsic(API)
   select_intrinsic(code(sess));
 
index 1d87c70..71a5253 100644 (file)
@@ -18,6 +18,7 @@
 #define __REWRITE_H__
 
 #include "Code.h"
+#include "Pass.h"
 
 namespace enco
 {
@@ -27,6 +28,16 @@ namespace enco
  */
 void lower_avgpool(enco::Code *);
 
+struct AvgPoolLoweringPass final : public Pass
+{
+  PASS_CTOR(AvgPoolLoweringPass)
+  {
+    // DO NOTHING
+  }
+
+  void run(const SessionID &sess) const override { lower_avgpool(code(sess)); }
+};
+
 } // namespace enco
 
 #endif // __REWRITE_H__