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

quantum circuit optimisation with the zx calculus
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 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

slide-2
SLIDE 2

Quantum circuit optimisation

§ We want to use quantum resources as efficiently as possible.

slide-3
SLIDE 3

Quantum circuit optimisation

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

slide-4
SLIDE 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:

slide-5
SLIDE 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

slide-6
SLIDE 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 = RZp π

4 q ]

slide-7
SLIDE 7

Circuit diagrams

NOT =

+

CNOT =

+

An example quantum circuit:

T

` `

H

`

S S

slide-8
SLIDE 8

Circuit identities

+ +

=

H H

=

T T

=

S T: T

=

slide-9
SLIDE 9

Gate commutation

=

+ + + +

T

=

+

T

+

T

=

+ +

T T

+ +

T

slide-10
SLIDE 10

More circuit equalities

slide-11
SLIDE 11

And more circuit equalities

slide-12
SLIDE 12

And even more circuit equalities

slide-13
SLIDE 13

Things get messy because circuits are very rigid

slide-14
SLIDE 14

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

slide-15
SLIDE 15

ZX-diagrams

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

slide-16
SLIDE 16

ZX-diagrams

What gates are to circuits, spiders are to ZX-diagrams. Z-spider X-spider |0 ¨ ¨ ¨ 0yx0 ¨ ¨ ¨ 0| |+ ¨ ¨ ¨ +yx+ ¨ ¨ ¨ +| `eiα |1 ¨ ¨ ¨ 1yx1 ¨ ¨ ¨ 1| ` eiα |- ¨ ¨ ¨ -yx- ¨ ¨ ¨ -|

α

... ...

α

... ...

slide-17
SLIDE 17

ZX-diagrams

What gates are to circuits, spiders are to ZX-diagrams. Z-spider X-spider |0 ¨ ¨ ¨ 0yx0 ¨ ¨ ¨ 0| |+ ¨ ¨ ¨ +yx+ ¨ ¨ ¨ +| `eiα |1 ¨ ¨ ¨ 1yx1 ¨ ¨ ¨ 1| ` eiα |- ¨ ¨ ¨ -yx- ¨ ¨ ¨ -|

α

... ...

α

... ... Spiders can be wired in any way:

α

π 2 3π 2

β π

slide-18
SLIDE 18

Quantum gates as ZX-diagrams

Every quantum gate can be written as a ZX-diagram: S “

π 2

T “

π 4

H “ :=

π 2 π 2 π 2

CNOT “ CZ “ “

slide-19
SLIDE 19

Quantum gates as ZX-diagrams

Every quantum gate can be written as a ZX-diagram: S “

π 2

T “

π 4

H “ :=

π 2 π 2 π 2

CNOT “ CZ “ “

Universality

Any linear map between qubits can be represented as a ZX-diagram.

slide-20
SLIDE 20

Rules for ZX-diagrams: The ZX-calculus

β

... ...

α

... ... “ ... ... ...

α`β p-1qaα

aπ aπ aπ α

... ...

aπ aπ

...

aπ α

“ ...

aπ aπ α

... “

α

... “ “ “ α, β P r0, 2πs, a P t0, 1u

slide-21
SLIDE 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).

slide-22
SLIDE 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.

slide-23
SLIDE 23

Optimisation using ZX-diagrams

§ Write circuit as ZX-diagram.

slide-24
SLIDE 24

Optimisation using ZX-diagrams

§ Write circuit as ZX-diagram. § Turn it into graph-like ZX-diagram.

slide-25
SLIDE 25

Optimisation using ZX-diagrams

§ Write circuit as ZX-diagram. § Turn it into graph-like ZX-diagram. § Simplify the diagram.

slide-26
SLIDE 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.

slide-27
SLIDE 27

PyZX

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

slide-28
SLIDE 28

Graph-like diagrams

π 2 π 2 π 2 π 2 π 2 π 2 π 2 π 2

=

π 2

π

π 2 π 2 π 2 π 2 π 2

slide-29
SLIDE 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.

slide-30
SLIDE 30

The tools: Local complementation and pivoting

˘ π

2

α1 αn

... ... ... “ ...

α1¯ π

2

...

αn ¯ π

2

α2

...

αn

´ 1

...

α2¯ π

2

...

αn

´ 1¯ π 2

... ...

jπ α1

αn β1 βn γ1 γn kπ

... ... ...

αn ` kπ βn ` pj ` k ` 1qπ

...

β1 ` pj ` k ` 1qπ γ1 ` jπ α1 ` kπ

... ...

γn ` jπ

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

Duncan, Kissinger, Perdrix, vdW (2019)

slide-31
SLIDE 31

Example

Example result after simplification:

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

slide-32
SLIDE 32

Example

Example result after simplification:

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

Problem: does not look a circuit.

slide-33
SLIDE 33

Example

Example result after simplification:

π 2 7π 4 5π 4 π 4 3π 2 3π 2 5π 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.

slide-34
SLIDE 34

Clifford simplification

Clifford circuits are reduced to a pseudo-normal form:

LC LC LC

...

LC LC

...

LC

¨ ¨ ¨

slide-35
SLIDE 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 |x1, x2, x3, x4y ÞÑ |x1 ‘ x2, x1 ‘ x3, x4, x3y .

slide-36
SLIDE 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

slide-37
SLIDE 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].

slide-38
SLIDE 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 9n ´ 2, a

new record (Recently matched by [Bravyi & Maslov 2020]).

slide-39
SLIDE 39

Non-Clifford optimisation

slide-40
SLIDE 40

Non-Clifford optimisation

Additional rules for phase gadgets:

α

...

phase gadget

:: |x1, ..., xny ÞÑ eiαpx1‘...‘xnq |x1, ..., xny

slide-41
SLIDE 41

Non-Clifford optimisation

Additional rules for phase gadgets:

α

...

phase gadget

:: |x1, ..., xny ÞÑ eiαpx1‘...‘xnq |x1, ..., xny

=

α

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

(-1)jα α β α1 αn

...

α ` β α1 αn

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

Kissinger, vdW 2019: Reducing T-count with the ZX-calculus

slide-42
SLIDE 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%.

slide-43
SLIDE 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.

slide-44
SLIDE 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.

slide-45
SLIDE 45

CNOT optimisation

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

slide-46
SLIDE 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].

slide-47
SLIDE 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].

slide-48
SLIDE 48

Conclusion

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

slide-49
SLIDE 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.

slide-50
SLIDE 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.

slide-51
SLIDE 51

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. § Find ways to incorporate ancillae.

slide-52
SLIDE 52

Thank you for your attention

slide-53
SLIDE 53

References

Duncan, Kissinger, Perdrix & vdW 2019, arXiv:1902.03178 Graph-theoretic Simplification of Quantum Circuits with the ZX-calculus Kissinger & vdW 2019, arXiv:1903.10477 Reducing T-count with the ZX-calculus Backens, Miller-Bakewell, de Felice, Lobski & vdW 2020, arXiv:2003.01664 There and back again: A circuit extraction tale Heyfron & Campbell 2018, arxiv:1712.01557 An Efficient Quantum Compiler that reduces T count Maslov & Roetteler 2018, arXiv:1705.09176 Shorter stabilizer circuits via Bruhat decomposition and quantum circuit transformations Zhang & Chen 2019, arXiv:1903.12456 Optimizing T gates in Clifford+T circuit as π{4 rotations around Paulis Bravyi & Maslov 2020, arXiv:2003.09412 Hadamard-free circuits expose the structure of the Clifford group