This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Change the syntax of dense arrays
ClosedPublic

Authored by Mogball on Aug 11 2022, 4:11 PM.

Details

Summary

Follow-up to D123774, where the syntax of dense arrays was discussed. It
was included that the syntax should be changed to array<i32: 1, 2>.
This patch changes the syntax but importantly preserves the [1, 2]
syntax when embedding these attributes in assembly formats through ODS.

Diff Detail

Event Timeline

Mogball created this revision.Aug 11 2022, 4:11 PM
Herald added a reviewer: ftynse. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Mogball requested review of this revision.Aug 11 2022, 4:11 PM
jpienaar accepted this revision.Aug 11 2022, 4:17 PM
jpienaar added a subscriber: jpienaar.

Thanks for this cleanup!

mlir/include/mlir/IR/BuiltinAttributes.td
179–181

Borderline between dropping : when empty, but consistency in printing parsing pushed towards what you did.

This revision is now accepted and ready to land.Aug 11 2022, 4:17 PM
Mogball added inline comments.Aug 11 2022, 4:18 PM
mlir/include/mlir/IR/BuiltinAttributes.td
179–181

Yes, this looks weird. I honestly prefer array<1, 2, 3> : i8 but that requires parsing ahead...

mehdi_amini accepted this revision.Aug 11 2022, 4:21 PM

Thanks!

This revision was landed with ongoing or failed builds.Aug 11 2022, 5:56 PM
This revision was automatically updated to reflect the committed changes.

Awesome, thank you for pushing this forward. What do y'all think about changing the empty syntax to just array<i8>? It looks weird to have the colon there in the empty case.

mlir/test/IR/attribute.mlir
538

What do y'all think about changing the empty syntax to just array<i8>? It looks weird to have the colon there in the empty case.

A Space instead of the colon LGTM assuming we won’t have any kind of ambiguity (I don’t think so but …)

Thanks for tackling this!

The proposed change for the empty syntax LGTM.