未验证 提交 d1dc677a 编写于 作者: 王明冬 提交者: GitHub

[infrt] optimize the infrt rewriter pattern format. test=develop (#38694)

上级 6eac06e3
...@@ -35,8 +35,4 @@ def INFRT_cvtValueToValueRange : NativeCodeCall< ...@@ -35,8 +35,4 @@ def INFRT_cvtValueToValueRange : NativeCodeCall<
def INFRT_concatTwoValueRange : NativeCodeCall< def INFRT_concatTwoValueRange : NativeCodeCall<
"mlir::concatTwoValueRange($0, $1)">; "mlir::concatTwoValueRange($0, $1)">;
class IsBoolAttrEq<string value> : Constraint<
CPred<"($0.getValue() ==" # value # ")">,
"Bool attrbute value constraint">;
#endif // INFRT_BASE #endif // INFRT_BASE
...@@ -15,13 +15,16 @@ include "paddle/infrt/dialect/pd_ops.td" ...@@ -15,13 +15,16 @@ include "paddle/infrt/dialect/pd_ops.td"
// which corresponds to the following computation: // which corresponds to the following computation:
// (FusedFC) out = x * y + bias // (FusedFC) out = x * y + bias
// //
// while meeting the following attribute constrait:
// Matmul: transpose_x: false
// transpose_y: false
//
// Todo: // Todo:
// 1. Make the constrait more completely. // 1. Make the constrait more completely.
// 2. Consider the case of : out = bias + z // 2. Consider the case of : out = bias + z
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
def FuseMulAdd : Pat<(PD_ElementwiseAdd (PD_MatmulOp $x, $y, $transpose_x, $transpose_y, $alpha), $bias, $axis), def FuseMulAdd : Pat<(PD_ElementwiseAdd (PD_MatmulOp $x, $y, ConstBoolAttrFalse:$_, ConstBoolAttrFalse:$_, $alpha), $bias, $axis),
(PD_FusedFC $x, $y, $bias, (INFRT_createI32Attr<"1">)), (PD_FusedFC $x, $y, $bias, (INFRT_createI32Attr<"1">))>;
[(IsBoolAttrEq<"false"> $transpose_x),(IsBoolAttrEq<"false"> $transpose_y)]>;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册