A method and device for designing a classical and quantum hybrid instruction pipeline

By dividing the instruction execution process into five clock cycles and combining the shared instruction memory and the quantum control unit, the parallel processing of classical and quantum hybrid instructions is realized, which solves the problem of low hybrid program execution efficiency in the existing technology and improves the computing efficiency. .

CN116187455BActive Publication Date: 2024-10-25Chinese People's Liberation Army Cyberspace Force Information Engineering University
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211625004.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-16
Publication Date
2024-10-25
Estimated Expiration
2042-12-16

AI Technical Summary

Technical Problem

Existing technology cannot achieve efficient overlapping execution of instructions in classical and quantum hybrid programs, resulting in low computing efficiency within quantum coherence time and noise interference.

Method used

A hybrid classical and quantum instruction pipeline method is designed, which divides the instruction execution process into five clock cycles, including instruction fetch, decode/register fetch, execution/address calculation, measurement/memory access and write-back cycles, using shared instructions The memory and quantum control unit enable parallel processing of classical and quantum instructions.

Benefits of technology

By making full use of the parallelism between hybrid instructions, the pipeline delay problem introduced by quantum feedback control and communication between classical quantum units is solved, and efficient instruction-level parallel execution of classical and quantum hybrid programs is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116187455B_ABST
    Figure CN116187455B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for designing a classical and quantum hybrid instruction pipeline. The method divides the instruction execution process into five clock cycles; in the instruction extraction cycle, the instruction is read from the shared instruction memory to the instruction register according to the value of the program counter, and then the value of the program counter is updated; in the instruction decoding / register extraction cycle, the instruction is read from the instruction register, and for quantum instructions, it is decoded into a quantum operation and sent to the quantum control unit to convert it from a digital signal to an analog signal; in the execution / address calculation cycle, for quantum instructions, the analog signal output by the quantum control unit is processed by the quantum processing unit to control the quantum state evolution on different quantum bits; in the measurement / memory access cycle, for quantum instructions, the measurement result is converted into a digital signal by the quantum control unit and then written into the classical register; in the write-back cycle, the instruction execution result is written to the corresponding register.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of quantum computing technology, and in particular to a method and device for designing a classical and quantum hybrid instruction pipeline. Background Art

[0002] In the field of classical computing, instruction pipelining is a technology that achieves overlapping execution of multiple instructions by dividing instruction execution into multiple cycles. The overlap between instructions is called instruction level parallelism (ILP). Instruction pipelining develops the parallelism between instructions in a serial instruction stream, which can shorten the average execution clock cycle per instruction (CPI), but it also introduces data hazards, structural hazards, and control hazards. The corresponding optimization technologies include forwarding and bypassing, branch prediction, and dynamic scheduling.

[0003] In the field of quantum computing, like classical architectures, the Quantum Instruction Set Architecture (QISA) is an important component of fully programmable quantum computers. It is the interface between quantum software and hardware. Similar to classical parallel computing, there are multiple levels of parallelism in quantum programs. For example, quantum programs are usually organized through parallel subcircuits, in which different quantum operations can be executed simultaneously. Parallel optimization techniques for quantum instruction execution include circuit level parallelism (CLP) and quantum operation level parallelism (QOLP). For example, studies have proposed a multi-processor architecture using CLP, which supports dynamic scheduling of different subcircuits, can handle parallel feedback control, and minimize the potential overhead of interrupt timing control. In terms of quantum operation level parallelism, studies have proposed quantum superscalar methods for efficient parallel quantum instructions.

[0004] In the field of instruction-level parallelism research, existing technologies are either instruction parallelism technologies for classical computing programs or instruction parallelism technologies only for quantum circuits, and have not yet paid attention to the parallel optimization of classical and quantum hybrid instructions. At present, the execution process of a typical classical and quantum hybrid program is generally an iterative process of classical preprocessing, quantum computing, and classical postprocessing. Among them, classical instructions are executed on the classical CPU pipeline, and quantum instructions are sent to the quantum computer for execution. The execution process of classical and quantum instructions is relatively independent. The main reason for limiting the execution of classical and quantum hybrid instructions is that real-time classical computing cannot be performed within the quantum coherence time. To address this problem, existing studies have proposed a technology for performing classical computing within the coherence time based on high-speed synchronous measurement and control equipment. This method is called dynamic circuit technology.

[0005] In summary, existing technologies include mature classical instruction pipeline technology, quantum instruction parallel optimization technology, and dynamic circuit technology based on high-speed synchronous devices. The disadvantage is that there is currently no classical and quantum hybrid instruction pipeline. For classical and quantum hybrid programs, when classical instructions and quantum instructions are executed alternately, instruction overlapping execution cannot be achieved. Summary of the invention

[0006] In view of the problem that classical and quantum hybrid programs cannot achieve efficient instruction pipeline parallelism under current technology, the present invention provides a classical and quantum hybrid instruction pipeline design method and device, which can improve the execution efficiency of hybrid programs and more efficiently complete classical quantum hybrid calculations within a limited quantum coherence time and under noise interference.

[0007] On the one hand, the present invention provides a classical and quantum hybrid instruction pipeline design method, which divides the instruction execution process into five clock cycles, including an instruction fetch cycle, an instruction decode / register fetch cycle, an execution / address calculation cycle, a measurement / memory access cycle, and a write-back cycle;

[0008] In an instruction fetch cycle, an instruction is read from a shared instruction memory into an instruction register according to a value of a program counter, and then the value of the program counter is updated; the shared instruction memory refers to an instruction memory shared by classical instructions and quantum instructions;

[0009] In the instruction decoding / register extraction cycle, the instruction is read from the instruction register. If the current instruction is a classical instruction, the corresponding operation is performed according to the original decoding and reading method of the classical instruction; if the current instruction is a quantum instruction, it is decoded into a quantum operation and sent to the quantum control unit to convert it from a digital signal to an analog signal;

[0010] In the execution / address calculation cycle, for classical instructions, the ALU unit is used to process them in the original processing mode of classical instructions; for quantum instructions, the quantum processing unit is used to process the analog signal output by the quantum control unit to control the evolution of quantum states on different quantum bits;

[0011] In the measurement / memory access cycle, for classical instructions, the shared instruction memory is accessed according to the original access method of classical instructions; for quantum instructions, the measurement results are converted into digital signals by the quantum control unit and then written into the classical register;

[0012] In the write-back cycle, the instruction execution result is written to the corresponding register.

[0013] In another aspect, the present invention provides a classical and quantum hybrid instruction pipeline processing device, comprising a classical instruction processing module and a quantum instruction processing module;

[0014] The classical instruction processing module is used to perform corresponding operations according to the original decoding and reading methods of the classical instructions during the instruction decoding / register extraction cycle; to process the classical instructions according to the original processing methods of the classical instructions using the ALU unit during the execution / address calculation cycle; and to access the instruction memory according to the original access methods of the classical instructions;

[0015] The quantum instruction processing module includes: a quantum register, a quantum control unit and a quantum processing unit;

[0016] The quantum register is used to decode the quantum instruction into a quantum operation and then send it to the quantum control unit during the instruction decoding / register extraction cycle;

[0017] The quantum control unit is used to convert the quantum operation from digital signal to analog signal in the instruction decoding / register extraction cycle; and to convert the measurement result into digital signal and write it into the classical register in the measurement / memory access cycle;

[0018] The quantum processing unit is used to process the analog signal output by the quantum control unit during the execution / address calculation cycle to control the evolution of quantum states on different quantum bits.

[0019] Furthermore, an instruction cache is provided for caching instructions read into the instruction register during an instruction fetch cycle.

[0020] Beneficial effects of the present invention:

[0021] The present invention designs a classical and quantum hybrid instruction pipeline scheme based on classical instruction pipeline design and quantum instruction parallel technology, fully utilizing the parallelism between hybrid instructions in classical and quantum hybrid programs, realizing pipeline execution of classical and quantum hybrid instructions, and providing support for efficient execution of classical and quantum hybrid programs. Compared with the prior art, the present invention addresses the problem that there is no classical and quantum hybrid instruction pipeline at present, and solves the problems such as significant pipeline delay introduced by quantum feedback control and communication between classical and quantum units during the execution of classical and quantum hybrid programs. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A schematic diagram of a classical and quantum hybrid instruction pipeline and data path provided for an embodiment of the present invention;

[0023] Figure 2 A schematic diagram of the execution process of the hybrid program provided in an embodiment of the present invention on a hybrid pipeline. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0025] Example 1

[0026] Through in-depth analysis of the execution process of quantum instructions, the inventor believes that the execution process of quantum instructions can be divided into digital-to-analog conversion (DA) and execution (EX) stages, and the measurement process of quantum instructions can be divided into analog-to-digital conversion (AD) and memory access (MEM). Based on this, the embodiment of the present invention explores the instruction-level parallelism of classical and quantum hybrid programs, fully considers the characteristics of quantum instructions, introduces quantum instruction processing components on the basis of classical pipelines, and divides the execution process of quantum instructions into several instruction cycles, thereby pipelined quantum instructions and merged with classical pipelines, solving the problems of significant pipeline delays introduced by quantum feedback control and classical quantum communication during the execution of classical and quantum hybrid programs, and realizing efficient instruction-level parallelism of classical and quantum hybrid programs.

[0027] like Figure 1As shown, an embodiment of the present invention provides a classical and quantum hybrid instruction pipeline design method, characterized in that the instruction execution process is divided into five clock cycles, including an instruction fetch cycle (IF), an instruction decode / register fetch cycle (ID), an execution / address calculation cycle (EX), a measurement / memory access cycle (MM) and a write-back cycle (WB); Figure 1 In the figure, NPC, A, B, Imm and ALUoutput all represent temporary registers; IR represents instruction register; Mux represents multiplexer;

[0028] In the instruction fetch cycle, instructions are read from the shared instruction memory (all instructions of the hybrid program are stored in the shared instruction memory) to the instruction register according to the value of the program counter (PC), and then the value of the program counter is updated (each instruction is 4 bytes long, and the program counter (PC) is increased by 4 each time); the shared instruction memory refers to the instruction memory shared by classical instructions and quantum instructions. Classical instructions include arithmetic instructions, control instructions, and load / store instructions. Quantum instructions are quantum operations (Qop) composed of basic quantum gates (such as U gates and CR gates).

[0029] In the instruction decoding / register extraction cycle, the instruction is read from the instruction register. If the current instruction is a classical instruction, the corresponding operation is performed according to the original decoding and reading method of the classical instruction; if the current instruction is a quantum instruction, it is decoded into a quantum operation (Qop) and sent to the quantum control unit to convert it from a digital signal to an analog signal;

[0030] In the execution / address calculation cycle, for classical instructions, the ALU unit is used to process them in the original processing mode of classical instructions; for quantum instructions, the quantum processing unit is used to process the analog signal output by the quantum control unit to control the evolution of quantum states on different quantum bits;

[0031] In the measurement / memory access cycle, for classical instructions, the shared instruction memory is accessed according to the original access method of classical instructions; for quantum instructions, the measurement results are converted into digital signals by the quantum control unit and then written into the classical register;

[0032] Specifically, if the classic instruction is a load instruction, the effective address calculated in the previous cycle is used for reading; if the classic instruction is a store instruction, the register data read from the classic register using the effective address is written to the memory.

[0033] In the write-back cycle, the instruction execution results (including classical load instructions, classical ALU calculation instructions, and quantum measurement instructions) are written to the corresponding registers.

[0034] Figure 2The execution process of a classical and quantum hybrid program on the classical and quantum hybrid instruction pipeline proposed by the present invention is given. Figure 2 The left side of the figure shows a mixed program code represented by low-level instructions. The program consists of classical instructions and quantum instructions, of which H and Measure are quantum instructions and the rest are classical instructions. In this program, the results of the operation and measurement of the quantum bit are saved in the classical register R5 and used in the classical instruction DSUB. Figure 2 The right side shows the execution process of the program instruction on the hybrid pipeline proposed by the present invention, that is, the stage of each instruction in the pipeline as the clock cycle increases. The corresponding relationship between each symbol and instruction is: HH, M-Measure, LD-LD, SUB-DSUB, AND-AND, OR-OR. The following is a detailed description of the instruction execution process in each clock cycle pipeline.

[0035] In the first clock cycle, quantum instruction H enters the IF stage;

[0036] In the second, third, and fourth clock cycles, the quantum instruction M, the classical instruction LD, and the classical instruction SUB enter the pipeline in sequence, and each instruction in the pipeline enters the next stage of the pipeline in sequence according to the clock cycle;

[0037] In the fifth clock cycle, the SUB instruction and LD instruction enter the ID and EX stages of the pipeline respectively. The data of the source register R1 of the SUB instruction should come from the destination register of the LD instruction, and the data of the source register R5 should come from the destination register of the Measure instruction. Since the LD instruction and the Measure instruction have not been executed completely, the pipeline detects a data hazard and will pause in the next clock cycle to resolve the data hazard.

[0038] In the sixth clock cycle, since a data hazard was detected in the previous clock cycle, the pipeline pauses to wait for the data to be in place. The SUB instruction and the instructions before the SUB instruction pause execution, and the instructions after the SUB instruction continue to execute in the pipeline. Among them, the LD instruction and the Measure instruction enter the MEM stage and the WB stage respectively.

[0039] In the seventh clock cycle, the LD instruction has loaded the data in the memory into the R1 register, and the Measure instruction has written the measurement result to the R5 register, and the data hazard is removed. The pipeline executes normally, and the OR instruction enters the IF stage of the pipeline;

[0040] From the eighth clock cycle to the eleventh clock cycle, the pipeline executes normally and in order until the OR instruction enters the WB stage to complete execution.

[0041] Example 2

[0042] The embodiment of the present invention also provides a classical and quantum hybrid instruction pipeline processing device, including a classical instruction processing module, a quantum instruction processing module and an instruction cache;

[0043] The classical instruction processing module is used to perform corresponding operations according to the original decoding and reading methods of the classical instructions during the instruction decoding / register extraction cycle; to process the classical instructions according to the original processing methods of the classical instructions using the ALU unit during the execution / address calculation cycle; and to access the instruction memory according to the original access methods of the classical instructions;

[0044] The quantum instruction processing module includes: a quantum register, a quantum control unit and a quantum processing unit;

[0045] The quantum register is used to decode the quantum instruction into a quantum operation and then send it to the quantum control unit during the instruction decoding / register extraction cycle;

[0046] The quantum control unit is used to convert the quantum operation from digital signal to analog signal in the instruction decoding / register extraction cycle; and to convert the measurement result into digital signal and write it into the classical register in the measurement / memory access cycle;

[0047] The quantum processing unit is used to process the analog signal output by the quantum control unit in the execution / address calculation cycle to control the evolution of quantum states on different quantum bits;

[0048] The instruction cache is used to cache instructions read into the instruction register during an instruction fetch cycle, which can further improve execution efficiency.

[0049] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for designing a classical and quantum hybrid instruction pipeline, characterized in that: First, the execution process of quantum instructions is divided into digital-to-analog conversion and execution stages, and the measurement process of quantum instructions is divided into analog-to-digital conversion and memory access, so as to divide the entire execution process of quantum instructions into several instruction cycles; then, a quantum instruction control unit and a quantum instruction processing unit are introduced on the classical instruction pipeline to merge the quantum instruction pipeline with the classical instruction pipeline, so as to finally divide the hybrid instruction execution process into five clock cycles, including instruction fetch cycle, instruction decoding / register fetch cycle, execution / address calculation cycle, measurement / memory access cycle and write-back cycle; In an instruction fetch cycle, an instruction is read from a shared instruction memory into an instruction register according to a value of a program counter, and then the value of the program counter is updated; the shared instruction memory refers to an instruction memory shared by classical instructions and quantum instructions; In the instruction decoding / register extraction cycle, the instruction is read from the instruction register. If the current instruction is a classical instruction, the corresponding operation is performed according to the original decoding and reading method of the classical instruction; if the current instruction is a quantum instruction, it is decoded into a quantum operation and sent to the quantum control unit to convert it from a digital signal to an analog signal; In the execution / address calculation cycle, for classical instructions, the ALU unit is used to process them in the original processing mode of classical instructions; for quantum instructions, the quantum processing unit is used to process the analog signal output by the quantum control unit to control the evolution of quantum states on different quantum bits; In the measurement / memory access cycle, for classic instructions, the shared instruction memory is accessed according to the original access mode of the classic instructions; For quantum instructions, the quantum control unit is used to convert the measurement results into digital signals and then write them into classical registers; In the write-back cycle, the instruction execution result is written to the corresponding register.

2. A classical and quantum hybrid instruction pipeline processing device, applied to the method of claim 1, characterized in that: Includes classical instruction processing module and quantum instruction processing module; The classic instruction processing module is used to perform corresponding operations according to the original decoding and reading methods of the classic instructions during the instruction decoding / register extraction cycle; In the execution / address calculation cycle, the ALU unit is used to process the classical instructions according to the original processing method of the classical instructions; and accessing the instruction memory in accordance with the original access mode of the classic instructions; The quantum instruction processing module includes: a quantum register, a quantum control unit and a quantum processing unit; The quantum register is used to decode the quantum instruction into a quantum operation and then send it to the quantum control unit during the instruction decoding / register extraction cycle; The quantum control unit is used to convert the quantum operation from digital signal to analog signal in the instruction decoding / register extraction cycle; and to convert the measurement result into digital signal and write it into the classical register in the measurement / memory access cycle; The quantum processing unit is used to process the analog signal output by the quantum control unit during the execution / address calculation cycle to control the evolution of quantum states on different quantum bits.

3. A classical and quantum hybrid instruction pipeline processing device according to claim 2, characterized in that: An instruction cache is also provided for caching instructions read into the instruction register during an instruction fetch cycle.