Skip to content

Commit

Permalink
Merge pull request PaddlePaddle#24 from zyfncg/drr_pass
Browse files Browse the repository at this point in the history
Fix merge confilct of fused_gemm_epilogue_pass
  • Loading branch information
yuanlehome authored Sep 1, 2023
2 parents f3c1d88 + 9235c31 commit 91a5036
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
31 changes: 16 additions & 15 deletions paddle/fluid/ir/dialect/paddle_dialect/ir/pd_manual_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,12 @@ OpInfoTuple FusedGemmEpilogueOp::GetOpInfo() {
"out", "paddle::dialect::DenseTensorType", false, false),
paddle::dialect::OpOutputInfo(
"reserve_space", "paddle::dialect::DenseTensorType", true, false)};
paddle::dialect::OpRunTimeInfo run_time_info = paddle::dialect::OpRunTimeInfo(
paddle::dialect::OpRunTimeInfo run_time_info(
"FusedGemmEpilogueInferMeta",
{"x", "y", "bias", "trans_x", "trans_y", "activation"},
{""},
{""},
{""},
{},
{},
{});
Expand Down Expand Up @@ -397,20 +398,20 @@ OpInfoTuple FusedGemmEpilogueGradOp::GetOpInfo() {
"y_grad", "paddle::dialect::DenseTensorType", false, false),
paddle::dialect::OpOutputInfo(
"bias_grad", "paddle::dialect::DenseTensorType", false, false)};
paddle::dialect::OpRunTimeInfo run_time_info =
paddle::dialect::OpRunTimeInfo("FusedGemmEpilogueGradInferMeta",
{"x",
"y",
"reserve_space",
"out_grad",
"trans_x",
"trans_y",
"activation_grad"},
{""},
{""},
{},
{},
{});
paddle::dialect::OpRunTimeInfo run_time_info("FusedGemmEpilogueGradInferMeta",
{"x",
"y",
"reserve_space",
"out_grad",
"trans_x",
"trans_y",
"activation_grad"},
{""},
{""},
{""},
{},
{},
{});

return std::make_tuple(
inputs, attributes, outputs, run_time_info, "fused_gemm_epilogue_grad");
Expand Down
7 changes: 7 additions & 0 deletions paddle/fluid/ir/drr/api/drr_pattern_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ class ResultPattern {
return ctx_->ResultTensorPattern(name);
}

// Represent the input tensor which is none.
// Example:
// instance_norm has follow input tensor : (x, scale, bias), scale and
// bias are optional(means it may be none).
// When scale is onoe, we can write a instance_norm op in drr as follow:
// res.Op("instance_norm")(res.Tensor("x"), res.NoneTensor,
// res.Tensor("bias"));
drr::Tensor& NoneTensor() {
return ctx_->ResultTensorPattern(Tensor::NONE_TENSOR_NAME);
}
Expand Down

0 comments on commit 91a5036

Please sign in to comment.