OSDN Git Service

[mlir] Refactor affine loop nest builders
authorAlex Zinenko <zinenko@google.com>
Thu, 18 Jun 2020 15:53:50 +0000 (17:53 +0200)
committerAlex Zinenko <zinenko@google.com>
Thu, 18 Jun 2020 21:03:13 +0000 (23:03 +0200)
commit8647a9bc511bd47ca80ae48761662436066a09bb
tree481b594130ffe52a01c36b324db16eb5ebe79231
parent80d7ac3bc7c04975fd444e9f2806e4db224f2416
[mlir] Refactor affine loop nest builders

Existing implementation of affine loop nest builders relies on EDSC
ScopedContext, which is not used pervasively. Provide a common OpBuilder-based
helper function to construct a perfect nest of affine loops with the body of
the innermost loop populated by a callback. Use this function to implement the
EDSC version.

Affine "for" loops differ from SCF "for" loops by (1) not allowing to yield
values and (2) supporting short-hand form for constant bounds, which justifies
a separate implementation of the loop nest builder for the same of simplicity.

Differential Revision: https://reviews.llvm.org/D81955
mlir/include/mlir/Dialect/Affine/IR/AffineOps.h
mlir/lib/Dialect/Affine/EDSC/Builders.cpp
mlir/lib/Dialect/Affine/IR/AffineOps.cpp