-
Notifications
You must be signed in to change notification settings - Fork 58
Issue #1762: Pipelines should have one source of truth #2259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Set pipelineList in mlir/include/DefaultPipelines.h as the only source of truth for pipeline and pass names. Update mlir/lib/Driver/Pipelines.cpp to use getEnforceRuntimeInvariantsPipeline() function from DefaultPipelines.h. Update frontend/catalyst/pipelines.py to use get_enforce_runtime_invariants_stage() function from default_pipelines nanobind module. Add fmt library dependency to mlir/lib/Driver. Add default_pipelines nanobind module to frontend/catalyst. At the moment, it only exports a couple of functions, one to get the pipeline names, and the other to get the pass names of the EnforceRuntimeInvariants stage. Move nanobind configuration code from frontend/catalyst/utils to frontend. Add catalyst.default_pipelines as a CMakeExtension to setup.py.
…ontend/ctalyst/utils/CMakeLists.txt
Update Pipelines.cpp and pipelines.py to use the new accessor functions.
|
Thank you @rturrado 🎉 As discussed in the issue I'll put a hold label on this for the time being :) |
|
@dime10 yes, yes, thanks! |
|
By the way, when unifying the HLOLoweringPass passes from Pipelines.cpp and pipelines.py I found out that:
|
Ah, thanks for reporting this! That's exactly the problem we're trying to prevent I suppose 😅 |
Context:
Currently we have two pipeline registries: the frontend pipeline is used by default qjit program flow, and the CPP pipeline is used by CLI and things like having stage names in the pipeline being passed into the
pipelinekwarg on qjit, e.g. in the oqd, mbqc, ppm pytests.This seems redundant, not to mention error-prone when developing and maintaining.
With more and more custom pipelines emerging and people start thinking about pipeline organization more (e.g. #1758), it would be good to have pipeline registration in just one place.
Description of the Change:
pipelineListinmlir/include/DefaultPipelines.has the only source of truth for pipeline and pass names.This pipeline list is a vector of
PipelineInfo, each of which is a pair of pipeline name and pass names.The pass names are just vectors of strings too.
mlir/lib/Driver/Pipelines.cppandfrontend/catalyst/pipelines.pyto useDefaultPipelines.h, via a few accessor functions.These were the 2 points where information was being duplicated at the moment.
In order for the Python code to use the C++ code, add a
default_pipelinesnanobind module tofrontend/catalyst.Benefits:
The definition of the pipelines and passes, used by C++ and Python code, is defined just in one point.
Possible Drawbacks:
mlir/include/Driver/DefaultPipelines.has a dependency to thefrontend. It's not a big deal but it is ugly to depend on files outside the project.Related GitHub Issues:
#1762