This is an archive of the discontinued LLVM Phabricator instance.

[mlir] add user-level documentation for Python bindings
ClosedPublic

Authored by ftynse on Oct 11 2021, 5:54 AM.

Details

Summary

Until now, we only had documentation oriented towards developers of the
bindings. Provide some documentation for users of the bindings that don't want
or need to understand the inner workings.

Diff Detail

Event Timeline

ftynse created this revision.Oct 11 2021, 5:54 AM
ftynse requested review of this revision.Oct 11 2021, 5:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2021, 5:54 AM
nicolasvasilache accepted this revision.Oct 11 2021, 6:09 AM
nicolasvasilache added inline comments.
mlir/docs/Bindings/Python.md
305

typo

451

typo: access

538

is this the encouraged way to use isa in python ?

578

typo: and

618

grammo: operations

This revision is now accepted and ready to land.Oct 11 2021, 6:09 AM
ftynse updated this revision to Diff 378678.Oct 11 2021, 8:21 AM
ftynse marked 4 inline comments as done.

Address review.

mlir/docs/Bindings/Python.md
538

I'd say this is the way to do dyn_cast. For isa, it should be possible to call OpResult.isinstance(value) similarly to types, but somebody needs to add it.

ftynse edited the summary of this revision. (Show Details)Oct 11 2021, 8:22 AM
This revision was landed with ongoing or failed builds.Oct 11 2021, 8:23 AM
This revision was automatically updated to reflect the committed changes.
mlir/docs/Bindings/Python.md
362

Remove "maintain it"

477

s/does not have/is not of/

516

Since people always ask, maybe note that by convention, Attribute subclasses provide a static get method (or close variant like get_signless for cases when an attribute can be identified in different ways) used to get a uniqued instance from the context.

Thanks for improving the doc!

ftynse marked 3 inline comments as done.Oct 13 2021, 5:42 AM
mlir/docs/Bindings/Python.md
516

It's written below in the "creating IR objects / attributes and types" section.