Refactor LowerVectorTransfersPass using pattern rewriters
authorAlex Zinenko <zinenko@google.com>
Mon, 17 Dec 2018 22:11:31 +0000 (14:11 -0800)
committerjpienaar <jpienaar@google.com>
Fri, 29 Mar 2019 21:31:43 +0000 (14:31 -0700)
commit4dbd94b5435e1e1e23984d023637dbb77fa89cbd
tree5a8e22586e8f62236da7f99c2a066a99acfde994
parent699a2f537369623f62ad5ceac78211c8982bccba
Refactor LowerVectorTransfersPass using pattern rewriters

This introduces a generic lowering pass for ML functions.  The pass is
parameterized by template arguments defining individual pattern rewriters.
Concrete lowering passes define individual pattern rewriters and inherit from
the generic class that takes care of allocating rewriters, traversing ML
functions and performing the actual rewrite.

While this is similar to the greedy pattern rewriter available in
Transform/Utils, it requires adjustments due to the ML/CFG duality.  In
particular, ML function rewriters must be able to create statements, not only
operations, and need access to an MLFuncBuilder.  When we move to using the
unified function type, the ML-specific rewriting will become unnecessary.

Use LowerVectorTransfers as a testbed for the generic pass.

PiperOrigin-RevId: 225887424
mlir/include/mlir/Transforms/MLPatternLoweringPass.h [new file with mode: 0644]
mlir/lib/Transforms/LowerVectorTransfers.cpp