[MLIR] Support for vectorizing operations.
authorNicolas Vasilache <ntv@google.com>
Wed, 14 Nov 2018 12:04:10 +0000 (04:04 -0800)
committerjpienaar <jpienaar@google.com>
Fri, 29 Mar 2019 20:56:47 +0000 (13:56 -0700)
commitfefbf9131400a404c5a81ef51726d517b6beba75
tree4383d6212d857ec0acd554f489b14853a7127a11
parent07b594de46fa4a7d9593fd81fc53b3df32afa5c1
[MLIR] Support for vectorizing operations.

This CL adds support for and a vectorization test to perform scalar 2-D addf.

The support extension notably comprises:
1. extend vectorizable test to exclude vector_transfer operations and
expose them to LoopAnalysis where they are needed. This is a temporary
solution a concrete MLIR Op exists;
2. add some more functional sugar mapKeys, apply and ScopeGuard (which became
relevant again);
3. fix improper shifting during coarsening;
4. rename unaligned load/store to vector_transfer_read/write and simplify the
design removing the unnecessary AllocOp that were introduced prematurely:
vector_transfer_read currently has the form:
  (memref<?x?x?xf32>, index, index, index) -> vector<32x64x256xf32>
vector_transfer_write currently has the form:
  (vector<32x64x256xf32>, memref<?x?x?xf32>, index, index, index) -> ()
5. adds vectorizeOperations which traverses the operations in a ForStmt and
rewrites them to their vector form;
6. add support for vector splat from a constant.

The relevant tests are also updated.

PiperOrigin-RevId: 221421426
mlir/include/mlir/Analysis/LoopAnalysis.h
mlir/include/mlir/Support/Functional.h
mlir/lib/Analysis/LoopAnalysis.cpp
mlir/lib/Analysis/MLFunctionMatcher.cpp
mlir/lib/Transforms/Vectorize.cpp
mlir/test/Transforms/vectorize.mlir