Fix Linalg tiling for the partial tile case.
authorNicolas Vasilache <ntv@google.com>
Thu, 23 May 2019 20:00:16 +0000 (13:00 -0700)
committerMehdi Amini <joker.eph@gmail.com>
Sun, 2 Jun 2019 02:58:43 +0000 (19:58 -0700)
commit997c7c4a8d4fc5c8b961a5ca8ac31f6ff479ef66
treede5fd048ff7dbb03b7107215a595c2aac08a463f
parentc84286773c2cfdea0daee71aae0f7a7d23eee7b1
Fix Linalg tiling for the partial tile case.

    This CL prepares for mixing lowering of tiled linalg operations to loops with load and store operations. In particular it is necessary to capture partial tile information in views. This CL makes slice ops during Linalg tiling properly stop at partial tile boundaries by implementing `min` with a `cmpi` and `select` over values of index type.

    To be consistent with lowering to loops, the implementation of tiling also drops specifics of accessing values via ranges and instead uses ranges of the form
    `[0, dim(view), 1]` for creating view slices. This simplifies the code for the implementation of tiling and utils.

    This also allows removing restrictions around needing a View or SliceOp defined in the current function context (as well as all it RangeOps). The restriction removal is tested by making the dot test operate directly on views.

    The above is still subject to folding of the linalg.dim operation left for a future CL.

    At this time, mixing tiling and lowering to loops all the way to execution is not yet functional because affine.for does not allow arbitrarily defined values of index type as its operands.

    The previously introduced linalg.range_intersection was not sufficient to capture the necessary information and still required dealing with max quantities.
    A followup CL will remove linalg.range_intersection.

--

PiperOrigin-RevId: 249698823
mlir/include/mlir/Linalg/Utils/Utils.h
mlir/lib/Linalg/IR/LinalgOps.cpp
mlir/lib/Linalg/Transforms/LowerToLoops.cpp
mlir/lib/Linalg/Transforms/Tiling.cpp
mlir/lib/Linalg/Utils/Utils.cpp
mlir/test/Linalg/tile.mlir