mitiq icon indicating copy to clipboard operation
mitiq copied to clipboard

Directly support openQASM circuits

Open nathanshammah opened this issue 2 years ago • 5 comments

Issue Description

Mitiq could support directly as one of its frontends quantum circuits in openQASM format. Mitiq already has some conversion functions for openqasm wrt to Qiskit circuits.

Additional References

@nickdgardner mentioned this as a useful feature.

nathanshammah avatar Sep 22 '22 09:09 nathanshammah

I've started looking at this (specifically for openQASM 3) and would be happy to collaborate on the issue with others who have more experience with Mitiq and/or openQASM.

nickdgardner avatar Sep 22 '22 19:09 nickdgardner

Interesting @nickdgardner ! This probably requires some planning and decisions (e.g. QASM2 vs QASM3). We can discuss more during a Mitiq call.

andreamari avatar Sep 22 '22 20:09 andreamari

Can someone lay out the value prop for this? From my understanding very few users are writing openqasm by hand, and many frontends can import/export from openqasm easily.

natestemen avatar Nov 04 '22 00:11 natestemen

I don't see a clear one now that I've looked into it more. But maybe @andreamari or @nathanshammah had something in mind? My initial thought was that it would be useful if Mitiq aims to eventually support people who want to apply mitigation methods involving sub-gate-level control, who might be working directly in QASM, and if QASM submodules would be the best way for Mitiq to implement those methods internally. But I see now this would be a huge undertaking, and I don't even know if it's a plausible scenario.

nickdgardner avatar Nov 04 '22 03:11 nickdgardner

QASM(2) is a very popular intermediate representation for circuits .

Supporting QASM would make Mitiq easy to use with any software library that is able to export QASM circuits and any backend that is able to run QASM circuits.

Short term value prop: It would simplify the code of the user. E.g., if Mitiq supported QASM as a fronted, there would be no need to manually convert circuits to Cirq in the BSQkit tutorial. Mitiq would do it internally. So no fundamental advantages, just more user-friendly.

Long term value prop: In the long term, Mitiq could act directly on some fixed and unique intermediate representation (e.g. QASM2, QASM3 or QIR). This would imply rewriting almost all the code of Mitiq which is instead Cirq-based, but it has some clear potential advantages.

In practice, in my opinion, adding now QASM as a Mitiq frontend is perhaps not a super urgent issue but I see some short-term utility and some long-term potential.

andreamari avatar Nov 08 '22 09:11 andreamari