Page MenuHomePhabricator

[mlir] Add SubViewOp::getOrCreateRanges and fix folding pattern

Authored by nicolasvasilache on May 11 2020, 7:15 PM.



The existing implementation of SubViewOp::getRanges relies on all
offsets/sizes/strides to be dynamic values and does not work in
combination with canonicalization. This revision adds a
SubViewOp::getOrCreateRanges to create the missing constants in the
canonicalized case.

This allows reactivating the fused pass with staged pattern

However another issue surfaces that the SubViewOp verifier is now too
strict to allow folding. The existing folding pattern is turned into a
canonicalization pattern which rewrites memref_cast + subview into
subview + memref_cast.

The transform-patterns-matmul-to-vector can then be reactivated.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald Transcript

Drop spurious methods in

Harbormaster completed remote builds in B56391: Diff 263338.
mravishankar resigned from this revision.May 11 2020, 11:07 PM

Not familiar with the folding patterns for memref cast as much, but it seems fine to me. Please let someone with more knowledge of this to review it as well.


Nit: this name is misleading. How about SubViewOpConstantArgumentFolder ?

ftynse requested changes to this revision.May 12 2020, 1:39 AM
ftynse added inline comments.

Please add documentation.


I don't understand why you do std::prev, and there is no comment to help. Normally, all standard algorithms exclude the upper bound, so this would exclude the element _before_ idx-th.


Could you please explain _how_ is it rewritten?


This needs a test.

This revision now requires changes to proceed.May 12 2020, 1:39 AM
nicolasvasilache marked an inline comment as done.


Harbormaster completed remote builds in B56530: Diff 263593.
ftynse accepted this revision.May 13 2020, 12:59 AM
This revision is now accepted and ready to land.May 13 2020, 12:59 AM
This revision was automatically updated to reflect the committed changes.