From 854966f7f24896f5765d3727d687fc0454c36ff0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9C=A4=ED=98=84=EC=8B=9D/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 7 Oct 2019 08:54:16 +0900 Subject: [PATCH] [exo-tflite] Introducing Pass dir and Passes.h (#7909) This introduces Pass dir, which is for all optimization pass for TFL nodes, and Passes.h, which is a aggregation of passes in Pass dir. Signed-off-by: Hyun Sik Yoon --- compiler/exo-tflite/src/Convert.cpp | 4 +-- .../Dialect/Service/TFLShapeInferenceRule.test.cpp | 2 -- .../{Conversion => Pass}/ShapeInferencePass.cpp | 0 .../src/{Conversion => Pass}/ShapeInferencePass.h | 6 ++--- .../src/{Conversion => Pass}/TypeInferencePass.cpp | 0 .../src/{Conversion => Pass}/TypeInferencePass.h | 7 +++--- compiler/exo-tflite/src/Passes.cpp | 19 ++++++++++++++ compiler/exo-tflite/src/Passes.h | 29 ++++++++++++++++++++++ compiler/exo-tflite/src/TestHelper.h | 3 +-- 9 files changed, 57 insertions(+), 13 deletions(-) rename compiler/exo-tflite/src/{Conversion => Pass}/ShapeInferencePass.cpp (100%) rename compiler/exo-tflite/src/{Conversion => Pass}/ShapeInferencePass.h (87%) rename compiler/exo-tflite/src/{Conversion => Pass}/TypeInferencePass.cpp (100%) rename compiler/exo-tflite/src/{Conversion => Pass}/TypeInferencePass.h (87%) create mode 100644 compiler/exo-tflite/src/Passes.cpp create mode 100644 compiler/exo-tflite/src/Passes.h diff --git a/compiler/exo-tflite/src/Convert.cpp b/compiler/exo-tflite/src/Convert.cpp index 7b2e524..0b63daf 100644 --- a/compiler/exo-tflite/src/Convert.cpp +++ b/compiler/exo-tflite/src/Convert.cpp @@ -17,9 +17,7 @@ #include "Convert.h" #include "Conversions.h" - -#include "Conversion/TypeInferencePass.h" -#include "Conversion/ShapeInferencePass.h" +#include "Passes.h" #include "ProgressReporter.h" #include "Knob.h" diff --git a/compiler/exo-tflite/src/Dialect/Service/TFLShapeInferenceRule.test.cpp b/compiler/exo-tflite/src/Dialect/Service/TFLShapeInferenceRule.test.cpp index 26cf634..0b174d0 100644 --- a/compiler/exo-tflite/src/Dialect/Service/TFLShapeInferenceRule.test.cpp +++ b/compiler/exo-tflite/src/Dialect/Service/TFLShapeInferenceRule.test.cpp @@ -20,8 +20,6 @@ #include "Dialect/IR/TFLDialect.h" #include "Dialect/Service/TFLShapeInferenceRule.h" -#include "Conversion/ShapeInferencePass.h" - #include #include #include diff --git a/compiler/exo-tflite/src/Conversion/ShapeInferencePass.cpp b/compiler/exo-tflite/src/Pass/ShapeInferencePass.cpp similarity index 100% rename from compiler/exo-tflite/src/Conversion/ShapeInferencePass.cpp rename to compiler/exo-tflite/src/Pass/ShapeInferencePass.cpp diff --git a/compiler/exo-tflite/src/Conversion/ShapeInferencePass.h b/compiler/exo-tflite/src/Pass/ShapeInferencePass.h similarity index 87% rename from compiler/exo-tflite/src/Conversion/ShapeInferencePass.h rename to compiler/exo-tflite/src/Pass/ShapeInferencePass.h index 4db9a43..518c874 100644 --- a/compiler/exo-tflite/src/Conversion/ShapeInferencePass.h +++ b/compiler/exo-tflite/src/Pass/ShapeInferencePass.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef __CONVERSION_SHAPE_INFERENCE_PASS_H__ -#define __CONVERSION_SHAPE_INFERENCE_PASS_H__ +#ifndef __PASS_SHAPE_INFERENCE_PASS_H__ +#define __PASS_SHAPE_INFERENCE_PASS_H__ #include #include @@ -37,4 +37,4 @@ public: } // namespace exo -#endif //__CONVERSION_SHAPE_INFERENCE_PASS_H__ +#endif //__PASS_SHAPE_INFERENCE_PASS_H__ diff --git a/compiler/exo-tflite/src/Conversion/TypeInferencePass.cpp b/compiler/exo-tflite/src/Pass/TypeInferencePass.cpp similarity index 100% rename from compiler/exo-tflite/src/Conversion/TypeInferencePass.cpp rename to compiler/exo-tflite/src/Pass/TypeInferencePass.cpp diff --git a/compiler/exo-tflite/src/Conversion/TypeInferencePass.h b/compiler/exo-tflite/src/Pass/TypeInferencePass.h similarity index 87% rename from compiler/exo-tflite/src/Conversion/TypeInferencePass.h rename to compiler/exo-tflite/src/Pass/TypeInferencePass.h index 3e0b710..3ede587 100644 --- a/compiler/exo-tflite/src/Conversion/TypeInferencePass.h +++ b/compiler/exo-tflite/src/Pass/TypeInferencePass.h @@ -15,10 +15,11 @@ * limitations under the License. */ -#ifndef __CONVERSION_TYPE_INFERENCE_PASS_H__ -#define __CONVERSION_TYPE_INFERENCE_PASS_H__ +#ifndef __PASS_TYPE_INFERENCE_PASS_H__ +#define __PASS_TYPE_INFERENCE_PASS_H__ #include + #include namespace exo @@ -38,4 +39,4 @@ public: } // namespace exo -#endif //__CONVERSION_TYPE_INFERENCE_PASS_H__ +#endif //__PASS_TYPE_INFERENCE_PASS_H__ diff --git a/compiler/exo-tflite/src/Passes.cpp b/compiler/exo-tflite/src/Passes.cpp new file mode 100644 index 0000000..99d229c --- /dev/null +++ b/compiler/exo-tflite/src/Passes.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "Passes.h" + +// This file is to make sure that Passes.h be compiled diff --git a/compiler/exo-tflite/src/Passes.h b/compiler/exo-tflite/src/Passes.h new file mode 100644 index 0000000..37af66d --- /dev/null +++ b/compiler/exo-tflite/src/Passes.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PASSES_H__ +#define __PASSES_H__ + +// Please add in alphabetical order + +#include "Pass/ShapeInferencePass.h" +#include "Pass/TypeInferencePass.h" + +#include +#include +#include + +#endif // __PASSES_H__ diff --git a/compiler/exo-tflite/src/TestHelper.h b/compiler/exo-tflite/src/TestHelper.h index 19097df..756793c 100644 --- a/compiler/exo-tflite/src/TestHelper.h +++ b/compiler/exo-tflite/src/TestHelper.h @@ -19,8 +19,7 @@ #include "Check.h" #include "ProgressReporter.h" -#include "Conversion/TypeInferencePass.h" -#include "Conversion/ShapeInferencePass.h" +#include "Passes.h" #include #include -- 2.7.4