[enco] Rename Normalize as DataLayoutConversion (#1783)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 10 Oct 2018 00:38:39 +0000 (09:38 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 10 Oct 2018 00:38:39 +0000 (09:38 +0900)
This commit renames Normalize pass as DataLayoutConversion pass, and
rewrites it to expose one function similarly as other transforms.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/enco/core/src/Backend.cpp
contrib/enco/core/src/Transforms/DataLayoutConversion.cpp [moved from contrib/enco/core/src/Transforms/Normalize.cpp with 93% similarity]
contrib/enco/core/src/Transforms/DataLayoutConversion.h [moved from contrib/enco/core/src/Transforms/Normalize.h with 78% similarity]

index d436e98..ab183e7 100644 (file)
@@ -25,7 +25,7 @@
 #include "Transforms/Duplicate.h"
 #include "Transforms/FeatureUnification.h"
 #include "Transforms/Rewrite.h"
-#include "Transforms/Normalize.h"
+#include "Transforms/DataLayoutConversion.h"
 #include "Transforms/IndirectCopyElimination.h"
 #include "Transforms/IdenticalObjectReduction.h"
 #include "Transforms/DuplicatedObjectReduction.h"
@@ -106,8 +106,7 @@ void BackendImpl::compile(coco::Module *m, coco::Data *d)
   avgpool_rewrite.runOnCode(code(sess));
 
   // Insert data ordering if necessary
-  NormalizePass normalize;
-  normalize.runOnCode(code(sess));
+  convert_data_layout(code(sess));
 
   eliminate_indirect_copy(code(sess));
   reduce_identical_object(code(sess));
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "Normalize.h"
+#include "DataLayoutConversion.h"
 
 #include <coco/IR/FeatureLayouts.h>
 
@@ -154,8 +154,16 @@ void ShuffleGen::mutate(coco::Copy *)
 
 } // namespace
 
-namespace enco
+namespace
 {
+class NormalizePass
+{
+private:
+  void runOnModule(coco::Module *m) const;
+
+public:
+  void runOnCode(enco::Code *) const;
+};
 
 void NormalizePass::runOnModule(coco::Module *m) const
 {
@@ -172,4 +180,15 @@ void NormalizePass::runOnModule(coco::Module *m) const
 
 void NormalizePass::runOnCode(enco::Code *code) const { runOnModule(code->module()); }
 
+} // namespace
+
+namespace enco
+{
+
+void convert_data_layout(enco::Code *code)
+{
+  NormalizePass pass;
+  pass.runOnCode(code);
+}
+
 } // namespace enco
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef __NORMALIZE_H__
-#define __NORMALIZE_H__
+#ifndef __ENCO_TRANSFORM_DATA_LAYOUT_CONVERSION_H__
+#define __ENCO_TRANSFORM_DATA_LAYOUT_CONVERSION_H__
 
 #include "Code.h"
 
@@ -25,15 +25,8 @@ namespace enco
 /**
  * @brief Insert data reordering if necessary
  */
-class NormalizePass
-{
-private:
-  void runOnModule(coco::Module *m) const;
-
-public:
-  void runOnCode(enco::Code *) const;
-};
+void convert_data_layout(enco::Code *code);
 
 } // namespace enco
 
-#endif // __NORMALIZE_H__
+#endif // __ENCO_TRANSFORM_DATA_LAYOUT_CONVERSION_H__