Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CINN][Backend Pass Update No.11] Update schedule_block_dce pass #70498

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions paddle/cinn/hlir/framework/pir/op_lowering_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
#include "paddle/cinn/ir/group_schedule/config/group_tile_config.h"
#include "paddle/cinn/ir/ir_analyzer/ir_analyzer.h"
#include "paddle/cinn/ir/schedule/ir_schedule.h"
#include "paddle/cinn/ir/utils/stmt_converter.h"
#include "paddle/cinn/lang/placeholder.h"
#include "paddle/cinn/operator_fusion/fusion_interface.h"
#include "paddle/cinn/optim/check_tensor_buffer_map.h"
#include "paddle/cinn/optim/eliminate_common_global_memory_read.h"
#include "paddle/cinn/optim/schedule_block_dce.h"
#include "paddle/cinn/optim/schedule_block_dce_pass.h"
#include "paddle/cinn/optim/transform_gpu_forloop.h"
#include "paddle/cinn/pass/pass_manager.h"
#include "paddle/common/ddim.h"
#include "paddle/common/enforce.h"
#include "paddle/fluid/pir/dialect/operator/ir/op_type.h"
Expand Down Expand Up @@ -368,7 +370,20 @@ std::vector<ir::LoweredFunc> OpLowererImpl::PostProcess(
std::vector<ir::LoweredFunc> lowered_funcs;
for (int i = 0; i < func_bodies.size(); ++i) {
ir::Expr func_body = func_bodies[i];
optim::EliminateDeadScheduleBlock(&(func_body), group->output_names());

if (func_body.As<ir::Block>()) {
VLOG(6) << "Before CreateEliminateDeadScheduleBlockPass: \n" << func_body;
ir::stmt::BlockRef _block = ir::ConvertExprBlockToStmtBlock(func_body);
VLOG(6) << "Expr2Stmt: \n" << _block;

optim::BlockPassManager pass_manager;
pass_manager.AddPass(
optim::CreateEliminateDeadScheduleBlockPass(group->output_names()));
pass_manager.Run(_block);
func_body = ir::ConvertStmtBlockToExprBlock(_block);
VLOG(6) << "After CreateEliminateDeadScheduleBlockPass: \n" << func_body;
}

if (i != func_bodies.size() - 1) {
cinn::common::DefaultDeviceTarget().arch.Match(
[&](std::variant<common::UnknownArch,
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/hlir/framework/pir/trivial_op_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "paddle/cinn/ir/schedule/ir_schedule.h"
#include "paddle/cinn/ir/schedule/ir_schedule_util.h"
#include "paddle/cinn/lang/placeholder.h"
#include "paddle/cinn/optim/schedule_block_dce.h"
#include "paddle/cinn/optim/schedule_block_dce_pass.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有用到的头文件直接删除吧,下同

#include "paddle/cinn/optim/transform_gpu_forloop.h"
#include "paddle/common/ddim.h"
#include "paddle/common/enforce.h"
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/hlir/framework/pir/trivial_op_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "paddle/cinn/ir/schedule/ir_schedule_util.h"
#include "paddle/cinn/lang/placeholder.h"
#include "paddle/cinn/operator_fusion/pattern_graph.h"
#include "paddle/cinn/optim/schedule_block_dce.h"
#include "paddle/cinn/optim/schedule_block_dce_pass.h"
#include "paddle/cinn/optim/transform_gpu_forloop.h"
#include "paddle/common/ddim.h"
#include "paddle/fluid/pir/dialect/operator/ir/op_type.h"
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/hlir/framework/pir/trivial_op_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "paddle/cinn/ir/schedule/ir_schedule.h"
#include "paddle/cinn/ir/schedule/ir_schedule_util.h"
#include "paddle/cinn/lang/placeholder.h"
#include "paddle/cinn/optim/schedule_block_dce.h"
#include "paddle/cinn/optim/schedule_block_dce_pass.h"
#include "paddle/cinn/optim/transform_gpu_forloop.h"
#include "paddle/common/ddim.h"
#include "paddle/common/enforce.h"
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/hlir/framework/pir/trivial_op_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "paddle/cinn/ir/group_schedule/base_group_scheduler.h"
#include "paddle/cinn/ir/schedule/ir_schedule.h"
#include "paddle/cinn/lang/placeholder.h"
#include "paddle/cinn/optim/schedule_block_dce.h"
#include "paddle/cinn/optim/schedule_block_dce_pass.h"
#include "paddle/cinn/optim/transform_gpu_forloop.h"
#include "paddle/common/ddim.h"
#include "paddle/common/enforce.h"
Expand Down
2 changes: 1 addition & 1 deletion paddle/cinn/optim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ gather_srcs(
resize_buffer.cc
update_buffer_axis_pass.cc
trans_buffer_with_dynamic_shape.cc
schedule_block_dce.cc
schedule_block_dce_pass.cc
eliminate_common_factor_of_local_index.cc
if_fusion_pass.cc
merge_block_utils.cc
Expand Down
169 changes: 0 additions & 169 deletions paddle/cinn/optim/schedule_block_dce.cc

This file was deleted.

Loading
Loading