Skip to content

Commit

Permalink
[PIR+CINN]Polish CINN Support Op Name List (#58766)
Browse files Browse the repository at this point in the history
* [PIR+CINN]Polish CINN Support Op Name List

* add multiply
  • Loading branch information
Aurelius84 authored Nov 8, 2023
1 parent b67c4cf commit 17c4134
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 3 additions & 1 deletion paddle/cinn/hlir/framework/pir/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace hlir {
namespace framework {
namespace pir {

// Mapping PaddleDialect Op into CINN AST Compute register Op
const std::unordered_map<std::string, std::string> CompatibleInfo::OP_NAMES = {
{"pd_op.full", "fill_constant"},
{"pd_op.sum", "reduce_sum"},
Expand All @@ -39,8 +40,9 @@ const std::unordered_map<std::string, std::string> CompatibleInfo::OP_NAMES = {
{"pd_op.divide", "divide"},
{"cinn_op.broadcast", "broadcast_to"}};

// Tagging PaddleDialect Op with REGITER_OP_MAPPER(OP)
const std::unordered_set<std::string> CompatibleInfo::CINN_WHITE_OPS = {
"subtract"};
"subtract", "divide", "broadcast_to", "multiply"};

bool CompatibleInfo::IsSupportCinn(const ::pir::Operation& op) {
return CINN_WHITE_OPS.find(CompatibleInfo::OpName(op)) !=
Expand Down
7 changes: 0 additions & 7 deletions paddle/fluid/pir/transforms/build_cinn_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,6 @@ bool IsSupportCinn(pir::Operation* op) {
bool registered =
::cinn::frontend::OpMapperRegistry::Global()->Find(op_name) != nullptr;

// TODO(phlrain): cinn fronted op name is not same with name in codegen
// update using a better way define allow op list
if (op_name == "subtract" || op_name == "divide" ||
op_name == "broadcast_to") {
return true;
}

OpTransInfo trans_info;
bool is_support = registered && !trans_info.default_deny_ops().count(op_name);
// if the op type is registered in CINN and allow_ops is not empty, return
Expand Down

0 comments on commit 17c4134

Please sign in to comment.