Skip to content

🚸 MLIR - Improve the usability of the ToQuantumComputationPattern and the FromQuantumComputationPattern #46

@burgholzer

Description

@burgholzer

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

Metadata

Metadata

Assignees

Labels

c++C++ related changesenhancementEnhancement to existing feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions