This is an archive of the discontinued LLVM Phabricator instance.

[mlir][ODS] Add support for passing properties to `custom`
ClosedPublic

Authored by zero9178 on Jul 12 2023, 4:33 AM.

Details

Summary

Printing and parsing properties of ops is currently only possible through the prop-dict attribute. This forces a specific place that the property is printed at and is generally not very flexible.

This patch adds support of passing properties to the custom directive, making it possible to incorporate them with more complex syntax. This makes it possible to parse and print them without generic syntax and without the use of prop-dict.

Diff Detail

Event Timeline

zero9178 created this revision.Jul 12 2023, 4:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2023, 4:33 AM
zero9178 requested review of this revision.Jul 12 2023, 4:33 AM
zero9178 updated this revision to Diff 539539.Jul 12 2023, 6:44 AM

clang-format

Mogball accepted this revision.Jul 12 2023, 9:03 AM
This revision is now accepted and ready to land.Jul 12 2023, 9:03 AM

Does ref($prop) work in a custom directive?

mlir/test/lib/Dialect/Test/TestOps.td
3349–3351
mlir/tools/mlir-tblgen/OpFormatGen.cpp
98

This is missing the typical comment

Does ref($prop) work in a custom directive?

Not right now no. It currently errors out as they are currently only valid in the context of a custom directive. Wasn't planning to implement it this revision but can do so if you like.

Doesn't have to be in this one. Thanks for the patch!

jpienaar accepted this revision.Jul 12 2023, 10:48 AM

Thanks!

mlir/tools/mlir-tblgen/OpFormatGen.cpp
3098

Could you sort these while here?

Thanks! (if ref can be added it'd be even better :))

zero9178 marked 3 inline comments as done.Jul 13 2023, 12:03 AM