Open ravidalon opened 1 year ago
Are you thinking of something in addition to or distinct from the PLATFORM_LOWERING_CONFIG
option in the .config
files?
It seems similar to what we are looking for, but there are some differences:
kernel_builder
(here)It seems similar to what we are looking for, but there are some differences:
- This does not allow registering and loading custom passes
- This is directly tied to using a specific backend, while we would want to use a similar mechanism regardless of backend (or, as a first step, with the simulator backends)
- This does not seem to be used when invoking a kernel using
kernel_builder
(here)
Thanks for the feedback. That's very helpful.
There is a mechanism to create a custom pass plugin. You can find the example in unittests/plugin
.
Following a discussion with @1tnguyen, we have one main question regarding this issue: is it possible to load a custom pass for RemoteRESTQPU.cpp:lowerQuakeCode
?
If it is, then this issue can be closed I think
Yes this should be possible - e.g. see an example here https://github.com/NVIDIA/cuda-quantum/blob/main/runtime/cudaq/platform/default/rest/helpers/quantinuum/quantinuum.config#L19. You can specify the pass in this string, as long as it's part of the framework.
@amccaskey Thank you! To my understanding, "as long as it's part of the framework" is referring to passes that are part of cudaq-opt
. What about passes that are implemented in plugins, as described at https://nvidia.github.io/cuda-quantum/latest/using/advanced/mlir_pass.html ?
Required prerequisites
Describe the feature
Injecting a custom MLIR pass into
cudaq-opt
is possible, as described here. It would also be useful to inject custom passes into the JIT compiler, for compilation of runtime kernels and for Python support. In addition, it would be useful to support defining the pass order to be run by the JIT compiler. In particular, requiring that some passes are run before the custom pass.