Page MenuHomePhabricator

[mlir] Introduce ViewLikeConsumerOpInterface

Authored by christopherbate on Sep 21 2022, 3:37 PM.
This is a draft revision that has not yet been submitted for review.



ViewLikeConsumerOpInterface represents an operation that can "fold" a
ViewLikeInterfaceOp producer into itself for one or more of its operands.

The new interface is meant to address issues with the current MemRef
dialect fold-memref-alias-ops transformation. The transformation
implements the ability to "fold" (or "skip over"/"bypass"/"consume")
producing ops such as memref.subview, memref.collapse_shape,
and memref.expand_shape into operations such as memref.load as
well as other dialects' ops such as vector.transfer_read. So
effectively it is implementing exactly what interfaces are for, but we
now need a real interface for other dialects (in or out of tree) to
hook into this process.

The new interface is not specific to memref, it could be used for
equivalent operations on tensors.

This is also the opportunity to position some utilities that handle the
common operations (e.g. composing "offsetStrideAndSliceInterface" ops),
allowing for de-duplication of code across the tensor and memref cases.
However, due to layering issues, we have to put these utilities under
Dialect/Affine. They can't go in Dialect/Utils or
Interfaces/ViewLikeInterface due to creation of circular dependencies.

Diff Detail