-
Notifications
You must be signed in to change notification settings - Fork 208
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
[python] Remove unused MLIR components #2443
base: main
Are you sure you want to change the base?
Conversation
a8cef3f
to
5b4059b
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
registerAllDialects(registry); | ||
auto *mlirContext = unwrap(context); | ||
cudaq::registerAllDialects(registry); | ||
MLIRContext *mlirContext = unwrap(context); | ||
mlirContext->appendDialectRegistry(registry); | ||
mlirContext->loadAllAvailableDialects(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does loadAllAvailableDialects actually load Quake, CC, and CodeGen?
Do we need an explicit test to verify that all the dialects we expect to be loaded are loaded?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadAllAvailableDialects()
will load all dialects registered in the context. So, Quake
and CC
will be loaded. The CodeGen
dialect is not registered in cudaq::registerAllDialects
. I'm not sure why, but its being registered in other places and in different ways:
registry.insert<cudaq::codegen::CodeGenDialect>(); |
cudaq::opt::registerCodeGenDialect(registry); |
I can make it uniform in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codegen dialect was intended to be sort of second-class in that it would only be applicable at codegen time. The point being we don't want folks to start using it in ad hoc ways in random passes, etc. Adding a few landmines was sort of the idea.
OTOH, we could clean it up a bit and remove some of those hurdles. We still don't want that dialect used "in the wild" though...
f6a8985
to
a30eddd
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
a30eddd
to
e04b6f8
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
e04b6f8
to
2010d99
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
992ba52
to
e62b6cf
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
754fffd
to
c30f508
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
c30f508
to
99ad7a6
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
99ad7a6
to
a156bdc
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
We don't need to take everything from MLIR for our python bindings. This change cherry picks the upstream components our compiler depends on. The commit also cleans up some unnecessary code that ends up registering dialects more than once, and surfaces the `register_all_dialects` function to a less obscure location. Signed-off-by: boschmitt <7152025+boschmitt@users.noreply.github.com>
a156bdc
to
479db23
Compare
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Description
We don't need to take everything from MLIR for our python bindings. This change cherry picks the upstream components our compiler depends on.
The commit also cleans up some unnecessary code that ends up registering dialects more than once, and surfaces the
register_all_dialects
function to a less obscure location.EDIT: The process of registering dialects can be further improved and made completely automatic. MLIR provides a global
_dialect_registry
that gets automatically populated with all upstream dialects whenRegisterEverything
is built. This global registry is loaded to allContext()
objects on its__init__
method. We can populate this global registry whenevercudaq.mlir
is loaded so that everyContext()
gets all dialects that we need. This improvement will be left for later work.