quantum circuit optimisation with the zx calculus
play

Quantum Circuit Optimisation with the ZX-calculus Ross Duncan - PowerPoint PPT Presentation

Quantum Circuit Optimisation with the ZX-calculus Ross Duncan Cambridge Quantum Computing Simon Perdrix Universit e de Lorraine Aleks Kissinger Oxford University John van de Wetering Radboud University Nijmegen April 8, 2020 Quantum


  1. Quantum Circuit Optimisation with the ZX-calculus Ross Duncan Cambridge Quantum Computing Simon Perdrix Universit´ e de Lorraine Aleks Kissinger Oxford University John van de Wetering Radboud University Nijmegen April 8, 2020

  2. Quantum circuit optimisation § We want to use quantum resources as efficiently as possible.

  3. Quantum circuit optimisation § We want to use quantum resources as efficiently as possible. § So quantum circuits should contain as few gates as possible.

  4. Quantum circuit optimisation § We want to use quantum resources as efficiently as possible. § So quantum circuits should contain as few gates as possible. § Several important metrics:

  5. Quantum circuit optimisation § We want to use quantum resources as efficiently as possible. § So quantum circuits should contain as few gates as possible. § Several important metrics: § Gate-depth § 2-qubit gate count

  6. Quantum circuit optimisation § We want to use quantum resources as efficiently as possible. § So quantum circuits should contain as few gates as possible. § Several important metrics: § Gate-depth § 2-qubit gate count § Number of T gates: T-count [ T = R Z p π 4 q ]

  7. Circuit diagrams NOT = CNOT = + + An example quantum circuit: ` T ` H S ` S

  8. Circuit identities = + + = H H T : = T = T T S

  9. Gate commutation = + + + + T T = + + = + + + + T T T T

  10. More circuit equalities

  11. And more circuit equalities

  12. And even more circuit equalities

  13. Things get messy because circuits are very rigid

  14. Things get messy because circuits are very rigid Enter ZX-diagrams

  15. ZX-diagrams What gates are to circuits, spiders are to ZX-diagrams.

  16. ZX-diagrams What gates are to circuits, spiders are to ZX-diagrams. Z-spider X-spider | 0 ¨ ¨ ¨ 0 yx 0 ¨ ¨ ¨ 0 | | + ¨ ¨ ¨ + yx + ¨ ¨ ¨ + | ` e i α | 1 ¨ ¨ ¨ 1 yx 1 ¨ ¨ ¨ 1 | ` e i α | - ¨ ¨ ¨ - yx - ¨ ¨ ¨ - | α α ... ... ... ...

  17. ZX-diagrams What gates are to circuits, spiders are to ZX-diagrams. Z-spider X-spider | 0 ¨ ¨ ¨ 0 yx 0 ¨ ¨ ¨ 0 | | + ¨ ¨ ¨ + yx + ¨ ¨ ¨ + | ` e i α | 1 ¨ ¨ ¨ 1 yx 1 ¨ ¨ ¨ 1 | ` e i α | - ¨ ¨ ¨ - yx - ¨ ¨ ¨ - | α α ... ... ... ... Spiders can be wired in any way: π 2 β 3 π 2 α 0 π

  18. Quantum gates as ZX-diagrams Every quantum gate can be written as a ZX-diagram: S “ T “ π π 2 4 H “ := π π π 2 2 2 CNOT “ CZ “ “

  19. Quantum gates as ZX-diagrams Every quantum gate can be written as a ZX-diagram: S “ T “ π π 2 4 H “ := π π π 2 2 2 CNOT “ CZ “ “ Universality Any linear map between qubits can be represented as a ZX-diagram.

  20. Rules for ZX-diagrams: The ZX-calculus α ... ... ... α ` β “ “ ... ... α α ... ... β ... ... a π a π a π a π “ a π α “ p - 1 q a α ... ... a π α ... ... a π a π “ “ “ α, β P r 0 , 2 π s , a P t 0 , 1 u

  21. Completeness of the ZX-calculus Theorem (Vilmart 2018) If two ZX-diagrams represent the same linear map, then they can be transformed into one another using the previous rules (and one additional one).

  22. Completeness of the ZX-calculus Theorem (Vilmart 2018) If two ZX-diagrams represent the same linear map, then they can be transformed into one another using the previous rules (and one additional one). So instead of dozens of circuit equalities, we just need a few simple rules.

  23. Optimisation using ZX-diagrams § Write circuit as ZX-diagram.

  24. Optimisation using ZX-diagrams § Write circuit as ZX-diagram. § Turn it into graph-like ZX-diagram.

  25. Optimisation using ZX-diagrams § Write circuit as ZX-diagram. § Turn it into graph-like ZX-diagram. § Simplify the diagram.

  26. Optimisation using ZX-diagrams § Write circuit as ZX-diagram. § Turn it into graph-like ZX-diagram. § Simplify the diagram. § Extract a circuit from the diagram.

  27. PyZX § PyZX is an open-source Python library. § https://github.com/Quantomatic/pyzx § It allows easy manipulation of large ZX-diagrams.

  28. Graph-like diagrams π π 2 2 π π π 2 2 2 π π 2 2 π 2 = π π 2 2 π π π 2 2 2 π π 2

  29. Graph-like diagrams π π 2 2 π π π 2 2 2 π π 2 2 π 2 = π π 2 2 π π π 2 2 2 π π 2 Now we are ready for simplification. The game: Remove as many interior vertices as possible.

  30. The tools: Local complementation and pivoting ˘ π α 1 ¯ π α n ¯ π 2 2 2 ... ... ... α 1 α n “ ... ... ... α 2 ¯ π α n 1 ¯ π 2 2 ´ α 2 α n 1 ´ ... ... ... ... ... ... ... ... j π k π α 1 ` k π γ 1 ` j π α 1 γ 1 ... ... ... ... ... “ α n ` k π γ n ` j π α n γ n ... β n ... ... ... ... ... β n ` p j ` k ` 1 q π ... β 1 ... β 1 ` p j ` k ` 1 q π ... Duncan, Kissinger, Perdrix, vdW (2019)

  31. Example Example result after simplification: 7 π 5 π 4 4 π 2 3 π 5 π 2 4 3 π π 2 4

  32. Example Example result after simplification: 7 π 5 π 4 4 π 2 3 π 5 π 2 4 3 π π 2 4 Problem: does not look a circuit.

  33. Example Example result after simplification: 7 π 5 π 4 4 π 2 3 π 5 π 2 4 3 π π 2 4 Problem: does not look a circuit. Solution: all rewrites preserve gflow . § Duncan, Perdrix, Kissinger, vdW (2019). Graph-theoretic Simplification of Quantum Circuits with the ZX-calculus . § Backens, Miller-Bakewell, de Felice, Lobski, vdW (2020). There and back again: A circuit extraction tale .

  34. Clifford simplification Clifford circuits are reduced to a pseudo-normal form: LC LC ¨ ¨ ¨ LC LC ... ... LC LC

  35. Clifford simplification Clifford circuits are reduced to a pseudo-normal form: LC LC ¨ ¨ ¨ LC LC ... ... LC LC This is equal to: LC LC LC ¨ ¨ ¨ LC ... ... LC LC P e.g. P | x 1 , x 2 , x 3 , x 4 y ÞÑ | x 1 ‘ x 2 , x 1 ‘ x 3 , x 4 , x 3 y .

  36. Clifford normal form LC LC LC ¨ ¨ ¨ LC ... ... LC LC P § Extracts to circuit with 8 layers: § H - S - CZ - CNOT - H - CZ - S - H

  37. Clifford normal form LC LC LC ¨ ¨ ¨ LC ... ... LC LC P § Extracts to circuit with 8 layers: § H - S - CZ - CNOT - H - CZ - S - H § Asymptotically optimal number of free parameters, like normal form of [Maslov & Roetteler 2019].

  38. Clifford normal form LC LC LC ¨ ¨ ¨ LC ... ... LC LC P § Extracts to circuit with 8 layers: § H - S - CZ - CNOT - H - CZ - S - H § Asymptotically optimal number of free parameters, like normal form of [Maslov & Roetteler 2019]. § But additionally, linear nearest neighbour depth of 9 n ´ 2, a new record (Recently matched by [Bravyi & Maslov 2020]).

  39. Non-Clifford optimisation

  40. Non-Clifford optimisation Additional rules for phase gadgets : α phase gadget | x 1 , ..., x n y ÞÑ e i α p x 1 ‘ ... ‘ x n q | x 1 , ..., x n y :: ...

  41. Non-Clifford optimisation Additional rules for phase gadgets : α phase gadget | x 1 , ..., x n y ÞÑ e i α p x 1 ‘ ... ‘ x n q | x 1 , ..., x n y :: ... (-1) j α ... ... ... ... ... ... β α 1 α ` β α 1 ... α = = ... ... ... ... ... j π α α n α n ... ... ... ... ... ... Kissinger, vdW 2019: Reducing T-count with the ZX-calculus

  42. T-count optimisation § At time of publishing, our method improved upon previous best T-counts for 6/36 benchmark circuits — in one case by 50%.

  43. T-count optimisation § At time of publishing, our method improved upon previous best T-counts for 6/36 benchmark circuits — in one case by 50%. § Combining with TODD [Heyfron & Campbell 2018] we improved T-counts for 20/36 circuits.

  44. T-count optimisation § At time of publishing, our method improved upon previous best T-counts for 6/36 benchmark circuits — in one case by 50%. § Combining with TODD [Heyfron & Campbell 2018] we improved T-counts for 20/36 circuits. § Note: [Zhang & Chen 2019] use a different method that achieves nearly identical T-counts.

  45. CNOT optimisation § Circuit extraction resynthesises two-qubit gates. § Sometimes this is beneficial, but sometimes it is not.

  46. CNOT optimisation § Circuit extraction resynthesises two-qubit gates. § Sometimes this is beneficial, but sometimes it is not. § Can be circumvented using phase teleportation [Kissinger & vdW 2019].

  47. CNOT optimisation § Circuit extraction resynthesises two-qubit gates. § Sometimes this is beneficial, but sometimes it is not. § Can be circumvented using phase teleportation [Kissinger & vdW 2019]. § Improves on previous best for quantum chemistry circuits of [Cowtan et al. 2019].

  48. Conclusion Using the ZX-calculus we found new techniques to improve depth, two-qubit gate count and T-count of realistic benchmark circuits.

  49. Conclusion Using the ZX-calculus we found new techniques to improve depth, two-qubit gate count and T-count of realistic benchmark circuits. Future work: § Allow routing for restricted architectures.

  50. Conclusion Using the ZX-calculus we found new techniques to improve depth, two-qubit gate count and T-count of realistic benchmark circuits. Future work: § Allow routing for restricted architectures. § Improve extraction to reduce CNOT count.

Recommend


More recommend