This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][Standard] Update `tensor_from_elements` assembly format
ClosedPublic

Authored by frgossen on Aug 20 2020, 6:52 AM.

Details

Summary

Remove the redundant parenthesis that are used for none of the other operation
formats.

Diff Detail

Event Timeline

frgossen created this revision.Aug 20 2020, 6:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2020, 6:52 AM
frgossen requested review of this revision.Aug 20 2020, 6:52 AM
herhut accepted this revision.Sep 1 2020, 8:53 AM

Thanks for cleaning this up!

This revision is now accepted and ready to land.Sep 1 2020, 8:53 AM
rriddle added inline comments.Sep 1 2020, 8:55 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1743

Do you know why this is this not using the declarative assembly format?

frgossen added inline comments.Sep 8 2020, 5:04 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1743

It seems the assembly format cannot infer the operand types from the the result type.

rriddle added inline comments.Sep 8 2020, 5:08 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1743

That is a very common use case, you just need to add the right traits. In this case, TypesMatchWith would do it.

E.g. https://github.com/llvm/llvm-project/blob/df63eedef64d715ce1f31843f7de9c11fe1e597f/mlir/include/mlir/Dialect/StandardOps/IR/Ops.td#L1555

frgossen added inline comments.Sep 8 2020, 5:29 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1743

Not sure how that can help here.
The number of elements is variadic and I don't see how to use TypesMatchWith to derive all types simultaneously.

This revision was automatically updated to reflect the committed changes.
frgossen marked 2 inline comments as done.
herhut added inline comments.Sep 9 2020, 1:57 AM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1743
frgossen marked an inline comment as done.Sep 9 2020, 4:42 AM
frgossen added inline comments.
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1743

Nice! Now this mini-change evolved into a nice simplification :)

See https://reviews.llvm.org/D87366