Quit lloction for quntum circuit compilers Nov. 10, 2017 JIQ 2017 Mrcos Yukio Sirichi Sylvin Collnge Vinícius Fernndes dos Sntos Fernndo Mgno Quintão Pereir
Compilers for quntum computing The first genertion of usle quntum computers is here e.g. IBM Quntum Experience Enles experimentl computer science Existing nd ner-future rchitectures: 10s to 50 quits No error correction Low-level constrints on circuits: set of gtes, quit connectivity Need compilers of circuits down to lowlevel gtes Mny differences from clssicl compilers Algorithms Quntum circuits Quntum circuit compiler Quntum microrchitecture Quntum computing hrdwre
Focus: the quit lloction phse Mp logicl quits to physicl quits Need to meet hrdwre constrints: connectivity etween physicl quits Trnsform circuit to fit on given quntum computer Minimize runtime nd gte count to minimize noise Softwre: circuit on logicl quits rdwre: physicl quits 3
Agend The quit lloction prolem An exct lgorithm A greedy heuristic Comprison of lloction ccurcy Future directions 4
Level of strction: quntum circuits Input: reversile quntum circuits descried t gte level 0 X 0 T Between initiliztion nd mesurement : unitry gtes only After decomposition into single-quit nd CNOT gtes Expressed in QASM lnguge qreg l[2]; creg c[2]; x l[0]; h l[0]; cx l[0] l[1]; t l[1]; mesure l[0] -> c[0]; mesure l[1] -> c[1]; 5
Limited-connectivity quntum computer Trget: superconducting quit sed quntum computers Constrints on which quits re llowed to interct e.g. IBM QX2, 5 quits Quits Possile CNOT gtes e.g. IBM QX5, 16 quits 6
The quit ssignment prolem Cn we lel logicl quits with physicl quits so tht ll gtes oey mchine connectivity constrints? Esy prt of quit lloction Alredy NP-Complete (sugrph isomorphism) l0 l1 l2 l3 l4 l4 l0 l2 l3 l1 emed? Circuit Dependencies on logicl quits Connectivity of physicl quits In prctice, most circuits will need trnsformtions to fit the connectivity grph 7
Circuit trnsformtion primitives CNOT reversl Trnsformtion Effect on dependency grph (ssuming no other dependency) Bridge ` c c c Swp Chnge mpping! 8
The quit lloction prolem Quit lloction with swps only Minimize numer of swps inserted NP-Complete (Token Swpping prolem) Generl quit lloction prolem Use CNOT reversl, ridge nd swp Minimize cost of circuit trnsformtions Suprolem of depth d Circuit depth := numer of CNOT gtes Strts nd ends with logicl-to-physicl quit mppings initil L Q mpping Slice of depth d finl L Q mpping Slice of depth d+1 9
......... Exct lgorithm: dynmic progrmming Assume we know prtil solutions of depth d with finl mpping M nd their cost, for ll M Compute solutions of depth d+1 with finl mpping M, for ll M Select the (solution of depth d) + (permuttion) tht minimizes cost Solutions of depth d: cost Cost of permuttion from Mi to Mj Solutions of depth d+1... Solutions for full circuit M0 22 29 3 6 M1 26 0 25 1 10 3 M2 20 6 26 3 28 Unfesile solutions hve cost Finl solution: minimum cost 10
......... Exct lgorithm: dynmic progrmming Solutions of depth d: cost Cost of permuttion from Mi to Mj Solutions of depth d+1... Solutions for full circuit M0 22 29 3 6 M1 26 0 25 1 10 3 M2 20 6 26 3 28 Unfesile solutions hve cost Finl solution: minimum cost Complexity O((n!) 2 m) for n quits nd circuit depth m Suitle for 8 quits Gives n optiml reference to compre heuristics 11
The Weighted Prtil Mtching heuristic 1. Find good initil mpping Fvor most-often used dependencies 2. Extend the mpping, trnsforming circuit s needed Perform swp when it cn e mortized Use CNOT reversl on ckwrd edges If we hve 2-step pth through nother quit, use Bridge If ll else fils, insert s mny swps s needed 12
Results: cost on IBM QX2, ctul circuits Exct lgorithm Other heuristics from the literture Our heuristic with rndom initil mpping Our heuristic quiter heuristic with improved initil mpping euristic outperforms stte of the rt in this 5-quit configurtion Exct lgorithm shows heuristics hve potentil for improvement Both in initil mpping choice nd migrtion strtegy 13
Next steps for quit lloction Improved heuristics Seek run-time vs. ccurcy trdeoffs Specilize for regulr quntum computer structures Tke dvntge of quntum circuit properties: spcil, temporl loclity Coordinte circuit optimiztion with quit lloction e.g. optimize wy redundnt dmrd gtes when plcing reverse CNOT next to gtes Recycle ncille quits Quit with completely known equl stte re interchngele (e.g. 0 ) Sttic nlysis to find quit equlities? Optimize for device chrcteristics Different quits nd couplings hve different noise levels 14
Compiler optimiztion for quntum circuits Mpping high-level gtes to hrdwre-supported gtes Single-quit gtes: ccurcy/cost trdeoffs Toffoli gtes: exploit freedom on reltive phse Time/spce trdeoffs Adpt numer of ncille quits to resource vilility Formliztion Which semntics for quntum progrms nd quntum computers? Which intermedite representtion for quntum circuits? Correctness proofs of compiler trnsformtions 15