Skip to content

Commit e42a0b8

Browse files
authored
Merge pull request #37 from Xilinx/tiagot.tosa_custom_op_support
Support lowering tosa.custom_op to another dialect operation.
2 parents d319b8c + 07d8cd0 commit e42a0b8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,13 @@ createLinalgBodyCalculationForElementwiseOp(Operation *op, ValueRange args,
506506
}
507507
}
508508

509+
// tosa::CustomOp
510+
if (auto customOp = dyn_cast<tosa::CustomOp>(op)) {
511+
return llvm::StringSwitch<Value>(customOp.getIdentifierAttr().str())
512+
.Case("atan2", rewriter.create<math::Atan2Op>(loc, resultTypes, args))
513+
.Default(nullptr);
514+
}
515+
509516
(void)rewriter.notifyMatchFailure(
510517
op, "unhandled op for linalg body calculation for elementwise op");
511518
return nullptr;
@@ -2067,6 +2074,7 @@ void mlir::tosa::populateTosaToLinalgConversionPatterns(
20672074
PointwiseConverter<tosa::FloorOp>,
20682075
PointwiseConverter<tosa::ClampOp>,
20692076
PointwiseConverter<tosa::SigmoidOp>,
2077+
PointwiseConverter<tosa::CustomOp>,
20702078
IdentityNConverter<tosa::IdentityOp>,
20712079
ReduceConverter<tosa::ReduceAllOp>,
20722080
ReduceConverter<tosa::ReduceAnyOp>,

0 commit comments

Comments
 (0)