[mlir][linalg] Update Structured Op Interface (NFC).

Adding methods to access operand properties via OpOperands and mark outdated methods as deprecated.

Differential Revision: https://reviews.llvm.org/D103394
This commit is contained in:
Tobias Gysi 2021-05-31 12:46:32 +00:00
parent 63fe4cb082
commit 0a52d9006c
3 changed files with 739 additions and 535 deletions

View File

@ -25,6 +25,11 @@ namespace mlir {
namespace linalg {
class LinalgOp;
/// OpOperand vector that implicitly converts to a Value vector.
struct OpOperandVector : public SmallVector<OpOperand *> {
operator SmallVector<Value>();
};
/// Returns the values obtained by applying `map` to the list of values.
SmallVector<Value, 4> applyMapToValues(OpBuilder &b, Location loc,
AffineMap map, ValueRange values);

File diff suppressed because it is too large Load Diff

View File

@ -155,6 +155,14 @@ LogicalResult mlir::linalg::detail::verifyContractionInterface(Operation *op) {
// StructuredOpInterface implementation
//===----------------------------------------------------------------------===//
OpOperandVector::operator SmallVector<Value>() {
SmallVector<Value> result;
result.reserve(this->size());
llvm::transform(*this, std::back_inserter(result),
[](OpOperand *opOperand) { return opOperand->get(); });
return result;
}
/// Fully compose map with operands and canonicalize the result.
/// Return the `createOrFold`'ed AffineApply op.
static Value createFoldedComposedAffineApply(OpBuilder &b, Location loc,