munich-quantum-toolkit / munich-quantum-toolkit/core-plugins-catalyst
🚸 MLIR - Improve the usability of the `ToQuantumComputationPattern` and the `FromQuantumComputationPattern`
@flowerthrower is already working on this.
Since Jul 30, 2025.
- Dominant language
- C++
- Stars
- 8
- Forks
- 2
- Avg merge
- 5h 27m
- Merged PRs (30d)
- 34
Description
Problem Statement
While working on the Catalyst plugin code, I noticed that the conversion code to and from our QuantumComputation is quite wonky.
For example, any conversion will currently result in a warning of the sort
Skipping unsupported operation: %1 = "mqtopt.allocQubitRegister"() <{size_attr = 2 : i64}> : () -> !mqtopt.QubitRegister
This is due to the AllocOp being processed in the loop of operations but not actually being handled.
What makes matters worse is that this also means that the current code will not be able to handle multiple register allocations.
Also, the solution with the tagged alloc operation feels very hacky.
Proposed Solution
Supporting multiple allocation operations should be fairly straightforward by moving the allocation operation handling from the start of the method to the loop that handles the operations.
As for the operation tagging, I am thinking that there has to be a way to group up operations forming a transformable subset of the operations. Maybe they can be moved into a block, maybe we could introduce a dedicated operation that encapsulates an entire list of MLIR Quantum Operations and simply move operations there.
Something like this will most likely come up when working on munich-quantum-toolkit/core#1079 anyway.
The other optimizations probably make sense once we have proper testing from munich-quantum-toolkit/core#1071
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.