Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Quantum Compiler

239 views

Published on

OpenQL Seminar 2018/03/19 handout

Published in: Science
  • Be the first to comment

  • Be the first to like this

Quantum Compiler

  1. 1. OpenQL Project, 2018 Page. 1 量子コンパイラについて考える会 OpenQL勉強会資料 @k_yamaz | OpenQL >
  2. 2. Page. 2OpenQL Project, 2018 「量子コンパイラを考える会」の意義(目的) 量子コンパイラを開発していきたい   量子コンピューター自体が未成熟な機器      →独創的な発想が求められる分野   技術領域が広く、最先端技術を集結しなければならない        →知的好奇心を満たすには良い素材 歴史の追体験   40年ほど前、コンピューター(CPU)が世の中に出て来た時代の追体験      →懐かしむ      →今から 40年後の未来を担うために
 
 “量子コンピューターや量子情報を勉強する動機”という方がよいですが、
 推進するための取り組みとして「量子コンパイラ開発」をテーマにしています。 とても、1回の勉強会では検討しきれない → 継続的に扱いましょうか?
  3. 3. Page. 3OpenQL Project, 2018 References ProjectQ: An Open Source Software Framework for Quantum Computing Damian S. Steiger, Thomas Häner, Matthias Troyer Institute for Theoretical Physics, ETH Zurich arXiv: 1612.08091 An Experimental Microarchitecture for a Superconducting Quantum Processor X. Fu, M. A. Rol, C. C. Bultink, J. van Someren, N. Khammassi, I. Ashraf, R. F. L. Vermeulen, J. C. de Sterke, W. J. Vlothuizen, R. N. Schouten, C. G. Almudever, L. DiCarlo, K. Bertels QuTech, Delft University of Technology arXiv: 1708.07677 A Software Methodology for Compiling Quantum Programs Thomas Häner, Damian S. Steiger, Krysta Svore, Matthias Troyer ETH Zurich, Microsoft Research Station Q arXiv: 1604.01401
  4. 4. Page. 4OpenQL Project, 2018 Related work Several quantum programming languages, simulators, and compilers have been proposed and implemented in various languages. Quipper : a quantum program compiler implemented in Haskell. the ScaffCC compiler : based on the LLVM framework. the LIQUi |> simulator : simulator, which is implemented in F# and only available as a binary → #Q Project Q :
 from ETH Zurich, An Open Source Software Framework for Quantum Computing. Quil : from Rigetti. arXiv:1608.03355. OpenQASM : from IBM. arXiv:1707.03429.
  5. 5. Page. 5OpenQL Project, 2018 Overview of the quantum computer system stack 量子プログラム( H|ψ> の計算)  → 重ね合せ状態の複素行列計算 複素関数方程式の解法 量子アセンブリ、誤り訂正  → 量子演算子を使って 時間発展(=計算する) 例)Hadamard, T-gate, CNOT 量子ファームウェア(量子ビット操作)  → Quantum Chip の物理的操作 例)レーザー照射, 高周波電流 (arXiv:1708.07677) An Experimental Microarchitecture for a Superconducting Quantum Processor より
  6. 6. Page. 6OpenQL Project, 2018 eDSL and Compiler Pipe-Line  Figure 3: ProjectQ’s full stack software framework. Users write their quantum programs in a high-level domain-specific language embedded in Python. The quantum program is then sent to the MainEngine , which is the front end of the modular compiler. The compiler consists of individual compiler engines which transform the code to the low- level instruction sets supported by the various back-ends, such as interfaces to quantum hardware, a high-performance quantum simulator and emulator, as well as a circuit drawer and a resource counter. (arXiv:1612.08091) ProjectQ: An Open Source Software Framework for Quantum Computing より
  7. 7. Page. 7OpenQL Project, 2018 High-level picture of what a compiler does Figure 1: High-level picture of what a compiler does: It transforms the high-level user code to gate sequences satisfying the constraints dictated by the target hardware (supported gate set, connectivity, ...) while optimizing the circuit. The resulting low-level instructions are then translated to, e.g., pulse sequences. (arXiv:1612.08091) ProjectQ: An Open Source Software Framework for Quantum Computing より
  8. 8. OpenQL Project, 2018 Page. 8 Low-Level Compilation and MicroArchitecture
  9. 9. Page. 9OpenQL Project, 2018 Overview of the Quantum MicroArchitecture (QuMA) (arXiv:1708.07677) An Experimental Microarchitecture for a Superconducting Quantum Processor より
  10. 10. Page. 10OpenQL Project, 2018 QCBox firmware architecture & the implemented QuMA (arXiv:1708.07677) An Experimental Microarchitecture for a Superconducting Quantum Processor より  on FPGA
  11. 11. Page. 11OpenQL Project, 2018 Supercoducting Qubits  Figure 2: Images at various scales of a transmon qubit coupled to a readout resonator in a planar circuit quantum electrodynamics chip. (a) Qubit (Q), resonator (R), flux-bias line (PF), feedline input (Pi), and feedline output (Po). (b) Zoom-in on the two Josephson junctions of the qubit. The magnetic flux threaded through the loop sets the qubit transition frequency fQ. (c) Zoom-in on one of the two Josephson junctions. (arXiv:1708.07677) An Experimental Microarchitecture for a Superconducting Quantum Processor より
  12. 12. Page. 12OpenQL Project, 2018 The format of QIS instructions, QuMIS, ... (arXiv:1708.07677) An Experimental Microarchitecture for a Superconducting Quantum Processor より
  13. 13. OpenQL Project, 2018 Page. 13 High-Level Compilation
  14. 14. Page. 14OpenQL Project, 2018 High level quantum language ## The basic (quantum) types. l  qubit : A quantum bit, which is the basic building block of all quantum types l  qureg : General purpose quantum registers, consisting of a fixed 
 or variable number of qubits l  quint : Quantum integer types l  qufixed : Quantum fixed-point types l  qufloat : Quantum floating-point types 量子コンピューターで小数を扱うにはどうしたら良いでしょう? QFTを使った 21/2(√2)進数?
 qubit の係数は、複素数で表される = 複素数をプリミティブにできる? アンシラ(補助)量子ビットを付加するのは、より下層で実現か? (arXiv:1612.08091) ProjectQ: An Open Source Software Framework for Quantum Computing より (arXiv:1604.01401) A Software Methodology for Compiling Quantum Programs より
  15. 15. Page. 15OpenQL Project, 2018 High level quantum language 量子Fourier変換の回路.この回路は量子Fourier変換に対する積表現から容易に導ける.
 回路の最後の交換ゲートは図に示されていないが,q ビットの順序を反転する.
 出力の正規化係数1/√2 も示されていない. |j1> |j2> |jn-1> |jn> |0>+e2πi0.j1…jn|1> |0>+e2πi0.j2…jn|1> |0>+e2πi0.jn-1jn|1> |0>+e2πi0.jn|1> H R2 Rn-1 Rn H Rn-2 Rn-1 H R2 H ・・・ ・・・ ・・・ ・・・ ・・・ ・・・ ・・・ ・・・ |j1> |j2> |jn-1> |jn> |0>+e2πi0.j1…jn|1> |0>+e2πi0.j2…jn|1> |0>+e2πi0.jn-1jn|1> |0>+e2πi0.jn|1> H R2 Rn-1 Rn H Rn-2 Rn-1 H R2 H ・・・ ・・・ ・・・ ・・・ ・・・ ・・・ ・・・ ・・・
  16. 16. Page. 16OpenQL Project, 2018 High level quantum language ## Quantum gates. どのようなゲート操作を提供したらよいでしょう?    例)「T, H, CNOT」「S, H, CNOT, Toffoli」・・・必要十分 Z周りの任意回転, Pauli-X,Y,Z ... ※おそらく低階層でハードウェアがサポートするゲートとは異なるでしょう。 ※そもそも、High-Level Language では、ゲート操作は意識させないのが良い? (arXiv:1604.01401) A Software Methodology for Compiling Quantum Programs より
  17. 17. Page. 17OpenQL Project, 2018 Transform Quantum Gate flow  Figure 5: Individual stages of compiling an entangling operation for the IBM back-end. The high-level Entangle-gate is decomposed into its definition (Hadamard gate on the first qubit, followed by a sequence of controlled NOT gates on all other qubits). Then, the CNOT gates are remapped to satisfy the logical constraint that controlled NOT gates are allowed to act on one qubit only, followed by optimizing and mapping the circuit to the actual hardware. (arXiv:1612.08091) ProjectQ: An Open Source Software Framework for Quantum Computing より つじしん さんの 発表で詳しく
  18. 18. Page. 18OpenQL Project, 2018 Solovay Kitaev theorem if a set of single-qubit quantum gates generates a dense subset of SU(2) then that set is guaranteed to fill SU(2) quickly. For instance, θ= π/ 8 is HTSHTSHTSHTHTSHTSHTSHTHTSHTHTSHTHTSHTSHTHTHTSHTSHTHTSHTHTS HTHTHTHTSHTSHTSHTHTSHTSHTSHTHTSHTHTHTHTSHTHTHTSHTHTHTHTSH TSHTSHTHTSHTSHTHTSHTHTSHTHTSHTHTSHTSHTHTSHTHTSHTSHTSHTSHTH THTSHTHTSHTHTHTHTSHTHTHTHTHTHTSHTSHTSHTHTSHTSHTHTSHTSHTHT HTSHTSHTHTHTSHTHTHSS for a tolerance of 10-10 and HTHTSHTSHTSHTSHTHTSHTHTHTSHTHTSHTHTHTSHTSHTSHTSHTSHTSHTSHTS HTSHTHTSHTHTSHTHTHTSHTSHTSHTHTHTHTSHTSHTHTSHX
 =HT*(HTS)^4*HT*HTS*(HT)^2*(HTS*HT)^2*HT*(HTS)^9*(HT*HTS)^2*(HT)^2*(HTS)^3 *(HT)^3*(HTS)^2*HT*HTS*HX for a tolerance of 10-4, (arXiv:1604.01401) A Software Methodology for Compiling Quantum Programs より 5月14日(月)開催予定
 「Solovay-Kitaevの定理を学ぶ
 (量子ゲートセットへの分解 」
  19. 19. Page. 19OpenQL Project, 2018 High level quantum language ## Quantum control flow statements. ・可逆計算な部分の reverse compute が可能. High-level optimizationで利用. ・サブルーチン化 ・条件分岐(if ... then ... else ...) ⇔ 量子マルチプレクサ(複数の制御ユニタリゲート):量子的
 条件判定量子ビットを測定して分岐:古典的 ・再帰処理 :第二量子化による数学的定式化の利用 ・ループ処理 :非決定性分岐を利用すると、停止性判定が困難に? ・回路途中の測定の扱いは? ・naive programmer(無邪気な開発者)は、量子プログラムを正しく書けるか? → 正当性の判定
 量子最弱事前条件(Kraus表現)、停止性(量子グラフ理論)、到達可能性、
 健全性、完全性 などの考慮 (arXiv:1612.08091) ProjectQ: An Open Source Software Framework for Quantum Computing より (arXiv:1604.01401) A Software Methodology for Compiling Quantum Programs より 量子プログラミングの基礎 Mingsheng Ying著, 川辺 治之訳 共立出版 ¥6,500+税 ISBN: 978-4320124059
  20. 20. Page. 20OpenQL Project, 2018 The proposed toolchain for quantum programming ToolChain や PipeLine の考え方は、LLVM の設計思想を模していると思われます。  eDSL による既存の言語の言語拡張: 実装しやすい言語は? (arXiv:1604.01401) A Software Methodology for Compiling Quantum Programs より
  21. 21. Page. 21OpenQL Project, 2018 Compilation Process ## A. Host language compilation The first step of the compilation process is carried out by the host language compiler/ interpreter, resolving the control statements of the classical code and performing first optimizations. ## B. High-level quantum compiler The quantum part of the code is compiled further using all available information on the high-level structure of the quantum program. This includes both meta instruction replacement and optimization. ## C. Low-level quantum compiler The code consists of quantum gates, inlined library functions, and library calls to be resolved later. The task of the low level compiler is to translate all quantum gates into sequences of gates from a discrete, technology-dependent set of quantum gates. The concrete structure of this set depends on both the hardware and the chosen error correction strategy. (arXiv:1604.01401) A Software Methodology for Compiling Quantum Programs より
  22. 22. Page. 22OpenQL Project, 2018 Compilation Process ## D. Logical layout generator and optimizer We have to assign qubit variables to logical qubits similar to how variables are assigned to registers in classical computers. ## E. Quantum error correction (QEC) Unlike classical computers, quantum computers suffer readily from noise on very short time scale and require substantial overhead in both additional qubits and quantum gates to maintain a fault-tolerant and reliable computation. Quantum error correction protects a logical qubit through redundancy, which is similar in nature to a classical repetition code, where a bit of information is copied into several bits and the information is decoded by taking a majority vote over the copies. If the error rate on a given bit is low enough, that is, below a threshold, then the information will be protected. (arXiv:1604.01401) A Software Methodology for Compiling Quantum Programs より
  23. 23. Page. 23OpenQL Project, 2018 Compilation Process ## F. Physical layout generator and optimizer At this level, the physical qubits are mapped to actual hardware qubits. This mapping may be straightforward if the hardware layout is built with a specific error correction scheme in mind.. ## G. Mapping to hardware The final step is the mapping of physical gate operations to hardware control of the specific device. For example, a hardware backend for superconducting qubits may map a native X gate to a function call of an arbitrary wave form generator which will apply a microwave pulse corresponding to an X gate on this qubit. (arXiv:1604.01401) A Software Methodology for Compiling Quantum Programs より

×