Skip to content

🐛 Some bugs in ToQuantumComputationPattern #47

@taminob

Description

@taminob

System and Environment Information

  • Arch Linux
  • feature branch, but should be the same on main
  • C++, GCC 15.2.1
  • LLVM 21.1.0

Bug Description

  1. The current implementation cannot handle "normal" non-static parameters with a arith.constant. This should become easy to fix after the Dialect Rewrite since the constants will be accessible via the interface if I remember correctly. For now, I used a helper function (see here) to add the parameters here. This will lead to a crash because the parameters are access without any check since it is to be expected for e.g. a rotation gate to have exactly one parameter.
  2. The current implementation cannot handle operations without a target like GPhaseOp. This can be solved by a check here and here
  3. The name of the qubit registers (at least in OpenQASM 2) which is read here will result in a syntax error in OpenQASM because it will be something like %1 = "mqtopt.allocQubitRegister"() <{size_attr = 2 : i64}> : () -> !mqtopt.QubitRegister
  4. allocQubit is not supported yet and requires the code to be re-written using allocQubitRegister (not necessarily a bug)

Especially regarding the first issue, I think it makes sense to wait for the dialect rewrite which will require

Steps to Reproduce

While trying to use the ToQuantumComputationPattern to dump MLIR code as OpenQASM, I noticed some minor bugs in the current implementation. For this, I modified the round-trip pass to dump the MLIR code as OpenQASM code to verify it more easily.
While #46 already addresses some usability issues, I wanted to add actual bugs that need to be fixed in order to use it for its intended purpose outside of the "round-trip" test cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingc++C++ related changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions