From 70eade79e5e9fdcd152de28e41a4010efed756bb Mon Sep 17 00:00:00 2001 From: winter-wang <78149749+winter-wang@users.noreply.github.com> Date: Mon, 29 May 2023 20:21:37 +0800 Subject: [PATCH] [IR] rectify the new ir folder (#54124) --- paddle/CMakeLists.txt | 2 +- paddle/fluid/dialect/legacy_pd_op.h | 2 +- paddle/fluid/dialect/op_gen.py | 8 ++--- paddle/fluid/dialect/pd_attribute.h | 2 +- paddle/fluid/dialect/pd_attribute_storage.h | 4 +-- paddle/fluid/dialect/pd_dialect.cc | 2 +- paddle/fluid/dialect/pd_dialect.h | 4 +-- paddle/fluid/dialect/pd_type.h | 2 +- paddle/fluid/dialect/pd_type_storage.h | 4 +-- paddle/fluid/dialect/utils.h | 2 +- paddle/fluid/translator/op_translator.cc | 8 ++--- paddle/fluid/translator/op_translator.h | 8 ++--- paddle/fluid/translator/program_translator.cc | 8 ++--- paddle/fluid/translator/program_translator.h | 6 ++-- paddle/fluid/translator/translate.cc | 2 +- paddle/fluid/translator/translate.h | 2 +- paddle/fluid/translator/type_translator.cc | 2 +- paddle/fluid/translator/type_translator.h | 6 ++-- paddle/ir/CMakeLists.txt | 7 +--- paddle/ir/core/CMakeLists.txt | 6 ++++ paddle/ir/{ => core}/attribute.cc | 4 +-- paddle/ir/{ => core}/attribute.h | 4 +-- paddle/ir/{ => core}/attribute_base.h | 6 ++-- paddle/ir/{ => core}/block.cc | 2 +- paddle/ir/{ => core}/block.h | 2 +- paddle/ir/{ => core}/builder.cc | 2 +- paddle/ir/{ => core}/builder.h | 6 ++-- paddle/ir/{ => core}/builtin_attribute.cc | 2 +- paddle/ir/{ => core}/builtin_attribute.h | 6 ++-- .../ir/{ => core}/builtin_attribute_storage.h | 4 +-- paddle/ir/{ => core}/builtin_dialect.cc | 8 ++--- paddle/ir/{ => core}/builtin_dialect.h | 2 +- paddle/ir/{ => core}/builtin_op.cc | 6 ++-- paddle/ir/{ => core}/builtin_op.h | 2 +- paddle/ir/{ => core}/builtin_type.cc | 2 +- paddle/ir/{ => core}/builtin_type.h | 4 +-- paddle/ir/{ => core}/builtin_type_storage.h | 4 +-- paddle/ir/{ => core}/cast_utils.h | 0 paddle/ir/{ => core}/dialect.cc | 2 +- paddle/ir/{ => core}/dialect.h | 10 +++--- paddle/ir/{ => core}/dialect_interface.h | 2 +- paddle/ir/{ => core}/ir_context.cc | 16 ++++----- paddle/ir/{ => core}/ir_context.h | 0 paddle/ir/{ => core}/op_base.cc | 2 +- paddle/ir/{ => core}/op_base.h | 4 +-- paddle/ir/{ => core}/op_info.cc | 8 ++--- paddle/ir/{ => core}/op_info.h | 2 +- paddle/ir/{ => core}/op_info_impl.h | 6 ++-- paddle/ir/{ => core}/operation.cc | 8 ++--- paddle/ir/{ => core}/operation.h | 13 +++---- paddle/ir/{ => core}/operation_utils.cc | 2 +- paddle/ir/{ => core}/operation_utils.h | 8 ++--- paddle/ir/{ => core}/parameter.h | 2 +- paddle/ir/{ => core}/printer.cc | 12 +++---- paddle/ir/{ => core}/program.cc | 4 +-- paddle/ir/{ => core}/program.h | 8 ++--- paddle/ir/{ => core}/spin_lock.h | 0 paddle/ir/{ => core}/storage_manager.cc | 2 +- paddle/ir/{ => core}/storage_manager.h | 4 +-- paddle/ir/{ => core}/type.cc | 4 +-- paddle/ir/{ => core}/type.h | 4 +-- paddle/ir/{ => core}/type_base.h | 6 ++-- paddle/ir/{ => core}/type_id.h | 0 paddle/ir/{ => core}/utils.cc | 2 +- paddle/ir/{ => core}/utils.h | 0 paddle/ir/{ => core}/value.cc | 4 +-- paddle/ir/{ => core}/value.h | 4 +-- paddle/ir/{ => core}/value_impl.h | 2 +- paddle/pass/pass.cc | 4 +-- test/cpp/ir/CMakeLists.txt | 35 +++---------------- test/cpp/ir/core/CMakeLists.txt | 29 +++++++++++++++ test/cpp/ir/{ => core}/ir_attribute_test.cc | 12 +++---- test/cpp/ir/{ => core}/ir_op_test.cc | 12 +++---- test/cpp/ir/{ => core}/ir_program_test.cc | 12 +++---- test/cpp/ir/{ => core}/ir_value_test.cc | 10 +++--- .../ir/{ => core}/program_translator_test.cc | 8 ++--- test/cpp/ir/{ => core}/type_test.cc | 14 ++++---- test/cpp/pass/pass_manager_test.cc | 10 +++--- 78 files changed, 222 insertions(+), 218 deletions(-) create mode 100644 paddle/ir/core/CMakeLists.txt rename paddle/ir/{ => core}/attribute.cc (90%) rename paddle/ir/{ => core}/attribute.h (96%) rename paddle/ir/{ => core}/attribute_base.h (98%) rename paddle/ir/{ => core}/block.cc (95%) rename paddle/ir/{ => core}/block.h (97%) rename paddle/ir/{ => core}/builder.cc (97%) rename paddle/ir/{ => core}/builder.h (95%) rename paddle/ir/{ => core}/builtin_attribute.cc (96%) rename paddle/ir/{ => core}/builtin_attribute.h (94%) rename paddle/ir/{ => core}/builtin_attribute_storage.h (98%) rename paddle/ir/{ => core}/builtin_dialect.cc (90%) rename paddle/ir/{ => core}/builtin_dialect.h (97%) rename paddle/ir/{ => core}/builtin_op.cc (97%) rename paddle/ir/{ => core}/builtin_op.h (98%) rename paddle/ir/{ => core}/builtin_type.cc (94%) rename paddle/ir/{ => core}/builtin_type.h (97%) rename paddle/ir/{ => core}/builtin_type_storage.h (97%) rename paddle/ir/{ => core}/cast_utils.h (100%) rename paddle/ir/{ => core}/dialect.cc (97%) rename paddle/ir/{ => core}/dialect.h (95%) rename paddle/ir/{ => core}/dialect_interface.h (98%) rename paddle/ir/{ => core}/ir_context.cc (97%) rename paddle/ir/{ => core}/ir_context.h (100%) rename paddle/ir/{ => core}/op_base.cc (96%) rename paddle/ir/{ => core}/op_base.h (98%) rename paddle/ir/{ => core}/op_info.cc (97%) rename paddle/ir/{ => core}/op_info.h (98%) rename paddle/ir/{ => core}/op_info_impl.h (96%) rename paddle/ir/{ => core}/operation.cc (98%) rename paddle/ir/{ => core}/operation.h (92%) rename paddle/ir/{ => core}/operation_utils.cc (96%) rename paddle/ir/{ => core}/operation_utils.h (94%) rename paddle/ir/{ => core}/parameter.h (98%) rename paddle/ir/{ => core}/printer.cc (96%) rename paddle/ir/{ => core}/program.cc (93%) rename paddle/ir/{ => core}/program.h (92%) rename paddle/ir/{ => core}/spin_lock.h (100%) rename paddle/ir/{ => core}/storage_manager.cc (99%) rename paddle/ir/{ => core}/storage_manager.h (98%) rename paddle/ir/{ => core}/type.cc (92%) rename paddle/ir/{ => core}/type.h (97%) rename paddle/ir/{ => core}/type_base.h (98%) rename paddle/ir/{ => core}/type_id.h (100%) rename paddle/ir/{ => core}/utils.cc (98%) rename paddle/ir/{ => core}/utils.h (100%) rename paddle/ir/{ => core}/value.cc (98%) rename paddle/ir/{ => core}/value.h (98%) rename paddle/ir/{ => core}/value_impl.h (99%) create mode 100644 test/cpp/ir/core/CMakeLists.txt rename test/cpp/ir/{ => core}/ir_attribute_test.cc (90%) rename test/cpp/ir/{ => core}/ir_op_test.cc (96%) rename test/cpp/ir/{ => core}/ir_program_test.cc (97%) rename test/cpp/ir/{ => core}/ir_value_test.cc (95%) rename test/cpp/ir/{ => core}/program_translator_test.cc (93%) rename test/cpp/ir/{ => core}/type_test.cc (96%) diff --git a/paddle/CMakeLists.txt b/paddle/CMakeLists.txt index af7c0309935..531324c250c 100644 --- a/paddle/CMakeLists.txt +++ b/paddle/CMakeLists.txt @@ -3,12 +3,12 @@ set(PYTHON_TESTS_DIR CACHE INTERNAL "python tests directory") add_subdirectory(utils) +add_subdirectory(ir) add_subdirectory(scripts) add_subdirectory(testing) add_subdirectory(phi) add_subdirectory(fluid) -add_subdirectory(ir) add_subdirectory(pass) # NOTE(zhiqiu): The changes of cc tests diff --git a/paddle/fluid/dialect/legacy_pd_op.h b/paddle/fluid/dialect/legacy_pd_op.h index 3d06cd4d64c..44d55d57225 100644 --- a/paddle/fluid/dialect/legacy_pd_op.h +++ b/paddle/fluid/dialect/legacy_pd_op.h @@ -14,7 +14,7 @@ #pragma once -#include "paddle/ir/op_base.h" +#include "paddle/ir/core/op_base.h" namespace paddle { namespace dialect { diff --git a/paddle/fluid/dialect/op_gen.py b/paddle/fluid/dialect/op_gen.py index 94930d0f133..163f7149e11 100644 --- a/paddle/fluid/dialect/op_gen.py +++ b/paddle/fluid/dialect/op_gen.py @@ -29,7 +29,7 @@ H_FILE_TEMPLATE = """#ifdef GET_OP_LIST {op_declare} #else -#include "paddle/ir/op_base.h" +#include "paddle/ir/core/op_base.h" {input} #endif @@ -67,9 +67,9 @@ OP_GET_OUTPUT_TEMPLATE = """ ir::OpResult {output_name}() {{ return operation() CC_FILE_TEMPLATE = """#include "{h_file}" #include "paddle/fluid/dialect/pd_type.h" #include "paddle/fluid/dialect/pd_attribute.h" -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/ir_context.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/ir_context.h" #include "paddle/phi/core/enforce.h" {input} diff --git a/paddle/fluid/dialect/pd_attribute.h b/paddle/fluid/dialect/pd_attribute.h index 59481f1cedc..6afcd4b2bd0 100644 --- a/paddle/fluid/dialect/pd_attribute.h +++ b/paddle/fluid/dialect/pd_attribute.h @@ -15,7 +15,7 @@ #pragma once #include "paddle/fluid/dialect/pd_attribute_storage.h" -#include "paddle/ir/attribute.h" +#include "paddle/ir/core/attribute.h" namespace paddle { namespace dialect { diff --git a/paddle/fluid/dialect/pd_attribute_storage.h b/paddle/fluid/dialect/pd_attribute_storage.h index 352dcc8b0e4..c524a360877 100644 --- a/paddle/fluid/dialect/pd_attribute_storage.h +++ b/paddle/fluid/dialect/pd_attribute_storage.h @@ -14,8 +14,8 @@ #pragma once -#include "paddle/ir/attribute.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/attribute.h" +#include "paddle/ir/core/utils.h" #include "paddle/phi/common/data_type.h" #include "paddle/phi/common/int_array.h" #include "paddle/phi/common/layout.h" diff --git a/paddle/fluid/dialect/pd_dialect.cc b/paddle/fluid/dialect/pd_dialect.cc index a11dd5fb6da..c5d648d3838 100644 --- a/paddle/fluid/dialect/pd_dialect.cc +++ b/paddle/fluid/dialect/pd_dialect.cc @@ -23,7 +23,7 @@ #include "paddle/fluid/dialect/utils.h" #include "paddle/fluid/framework/convert_utils.h" #include "paddle/fluid/framework/data_type.h" -#include "paddle/ir/dialect_interface.h" +#include "paddle/ir/core/dialect_interface.h" #include "paddle/phi/core/dense_tensor.h" namespace paddle { diff --git a/paddle/fluid/dialect/pd_dialect.h b/paddle/fluid/dialect/pd_dialect.h index 6b1312e6913..069827bedcf 100644 --- a/paddle/fluid/dialect/pd_dialect.h +++ b/paddle/fluid/dialect/pd_dialect.h @@ -15,8 +15,8 @@ #pragma once #include "paddle/fluid/framework/variable.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/parameter.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/parameter.h" namespace paddle { namespace dialect { diff --git a/paddle/fluid/dialect/pd_type.h b/paddle/fluid/dialect/pd_type.h index e07951bbf93..8e9f1e6c54c 100644 --- a/paddle/fluid/dialect/pd_type.h +++ b/paddle/fluid/dialect/pd_type.h @@ -15,7 +15,7 @@ #pragma once #include "paddle/fluid/dialect/pd_type_storage.h" -#include "paddle/ir/type.h" +#include "paddle/ir/core/type.h" namespace paddle { namespace dialect { diff --git a/paddle/fluid/dialect/pd_type_storage.h b/paddle/fluid/dialect/pd_type_storage.h index e52d81db1dd..3104edb80f8 100644 --- a/paddle/fluid/dialect/pd_type_storage.h +++ b/paddle/fluid/dialect/pd_type_storage.h @@ -16,8 +16,8 @@ #include -#include "paddle/ir/type.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/type.h" +#include "paddle/ir/core/utils.h" namespace std { /// diff --git a/paddle/fluid/dialect/utils.h b/paddle/fluid/dialect/utils.h index 69af6fd1ddc..56c6db01a82 100644 --- a/paddle/fluid/dialect/utils.h +++ b/paddle/fluid/dialect/utils.h @@ -17,7 +17,7 @@ #include "paddle/fluid/dialect/pd_type_storage.h" #include "paddle/fluid/framework/convert_utils.h" #include "paddle/fluid/framework/data_type.h" -#include "paddle/ir/builtin_type.h" +#include "paddle/ir/core/builtin_type.h" #include "paddle/phi/core/dense_tensor.h" namespace paddle { diff --git a/paddle/fluid/translator/op_translator.cc b/paddle/fluid/translator/op_translator.cc index 9654f1f09ec..222edc45e68 100644 --- a/paddle/fluid/translator/op_translator.cc +++ b/paddle/fluid/translator/op_translator.cc @@ -25,10 +25,10 @@ #include "paddle/fluid/translator/op_compat_info.h" #include "paddle/fluid/translator/program_translator.h" #include "paddle/fluid/translator/type_translator.h" -#include "paddle/ir/builtin_op.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/value.h" +#include "paddle/ir/core/builtin_op.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/value.h" #include "paddle/phi/core/enforce.h" namespace paddle { diff --git a/paddle/fluid/translator/op_translator.h b/paddle/fluid/translator/op_translator.h index 92c03458300..17c1b306a9f 100644 --- a/paddle/fluid/translator/op_translator.h +++ b/paddle/fluid/translator/op_translator.h @@ -21,10 +21,10 @@ #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/framework/var_desc.h" #include "paddle/fluid/translator/program_translator.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/operation.h" -#include "paddle/ir/program.h" -#include "paddle/ir/value.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/operation.h" +#include "paddle/ir/core/program.h" +#include "paddle/ir/core/value.h" namespace paddle { namespace translator { diff --git a/paddle/fluid/translator/program_translator.cc b/paddle/fluid/translator/program_translator.cc index 7618972f108..f3af3a3db54 100644 --- a/paddle/fluid/translator/program_translator.cc +++ b/paddle/fluid/translator/program_translator.cc @@ -21,10 +21,10 @@ #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/translator/op_translator.h" #include "paddle/fluid/translator/type_translator.h" -#include "paddle/ir/attribute.h" -#include "paddle/ir/builtin_op.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/operation.h" +#include "paddle/ir/core/attribute.h" +#include "paddle/ir/core/builtin_op.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/operation.h" #include "paddle/phi/core/enforce.h" namespace paddle { diff --git a/paddle/fluid/translator/program_translator.h b/paddle/fluid/translator/program_translator.h index f7fd4e2890e..148ac9b0563 100644 --- a/paddle/fluid/translator/program_translator.h +++ b/paddle/fluid/translator/program_translator.h @@ -20,9 +20,9 @@ #include #include "paddle/fluid/framework/program_desc.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/program.h" -#include "paddle/ir/value.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/program.h" +#include "paddle/ir/core/value.h" namespace paddle { namespace translator { diff --git a/paddle/fluid/translator/translate.cc b/paddle/fluid/translator/translate.cc index 40af6ce5394..eaf9c35d403 100644 --- a/paddle/fluid/translator/translate.cc +++ b/paddle/fluid/translator/translate.cc @@ -19,7 +19,7 @@ #include "paddle/fluid/dialect/pd_dialect.h" #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/translator/program_translator.h" -#include "paddle/ir/program.h" +#include "paddle/ir/core/program.h" namespace paddle { diff --git a/paddle/fluid/translator/translate.h b/paddle/fluid/translator/translate.h index 9cf013ea2bc..4c7e224fd1e 100644 --- a/paddle/fluid/translator/translate.h +++ b/paddle/fluid/translator/translate.h @@ -18,7 +18,7 @@ #include "paddle/fluid/dialect/pd_dialect.h" #include "paddle/fluid/framework/program_desc.h" -#include "paddle/ir/program.h" +#include "paddle/ir/core/program.h" namespace paddle { diff --git a/paddle/fluid/translator/type_translator.cc b/paddle/fluid/translator/type_translator.cc index e0c31913ffe..c677ec8682d 100644 --- a/paddle/fluid/translator/type_translator.cc +++ b/paddle/fluid/translator/type_translator.cc @@ -17,7 +17,7 @@ #include "paddle/fluid/dialect/pd_type.h" #include "paddle/fluid/dialect/pd_type_storage.h" #include "paddle/fluid/framework/framework.pb.h" -#include "paddle/ir/builtin_type.h" +#include "paddle/ir/core/builtin_type.h" namespace paddle { namespace translator { diff --git a/paddle/fluid/translator/type_translator.h b/paddle/fluid/translator/type_translator.h index 707b8913f33..e32757cd105 100644 --- a/paddle/fluid/translator/type_translator.h +++ b/paddle/fluid/translator/type_translator.h @@ -20,9 +20,9 @@ #include "paddle/fluid/framework/op_desc.h" #include "paddle/fluid/framework/var_desc.h" #include "paddle/fluid/translator/program_translator.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/ir_context.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/ir_context.h" namespace paddle { namespace translator { diff --git a/paddle/ir/CMakeLists.txt b/paddle/ir/CMakeLists.txt index 084ee7e52ca..14c08067b5f 100644 --- a/paddle/ir/CMakeLists.txt +++ b/paddle/ir/CMakeLists.txt @@ -2,9 +2,4 @@ if(NOT WITH_NEWIR) return() endif() -set(NEWIR_SOURCE_DIR "${PADDLE_SOURCE_DIR}/paddle/ir") -set(NEWIR_BINARY_DIR "${PADDLE_BINARY_DIR}/paddle/ir") - -file(GLOB IR_SRCS "*.cc") - -cc_library(new_ir SRCS ${IR_SRCS}) +add_subdirectory(core) diff --git a/paddle/ir/core/CMakeLists.txt b/paddle/ir/core/CMakeLists.txt new file mode 100644 index 00000000000..dde617e33a0 --- /dev/null +++ b/paddle/ir/core/CMakeLists.txt @@ -0,0 +1,6 @@ +set(NEWIR_SOURCE_DIR "${PADDLE_SOURCE_DIR}/paddle/ir") +set(NEWIR_BINARY_DIR "${PADDLE_BINARY_DIR}/paddle/ir") + +file(GLOB IR_SRCS "*.cc") + +cc_library(new_ir SRCS ${IR_SRCS}) diff --git a/paddle/ir/attribute.cc b/paddle/ir/core/attribute.cc similarity index 90% rename from paddle/ir/attribute.cc rename to paddle/ir/core/attribute.cc index 0d70a47f4d1..77e768720e3 100644 --- a/paddle/ir/attribute.cc +++ b/paddle/ir/core/attribute.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/attribute.h" -#include "paddle/ir/dialect.h" +#include "paddle/ir/core/attribute.h" +#include "paddle/ir/core/dialect.h" namespace ir { IrContext *Attribute::ir_context() const { return dialect().ir_context(); } diff --git a/paddle/ir/attribute.h b/paddle/ir/core/attribute.h similarity index 96% rename from paddle/ir/attribute.h rename to paddle/ir/core/attribute.h index db556ce9652..4f269187b75 100644 --- a/paddle/ir/attribute.h +++ b/paddle/ir/core/attribute.h @@ -14,8 +14,8 @@ #pragma once -#include "paddle/ir/attribute_base.h" -#include "paddle/ir/cast_utils.h" +#include "paddle/ir/core/attribute_base.h" +#include "paddle/ir/core/cast_utils.h" namespace ir { /// diff --git a/paddle/ir/attribute_base.h b/paddle/ir/core/attribute_base.h similarity index 98% rename from paddle/ir/attribute_base.h rename to paddle/ir/core/attribute_base.h index eaf0deb899f..8ad3c877416 100644 --- a/paddle/ir/attribute_base.h +++ b/paddle/ir/core/attribute_base.h @@ -14,9 +14,9 @@ #pragma once -#include "paddle/ir/ir_context.h" -#include "paddle/ir/storage_manager.h" -#include "paddle/ir/type_id.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/storage_manager.h" +#include "paddle/ir/core/type_id.h" namespace ir { class Dialect; diff --git a/paddle/ir/block.cc b/paddle/ir/core/block.cc similarity index 95% rename from paddle/ir/block.cc rename to paddle/ir/core/block.cc index 9603eff00f1..62263a8f1a3 100644 --- a/paddle/ir/block.cc +++ b/paddle/ir/core/block.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/block.h" +#include "paddle/ir/core/block.h" namespace ir { Block::~Block() { clear(); } diff --git a/paddle/ir/block.h b/paddle/ir/core/block.h similarity index 97% rename from paddle/ir/block.h rename to paddle/ir/core/block.h index 3176bfe4c9e..3bc4ef82478 100644 --- a/paddle/ir/block.h +++ b/paddle/ir/core/block.h @@ -15,7 +15,7 @@ #pragma once #include -#include "paddle/ir/operation.h" +#include "paddle/ir/core/operation.h" namespace ir { class Block { diff --git a/paddle/ir/builder.cc b/paddle/ir/core/builder.cc similarity index 97% rename from paddle/ir/builder.cc rename to paddle/ir/core/builder.cc index 842e8c63bcf..107b8467747 100644 --- a/paddle/ir/builder.cc +++ b/paddle/ir/core/builder.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/builder.h" +#include "paddle/ir/core/builder.h" namespace ir { Operation *Builder::insert(Operation *op) { diff --git a/paddle/ir/builder.h b/paddle/ir/core/builder.h similarity index 95% rename from paddle/ir/builder.h rename to paddle/ir/core/builder.h index c1762ca1441..e1f3de2b726 100644 --- a/paddle/ir/builder.h +++ b/paddle/ir/core/builder.h @@ -16,9 +16,9 @@ #include -#include "paddle/ir/block.h" -#include "paddle/ir/operation.h" -#include "paddle/ir/program.h" +#include "paddle/ir/core/block.h" +#include "paddle/ir/core/operation.h" +#include "paddle/ir/core/program.h" namespace ir { /// diff --git a/paddle/ir/builtin_attribute.cc b/paddle/ir/core/builtin_attribute.cc similarity index 96% rename from paddle/ir/builtin_attribute.cc rename to paddle/ir/core/builtin_attribute.cc index ba95318df6f..78bd2903be3 100644 --- a/paddle/ir/builtin_attribute.cc +++ b/paddle/ir/core/builtin_attribute.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/builtin_attribute.h" +#include "paddle/ir/core/builtin_attribute.h" namespace ir { std::string StrAttribute::data() const { return storage()->GetAsKey(); } diff --git a/paddle/ir/builtin_attribute.h b/paddle/ir/core/builtin_attribute.h similarity index 94% rename from paddle/ir/builtin_attribute.h rename to paddle/ir/core/builtin_attribute.h index 468bf1be6ab..edad980136f 100644 --- a/paddle/ir/builtin_attribute.h +++ b/paddle/ir/core/builtin_attribute.h @@ -14,9 +14,9 @@ #pragma once -#include "paddle/ir/attribute.h" -#include "paddle/ir/builtin_attribute_storage.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/attribute.h" +#include "paddle/ir/core/builtin_attribute_storage.h" +#include "paddle/ir/core/utils.h" namespace ir { class StrAttribute : public Attribute { diff --git a/paddle/ir/builtin_attribute_storage.h b/paddle/ir/core/builtin_attribute_storage.h similarity index 98% rename from paddle/ir/builtin_attribute_storage.h rename to paddle/ir/core/builtin_attribute_storage.h index d91c4c44f63..101c4781beb 100644 --- a/paddle/ir/builtin_attribute_storage.h +++ b/paddle/ir/core/builtin_attribute_storage.h @@ -18,8 +18,8 @@ #include #include -#include "paddle/ir/attribute.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/attribute.h" +#include "paddle/ir/core/utils.h" namespace ir { diff --git a/paddle/ir/builtin_dialect.cc b/paddle/ir/core/builtin_dialect.cc similarity index 90% rename from paddle/ir/builtin_dialect.cc rename to paddle/ir/core/builtin_dialect.cc index 32f8750b710..bdbb2736f12 100644 --- a/paddle/ir/builtin_dialect.cc +++ b/paddle/ir/core/builtin_dialect.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/builtin_dialect.h" -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/builtin_op.h" -#include "paddle/ir/builtin_type.h" +#include "paddle/ir/core/builtin_dialect.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/builtin_op.h" +#include "paddle/ir/core/builtin_type.h" namespace ir { BuiltinDialect::BuiltinDialect(ir::IrContext *context) diff --git a/paddle/ir/builtin_dialect.h b/paddle/ir/core/builtin_dialect.h similarity index 97% rename from paddle/ir/builtin_dialect.h rename to paddle/ir/core/builtin_dialect.h index 5016c1abea0..ff7da2d7f5d 100644 --- a/paddle/ir/builtin_dialect.h +++ b/paddle/ir/core/builtin_dialect.h @@ -14,7 +14,7 @@ #pragma once -#include "paddle/ir/dialect.h" +#include "paddle/ir/core/dialect.h" namespace ir { /// diff --git a/paddle/ir/builtin_op.cc b/paddle/ir/core/builtin_op.cc similarity index 97% rename from paddle/ir/builtin_op.cc rename to paddle/ir/core/builtin_op.cc index 63bfc2196dc..023c96d7e13 100644 --- a/paddle/ir/builtin_op.cc +++ b/paddle/ir/core/builtin_op.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/builtin_op.h" +#include "paddle/ir/core/builtin_op.h" -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/builtin_type.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/builtin_type.h" #include "paddle/phi/core/enforce.h" namespace ir { diff --git a/paddle/ir/builtin_op.h b/paddle/ir/core/builtin_op.h similarity index 98% rename from paddle/ir/builtin_op.h rename to paddle/ir/core/builtin_op.h index d1d2c20b572..ffe357ed9e9 100644 --- a/paddle/ir/builtin_op.h +++ b/paddle/ir/core/builtin_op.h @@ -14,7 +14,7 @@ #pragma once -#include "paddle/ir/op_base.h" +#include "paddle/ir/core/op_base.h" namespace ir { /// diff --git a/paddle/ir/builtin_type.cc b/paddle/ir/core/builtin_type.cc similarity index 94% rename from paddle/ir/builtin_type.cc rename to paddle/ir/core/builtin_type.cc index 8929496b5de..d9ee429a5f6 100644 --- a/paddle/ir/builtin_type.cc +++ b/paddle/ir/core/builtin_type.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/builtin_type.h" +#include "paddle/ir/core/builtin_type.h" namespace ir { std::vector VectorType::data() const { return storage()->GetAsKey(); } diff --git a/paddle/ir/builtin_type.h b/paddle/ir/core/builtin_type.h similarity index 97% rename from paddle/ir/builtin_type.h rename to paddle/ir/core/builtin_type.h index cb7dd8a853d..ea0d93a5397 100644 --- a/paddle/ir/builtin_type.h +++ b/paddle/ir/core/builtin_type.h @@ -14,8 +14,8 @@ #pragma once -#include "paddle/ir/builtin_type_storage.h" -#include "paddle/ir/type.h" +#include "paddle/ir/core/builtin_type_storage.h" +#include "paddle/ir/core/type.h" namespace ir { /// diff --git a/paddle/ir/builtin_type_storage.h b/paddle/ir/core/builtin_type_storage.h similarity index 97% rename from paddle/ir/builtin_type_storage.h rename to paddle/ir/core/builtin_type_storage.h index 576457fe119..5c6f255461b 100644 --- a/paddle/ir/builtin_type_storage.h +++ b/paddle/ir/core/builtin_type_storage.h @@ -14,8 +14,8 @@ #pragma once -#include "paddle/ir/type.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/type.h" +#include "paddle/ir/core/utils.h" namespace ir { struct VectorTypeStorage : public TypeStorage { diff --git a/paddle/ir/cast_utils.h b/paddle/ir/core/cast_utils.h similarity index 100% rename from paddle/ir/cast_utils.h rename to paddle/ir/core/cast_utils.h diff --git a/paddle/ir/dialect.cc b/paddle/ir/core/dialect.cc similarity index 97% rename from paddle/ir/dialect.cc rename to paddle/ir/core/dialect.cc index 8764daf861a..fe53c14f1f0 100644 --- a/paddle/ir/dialect.cc +++ b/paddle/ir/core/dialect.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/dialect.h" +#include "paddle/ir/core/dialect.h" namespace ir { Dialect::Dialect(std::string name, ir::IrContext *context, ir::TypeId id) diff --git a/paddle/ir/dialect.h b/paddle/ir/core/dialect.h similarity index 95% rename from paddle/ir/dialect.h rename to paddle/ir/core/dialect.h index 18a95d5844a..8d199ff77d7 100644 --- a/paddle/ir/dialect.h +++ b/paddle/ir/core/dialect.h @@ -16,11 +16,11 @@ #include -#include "paddle/ir/attribute_base.h" -#include "paddle/ir/dialect_interface.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/op_base.h" -#include "paddle/ir/type_base.h" +#include "paddle/ir/core/attribute_base.h" +#include "paddle/ir/core/dialect_interface.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/op_base.h" +#include "paddle/ir/core/type_base.h" namespace ir { class DialectInterface; diff --git a/paddle/ir/dialect_interface.h b/paddle/ir/core/dialect_interface.h similarity index 98% rename from paddle/ir/dialect_interface.h rename to paddle/ir/core/dialect_interface.h index dd3ec08af52..0363ca0ebac 100644 --- a/paddle/ir/dialect_interface.h +++ b/paddle/ir/core/dialect_interface.h @@ -14,7 +14,7 @@ #pragma once -#include "paddle/ir/type_id.h" +#include "paddle/ir/core/type_id.h" namespace ir { class Dialect; diff --git a/paddle/ir/ir_context.cc b/paddle/ir/core/ir_context.cc similarity index 97% rename from paddle/ir/ir_context.cc rename to paddle/ir/core/ir_context.cc index dd922a7359f..2c03bbd05b2 100644 --- a/paddle/ir/ir_context.cc +++ b/paddle/ir/core/ir_context.cc @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/ir_context.h" +#include "paddle/ir/core/ir_context.h" #include -#include "paddle/ir/attribute_base.h" -#include "paddle/ir/builtin_dialect.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/op_info_impl.h" -#include "paddle/ir/spin_lock.h" -#include "paddle/ir/type_base.h" +#include "paddle/ir/core/attribute_base.h" +#include "paddle/ir/core/builtin_dialect.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/op_info_impl.h" +#include "paddle/ir/core/spin_lock.h" +#include "paddle/ir/core/type_base.h" namespace ir { // The implementation class of the IrContext class, cache registered diff --git a/paddle/ir/ir_context.h b/paddle/ir/core/ir_context.h similarity index 100% rename from paddle/ir/ir_context.h rename to paddle/ir/core/ir_context.h diff --git a/paddle/ir/op_base.cc b/paddle/ir/core/op_base.cc similarity index 96% rename from paddle/ir/op_base.cc rename to paddle/ir/core/op_base.cc index 30e5a68e933..7ddc948c66a 100644 --- a/paddle/ir/op_base.cc +++ b/paddle/ir/core/op_base.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/op_base.h" +#include "paddle/ir/core/op_base.h" namespace ir { InterfaceValue::~InterfaceValue() { if (model_) free(model_); diff --git a/paddle/ir/op_base.h b/paddle/ir/core/op_base.h similarity index 98% rename from paddle/ir/op_base.h rename to paddle/ir/core/op_base.h index 47fa243b1c4..20d7d7036d4 100644 --- a/paddle/ir/op_base.h +++ b/paddle/ir/core/op_base.h @@ -15,8 +15,8 @@ #pragma once #include -#include "paddle/ir/operation.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/operation.h" +#include "paddle/ir/core/utils.h" namespace ir { diff --git a/paddle/ir/op_info.cc b/paddle/ir/core/op_info.cc similarity index 97% rename from paddle/ir/op_info.cc rename to paddle/ir/core/op_info.cc index f1fe019cc06..01d01c56883 100644 --- a/paddle/ir/op_info.cc +++ b/paddle/ir/core/op_info.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/op_info.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/op_info_impl.h" +#include "paddle/ir/core/op_info.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/op_info_impl.h" namespace ir { bool OpInfo::HasTrait(TypeId trait_id) const { diff --git a/paddle/ir/op_info.h b/paddle/ir/core/op_info.h similarity index 98% rename from paddle/ir/op_info.h rename to paddle/ir/core/op_info.h index 43e42d9c756..3c2ae1633ff 100644 --- a/paddle/ir/op_info.h +++ b/paddle/ir/core/op_info.h @@ -15,7 +15,7 @@ #pragma once #include #include -#include "paddle/ir/type_id.h" +#include "paddle/ir/core/type_id.h" namespace ir { class OpInfoImpl; diff --git a/paddle/ir/op_info_impl.h b/paddle/ir/core/op_info_impl.h similarity index 96% rename from paddle/ir/op_info_impl.h rename to paddle/ir/core/op_info_impl.h index 72f684c56a4..409417eee53 100644 --- a/paddle/ir/op_info_impl.h +++ b/paddle/ir/core/op_info_impl.h @@ -19,9 +19,9 @@ #include #include -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/op_base.h" -#include "paddle/ir/type.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/op_base.h" +#include "paddle/ir/core/type.h" namespace ir { class Dialect; diff --git a/paddle/ir/operation.cc b/paddle/ir/core/operation.cc similarity index 98% rename from paddle/ir/operation.cc rename to paddle/ir/core/operation.cc index b5e0d9c3ce6..4c62ed811cc 100644 --- a/paddle/ir/operation.cc +++ b/paddle/ir/core/operation.cc @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/operation.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/program.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/operation.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/program.h" +#include "paddle/ir/core/utils.h" namespace ir { Operation *Operation::create(const OperationArgument &argument) { diff --git a/paddle/ir/operation.h b/paddle/ir/core/operation.h similarity index 92% rename from paddle/ir/operation.h rename to paddle/ir/core/operation.h index 0b4f03c8e6a..7e5993ada74 100644 --- a/paddle/ir/operation.h +++ b/paddle/ir/core/operation.h @@ -15,10 +15,11 @@ #pragma once #include -#include "paddle/ir/op_info.h" -#include "paddle/ir/operation_utils.h" -#include "paddle/ir/type.h" -#include "paddle/ir/value_impl.h" +#include +#include "paddle/ir/core/op_info.h" +#include "paddle/ir/core/operation_utils.h" +#include "paddle/ir/core/type.h" +#include "paddle/ir/core/value_impl.h" namespace ir { class OpBase; @@ -104,13 +105,13 @@ class alignas(8) Operation final { AttributeMap attribute_; - ir::OpInfo op_info_; + OpInfo op_info_; uint32_t num_results_ = 0; uint32_t num_operands_ = 0; - ir::Program *parent_program_{nullptr}; + Program *parent_program_{nullptr}; }; } // namespace ir diff --git a/paddle/ir/operation_utils.cc b/paddle/ir/core/operation_utils.cc similarity index 96% rename from paddle/ir/operation_utils.cc rename to paddle/ir/core/operation_utils.cc index 07b217e8c05..e61b368bafa 100644 --- a/paddle/ir/operation_utils.cc +++ b/paddle/ir/core/operation_utils.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/operation_utils.h" +#include "paddle/ir/core/operation_utils.h" namespace ir { OperationArgument::OperationArgument(IrContext* ir_context, std::string name) { diff --git a/paddle/ir/operation_utils.h b/paddle/ir/core/operation_utils.h similarity index 94% rename from paddle/ir/operation_utils.h rename to paddle/ir/core/operation_utils.h index 26f831ee403..8deeec781e8 100644 --- a/paddle/ir/operation_utils.h +++ b/paddle/ir/core/operation_utils.h @@ -14,10 +14,10 @@ #pragma once -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/op_info.h" -#include "paddle/ir/type.h" -#include "paddle/ir/value_impl.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/op_info.h" +#include "paddle/ir/core/type.h" +#include "paddle/ir/core/value_impl.h" namespace ir { diff --git a/paddle/ir/parameter.h b/paddle/ir/core/parameter.h similarity index 98% rename from paddle/ir/parameter.h rename to paddle/ir/core/parameter.h index 38d74ea3cbf..74524537d2b 100644 --- a/paddle/ir/parameter.h +++ b/paddle/ir/core/parameter.h @@ -14,7 +14,7 @@ #pragma once -#include "paddle/ir/type.h" +#include "paddle/ir/core/type.h" namespace ir { /// diff --git a/paddle/ir/printer.cc b/paddle/ir/core/printer.cc similarity index 96% rename from paddle/ir/printer.cc rename to paddle/ir/core/printer.cc index fbb1673b569..5dc91142fb5 100644 --- a/paddle/ir/printer.cc +++ b/paddle/ir/core/printer.cc @@ -17,12 +17,12 @@ #include #include -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/operation.h" -#include "paddle/ir/program.h" -#include "paddle/ir/value.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/operation.h" +#include "paddle/ir/core/program.h" +#include "paddle/ir/core/value.h" namespace ir { diff --git a/paddle/ir/program.cc b/paddle/ir/core/program.cc similarity index 93% rename from paddle/ir/program.cc rename to paddle/ir/core/program.cc index 6b8524cee1c..01bd9e2dd57 100644 --- a/paddle/ir/program.cc +++ b/paddle/ir/core/program.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/program.h" -#include "paddle/ir/ir_context.h" +#include "paddle/ir/core/program.h" +#include "paddle/ir/core/ir_context.h" namespace ir { Program::~Program() = default; diff --git a/paddle/ir/program.h b/paddle/ir/core/program.h similarity index 92% rename from paddle/ir/program.h rename to paddle/ir/core/program.h index 5115034755e..3169772df7a 100644 --- a/paddle/ir/program.h +++ b/paddle/ir/core/program.h @@ -17,10 +17,10 @@ #include #include -#include "paddle/ir/block.h" -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/operation.h" -#include "paddle/ir/parameter.h" +#include "paddle/ir/core/block.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/operation.h" +#include "paddle/ir/core/parameter.h" namespace ir { /// diff --git a/paddle/ir/spin_lock.h b/paddle/ir/core/spin_lock.h similarity index 100% rename from paddle/ir/spin_lock.h rename to paddle/ir/core/spin_lock.h diff --git a/paddle/ir/storage_manager.cc b/paddle/ir/core/storage_manager.cc similarity index 99% rename from paddle/ir/storage_manager.cc rename to paddle/ir/core/storage_manager.cc index 3dab38a49a3..ff985f8e537 100644 --- a/paddle/ir/storage_manager.cc +++ b/paddle/ir/core/storage_manager.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/storage_manager.h" +#include "paddle/ir/core/storage_manager.h" #include #include diff --git a/paddle/ir/storage_manager.h b/paddle/ir/core/storage_manager.h similarity index 98% rename from paddle/ir/storage_manager.h rename to paddle/ir/core/storage_manager.h index be83df3fcb1..6b20afb8a80 100644 --- a/paddle/ir/storage_manager.h +++ b/paddle/ir/core/storage_manager.h @@ -18,8 +18,8 @@ #include #include -#include "paddle/ir/spin_lock.h" -#include "paddle/ir/type_id.h" +#include "paddle/ir/core/spin_lock.h" +#include "paddle/ir/core/type_id.h" namespace ir { /// diff --git a/paddle/ir/type.cc b/paddle/ir/core/type.cc similarity index 92% rename from paddle/ir/type.cc rename to paddle/ir/core/type.cc index e9c24672e5b..e4ef996a51f 100644 --- a/paddle/ir/type.cc +++ b/paddle/ir/core/type.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/type.h" -#include "paddle/ir/dialect.h" +#include "paddle/ir/core/type.h" +#include "paddle/ir/core/dialect.h" namespace ir { IrContext* Type::ir_context() const { return dialect().ir_context(); } diff --git a/paddle/ir/type.h b/paddle/ir/core/type.h similarity index 97% rename from paddle/ir/type.h rename to paddle/ir/core/type.h index 89d153c0894..019ce360050 100644 --- a/paddle/ir/type.h +++ b/paddle/ir/core/type.h @@ -16,8 +16,8 @@ #include -#include "paddle/ir/cast_utils.h" -#include "paddle/ir/type_base.h" +#include "paddle/ir/core/cast_utils.h" +#include "paddle/ir/core/type_base.h" namespace ir { /// diff --git a/paddle/ir/type_base.h b/paddle/ir/core/type_base.h similarity index 98% rename from paddle/ir/type_base.h rename to paddle/ir/core/type_base.h index 752b7e4b9b9..3b62ae87fcc 100644 --- a/paddle/ir/type_base.h +++ b/paddle/ir/core/type_base.h @@ -14,9 +14,9 @@ #pragma once -#include "paddle/ir/ir_context.h" -#include "paddle/ir/storage_manager.h" -#include "paddle/ir/type_id.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/storage_manager.h" +#include "paddle/ir/core/type_id.h" namespace ir { class Dialect; diff --git a/paddle/ir/type_id.h b/paddle/ir/core/type_id.h similarity index 100% rename from paddle/ir/type_id.h rename to paddle/ir/core/type_id.h diff --git a/paddle/ir/utils.cc b/paddle/ir/core/utils.cc similarity index 98% rename from paddle/ir/utils.cc rename to paddle/ir/core/utils.cc index 9e6f1fcaf57..eec502ee10b 100644 --- a/paddle/ir/utils.cc +++ b/paddle/ir/core/utils.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/utils.h" +#include "paddle/ir/core/utils.h" namespace ir { std::size_t hash_combine(std::size_t lhs, std::size_t rhs) { diff --git a/paddle/ir/utils.h b/paddle/ir/core/utils.h similarity index 100% rename from paddle/ir/utils.h rename to paddle/ir/core/utils.h diff --git a/paddle/ir/value.cc b/paddle/ir/core/value.cc similarity index 98% rename from paddle/ir/value.cc rename to paddle/ir/core/value.cc index 8f904cfd6f0..631f0ba7adf 100644 --- a/paddle/ir/value.cc +++ b/paddle/ir/core/value.cc @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "paddle/ir/value.h" -#include "paddle/ir/value_impl.h" +#include "paddle/ir/core/value.h" +#include "paddle/ir/core/value_impl.h" namespace ir { // Operand diff --git a/paddle/ir/value.h b/paddle/ir/core/value.h similarity index 98% rename from paddle/ir/value.h rename to paddle/ir/core/value.h index 423553f5aab..c0bb5cc4d4d 100644 --- a/paddle/ir/value.h +++ b/paddle/ir/core/value.h @@ -14,8 +14,8 @@ #pragma once -#include "paddle/ir/cast_utils.h" -#include "paddle/ir/type.h" +#include "paddle/ir/core/cast_utils.h" +#include "paddle/ir/core/type.h" namespace ir { class Operation; diff --git a/paddle/ir/value_impl.h b/paddle/ir/core/value_impl.h similarity index 99% rename from paddle/ir/value_impl.h rename to paddle/ir/core/value_impl.h index e06e086145c..889ee34faf8 100644 --- a/paddle/ir/value_impl.h +++ b/paddle/ir/core/value_impl.h @@ -14,7 +14,7 @@ #pragma once -#include "paddle/ir/value.h" +#include "paddle/ir/core/value.h" namespace ir { static const uint32_t OUTLINE_OP_RESULT_INDEX = 6; diff --git a/paddle/pass/pass.cc b/paddle/pass/pass.cc index 2d74f7a20e2..8d5222220fa 100644 --- a/paddle/pass/pass.cc +++ b/paddle/pass/pass.cc @@ -13,8 +13,8 @@ // limitations under the License. #include "paddle/pass/pass.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/operation.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/operation.h" #include "paddle/pass/pass_adaptor.h" #include "paddle/pass/pass_manager.h" diff --git a/test/cpp/ir/CMakeLists.txt b/test/cpp/ir/CMakeLists.txt index 9dc8d85f8dc..14c08067b5f 100644 --- a/test/cpp/ir/CMakeLists.txt +++ b/test/cpp/ir/CMakeLists.txt @@ -1,32 +1,5 @@ -if(WITH_NEWIR) - cc_test_old(type_test SRCS type_test.cc DEPS new_ir gtest) - cc_test_old(ir_attribute_test SRCS ir_attribute_test.cc DEPS new_ir gtest) - cc_test_old(ir_value_test SRCS ir_value_test.cc DEPS new_ir gtest) - cc_test_old(ir_op_test SRCS ir_op_test.cc DEPS new_ir gtest) - cc_test_old( - ir_program_test - SRCS - ir_program_test.cc - DEPS - new_ir - pd_dialect - phi - gtest) - - file( - DOWNLOAD - https://paddle-ci.gz.bcebos.com/ir_translator_test/restnet50_main.prog - ${CMAKE_CURRENT_BINARY_DIR}/restnet50_main.prog - EXPECTED_MD5 b64c0ad3c96d99fc37d12094623ce1ad) - - cc_test_old( - program_translator_test - SRCS - program_translator_test.cc - DEPS - program_translator - gtest - new_ir - pd_dialect) - +if(NOT WITH_NEWIR) + return() endif() + +add_subdirectory(core) diff --git a/test/cpp/ir/core/CMakeLists.txt b/test/cpp/ir/core/CMakeLists.txt new file mode 100644 index 00000000000..7abbe8c0b98 --- /dev/null +++ b/test/cpp/ir/core/CMakeLists.txt @@ -0,0 +1,29 @@ +cc_test_old(type_test SRCS type_test.cc DEPS new_ir gtest) +cc_test_old(ir_attribute_test SRCS ir_attribute_test.cc DEPS new_ir gtest) +cc_test_old(ir_value_test SRCS ir_value_test.cc DEPS new_ir gtest) +cc_test_old(ir_op_test SRCS ir_op_test.cc DEPS new_ir gtest) +cc_test_old( + ir_program_test + SRCS + ir_program_test.cc + DEPS + new_ir + pd_dialect + phi + gtest) + +file( + DOWNLOAD + https://paddle-ci.gz.bcebos.com/ir_translator_test/restnet50_main.prog + ${CMAKE_CURRENT_BINARY_DIR}/restnet50_main.prog + EXPECTED_MD5 b64c0ad3c96d99fc37d12094623ce1ad) + +cc_test_old( + program_translator_test + SRCS + program_translator_test.cc + DEPS + program_translator + gtest + new_ir + pd_dialect) diff --git a/test/cpp/ir/ir_attribute_test.cc b/test/cpp/ir/core/ir_attribute_test.cc similarity index 90% rename from test/cpp/ir/ir_attribute_test.cc rename to test/cpp/ir/core/ir_attribute_test.cc index d361a1c20d0..69a121fbecf 100644 --- a/test/cpp/ir/ir_attribute_test.cc +++ b/test/cpp/ir/core/ir_attribute_test.cc @@ -15,12 +15,12 @@ #include #include -#include "paddle/ir/attribute.h" -#include "paddle/ir/attribute_base.h" -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/builtin_dialect.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/ir_context.h" +#include "paddle/ir/core/attribute.h" +#include "paddle/ir/core/attribute_base.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/builtin_dialect.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/ir_context.h" TEST(attribute_test, attribute_base) { class AttributeA {}; diff --git a/test/cpp/ir/ir_op_test.cc b/test/cpp/ir/core/ir_op_test.cc similarity index 96% rename from test/cpp/ir/ir_op_test.cc rename to test/cpp/ir/core/ir_op_test.cc index 69ea38c487c..831a3f39b21 100644 --- a/test/cpp/ir/ir_op_test.cc +++ b/test/cpp/ir/core/ir_op_test.cc @@ -14,12 +14,12 @@ #include -#include "paddle/ir/builder.h" -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/op_base.h" +#include "paddle/ir/core/builder.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/op_base.h" /// \brief Define built-in Trait, derived from OpTraitBase. class ReadOnlyTrait : public ir::OpTraitBase { diff --git a/test/cpp/ir/ir_program_test.cc b/test/cpp/ir/core/ir_program_test.cc similarity index 97% rename from test/cpp/ir/ir_program_test.cc rename to test/cpp/ir/core/ir_program_test.cc index 9fb72fec13c..34a24a0475d 100644 --- a/test/cpp/ir/ir_program_test.cc +++ b/test/cpp/ir/core/ir_program_test.cc @@ -17,12 +17,12 @@ #include "paddle/fluid/dialect/pd_dialect.h" #include "paddle/fluid/dialect/pd_type.h" #include "paddle/fluid/dialect/utils.h" -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/builtin_dialect.h" -#include "paddle/ir/builtin_op.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/program.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/builtin_dialect.h" +#include "paddle/ir/core/builtin_op.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/program.h" +#include "paddle/ir/core/utils.h" #include "paddle/phi/core/meta_tensor.h" #include "paddle/phi/infermeta/binary.h" #include "paddle/phi/kernels/elementwise_add_kernel.h" diff --git a/test/cpp/ir/ir_value_test.cc b/test/cpp/ir/core/ir_value_test.cc similarity index 95% rename from test/cpp/ir/ir_value_test.cc rename to test/cpp/ir/core/ir_value_test.cc index 00a35db2cab..9a7fbc13810 100644 --- a/test/cpp/ir/ir_value_test.cc +++ b/test/cpp/ir/core/ir_value_test.cc @@ -14,11 +14,11 @@ #include -#include "paddle/ir/attribute.h" -#include "paddle/ir/builtin_attribute.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/operation.h" +#include "paddle/ir/core/attribute.h" +#include "paddle/ir/core/builtin_attribute.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/operation.h" // This unittest is used to test the construction interfaces of value class and // operation. The constructed test scenario is: a = OP1(); b = OP2(); c = OP3(a, diff --git a/test/cpp/ir/program_translator_test.cc b/test/cpp/ir/core/program_translator_test.cc similarity index 93% rename from test/cpp/ir/program_translator_test.cc rename to test/cpp/ir/core/program_translator_test.cc index 0035f860c58..92adc02a5e0 100644 --- a/test/cpp/ir/program_translator_test.cc +++ b/test/cpp/ir/core/program_translator_test.cc @@ -23,10 +23,10 @@ #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/translator/translate.h" -#include "paddle/ir/builtin_dialect.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/program.h" +#include "paddle/ir/core/builtin_dialect.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/program.h" using PaddleDialect = paddle::dialect::PaddleDialect; using ProgramDesc = paddle::framework::ProgramDesc; diff --git a/test/cpp/ir/type_test.cc b/test/cpp/ir/core/type_test.cc similarity index 96% rename from test/cpp/ir/type_test.cc rename to test/cpp/ir/core/type_test.cc index 36917e541e3..ea8ce1b66e6 100644 --- a/test/cpp/ir/type_test.cc +++ b/test/cpp/ir/core/type_test.cc @@ -15,13 +15,13 @@ #include #include -#include "paddle/ir/builtin_dialect.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/type.h" -#include "paddle/ir/type_base.h" -#include "paddle/ir/utils.h" +#include "paddle/ir/core/builtin_dialect.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/type.h" +#include "paddle/ir/core/type_base.h" +#include "paddle/ir/core/utils.h" TEST(type_test, type_id) { // Define two empty classes, just for testing. diff --git a/test/cpp/pass/pass_manager_test.cc b/test/cpp/pass/pass_manager_test.cc index d33c5a04222..da46ffefa1d 100644 --- a/test/cpp/pass/pass_manager_test.cc +++ b/test/cpp/pass/pass_manager_test.cc @@ -18,11 +18,11 @@ #include "glog/logging.h" -#include "paddle/ir/builtin_type.h" -#include "paddle/ir/dialect.h" -#include "paddle/ir/ir_context.h" -#include "paddle/ir/op_base.h" -#include "paddle/ir/operation.h" +#include "paddle/ir/core/builtin_type.h" +#include "paddle/ir/core/dialect.h" +#include "paddle/ir/core/ir_context.h" +#include "paddle/ir/core/op_base.h" +#include "paddle/ir/core/operation.h" #include "paddle/pass/pass.h" #include "paddle/pass/pass_manager.h" -- GitLab