Page MenuHomePhabricator

[MLIR] Add type conversion for `shape.shape`
ClosedPublic

Authored by frgossen on Jun 4 2020, 6:59 AM.

Details

Summary

Convert shape.shape to tensor<?xindex> when lowering the shape to the
std dialect.

Diff Detail

Event Timeline

frgossen created this revision.Jun 4 2020, 6:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 4 2020, 6:59 AM
pifon2a added inline comments.Jun 4 2020, 7:13 AM
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
60

why is it always dynamic?

frgossen marked an inline comment as done.Jun 4 2020, 7:25 AM
frgossen added inline comments.
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
60

The actual shape is not dynamic but the shape type is really not holding that information at compile time.
I would not know how to concretise this here without extending the shape type itself.

jpienaar accepted this revision.Jun 4 2020, 8:13 AM
jpienaar marked an inline comment as done.
jpienaar added inline comments.
mlir/lib/Conversion/ShapeToStandard/ShapeToStandard.cpp
60

Yes this is where the type/value boundary gets spanned (what is part of the type in tensor is part of the value in shape).

We could expand shape's type to hold rank (known, unknown, error) but starting with dynamic and having this be refined along with the lowering of the rest of the shape computations should work too.

This revision is now accepted and ready to land.Jun 4 2020, 8:13 AM
frgossen marked an inline comment as done.Jun 8 2020, 2:31 AM
This revision was automatically updated to reflect the committed changes.