Page MenuHomePhabricator

[mlir][python] Need based additions to work with unregistered ops and do simple transforms.
DraftPublic

Authored by stellaraccident on Jan 17 2022, 8:39 PM.
This is a draft revision that has not yet been submitted for review.

Details

Reviewers
None
Summary
  • A few fixes to make unregistered dialects more useful for this API:
    • Add 'register_all_dialects=' (default True) Context constructor arg. This bypasses the built-in registration of all dialects (which we really need to retire anyway but this is at least a step).
    • Only attempts to create custom OpViews for registered ops. Previously, if you happened to have generated OpView code on your path but had not registered the dialect with the context, it would be loaded anyway, which is, in general, not correct (i.e. unregistered ops can be anything and the contract for generated code assumes they are specifically what is defined).
  • Moves some methods that were only defined on Operation to _OperationBase which makes them shared with OpViews. Afaict, these were just bugs and were put in the wrong place.
  • Add Value.replace_all_uses_with.

Diff Detail