From d971a716b5bdd645e56bd8d2acf5ab4a660d6594 Mon Sep 17 00:00:00 2001 From: Aurelius84 Date: Wed, 16 Aug 2023 12:52:15 +0800 Subject: [PATCH] [NewIR]Refine shape dialect directory (#56313) * [NewIR]Refine shape dialect directory * modify IR into ir * fix cmake * fix typo --- paddle/ir/CMakeLists.txt | 2 +- paddle/ir/dialect/shape/CMakeLists.txt | 3 +-- paddle/ir/dialect/shape/ir/CMakeLists.txt | 2 ++ paddle/ir/dialect/shape/{ => ir}/shape_dialect.cc | 4 ++-- paddle/ir/dialect/shape/{ => ir}/shape_dialect.h | 0 paddle/ir/dialect/shape/{ => ir}/shape_op.cc | 2 +- paddle/ir/dialect/shape/{ => ir}/shape_op.h | 0 paddle/ir/{builtin_transforms => transforms}/CMakeLists.txt | 0 .../dead_code_elimination_pass.cc | 2 +- .../dead_code_elimination_pass.h | 0 test/cpp/ir/pattern_rewrite/pattern_rewrite_test.cc | 2 +- test/cpp/ir/shape_dialect/assist_struct_test.cc | 4 ++-- 12 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 paddle/ir/dialect/shape/ir/CMakeLists.txt rename paddle/ir/dialect/shape/{ => ir}/shape_dialect.cc (90%) rename paddle/ir/dialect/shape/{ => ir}/shape_dialect.h (100%) rename paddle/ir/dialect/shape/{ => ir}/shape_op.cc (98%) rename paddle/ir/dialect/shape/{ => ir}/shape_op.h (100%) rename paddle/ir/{builtin_transforms => transforms}/CMakeLists.txt (100%) rename paddle/ir/{builtin_transforms => transforms}/dead_code_elimination_pass.cc (97%) rename paddle/ir/{builtin_transforms => transforms}/dead_code_elimination_pass.h (100%) diff --git a/paddle/ir/CMakeLists.txt b/paddle/ir/CMakeLists.txt index 581bb3f8a7c..5a778466b4c 100644 --- a/paddle/ir/CMakeLists.txt +++ b/paddle/ir/CMakeLists.txt @@ -37,7 +37,7 @@ endfunction() add_subdirectory(core) add_subdirectory(pass) add_subdirectory(pattern_rewrite) -add_subdirectory(builtin_transforms) +add_subdirectory(transforms) add_subdirectory(dialect) if(WIN32) diff --git a/paddle/ir/dialect/shape/CMakeLists.txt b/paddle/ir/dialect/shape/CMakeLists.txt index ab8ecdd7eda..dd1b708ce9f 100644 --- a/paddle/ir/dialect/shape/CMakeLists.txt +++ b/paddle/ir/dialect/shape/CMakeLists.txt @@ -1,2 +1 @@ -file(GLOB SHAPE_SRCS "*.cc") -ir_library(ir_shape SRCS ${SHAPE_SRCS} DEPS ir_core) +add_subdirectory(ir) diff --git a/paddle/ir/dialect/shape/ir/CMakeLists.txt b/paddle/ir/dialect/shape/ir/CMakeLists.txt new file mode 100644 index 00000000000..ab8ecdd7eda --- /dev/null +++ b/paddle/ir/dialect/shape/ir/CMakeLists.txt @@ -0,0 +1,2 @@ +file(GLOB SHAPE_SRCS "*.cc") +ir_library(ir_shape SRCS ${SHAPE_SRCS} DEPS ir_core) diff --git a/paddle/ir/dialect/shape/shape_dialect.cc b/paddle/ir/dialect/shape/ir/shape_dialect.cc similarity index 90% rename from paddle/ir/dialect/shape/shape_dialect.cc rename to paddle/ir/dialect/shape/ir/shape_dialect.cc index a5e3adc3ac0..c2fd60d88a4 100644 --- a/paddle/ir/dialect/shape/shape_dialect.cc +++ b/paddle/ir/dialect/shape/ir/shape_dialect.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/dialect/shape/shape_dialect.h" -#include "paddle/ir/dialect/shape/shape_op.h" +#include "paddle/ir/dialect/shape/ir/shape_dialect.h" +#include "paddle/ir/dialect/shape/ir/shape_op.h" namespace ir { namespace dialect { diff --git a/paddle/ir/dialect/shape/shape_dialect.h b/paddle/ir/dialect/shape/ir/shape_dialect.h similarity index 100% rename from paddle/ir/dialect/shape/shape_dialect.h rename to paddle/ir/dialect/shape/ir/shape_dialect.h diff --git a/paddle/ir/dialect/shape/shape_op.cc b/paddle/ir/dialect/shape/ir/shape_op.cc similarity index 98% rename from paddle/ir/dialect/shape/shape_op.cc rename to paddle/ir/dialect/shape/ir/shape_op.cc index 7befe847790..c5368987d4f 100644 --- a/paddle/ir/dialect/shape/shape_op.cc +++ b/paddle/ir/dialect/shape/ir/shape_op.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/dialect/shape/shape_op.h" +#include "paddle/ir/dialect/shape/ir/shape_op.h" #include "paddle/ir/core/builtin_attribute.h" namespace ir { diff --git a/paddle/ir/dialect/shape/shape_op.h b/paddle/ir/dialect/shape/ir/shape_op.h similarity index 100% rename from paddle/ir/dialect/shape/shape_op.h rename to paddle/ir/dialect/shape/ir/shape_op.h diff --git a/paddle/ir/builtin_transforms/CMakeLists.txt b/paddle/ir/transforms/CMakeLists.txt similarity index 100% rename from paddle/ir/builtin_transforms/CMakeLists.txt rename to paddle/ir/transforms/CMakeLists.txt diff --git a/paddle/ir/builtin_transforms/dead_code_elimination_pass.cc b/paddle/ir/transforms/dead_code_elimination_pass.cc similarity index 97% rename from paddle/ir/builtin_transforms/dead_code_elimination_pass.cc rename to paddle/ir/transforms/dead_code_elimination_pass.cc index 82ef7db726d..f58a4485fc7 100644 --- a/paddle/ir/builtin_transforms/dead_code_elimination_pass.cc +++ b/paddle/ir/transforms/dead_code_elimination_pass.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/builtin_transforms/dead_code_elimination_pass.h" +#include "paddle/ir/transforms/dead_code_elimination_pass.h" #include "paddle/ir/core/builtin_op.h" #include "paddle/ir/core/program.h" diff --git a/paddle/ir/builtin_transforms/dead_code_elimination_pass.h b/paddle/ir/transforms/dead_code_elimination_pass.h similarity index 100% rename from paddle/ir/builtin_transforms/dead_code_elimination_pass.h rename to paddle/ir/transforms/dead_code_elimination_pass.h diff --git a/test/cpp/ir/pattern_rewrite/pattern_rewrite_test.cc b/test/cpp/ir/pattern_rewrite/pattern_rewrite_test.cc index 0eeb448b3f8..6531b94fe3c 100644 --- a/test/cpp/ir/pattern_rewrite/pattern_rewrite_test.cc +++ b/test/cpp/ir/pattern_rewrite/pattern_rewrite_test.cc @@ -23,7 +23,6 @@ #include "paddle/fluid/ir/dialect/pd_attribute.h" #include "paddle/fluid/ir/transforms/constant_folding_pass.h" #include "paddle/fluid/ir/transforms/transform_general_functions.h" -#include "paddle/ir/builtin_transforms/dead_code_elimination_pass.h" #include "paddle/ir/core/builder.h" #include "paddle/ir/core/builtin_attribute.h" #include "paddle/ir/core/builtin_dialect.h" @@ -42,6 +41,7 @@ #include "paddle/ir/pattern_rewrite/pattern_applicator.h" #include "paddle/ir/pattern_rewrite/pattern_match.h" #include "paddle/ir/pattern_rewrite/pattern_rewrite_driver.h" +#include "paddle/ir/transforms/dead_code_elimination_pass.h" #include "paddle/phi/core/kernel_registry.h" // NOTE(zhangbo9674): File pd_op.h is generated by op_gen.py, see details in diff --git a/test/cpp/ir/shape_dialect/assist_struct_test.cc b/test/cpp/ir/shape_dialect/assist_struct_test.cc index 05ecf3734c4..ae94fdbda4d 100644 --- a/test/cpp/ir/shape_dialect/assist_struct_test.cc +++ b/test/cpp/ir/shape_dialect/assist_struct_test.cc @@ -19,8 +19,8 @@ #include "paddle/ir/core/dialect.h" #include "paddle/ir/core/ir_context.h" #include "paddle/ir/core/program.h" -#include "paddle/ir/dialect/shape/shape_dialect.h" -#include "paddle/ir/dialect/shape/shape_op.h" +#include "paddle/ir/dialect/shape/ir/shape_dialect.h" +#include "paddle/ir/dialect/shape/ir/shape_op.h" TEST(assist_struct_test, symbolic_dim) { ir::IrContext *ctx = ir::IrContext::Instance(); -- GitLab