From 0379e586f15a07a472e0f5d591b465ee63a75a24 Mon Sep 17 00:00:00 2001 From: kangguangli Date: Tue, 13 Jun 2023 12:44:52 +0800 Subject: [PATCH] fix api rename (#54592) --- paddle/fluid/ir/pass/pd_op_to_kernel_pass.cc | 13 +++++-------- test/cpp/ir/core/phi_kernel_adaptor.h | 2 +- .../kernel_dialect/ir_kernel_dialect_pass_test.cc | 5 ++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/paddle/fluid/ir/pass/pd_op_to_kernel_pass.cc b/paddle/fluid/ir/pass/pd_op_to_kernel_pass.cc index d3e8fbd526d..b9f7e9f591b 100644 --- a/paddle/fluid/ir/pass/pd_op_to_kernel_pass.cc +++ b/paddle/fluid/ir/pass/pd_op_to_kernel_pass.cc @@ -71,7 +71,7 @@ phi::KernelKey GetKernelKey( int in_index = input_map.at(slot_name); dialect::AllocatedDenseTensorType type = - op->GetOperandByIndex(in_index) + op->operand(in_index) .source() .type() .dyn_cast(); @@ -98,7 +98,7 @@ phi::KernelKey GetKernelKey( for (size_t i = 0; i < input_info.size(); ++i) { // todo filter attribute tensor - auto input_tmp = op->GetOperandByIndex(i).source(); + auto input_tmp = op->operand(i).source(); auto new_input_tmp = map_value_pair.at(input_tmp); dialect::AllocatedDenseTensorType type = new_input_tmp.type().dyn_cast(); @@ -164,16 +164,13 @@ std::unique_ptr PdOpLowerToKernelPass(ir::Program* prog) { paddle::dialect::AllocatedDenseTensorType::get( ctx, phi::TransToPhiPlace(kernel_key.backend()), - (*it) - ->GetResultByIndex(0) - .type() - .dyn_cast()); + (*it)->result(0).type().dyn_cast()); // constuct input std::vector vec_inputs; if ((*it)->name() != "pd.full_" && (*it)->num_operands() > 0) { for (size_t i = 0; i < (*it)->num_operands(); ++i) { - auto cur_in = (*it)->GetOperandByIndex(i).source(); + auto cur_in = (*it)->operand(i).source(); auto new_in = map_value_pair.at(cur_in); vec_inputs.push_back(new_in); @@ -201,7 +198,7 @@ std::unique_ptr PdOpLowerToKernelPass(ir::Program* prog) { vec_inputs, op1_attribute, {allocated_dense_tensor_dtype}, op1_info); map_op_pair[*it] = op1; - map_value_pair[(*it)->GetResultByIndex(0)] = op1->GetResultByIndex(0); + map_value_pair[(*it)->result(0)] = op1->result(0); program->block()->push_back(op1); } diff --git a/test/cpp/ir/core/phi_kernel_adaptor.h b/test/cpp/ir/core/phi_kernel_adaptor.h index 1910f4bf49a..3d7a5a93090 100644 --- a/test/cpp/ir/core/phi_kernel_adaptor.h +++ b/test/cpp/ir/core/phi_kernel_adaptor.h @@ -292,7 +292,7 @@ class PhiKernelAdaptor { (*it), name_map, scope_, yaml_info, &kernel_ctx, false); kernel_fn(&kernel_ctx); - auto out_value = (*it)->GetResultByIndex(0); + auto out_value = (*it)->result(0); out_name = name_map[out_value]; } } diff --git a/test/cpp/ir/kernel_dialect/ir_kernel_dialect_pass_test.cc b/test/cpp/ir/kernel_dialect/ir_kernel_dialect_pass_test.cc index dba6c5a7686..f517ca0de53 100644 --- a/test/cpp/ir/kernel_dialect/ir_kernel_dialect_pass_test.cc +++ b/test/cpp/ir/kernel_dialect/ir_kernel_dialect_pass_test.cc @@ -62,7 +62,7 @@ TEST(program_test, program) { ctx->GetOrRegisterDialect(); - ir::Builder builder = ir::Builder::AtBlockEnd(ctx, program.block()); + ir::Builder builder = ir::Builder(ctx, program.block()); paddle::dialect::FullOp op1 = builder.Build( std::vector{2, 2}, 1.0, phi::DataType::FLOAT32, phi::CPUPlace()); @@ -70,8 +70,7 @@ TEST(program_test, program) { paddle::dialect::FullOp op2 = builder.Build( std::vector{2, 2}, 1.0, phi::DataType::FLOAT32, phi::CPUPlace()); - builder.Build(op1->GetResultByIndex(0), - op2->GetResultByIndex(0)); + builder.Build(op1->result(0), op2->result(0)); auto kernel_program = paddle::dialect::PdOpLowerToKernelPass(&program); -- GitLab