This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Linalg] Refactor Linalg op initTensors support - NFC
ClosedPublic

Authored by nicolasvasilache on Sep 29 2020, 5:24 AM.

Details

Summary

Manually-defined named ops do not currently support init_tensors or return values and may never support them. Add extra interface to the StructuredOpInterface so that we can still write op-agnostic transformations based on StructuredOpInterface.

This is an NFC extension in preparation for tiling on tensors.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptSep 29 2020, 5:24 AM
nicolasvasilache requested review of this revision.Sep 29 2020, 5:24 AM
ftynse accepted this revision.Sep 29 2020, 5:33 AM
ftynse added inline comments.
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
30

Typo: "and usage"

mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOpsInterface.td
388

I think I already asked this question elsewhere, but don't remember the answer. Do you expect non-default implementation of this method? If not, I don't see the point of paying the cost of having it as an interface method instead of having it in extraClassDeclarations.

mlir/include/mlir/Dialect/Linalg/IR/LinalgTraits.h
41

I don't think you need ::Impl for non-parametric traits.

45–46

Nit: doubly public

This revision is now accepted and ready to land.Sep 29 2020, 5:33 AM
pifon2a accepted this revision.Sep 29 2020, 6:34 AM
pifon2a added inline comments.
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
67

will all (or most) these ops with ZeroInitTensors have always one output? If yes, then it might make sense to just have a base class PolyadicLinalgStructured_Op which is parameterized by the number of inputs and already sets number of outputs to 1 and number of inits to 0? Just a suggestion, no need to do anything.

nicolasvasilache marked 4 inline comments as done.Sep 29 2020, 6:37 AM
nicolasvasilache added inline comments.
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOpsInterface.td
388

The extraClassDeclarations of what ?
How do you write portable transformations without having the method as part of the interface ?

nicolasvasilache marked 2 inline comments as done.Sep 29 2020, 6:38 AM
nicolasvasilache added inline comments.
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
67

Ideally these would just go away and be replaced by full auto-generated ops.
For now this is allows implementing tiling on tensors, even though these ops are not concerned with it.

nicolasvasilache marked an inline comment as done.

Address review

ftynse added inline comments.Sep 29 2020, 6:41 AM
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOpsInterface.td
388
nicolasvasilache marked an inline comment as done.Sep 29 2020, 6:54 AM
nicolasvasilache added inline comments.
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOpsInterface.td
388

ok, I'll do a standalone CL to move all methods that don't depend on $_op to extraClassDeclaration.

nicolasvasilache marked an inline comment as done.

Rebase.

This revision was landed with ongoing or failed builds.Sep 29 2020, 6:57 AM
This revision was automatically updated to reflect the committed changes.