-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZX calculus optimization pass #4990
Comments
@the-legend-of-lia worked on this a couple of years ago and currently is in Aleks Kissinger's group so she might have some comments as well. |
I worked with Emma Dasgupta ( @edasgupta ) and @ewinston on this in 2019 when Emma and I interned at IBM Q as undergrads. |
A writeup summarizing our 2019 PyZX transpiler pass in Qiskit is at https://src.acm.org/binaries/content/assets/src/2020/lia-yeh.pdf In PyZX, we added two files to the folder at https://github.com/lia-approves/pyzx/tree/master/pyzx/circuit :
In Qiskit, we have a few examples which ran the transpiler pass to optimize various types of circuits, in the folder at https://github.com/lia-approves/qiskit-terra/tree/master/qiskit/transpiler/pyzxpass :
|
In general if you're going to propose adding a transpiler pass directly to terra to leverage pyzx I think that you'll need to remove the intermediate qasm representation. There shouldn't be any requirement on going through qasm as if you take the topological ordering of the |
What's the status of this issue? Has the code to add a ZX-calculus pass to Qiskit been submitted? |
As far as I know, the closes to it was https://github.com/gprs1809/ZX_to_DAG_QAMP_fall_2022, in the context of qiskit-advocate/qamp-fall-22#27 I didn't take a look to the code yet. If you do, let us know if this issue can be closed! |
That project was never completed due to its being blocked by zxcalc/pyzx#102 which I recently fixed. That is why I'm following up here, to see if such a pass has already been added, and if not, whether there is interest in doing so now that the blocking issue has been resolved. |
Sure! Qiskit currently handles this form of integration through transpiler plugins, which offers a flexible and efficient approach: eliminates the need to submit a pull request to the Qiskit codebase, making it easier to maintain and sets a clear owner. You can take a look at a similar project, qiskit-tket-passes, to get a better idea of how it would work. |
Maybe I'm missing something. I can see that in general the DAG has more information than the qasm representation, but is there any advantage to using the DAG directly specifically for pyzx? What information is available and usable to pyzx in the DAG, which isn't also already in the qasm representation? I have written up a zx transpiler using qasm as an intermediary format and I'm wondering what can be improved by using the DAG directly. |
There are two factors to consider. The first is that a DAG <-> QASM translation is inherently lossy, not because of the The second concern is just from a practical PoV, things will be unnecessarily inefficient going from |
I've uploaded my implementation of a ZX transpiler for Qiskit here: https://github.com/dlyongemallo/qiskit-zx-transpiler This implementation converts directly between As a sanity check, I re-created the benchmark from #4990 (comment) above. As both Qiskit and PyZX have changed in the interim, there are some slight differences, but the results look mostly the same. There was one major difference, though. I had to leave out What else should I do to test or benchmark the implementation? Does anyone have suggestions for anything to improve? |
What work remains to be done to close this issue? |
indeed... This issue can be closed. Would you like to present your ZX transpiler for Qiskit in Qiskit Demoday? |
Sure. I need some time to work on exposing the transpiler as a plugin, though, so maybe we can aim for the May date? |
@levbishop recently asked my about a the status hackathon project to integrate ZX calculus in Qiskit Terra. From what I remember, it there was some coding challenges and their pass was doing
DAG->CIRCUIT->QASM->pyZX(with some modifications)->QASM->CIRCUIT->DAG
.So... the question is if there is interest for a proper ZX calculus. If so, we should discuss the size of that technical challenge. Maybe @eliasrg, @the-wag, @we-taper, @chunlam-chan, and @jean-philippe-arias-zapata have comments?
The text was updated successfully, but these errors were encountered: