diff --git a/paddle/CMakeLists.txt b/paddle/CMakeLists.txt index af7c030993535f39b3813e3ce7c8c0487e2f0675..531324c250c2e2a54f608a5b80a1786c57afcebf 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 3d06cd4d64c1fa590a4d655cd0799bab5bdd8b89..44d55d57225e91f542de0f460ba05e3a48d1d920 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 94930d0f1331042d1a27c0e4ac1e1da51e0d8c44..163f7149e11596a0b6fcb142623734ceb921dc6a 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 59481f1cedc14a2d95192d11b0975e892bcf45c1..6afcd4b2bd0cfa0436cc9b67441e5914c34f3e2a 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 352dcc8b0e434326fa5228570ceab9b71608d742..c524a360877dc1f739cac0c050eb673fa0c49f97 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 a11dd5fb6da7747861c2a18780dad66144e824bc..c5d648d3838742c3171ddfa2f9ab042b46b9ea70 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 6b1312e69137d192d8842e1b4e6fec7efbb1d88e..069827bedcf9a1b1a3ee64b7f8da946c2735631c 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 e07951bbf93bcb5859439e2bc09334a46cb5191d..8e9f1e6c54c8151258ad1bcc98b4e2d6b7709ce7 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 e52d81db1dd83dd1eaad0c3db6437105d7aea114..3104edb80f8ee7f26a067b8cc91e318dbea65aa8 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 69af6fd1ddce80b8aac1f6bb4b1f7fa2764603eb..56c6db01a8250cfb494df7c747caca7946520bac 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 9654f1f09ec558751f1afd3c54151b25d8221749..222edc45e68f654633b881dd67048c9a9606e5d0 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 92c03458300257c6b3813e58b4db2e59abc52158..17c1b306a9fbff5b0b1e95c45708d6e8f1e5c27a 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 7618972f1080409797cdd78fafd22caf6a5314b4..f3af3a3db54e4ffc5de818ade10818ab28568576 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 f7fd4e2890ea64ae4a5a8d434816837fd107c321..148ac9b0563f19d8821c7f0c03270219fb32726d 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 40af6ce539467a22fd9fa3b7ebfae14d42b3664c..eaf9c35d4035f3cf4b9a9b55bb95d5f083bb663c 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 9cf013ea2bca36d259e7a8d489dbc21badeec930..4c7e224fd1e5d91501fe32f842c142c48139271f 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 e0c31913ffefe2c641eb61edefab3ce081b9babd..c677ec8682d610e42ad702839769baef2fcb163f 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 707b8913f3385d9a23c5d70c1a79a316527a8bf2..e32757cd105ecc245379a8012247e09e23540813 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 084ee7e52cada2eef2f8fd11133f64dfe970c302..14c08067b5f3568427cc2388371f8cbf1c35ad4a 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 0000000000000000000000000000000000000000..dde617e33a05025a9901397d0fe15eee9def2689 --- /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 0d70a47f4d174e67e6e4a15e3c153287abd33d01..77e768720e36b0b556a91f692d5531b3973a3db1 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 db556ce9652e95b105e66a0ffa12fdbfa096217f..4f269187b751b3e8ab2ac42652dd975a68743cdf 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 eaf0deb899f3422f0a671b038660e2d92c0c6334..8ad3c877416015eb0e44b130573cf27ce9735bfe 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 9603eff00f162698595062929d0874e65b3e2845..62263a8f1a383d33c794a097e950e5cef48b0044 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 3176bfe4c9e9c0aab5e4adb24c0aefa7d8eca715..3bc4ef8247881a798d1fa2bd1fcc4911522d4da8 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 842e8c63bcf79c558bc0a3a12cd5f82638a645fc..107b846774779ff8259c10dfbcf2a4e2437cbb84 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 c1762ca1441cdb75796cef401e99e787a61a44f6..e1f3de2b7269183324042c904200063c1c397456 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 ba95318df6f5cb5a267f9e94883f22d65fb1e55c..78bd2903be34a9f1a06a2176b3c93960730b4f3c 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 468bf1be6ab23fac9cd680118e618383b7c2780e..edad980136f115fe2714ceced5a566913c35a371 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 d91c4c44f639bde38b0c669453ac6a171a889e29..101c4781beb2efa0e66a96263651f2740f268875 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 32f8750b7109416647e86433b42363929433bbd1..bdbb2736f12e04996b8d74bbe3425a2f239675ae 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 5016c1abea074649e2e86e33425193edb74e4a79..ff7da2d7f5da5e3a2f6de7db9fa7afa0a79b011f 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 63bfc2196dca35ac8d4a6cab63dfeee138b467c8..023c96d7e13d14db030569d5adf9edc0e7950694 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 d1d2c20b5725dbe04818cd6ff493d51b9c97112a..ffe357ed9e99358f31c6c81641cab989d95fd4cb 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 8929496b5deac52de2f7138409fadebdf2ab79f5..d9ee429a5f6d358784b93fdd5923e84601db31a9 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 cb7dd8a853d9ff1ffd86a6addf4c741aba66fa14..ea0d93a5397424dda0cb34aad358d568fa755be6 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 576457fe11992bc84306cf4dd13afef34311a8d7..5c6f255461b1e7f57eab6398144b89704e4d7d58 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 8764daf861aa205c34b570bd6fc3b63deadbb879..fe53c14f1f0fc65f97599a7d67d2d42fc8d9d4fe 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 18a95d5844af51b8ae5f572abe1875f5ba07cc05..8d199ff77d7eb4096f0c3290f08daed497cf47a8 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 dd3ec08af52fd61029b9436be480a660463351a9..0363ca0ebac1784e7f57444c6cfb2eece0568091 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 dd922a7359f428897de1b718243ebe89c5dc8296..2c03bbd05b2413ad10d041b2641ba06ddd9d882a 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 30e5a68e9330e0cc8baa54efc8ecc9cb7115286f..7ddc948c66a2d93807b81cf95e578ac608236487 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 47fa243b1c44e1b2016c2b7b3c9802a9a37c8d77..20d7d7036d4f59f1795a3b039c7b271e64abc9dc 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 f1fe019cc06e710686ddbe484f64d141057ab3d3..01d01c56883bfedaa131da7b5b23abaa1a12ce40 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 43e42d9c756362411ae3c54d21716519eb2025d4..3c2ae1633ff06910da0d3f8843edd59cce56804e 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 72f684c56a4fd4808a4d2b6c6ff6911e5947fc59..409417eee537b3b765792e603c9570e8e85f3491 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 b5e0d9c3ce642aab935234be1f7c301ed9533c9c..4c62ed811cc969612f617380712a91c0f66d8904 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 0b4f03c8e6a3e8cddeb9f9223acedb5ae985f97a..7e5993ada74b515580e4c165bd94f556cabf6e16 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 07b217e8c05f93ef07a574f2d5438b3913601fc7..e61b368bafa81c1ecf9a6dd3dc3c1bffa641d0bf 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 26f831ee4039bd6fcb71f7648e5f9ccb38f10575..8deeec781e84046d0b19aec4f8a01d51a810736c 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 38d74ea3cbff2e5f3db2b8aaab5fdf26575a1b4a..74524537d2bf44b5eab0c8984e1983d37e2390d0 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 fbb1673b5698ff129cc79f87d75b20f729ebfb83..5dc91142fb5e28b3da2307aac2349a6576932bd9 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 6b8524cee1ca0690302bf92f89cf2536f7ead7f3..01bd9e2dd575e4e04284ff30ac6948e8c1afb038 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 5115034755edf668fe5431d4af8f44b66ab1280c..3169772df7ae98cdf78eb5a93656b5e02843d7b0 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 3dab38a49a36b42a531b114b811b125c1b6e77f1..ff985f8e537d1dfe8049a99a80c0ef2465def715 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 be83df3fcb10150bc61359d4e2dfcaf9cf319851..6b20afb8a8067cca8b72def14f8cb9058eccfce6 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 e9c24672e5b5e4bed0015078f9c1a7522eecf558..e4ef996a51fb86e5c66924333809feb61a8cc6cf 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 89d153c089476e8373427c0c4cf1c5c3ecf6edc2..019ce360050125ae79e1be2409ad236f9ec76f1f 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 752b7e4b9b97671374e76d186b817fef517521a3..3b62ae87fcc60734d7f158b1f5a2cb6d0141e2f2 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 9e6f1fcaf579012d69cc629a34c9b04b1c812368..eec502ee10b1f3eb6a591826dc961ba18e5c453b 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 8f904cfd6f0afb700cb71bcd616a66dceb8f297d..631f0ba7adfd2a196d18d807149e6c0e24e64c50 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 423553f5aab7f7e642536054d59d1ca59cc523c9..c0bb5cc4d4d9990ee2cd7c01493501104e926343 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 e06e086145c609781092adeeabaf9f0c0b97c88a..889ee34faf8a19c296f608b1a7158b04b0781715 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 2d74f7a20e2cb0c916b150f70934520bbe40d844..8d5222220fa0ca827361d6046201ad17d4905135 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 9dc8d85f8dc0d06b31a9d39a4bac7602a5cd788a..14c08067b5f3568427cc2388371f8cbf1c35ad4a 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 0000000000000000000000000000000000000000..7abbe8c0b984b702938cc6a9f18c950f0d60e6ed --- /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 d361a1c20d09a4ab9bd1d9d4fe6bf835a9a3cac3..69a121fbecfd27cd113aa21278cb592b90138fae 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 69ea38c487ca1a71dda88b9038b9d3ad362cff9f..831a3f39b2196b54af0923bc0f3faf108f12dd14 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 9fb72fec13c23bfb52d2550b27ec2e07e384b6d9..34a24a0475d916823fef62308692bc6e1b5ad55c 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 00a35db2cabfe2bd9ea66d6913546ee36dd5354e..9a7fbc1381055f4784523e12e4c7fc7abb863bd0 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 0035f860c5861b0527316c3a8b4a32da9343694d..92adc02a5e0484dd9e50ade981c3757eec70ccec 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 36917e541e3154b66acb0a41f7b673fdaddbfed2..ea8ce1b66e6324aee3815171270dec05cb6e9f8e 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 d33c5a04222c5c6799585dcdcff012bf16dafdd5..da46ffefa1d9067a0c8bf0bccde63771770cadd3 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"