From 37cc5a68990c90441a07a7a19f5a7e69c94a50d5 Mon Sep 17 00:00:00 2001 From: winter-wang <78149749+winter-wang@users.noreply.github.com> Date: Sat, 23 Sep 2023 16:29:58 +0800 Subject: [PATCH] [PIR] rectify yield input from opresult to value. (#57635) --- paddle/pir/dialect/control_flow/ir/cf_ops.cc | 4 ++-- paddle/pir/dialect/control_flow/ir/cf_ops.h | 2 +- test/cpp/new_executor/standalone_executor_new_ir_test.cc | 4 ++-- test/cpp/pir/cinn/group_op_test.cc | 4 ++-- test/cpp/pir/control_flow_dialect/if_op_test.cc | 4 ++-- test/cpp/pir/kernel_dialect/ir_kernel_dialect_pass_test.cc | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/paddle/pir/dialect/control_flow/ir/cf_ops.cc b/paddle/pir/dialect/control_flow/ir/cf_ops.cc index 6147ab8ee40e47..7981a6ab963965 100644 --- a/paddle/pir/dialect/control_flow/ir/cf_ops.cc +++ b/paddle/pir/dialect/control_flow/ir/cf_ops.cc @@ -18,8 +18,8 @@ namespace pir { void YieldOp::Build(Builder &builder, OperationArgument &argument, - std::vector &&inputs) { - argument.AddInputs(inputs.begin(), inputs.end()); + const std::vector &inputs) { + argument.AddInputs(inputs); } } // namespace pir diff --git a/paddle/pir/dialect/control_flow/ir/cf_ops.h b/paddle/pir/dialect/control_flow/ir/cf_ops.h index 2f69aa91472245..3689920e1bce65 100644 --- a/paddle/pir/dialect/control_flow/ir/cf_ops.h +++ b/paddle/pir/dialect/control_flow/ir/cf_ops.h @@ -27,7 +27,7 @@ class IR_API YieldOp : public Op { static void Build(Builder &builder, // NOLINT OperationArgument &argument, // NOLINT - std::vector &&inputs); + const std::vector &Value); void Verify() {} }; } // namespace pir diff --git a/test/cpp/new_executor/standalone_executor_new_ir_test.cc b/test/cpp/new_executor/standalone_executor_new_ir_test.cc index eac996ffebe0f3..02ca49d180baaf 100644 --- a/test/cpp/new_executor/standalone_executor_new_ir_test.cc +++ b/test/cpp/new_executor/standalone_executor_new_ir_test.cc @@ -242,7 +242,7 @@ TEST(StandaloneExecutor, if_op) { auto full_op_1 = builder.Build( std::vector{2}, true, phi::DataType::BOOL); - builder.Build(std::vector{full_op_1.out()}); + builder.Build(std::vector{full_op_1.out()}); pir::Block* false_block = if_op.false_block(); @@ -250,7 +250,7 @@ TEST(StandaloneExecutor, if_op) { auto full_op_2 = builder.Build( std::vector{3}, true, phi::DataType::BOOL); - builder.Build(std::vector{full_op_2.out()}); + builder.Build(std::vector{full_op_2.out()}); auto kernel_program = paddle::dialect::PdOpLowerToKernelPass(&program); diff --git a/test/cpp/pir/cinn/group_op_test.cc b/test/cpp/pir/cinn/group_op_test.cc index bc1d65b51ac011..a5bd90a54f0f01 100644 --- a/test/cpp/pir/cinn/group_op_test.cc +++ b/test/cpp/pir/cinn/group_op_test.cc @@ -55,7 +55,7 @@ std::shared_ptr<::pir::Program> BuildGroupProgram() { builder.SetInsertionPointToEnd(block1); auto full_op_x = builder.Build( shape, value_one, phi::DataType::FLOAT32, phi::GPUPlace()); - builder.Build<::pir::YieldOp>(std::vector<::pir::OpResult>{full_op_x.out()}); + builder.Build<::pir::YieldOp>(std::vector<::pir::Value>{full_op_x.out()}); builder.SetInsertionPointToEnd(program->block()); auto group_op2 = builder.Build( @@ -67,7 +67,7 @@ std::shared_ptr<::pir::Program> BuildGroupProgram() { auto relu_op_x = builder.Build(tan_op_x->result(0)); auto tan_op_y = builder.Build(relu_op_x->result(0)); auto relu_op_y = builder.Build(tan_op_y->result(0)); - builder.Build<::pir::YieldOp>(std::vector<::pir::OpResult>{relu_op_y.out()}); + builder.Build<::pir::YieldOp>(std::vector<::pir::Value>{relu_op_y.out()}); return program; } diff --git a/test/cpp/pir/control_flow_dialect/if_op_test.cc b/test/cpp/pir/control_flow_dialect/if_op_test.cc index f4a7a7790866d0..f2e49b150b7bc7 100644 --- a/test/cpp/pir/control_flow_dialect/if_op_test.cc +++ b/test/cpp/pir/control_flow_dialect/if_op_test.cc @@ -44,7 +44,7 @@ TEST(if_op_test, base) { auto full_op_1 = builder.Build( std::vector{2}, true, phi::DataType::BOOL); - builder.Build(std::vector{full_op_1.out()}); + builder.Build(std::vector{full_op_1.out()}); pir::Block* false_block = if_op.false_block(); @@ -52,7 +52,7 @@ TEST(if_op_test, base) { auto full_op_2 = builder.Build( std::vector{3}, true, phi::DataType::BOOL); - builder.Build(std::vector{full_op_2.out()}); + builder.Build(std::vector{full_op_2.out()}); std::stringstream ss; program.Print(ss); diff --git a/test/cpp/pir/kernel_dialect/ir_kernel_dialect_pass_test.cc b/test/cpp/pir/kernel_dialect/ir_kernel_dialect_pass_test.cc index 52773cc96e9289..1c0eaebe0a909b 100644 --- a/test/cpp/pir/kernel_dialect/ir_kernel_dialect_pass_test.cc +++ b/test/cpp/pir/kernel_dialect/ir_kernel_dialect_pass_test.cc @@ -195,7 +195,7 @@ TEST(kernel_dialect, cond_op_test) { auto full_op_1 = builder.Build( std::vector{2}, true, phi::DataType::BOOL); - builder.Build(std::vector{full_op_1.out()}); + builder.Build(std::vector{full_op_1.out()}); pir::Block* false_block = if_op.false_block(); @@ -203,7 +203,7 @@ TEST(kernel_dialect, cond_op_test) { auto full_op_2 = builder.Build( std::vector{3}, true, phi::DataType::BOOL); - builder.Build(std::vector{full_op_2.out()}); + builder.Build(std::vector{full_op_2.out()}); program.Print(std::cout); auto kernel_program = paddle::dialect::PdOpLowerToKernelPass(&program);