[mlir][Linalg] Extend generic ops to allow tensors
authorNicolas Vasilache <ntv@google.com>
Tue, 31 Dec 2019 14:28:18 +0000 (09:28 -0500)
committerNicolas Vasilache <ntv@google.com>
Thu, 2 Jan 2020 18:54:57 +0000 (13:54 -0500)
commit2140a973f272969b5391532f3c0b7c90aafd803b
tree5459c67a91dfa71b31f6d158a9c79dbfb9bc2ee3
parent9d49e5c0876f7cf75ce0b5d8b3c8473300eb096a
[mlir][Linalg] Extend generic ops to allow tensors

    Summary:
    This diff adds support to allow `linalg.generic` and
    `linalg.indexed_generic` to take tensor input and output
    arguments.

    The subset of output tensor operand types must appear
    verbatim in the result types after an arrow. The parser,
    printer and verifier are extended to accomodate this
    behavior.

    The Linalg operations now support variadic ranked tensor
    return values. This extension exhibited issues with the
    current handling of NativeCall in RewriterGen.cpp. As a
    consequence, an explicit cast to `SmallVector<Value, 4>`
    is added in the proper place to support the new behavior
    (better suggestions are welcome).

    Relevant cleanups and name uniformization are applied.

    Relevant invalid and roundtrip test are added.

    Reviewers: mehdi_amini, rriddle, jpienaar, antiagainst, ftynse

    Subscribers: burmako, shauheen, llvm-commits

    Tags: #llvm

    Differential Revision: https://reviews.llvm.org/D72022
16 files changed:
mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgTraits.h
mlir/include/mlir/Dialect/Linalg/Transforms/LinalgTransformPatterns.td
mlir/include/mlir/Dialect/Linalg/Transforms/LinalgTransforms.h
mlir/include/mlir/Dialect/VectorOps/VectorTransforms.h
mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
mlir/lib/Dialect/Linalg/EDSC/Builders.cpp
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/lib/Dialect/Linalg/Transforms/LinalgTransforms.cpp
mlir/lib/Dialect/VectorOps/VectorTransforms.cpp
mlir/test/Dialect/Linalg/invalid.mlir
mlir/test/Dialect/Linalg/roundtrip.mlir
mlir/test/lib/DeclarativeTransforms/TestLinalgTransformPatterns.td
mlir/tools/mlir-tblgen/RewriterGen.cpp