Quantum circuits: From Structure to Software Aleks Kissinger - - PowerPoint PPT Presentation

quantum circuits from structure to software
SMART_READER_LITE
LIVE PREVIEW

Quantum circuits: From Structure to Software Aleks Kissinger - - PowerPoint PPT Presentation

Quantum circuits: From Structure to Software Aleks Kissinger Quantum Natural Language Processing, Oxford 2020 Aleks Kissinger QNLP 2020 1 / 34 Quantum software 1. := the code the runs on a quantum computer factoring search physical


slide-1
SLIDE 1

Quantum circuits: From Structure to Software

Aleks Kissinger

Quantum Natural Language Processing, Oxford 2020

Aleks Kissinger QNLP 2020 1 / 34

slide-2
SLIDE 2

Quantum software

  • 1. := the code the runs on a quantum computer

factoring search

physical simulation

  • ptimisation problems

linear systems & codes network flows natural language processing ...

  • 2. := the code that makes that code (better)
  • compilers
  • optimisation
  • verification

Aleks Kissinger QNLP 2020 2 / 34

slide-3
SLIDE 3

Problem: no quantum computers

Rigetti Aspen IBM Q Rochester Google Sycamore

(+ Oxford, Vienna, Delft, Sussex, Grenoble...)

Aleks Kissinger QNLP 2020 3 / 34

slide-4
SLIDE 4

H H

⊕ ⊕

H Z X Z

S T

⊕ ⊕

Aleks Kissinger QNLP 2020 4 / 34

slide-5
SLIDE 5

H H

⊕ ⊕

H Z X Z

S T

⊕ ⊕

Aleks Kissinger QNLP 2020 4 / 34

slide-6
SLIDE 6

H H

⊕ ⊕

H Z X Z S T

⊕ ⊕

Aleks Kissinger QNLP 2020 4 / 34

slide-7
SLIDE 7

H H

⊕ ⊕

H Z X Z S T

⊕ ⊕

Aleks Kissinger QNLP 2020 4 / 34

slide-8
SLIDE 8

⊕ ⊕ ⊕ = ⊕

H H

= ⊕

H H

⊕ ⊕ = ⊕ ⊕ ⊕

Z

=

Z H

=

S H S H H

. . .

Aleks Kissinger QNLP 2020 5 / 34

slide-9
SLIDE 9

* Selinger 2015

Aleks Kissinger QNLP 2020 5 / 34

slide-10
SLIDE 10

* Selinger 2015

Aleks Kissinger QNLP 2020 5 / 34

slide-11
SLIDE 11

* Amy, Chen, & Ross 2018

Aleks Kissinger QNLP 2020 5 / 34

slide-12
SLIDE 12

* Nam et al 2018

Aleks Kissinger QNLP 2020 5 / 34

slide-13
SLIDE 13

H H

⊕ ⊕

H Z X Z

⊕ ⊕

S T

⊕ ⊕

π π π

π 2 π 4 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2

Aleks Kissinger QNLP 2020 6 / 34

slide-14
SLIDE 14

H H

⊕ ⊕

H Z X Z

⊕ ⊕

S T

⊕ ⊕

π π π

π 2 π 4 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2

Aleks Kissinger QNLP 2020 6 / 34

slide-15
SLIDE 15

π π π

π 2 π 4 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2

Aleks Kissinger QNLP 2020 6 / 34

slide-16
SLIDE 16

π π π

π 2 π 4 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2

ZX-diagram

Aleks Kissinger QNLP 2020 6 / 34

slide-17
SLIDE 17

ZX-diagrams

...are made of spiders:

  • α

... ...

  • =

      1 ... ... eiα      

α

... ... := ...

α

...

  • :=

1 √ 2 1 1 1 −1

  • Aleks Kissinger

QNLP 2020 7 / 34

slide-18
SLIDE 18

α

π 2 3π 2

β π

Aleks Kissinger QNLP 2020 8 / 34

slide-19
SLIDE 19

α

π 2 3π 2

β π

Aleks Kissinger QNLP 2020 8 / 34

slide-20
SLIDE 20

α

π 2 3π 2

β π

Aleks Kissinger QNLP 2020 8 / 34

slide-21
SLIDE 21

1

ZX calculus

these 8 rules = ⇒ everything before

1Vilmart 2018. arXiv:1812.09114 Aleks Kissinger QNLP 2020 9 / 34

slide-22
SLIDE 22

H H

⊕ ⊕

H Z X Z

⊕ ⊕

S T

⊕ ⊕

Aleks Kissinger QNLP 2020 10 / 34

slide-23
SLIDE 23

π π π

π 2 π 4 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2

Aleks Kissinger QNLP 2020 10 / 34

slide-24
SLIDE 24

π

π 4 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2

π 2π

Aleks Kissinger QNLP 2020 10 / 34

slide-25
SLIDE 25

π

π 4 π 2 π 2 π 2 π 2 π 2 π 2

π

Aleks Kissinger QNLP 2020 10 / 34

slide-26
SLIDE 26

π

π 4 π 2 π 2 π 2 π 2 π 2 π 2

π

Aleks Kissinger QNLP 2020 10 / 34

slide-27
SLIDE 27

π 4 π 2 π 2 π 2 π 2 π 2

π π

Aleks Kissinger QNLP 2020 10 / 34

slide-28
SLIDE 28

π 4 π 2

π

Aleks Kissinger QNLP 2020 10 / 34

slide-29
SLIDE 29

π 4 π 2

Aleks Kissinger QNLP 2020 10 / 34

slide-30
SLIDE 30

π 4 π 2

Aleks Kissinger QNLP 2020 10 / 34

slide-31
SLIDE 31

π 4 π 2

Aleks Kissinger QNLP 2020 10 / 34

slide-32
SLIDE 32

Q: How do we scale up?

π π π

π 2 π 4 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2
  • ∼30 spiders

  • 103-107 spiders

A: Automation.

Aleks Kissinger QNLP 2020 11 / 34

slide-33
SLIDE 33

Quantomatic

  • General-purpose, medium scale tool for teaching and experimenting

with graphical calculi

Aleks Kissinger QNLP 2020 12 / 34

slide-34
SLIDE 34

PyZX

  • Special-purpose, large scale circuit optimisation tool for ZX-calculus

Aleks Kissinger QNLP 2020 13 / 34

slide-35
SLIDE 35

The idea

  • 1. Turn equations into directed rewrite rules

β

... ...

α+β

... ...

β

... ...

α

... =

= ⇒

β

... ...

α+β

... ...

β

... ...

α

... →

  • 2. Use rewrite rules to simplify ZX-diagrams
  • 3. Extract meaningful data from simplified diagram

(e.g. optimised circuits, amplitudes/probabilities, ...).

Aleks Kissinger QNLP 2020 14 / 34

slide-36
SLIDE 36

Clifford circuits

  • Built from:

CNOT := H := S :=

π 2

  • Efficient to classically simulate (Gottesman-Knill)
  • Expressible by Clifford ZX-diagrams

❦π 2 ...

... ;

❦π 2 ...

... k ∈ Z

Aleks Kissinger QNLP 2020 15 / 34

slide-37
SLIDE 37

Clifford ZX-calculus

β

... ...

α+β

... ... ... ... ... ... ...

α

...

α

... ...

π 2 π 2 π 2

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... = = = = = = =

complete for Clifford ZX-diagrams

Aleks Kissinger QNLP 2020 16 / 34

slide-38
SLIDE 38

Equations Rewrite rules

Aleks Kissinger QNLP 2020 17 / 34

slide-39
SLIDE 39

Equations Rewrite rules

β

... ...

α+β

... ... ... ... ... ... ...

α

...

α

... ...

π 2 π 2 π 2

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... = = = = = = =

Aleks Kissinger QNLP 2020 17 / 34

slide-40
SLIDE 40

Equations Rewrite rules

β

... ...

α+β

... ... ... ... ... ... ...

α

...

α

... ...

π 2 π 2 π 2

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... → → = = = → →

Aleks Kissinger QNLP 2020 17 / 34

slide-41
SLIDE 41

Equations Rewrite rules

β

... ...

α+β

... ... ... ... ... ... ...

α

...

α

... ...

π 2 π 2 π 2

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... → → = → = → →

Aleks Kissinger QNLP 2020 17 / 34

slide-42
SLIDE 42

π 2 3π 2

π

Aleks Kissinger QNLP 2020 18 / 34

slide-43
SLIDE 43

π 2 3π 2

π

Aleks Kissinger QNLP 2020 18 / 34

slide-44
SLIDE 44

π 2 3π 2

π

Aleks Kissinger QNLP 2020 18 / 34

slide-45
SLIDE 45

Equations Rewrite rules

β

... ...

α+β

... ... ... ... ... ... ...

α

...

α

... ...

π 2 π 2 π 2

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... → → = → = → →

Aleks Kissinger QNLP 2020 19 / 34

slide-46
SLIDE 46

Equations Rewrite rules

β

... ...

α+β

... ... ... ... ... ...

π 2 π 2 π 2

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... → → = = → → ...

α

...

α

... ... →

Aleks Kissinger QNLP 2020 19 / 34

slide-47
SLIDE 47

Equations Rewrite rules

β

... ...

α+β

... ...

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... → → → → ... ... =

∓ π 2

... ... ... ... ... ... ... ... ... ... ... ...

∓ π 2 ∓ π 2 ∓ π 2 ± π 2

❦π

...

❥π

... ... = ... ... ... ... ... ... ... ... ...

❦π ❦π ❥π ❥π

...

α

...

α

... ... →

Aleks Kissinger QNLP 2020 19 / 34

slide-48
SLIDE 48

Equations Rewrite rules

β

... ...

α+β

... ...

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... → → → → ... ... →

∓ π 2

... ... ... ... ... ... ... ... ... ... ... ...

∓ π 2 ∓ π 2 ∓ π 2 ± π 2

❦π

...

❥π

... ... → ... ... ... ... ... ... ... ... ...

❦π ❦π ❥π ❥π

...

α

...

α

... ... →

Aleks Kissinger QNLP 2020 19 / 34

slide-49
SLIDE 49

Equations Rewrite rules

β

... ...

α+β

... ...

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... → → → → ... ... →

∓ π 2

... ... ... ... ... ... ... ... ... ... ... ...

∓ π 2 ∓ π 2 ∓ π 2 ± π 2

❦π

...

❥π

... ... → ... ... ... ... ... ... ... ... ...

❦π ❦π ❥π ❥π

...

α

...

α

... ... → pivoting local complementation

Aleks Kissinger QNLP 2020 19 / 34

slide-50
SLIDE 50

Computing the skeleton

π 2 π 2 3π 2 π 2 5π 4 π 2 π 2 π 2 π 2 3π 2 π 2 3π 2 π 4 π 2 3π 2 3π 2 π 2 3π 2 3π 2 3π 2 π 2 π 2 3π 2 3π 2 3π 2 3π 2 3π 4 π 2 3π 2 π 2 π 2 π 2 π 2 π 2 π 2 3π 2 π 2 π 2 3π 2 3π 2 3π 2 3π 2 π 2 π 2 π 2 π 2 π 2 3π 2 3π 2 π 2 3π 2 3π 4 3π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2 3π 2 3π 2 π 2 π 2

... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

π 2 π 4 5π 4 π 2 π 4 π 4

π π

Aleks Kissinger QNLP 2020 20 / 34

slide-51
SLIDE 51

ZX-diagram circuit?

π 2 π 4 5π 4 π 2 π 4 π 4

π π

  • ZX-diagrams can represent any linear map, but circuits are always

unitary

  • =

⇒ not all ZX-diagrams are equal to circuits

  • All unitary ZX-diagrams can be written as circuits, but at what

cost???

Aleks Kissinger QNLP 2020 21 / 34

slide-52
SLIDE 52

Problem (Circuit extraction problem)

Given a ZX-diagram that represents a unitary linear map, find an equivalent quantum circuit.

Conjecture

If the circuit extraction problem is solvable with polynomial overhead, then BQP = PostBQP. = ⇒ need heuristics or extra data

Aleks Kissinger QNLP 2020 22 / 34

slide-53
SLIDE 53

Circuit extraction strategy

π

7π 4

π

3π 2 π 2 π 2 π 4

Aleks Kissinger QNLP 2020 23 / 34

slide-54
SLIDE 54

Circuit extraction strategy

π

7π 4

π

3π 2 π 2 π 2 π 4

Aleks Kissinger QNLP 2020 23 / 34

slide-55
SLIDE 55

Circuit extraction strategy

π

7π 4

π

3π 2 π 2 π 2 π 4

Aleks Kissinger QNLP 2020 23 / 34

slide-56
SLIDE 56

Circuit extraction strategy

π

7π 4

π

3π 2 π 2 π 2 π 4

* * *

Aleks Kissinger QNLP 2020 23 / 34

slide-57
SLIDE 57

Circuit extraction strategy

π

7π 4

π

3π 2 π 2 π 2 π 4

Aleks Kissinger QNLP 2020 23 / 34

slide-58
SLIDE 58

Circuit extraction strategy

7π 4 3π 2 π 2 π 2 π 4

π π

Aleks Kissinger QNLP 2020 23 / 34

slide-59
SLIDE 59

Circuit extraction strategy

7π 4 3π 2 π 2 π 2 π 4

π π

    1 1 1 1 1    

Aleks Kissinger QNLP 2020 23 / 34

slide-60
SLIDE 60

Circuit extraction strategy

7π 4 3π 2 π 2 π 2 π 4

*

π π

    1 1 1 1 1     R1 := R1 + R4     1 1 1 1    

Aleks Kissinger QNLP 2020 23 / 34

slide-61
SLIDE 61

Circuit extraction strategy

7π 4 3π 2 π 2 π 2 π 4

π π

Aleks Kissinger QNLP 2020 23 / 34

slide-62
SLIDE 62

Circuit extraction strategy

π

7π 4

π

π 2 π 2 π 4 3π 2

Aleks Kissinger QNLP 2020 23 / 34

slide-63
SLIDE 63

Extraction and gFlow

  • Strategy always works iff the graph of a ZX-diagram has generalised

flow (gFlow) ∃≺, g.∀v. g(v) ⊆ v≻ ∧ Odd(v) ∩ I ∩ v≺ = {v}

  • quantum circuits have gFlow
  • + these rules all preserve gFlow:

β

... ...

α+β

... ...

β

... ...

α

...

β

... ...

α+β

... ...

β

... ...

α

... → → → → ... ... →

∓ π 2

... ... ... ... ... ... ... ... ... ... ... ...

∓ π 2 ∓ π 2 ∓ π 2 ± π 2

❦π

...

❥π

... ... → ... ... ... ... ... ... ... ... ...

❦π ❦π ❥π ❥π

...

α

...

α

... ... → pivoting local complementation

  • =

⇒ skeletons can always be extracted into circuits

Aleks Kissinger QNLP 2020 24 / 34

slide-64
SLIDE 64

T-count reduction

7π 4 π 4 7π 4 π 4 π 4 π 4 7π 4 7π 4 π 4 7π 4 π 4 π 4 π 4 7π 4 7π 4 π 4 7π 4 π 4 π 4 π 4 7π 4

7π 4 7π 4 π 4 π 4 π 4 7π 4 7π 4 π 4 π 4 7π 4 π 4 π 4 7π 4 π 4 7π 4

7π 4 π 4 7π 4 π 4 3π 2 π 4 7π 4 π 4 7π 4 π 4 7π 4 7π 4 π 4 7π 4 π 4 π 2 π 2 π 4

Aleks Kissinger QNLP 2020 25 / 34

slide-65
SLIDE 65

T-count reduction

Circuit n T Best prev. Method PyZX adder8 24 399 213 RMm 173 Adder8 23 266 56 NRSCM 56 Adder16 47 602 120 NRSCM 120 Adder32 95 1274 248 NRSCM 248 Adder64 191 2618 504 NRSCM 504 barenco-tof3 5 28 16 Tpar 16 barenco-tof4 7 56 28 Tpar 28 barenco-tof5 9 84 40 Tpar 40 barenco-tof10 19 224 100 Tpar 100 tof3 5 21 15 Tpar 15 tof4 7 35 23 Tpar 23 tof5 9 49 31 Tpar 31 tof10 19 119 71 Tpar 71 csla-mux3 15 70 58 RMr 62 csum-mux9 30 196 76 RMr 84 cycle173 35 4739 1944 RMm 1797 gf(24)-mult 12 112 56 TODD 68 gf(25)-mult 15 175 90 TODD 115 gf(26)-mult 18 252 132 TODD 150 gf(27)-mult 21 343 185 TODD 217 gf(28)-mult 24 448 216 TODD 264 ham15-low 17 161 97 Tpar 97 ham15-med 17 574 230 Tpar 212 ham15-high 20 2457 1019 Tpar 1019 hwb6 7 105 75 Tpar 75 hwb8 12 5887 3531 RMm&r 3517 mod-mult-55 9 49 28 TODD 35 mod-red-21 11 119 73 Tpar 73 mod54 5 28 16 Tpar 8 nth-prime6 9 567 400 RMm&r 279 nth-prime8 12 6671 4045 RMm&r 4047 qcla-adder10 36 589 162 Tpar 162 qcla-com7 24 203 94 RMm 95 qcla-mod7 26 413 235 NRSCM 237 rc-adder6 14 77 47 RMm&r 47 vbe-adder3 10 70 24 Tpar 24

  • Compared with state of the art for

(ancilla-free) T-count reduction:

  • Amy, Maslov, Mosca. 2014
  • Amy, Mosca. 2016
  • Heyfron, Campbell. 2018
  • Nam et al. 2018
  • As of March 2019:
  • 26/36 ≈ 72% match SotA
  • 6/36 ≈ 17% beat SotA
  • In April 2019, Zhang & Chen matched

PyZX numbers with circuit method

  • In Nov 2019, de Beaudrap, Bian, & Wang

beat SotA again with new ZX method + TODD

Aleks Kissinger QNLP 2020 26 / 34

slide-66
SLIDE 66

Circuit routing

Aleks Kissinger QNLP 2020 27 / 34

slide-67
SLIDE 67

Circuit routing

PyZX uses Gaussian elimination to extract circuits:

π

7π 4

π

π 2 π 2 π 4 3π 2

    1 1 1 1 1     R1 := R1 + R4     1 1 1 1    

By constrained GE, we produce routed circuits:

1 2 5 4 3 6 7 8 ⇒

⊕ ⊕ ⊕ ⊕ ⊕ 4 1 2 6 7 8 5 3 t1 t2 t3 t4 ⊕ t5

Aleks Kissinger QNLP 2020 28 / 34

slide-68
SLIDE 68

CNOT Circuit routing

Architecture CNOT QuilC PyZX Savings 9q-square 3 3.8 3 21.05% 9q-square 5 10.82 5.2 51.94% 9q-square 10 20.08 11.6 42.23% 9q-square 20 46.24 25.85 44.10% 9q-square 30 72.89 35.55 51.23% 16q-square 4 6.14 4.44 27.69% 16q-square 8 19.68 12.41 36.94% 16q-square 16 48.13 33.08 31.27% 16q-square 32 106.75 82.95 22.30% 16q-square 64 225.69 147.38 34.70% 16q-square 128 457.35 168.12 63.24% 16q-square 256 925.85 169.28 81.72% rigetti-16q-aspen 4 7.05 4.15 41.13% rigetti-16q-aspen 8 28.2 11.22 60.21% rigetti-16q-aspen 16 69.15 33.95 50.90% rigetti-16q-aspen 32 147.3 101.75 30.92% rigetti-16q-aspen 64 324.6 189.15 41.73% rigetti-16q-aspen 128 664.65 220.75 66.79% rigetti-16q-aspen 256 1367.89 222.15 83.76% ibm-qx5 4 6.75 4 40.74% ibm-qx5 8 23.7 8.95 62.24% ibm-qx5 16 60.5 26.55 56.12% ibm-qx5 32 140.05 84.4 39.74% ibm-qx5 64 301.05 152.65 49.29% ibm-qx5 128 600.9 188.25 68.67% ibm-qx5 256 1247.8 193.8 84.47% ibm-q20-tokyo 4 5.5 4 27.27% ibm-q20-tokyo 8 17.3 7.69 55.55% ibm-q20-tokyo 16 43.83 20.44 53.37% ibm-q20-tokyo 32 93.58 66.93 28.48% ibm-q20-tokyo 64 215.9 165.6 23.30% ibm-q20-tokyo 128 432.65 237.64 45.07% ibm-q20-tokyo 256 860.74 245.84 71.44%

  • up to 5X more efficient vs. Rigetti, CQC,

IBM (as of April 2019)

Aleks Kissinger QNLP 2020 29 / 34

slide-69
SLIDE 69

Verification

  • Q: How do we verify correctness of optimised circuits?

C D = ⇒ C = D

  • QMA-complete
  • PyZX optimiser is self-checking

C D = ⇒ C; D−1 1

  • ∼O(n1.5)
  • Sound approx. of circuit equality helps find bugs:

Aleks Kissinger QNLP 2020 30 / 34

slide-70
SLIDE 70

Classical simulation of circuits

  • The ZX-calculus can ‘supercharge’ stabilizer rank techniques, which

decompose blocks of non-Clifford gates into sums of stabilizer circuits

  • e.g. Bravyi/Smith/Smolin decomposition in ZX-language is:

Aleks Kissinger QNLP 2020 31 / 34

slide-71
SLIDE 71

Classical simulation of circuits

33 33 27 27 27 27

...

  • Produces 7n/6 ≈ 20.468n terms for n T-gates
  • Interleaving ZX-simplification can make that signficantly less

Aleks Kissinger QNLP 2020 32 / 34

slide-72
SLIDE 72

Where to?

  • More aggressive optimisation more difficult circuit extraction
7π 4 7π 4 π 4 π 4 π 4 7π 4 7π 4 π 4 π 4 7π 4 π 4 π 4 7π 4 π 4 7π 4

=

7π 4 7π 4 π 4 π 4 π 4 7π 4 7π 4 π 4 π 4 7π 4 π 4 π 4 7π 4 π 4 7π 4
  • Circuit routing for general circuits
  • “Quantum static analysis” to find bugs in circuits
  • Classical simulation techniques + data

Aleks Kissinger QNLP 2020 33 / 34

slide-73
SLIDE 73

Thanks!

  • Graph-theoretic Simplification of Quantum Circuits with the ZX-calculus. Ross

Duncan, Simon Perdrix, AK, John van de Wetering. arXiv:1902.03178 [quant-ph]

  • Reducing T-count with the ZX-calculus. AK, John van de Wetering

arXiv:1903.10477 [quant-ph]

  • CNOT circuit extraction for topologically-constrained quantum memories.AK,

Arianne Meijer-van de Griend arXiv:1903.00633 [quant-ph]

Quantomatic: quantomatic.github.io PyZX: github.com/Quantomatic/pyzx

Aleks Kissinger QNLP 2020 34 / 34