Skip to content

Commit 1fbced6

Browse files
committed
[mlir][vector] vector.fma is not ElementwiseMappable
`ElementwiseMappable` implies `Scalarizable` and `Tensorizable` but `vector.fma` only supports vector inputs.
1 parent af93db9 commit 1fbced6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

mlir/include/mlir/Dialect/Vector/IR/VectorOps.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,9 @@ def Vector_ExtractOp :
759759
def Vector_FMAOp :
760760
Op<Vector_Dialect, "fma", [
761761
Pure, AllTypesMatch<["lhs", "rhs", "acc", "result"]>,
762-
DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>
763-
] # ElementwiseMappable.traits>,
762+
DeclareOpInterfaceMethods<VectorUnrollOpInterface, ["getShapeForUnroll"]>,
763+
Elementwise, Vectorizable
764+
] >,
764765
Arguments<(ins VectorOfAnyRankOf<[AnyFloat]>:$lhs,
765766
VectorOfAnyRankOf<[AnyFloat]>:$rhs,
766767
VectorOfAnyRankOf<[AnyFloat]>:$acc)>,

mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ struct UnrollElementwisePattern : public RewritePattern {
434434

435435
LogicalResult matchAndRewrite(Operation *op,
436436
PatternRewriter &rewriter) const override {
437-
if (!OpTrait::hasElementwiseMappableTraits(op) || op->getNumResults() != 1)
437+
if (!op->hasTrait<OpTrait::Elementwise>() ||
438+
!op->hasTrait<OpTrait::Vectorizable>() || op->getNumResults() != 1)
438439
return failure();
439440
auto targetShape = getTargetShape(options, op);
440441
if (!targetShape)

0 commit comments

Comments
 (0)