This is an archive of the discontinued LLVM Phabricator instance.

[mlir][CAPI] Allow specifying pass manager anchor
ClosedPublic

Authored by rkayaith on Oct 20 2022, 5:36 PM.

Details

Summary

This adds a new function for creating pass managers that takes an
argument for the anchor string.

Diff Detail

Event Timeline

rkayaith created this revision.Oct 20 2022, 5:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2022, 5:36 PM
rkayaith updated this revision to Diff 469449.Oct 20 2022, 6:41 PM
rkayaith edited the summary of this revision. (Show Details)

description

rkayaith published this revision for review.Oct 20 2022, 6:51 PM
rkayaith added a reviewer: mehdi_amini.

I'm a bit hesitant if we should rename C API in this kind of case to make sure the build breakage is visible through the symbol name change?

I could rename it to something like mlirPassManagerCreateWithAnchor but it's a bit unfortunate, mlirPassManagerCreate feels like the "right" name. Or maybe there should be both: mlirPassManagerCreate which uses the default anchor (builtin.module for now, but should probably be changed to any) and mlirPassManagerCreateWithAnchor with the anchor argument?

And I suppose the same thing about renaming applies to D136403?

I could rename it to something like mlirPassManagerCreateWithAnchor but it's a bit unfortunate, mlirPassManagerCreate feels like the "right" name. Or maybe there should be both: mlirPassManagerCreate which uses the default anchor (builtin.module for now, but should probably be changed to any) and mlirPassManagerCreateWithAnchor with the anchor argument?

And I suppose the same thing about renaming applies to D136403?

Yes, I'd wait for @ftynse and @stellaraccident to chime in here.

I don't have a strong opinion. We don't (yet) offer any sort of API stability guarantees at this level, so just changing it is fine. There will be a compiler error, it's not like changing the type from one pointer to another. On the other hand, having mlirPassManagerCreate to work on builtin.module sounds like a reasonable default and we can have a more verbose mlirPassManagerCreateOnOperation that also needs a more verbose argument.

I don't have a strong opinion. We don't (yet) offer any sort of API stability guarantees at this level, so just changing it is fine. There will be a compiler error, it's not like changing the type from one pointer to another. On the other hand, having mlirPassManagerCreate to work on builtin.module sounds like a reasonable default and we can have a more verbose mlirPassManagerCreateOnOperation that also needs a more verbose argument.

I concur with Alex. I have a slight preference for the mlirPassManagerCreateOnOperation approach but wouldn't insist on it.

rkayaith updated this revision to Diff 470923.Oct 26 2022, 1:49 PM
rkayaith retitled this revision from [mlir][CAPI] Include anchor op in mlirPassManagerCreate to [mlir][CAPI] Allow specifying pass manager anchor.
rkayaith edited the summary of this revision. (Show Details)

create new function, mlirPassManagerCreateOnOperation, instead of changing the existing one

mehdi_amini accepted this revision.Oct 26 2022, 8:49 PM
This revision is now accepted and ready to land.Oct 26 2022, 8:49 PM
This revision was automatically updated to reflect the committed changes.