Page MenuHomePhabricator

[MLIR][Shape] Add canonicalization pattern for `shape.rank`
ClosedPublic

Authored by frgossen on Thu, Jun 18, 2:52 AM.

Details

Summary

Replace any rank(shape_of(tensor)) that relies on a ranked tensor with the
corresponding constant const_size.

Depends On D82076

Diff Detail

Event Timeline

frgossen created this revision.Thu, Jun 18, 2:52 AM
Herald added a reviewer: silvas. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
silvas accepted this revision.Thu, Jun 18, 9:45 AM

Awesome, thanks!

mlir/lib/Dialect/Shape/IR/Shape.cpp
465

nit: getDefiningOp<ShapeOfOp>()

rriddle added inline comments.Thu, Jun 18, 10:09 AM
mlir/lib/Dialect/Shape/IR/Shape.cpp
369

nit: inline this variable into its only use.

459

Can you documentation to this pattern? Even just a little code block of the transformation being performed.

frgossen updated this revision to Diff 272060.Fri, Jun 19, 7:08 AM
frgossen marked 3 inline comments as done.

Address comments

frgossen retitled this revision from [MLIR][Shape] Add canonicalization pattern for `shape.get_size` to [MLIR][Shape] Add canonicalization pattern for `shape.rank` .Fri, Jun 19, 7:09 AM
frgossen edited the summary of this revision. (Show Details)
frgossen retitled this revision from [MLIR][Shape] Add canonicalization pattern for `shape.rank` to [MLIR][Shape] Add canonicalization pattern for `shape.rank`.
pifon2a accepted this revision.Fri, Jun 19, 9:27 AM
jpienaar accepted this revision.Mon, Jun 22, 2:43 PM

Nice, thanks

mlir/lib/Dialect/Shape/IR/Shape.cpp
465

Is there a : missing before tensor<...> ?

This revision is now accepted and ready to land.Mon, Jun 22, 2:43 PM
rriddle added inline comments.Mon, Jun 22, 2:45 PM
mlir/lib/Dialect/Shape/IR/Shape.cpp
458

Please use /// for top-level comments.

frgossen updated this revision to Diff 273250.Thu, Jun 25, 1:37 AM
frgossen marked 2 inline comments as done.

Address comments

This revision was automatically updated to reflect the committed changes.