Open joeycarter opened 4 days ago
This is my initial attempt at resolving issue #873. At the moment, the OpenQASM dialect I have implemented is not "aware" of what any of the operations do (qubit allocation, RY gate and CNOT gate); I have assumed this was not required for the issue at hand. The MLIR -> OpenQASM translation pass simply walks through the IR operations and prints to the console the equivalent OpenQASM statements (as suggested in the original issue description). However, because of the way the MLIR tools are implemented, this also prints the original IR after it, since the operations were not modified in any way. I'm curious if there's a solution to this.
Hi @joeycarter, thank you for the submission! I will have a look at it shortly :)
Nice work!! I don't really have any comments so this is great as is 🎉
However, because of the way the MLIR tools are implemented, this also prints the original IR after it, since the operations were not modified in any way. I'm curious if there's a solution to this.
Good point, this is just how the opt tool works I think. If you really wanted to you could probably output the openqasm to a different stream, and then redirect the regular opt output to /dev/null. But I think its fine.
Thanks @dime10! In that case I'll leave it as is.
Context: Adding a native representation of the OpenQASM standard in MLIR.
Description of the Change:
Benefits: Having native OpenQASM support in MLIR will, for example, help facilitate the translation of an OpenQASM text file into and out of MLIR, enable transformations on OpenQASM programs, and more generally improve inter-operability between tools.
Possible Drawbacks: Only limited support for now.
Related GitHub Issues: Resolves #873