This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Allow for using OpPassManager in pass options
ClosedPublic

Authored by rriddle on Apr 1 2022, 1:24 AM.

Details

Summary

This significantly simplifies the boilerplate necessary for passes
to define nested pass pipelines.

Diff Detail

Event Timeline

rriddle created this revision.Apr 1 2022, 1:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2022, 1:24 AM
rriddle requested review of this revision.Apr 1 2022, 1:24 AM
mehdi_amini accepted this revision.Apr 1 2022, 11:23 AM
mehdi_amini added inline comments.
mlir/lib/Transforms/Inliner.cpp
750

Not related to this change, but I'm curious if collision are expected here and if they should just be ignored?

This revision is now accepted and ready to land.Apr 1 2022, 11:23 AM
silvas accepted this revision.Apr 1 2022, 12:39 PM

Thanks River!

mlir/include/mlir/Transforms/Passes.td
84

Should defaultPipelineStr also be an OpPassManager option?

rriddle updated this revision to Diff 419948.Apr 1 2022, 11:42 PM
rriddle edited the summary of this revision. (Show Details)
rriddle marked an inline comment as done.
rriddle marked an inline comment as done.Apr 1 2022, 11:43 PM
rriddle added inline comments.
mlir/include/mlir/Transforms/Passes.td
84

Not right now given that this pipeline is op-agnostic, which we don't support for OpPassManager right now (though I do have it on my list to explore/support).

mlir/lib/Transforms/Inliner.cpp
750

I don't think we should allow collision here. Will send a followup to error out here.

This revision was automatically updated to reflect the committed changes.
rriddle marked an inline comment as done.
silvas added a comment.Apr 6 2022, 2:51 PM

Hey River, I was trying to use this downstream and it isn't working for me

I have code like:

Option<OpPassManager> pipeline{
    *this, "pipeline", llvm::cl::desc("Pipeline to run to a fixed point")};

This gives me errors about OpPassManager not having a default constructor.

Hey River, I was trying to use this downstream and it isn't working for me

I have code like:

Option<OpPassManager> pipeline{
    *this, "pipeline", llvm::cl::desc("Pipeline to run to a fixed point")};

This gives me errors about OpPassManager not having a default constructor.

Yeah, llvm's command line support doesn't like non-default constructible things (each day I come closer to diverging from it entirely). For this though, I think it should technically work after a default constructor for OpPassManager is added in D123536.