unitaryfund / mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.
https://mitiq.readthedocs.io
GNU General Public License v3.0
359 stars 157 forks source link

Directly support openQASM circuits #1503

Open nathanshammah opened 2 years ago

nathanshammah commented 2 years ago

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.

nickdgardner commented 2 years ago

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.

andreamari commented 2 years ago

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

natestemen commented 1 year ago

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.

nickdgardner commented 1 year ago

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.

andreamari commented 1 year ago

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.