Language, Compiler, and Optimization Issues in Quantum Computing
Fred Chong Diana Franklin Jeff Heckey Daniel Kudrow UC Santa Barbara Ali JavadiAbhari Shruti Patil Princeton University Kenneth R. Brown Georgia Tech Adam Holmes Cornell University
Language, Compiler, and Optimization Issues in Quantum Computing - - PowerPoint PPT Presentation
Language, Compiler, and Optimization Issues in Quantum Computing Margaret Martonosi Princeton University Fred Chong Ali JavadiAbhari Kenneth R. Brown Diana Franklin Shruti Patil Georgia Tech Jeff Heckey Princeton University Daniel Kudrow
Fred Chong Diana Franklin Jeff Heckey Daniel Kudrow UC Santa Barbara Ali JavadiAbhari Shruti Patil Princeton University Kenneth R. Brown Georgia Tech Adam Holmes Cornell University
QC Ten years ago:
¡ High level algorithms ¡ Low level devices ¡ Little in between
Today:
¡ Increasing attention at
languages and toolflows to connect top to bottom.
Why? And why “regular”
QC Algorithms QC Devices Languages, Compilers, Toolflows Architectural Design
No abstractions, no system layering.
¡ Just people with big problems to solve ¡ And people who could build machines.
1964: Instruction Set Architecture is
¡ ISA = Fundamental abstraction: Allows same
software to run on different implementations.
¡ Gives software stable target. Allows hardware to
¡ Supports independent layers of optimization
and analysis.
Now: Time to begin similar layerings for
¡ Should be a collaboration of QC people and
classical computer systems researchers.
¡ Quantify physical bounds and hardware characteristics ¡ Alert physicists of technological limits that are needed for
¡ Scaling to arbitrary sizes compounds challenges
Few diverse and large-scale
Few openly-available tools for
Code/data specialization
No cloning theorem -> Many
Long serial chains: Data
eg Quantum Teleportation vs.
¡ Good experimental understanding ¡ Microwave control ¡ Allows for “SIMD” operation:
¡ Superconducting, QDOT…
SIMD Region
Local Mem
Microwave Control
¡ Capacity (d): Few to 100’s ¡ K=2-8 SIMD regions are useful
Teleport Teleport
Teleportation Unit
Global Memory Entangled Pair Channels
Local Mem Local Mem
SIMD Region SIMD Region SIMD Region SIMD Region
Teleport Teleport
Local Mem Local Mem
Microwave Control Microwave Control Microwave Control Microwave Control Microwave Control K SIMD operation regions, each operating
Teleport Teleport
Teleportation Unit
Global Memory Entangled Pair Channels
Local Mem Local Mem
SIMD Region SIMD Region SIMD Region SIMD Region
Teleport Teleport
Local Mem Local Mem
Microwave Control Microwave Control Microwave Control
Primary Goal: Schedule
Also: Manage tradeoffs
Data types and instructions in
¡ Qubits, quantum gates
Decoherence requires QECC
¡ Logical vs. Physical Levels
Efficiency crucial
¡ Inefficiencies at logical level are
amplified into greater physical level QECC requirements.
¡ Optimizations performed at
logic level can be more tractable and have high leverage.
Quantum Program in High-Level Language Compiler & High-level Scheduler Error Correction Mapper (Final Placement, Routing) Quantum Physical Operation Language QECC
Physical Machine Description
Scaffold QASM QASM with QECC
Algorithm
ScaffCC
Logical Physical
Benchmark ¡ Size ¡ Lines ¡of ¡ Code ¡ Ops ¡ Min ¡Logical ¡ Qubits ¡ Grover’s ¡Search ¡ n ¡= ¡40 ¡ 208 ¡ 2.4E+09 ¡ 120 ¡ Binary ¡Welded ¡Tree ¡ n ¡= ¡300 ¡ s ¡= ¡3000 ¡ 482 ¡ 2.9E+09 ¡ 2719 ¡ Ground ¡State ¡EsDmaDon ¡ m ¡= ¡10 ¡ 9643 ¡ 9.74E+07 ¡ 13 ¡ SHA-‑1 ¡Reversal ¡ n ¡= ¡128 ¡ 855 ¡ 1.02E+11 ¡ 486536 ¡ Shor’s ¡FactorizaDon ¡ n ¡= ¡512 ¡ 1055 ¡ 9.80E+10 ¡ 5634 ¡ Triangle ¡Finding ¡Problem ¡ n ¡= ¡5 ¡ 4052 ¡ 5.24E+09 ¡ 176 ¡ Boolean ¡Formula ¡ x ¡= ¡2 ¡ y ¡= ¡3 ¡ 693 ¡ 3.1E+08 ¡ 1711 ¡ Class ¡Number ¡ p ¡= ¡6 ¡ 383 ¡ 3.5E+06 ¡ 60052 ¡
¡ Many compilation optimizations rest on critical path estimates.
¡ Use Hierarchical / Modular techniques ¡ Obtain module critical paths separately and then treat them as
a
H T C T S
b c
C C C T T T T T C H C 1 2 3 4 5 6 7 8 9 10 11 12
PrepZ(s0) PrepZ(s1) X(s1) Toffoli(a0,s1,s0) X(s1) . . . s0 s1 a0 P z P z X X
H T C T S C C C T T T T T C H C 1 2 3 4 5 6 7 8 9 10 11 12 X Pz
s0 s1 a0 X
13 14 1 2 12 cycles 15
Module Toffoli(a,b,c) Modular Analysis Flattened Analysis
Pz
0 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 4.8E+08 ¡ 5.0E+08 ¡ 5.2E+08 ¡ 5.4E+08 ¡ 5.6E+08 ¡ 5.8E+08 ¡ 6.0E+08 ¡ 6.2E+08 ¡ 6.4E+08 ¡ 5k ¡ 10k ¡ 50k ¡ 100k ¡ 150k ¡ 2M ¡
Analysis ¡Time ¡(s) ¡ CriDcal ¡Path ¡Length ¡EsDmate ¡ (# ¡gates) ¡ FlaPening ¡Threshold ¡for ¡RemodularizaDon ¡ Binary ¡Welded ¡Tree ¡n=300, ¡s=1000 ¡
¡ QASM Output format: ÷ 200,000X on average + up to 90% for some benchmarks ¡ Code generation approach: ÷ Up to 70% for large problems
¡ Computing Frontiers (CF) 2014: ScaffCC overview. ¡ IISWC 2014: Trials & Rotations in Quantum Phase Estimation ¡ J. Parallel Computation: ScaffCC long version. ¡ ASPLOS 2015: Communication optimizations.
Global Mem SIMD 1 SIMD 2
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 a b c a b c a b
H C T† C T C T† H T C T T† C C S
a a b b a b a a b a c c c c b c c a c c b c b c a c c c a b b a b b
C H T† C T C T† T† C C T H T† C T S
¡ Optionally: schedule any same operations to one of l SIMDs
Global Mem SIMD 1 SIMD 2
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 a b c
H H C X Z X T S C X X C C H T† T† X S X C X
a b c
Global Mem SIMD 1 SIMD 2
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 a b c
H H C X Z X T S C X X C C H T† T† X S X C X
a b c
Global Mem SIMD 1 SIMD 2
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 a b c
H H C X Z X T S C X X C C H T† T† X S X C X
b c c a b c a b c a b c a b c a b c a b c a b c a b c a b c a b c
H C Z T S X C T† S X C X
a b a
Global Mem SIMD 1 SIMD 2
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 a b c
H H C X Z X T S C X X C C H T† T† X S X C X
b c c a c a b c a a b a c b c a b c a b c a b c a b c
H C Z T S X C T† S X C X
a b a
X
b
X
c b
C
c
X
b a
C H
b
X
Global Mem SIMD 1 SIMD 2
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12 a b c
H H C X Z X T S C X X C C H T† T† X S X C X
b c c a c a b c a a b a c b c a b c a b c a b c a b c
H C Z T S X C T† S X C X
a b a
X
b
X
c b
C
c
X
b a
C H
b
X
2 4 6 8 10 12 rcp lpfs rcp lpfs rcp lpfs rcp lpfs GSE M=10 SHA-1 n=128 Shors n=512 TFP n=5 Speedup Critical Path K=2 K=4 0 ¡ 2 ¡ 4 ¡ 6 ¡ 8 ¡ 10 ¡ 12 ¡ K ¡= ¡8 ¡ K ¡= ¡16 ¡ K ¡= ¡24 ¡ K ¡= ¡32 ¡ K ¡= ¡128 ¡ K ¡= ¡8 ¡ K ¡= ¡16 ¡ K ¡= ¡24 ¡ K ¡= ¡32 ¡ K ¡= ¡128 ¡ cp ¡ rcp ¡ lpfs ¡
Shor's ¡with ¡K ¡Scaling ¡
2 4 6 8 10 12 rcp lpfs rcp lpfs rcp lpfs rcp lpfs GSE M=10 SHA-1 n=128 Shors n=512 TFP n=5 Speedup Critical Path K=2 K=4
2 4 6 8 10 12 rcp lpfs rcp lpfs rcp lpfs rcp lpfs GSE M=10 SHA-1 n=128 Shors n=512 TFP n=5 Speedup Critical Path No Local Memory (K=4) Q/4 Local Memory Q/2 Local Memory Inf Local Memory
¡ Drawing from classical architectural techniques for QC
¡ 2.3x- 9.8x in the best case ¡ Logic-level (pre-QECC) scheduling limits qubit counts to
¡ And like C, it emphasizes low-level functional orchestration
¡ Good for mapping onto QASM and variants. ¡ But…
¡ Verification, simulation, assertion checking ¡ Error models and ECC support…
¡ Simulation for small problem sizes (~30 qubits) ¡ Symbolic execution for larger ¡ Type systems ¡ Model checking ¡ Certified compilation passes
¡ No-cloning, entanglement, uncomputation
¡ Need to track achieved precision
¡ Assume error probability is low enough for success in small number
¡ Static analysis when possible ¡ Symbolic execution when necessary
Precision-optimized
Example: Select
¡ Expressibility of algorithms, ¡ Verification of program correctness ¡ Annotations of precision and error bounds
¡ Verification or direct code generation using Unitary Transforms ¡ Precision vs. runtime optimizations.
DQ ¡ Program ¡ Logical ¡ HQASM ¡ Physical ¡ HQASM ¡ Quantum ¡ SimulaCon ¡ Circuit ¡
Quantum ¡ Machine ¡ Circuit ¡
Error-‑ Opt’d ¡ QECC ¡ Inser Con ¡ Front ¡End: ¡ Embedded ¡ DQ ¡Implem. ¡ ¡ Linear ¡Types ¡
Type ¡ Checking ¡ ¡ Precision-‑ Opt’d ¡ RotaCon ¡
Entanglement ¡ Analysis ¡ Flow ¡Analysis ¡for ¡
Precision ¡ Constraint ¡Sat. ¡+ ¡ Back ¡Prop. ¡ Error, ¡QECC ¡ Constraint ¡Sat. ¡+ ¡ Back ¡Prop. ¡ Resource ¡ OpCmizaCons ¡ Symbolic ¡ ExecuCon ¡ Proof ¡ Assistant ¡ StaCc ¡AsserCon ¡Checking ¡ Dynamic ¡ ¡ AsserCon ¡Checking ¡ Leverage ¡ExisCng ¡ScaffCC ¡Toolflow ¡
¡ EPR distribution network underlying teleportations.
¡ Decoherence and purification rate of qubits.
¡ Communication-Avoiding Algorithms localize compute in
¡ Current/Future work: Balance qubit storage/communication
High-level languages for
Mid-level languages for scalable
Toolflows and benchmarks drive
QC Algorithms QC Devices Languages, Compilers, Toolflows Architectural Design
¡ Students: Ali JavadiAbhari, Adam Holmes, Jeff Heckey ¡ Post-docs and Profs: Shruti Patil, Fred Chong, Diana Franklin, Ken
¡ Alexey Lvov, John Black, Lukas Svec, Aram Harrow, Amlan Chakrabarti,
¡ NSF PHY-1415537, IARPA, …
¡ Computing Frontiers (CF) 2014: ScaffCC overview. ¡ IISWC 2014: Trials & Rotations in Quantum Phase Estimation ¡ J. Parallel Computation: ScaffCC long version. ¡ ASPLOS 2015: Communication optimizations. ¡ http://mrmgroup.cs.princeton.edu