Page MenuHomePhabricator

[mlir][Vector] Add folding of vector transfers from/into tensor producing ops.

Authored by nicolasvasilache on Mar 4 2021, 4:53 AM.



Add a folder to rewrite a sequence such as:

%v = vector.transfer_read %t0[%c0...], {masked = [false...]} :
  tensor<static_sizesxf32>, vector<static_sizesxf32>
%t1 = side_effect_free_tensor_producing_op : tensor<static_sizesxf32>
%t2 = vector.transfer_write %v, %t1[%c0...] {masked = [false...]} :
  vector<static_sizesxf32>, tensor<static_sizesxf32>

into just t0.

Diff Detail

Event Timeline

nicolasvasilache requested review of this revision.Mar 4 2021, 4:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2021, 4:53 AM
ftynse added inline comments.Mar 4 2021, 5:20 AM

Just drop the argument if it is not used


the doc says the producer is side-effect-free, but there's no check for this


Is there a way to make a custom op that does not have side effects ?
The issue I have right now is that I don't want a cyclic dependence on tensor ops and I would prefer to not create a special interface for this immediately.

ftynse added inline comments.Mar 4 2021, 5:33 AM

If by "custom" you mean unregistered, then no. But you can put an op in the test dialect (or maybe there's already one).


Thanks! Actually @gysit remarked offline that side effects are orthogonal here.
So is the fact that init is coming from an op at all..

Address review.

ftynse accepted this revision.Mar 4 2021, 6:16 AM
This revision is now accepted and ready to land.Mar 4 2021, 6:16 AM
This revision was landed with ongoing or failed builds.Mar 4 2021, 6:22 AM
This revision was automatically updated to reflect the committed changes.