Skip to content

Commit b4464e9

Browse files
committed
feat: remove legalization from tosa.custom to linalg.
1 parent eb28bbc commit b4464e9

File tree

2 files changed

+0
-41
lines changed

2 files changed

+0
-41
lines changed

mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,6 @@ createLinalgBodyCalculationForElementwiseOp(Operation *op, ValueRange args,
544544
}
545545
}
546546

547-
// tosa::CustomOp
548-
if (auto customOp = dyn_cast<tosa::CustomOp>(op)) {
549-
// Only legalize tosa.custom_op's that are marked as implementable with
550-
// 'linalg.generic' by looking at the 'implementation_attrs' attribute
551-
auto implementationAttr = customOp.getImplementationAttrs();
552-
if (implementationAttr == "linalg.generic") {
553-
OperationState state(loc, customOp.getOperatorName(), args,
554-
resultTypes);
555-
return rewriter.create(state)->getResult(0);
556-
}
557-
}
558-
559547
(void)rewriter.notifyMatchFailure(
560548
op, "unhandled op for linalg body calculation for elementwise op");
561549
return nullptr;
@@ -2480,7 +2468,6 @@ void mlir::tosa::populateTosaToLinalgConversionPatterns(
24802468
PointwiseConverter<tosa::FloorOp>,
24812469
PointwiseConverter<tosa::ClampOp>,
24822470
PointwiseConverter<tosa::SigmoidOp>,
2483-
PointwiseConverter<tosa::CustomOp>,
24842471
IdentityNConverter<tosa::IdentityOp>,
24852472
ReduceConverter<tosa::ReduceAllOp>,
24862473
ReduceConverter<tosa::ReduceAnyOp>,

mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,34 +1698,6 @@ func.func @table8_dyn_table(%arg0: tensor<6xi8>, %arg1: tensor<?xi8>) -> () {
16981698

16991699
// -----
17001700

1701-
// CHECK-LABEL: @test_custom_ops
1702-
func.func @test_custom_ops(%arg0: tensor<1xf32>, %arg1: tensor<1xf32>) -> () {
1703-
// CHECK: linalg.generic
1704-
// CHECK: math.sin
1705-
// CHECK: linalg.generic
1706-
// CHECK: math.atan2
1707-
%2 = "tosa.custom"(%arg0) <{domain_name = "UNDEF", operator_name = "math.sin", implementation_attrs = "linalg.generic"}> : (tensor<1xf32>) -> tensor<1xf32>
1708-
%3 = "tosa.custom"(%arg0, %arg1) <{domain_name = "UNDEF", operator_name = "math.atan2", implementation_attrs = "linalg.generic"}> : (tensor<1xf32>, tensor<1xf32>) -> tensor<1xf32>
1709-
1710-
return
1711-
}
1712-
1713-
// -----
1714-
1715-
// CHECK-LABEL: @test_custom_ops_dyn
1716-
func.func @test_custom_ops_dyn(%arg0: tensor<?xf32>, %arg1: tensor<?xf32>) -> () {
1717-
// CHECK: linalg.generic
1718-
// CHECK: math.cos
1719-
// CHECK: linalg.generic
1720-
// CHECK: math.atan2
1721-
%2 = "tosa.custom"(%arg0) <{domain_name = "UNDEF", operator_name = "math.cos", implementation_attrs = "linalg.generic"}> : (tensor<?xf32>) -> tensor<?xf32>
1722-
%3 = "tosa.custom"(%arg0, %arg1) <{domain_name = "UNDEF", operator_name = "math.atan2", implementation_attrs = "linalg.generic"}> : (tensor<?xf32>, tensor<?xf32>) -> tensor<?xf32>
1723-
1724-
return
1725-
}
1726-
1727-
// -----
1728-
17291701
// CHECK: #[[$MAP0:.*]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d3, d4)>
17301702
// CHECK: #[[$MAP1:.*]] = affine_map<(d0, d1, d2, d3, d4) -> (d0, d1, d2)>
17311703

0 commit comments

Comments
 (0)