TOSA-to-Linalg lowering for element-wise ops
authorRafael Ubal Tena <rubal@mathworks.com>
Fri, 21 Jul 2023 21:48:11 +0000 (14:48 -0700)
committerEric Kunze <eric.kunze@arm.com>
Fri, 21 Jul 2023 22:08:33 +0000 (22:08 +0000)
commitb2d76a063dd7fb681c98a10d8e7f54fd6d25dd27
tree3e9de377e4778ab4ce6d4a1564d7ffdf0a199255
parentcbf2a6ce197e8176c01316fe25400aae0b7390c4
TOSA-to-Linalg lowering for element-wise ops

- Wrote complete documentation for the `Broadcastable` op trait. This is mostly meant as a thorough description of its previous behavior, with the exception of minor feature updates.

- Restricted legality criteria for a `Broadcastable` op in order to simplify current and future lowering passes and increase efficiency of code generated by those passes. New restriction are: 1) A dynamic dimension in an inferred result is not compatible with a static dimension in the actual result. 2) Broadcast semantics are restricted to input operands and not supported between inferred and actual result shapes.

- Implemented TOSA-to-Linalg lowering support for unary, binary, tertiary element-wise ops. This support is complete for all legal cases described in the `Broadcastable` trait documentation.

- Added unit tests for `tosa.abs`, `tosa.add`, and `tosa.select` as examples of unary, binary, and tertiary ops.

Reviewed By: eric-k256

Differential Revision: https://reviews.llvm.org/D153291
mlir/docs/Traits/Broadcastable.md [new file with mode: 0644]
mlir/docs/Traits/_index.md [moved from mlir/docs/Traits.md with 95% similarity]
mlir/include/mlir/Dialect/Tosa/IR/TosaOpBase.td
mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp
mlir/lib/Dialect/Traits.cpp
mlir/test/Conversion/TosaToLinalg/tosa-to-linalg.mlir
mlir/test/Dialect/traits.mlir