This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Move `linalg.tensor_expand/collapse_shape` to TensorDialect.
ClosedPublic

Authored by pifon2a on Dec 10 2021, 2:55 AM.

Details

Summary

RFC: https://llvm.discourse.group/t/rfc-reshape-ops-restructuring/3310

linalg.fill gets a canonicalizer, because FoldFillWithTensorReshape cannot be moved to tensorops (it uses linalg::FillOp inside). Before it was listed as a canonicalization pattern for the reshape operations, now it became a canonicalization for FillOp.

Diff Detail

Event Timeline

pifon2a created this revision.Dec 10 2021, 2:55 AM
pifon2a requested review of this revision.Dec 10 2021, 2:55 AM
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
221

IIUC you need this to change the anchor point of canonicalization?
Could you please specify it in the commit message?

pifon2a accepted this revision.Dec 10 2021, 3:04 AM
pifon2a edited the summary of this revision. (Show Details)
pifon2a marked an inline comment as done.

Thank you! Added a comment.

This revision is now accepted and ready to land.Dec 10 2021, 3:05 AM
pifon2a resigned from this revision.Dec 10 2021, 3:05 AM
This revision now requires review to proceed.Dec 10 2021, 3:05 AM
nicolasvasilache accepted this revision.Dec 10 2021, 3:13 AM
nicolasvasilache added a subscriber: gysit.

Awesome, thanks much @pifon2a !

mlir/include/mlir/Dialect/Tensor/IR/TensorInferTypeOpInterfaceImpl.h
31

Thanks for spelling this out, this has been an issue for some time and will need to be addressed but in the meantime this is a good step forward.
Thanks for putting in the effort to untangle cycles despite the pain!

mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp
551–554

I understand this reanchoring can be changed once we have a tensor dialect op that replaces FillOp ?
@gysit could you please make a note of this?

This revision is now accepted and ready to land.Dec 10 2021, 3:13 AM
This revision was landed with ongoing or failed builds.Dec 10 2021, 3:14 AM
This revision was automatically updated to reflect the committed changes.
mehdi_amini added inline comments.Jan 21 2022, 3:36 PM
mlir/include/mlir/InitAllDialects.h
88

I'm very concerned by this. This looks like a big hack, did you check with someone like River before doing something like this in the core infra?