TW202134959A - Control method for a distributed processing system including a quantum information processor - Google Patents
Control method for a distributed processing system including a quantum information processor Download PDFInfo
- Publication number
- TW202134959A TW202134959A TW110104907A TW110104907A TW202134959A TW 202134959 A TW202134959 A TW 202134959A TW 110104907 A TW110104907 A TW 110104907A TW 110104907 A TW110104907 A TW 110104907A TW 202134959 A TW202134959 A TW 202134959A
- Authority
- TW
- Taiwan
- Prior art keywords
- classical
- program
- quantum
- processors
- hardware
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 109
- 238000012545 processing Methods 0.000 title claims abstract description 41
- 230000003993 interaction Effects 0.000 claims abstract description 48
- 230000015654 memory Effects 0.000 claims description 40
- 230000002452 interceptive effect Effects 0.000 claims description 32
- 230000006870 function Effects 0.000 claims description 30
- 238000003860 storage Methods 0.000 claims description 24
- 238000003780 insertion Methods 0.000 claims description 22
- 230000037431 insertion Effects 0.000 claims description 22
- 230000003068 static effect Effects 0.000 claims description 21
- 238000005206 flow analysis Methods 0.000 claims description 14
- 230000006698 induction Effects 0.000 claims description 5
- 238000004891 communication Methods 0.000 description 15
- 230000014509 gene expression Effects 0.000 description 14
- 238000004422 calculation algorithm Methods 0.000 description 13
- 239000002096 quantum dot Substances 0.000 description 11
- 230000001419 dependent effect Effects 0.000 description 10
- 238000004458 analytical method Methods 0.000 description 9
- 101100096995 Caenorhabditis elegans strm-1 gene Proteins 0.000 description 7
- 238000005457 optimization Methods 0.000 description 6
- 208000033986 Device capturing issue Diseases 0.000 description 5
- 238000004364 calculation method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 5
- 238000013519 translation Methods 0.000 description 5
- 239000003990 capacitor Substances 0.000 description 4
- 238000004590 computer program Methods 0.000 description 4
- 238000010276 construction Methods 0.000 description 4
- 238000013461 design Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 4
- 238000012805 post-processing Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000007405 data analysis Methods 0.000 description 3
- 230000001939 inductive effect Effects 0.000 description 3
- 238000007781 pre-processing Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000010365 information processing Effects 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 238000005481 NMR spectroscopy Methods 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 239000001307 helium Substances 0.000 description 1
- 229910052734 helium Inorganic materials 0.000 description 1
- SWQJXJOGLNCZEY-UHFFFAOYSA-N helium atom Chemical compound [He] SWQJXJOGLNCZEY-UHFFFAOYSA-N 0.000 description 1
- 238000005040 ion trap Methods 0.000 description 1
- 150000002500 ions Chemical class 0.000 description 1
- 239000007788 liquid Substances 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- KRTSDMXIXPKRQR-AATRIKPKSA-N monocrotophos Chemical compound CNC(=O)\C=C(/C)OP(=O)(OC)OC KRTSDMXIXPKRQR-AATRIKPKSA-N 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 230000000644 propagated effect Effects 0.000 description 1
- 230000005610 quantum mechanics Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 230000001568 sexual effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 239000000243 solution Substances 0.000 description 1
- 238000004611 spectroscopical analysis Methods 0.000 description 1
- 239000012086 standard solution Substances 0.000 description 1
- 239000002887 superconductor Substances 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/447—Target code generation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/443—Optimisation
- G06F8/4441—Reducing the execution time required by the program code
- G06F8/4443—Inlining
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N10/00—Quantum computing, i.e. information processing based on quantum-mechanical phenomena
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N10/00—Quantum computing, i.e. information processing based on quantum-mechanical phenomena
- G06N10/60—Quantum algorithms, e.g. based on quantum optimisation, quantum Fourier or Hadamard transforms
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Condensed Matter Physics & Semiconductors (AREA)
- Evolutionary Computation (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Computational Mathematics (AREA)
- Artificial Intelligence (AREA)
- Devices For Executing Special Programs (AREA)
- Multi Processors (AREA)
Abstract
Description
本揭露涉及一種分散式計算系統。更具體地,本揭露涉及包括至少一個量子資訊處理器的分散式計算系統。This disclosure relates to a distributed computing system. More specifically, the present disclosure relates to a distributed computing system including at least one quantum information processor.
目前的量子電腦通常不能自己解譯指令/程式碼。相反,人們通常藉由一些類比交互工具與量子資訊處理器進行交互,以執行量子操作並檢索/讀出資訊。這導致了經典-量子混合程式設計範式的發展,量子電腦作為強大的經典電腦的輔助處理器,承擔了使用經典方法效率低下的問題的要素。Current quantum computers usually cannot interpret instructions/codes by themselves. On the contrary, people usually interact with quantum information processors through some analog interaction tools to perform quantum operations and retrieve/read information. This has led to the development of the classical-quantum hybrid programming paradigm. As a powerful auxiliary processor of classical computers, quantum computers bear the elements of the inefficiency of classical methods.
這種經典量子混合程式通常是特定於硬體的,這可能意味著它們不靈活且功能有限。Such classical quantum hybrid programs are usually hardware-specific, which may mean that they are inflexible and have limited functionality.
根據本發明的一個方面,提供了一種轉譯(transpiling)將由分散式處理系統執行的經典量子混合程式的方法。該分散式處理系統包括一個或更多個經典處理器和一個經由經典類比交互工具可詢問(interrogable)的量子資訊處理器。經典量子混合程式包括將由量子資訊處理器執行的功能。該方法包括解析經典量子混合程式以產生經典量子混合程式的中間表示,該中間表示包括一系列基本塊,每個基本塊包括指令序列。該方法包括識別這樣的基本塊:這些基本塊的指令序列包括一個或更多個流操作指令,該一個或更多個流操作指令被配置成控制與量子資訊處理器的交互。該方法包括分析所識別的程序塊,以識別用於在一個或更多個經典處理器和量子資訊處理器上實現的一個或更多個副程式。該方法包括,基於對類比交互工具的目標硬體設定描述,利用用於控制類比交互工具與量子資訊處理器交互的目標硬體特定代碼替換副程式的一個或更多個流操作指令,以產生經典量子混合程式的硬體特定中間表示。該方法包括將經典量子混合程式的硬體特定中間表示轉換成轉譯的經典量子混合程式。According to one aspect of the present invention, a method of transpiling a classical quantum hybrid program to be executed by a distributed processing system is provided. The distributed processing system includes one or more classical processors and a quantum information processor interrogable via classical analog interactive tools. The classical quantum hybrid program includes functions to be executed by the quantum information processor. The method includes parsing the classical quantum hybrid program to generate an intermediate representation of the classical quantum hybrid program, the intermediate representation including a series of basic blocks, each basic block including a sequence of instructions. The method includes identifying basic blocks whose instruction sequence includes one or more stream operation instructions configured to control interaction with the quantum information processor. The method includes analyzing the identified program blocks to identify one or more subroutines for implementation on one or more classical processors and quantum information processors. The method includes, based on the description of the target hardware setting of the analog interactive tool, replacing one or more stream operation instructions of the subroutine with specific code of the target hardware used to control the interaction of the analog interactive tool with the quantum information processor to generate The hardware-specific intermediate representation of the classical quantum hybrid program. The method includes converting the hardware-specific intermediate representation of the classical quantum hybrid program into a translated classical quantum hybrid program.
該方法還可以包括,在識別到其指令序列包括一個或更多個流操作指令的基本塊之後,標記用於插入(inlining)的程序呼叫。程序可以包括一個或更多個基本塊。該方法還可以包括插入包含被標記用於插入的程序呼叫的基本塊。標記用於插入的程序呼叫可以包括將包含一個或更多個基本塊的程序標記為屬於第一集合,對於該一個或更多個基本塊,其指令序列包括一個或更多個流操作指令。標記用於插入的程序呼叫還可以包括將從其可到達第一集合的任何標記程序的程序標記為屬於第二集合。標記用於插入的程序呼叫還可以包括將第一集合和第二集合組合以形成第三集合。標記用於插入的程序呼叫還可以包括,對於第三集合中的每個程序,識別調用該程序的所有調用程序,並且如果調用程序已經在第三集合中,或者如果調用程序在第二集合中並且調用第二集合中的另一個程序,則標記用於插入的調用。此外,如果調用程序在第二集合中,並且調用第二集合中的另一個程序,那麼調用程序被添加到第三集合。The method may further include marking a program call for inlining after identifying a basic block whose instruction sequence includes one or more stream operation instructions. The program can include one or more basic blocks. The method may also include inserting a basic block containing a program call marked for insertion. Marking the program call for insertion may include marking the program containing one or more basic blocks as belonging to the first set, for which the instruction sequence includes one or more flow operation instructions. Marking a program call for insertion may also include marking the program of any marked program from which the first set is reachable as belonging to the second set. Marking the program call for insertion may also include combining the first set and the second set to form a third set. Marking the program call for insertion may also include, for each program in the third set, identifying all calling programs that called the program, and if the calling program is already in the third set, or if the calling program is in the second set And call another program in the second set, then mark the call for insertion. In addition, if the calling program is in the second set and another program in the second set is called, the calling program is added to the third set.
分析所識別的基本塊以識別一個或更多個副程式可以包括將所識別的基本塊轉換成靜態單賦值形式,並且另外確保每個流操作指令依賴於至多一個支配流操作指令(dominating stream operation instruction)。分析所識別的基本塊以識別一個或更多個副程式還可以包括分析所識別的基本塊的靜態單賦值形式以識別一個或更多個副程式以用於在一個或更多個經典處理器和量子資訊處理器上實現。Analyzing the identified basic block to identify one or more subroutines may include converting the identified basic block into a static single-assignment form, and additionally ensuring that each stream operation instruction depends on at most one dominating stream operation instruction (dominating stream operation instruction). instruction). Analyzing the identified basic block to identify one or more subroutines may also include analyzing the static single assignment form of the identified basic block to identify one or more subroutines for use in one or more classic processors. And implemented on the quantum information processor.
分析靜態單賦值形式可以包括在所識別的基本塊內標記用於展開的迴圈;以及展開被標記用於展開的迴圈。在所識別的基本塊內標記用於展開的迴圈可以包括在所識別的基本塊內定位非常量流識別字;並且還可以包括,如果非常量流識別字依賴於迴圈歸納變數,則標記用於展開的迴圈。Analyzing the static single assignment form may include marking a loop for expansion within the identified basic block; and expanding the loop marked for expansion. Marking the loop for expansion in the recognized basic block may include locating a non-constant flow identifier in the recognized basic block; and may also include, if the non-constant flow identifier depends on the loop induction variable, then marking Used to expand the loop.
流操作指令可以包括用於啟動流的OPEN指令、用於從打開的流進行讀取的READ指令、用於寫入打開的流的WRITE指令、用於停用打開的流的CLOSE指令中的一個。The stream operation instruction may include one of an OPEN instruction for starting a stream, a READ instruction for reading from an open stream, a WRITE instruction for writing an open stream, and a CLOSE instruction for deactivating an open stream. .
確保每個流操作指令依賴於最多一個支配流操作指令可以包括在流操作的分叉路徑合併的地方插入預留位置(placeholder)流函數。Ensuring that each flow operation instruction depends on at most one dominating flow operation instruction can include inserting a placeholder flow function where the branch paths of the flow operation merge.
將所識別的基本塊轉換成靜態單賦值形式可以包括分析經典量子混合程式的控制流、支配層次結構和控制依賴性中的一個或更多個。Converting the identified basic block into a static single assignment form may include analyzing one or more of the control flow, the domination hierarchy, and the control dependency of the classical quantum hybrid program.
分析靜態單賦值形式可以包括執行資料流程分析或常量傳播(constant propagation)中的一個或更多個。Analyzing the static single assignment form may include performing one or more of data flow analysis or constant propagation.
利用用於控制類比交互工具的目標硬體特定代碼替換副程式的一個或更多個流操作指令可以包括:識別副程式的子常式,根據副程式的流操作指令和目標硬體設定描述將子常式傳遞到硬體/硬體後端,以使硬體後端能夠產生硬體設定資料和指令並定義硬體資料流程,基於配置資料、指令和硬體資料流程將命令插入經典量子混合程式的靜態單賦值形式,以向硬體後端推送資料/從硬體後端拉取資料。Replacing one or more stream operation instructions of the subroutine with the specific code of the target hardware used to control the analog interactive tool may include: identifying the subroutine of the subroutine, according to the subroutine's stream operation instruction and the target hardware setting description Subroutines are passed to the hardware/hardware backend so that the hardware backend can generate hardware configuration data and commands and define the hardware data flow, and insert commands into the classical quantum hybrid based on the configuration data, commands and hardware data flow The static single assignment form of the program to push data to/pull data from the hardware backend.
分析所識別的基本塊的靜態單賦值形式以識別用於在一個或更多個經典處理器和量子資訊處理器上實現的一個或更多個副程式可以包括分析靜態單賦值形式的流依賴性以建構流依賴圖,並且將流依賴圖的連通子圖修改為強連通子圖。分析靜態單賦值形式還可以包括基於經典量子混合程式的靜態單賦值形式的修改的流依賴圖、控制依賴性和資料依賴性來建構依賴圖;以及將依賴圖的強連通分量識別為副程式。Analyzing the static single assignment form of the identified basic block to identify one or more subroutines for implementation on one or more classical processors and quantum information processors may include analyzing the flow dependency of the static single assignment form To construct a flow dependency graph, and modify the connected subgraph of the flow dependency graph to a strongly connected subgraph. Analyzing the static single assignment form can also include constructing the dependency graph based on the modified flow dependency graph, control dependency and data dependency of the static single assignment form of the classical quantum hybrid program; and identifying the strongly connected components of the dependency graph as subprograms.
該方法還可以包括接收用於經典量子混合程式的原始程式碼。The method may also include receiving source code for the classical quantum hybrid program.
一個或更多個經典處理器可以包括現場可程式閘陣列。One or more classic processors may include a field programmable gate array.
該方法還可以包括將轉譯的經典量子混合程式的至少一部分分配給一個或更多個經典處理器。The method may also include allocating at least a part of the translated classical quantum hybrid program to one or more classical processors.
根據本發明的一個方面,提供了一種電腦可讀儲存媒體,該電腦可讀媒體上儲存有指令,該指令當由一個或更多個處理器執行時使該一個或更多個處理器執行如本文描述的轉譯經典量子混合程式的方法。According to one aspect of the present invention, there is provided a computer-readable storage medium having instructions stored on the computer-readable medium, which when executed by one or more processors cause the one or more processors to execute such as The method of translating classical quantum hybrid program described in this article.
根據本發明的一個方面,提供了一種電腦可讀儲存媒體,該電腦可讀媒體上儲存有轉譯的經典量子混合程式,該經典量子混合程式根據如本文所描述的轉譯經典量子混合程式的方法進行轉譯。According to one aspect of the present invention, there is provided a computer-readable storage medium having a translated classical quantum hybrid program stored on the computer-readable medium, and the classical quantum hybrid program is performed according to the method for translating a classical quantum hybrid program as described herein Translation.
根據本發明的一個方面,揭露了分散式系統控制器。該分散式系統控制器被配置成轉譯將由分散式處理系統執行的經典量子混合程式,該分散式處理系統包括分散式系統控制器、一個或更多個經典處理器和經由經典類比交互工具可詢問的量子資訊處理器,該經典量子混合程式包括將由量子資訊處理器執行的功能。分散式系統控制器包括一個或更多個記憶體。分散式系統控制器還包括一個或更多個處理器。該一個或更多個處理器被配置成解析經典量子混合程式以產生經典量子混合程式的中間表示,該中間表示包括一系列基本塊,每個基本塊包括指令序列。一個或更多個處理器被配置成識別這樣的基本塊:這些基本塊的指令序列包括一個或更多個流操作指令,該一個或更多個流操作指令被配置成控制與量子資訊處理器的交互。一個或更多個處理器被配置成分析所識別的基本塊,以識別一個或更多個副程式,用於在一個或更多個經典處理器和量子資訊處理器上實現。該一個或更多個處理器被配置成,基於對類比交互工具的目標硬體設定描述,利用用於控制類比交互工具與量子資訊處理器交互的目標硬體特定代碼替換副程式的一個或更多個流操作指令,以經典量子混合程式的硬體特定中間表示。該一個或更多個處理器被配置成將經典量子混合程式的硬體特定中間表示轉換(translate)成轉譯的經典量子混合程式。According to one aspect of the present invention, a distributed system controller is disclosed. The distributed system controller is configured to translate the classical quantum hybrid program to be executed by the distributed processing system. The distributed processing system includes the distributed system controller, one or more classical processors and interrogable via classical analog interactive tools. The quantum information processor, the classical quantum hybrid program includes functions to be executed by the quantum information processor. The distributed system controller includes one or more memories. The distributed system controller also includes one or more processors. The one or more processors are configured to parse the classical quantum hybrid program to generate an intermediate representation of the classical quantum hybrid program, the intermediate representation including a series of basic blocks, each basic block including a sequence of instructions. One or more processors are configured to identify basic blocks: the instruction sequence of these basic blocks includes one or more stream operation instructions, and the one or more stream operation instructions are configured to control the quantum information processor Interaction. One or more processors are configured to analyze the identified basic blocks to identify one or more subroutines for implementation on one or more classical processors and quantum information processors. The one or more processors are configured to replace one or more of the sub-programs with specific codes of the target hardware used to control the interaction between the analog interactive tool and the quantum information processor based on the description of the target hardware setting of the analog interactive tool. Multiple stream operation instructions are represented by the hardware-specific intermediate of the classical quantum hybrid program. The one or more processors are configured to translate the hardware-specific intermediate representation of the classical quantum hybrid program into a translated classical quantum hybrid program.
根據本發明的一個方面,提供了一種分散式處理系統。分散式系統包括量子資訊處理器。分散式系統還包括一個或更多個經典處理器。分散式系統還包括如本文所描述的分散式系統控制器。According to one aspect of the present invention, a distributed processing system is provided. The distributed system includes a quantum information processor. The decentralized system also includes one or more classic processors. The distributed system also includes a distributed system controller as described herein.
用於執行如本文所描述的這種方法的電腦程式及/或代碼/指令可以在電腦可讀媒體或電腦程式產品上被提供給諸如電腦的裝置。電腦可讀媒體可以是例如電子、磁、光、電磁、紅外或半導體系統,或者用於資料傳輸(例如用於藉由網際網路下載代碼)的傳播媒體。可選地,電腦可讀媒體可以採用實體電腦可讀媒體(諸如半導體或固態記憶體、磁帶、可移動電腦磁片、隨機存取記憶體(RAM)、唯讀記憶體(ROM)、硬磁片和光碟(諸如CD-ROM、CD-R/W或DVD))的形式。The computer program and/or code/instructions for executing the method as described herein can be provided to a device such as a computer on a computer-readable medium or computer program product. The computer-readable medium may be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, or a transmission medium used for data transmission (for example, for downloading codes via the Internet). Alternatively, the computer-readable medium may be a physical computer-readable medium (such as semiconductor or solid-state memory, magnetic tape, removable computer disk, random access memory (RAM), read-only memory (ROM), hard magnetic The form of film and optical disc (such as CD-ROM, CD-R/W or DVD).
根據本文給出的教導,本發明所屬領域的技術人員將會想到本文闡述的本發明的許多修改和其他實施例。因此,將會理解的是,本文的揭露並不限於本文揭露的特定實施例。此外,儘管本文提供的描述提供了在要素的某些組合的背景下的示例實施例,但是在不脫離本發明的範圍的情況下,步驟及/或功能可以由替代實施例提供。Based on the teachings given herein, those skilled in the art to which the invention pertains will come to mind many modifications and other embodiments of the invention set forth herein. Therefore, it will be understood that the disclosure herein is not limited to the specific embodiments disclosed herein. In addition, although the description provided herein provides example embodiments in the context of certain combinations of elements, steps and/or functions may be provided by alternative embodiments without departing from the scope of the present invention.
雖然下面描述了各種實施例,但是本發明不限於這些實施例,並且這些實施例的變型可以很好地落入僅由所附請求項所限定的本發明的範圍內。Although various embodiments are described below, the present invention is not limited to these embodiments, and variations of these embodiments can well fall within the scope of the present invention defined only by the appended claims.
量子資訊處理側重於基於量子力學的資訊處理和計算。雖然目前的數位電腦以二進制數位(位元)編碼資料,但是量子電腦不限於兩種狀態。它們將資訊編碼為量子位元(quantum bits),或者叫量子位(qubits),量子位元可以以疊加方式存在。量子位元是量子資訊的單位。量子位元可以用原子、離子、光子或電子(例如)和一起工作以充當電腦記憶體和處理器的合適的控制設備來實現。在下文中,術語量子資訊處理器和量子電腦被互換使用。應當理解,量子資訊處理器包括複數量子位和將量子位保持在疊加態所需的裝置。Quantum information processing focuses on information processing and calculation based on quantum mechanics. Although current digital computers encode data with binary digits (bits), quantum computers are not limited to two states. They encode information into quantum bits, or qubits, which can exist in superposition. Qubit is the unit of quantum information. Qubits can be implemented with atoms, ions, photons or electrons (for example) and work together to act as suitable control devices for computer memory and processors. In the following, the terms quantum information processor and quantum computer are used interchangeably. It should be understood that the quantum information processor includes complex quantum bits and the devices required to keep the qubits in a superposition state.
量子電腦有望在解決幾種類型的問題的速度比最好的經典電腦呈指數級增快的能力上提供史無前例的進步。然而,兌現這種前景可能需要克服相當大的技術挑戰。Quantum computers are expected to provide unprecedented advances in their ability to solve several types of problems exponentially faster than the best classical computers. However, fulfilling this prospect may require overcoming considerable technical challenges.
為了至少部分減輕這些挑戰的負擔,已經提出了幾種經典量子混合演算法。經典量子混合程式是包括一個或更多個這種經典量子混合演算法的程式。在經典量子混合演算法中,經典資源和量子資源都用於執行計算任務。這個計算任務可以簡單,也可以複雜。一個非平凡的示例是變分量子本徵求解器(Variational Quantum Eigensolver,VQE)演算法,它使用量子資源和經典資源來尋找傳統經典電腦無法獲得的對於特徵值和最佳化問題的變分解。更具體地說,VQE演算法用於尋找(通常是大的)矩陣的特徵值,該矩陣可以表示實體系統的哈密頓量(Hamiltonian)。量子子常式在經典最佳化迴圈內部運行。量子子常式包括準備由參數參數化的擬設(ansatz)量子態並測量期望值。變分原理確保這個期望值總是大於矩陣的最小特徵值。在經典最佳化迴圈中,可以反覆運算地調整參數,直到滿足收斂條件。In order to at least partially alleviate the burden of these challenges, several classical quantum hybrid algorithms have been proposed. A classical quantum hybrid program is a program that includes one or more such classical quantum hybrid algorithms. In the classical quantum hybrid algorithm, both classical resources and quantum resources are used to perform computing tasks. This calculation task can be simple or complex. A non-trivial example is the Variational Quantum Eigensolver (VQE) algorithm, which uses quantum resources and classical resources to find variational solutions for eigenvalues and optimization problems that traditional classical computers cannot obtain. More specifically, the VQE algorithm is used to find (usually large) matrices Eigenvalues of the matrix It can represent the Hamiltonian of the entity system. Quantum routines operate inside the classical optimization loop. Quantum routines include preparation of parameters Parameterized quasi hypothesis (ansatz) quantum state And measure the expected value . The variational principle ensures that this expected value is always greater than the matrix The smallest eigenvalue. In the classic optimization loop, the parameters can be adjusted repeatedly , Until the convergence condition is met.
為了最好地利用經典量子混合程式的能力,需要混合計算系統,其中一個或更多個經典處理器執行程式的大部分指令,並且只針對非常特定的任務外包給量子資訊處理器。這種混合計算系統減少了量子資訊處理器需要執行的運算元量,這意味著也可以更有效地糾正錯誤。計算任務分佈在經典和量子資訊處理器之間。In order to make the best use of the capabilities of the classical quantum hybrid program, a hybrid computing system is required, in which one or more classical processors execute most of the instructions of the program and are only outsourced to the quantum information processor for very specific tasks. This kind of hybrid computing system reduces the number of operations that the quantum information processor needs to perform, which means that errors can also be corrected more effectively. The computing tasks are distributed between the classical and quantum information processors.
目前的量子電腦通常無法自己解譯量子電腦程式。相反,人們通常使用一些經典控制的交互工具(例如微波發生器)與量子資訊處理器交互,以在量子資訊處理器上執行量子操作,並從量子資訊處理器中讀出資訊。需要軟體來配置類比交互工具,準備和處理資料,執行量子資訊處理器的校準,執行使用者提供的程式以及執行經典量子混合演算法的經典部分。標準解決方案通常包括建構產生量副程式的經典程式。這些量副程式被單獨處理,以產生例如微波級指令,用於藉由交互工具來執行。這些微波級指令通常由實驗室中的軟體解譯,以配置特定的硬體設置。該硬體設置然後執行實驗。由於使用者和最終系統之間有許多固定介面,這種方法是不靈活並且功能受限的。Current quantum computers usually cannot interpret quantum computer programs by themselves. On the contrary, people usually use some classically controlled interactive tools (such as microwave generators) to interact with the quantum information processor to perform quantum operations on the quantum information processor and read information from the quantum information processor. Software is needed to configure analog interactive tools, prepare and process data, perform quantum information processor calibration, execute user-supplied programs, and perform classical parts of classical quantum hybrid algorithms. Standard solutions usually include the construction of classic programs that generate subroutines. These quantity subroutines are processed separately to generate, for example, microwave-level commands for execution by interactive tools. These microwave-level commands are usually interpreted by software in the laboratory to configure specific hardware settings. The hardware is set up and then the experiment is performed. Since there are many fixed interfaces between the user and the final system, this method is inflexible and has limited functions.
發明人設計了一種編譯方法,用於獲取包括經典指令和量子指令的單個輸入程式,並且基於目標硬體規範輸出轉譯的程式以用於協調處理任務在適當硬體上的分佈。轉譯的程式可以相應地分佈在相關的經典處理器、低延遲可程式硬體和交互工具上。這種方法有幾個明顯的優點。首先,混合程式中的可變控制級別使量子工程師、軟體工程師和應用終端使用者能夠利用同一個系統。這減少了來自複數資料包的維護負擔,並確保了用戶和開發人員之間的一致體驗。其次,可以輕鬆選擇和更新不同的硬體目標。可以對硬體進行更新,其中需要該更新來支援程式或使程式能夠更有效地被編譯。在沒有任何必要的改變的情況下,程式可以被編譯以利用硬體中新可用的功能,如果可用的話。第三,藉由輸入一個程式,精確地描述一個人想做什麼,但不明確地說明它是如何或在哪裡完成的,編譯器有最好的機會找到一種使用硬體目標來使這個程式運行的方法。這允許對量子硬體進行完全可定制的、極低延遲的控制。The inventor designed a compilation method for obtaining a single input program including classical instructions and quantum instructions, and outputting the translated program based on the target hardware specification to coordinate the distribution of processing tasks on appropriate hardware. The translated programs can be distributed accordingly on related classic processors, low-latency programmable hardware and interactive tools. This method has several obvious advantages. First, the variable control levels in the hybrid program enable quantum engineers, software engineers, and application end users to use the same system. This reduces the maintenance burden from multiple data packages and ensures a consistent experience between users and developers. Second, different hardware targets can be easily selected and updated. The hardware can be updated, which is needed to support the program or enable the program to be compiled more efficiently. Without any necessary changes, the program can be compiled to take advantage of newly available functions in the hardware, if available. Third, by entering a program that accurately describes what a person wants to do, but does not clearly state how or where it is done, the compiler has the best chance to find a way to use hardware targets to make the program run. method. This allows for fully customizable, extremely low-latency control of quantum hardware.
在最一般的形式中,編譯器是一種程式,它接受第一種語言的程式文本作為輸入,並產生另一種語言的程式文本作為輸出,同時保留該文本的含義。大多數編譯器將高級程式設計語言(諸如C語言)轉換成機器指令,用於在機器硬體上執行功能。In the most general form, a compiler is a program that accepts program text in the first language as input and produces program text in another language as output, while retaining the meaning of the text. Most compilers convert high-level programming languages (such as C language) into machine instructions for executing functions on machine hardware.
典型地,編譯器包括前端軟體模組,其執行輸入程式文本的分析,並產生輸入程式文本的語義表示。編譯器通常還包括後端軟體模組,其根據輸入程式的語義表示產生適當的機器指令。如果編譯器具有清晰的設計,那麼前端可能完全不知道目的語言,且後端可能完全不知道來源語言。然而,存在導致這種嚴格的分離可能效率低下的技術原因,並且實際上大多數編譯器都有某種形式的折衷。出於這個原因,諸如“前端”和“後端”的術語應作廣義解釋。Typically, the compiler includes a front-end software module that performs analysis of the input program text and generates a semantic representation of the input program text. The compiler usually also includes a back-end software module, which generates appropriate machine instructions according to the semantic representation of the input program. If the compiler has a clear design, the front end may not know the target language at all, and the back end may not know the source language at all. However, there are technical reasons that this strict separation may be inefficient, and in fact most compilers have some form of compromise. For this reason, terms such as "front-end" and "back-end" should be interpreted broadly.
翻譯器(transcompiler),其也稱為源到源編譯器或轉譯器,是一種類型的編譯器,這種編譯器將以程式設計語言編寫的程式的原始程式碼作為其輸入並以相同或不同的程式設計語言產生基本等效的程式。因此,轉譯器在程式設計語言之間以近似類似的抽象級進行轉換。A transcompiler, also known as a source-to-source compiler or translator, is a type of compiler that takes the original code of a program written in a programming language as its input and uses the same or different The programming language produces basically equivalent programs. Therefore, translators convert between programming languages at a similar level of abstraction.
在本文所述的轉譯方法中,以第一種程式設計語言或等效資料表示提供經典量子混合程式,並且該混合程式可以是跨硬體的(hardware-agnostic),或者可以僅提供目標硬體規範。經典量子混合程式被解構成語義表示,然後某種硬體特定代碼被提供,用於在分散式處理系統上執行某些命令。轉譯的經典量子混合程式以第二種程式設計語言或等效資料表示(其可以與第一種程式設計語言相同,也可以不同)產生。因此,本文描述的方法將高級的跨硬體程式轉換成至少部分硬體特定的高級程式。特別地,轉譯的混合程式適於在一個或更多個經典處理器和量子資訊處理器上執行。In the translation method described in this article, the classical quantum hybrid program is provided in the first programming language or equivalent data representation, and the hybrid program can be hardware-agnostic, or only the target hardware can be provided specification. Classical quantum hybrid programs are deconstructed into semantic representations, and then certain hardware-specific codes are provided to execute certain commands on the distributed processing system. The translated classical quantum hybrid program is expressed in a second programming language or equivalent data (which can be the same as or different from the first programming language). Therefore, the method described herein converts high-level cross-hardware programs into at least part of hardware-specific high-level programs. In particular, the translated hybrid program is suitable for execution on one or more classical processors and quantum information processors.
圖1示出根據本發明的實施例的分散式處理系統100。分散式處理系統100包括網路110、分散式系統控制器120、經典計算裝置130和135以及混合計算裝置140。分散式處理系統100可以包括更多或更少的設備和部件。分散式系統控制器120和混合計算裝置140將在下面進一步詳細描述。Fig. 1 shows a distributed processing system 100 according to an embodiment of the present invention. The distributed processing system 100 includes a network 110, a distributed system controller 120,
網路110可以是任何已知類型的電腦網路,實現計算裝置130/135和分散式系統控制器120之間以及分散式系統控制器和混合計算裝置140之間的有線或無線通訊。網路可以包括例如區域網路(LAN)、廣域網路(WAN)或網際網路。分散式處理系統可以包括複數網路,例如,計算裝置130和135可以與分散式系統控制器120無線通訊,而分散式系統控制器120可以經由有線連接與混合計算裝置140通訊。The network 110 may be any known type of computer network, which implements wired or wireless communication between the
混合計算裝置140包括一個或更多個經典處理器150、交互模組160和量子資訊處理器170。該示例的混合計算裝置140被配置成經由交互模組160在量子資訊處理器170上執行量子操作,同時在低延遲專用經典處理器150(例如,現場可程式閘陣列)上執行互補經典操作。這些將在以下進一步更加詳細討論。The
分散式系統控制器120可以從使用者接收經典量子混合程式。例如,使用者可以從第三方電腦(諸如,經典計算裝置130)向分散式系統控制器發送包含經典量子混合程式的電腦可執行檔。可選地,分散式系統控制器120本身可以支援程式編寫功能,使得使用者可以直接在分散式系統控制器120上設計經典量子混合程式。在其他實施例中,混合計算裝置140本身可以被配置成充當分散式系統控制器。The distributed system controller 120 can receive the classical quantum hybrid program from the user. For example, a user can send a computer executable file containing a classical quantum hybrid program from a third-party computer (such as the classical computing device 130) to the distributed system controller. Optionally, the distributed system controller 120 itself can support the programming function, so that the user can directly design the classical quantum hybrid program on the distributed system controller 120. In other embodiments, the
分散式系統控制器120被配置成根據本文描述的方法來轉譯經典量子混合程式,以產生轉譯的經典量子混合程式。轉譯的經典量子混合程式包括用於控制交互模組160的類比交互工具與量子資訊處理器170交互的硬體特定代碼,以及用於在一個或更多個經典處理器(諸如經典處理器150或計算裝置135)上執行的代碼。The distributed system controller 120 is configured to translate the classical quantum hybrid program according to the method described herein to generate the translated classical quantum hybrid program. The translated classical quantum hybrid program includes hardware specific codes used to control the interaction between the analog interaction tool of the
分散式系統控制器120可以進一步被配置成協調程式的執行。這可以藉由幾種可能的方式中的任何一種來執行。The distributed system controller 120 may be further configured to coordinate the execution of the program. This can be performed in any of several possible ways.
例如,分散式系統控制器120可以產生轉譯的經典量子混合程式,該程式可以在控制器120本身上執行,以直接控制在量子資訊處理器170、經典處理器150以及可選地在諸如裝置130和135的經典計算裝置上執行的操作。在另一示例中,轉譯的經典量子混合程式可以包括幾個代碼部分,每個代碼部分被分配給經典處理器和交互模組160,以便從那裡執行。For example, the distributed system controller 120 can generate a translated classical quantum hybrid program, which can be executed on the controller 120 itself to directly control the
在另一示例中,混合計算裝置140可以被配置成充當分散式系統控制器。混合計算裝置因此可以直接執行轉譯的經典量子混合程式本身的指令。在其他示例中,分散式系統控制器120可以僅負責創建轉譯的經典量子混合程式。主機設備可以負責協調轉譯的程式的執行。主機設備可以包括例如計算裝置130或計算裝置135。In another example, the
圖2描繪了分散式系統控制器200的框圖,其可以扮演圖1的分散式系統控制器120的角色。分散式系統控制器200是電腦的示例,其中實現程序的電腦可用程式碼或指令可以被定位並且被執行。本領域技術人員將認識到,可以設想其他架構。分散式系統控制器200被配置成執行諸如下面關於圖4至圖10描述的方法。FIG. 2 depicts a block diagram of the distributed
分散式系統控制器200包括複數使用者介面,這些使用者介面包括視覺化工具,諸如視覺顯示器280和虛擬或專用使用者輸入/輸出單元240。輸入/輸出單元240允許與可連接到設備200的其他設備/使用者的資料登錄和輸出。例如,輸入/輸出單元240可提供連接,以用於使用者藉由鍵盤、滑鼠及/或一些其他合適的輸入裝置的輸入。此外,輸入/輸出單元240可將輸出發送到印表機。The distributed
分散式系統控制器200還包括一個或更多個(經典)處理器210、記憶體220、永久性記憶體230和電源系統260。The distributed
分散式系統控制器200包括通訊模組250,通訊模組250用於在處理器210和遠端系統之間發送和接收通訊。例如,通訊模組250可以用於經由網路110(諸如網際網路)發送和接收通訊。通訊模組250可以藉由使用實體通訊鏈路和無線通訊鏈路中的任一個或兩個來提供通訊。The distributed
分散式系統控制器200還包括埠270,埠270用於接收例如非暫態機器可讀/電腦可讀媒體,該媒體包含待由處理器210處理的指令。The distributed
記憶體220和永久性儲存裝置230是存放裝置的示例。存放裝置是任何硬體塊,其能夠暫時性地及/或永久性地儲存資訊,例如但不限於資料、功能形式的程式碼及/或其他合適的資訊等。在這些示例中,記憶體220可以是例如隨機存取記憶體或任何其他合適的揮發性或非揮發性存放裝置。永久性儲存裝置230可採用各種形式,這取決於特定的實施方式。例如,永久性儲存裝置230可以包含一個或更多個部件或設備。例如,永久性儲存裝置230可以是硬碟驅動器、快閃記憶體、可重寫光碟、可重寫磁帶或以上的某種組合。由永久性儲存裝置230使用的媒體還可以是可拆卸的。例如,可移動硬碟驅動器可用於永久性儲存裝置230。The
可以儲存處理器210的指令。例如,指令可以以功能形式處於永久性儲存裝置230上。可將這些指令載入到記憶體220中,以藉由處理器210執行。The instructions of the
處理器210用於執行可被載入到記憶體220中的軟體指令。處理器單元210可以是一組一個或更多個處理器,或者可以是多處理器核心,這取決於特定的實施方式。此外,處理器單元210可以使用一個或更多個異構處理器系統來實現,其中主要處理器與次級處理器位於單個晶片上。如另一個說明性示例,處理器單元210可以是包含相同類型的複數處理器的對稱多處理器系統。The
處理器210被配置成接收資料、訪問記憶體220和永久性儲存裝置230,並對從該記憶體220或永久性儲存裝置230、從通訊模組250或從使用者輸入裝置240接收的指令起作用。The
本領域技術人員將認識到,圖2的分散式系統控制器200僅僅是一個示例。分散式系統控制器可以包括更多或更少的部件和模組。例如,分散式系統控制器可以不具有可視顯示能力。Those skilled in the art will recognize that the distributed
圖3描繪了混合計算裝置300的框圖,其可以扮演圖1的混合計算裝置140的角色。FIG. 3 depicts a block diagram of a hybrid computing device 300, which can play the role of the
混合計算裝置300包括輸入/輸出單元240’、通訊模組250’、記憶體220’、永久性記憶體230’和電源260’,並且這些部件被配置成執行與分散式系統控制器200的類似部件所執行的任務類似的任務。The hybrid computing device 300 includes an input/output unit 240', a communication module 250', a memory 220', a permanent memory 230', and a power supply 260', and these components are configured to perform similar to those of the distributed
混合計算裝置300還包括量子資訊處理器170和用於與量子資訊處理器170交互的交互模組160。The hybrid computing device 300 also includes a
量子資訊處理器170可以是能夠產生用於處理的量子態的任何設備。量子資訊處理器170可以是任何合適的類型,並且可以使用任何已知的方法處理量子位,包括但不限於以下方法:核磁共振、離子阱、超導體、量子點、液氦上的電子、固態自旋光譜學、腔QED。The
在一個示例中,量子資訊處理器170可以包括超導電路。在量子電腦的超導電路實施方式中,量子計算的基本單元(量子位元)可以以多種不同的方式以實體實現。一個或更多個約瑟夫森結(Josephson junctions)可以與電容器及/或電感器組合,以形成高品質的非諧振電路,該非諧振電路的最低量化能級用於定義量子位。例如,一個被普通實現且成功的設計(稱為電荷量子位或transmon)以其最簡單的形式存在:單個約瑟夫森結與一個電容器並聯。量子位元的兩個電極可以以多種方式排列;示例包括以類似偶極天線的幾何形狀共線佈置電極,或者使用叉指電容器(interdigitated capacitors),或者一個電極為十字形,而另一個電極實現為公共接地平面。In one example, the
交互模組160被配置成接收用於與量子資訊處理器170交互的指令,並執行這些指令。交互模組160可以包括專用記憶體及/或永久性記憶體,用於將一些輸入指令轉換成用於控制量子資訊處理器170的機器指令,例如,交互模組160可以包括“後端”軟體模組,用於配置經典量子混合程式的中間表示,以便與類比交互工具一起操作。交互模組160可以附加地或可選地被配置成與混合計算裝置的記憶體220’和永久性記憶體230’交互,記憶體220’和永久性記憶體230’可以與經典處理器150共用。The
交互模組160包括類比交互工具,用於控制與量子資訊處理器170的交互,以操縱量子位,從而執行量子操作和進行測量。在超導量子位元量子電腦中,控制和測量電路系統通常使用用量子位元整合在晶片上的平面電路系統,及/或使用在其中嵌入量子位元晶片的3D電磁波導和空腔來實現。因此,雖然圖3的交互模組160和量子資訊處理器170被示為獨立部件,但是它們在某種程度上可以被整合。交互模組160可以包括用於在超導電路或裝置中的特定點上施加電壓的電路系統,用於協調施加到量子資訊處理器170的微波脈衝。The
任意單個量子位門(qubit gate)可以藉由布洛赫球(Bloch sphere)的旋轉來實現。單個量子位的不同能級之間的旋轉是由發送到與量子位元耦合的天線或傳輸線的微波脈衝引起的,其頻率與能級之間的能量間隔共振。在這種情況下,交互模組160可以包括微波發生器形式的交互工具。耦合兩個量子位可以藉由將它們連接到中間電耦合電路來實現。耦合電路可以是固定元件(諸如電容器)或者是可控的(諸如DC-SQUID)。在第一種情況下,量子位元的去耦(在門閉合的時間期間)可以藉由將量子位調諧到彼此不共振來實現,也即,使它們的計算狀態之間的能隙不同。Any single qubit gate can be realized by the rotation of the Bloch sphere. The rotation between the different energy levels of a single qubit is caused by microwave pulses sent to the antenna or transmission line coupled with the qubit, and its frequency resonates with the energy interval between the energy levels. In this case, the
交互模組160相應地包括用於詢問/控制量子資訊處理器170的類比交互工具。The
混合計算裝置300還包括一個或更多個經典處理器150。經典處理器150是用於執行經典操作的低延遲硬體。經典處理器150可以包括例如現場可程式閘陣列(FPGA)。FPGA通常包含可程式邏輯塊的陣列和可重建互連的層次結構,該可重建互連允許可程式邏輯塊以幾種不同配置中的任何一種連接。邏輯塊可以被配置成執行複雜的組合功能,或者僅僅是簡單的邏輯閘(如與(AND)門和異或(XOR)門)。在大多數FPGA中,邏輯塊還包括記憶體元件,記憶體元件可以是簡單的觸發器或更完整的記憶體塊。許多FPGA可以被重新程式設計以實現不同的邏輯功能,允許在電腦軟體中執行靈活的可重建計算。The hybrid computing device 300 also includes one or more
混合計算裝置300在圖3中示出為就好像它在單個設備內,其中所有部件緊密連接。然而,本領域技術人員將認識到,可以設想其他架構。例如,混合計算裝置本身可以分佈在複數空間分離的設備和部件上。The hybrid computing device 300 is shown in FIG. 3 as if it is within a single device, where all components are tightly connected. However, those skilled in the art will recognize that other architectures can be envisaged. For example, the hybrid computing device itself can be distributed on multiple spatially separated equipment and components.
本領域技術人員將認識到,上述分散式處理系統、分散式系統控制器和混合計算裝置僅是示例,並且可以設想其他架構。Those skilled in the art will recognize that the above-described distributed processing system, distributed system controller, and hybrid computing device are only examples, and other architectures can be envisaged.
例如,分散式處理系統100內可以包括更多或更少的設備。分散式處理系統可以包括例如單個經典處理器、一個交互模組和一個量子資訊處理器。在這種情況下,經典處理器可以被配置成轉譯經典量子混合程式,以便與可用的經典處理器、交互工具和可用的量子資訊處理器一起使用。因此,可能不需要專用的分散式系統控制器120。經典處理器可以進一步被配置成可能在進一步的編譯之後執行轉譯的程式。類似地,可以需要或可以不需要圖1和圖3的專用低延遲處理硬體150。For example, the distributed processing system 100 may include more or fewer devices. The distributed processing system may include, for example, a single classical processor, an interactive module, and a quantum information processor. In this case, the classic processor can be configured to translate the classic quantum hybrid program for use with the available classic processor, interactive tools, and available quantum information processor. Therefore, a dedicated distributed system controller 120 may not be needed. The classic processor can be further configured to execute the translated program after further compilation. Similarly, the dedicated low-
在使用中,分散式系統控制器120可以被配置成接收經典量子混合程式。程式可以包括目標硬體規範,或者分散式系統控制器120可以被配置成以某種其他方式接收對於程式的目標硬體規範,例如經由來自外部設備的單獨通訊,或者藉由查閱其記憶體。目標硬體規範包括關於分散式處理系統的資訊,例如哪個硬體可用以及每個硬體連接到什麼部件(以及哪個類比硬體可用以及哪個類比連接可用)。目標硬體規範可包括用於實現程式的最低要求,其包括詳細資訊,例如執行量子操作所需的量子位的數量。In use, the distributed system controller 120 may be configured to receive a classical quantum hybrid program. The program may include the target hardware specification, or the distributed system controller 120 may be configured to receive the target hardware specification for the program in some other way, such as via separate communication from an external device, or by consulting its memory. The target hardware specification includes information about the distributed processing system, such as which hardware is available and what component each hardware is connected to (and which analog hardware is available and which analog connection is available). The target hardware specification may include the minimum requirements for the implementation of the program, which includes detailed information, such as the number of qubits required to perform a quantum operation.
分散式系統控制器120還被配置成基於目標硬體規範,根據基本上如本文所描述的方法轉譯經典量子混合程式。所得到的轉譯經典量子混合程式相應地包括用於使用交互模組160在量子資訊處理器170上實現一個或更多個量子操作的硬體特定指令。轉譯的經典量副程式還可以包括用於在專用經典處理器150上實現一個或更多個經典操作的硬體特定指令。轉譯的經典量副程式還可以包括高級(即,基本上跨硬體的)指令,用於在其他經典處理器上執行,諸如在經典計算裝置130、135上,或者在分散式系統控制器120本身的內部處理器上。The distributed system controller 120 is also configured to translate the classical quantum hybrid program based on the target hardware specification according to a method substantially as described herein. The obtained translated classical quantum hybrid program correspondingly includes hardware specific instructions for implementing one or more quantum operations on the
在轉譯/編譯之後,所得到的程式可以由與混合計算裝置140相結合的任何合適的經典裝置來執行。例如,轉譯的程式可以由分散式系統控制器120執行。如果需要,分散式系統控制器120可以相應地編譯器的任何剩餘的跨硬體部分,以便在其處理器上或外部設備的處理器上執行。當執行轉譯的程式時,分散式系統控制器120的處理器可以直接控制混合計算裝置140的交互模組160和專用處理器150。可選地,分散式系統控制器120可以被配置成向排程模組(其可以是分散式系統控制器的記憶體/永久性記憶體中或者混合計算裝置的記憶體/永久性記憶體中提供的軟體模組)提交配置以進行排程處理。可選地,轉譯的經典量副程式可以被進一步轉換成複數可執行檔,這些檔然後可以被傳輸到相關的處理器/交互模組以供執行。分散式系統控制器120可以以這些方式的某種組合來操作。After translation/compilation, the obtained program can be executed by any suitable classical device combined with the
粗略地說,轉譯的程式是某個主機系統可以執行的指令序列,該指令序列具有執行原始程式的“淨效應(net effect)”。轉譯的程式本身的指令可包含用於配置其他子系統、向它們發送資料、觸發它們執行代碼以及從它們檢索資料的指令。最終轉譯的程式本質上可以非常明確;保留在程式中的所有指令可以直接在主機上執行,但將包括配置其他機器來執行部分程式。Roughly speaking, the translated program is a sequence of instructions that can be executed by a host system, which has the "net effect" of executing the original program. The instructions of the translated program itself can include instructions for configuring other subsystems, sending data to them, triggering them to execute code, and retrieving data from them. The final translated program can be very clear in nature; all instructions retained in the program can be directly executed on the host, but it will include configuring other machines to execute part of the program.
轉譯的經典量子混合程式可以改為由單獨的主機設備(諸如經典計算裝置130)可執行。如果需要,經典計算裝置130可以相應地編譯器的任何剩餘的跨硬體部分,以便在其處理器上或外部設備的處理器上執行。當執行轉譯的程式時,經典計算裝置130的處理器可以直接控制混合計算裝置140的交互模組160和專用處理器150。可選地,經典計算裝置130可以被配置成向排程模組(其可以是分散式系統控制器120或經典計算裝置130的記憶體/永久性記憶體中或者混合計算裝置的記憶體/永久性記憶體中提供的軟體模組)提交配置以進行排程處理。可選地,轉譯的經典量副程式可以被進一步轉換成複數可執行檔,這些檔然後可以被傳輸到相關的處理器/交互模組以供執行。The translated classical quantum hybrid program can be executed by a separate host device (such as the classical computing device 130) instead. If necessary, the
現在將參照圖4描述轉譯經典量子混合程式的方法。在下面的描述中,量子資訊處理器在某些地方被描述為超導量子位元量子資訊處理器,並且交互模組被描述為包括微波訊號發生器形式的類比交互工具。然而,本領域技術人員將認識到,這僅僅是為了描述的目的,而不是為了限制。特別地,量子資訊處理器可以包括任何合適的量子資訊處理器,並且類比交互工具可以是適於與量子資訊處理器交互的任何類比交互工具。圖4的方法可以由例如上面關於圖1描述的分散式系統控制器120來執行。The method of translating the classical quantum hybrid program will now be described with reference to FIG. 4. In the following description, the quantum information processor is described as a superconducting qubit quantum information processor in some places, and the interactive module is described as an analog interactive tool in the form of a microwave signal generator. However, those skilled in the art will recognize that this is for descriptive purposes only and not for limitation. In particular, the quantum information processor may include any suitable quantum information processor, and the analog interaction tool may be any analog interaction tool suitable for interacting with the quantum information processor. The method of FIG. 4 may be executed by, for example, the distributed system controller 120 described above with respect to FIG. 1.
圖4示出了轉譯將由分散式處理系統執行的經典量子混合程式的方法的流程圖。分散式處理系統包括一個或更多個經典處理器150和量子資訊處理器170,該量子資訊處理器經由經典類比交互工具(在本示例中被包括在交互模組160內)可詢問。經典量子混合程式包括將在量子資訊處理器170上執行的至少一個功能。Fig. 4 shows a flowchart of a method of translating a classical quantum hybrid program to be executed by a distributed processing system. The distributed processing system includes one or more
經典量子混合程式可以用非硬體特定的任何高級程式設計語言來表示。例如,經典量子混合程式可以用Python、C、C++、Fortran、Pascal或任何其他這樣的語言編寫。經典量子混合程式可以包括用於校準量子資訊處理器的程序,並且可以包括用於在量子資訊處理器上實現量子邏輯操作的程序。由量子資訊處理器實現的程序通常包括一個或更多個流操作指令,該流操作指令在轉譯方法之後對應於類比交互工具的指令。因此,流操作指令可以被認為是在量子資訊處理器上執行的處理操作和由分散式處理系統的其餘部分執行的處理操作之間的介面,流操作指令描述了與量子資訊處理器的交互。例如,流操作指令可以包括用於微波訊號發生器的指令,以產生用於與量子資訊處理器交互的微波訊號。The classical quantum hybrid program can be expressed in any high-level programming language that is not hardware specific. For example, a classical quantum hybrid program can be written in Python, C, C++, Fortran, Pascal, or any other such language. The classical quantum hybrid program may include a program for calibrating the quantum information processor, and may include a program for implementing quantum logic operations on the quantum information processor. The program implemented by the quantum information processor usually includes one or more stream operation instructions, which correspond to the instructions of the analog interactive tool after the translation method. Therefore, the stream operation instruction can be considered as the interface between the processing operation performed on the quantum information processor and the processing operation performed by the rest of the distributed processing system. The stream operation instruction describes the interaction with the quantum information processor. For example, the stream operation instructions may include instructions for a microwave signal generator to generate microwave signals for interaction with the quantum information processor.
在410處,經典量子混合程式被解析以產生中間表示。中間表示包括一系列基本塊,每個基本塊包括指令序列。因此,中間表示本質上類似於彙編。作為這種中間表示的結果,每個指令實質上都是“單效(single-effect)”。指令被組織成清單,一個接一個的單效指令(儘管技術人員會理解中間表示可以包含幾個多效(multiple-effect)指令)。跳轉及/或條件跳轉實現了藉由指令清單的非線性流動。基本塊可以是連續的代碼塊,以標籤指令開始,使該塊能夠被識別,並以最終跳轉指令結束。一個基本塊包括帶有一個入口點和一個出口點的指令序列,從程式的任何地方都不能跳到基本塊的中間,也不能從中間退出基本塊。At 410, the classical quantum mixing formula is parsed to produce an intermediate representation. The middle representation includes a series of basic blocks, and each basic block includes a sequence of instructions. Therefore, the intermediate representation is essentially similar to assembly. As a result of this intermediate representation, each instruction is essentially a "single-effect". The instructions are organized into lists, single-effect instructions one after the other (though technicians will understand that the intermediate representation can contain several multiple-effect instructions). Jumps and/or conditional jumps realize non-linear flow through instruction lists. The basic block can be a continuous code block, starting with a label instruction, so that the block can be recognized, and ending with a final jump instruction. A basic block includes a sequence of instructions with an entry point and an exit point. You cannot jump to the middle of the basic block from anywhere in the program, nor can you exit the basic block from the middle.
一個基本塊的示例如下: LABEL(“A”) //每個塊以標識該塊的標籤“指令”開始 MOV(“X”, 3)//移動指令將變數“x”設置為值3 JMP“B”//每個塊以跳轉(或條件跳轉)指令結束,指定(或允許計算)要執行的下一塊。An example of a basic block is as follows: LABEL("A") //Each block starts with the label "instruction" that identifies the block MOV("X", 3)//The movement instruction sets the variable "x" to the value 3 JMP "B"//Each block ends with a jump (or conditional jump) instruction, specifying (or allowing calculation) the next block to be executed.
基本塊內的基本指令可以採取以下形式之一: LABEL(unique_label_name)//針對基本塊指定唯一id EVAL(expr)//評估expr中的運算式 MOV(unique_var_name, expr)//將expr中的值移動到指定變數中 JUMP(label_name) //跳轉到標籤 CJUMP(expr, label_name, label_name)//根據expr的值條件跳轉到兩個標籤之一 並且運算式可以儲存為樹結構,該樹結構可以包括基本結構,諸如常量值、對變數的引用和算數運算: CONST(const_value) //常量值的說明 TEMP(unique_var_name) //對變數值的引用 ADD(expr, expr) //運算式,其值為兩個運算式的和The basic instructions in the basic block can take one of the following forms: LABEL(unique_label_name)//Specify a unique id for the basic block EVAL(expr)//Evaluate the expression in expr MOV(unique_var_name, expr)//Move the value in expr to the specified variable JUMP(label_name) //Jump to label CJUMP(expr, label_name, label_name)//Jump to one of the two labels according to the value condition of expr And expressions can be stored as a tree structure, which can include basic structures, such as constant values, references to variables, and arithmetic operations: CONST(const_value) //Description of constant value TEMP(unique_var_name) //reference to variable value ADD(expr, expr) // expression, its value is the sum of two expressions
運算式還可以包括更複雜的結構,諸如函式呼叫,在傳統的編譯器中,這些函式呼叫最終將被轉換成更基本的指令,諸如上面描述的那些,但是在本方法中,這些函式呼叫被更有選擇地轉換。調用運算式的形式可以是,例如: CALL(function_name, expr_list)Expressions can also include more complex structures, such as function calls. In traditional compilers, these function calls will eventually be converted into more basic instructions, such as those described above, but in this method, these functions Calls are converted more selectively. The form of the calling expression can be, for example: CALL(function_name, expr_list)
“特殊”函式呼叫是在輸入程式中可提供流操作(例如,OPEN、READ、WRITE、CLOSE)的方法。這些函式呼叫可以具有各自的function_name值、strm_open、strm_read、strm_write、strm_close。"Special" function calls are methods that provide stream operations (for example, OPEN, READ, WRITE, CLOSE) in the input program. These function calls can have their own function_name value, strm_open, strm_read, strm_write, strm_close.
編譯器可以支援例如對流執行操作的四個低級指令: OPEN:一個或更多個流的列表被立刻打開,將它們的使用標記為同步。與資料分析類似,這可以被認為是對這些被打開流的賦值; READ:從特定的(打開的)流中進行讀取,還要指定資料陣列或要返回的資料長度; WRITE:寫入特定的(打開的)流,還要指定資料陣列或要返回的資料長度; CLOSE:一個或更多個流的列表被關閉。對於這些相同的流,該命令在邏輯上必須在OPEN命令之後。與資料分析類似,這可以被認為是對這些流的賦值。The compiler can support, for example, four low-level instructions that perform operations on streams: OPEN: The list of one or more streams is opened immediately, marking their use as synchronized. Similar to data analysis, this can be considered as an assignment to these opened streams; READ: Read from a specific (open) stream, and specify the data array or the length of the data to be returned; WRITE: Write to a specific (open) stream, and also specify the data array or the length of the data to be returned; CLOSE: The list of one or more streams is closed. For these same streams, the command must logically follow the OPEN command. Similar to data analysis, this can be thought of as assigning values to these streams.
在420處,識別具有一個或更多個流操作指令的基本塊。流操作指令涉及將由類比交互工具(在這個示例中是微波訊號發生器)執行的指令。由於流操作指令通常涉及用於微波訊號發生器的命令,該微波訊號發生器與量子資訊處理器的超導量子位進行交互,因此識別包含流操作指令的基本塊對於識別可被外包給微波訊號發生器的操作是有用的(相對於經典處理器)。At 420, a basic block with one or more stream operation instructions is identified. Stream operation instructions involve instructions that will be executed by an analog interactive tool (in this example, a microwave signal generator). Since stream operation instructions usually involve commands for microwave signal generators that interact with the superconducting qubits of the quantum information processor, the identification of basic blocks containing stream operation instructions can be outsourced to microwave signals for identification The operation of the generator is useful (as opposed to classic processors).
在430處,對所識別的基本塊進行分析,以識別用於在一個或更多個經典處理器和量子資訊處理器上實現的一個或更多個副程式。這可以包括將所識別的基本塊轉換成單流賦值(SSA)形式,並且進一步確保基本塊被轉換成每個流操作指令依賴於最多一個支配流指令的形式。在編譯器設計中,SSA形式是中間表示的一個屬性,它要求每個變數只被賦值一次,並且每個變數在其被使用前都被定義。將所識別的基本塊轉換成SSA形式可以包括,例如用新變數替換每個賦值的目標,以及用變數的達到該點的版本替換變數的每次使用。At 430, the identified basic blocks are analyzed to identify one or more subroutines for implementation on one or more classical processors and quantum information processors. This may include converting the identified basic block into a single-stream assignment (SSA) form, and further ensuring that the basic block is converted into a form in which each stream operation instruction depends on at most one dominant stream instruction. In the design of the compiler, the SSA form is an attribute of the intermediate representation. It requires that each variable be assigned only once, and each variable is defined before it is used. Converting the identified basic block into the SSA form may include, for example, replacing the target of each assignment with a new variable, and replacing each use of the variable with the version of the variable that reaches that point.
藉由將代碼轉換成SSA形式,資料流程分析變得更加容易。考慮一個示例: MOV(TEMP(‘x’), CONST(3)) // x=3 MOV(TEMP(‘y’), ADD(TEMP(‘x’), CONST(2)) // y=x+2 第二條語句對第一條指令有資料依賴性,因此資料流程分析將會發現,第二條指令中有一個temp“x”的“用法(use)”,它連結到第一條指令中“x”的“定義”/“def”。資料流程分析是建立use-def鏈的程序。考慮下一個示例: MOV(TEMP(‘x’), CONST(3)) // x=3 MOV(TEMP(‘y’), ADD(TEMP(‘x’), CONST(2)) // y=x+2 MOV(TEMP(‘z’), ADD(TEMP(‘x’), CONST(2)) // z=x+2 指令2使用了指令1中x的定義。指令3使用了指令1中x的定義。由於指令3對指令2不存在依賴性,因此指令3和指令2的執行順序無關緊要,因此切換它們或並存執行它們是可能的。考慮下一個示例: MOV(TEMP(‘x’), CONST(3)) // x=3 MOV(TEMP(‘y’), ADD(TEMP(‘x’), CONST(2)) // y=x+2 MOV(TEMP(‘z’), ADD(TEMP(‘y’), CONST(2)) // z=y+2 指令2使用了指令1中x的定義。指令3使用了指令2中y的定義。由於3對2具有依賴性並且2對1具有依賴性,因此指令可以被執行的順序是固定的。考慮下一個示例: MOV(TEMP(‘x’), CONST(3)) // x=3 MOV(TEMP(‘x’), ADD(TEMP(‘x’), CONST(2)) // x=x+2 MOV(TEMP(‘x’), ADD(TEMP(‘x’), CONST(2)) // x=y+2 指令2使用了指令1中x的定義。指令3使用了指令2中x的定義。By converting the code into SSA format, data flow analysis becomes easier. Consider an example: MOV(TEMP(‘x’), CONST(3)) // x=3 MOV(TEMP(‘y’), ADD(TEMP(‘x’), CONST(2)) // y=x+2 The second statement is data dependent on the first instruction, so the data flow analysis will find that there is a "use" of temp "x" in the second instruction, which is linked to the first instruction " The "definition"/"def" of x". Data flow analysis is the process of establishing a use-def chain. Consider the next example: MOV(TEMP(‘x’), CONST(3)) // x=3 MOV(TEMP(‘y’), ADD(TEMP(‘x’), CONST(2)) // y=x+2 MOV(TEMP(‘z’), ADD(TEMP(‘x’), CONST(2)) // z=x+2 Instruction 2 uses the definition of x in instruction 1. Instruction 3 uses the definition of x in instruction 1. Since instruction 3 has no dependency on instruction 2, the order of execution of instruction 3 and instruction 2 does not matter, so it is possible to switch them or execute them concurrently. Consider the next example: MOV(TEMP(‘x’), CONST(3)) // x=3 MOV(TEMP(‘y’), ADD(TEMP(‘x’), CONST(2)) // y=x+2 MOV(TEMP(‘z’), ADD(TEMP(‘y’), CONST(2)) // z=y+2 Instruction 2 uses the definition of x in instruction 1. Instruction 3 uses the definition of y in instruction 2. Since 3 is dependent on 2 and 2 is dependent on 1, the order in which instructions can be executed is fixed. Consider the next example: MOV(TEMP(‘x’), CONST(3)) // x=3 MOV(TEMP(‘x’), ADD(TEMP(‘x’), CONST(2)) // x=x+2 MOV(TEMP(‘x’), ADD(TEMP(‘x’), CONST(2)) // x=y+2 Instruction 2 uses the definition of x in instruction 1. Instruction 3 uses the definition of x in instruction 2.
有時,控制流使得不可能確定變數的最新版本。在這些情況下,編譯器會為該變數插入一個名為Phi(Φ)函數或Phi節點的人工定義。這個新定義合併了變數的所有傳入版本,從而為它創建新名稱。由於無法確定運行時將遵循幾個分支中的哪一個(例如,是否滿足IF語句內的條件),因此轉換到SSA形式可能涉及插入這樣一個Phi函數,它是“合併”不同選項的結果。可以藉由例如將記憶體中的相同位置用作產生對Phi函數的輸入的任何操作的目的地來實現Phi函數。Phi函數是預留位置函數,在編譯和最佳化步驟期間提供説明,但不需要實際執行。Sometimes, control flow makes it impossible to determine the latest version of a variable. In these cases, the compiler will insert an artificial definition named Phi(Φ) function or Phi node for the variable. This new definition merges all the incoming versions of the variable to create a new name for it. Since it is impossible to determine which of the several branches will be followed at runtime (for example, whether the conditions in the IF statement are met), the conversion to the SSA form may involve inserting such a Phi function, which is the result of "merging" different options. The Phi function can be implemented by, for example, using the same location in memory as the destination of any operation that generates input to the Phi function. The Phi function is a reserved position function, which is explained during the compilation and optimization steps, but does not need to be actually executed.
以下面的高級偽代碼為例: if(y) then: x = 3; else: x = 2; y = x+2; 該偽代碼可以在中間表示中表示為以下形式的一系列基本塊: LABEL(“START”) MOV(TEMP(‘y’), ?) // y事先設置為“某物” CJUMP( TEMP(y),LABEL(“A”),LABEL(“B”) ) //如果y為真,則執行A,如果y為假,則執行B LABEL(“A”) MOV(TEMP(‘x’), CONST(3)) // x=3 JUMP(“C”) LABEL(“B”) MOV(TEMP(‘x’), CONST(2)) // x=2 JUMP(“C”) LABEL(“C”) MOV(TEMP(‘y’),ADD(TEMP(‘x’),CONST(2))) // y = x + 2 JUMP(“END”) LABEL(“END”) JUMP(“END”) 在這個偽代碼中,y=x+2語句顯然是temp x的“用法”。根據程式流,它使用的x的定義要麼是“x=3”指令中的定義,要麼是“x=2”指令中的定義。因此,以這種方式建構的use-def鏈是多對多的,因為任何定義都可能有複數用法,並且任何用法都可能有複數定義。SSA形式藉由確保use-def鏈是多對一的來簡化資料分析,對於變數的任何給定用法,只有一個定義。這是藉由如下轉換偽代碼來實現的: LABEL(“START”) MOV(TEMP(‘y’), ?) // y事先設置為“某物” CJUMP( TEMP(y),LABEL(“A”),LABEL(“B”) ) //如果y為真,則執行A,如果y為假,則執行B LABEL(“A”) MOV(TEMP(‘x1’), CONST(3)) // x1=3 JUMP(“C”) LABEL(“B”) MOV(TEMP(‘x2’),CONST(2)) // x2=2 JUMP(“C”) LABEL(“C”) MOV(TEMP(‘x’)、PHI(TEMP(‘x1’)、TEMP(‘x2’)//x = x1或x = x2,如由前一程式流指示的 MOV(TEMP(‘y’)、ADD(TEMP(‘x’)、CONST(2))//y = x+2 JUMP(“END”) LABEL(“END”) JUMP(“END”)Take the following high-level pseudo code as an example: if(y) then: x = 3; else: x = 2; y = x+2; This pseudocode can be represented in the intermediate representation as a series of basic blocks in the following form: LABEL("START") MOV(TEMP(‘y’), ?) // y is set to "something" in advance CJUMP( TEMP(y), LABEL("A"), LABEL("B")) //If y is true, then execute A, if y is false, then execute B LABEL("A") MOV(TEMP(‘x’), CONST(3)) // x=3 JUMP("C") LABEL("B") MOV(TEMP(‘x’), CONST(2)) // x=2 JUMP("C") LABEL("C") MOV(TEMP(‘y’),ADD(TEMP(‘x’),CONST(2))) // y = x + 2 JUMP("END") LABEL("END") JUMP("END") In this pseudo code, the statement y=x+2 is obviously the "usage" of temp x. According to the program flow, the definition of x it uses is either the definition in the "x=3" instruction or the definition in the "x=2" instruction. Therefore, the use-def chain constructed in this way is many-to-many, because any definition may have plural usage, and any usage may have plural definitions. The SSA form simplifies data analysis by ensuring that the use-def chain is many-to-one. There is only one definition for any given use of a variable. This is achieved by converting pseudo-code as follows: LABEL("START") MOV(TEMP(‘y’), ?) // y is set to "something" in advance CJUMP( TEMP(y), LABEL("A"), LABEL("B")) //If y is true, then execute A, if y is false, then execute B LABEL("A") MOV(TEMP(‘x1’), CONST(3)) // x1=3 JUMP("C") LABEL("B") MOV(TEMP(‘x2’), CONST(2)) // x2=2 JUMP("C") LABEL("C") MOV(TEMP(‘x’), PHI(TEMP(‘x1’), TEMP(‘x2’)//x = x1 or x = x2, as indicated by the previous program flow MOV(TEMP(‘y’), ADD(TEMP(‘x’), CONST(2))//y = x+2 JUMP("END") LABEL("END") JUMP("END")
用於插入Phi函數以確保SSA形式的方法是眾所周知的,並在標準編譯器文獻中給出。它們包括對通程序式的“流”的潛在路徑的分析(控制流分析),並且可以藉由對控制流的進一步分析來有效地執行,以產生所謂的支配層次結構,由此可以計算每個塊的支配邊界(dominance frontier)。如果控制流中從“A”到程式末尾的所有路徑都經過“B”,則塊“A”支配另一個“B”。如果塊“C”是從“A”開始的任何控制流路徑上到達的、沒有被“A”支配的第一個塊,則它位於“A”的支配邊界上。The method used to insert the Phi function to ensure the SSA form is well known and given in the standard compiler documentation. They include the analysis of the potential path of the "flow" of the general procedure (control flow analysis), and can be effectively performed by further analysis of the control flow to produce the so-called dominance hierarchy, from which each can be calculated The dominance frontier of the block. If all paths in the control flow from "A" to the end of the program pass through "B", then block "A" dominates another "B". If block "C" is the first block that arrives on any control flow path starting from "A" and is not dominated by "A", then it is located on the dominated boundary of "A".
SSA形式是眾所周知的。然而,目前的方法將SSA形式的原理擴展到流操作的概念。The SSA format is well known. However, current methods extend the principles of the SSA form to the concept of stream operations.
邏輯上,流操作既影響特定流的狀態(“定義”新的流狀態),又依賴於特定流的狀態(目前流狀態的“用法”)。一個例外是strm_open指令,它不依賴於(“用法”)流;相反,它將流設置為打開和空白狀態,類似於將它們“定義”為特定初始狀態。Logically, flow operations both affect the state of a particular flow ("define" a new flow state), but also depend on the state of a particular flow (the "usage" of the current flow state). One exception is the strm_open instruction, which does not depend on the ("usage") stream; instead, it sets the stream to an open and blank state, similar to "defining" them to a specific initial state.
strm_open指令可以被定義為具有以下形式: EVAL(CALL(‘strm_open’, exprlist(CONST(‘unique_strm_name_1’), CONST(‘unique_strm_name_2’), …) ))The strm_open instruction can be defined as having the following form: EVAL(CALL(‘strm_open’, exprlist(CONST(‘unique_strm_name_1’), CONST(‘unique_strm_name_2’), …) ))
strm_close指令可以被定義為具有以下形式: EVAL(CALL(‘strm_close’, exprlist(CONST(‘unique_strm_name_1’), CONST(‘unique_strm_name_2’), …) ))The strm_close instruction can be defined as having the following form: EVAL(CALL(‘strm_close’, exprlist(CONST(‘unique_strm_name_1’), CONST(‘unique_strm_name_2’), …) ))
strm_read指令可以被定義為具有以下形式: EVAL(CALL(‘strm_read’, exprlist(CONST(‘unique_strm_name’), EXPR, …) )) 其中,EXPR是評估要從流中讀取的樣本數量的運算式。The strm_read instruction can be defined as having the following form: EVAL(CALL(‘strm_read’, exprlist(CONST(‘unique_strm_name’), EXPR, …) )) Among them, EXPR is an expression that evaluates the number of samples to be read from the stream.
strm_write指令可以被定義為具有以下形式: EVAL(CALL(‘strm_write’, exprlist(CONST(‘unique_strm_name’), EXPR, …) )) 其中,EXPR是對要寫入流的樣本或樣本陣列進行評估的運算式。The strm_write instruction can be defined as having the following form: EVAL(CALL(‘strm_write’, exprlist(CONST(‘unique_strm_name’), EXPR, …) )) Among them, EXPR is an expression for evaluating samples or sample arrays to be written to the stream.
在上文中,提供的流名稱被給出作為常量運算式。這允許建構流操作的use-def鏈。需要處理這些運算式是非常量的情況,但將在後面討論。In the above, the provided stream name is given as a constant expression. This allows the construction of a use-def chain of stream operations. Need to deal with the situation where these expressions are non-constant, but will be discussed later.
與Phi函數/Phi節點類似,當無法確定程式的哪個分支將在運行時被遵循時,Phi函數/Phi節點有助於表示變數,在這種擴展的SSA形式中,在流操作的分叉路徑合併的地方插入類似的預留位置流操作,本文稱為StreamPhi操作(或“strm_phi”)。藉由使用這樣的StreamPhi操作,每個流操作依賴於最多一個先前的(支配)流操作指令。Similar to the Phi function/Phi node, when it is impossible to determine which branch of the program will be followed at runtime, the Phi function/Phi node helps to represent the variable. In this extended form of SSA, in the bifurcation path of the flow operation Insert a similar placeholder stream operation at the merge place, which is called StreamPhi operation (or "strm_phi") in this article. By using such StreamPhi operations, each stream operation depends on at most one previous (dominant) stream operation instruction.
人們可以引入strm_phi操作,其形式為: EVAL(CALL(‘strm_phi’, exprlist(CONST(‘unique_strm_name’)))) strm_phi也被認為是流的一種用法和定義。People can introduce the strm_phi operation in the form: EVAL(CALL(‘strm_phi’, exprlist(CONST(‘unique_strm_name’)))) strm_phi is also considered a usage and definition of stream.
如同在標準SSA形式中一樣,可以藉由分析控制流、產生的支配資訊和目前的use-def鏈來插入strm_phi操作。這產生一組use-def鏈,其中每個strm_open、strm_write、strm_read、strm_close命令具有對唯一一個先前stream_operation的依賴性。As in the standard SSA format, the strm_phi operation can be inserted by analyzing the control flow, the generated dominance information, and the current use-def chain. This produces a set of use-def chains, where each strm_open, strm_write, strm_read, strm_close command has a dependency on only one previous stream_operation.
Strm_phi操作仍然依賴於複數先前的stream_operation,正如在這個示例中可以看到的,其中沒有重命名流,以確保每個流只有一個定義(我們以SSA的形式隱式而不是顯式地工作): data1 = ? data2 = ? y = ? strm_open(‘strm1’,) if(y) then: strm_write(‘strm1’, data1) x = 3; else: strm_write(‘strm1’, data2) x = 2; y = x + 2; strm_phi(‘strm1’,)//這個strm_phi命令被插入,因為兩個不同的控制流路徑在不同狀態下與strm1匯合。 strm_write(‘strm1’, data1) strm_close(‘strm1’)The Strm_phi operation still relies on the plural previous stream_operation, as can be seen in this example, there is no renaming of the streams to ensure that there is only one definition for each stream (we work implicitly rather than explicitly in the form of SSA): data1 =? data2 =? y =? strm_open(‘strm1’,) if(y) then: strm_write(‘strm1’, data1) x = 3; else: strm_write(‘strm1’, data2) x = 2; y = x + 2; strm_phi(‘strm1’,)//This strm_phi command is inserted because two different control flow paths merge with strm1 in different states. strm_write(‘strm1’, data1) strm_close(‘strm1’)
現在可以建構流依賴鏈,其中在適當的地方將單獨的流操作指令標記為依賴於先前操作,並且將StreamPhi操作標記為依賴於複數先前操作。流依賴圖/流依賴鏈是一種有向圖,其中每個節點代表一個流操作指令,並且每個有向邊代表一個流操作指令對另一個的依賴性。It is now possible to construct a stream dependency chain, where individual stream operation instructions are marked as dependent on previous operations where appropriate, and StreamPhi operations are marked as dependent on plural previous operations. The flow dependency graph/flow dependency chain is a directed graph, in which each node represents a flow operation instruction, and each directed edge represents the dependence of one flow operation instruction on another.
SSA形式的這種擴展也涵蓋了流操作指令,在本文中有時被稱為單流狀態形式。This extension of the SSA format also covers stream operation instructions, sometimes referred to as the single stream state format in this article.
本領域技術人員將認識到,經典量子混合程式的整個中間表示可以被轉換成SSA形式。在其他示例中,只有在420處標識的基本塊可以被轉換成SSA形式。Those skilled in the art will recognize that the entire intermediate representation of the classical quantum hybrid formula can be converted into SSA form. In other examples, only the basic block identified at 420 can be converted into SSA form.
藉由將所識別的基本塊轉換成這種SSA形式,可以在一定程度上最佳化程式,以便執行控制流分析和資料流程分析,並對程式執行適當的變換和最佳化。By converting the identified basic block into this SSA form, the program can be optimized to a certain extent to perform control flow analysis and data flow analysis, and perform appropriate transformation and optimization of the program.
控制流分析(CFA)是一種靜態代碼分析技術,用於確定程式的控制流。控制流可以表示為控制流圖(CFG)。CFG是程式執行程序中可能經過該程式的所有路徑的使用圖形符號的表示。在CFG中,圖中的每個節點代表一個基本塊(至少有一些基本塊是SSA形式),相鄰節點之間的有向邊可以用來表示控制流中的跳轉。CFG包括至少一個入口塊和至少一個出口塊,控制藉由入口塊進入CFG,控制藉由出口塊離開CFG。操作或基本塊被稱為支配第二操作或第二基本塊是在來自入口的到達第二操作或第二基本塊的每條路徑都經過該第一操作或基本塊時。雖然控制流圖和控制流圖上的圖操作可以在下面進一步描述,但是本領域技術人員將會認識到,這樣的圖和圖操作僅僅是為了說明的目的而描述的。CFA通常藉由已知的計算程序來執行。Control flow analysis (CFA) is a static code analysis technique used to determine the control flow of a program. The control flow can be expressed as a control flow graph (CFG). CFG is a graphical symbol representation of all paths that may pass through the program in the program execution process. In CFG, each node in the graph represents a basic block (at least some basic blocks are in the form of SSA), and the directed edges between adjacent nodes can be used to represent jumps in the control flow. The CFG includes at least one entry block and at least one exit block. The entry block enters the CFG through the entry block, and the exit block exits the CFG through the exit block. The operation or basic block is said to dominate the second operation or second basic block when every path from the entrance to the second operation or second basic block passes through the first operation or basic block. Although the control flow graph and the graph operations on the control flow graph may be further described below, those skilled in the art will recognize that such graphs and graph operations are described for illustrative purposes only. CFA is usually performed by known calculation procedures.
資料流程分析是一種用於收集關於在電腦程式中的不同點處計算的值的可能集合的資訊的技術。程式的控制流圖(CFG)可以用來確定被賦值給變數的特定值可以傳播到的那些程式部分。資料流程分析可以藉由任何已知的計算程序來執行。Data flow analysis is a technique used to collect information about possible sets of values calculated at different points in a computer program. The control flow graph (CFG) of a program can be used to determine the parts of the program to which a specific value assigned to a variable can be propagated. Data flow analysis can be performed by any known calculation program.
分析所識別的基本塊以識別用於在一個或更多個經典處理器和量子資訊處理器上實現的一個或更多個副程式還可以包括分析經典量子混合程式的單流狀態形式,以便識別用於在量子資訊處理器170上實現的任何副程式。副程式包括單個指令的合集。包含一條這樣的指令的任何塊都被認為是副程式的塊,但是並非這些塊內的所有指令一定都是副程式內的指令。副程式識別的主要目的是識別對其他指令有嚴格時序要求的指令,或執行流操作。這些指令不適合在主機控制器上執行,並且必須(直接或間接)在(一個或更多個)特定硬體部件中執行,該特定硬體部件具有導致任何流操作發生的實體能力,實現對量子設備的實際詢問,並且具有在特定的短時間視窗內相對於其他指令和流操作執行任何其他指令的能力。Analyzing the identified basic blocks to identify one or more subprograms for implementation on one or more classical processors and quantum information processors may also include analyzing the single-stream state form of the classical quantum hybrid program for identification Used for any subprograms implemented on the
流式流(stream flow)依賴性可以被認為是時間要求嚴格的,因此所有這樣的依賴性指令可以被添加到獨立的副程式中。具有依賴它的已經在副程式中的指令以及對已經在副程式中的指令具有依賴性的任何其他指令(或指令集)都可以被添加到副程式中,並且現在滿足該約束的任何指令也可以添加到副程式中。Stream flow dependencies can be considered time-critical, so all such dependent instructions can be added to independent subroutines. Any other instruction (or set of instructions) that has a dependency on it already in the subroutine and any other instruction (or instruction set) that has a dependency on the instruction already in the subroutine can be added to the subroutine, and any instruction that now satisfies the constraint is also added to the subroutine. Can be added to the subroutine.
高效發現所有此類指令的示例方法如下。首先,產生所有依賴關係的有向圖,其中節點表示指令,邊指向依賴方向(從一條指令到它所依賴的指令)。其次,插入額外的偽依賴關係,使得任何流指令在圖上從任何其他的流指令都可到達(在典型的情況下,這可以像插入從strm_open到strm_close的依賴關係一樣簡單)。這確保了所有流指令形成圖的強連通分量(根據定義)。第三,使用Kosaraju的演算法或類似演算法檢測強連通分量。該圖的強連通分量現在將包含副程式所需的所有指令,因為既離開副程式又再次進入副程式的依賴路徑上的任何指令顯然將構成強連通分量本身的一部分。An example method for efficiently discovering all such instructions is as follows. First, generate a directed graph of all dependencies, where nodes represent instructions, and edges point to the direction of dependency (from an instruction to the instruction it depends on). Second, insert additional pseudo-dependencies so that any stream instruction can be reached from any other stream instruction on the graph (in typical cases, this can be as simple as inserting a dependency from strm_open to strm_close). This ensures that all flow instructions form a strongly connected component of the graph (by definition). Third, use Kosaraju's algorithm or similar algorithms to detect strong connected components. The strongly connected components of the graph will now contain all the instructions required by the subroutine, because any instruction on the dependent path that both leaves the subroutine and enters the subroutine again will obviously constitute a part of the strongly connected component itself.
下面將進一步描述識別這種子程式的更詳細的方法。A more detailed method of identifying this subroutine will be further described below.
可以分析經典量子混合程式的單流狀態形式,以識別用於在經典處理器150或經典計算裝置130、135上實現的任何副程式。The single-stream state form of the classical quantum hybrid program can be analyzed to identify any sub-programs for implementation on the
在440處,基於微波訊號發生器的目標硬體設定描述,識別的副程式的一個或更多個低級流操作指令被用於控制類比交互工具160與量子資訊處理器170交互的目標硬體特定代碼代替,以產生經典量子混合程式的硬體特定中間表示。如下面將進一步詳細描述的,用於控制類比交互工具的目標硬體特定代碼藉由將相關指令傳遞給相關目標硬體後端模組來提供,相關指令可以儲存在交互模組160的記憶體中或者分散式系統控制器120的記憶體中。目標硬體特定代碼提供例如產生用於與量子資訊處理器170交互的微波訊號所需的硬體設定指令等。At 440, based on the description of the target hardware setting of the microwave signal generator, one or more low-level flow operation instructions of the identified subprogram are used to control the target hardware specific of the interaction between the analog
類似地,識別用於控制低延遲經典處理器150的副程式,並且藉助於相關目標硬體後端模組,插入用於控制低延遲經典處理器150的目標硬體特定代碼。Similarly, the subprogram used to control the low-
經典處理器150和量子資訊處理器的目標硬體特定代碼實現了經典量子混合操作的快速且有效的處理。例如,這樣的指令可以説明經典處理器150例如遍歷(iterate through)微波訊號發生器操作所依賴的歸納變數。The target hardware specific codes of the
在450處,經典量子混合程式的硬體特定中間表示被轉譯成轉譯的經典量子混合程式。特別是,轉譯的經典量子混合程式主要包括高級代碼。然而,現在要求在經典處理器150或量子資訊處理器170上運行的任何操作都由用於在相關處理器上實現那些操作的硬體特定代碼來表示。At 450, the hardware-specific intermediate representation of the classical quantum hybrid program is translated into the translated classical quantum hybrid program. In particular, the translated classical quantum hybrid programs mainly include high-level codes. However, any operations that are now required to run on the
圖5示出了如圖4中的用於轉譯經典量子混合程式的方法的流程圖,並提供了進一步的細節。該方法在502處開始。Fig. 5 shows a flowchart of the method for translating a classical quantum hybrid program as shown in Fig. 4, and provides further details. The method starts at 502.
在504處,經典量子混合程式被解析成中間表示(如步驟410處)。At 504, the classical quantum hybrid formula is parsed into an intermediate representation (as at step 410).
在506處,幾個基本塊被標記用於插入,特別是那些包含一個或更多個流操作指令的基本塊。標記用於插入的基本塊可以包括將其指令序列包括一個或更多個流操作指令的基本塊標記為屬於第一集合,將從其可以到達第一集合的任何標記的基本塊的基本塊標記為屬於第二集合,並且組合第一集合和第二集合以形成第三集合,然後,對於第三集合中的每個基本塊,識別該基本塊的所有調用者,以及如果該基本塊在第一集合中,或者如果該基本塊在第二集合中並調用第二集合中的基本塊,則標記該基本塊用於插入。插入(也稱為插入擴展)是一種編譯器最佳化形式,其用被調用函數的主體替換函式呼叫點。At 506, several basic blocks are marked for insertion, especially those basic blocks that contain one or more stream operation instructions. Marking the basic block for insertion may include marking the basic block whose instruction sequence includes one or more stream operation instructions as belonging to the first set, and marking the basic block of any marked basic block from which the first set can be reached To belong to the second set, and combine the first set and the second set to form a third set, then, for each basic block in the third set, identify all callers of the basic block, and if the basic block is in the first set In one set, or if the basic block is in the second set and call the basic block in the second set, mark the basic block for insertion. Insertion (also called insertion extension) is a form of compiler optimization that replaces the function call point with the body of the called function.
在508處,標記用於插入的基本塊被插入。At 508, the basic block marked for insertion is inserted.
圖6示出了標記用於插入的基本塊的方法的流程圖。在602處,該方法開始。在604處,建構有向圖。有向圖是由一組藉由邊連接的頂點/節點組成的圖,其中邊有與之相關聯的方向。特別地,程序/基本塊被分配給節點。圖的邊與基本塊之間的關係有關。特別地,有向邊形成在任何調用程序和被調用程序之間。本領域技術人員將認識到,該圖不需要在任何實體意義上產生,僅執行類似於這種圖建構的分析。Fig. 6 shows a flowchart of a method of marking basic blocks for insertion. At 602, the method starts. At 604, a directed graph is constructed. A directed graph is a graph composed of a set of vertices/nodes connected by edges, where the edges have directions associated with them. In particular, programs/basic blocks are allocated to nodes. The edges of the graph are related to the relationship between the basic blocks. In particular, directed edges are formed between any calling program and the called program. Those skilled in the art will recognize that the graph does not need to be generated in any physical sense, and only performs an analysis similar to this graph construction.
如果所有頂點對之間都有一條路徑,則有向圖被稱為強連通的。有向圖的強連通分量是極大強連通子圖。在606處,在604處建構的有向圖的任何強連通分量被識別並標記為迴圈的。If there is a path between all pairs of vertices, the directed graph is said to be strongly connected. The strongly connected components of the directed graph are maximally strongly connected subgraphs. At 606, any strongly connected components of the directed graph constructed at 604 are identified and marked as looped.
在608處,包含流操作指令的任何基本塊被標記為屬於第一集合,這裡表示為。在610處,從其可到達第一集合中的基本塊的任何基本塊被表示為屬於第二集合。At 608, any basic block containing stream operation instructions is marked as belonging to the first set, represented here as . At 610, the first collection can be reached from it Any basic block in the basic block is represented as belonging to the second set .
在612處,第一集合和第二集合被組合以形成第三集合,。At 612, the first set and the second set are combined to form a third set, .
在614處,從第三集合的程序建構工作列表。At 614, from the third set Procedural construction work list .
在616處,做出關於是否為空的確定。如果為空,則方法在618處結束。如果不是空的,則該方法前進到620,在620處,從中移除第一程序A 。At 616, make a statement about Is it empty? if If it is empty, the method ends at 618. if Is not empty, then the method proceeds to 620, at 620, from Remove the first program A.
在622處,找到的所有調用者。在624處,針對每個調用者做出關於該調用者是在第三集合中還是該調用者在中並調用中的另一個程序的確定。如果確定為否定的,則方法前進到步驟616。可選地,如果確定是肯定的,那麼調用被標記用於插入。如果調用者不在中,則調用者被添加到和。At 622, find All callers of. At 624, for each caller, make a statement about whether the caller is in the third set Or the caller is in And call The determination of another program in. If the determination is negative, the method proceeds to step 616. Optionally, if the determination is positive, then the call is marked for insertion. If the caller is not there , The caller is added to with .
以這種方式,相關基本塊被標記用於插入。In this way, the relevant basic block is marked for insertion.
再次參考圖5,在510處,執行程式的控制流、支配層次結構和控制依賴性的分析。控制流、支配層次結構和控制依賴性可以在轉譯方法的整個執行程序中的幾個階段處重新計算。Referring again to FIG. 5, at 510, an analysis of the control flow, domination hierarchy, and control dependency of the program is executed. Control flow, domination hierarchy, and control dependency can be recalculated at several stages in the entire execution program of the translation method.
在512處,包含一個或更多個流操作的基本塊的中間表示被轉換成單個靜態分析形式。在這個階段,每個變數只賦值一次,並且每個變數在使用前被定義,但是流操作指令本身可能沒有被安排成SSA形式。At 512, the intermediate representation of the basic block containing one or more stream operations is converted into a single static analysis form. At this stage, each variable is assigned only once, and each variable is defined before use, but the flow operation instruction itself may not be arranged in SSA form.
在步驟514處,執行資料流程分析。變數的使用被映射到該變數的先前賦值,使得對於任何給定指令,該給定指令具有“資料依賴性”的先前指令是清晰的,反之亦然。由於產生的代碼是SSA形式,因此如果賦值不在同一個基本塊內,可以簡單地沿著支配樹向上,直到找到一個賦值。At
在516處,執行常量傳播。根據資料流程分析,可以檢查運算式以發現它們是否是常量,或者是帶有常量參數的簡單運算式(或者甚至是內部/外部程序呼叫),在這種情況下,這些運算式可以被常量值替換。這減少了程式內的資料依賴性,並使關鍵指令(諸如流操作指令)的參數分析更容易執行/可能執行。At 516, constant propagation is performed. According to the data flow analysis, you can check the expressions to find out whether they are constants, or simple expressions with constant parameters (or even internal/external program calls). In this case, these expressions can be constant values replace. This reduces the data dependence in the program and makes the parameter analysis of key instructions (such as stream operation instructions) easier/possible to execute.
在520處,識別包含迴圈的基本塊,其中迴圈包含一個或更多個流操作指令,並且相關聯的迴圈被標記用於展開。迴圈展開(也稱為迴圈解繞)是一種迴圈變換技術,它試圖以犧牲程式的二進制大小為代價來最佳化程式的執行速度。在522處,標記的迴圈被展開,並且在524處,再次執行常量傳播。At 520, a basic block containing a loop is identified, where the loop contains one or more flow operation instructions, and the associated loop is marked for expansion. Loop unwinding (also called loop unwinding) is a loop transformation technique that tries to optimize the execution speed of the program at the expense of the binary size of the program. At 522, the marked loop is expanded, and at 524, constant propagation is performed again.
在程式內的任何迴圈中(其中被訪問的流在迴圈中被標記為變數),展開(複製並重複代碼以消除迴圈)是有益的,使得被訪問的流是常量。一旦識別出迴圈內包含流操作指令的基本塊,就可以藉由在所識別的基本塊內定位非常量流識別字來將迴圈標記為用於展開,並且如果非常量流識別字依賴於迴圈歸納變數,則將迴圈標記用於展開。圖7示出了方法700的流程圖,該方法700用於標記用於展開的迴圈、展開標記的迴圈以及執行常量傳播。在702處,該方法開始。In any loop in the program (where the accessed stream is marked as a variable in the loop), it is beneficial to expand (copy and repeat the code to eliminate the loop) so that the accessed stream is constant. Once the basic block containing the flow operation instruction in the loop is identified, the loop can be marked for expansion by locating the non-constant flow identifier in the recognized basic block, and if the non-constant flow identifier depends on When loop induction variables are used, the loop mark is used for expansion. Figure 7 shows a flowchart of a
在704處,識別程式中的任何自然迴圈。這可以使用任何已知方法來執行。在一個示例中,如果考慮控制流依賴圖,則控制流中來自支配塊的的任何邊被認為是形成迴圈的後邊緣,其中迴圈頭部是支配者,並且循環體包含從頭部沿著經過後邊緣的路徑可到達的任何基本塊。本領域技術人員將認識到,可以使用任何方法來檢測程式中的迴圈。At 704, identify any natural loops in the program. This can be performed using any known method. In one example, if the control flow dependency graph is considered, any edge from the dominating block in the control flow is considered to form the back edge of the loop, where the head of the loop is the dominator, and the loop body contains Any basic block that can be reached by the path through the back edge. Those skilled in the art will recognize that any method can be used to detect loops in the program.
在706處,任何可組合的自然迴圈被組合,也就是說,同一迴圈頭部內的任何自然迴圈形成單個自然迴圈。At 706, any combinable natural loops are combined, that is, any natural loops in the head of the same loop form a single natural loop.
在708處,歸納變數被檢測。歸納變數特別是指在循環體內只給自己加上或減去某個常量值來賦值的任何變數。At 708, the inductive variable is tested. Inductive variables especially refer to any variable that only adds or subtracts a constant value to itself in the loop body.
在710處,在流操作指令中搜尋任何非常量流識別字。如果任何識別字依賴於迴圈歸納變數(即,如果流識別字在迴圈內是非常量),則迴圈被標記用於展開(712)。At 710, search for any non-constant flow identifier in the flow operation instruction. If any identifier depends on the loop induction variable (ie, if the flow identifier is non-constant within the loop), then the loop is marked for expansion (712).
對於任何標記的迴圈,在每次反覆運算處從迴圈常量和歸納變數中找到任何換碼運算式(escape expression)的值,以便計算反覆運算計數(714)。For any marked loop, find the value of any escape expression from the loop constant and induction variable at each iteration to calculate the iteration count (714).
在716處,任何標記的迴圈塊被替換為重複複製體(迴圈被展開),並且確保跳轉指令相應地改變了它們的相應目標。At 716, any marked loop blocks are replaced with duplicates (the loop is expanded), and it is ensured that the jump instructions change their corresponding targets accordingly.
在718處,執行常量傳播,以便使流識別字恆定。At 718, constant propagation is performed to make the stream identifier constant.
該方法在720結束。藉由以這種方式展開迴圈,更容易將程式置於單流狀態形式。The method ends at 720. By expanding the loop in this way, it is easier to put the program in a single-flow state.
再次參考圖5,在526處,程式被置於單流狀態形式。如上文關於圖4所描述的,該單流狀態形式是SSA形式的擴展,其中基本塊被轉換成每個流操作指令依賴於最多一個支配流指令的形式。Referring again to FIG. 5, at 526, the program is placed in a single-stream state form. As described above with respect to FIG. 4, the single-stream state form is an extension of the SSA form, in which the basic block is converted into a form in which each flow operation instruction depends on at most one dominating flow instruction.
根據程式的單流狀態形式,可以在528處建立流依賴鏈,其中每個操作被標記為依賴於先前操作,並且StreamPhi操作被標記為依賴於複數先前操作。OPEN和CLOSE操作使相同的流能夠在沒有完全依賴的情況下被訪問,有效地使程式能夠清楚地說明在哪裡需要對量子資訊處理器進行不間斷控制,以及在哪裡不需要。According to the single-stream state form of the program, a stream dependency chain can be established at 528, where each operation is marked as dependent on the previous operation, and the StreamPhi operation is marked as dependent on the plural previous operation. The OPEN and CLOSE operations enable the same stream to be accessed without complete dependence, effectively enabling the program to clearly state where uninterrupted control of the quantum information processor is needed and where it is not needed.
在530處,分析程式的這種單流狀態形式,以識別用於在一個或更多個經典處理器上實現的任何副程式,並識別用於在量子資訊處理器上實現的一個或更多個副程式。下面關於圖8進一步定義了用於檢測副程式的方法。圖8示出了一種方法的流程圖,該方法用於分析(擴展的)靜態單賦值形式(也稱為單流狀態形式),以識別用於在一個或更多個經典處理器和量子資訊處理器上實現的一個或更多個副程式。特別地,根據程式的單流狀態形式的分析,每個流操作指令可以與流依賴圖的節點相關聯,其中流依賴圖的有向邊指示一個流操作指令依賴於另一個。在802處,該方法開始。At 530, this single-stream state form of the program is analyzed to identify any subprograms for implementation on one or more classical processors, and one or more for implementation on the quantum information processor Subroutines. The method for detecting the subroutine is further defined in relation to Figure 8 below. Figure 8 shows a flow chart of a method for analyzing (extended) static single-assignment forms (also known as single-flow state forms) to identify applications in one or more classical processors and quantum information One or more subroutines implemented on the processor. In particular, according to the analysis of the single-flow state form of the program, each flow operation instruction can be associated with a node of the flow dependency graph, where the directed edges of the flow dependency graph indicate that one flow operation instruction depends on another. At 802, the method starts.
流依賴圖可以被劃分成連通子圖(804)(忽略邊的方向性)。當一個圖或子圖至少有一個頂點,並且每對頂點之間都有一條路徑時,稱它是連通的。The flow dependency graph can be divided into connected subgraphs (804) (ignoring the directionality of the edges). When a graph or subgraph has at least one vertex and there is a path between each pair of vertices, it is said to be connected.
流依賴圖的每個連通子圖被修改以確保強連通性(806)。如果圖的每個頂點都從每個其他頂點可到達,則稱該圖是強連通的。如果有向圖或子圖的每對頂點之間在每個方向上都有一條路徑,則該圖是強連通的。因此,修改每個流依賴子圖可以包括忽略邊的方向性及/或引入額外的邊。Each connected subgraph of the flow dependency graph is modified to ensure strong connectivity (806). If every vertex of the graph is reachable from every other vertex, the graph is said to be strongly connected. If there is a path in each direction between each pair of vertices in a directed graph or subgraph, the graph is strongly connected. Therefore, modifying each flow-dependent subgraph may include ignoring the directionality of the edges and/or introducing additional edges.
在808處,藉由組合控制依賴圖、資料依賴圖和流依賴圖的邊來建構依賴圖。依賴圖是有向圖,其表示幾個物件之間的依賴關係。依賴圖相應地捕捉程式的各種變數和流之間的依賴關係。At 808, the dependency graph is constructed by combining the edges of the control dependency graph, the data dependency graph, and the flow dependency graph. The dependency graph is a directed graph, which represents the dependency relationship between several objects. Correspondingly, the dependency graph captures the dependency relationship between the various variables of the program and the flow.
在810處,使用Kosaraju的演算法找到依賴圖的強連通分量。Kosaraju的演算法(也稱為kosaraju-Sharir演算法)是一種線性時間演算法,用於尋找有向圖的強連通分量。本領域技術人員將認識到,可以使用其他合適的演算法來確定有向圖的強連通分量。有向圖的每個強連通分量代表一個子程式(812)。副程式入口點被指定為控制支配樹中所有副程式元素的最低共同祖先(814)。入口點的支配邊界標記了有保證的出口點,並且流入這些節點的副程式點被標記為出口(816)。At 810, Kosaraju's algorithm is used to find the strongly connected components of the dependency graph. Kosaraju's algorithm (also known as the kosaraju-Sharir algorithm) is a linear-time algorithm used to find the strongly connected components of a directed graph. Those skilled in the art will recognize that other suitable algorithms can be used to determine the strongly connected components of the directed graph. Each strongly connected component of the directed graph represents a subroutine (812). The subroutine entry point is designated as the lowest common ancestor of all subroutine elements in the control dominance tree (814). The dominant boundary of the entry point marks the guaranteed exit point, and the subroutine points that flow into these nodes are marked as the exit (816).
在818處,該方法結束。At 818, the method ends.
再次參考圖5,基於目標硬體設定描述,所識別的副程式中的任何流操作被用於控制類比交互工具與量子資訊處理器交互的目標硬體特定代碼代替。下面關於圖9進一步描述用於以這種方式變換程式的方法。在902處,該方法開始。Referring again to FIG. 5, based on the description of the target hardware setting, any flow operation in the identified subroutine is replaced by the target hardware specific code used to control the interaction between the analog interaction tool and the quantum information processor. The method for changing the formula in this manner is further described below with respect to FIG. 9. At 902, the method begins.
在904處,副程式被分解成流操作的基本塊,或者被稱為子常式。特別地,副程式跨越複數基本塊。對於處理來說,按塊分組流操作指令是有用的(因為當一個指令執行時,流操作指令都執行)。流子常式是指同一子常式內的一組流操作指令。At 904, the subroutine is decomposed into basic blocks of stream operations, or called subroutines. In particular, the subroutine spans multiple basic blocks. For processing, it is useful to group flow operation instructions in blocks (because when an instruction is executed, all flow operation instructions are executed). Flow subroutine refers to a group of flow operation instructions in the same subroutine.
在906處,根據所使用的流和任何可用的目標硬體設定資訊,子常式被傳遞到相關的硬體後端。後端可以針對每個子常式定義執行類型,並基於執行類型在需要觸發執行的地方將語句插入主程序。At 906, based on the stream used and any available target hardware configuration information, the subroutine is passed to the relevant hardware backend. The back-end can define the execution type for each subroutine, and insert the statement into the main program where the execution needs to be triggered based on the execution type.
後端可以查詢資料來源/目標,包括常量的任何實際資料(912)。後端可以定義發送哪些資料(914)。此外,語句被插入到主程序中,以根據需要向相關硬體推送資料/從相關硬體拉取資料(916)。在918處,圖9的方法結束。The backend can query the data source/target, including any actual data of constants (912). The backend can define what data to send (914). In addition, statements are inserted into the main program to push data to/pull data from related hardware as needed (916). At 918, the method of FIG. 9 ends.
副程式不一定由整個程式內連續的指令組成。它們可以與其他程式元素交錯,甚至相互交錯。它們還與外部程式有依賴關係(例如,對所使用或設置的變數的資料依賴性)。副程式是程式的旨在用於在分散式處理系統的各種可用部件上進行分散式執行的那些部分。再次參考圖5,在534處,這些副程式相應地與從該副程式本身開始在該副程式之前和之後出現的那些副程式分開。這包括在532處產生的配置和資料檢索指令。下面關於圖10進一步提供了用於隔離副程式的方法。The subroutine does not necessarily consist of consecutive instructions in the entire program. They can be interlaced with other program elements, or even interlaced with each other. They also have dependencies on external programs (for example, data dependencies on variables used or set). Subroutines are those parts of a program that are intended for distributed execution on the various available components of a distributed processing system. Referring again to FIG. 5, at 534, these subroutines are correspondingly separated from those subroutines that appear before and after the subroutine from the subroutine itself. This includes the configuration and data retrieval commands generated at 532. The method for isolating subroutines is further provided with respect to Figure 10 below.
參考圖10,該方法開始於1002。在1004處,從副程式入口在不藉由出口的情況下可到達的基本塊被標記為副程式塊。在出口塊和非副程式塊之間插入“執行”塊(1006)。 副程式的出口塊被定義為副程式內就在非副程式塊執行之前可以執行的塊。Referring to Figure 10, the method starts at 1002. At 1004, the basic block that can be reached from the entry of the subroutine without the exit is marked as the subroutine block. Insert an "execute" block (1006) between the exit block and the non-subprogram block. The exit block of the subroutine is defined as the block that can be executed just before the execution of the non-subroutine block in the subroutine.
在1008處,塊結構被複製並插入到執行塊和非副程式塊之間。原始塊在這裡被稱為“預處理塊”,並且新塊被稱為“後處理”塊。副程式指令是副程式內的指令(1010)。At 1008, the block structure is copied and inserted between the execution block and the non-subroutine block. The original block is referred to herein as a "pre-processing block", and the new block is referred to as a "post-processing" block. The subroutine command is the command (1010) in the subroutine.
在1012、1014和1016處,各種塊被標記。特別地,一條指令被標記為“輸入”指令,其中子程式或另一條輸入指令依賴於它;如果一條指令依賴於程式,則該指令被標記為“輸出”指令;並且如果一條指令依賴於不在副程式中的指令並且本身不在副程式中,則該指令可以被標記為“並行”。At 1012, 1014, and 1016, various blocks are marked. In particular, an instruction is marked as an "input" instruction, in which a subroutine or another input instruction depends on it; if an instruction depends on a program, the instruction is marked as an "output" instruction; and if an instruction depends on being absent If the instruction in the subroutine is not in the subroutine, the instruction can be marked as "parallel".
在1018處,輸出指令被移動到後處理塊中的相應位置。在預處理塊中對變數賦值的情況下,插入指令以將變數值推入管道(1020)。管道包括變數值的先進先出堆疊。該值可以在後處理中檢索(1022)。後處理中的條件跳轉指令也被修改以經由管道從預處理塊中檢索值(1024)。圖10的方法在1026處結束。At 1018, the output instruction is moved to the corresponding position in the post-processing block. In the case of variable assignment in the preprocessing block, insert instructions to push the variable value into the pipeline (1020). The pipeline includes first-in-first-out stacking of variable values. This value can be retrieved in post-processing (1022). The conditional jump instruction in the post-processing is also modified to retrieve the value (1024) from the pre-processing block via the pipeline. The method of FIG. 10 ends at 1026.
再次參考圖5,在536處,程式被轉換成標準高級表示。也就是說,在536處,代碼被轉換成轉譯的經典量子混合程式。轉譯的經典量子混合程式在幾個方面不同於最初的經典量子混合程式,最明顯的在於它包含一些硬體特定代碼來代替與流操作相關的代碼。轉譯的經典量子混合程式相應地產生以用於由分散式系統控制器執行。Referring again to Figure 5, at 536, the program is converted to a standard high-level representation. That is, at 536, the code is converted into a translated classical quantum hybrid program. The translated classical quantum hybrid program is different from the original classical quantum hybrid program in several respects. The most obvious one is that it contains some hardware-specific codes to replace the codes related to stream operations. The translated classical quantum hybrid program is accordingly generated for execution by the distributed system controller.
本領域技術人員將認識到,雖然在圖5中,轉譯的經典量子混合程式用於在分散式系統控制器上執行,該分散式系統控制器又控制經典處理器150和量子資訊處理器,但是轉譯的程式可以被設計用於由另一個設備執行。例如,轉譯的程式可以在PC上執行,該PC位於實驗室內,或者與實驗室中的硬體具有低延遲通訊。該程式可以被配置成直接且無縫地配置硬體,以在執行期間根據需要執行副程式,或者可以被配置成向排程系統提交配置。Those skilled in the art will recognize that although in FIG. 5, the translated classical quantum hybrid program is used for execution on the distributed system controller, which in turn controls the
在538處,該方法結束。At 538, the method ends.
圖11示出了根據一些示例的電腦可讀媒體1100。FIG. 11 shows a computer-
電腦可讀媒體1100儲存單元,其中每個單元包括當被執行時使處理器或其他處理設備執行特定操作的指令1110。電腦可讀媒體1100包括當被執行時使處理設備實現如本文描述的方法的指令1110。The computer-readable medium 1100 stores units, where each unit includes
諸如電腦可讀媒體1000的電腦可讀媒體能夠經由設備200的埠(例如埠270)與諸如分散式系統控制器200的設備進行交互。The computer-readable medium, such as the computer-
所描述的實施例的變形被設想,例如,所揭露的所有實施例的特徵可以以任何方式被組合。Variations of the described embodiments are envisaged, for example, the features of all the disclosed embodiments can be combined in any way.
例如,在一個應用中,本文使用的方法可以用作分散式處理系統的校準/調諧程序的一部分。For example, in one application, the method used herein can be used as part of the calibration/tuning procedure of a distributed processing system.
將理解的是,本發明的實施例可以以硬體、軟體、或硬體和軟體組合的形式被實現。任何這樣的軟體可以以揮發性或非揮發性儲存裝置(例如像ROM(無論是否可抹除或可重寫)的存放裝置)的形式被儲存,或者以記憶體(例如RAM、記憶體晶片、設備或積體電路)的形式被儲存,或者儲存在光學或磁性可讀媒體(例如CD、DVD、磁片或磁帶)上。將理解的是,存放裝置和儲存媒體是機器可讀儲存裝置的實施例,其適於儲存一個或更多個程式,這些程式在被執行時實現本發明的實施例。對應地,實施例提供了一種程式以及儲存這種程式的機器可讀儲存裝置,該程式包括用於實現如任一前述請求項所要求保護的系統或方法的代碼。更進一步地,本發明的實施例可以經由任何媒體(諸如藉由有線或無線連接承載的通訊訊號)以電子方式傳送,並且實施例適當地包含相同的內容。It will be understood that the embodiments of the present invention can be implemented in the form of hardware, software, or a combination of hardware and software. Any such software can be stored in the form of volatile or non-volatile storage devices (such as storage devices like ROM (whether erasable or rewritable)), or in the form of memory (such as RAM, memory chips, It is stored in the form of equipment or integrated circuit), or stored on optical or magnetic readable media (such as CD, DVD, magnetic disk or tape). It will be understood that the storage device and the storage medium are embodiments of a machine-readable storage device, which are suitable for storing one or more programs that, when executed, implement the embodiments of the present invention. Correspondingly, the embodiments provide a program and a machine-readable storage device storing such a program. The program includes code for implementing the system or method as claimed in any of the foregoing claims. Furthermore, the embodiment of the present invention can be electronically transmitted via any medium (such as a communication signal carried by a wired or wireless connection), and the embodiment appropriately includes the same content.
在本說明書(包括任何所附的請求項、摘要和圖式)中揭露的所有特徵及/或如此揭露的任何方法或程序的所有步驟可以在任何組合中被組合,除了其中這類特徵及/或步驟中的至少某些是相互地排他的組合之外。All the features disclosed in this specification (including any attached claims, abstracts and drawings) and/or all steps of any method or procedure disclosed in this way can be combined in any combination, except for such features and/ Or at least some of the steps are outside of mutually exclusive combinations.
除非另外明確聲明,否則本說明書(包括任何所附的請求項、摘要和圖式)中揭露的每個特徵可以被用於相同目的、等效目的或類似目的的可選擇特徵所替換。因此,除非另外明確說明,否則所揭露的每個特徵僅是通用系列的等效或類似特徵中的一個示例。本發明並不限於任何前述實施例的細節。本發明擴展至在本說明書(包括任何所附的請求項、摘要和圖式)中揭露的特徵中的任何新穎的特徵或任何新穎的特徵組合,或擴展至如此揭露的任何方法或程序的步驟中的任何新穎的步驟或任何新穎的步驟組合。請求項不應被解釋為僅覆蓋前述實施例,還應覆蓋落入請求項範圍內的任何實施例。Unless expressly stated otherwise, each feature disclosed in this specification (including any attached claims, abstracts and drawings) can be replaced by optional features serving the same, equivalent or similar purpose. Therefore, unless expressly stated otherwise, each feature disclosed is only an example of a generic series of equivalent or similar features. The invention is not limited to the details of any of the foregoing embodiments. The present invention extends to any novel feature or any novel combination of features disclosed in this specification (including any attached claims, abstracts and drawings), or extends to any method or procedure step disclosed in this way Any novel step or any novel combination of steps in the. The claim should not be construed as covering only the foregoing embodiments, but should also cover any embodiments falling within the scope of the claim.
100:分散式處理系統
110:網路
120、200:分散式系統控制器
130、135:經典計算裝置
140、300:混合計算裝置
150:經典處理器
160:交互模組
170:量子資訊處理器
210、1120:處理器
220、220’:記憶體
230、230’:永久性儲存裝置
240、240’:輸入/輸出單元
250、250’:通訊模組
260、260’:電源
270:埠
280:視覺顯示器
1100:電腦可讀媒體
1110:指令
RAM:隨機存取記憶體
ROM:唯讀記憶體
FPGA:現場可程式閘陣列
SSA:單流賦值
CFA:控制流分析
CFG:控制流圖:第一集合:第二集合:第三集合:工作列表A:第一程序100: Distributed processing system 110: Network 120, 200: Distributed
現在將參考圖式僅藉由示例的方式來描述本發明的實施例,其中: 圖1示出了包括量子資訊處理器的分散式處理系統; 圖2示出了用作分散式系統控制器的計算裝置的框圖; 圖3示出了混合計算裝置的框圖; 圖4示出了轉譯經典量子混合程式的方法的流程圖; 圖5更詳細地示出了用於轉譯經典量子混合程式的方法的流程圖; 圖6示出了用於標記用於插入的基本塊的方法的流程圖; 圖7示出了用於標記用於展開的迴圈的方法的流程圖;以及 圖8示出了識別副程式的方法的流程圖; 圖9示出了配置副程式以用於與目標硬體一起使用的方法的流程圖; 圖10示出了用於隔離副程式的方法的流程圖;以及 圖11示出了機器可讀儲存媒體的框圖。 整個描述和圖式中,類似的參考數字指的是類似的部分。The embodiments of the present invention will now be described by way of example only with reference to the drawings, in which: Figure 1 shows a distributed processing system including a quantum information processor; Figure 2 shows a block diagram of a computing device used as a distributed system controller; Figure 3 shows a block diagram of a hybrid computing device; Figure 4 shows a flowchart of a method for translating a classical quantum hybrid program; Figure 5 shows in more detail a flowchart of a method for translating a classical quantum hybrid program; Figure 6 shows a flowchart of a method for marking basic blocks for insertion; Figure 7 shows a flowchart of a method for marking a loop for deployment; and Figure 8 shows a flowchart of a method for identifying subroutines; Figure 9 shows a flowchart of a method of configuring a subroutine for use with target hardware; Figure 10 shows a flowchart of a method for isolating subroutines; and Figure 11 shows a block diagram of a machine-readable storage medium. Throughout the description and drawings, similar reference numbers refer to similar parts.
Claims (19)
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
GBGB2002491.5A GB202002491D0 (en) | 2020-02-21 | 2020-02-21 | Control method for a distributed processing system including a quantum information processor |
GB2002491.5 | 2020-02-21 |
Publications (1)
Publication Number | Publication Date |
---|---|
TW202134959A true TW202134959A (en) | 2021-09-16 |
Family
ID=70108324
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW110104907A TW202134959A (en) | 2020-02-21 | 2021-02-09 | Control method for a distributed processing system including a quantum information processor |
Country Status (3)
Country | Link |
---|---|
GB (1) | GB202002491D0 (en) |
TW (1) | TW202134959A (en) |
WO (1) | WO2021165639A1 (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114048857B (en) * | 2021-10-22 | 2024-04-09 | 天工量信(苏州)科技发展有限公司 | Calculation force distribution method and device and calculation force server |
US20230244459A1 (en) * | 2022-01-31 | 2023-08-03 | Intel Corporation | Hybrid compilation apparatus and method for quantum-classical code sequences |
CN116187455B (en) * | 2022-12-16 | 2024-10-25 | 中国人民解放军战略支援部队信息工程大学 | Classical and quantum mixed instruction pipeline design method and device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018165607A1 (en) * | 2017-03-10 | 2018-09-13 | Rigetti & Co, Inc. | Event scheduling in a hybrid computing system |
-
2020
- 2020-02-21 GB GBGB2002491.5A patent/GB202002491D0/en not_active Ceased
-
2021
- 2021-02-03 WO PCT/GB2021/050233 patent/WO2021165639A1/en active Application Filing
- 2021-02-09 TW TW110104907A patent/TW202134959A/en unknown
Also Published As
Publication number | Publication date |
---|---|
WO2021165639A1 (en) | 2021-08-26 |
GB202002491D0 (en) | 2020-04-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Li et al. | The deep learning compiler: A comprehensive survey | |
Mansinghka et al. | Venture: a higher-order probabilistic programming platform with programmable inference | |
Abhari et al. | Scaffold: Quantum programming language | |
JP5763783B2 (en) | Method and apparatus for compiling regular expressions | |
TW202134959A (en) | Control method for a distributed processing system including a quantum information processor | |
US7278122B2 (en) | Hardware/software design tool and language specification mechanism enabling efficient technology retargeting and optimization | |
JP5848778B2 (en) | Use of dedicated elements to implement FSM | |
Yi | POET: a scripting language for applying parameterized source‐to‐source program transformations | |
Guo et al. | A compiler intermediate representation for reconfigurable fabrics | |
US10733343B2 (en) | System and method for the design of digital hardware | |
CN110149800A (en) | It is a kind of for handling the device of abstract syntax tree associated with the source code of source program | |
Kapre et al. | Survey of domain-specific languages for FPGA computing | |
Ahmad et al. | Leveraging parallel data processing frameworks with verified lifting | |
Koelbl et al. | Constructing efficient formal models from high-level descriptions using symbolic simulation | |
Ejjeh et al. | HPVM2FPGA: Enabling true hardware-agnostic FPGA programming | |
Ye et al. | HIDA: A Hierarchical Dataflow Compiler for High-Level Synthesis | |
Donovick et al. | Peak: A single source of truth for hardware design and verification | |
US20240143296A1 (en) | METHODS AND APPARATUS FOR COMBINING CODE LARGE LANGUAGE MODELS (LLMs) WITH COMPILERS | |
Vajk et al. | Runtime model validation with parallel object constraint language | |
Jiang et al. | Using OCL in executable UML | |
Quinlan et al. | Annotating user-defined abstractions for optimization | |
Bezati et al. | High-level system synthesis and optimization of dataflow programs for mpsocs | |
Cheong | Actor-oriented programming for wireless sensor networks | |
Arató et al. | A data flow graph generation method starting from C description by handling loop nest hierarchy | |
Thillai Rani et al. | Recurrent deep neural learning classification algorithm based high level synthesis in VLSI circuit with runtime adaptability |