This is an archive of the discontinued LLVM Phabricator instance.

[mlir:OpFormatGen] Add Support for `$_ctxt` in the transformer.
ClosedPublic

Authored by silvas on Jun 14 2021, 5:34 PM.

Details

Summary

This is useful for "build tuple" type ops. In my case, in npcomp, I have
an op:

// Result type is `!torch.tuple<!torch.tensor, !torch.tensor>`.
torch.prim.TupleConstruct %0, %1 : !torch.tensor, !torch.tensor

and the context is required for the Torch::TupleType::get call (for
the case of an empty tuple).

The handling of these FmtContext's in the code is pretty ad-hoc -- I didn't
attempt to rationalize it and just made a targeted fix. As someone
unfamiliar with the code I had a hard time seeing how to more broadly fix
the situation.

Diff Detail

Event Timeline

silvas created this revision.Jun 14 2021, 5:34 PM
silvas requested review of this revision.Jun 14 2021, 5:34 PM
rriddle accepted this revision.Jun 14 2021, 6:00 PM
This revision is now accepted and ready to land.Jun 14 2021, 6:00 PM
This revision was landed with ongoing or failed builds.Jun 14 2021, 6:03 PM
This revision was automatically updated to reflect the committed changes.