This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Shape] Add a pattern to turn extract from shape_of into tensor.dim
ClosedPublic

Authored by bkramer on Oct 12 2021, 9:05 AM.

Details

Summary

If I remember correctly this wasn't done previously because dim used to
be in the memref dialect.

Diff Detail

Event Timeline

bkramer created this revision.Oct 12 2021, 9:05 AM
bkramer requested review of this revision.Oct 12 2021, 9:05 AM

Do we need to limit this to where $arg is a Tensor?

mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td
19

Add comment ?

53

Is this taking the front because there should be only 1 index as shape of should result in 1D shape?

mlir/test/Dialect/Shape/canonicalize.mlir
1390

Nit: C0 ? it just makes it easier for me to read below (or make %c1 above)

frgossen accepted this revision.Oct 12 2021, 9:44 AM

Thanks!

mlir/test/Dialect/Shape/canonicalize.mlir
1389

%c1?

This revision is now accepted and ready to land.Oct 12 2021, 9:44 AM
bkramer updated this revision to Diff 379090.Oct 12 2021, 9:59 AM

Address review comments

Do we need to limit this to where $arg is a Tensor?

tensor.extract only works on tensors, so I think !shape.shape cannot happen.

This revision was landed with ongoing or failed builds.Oct 12 2021, 10:09 AM
This revision was automatically updated to reflect the committed changes.