This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add canonicaliations for subtensor_insert operation.
ClosedPublic

Authored by mravishankar on Mar 1 2021, 10:12 AM.

Details

Summary

Add canonicalizers to subtensor_insert operations need canonicalizers
that propagate the constant arguments within offsets, sizes and
strides. Also add pattern to propogate tensor_cast operations.

Diff Detail

Event Timeline

mravishankar created this revision.Mar 1 2021, 10:12 AM
mravishankar requested review of this revision.Mar 1 2021, 10:12 AM
rriddle added inline comments.Mar 1 2021, 10:21 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
3310

Why do you need this method?

mravishankar added inline comments.Mar 1 2021, 10:48 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
3310

It is used in SubTensorInsertOpCastFolder below. When you output type changes, this adds the cast so that replacement works fine. The cast is canonicalized away later.

rriddle added inline comments.Mar 1 2021, 10:53 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
3310

Why do you need a new function for that? That is what I meant. This looks like something that would just be inlined into the pattern.

Address comments

Remove unneeded method.

mlir/lib/Dialect/StandardOps/IR/Ops.cpp
3310

Fair enough. I just copied what was done for subtensor and subview above. But that was done since those two ops use the same template method. Removed this.

mravishankar added inline comments.Mar 1 2021, 11:16 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
3310

At least I thought I did. Let me reupload.

rriddle accepted this revision.Mar 1 2021, 11:22 AM
rriddle added inline comments.
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
3800

copy/paste? : subview

3808
3828–3831
3836

nit: Drop trivial braces.

This revision is now accepted and ready to land.Mar 1 2021, 11:22 AM

Rebase and fix stale comments.

mravishankar marked 6 inline comments as done.

Addressing missed comments.

Harbormaster completed remote builds in B91395: Diff 327203.
This revision was landed with ongoing or failed builds.Mar 1 2021, 2:59 PM
This revision was automatically updated to reflect the committed changes.