[StructuredOps][Linalg] Add a primitive pattern to rewrite the linalg.generic form...
authorNicolas Vasilache <ntv@google.com>
Mon, 9 Dec 2019 17:14:05 +0000 (09:14 -0800)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Mon, 9 Dec 2019 17:14:39 +0000 (09:14 -0800)
commit91c0074624a2ba7f3f56617da75afe70713b82b2
treee28afd4a368fbefb3ccea8fc5b9f3197f3c967a0
parent70aeb4566e35541ffeef28050babc1c9580b43eb
[StructuredOps][Linalg] Add a primitive pattern to rewrite the linalg.generic form of matmul to vector form.

This CL uses the newly expanded matcher support to easily detect when a linalg.generic has a multiply-accumulate body. A linalg.generic with such a body is rewritten as a vector contraction.
This CL additionally limits the rewrite to the case of matrix multiplication on contiguous and statically shaped memrefs for now.

Before expanding further, we should harden the infrastructure for expressing custom ops with the structured ops abstraction.

PiperOrigin-RevId: 284566659
mlir/include/mlir/Dialect/Linalg/IR/LinalgLibraryOps.td
mlir/include/mlir/Dialect/Linalg/Transforms/LinalgTransformPatterns.td
mlir/include/mlir/Dialect/Linalg/Transforms/LinalgTransforms.h
mlir/include/mlir/Dialect/VectorOps/VectorOps.td
mlir/lib/Dialect/Linalg/CMakeLists.txt
mlir/lib/Dialect/Linalg/Transforms/LinalgTransforms.cpp
mlir/lib/Dialect/VectorOps/VectorOps.cpp
mlir/test/Dialect/Linalg/transform-patterns.mlir
mlir/test/lib/DeclarativeTransforms/TestLinalgTransformPatterns.td