From 9189a6b4cc73a132b0ae431d65535e1bda6f1b2f Mon Sep 17 00:00:00 2001 From: Yuanle Liu Date: Sun, 4 Jun 2023 16:25:52 +0800 Subject: [PATCH] [IR] adjust some API name (#54331) * adjust some API name * fix inference.a undefined reference to utf8proc --- paddle/fluid/dialect/pd_dialect.cc | 2 +- paddle/fluid/inference/CMakeLists.txt | 2 +- paddle/ir/core/ir_printer.cc | 4 ++-- paddle/ir/core/program.h | 2 +- paddle/ir/core/type.cc | 2 +- paddle/ir/core/type.h | 2 +- test/cpp/ir/core/ir_program_test.cc | 2 +- test/cpp/ir/core/program_translator_test.cc | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/paddle/fluid/dialect/pd_dialect.cc b/paddle/fluid/dialect/pd_dialect.cc index b9772a4dcd1..032811bb70c 100644 --- a/paddle/fluid/dialect/pd_dialect.cc +++ b/paddle/fluid/dialect/pd_dialect.cc @@ -116,7 +116,7 @@ void PaddleDialect::PrintType(ir::Type type, std::ostream &os) { os << d; os << "x"; } - tensor_type.dtype().print(os); + tensor_type.dtype().Print(os); os << ">"; } diff --git a/paddle/fluid/inference/CMakeLists.txt b/paddle/fluid/inference/CMakeLists.txt index 083ef059688..598997360d5 100644 --- a/paddle/fluid/inference/CMakeLists.txt +++ b/paddle/fluid/inference/CMakeLists.txt @@ -33,7 +33,7 @@ endif() # fluid_modules exclude API-interface of inference/api and inference/capi_exp get_property(fluid_modules GLOBAL PROPERTY FLUID_MODULES) get_property(phi_modules GLOBAL PROPERTY PHI_MODULES) -set(utils_modules pretty_log string_helper benchmark) +set(utils_modules pretty_log string_helper benchmark utf8proc) add_subdirectory(api) diff --git a/paddle/ir/core/ir_printer.cc b/paddle/ir/core/ir_printer.cc index 80ffdacd9ae..a7a962bd204 100644 --- a/paddle/ir/core/ir_printer.cc +++ b/paddle/ir/core/ir_printer.cc @@ -233,7 +233,7 @@ class IRPrinter : public BasicIRPrinter { std::unordered_map aliases_; }; -void Program::print(std::ostream& os) { +void Program::Print(std::ostream& os) { IRPrinter printer(os); printer.PrintProgram(this); } @@ -243,7 +243,7 @@ void Operation::Print(std::ostream& os) { printer.PrintOperation(this); } -void Type::print(std::ostream& os) const { +void Type::Print(std::ostream& os) const { BasicIRPrinter printer(os); printer.PrintType(*this); } diff --git a/paddle/ir/core/program.h b/paddle/ir/core/program.h index 1177e098488..74eb649447c 100644 --- a/paddle/ir/core/program.h +++ b/paddle/ir/core/program.h @@ -50,7 +50,7 @@ class Program { ModuleOp module_op() { return module_; } - void print(std::ostream& os); + void Print(std::ostream& os); Block* block() { return module_.block(); } diff --git a/paddle/ir/core/type.cc b/paddle/ir/core/type.cc index e4ef996a51f..e93d9f63e8c 100644 --- a/paddle/ir/core/type.cc +++ b/paddle/ir/core/type.cc @@ -19,7 +19,7 @@ namespace ir { IrContext* Type::ir_context() const { return dialect().ir_context(); } std::ostream& operator<<(std::ostream& os, Type type) { - type.print(os); + type.Print(os); return os; } diff --git a/paddle/ir/core/type.h b/paddle/ir/core/type.h index 019ce360050..45a34b0ccf8 100644 --- a/paddle/ir/core/type.h +++ b/paddle/ir/core/type.h @@ -78,7 +78,7 @@ class Type { return ir::dyn_cast(*this); } - void print(std::ostream &os) const; + void Print(std::ostream &os) const; /// /// \brief Enable hashing Type. diff --git a/test/cpp/ir/core/ir_program_test.cc b/test/cpp/ir/core/ir_program_test.cc index 1390db703a1..8196f7d5188 100644 --- a/test/cpp/ir/core/ir_program_test.cc +++ b/test/cpp/ir/core/ir_program_test.cc @@ -231,7 +231,7 @@ TEST(program_test, program) { EXPECT_EQ(program.block()->size() == 4, true); EXPECT_EQ(program.parameters_num() == 3, true); - program.print(std::cout); + program.Print(std::cout); } TEST(program_test, slice_combine_test) { diff --git a/test/cpp/ir/core/program_translator_test.cc b/test/cpp/ir/core/program_translator_test.cc index b98bedd016f..0ee3876c176 100644 --- a/test/cpp/ir/core/program_translator_test.cc +++ b/test/cpp/ir/core/program_translator_test.cc @@ -59,5 +59,5 @@ TEST(PaddleDialectTest, Translator) { // ops.size() = op size in BlockDesc + get_parameter_op + combine op EXPECT_EQ(op_size, p.Block(0).OpSize() + program->parameters_num() + 21); - std::cout << *program << std::endl; + program->Print(std::cout); } -- GitLab