This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Make `print-op-generic` print generic DialectSymbol.
Needs RevisionPublic

Authored by bollu on May 27 2022, 8:23 AM.

Details

Summary

This permits external consumers of MLIR to easily parse attributes/types,
since we guarantee to print the generic form of the attribute/type
as !dialect<"name<args>"> / #dialect<"name<args>">.

Diff Detail

Event Timeline

bollu created this revision.May 27 2022, 8:23 AM
Herald added a project: Restricted Project. · View Herald Transcript
bollu requested review of this revision.May 27 2022, 8:23 AM
rriddle requested changes to this revision.May 27 2022, 11:34 AM

You can already easily parse attributes/types (they have a limited syntax, see what the MLIR parser does for this), and we are actively trying to remove the string form.

This revision now requires changes to proceed.May 27 2022, 11:34 AM
bollu updated this revision to Diff 432609.May 27 2022, 11:42 AM

Rebase on latest build, fix tests

@rriddle as an external consumer of MLIR, it is quite annoying to have to parse both foo<"..."> as well as foo.bar<balanced-parens>.

It would be much more pleasant to have one or the other, *especially* since it seems like foo<"..."> isn't going anywhere anytime soon, since the syntax opaque syntax of a raw string is more expressive than the pretty syntax. [For example, as you know, the opaque syntax allows the string to have imbalanced parentheses such as foo<">">.]

rriddle requested changes to this revision.May 27 2022, 11:55 AM

@rriddle as an external consumer of MLIR, it is quite annoying to have to parse both foo<"..."> as well as foo.bar<balanced-parens>.

It would be much more pleasant to have one or the other, *especially* since it seems like foo<"..."> isn't going anywhere anytime soon, since the syntax opaque syntax of a raw string is more expressive than the pretty syntax. [For example, as you know, the opaque syntax allows the string to have imbalanced parentheses such as foo<">">.]

I understand the frustration, but making things easier for external users to parse is not a motivating driver for developments/stability/etc. of the MLIR parser. This is especially true when they desires are counter to the direction that we want to drive the project.

This revision now requires changes to proceed.May 27 2022, 11:55 AM

since it seems like foo<"..."> isn't going anywhere anytime soon, since the syntax opaque syntax of a raw string is more expressive than the pretty syntax. [For example, as you know, the opaque syntax allows the string to have imbalanced parentheses such as foo<">">.]

@rriddle maybe you can expand on this? In particular since you mentioned

we are actively trying to remove the string form.