Quantum-classical hybrid program optimization method

By using function inlining, value explicit transfer chain construction and conditional branch optimization technology in the quantum compiler, the number of classical instructions in the quantum-classical hybrid program is reduced, the problem of high computational load overhead of the quantum controller is solved, and the efficiency is improved The efficiency of quantum computing.

CN118627636APending Publication Date: 2024-09-10NAT UNIV OF DEFENSE TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410832464.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

When existing quantum-classical hybrid programs are executed in quantum controllers, the computational load overhead of classical logic is large, affecting computing efficiency.

Method used

The quantum-classical hybrid program is translated into an intermediate representation through a quantum compiler, using function inlining, value-explicit transfer chain construction and conditional branch optimization techniques to reduce the number of classical instructions until the function is converted into only one basic code block, thereby Generate target quantum computing instruction set program.

Benefits of technology

It reduces the number of classical instructions that need to be executed by the quantum controller during execution, and improves the efficiency and resource utilization of quantum computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627636A
    Figure CN118627636A
Patent Text Reader

Abstract

The invention discloses a quantum-classical hybrid program optimization method. The method comprises the following steps: 1) translating a quantum-classical real-time hybrid program described by using a high-level programming language into an intermediate representation capable of containing a quantum instruction and a classical instruction at the same time; the intermediate representation takes a function as a basic unit, (2) on the intermediate representation level, converting the whole program into a single function through function inline, and expressing a control flow of the program in the function by using a basic code block and instructions such as branches and skips; through a function inline technology, a function called by the target function is inline into the target function; (3) transmission of classical information and replacement or elimination of part of classical instructions are achieved through mode matching; 4) through a value explicit transmission chain construction algorithm, enabling any value which is used in the block but is from the outside of the block to serve as a parameter to be clearly transmitted, and avoiding the problem caused by implicit value transmission through block control; and 5) converting the code blocks in the function into an instruction stream without branch jump logic through the basic code block inline.
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, and in particular to a compilation method in a quantum-classical hybrid program. Background Art

[0002] Quantum-classical real-time heterogeneous computing hardware systems are generally composed of a classical computing system and a quantum coprocessor. In the quantum coprocessor, a quantum controller based on an instruction set can execute a hybrid quantum-classical instruction program. The classical instructions implement classical logic operations, update registers, and control program flow on the controller. The effect of the quantum instructions is to send a control signal and finally apply a quantum gate operation or measurement on the quantum bit. These two types of instructions can be interleaved on the controller, and the interaction delay between the two can be less than tens of nanoseconds.

[0003] From writing to executing on hardware, a quantum program includes several processes, such as using quantum programming language to describe quantum-classical heterogeneous programs, quantum compiler compiling and optimizing programs to generate instructions and other control commands, and quantum controller executing and applying operations on quantum chips. Quantum programming language provides expressive power to describe quantum logic, classical logic, and a mixture of the two on quantum controllers. The quantum compiler is responsible for parsing and optimizing quantum-classical real-time hybrid programs described in quantum programming language, and finally generating quantum-classical hybrid instruction programs for quantum-classical real-time heterogeneous computing hardware systems.

[0004] In addition to optimizing the quantum logic in quantum-classical real-time hybrid programs, quantum compilers also need to optimize the classical logic in the programs. Efficiently optimizing the classical logic in quantum-classical real-time hybrid programs plays a key role in reducing the computational load overhead of quantum controllers and improving the efficiency of quantum control.

[0005] CN113010302B discloses a multi-task scheduling method, system and quantum computer system architecture under a quantum-classical hybrid architecture, which is used for task scheduling transmitted by the front end of a quantum computer measurement and control system. The server merges the tasks of each user transmitted to the server, so that multiple tasks can be run simultaneously on the quantum computer; and divides the tasks into different task queues according to their different characteristics after merging; the quantum computer measurement and control system executes the tasks in the order in which the task queues are sent, and feeds back the execution results to the server; the server splits the feedback execution results and feeds them back to each user. Combining the characteristics of quantum computers with the resource management of classical computer operating systems, tasks submitted by different users in the same time period are run on quantum chips at the same time as much as possible, which improves the efficiency of using quantum computer bit resources and provides ideas for the efficient use of large-scale quantum bit chips in the future. Summary of the invention

[0006] The purpose of the present invention is to provide a quantum-classical hybrid program optimization method, that is, to optimize the classical logic in the program in the quantum compiler, reduce the computational load overhead of the quantum controller, and improve the efficiency of quantum control.

[0007] The technical solution of the present invention is a compilation optimization method for a quantum-classical hybrid program, which includes the following steps: 1. The compiler parses and translates the quantum-classical hybrid program into a quantum-classical hybrid intermediate representation; the intermediate representation meets the following conditions: - the function is the basic unit; - the basic unit in the function is the basic code block, and the basic code block ends with a program flow control instruction; - the static single assignment format is used to represent the value of the classical variable; 2. Through the function inlining technology, the function called by the target function is inlined into the target function. This process can be iterated multiple times until the target function no longer calls other functions. The result of this step is that the target function is expressed using a set of basic code blocks and program flow control instructions (such as branches, jumps, etc.); 3. In addition to the basic code block that serves as the entry point in the function, the value explicit transfer chain construction algorithm is executed on other basic code blocks in the function, so that any value used in the block but from outside the block is explicitly passed as a parameter; 4. The classical optimization technology in quantum-classical hybrid logic with conditional branches is iteratively executed for the function until the function is transformed into a form containing only one basic code block; 5. The program containing only one basic code block is translated and output as the target quantum computing instruction set program. Note that other additional compilation optimization steps can be inserted between the above steps.

[0008] The present invention translates a quantum-classical real-time hybrid program described in a high-level programming language into an intermediate representation that can contain both quantum instructions and classical instructions; at the intermediate representation level, the entire program is converted into a single function through function inlining, and the control flow of the program is expressed by using basic code blocks and instructions such as branches and jumps in the function; the transmission of classical information and the replacement or elimination of some classical instructions are realized through pattern matching; an algorithm is constructed through an explicit value transfer chain so that any value used in a block but from outside the block is explicitly passed as a parameter to avoid problems caused by implicitly passing values ​​through block dominance; and the code blocks in a function are converted into an instruction stream without branch jump logic through basic code block inlining. The present invention can be applied to a quantum compiler, can optimize the classical logic in a quantum-classical hybrid program, and can reduce the number of classical instructions to be executed in a quantum controller during the execution of a quantum-classical hybrid program.

[0009] The second aspect of the present invention provides an algorithm for constructing an explicit value transfer chain at the intermediate representation level of the compiler, so that any value used in a block but coming from outside the block can be explicitly passed to the block as a parameter; it includes the following steps: 1. Traverse all basic code blocks in the function, and perform the following operations on each basic code block: 1-1. Create an external value set: use a data structure to store all values ​​used in the current block but defined in external blocks; 1-2. Traverse the operations in the block: traverse each operation in the block by looping; 1-3. If the operand used by the operation is neither a parameter of the block nor generated by other operations in the block, add it to the external value set; 1-4. Add the values ​​in the external value set as new parameters to the block, and update all operations using these values; 2. If there is at least one basic code block whose parameters have changed during the traversal process, repeat the above traversal process until the parameters of all basic code blocks no longer change.

[0010] The third aspect of the present invention provides a classical optimization technique in quantum-classical hybrid logic with conditional branches, which can make the objective function contain as few classical instructions as possible and only contain one basic code block. It includes the following steps: 1. When the last instruction of the entry basic code block in the function is not a return instruction, execute the following iterations: 1. Use the determined classic numerical value to find the classic instructions that use the classic value later, perform compile-time calculations, obtain the classic constant results, and replace the classic instructions with the corresponding constant generation instructions 2. If the last instruction in the basic code block is an unconditional jump instruction, insert the basic code block pointed to by the unconditional jump instruction into the entry basic code block, and use the classic value in the entry basic block to replace the classic value passed by the jump instruction; delete the unconditional jump instruction; 4. If the last instruction in the basic code block is a conditional jump instruction, select the target basic code block for the jump according to the classic value in the entry basic code block, and then insert the target basic code block into the entry basic code block, and use the classic value in the entry basic block to replace the classic value passed by the jump instruction; delete the conditional jump instruction; 5. If the number of iterations exceeds the given threshold, the program terminates execution and returns failure.

[0011] The quantum-classical hybrid program optimization method proposed in the present invention can be used to construct a quantum compiler running on a classical processor (CPU). During the operation of the compiler on the CPU, the classical instructions in the quantum-classical hybrid program can be eliminated, and the underlying control signal description consistent with the semantics of the original quantum program can be generated. The quantum controller that does not support classical logic can thus use the generated underlying control signal description to generate specific control signals, complete the control of the quantum bit physical system, and then complete the expected quantum computing process.

[0012] The quantum-classical hybrid program compilation optimization technology of the quantum-classical real-time hybrid processor of the present invention is used to solve the determination and transmission process of classical information in the quantum-classical hybrid program. The present invention can be applied to quantum compilers, can optimize the classical logic in quantum-classical hybrid programs, and can reduce the number of classical instructions that need to be executed in the quantum controller during the execution of quantum-classical hybrid programs.

[0013] Beneficial effects: When users write quantum programs, they generally support describing the alternation of quantum computing and classical computing. However, in the currently commonly used quantum coprocessor implementation, a quantum control hardware system without real-time classical logic controls the quantum bit physical system (such as that based on superconducting quantum bits) by generating and receiving analog signals. Such quantum control hardware systems do not support classical logic. Therefore, the quantum compiler needs to provide classical optimization functions for quantum-classical hybrid programs so that the program can be executed on specific hardware. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 This is a flow chart of a compilation optimization method for quantum-classical hybrid programs;

[0015] Figure 2 Constructing method flow charts for explicit value delivery chains for quantum-classical hybrid programs;

[0016] Figure 3 Workflow diagram of classical optimization techniques in quantum-classical hybrid logic with conditional branches.

[0017] Figure 4 This is a schematic diagram of the physical device in Example 1 of the present invention.

[0018] Figure 5 This is the workflow of implementation case 1 of the present invention.

[0019] Figure 6 This is a schematic diagram of the physical device in Example 2 of the present invention.

[0020] Figure 7 This is the workflow of implementation case 2 of the present invention. DETAILED DESCRIPTION

[0021] Example 1: Quantum compiler for pure quantum logic generation

[0022] Figure 4 The figure is a physical device diagram of an exemplary practical application scenario of the present invention, wherein the quantum controller that only supports quantum logic can be realized by common electronic instruments, such as an arbitrary waveform generator, etc.; the quantum bit physical system can be a superconducting quantum bit physical system, etc.

[0023] In this scenario, the user writes a quantum-classical hybrid program using an independent quantum programming language on a classical host, then calls a quantum compiler that includes the quantum-classical hybrid optimization technology described in this invention to compile the program, and uploads it to a quantum controller that only supports pure quantum logic to control the quantum bit physical system to complete the expected computing process. Figure 5 As shown, the overall workflow of this application scenario is as follows.

[0024] 1. The user writes a quantum-classical hybrid program using an independent quantum programming language on a computer based on a classical CPU. In this program, quantum logic and classical logic can be intertwined, but measurement-based feedback control is not included.

[0025] 2. The user calls the quantum compiler that exists as a classical program on the classical CPU to compile the program. The process includes the following steps:

[0026] a) The quantum compiler parses the source program. After lexical analysis, syntax analysis, and semantic checking to ensure that the source code complies with the grammatical correctness of the source code, the source code is converted into an intermediate representation based on MLIR through intermediate representation conversion. In MLIR, the basic unit of program representation is the function, and the Single-Static Assignment (SSA) format is used. MLIR can express a mixture of quantum operations and classical operations, as well as the complex interactions between them.

[0027] b) The compiler applies various optimization techniques at the MLIR level, such as dead code elimination, constant folding, loop optimization, code normalization, etc. This stage can fully optimize the program in the static stage, improve the execution efficiency of the program, and reduce resource consumption.

[0028] c) The compiler uses the compilation optimization method in the first aspect of the present invention at the MLIR level, takes the entry function in the quantum program as the target optimization function, performs function inlining, value explicit transfer chain construction, supports classical logic optimization techniques with conditional branches, etc., and identifies and optimizes the interaction logic between quantum operations and classical operations. At this point, the quantum program is optimized into a program with a single code block, and the program does not contain other classical logic except constant definitions.

[0029] d) Based on the hardware characteristics of the quantum coprocessor, the compiler further optimizes the MLIR program. Factors that may need to be considered in this step include, but are not limited to: the physical layout and topological structure of quantum bits, the implementation limitations and delays of quantum gates, etc.

[0030] e) The quantum compiler converts the optimized MLIR into the required quantum control signal of the target quantum coprocessor, which can be a description of the required quantum control analog signal (such as microwave pulse) or other control signal.

[0031] 3. The user configures the quantum control signal to the quantum controller through a classical computer.

[0032] 4. The user triggers the quantum controller through a classical computer to generate and read the analog waveform, controlling the quantum bit physical system to complete the quantum computing logic.

[0033] Through the above process, the quantum-classical hybrid optimization process proposed in the present invention can translate a quantum hybrid program mixed with classical logic into a program that does not contain classical logic. The program can then be executed on a quantum controller that only supports pure quantum logic to complete quantum computing tasks.

[0034] Example 2: Optimization for quantum-classical hybrid logic

[0035] The quantum-classical hybrid optimization method proposed in the present invention can be used to optimize quantum-classical hybrid logic, and the optimized results can be applied to a quantum controller supporting quantum-classical real-time hybrid logic. Figure 6 FIG. 1 is a physical device diagram of a second exemplary practical application scenario of the present invention. Figure 5 The difference between the physical device is that the quantum controller in this device can support quantum-classical real-time hybrid logic. This quantum controller can be realized by customizing a microprocessor in a field programmable gate array (FPGA) to control an arbitrary waveform generator and a data acquisition module. The microprocessor can support a quantum-classical hybrid instruction set, in which quantum instructions and classical instructions can be arbitrarily interleaved.

[0036] The workflow in this scenario is as follows Figure 7 As shown:

[0037] 1. The user writes a quantum-classical hybrid program using an independent quantum programming language on a computer based on a classical CPU. The program allows for feedback control based on the quantum bit measurement results.

[0038] 2. The user calls the quantum compiler that exists as a classical program on the classical CPU to compile the program. The process generally includes the following steps:

[0039] a) The quantum compiler parses the source program. After lexical analysis, syntax analysis, and semantic checking to ensure that the source code complies with the grammatical correctness of the specification, the source code is converted into an intermediate representation based on MLIR through intermediate representation conversion.

[0040] The compiler applies various optimization techniques at the MLIR level, such as dead code elimination, constant folding, loop optimization, code normalization, etc. This stage can fully optimize the program in the static stage, improve the execution efficiency of the program, and reduce resource consumption. The compiler uses the compilation optimization method in the first aspect of the present invention at the MLIR level, with a function whose all parameter values ​​have been determined at compile time and does not contain feedback control based on quantum bit measurement results as the target optimization function, performs function inlining, value explicit transfer chain construction (the second aspect of this application), supports classical logic optimization technology with conditional branches (the third aspect of this application), etc., to identify and optimize the interaction logic between quantum operations and classical operations. At this point, the quantum program is optimized into a program with a single code block, and the program does not contain other classical logic except constant definitions. It is a brand-new compiler framework. For quantum compilers, please refer to: Alfred, V. Aho, S. Lam Monica, and D. Ullman Jeffrey. Compilers Principles, Techniques & Tools. Pearson Education, 2007. For function inlining, please refer to: Chang, Pohua P., and WW. Hwu. "Inline function expansion for compiling C programs." In Proceedings of the ACM SIGPLAN 1989 Conference on Programming language design and implementation, pp. 246-257. 1989. In MLIR, IR stands for Intermediate Representation, which can be regarded as a data format as an intermediate representation in end-to-end conversion. For example, deep learning models are generally represented as computational graphs, and the data results that can represent the computational graphs can be called an IR;

[0042] a)2. MLIR can express a mixture of quantum and classical operations, as well as the complex interactions between them.

[0043] b) For the quantum coprocessor, the compiler optimizes the MLIR program.

[0044] c) According to the classical computing resources on the quantum controller, the quantum compiler performs memory allocation, register allocation, etc., and converts the optimized MLIR into a quantum-classical real-time hybrid instruction set program and other required quantum control signals supported by the target quantum controller.

[0045] The present invention adopts function inlining as an optimization technique, which reduces the overhead of function calls by directly embedding the code of a function into the function that calls it. This technique is very common in compiler design, especially in performance-sensitive applications. Inline function is a programming language structure, which is mainly used to suggest the compiler to perform inline expansion on certain special functions, that is, embed the function body into each call at compile time to eliminate the overhead of function calls, thereby improving the running efficiency of the code. In programming, it is achieved by adding the inline keyword before the function definition. The purpose of inline function is to reduce the overhead of function calls, including the overhead of stack push, jump and return. The use of inline function should take into account the size and complexity of the function body: inline function usually requires the function body to be small and does not contain complex control statements, such as loops or recursion.

[0046] MLIR (Multi-Level Intermediate Representation) is a multi-level intermediate representation developed by the LLVM project team. It supports multiple programming languages ​​​​and hardware backends, making it possible to optimize code across multiple levels.

[0047] Here are some key uses and benefits of function inlining:

[0048] 1. Reduce call overhead: Function calls usually involve some overhead, such as saving and restoring register states, stack operations, etc. Through inlining, these call overheads can be eliminated, thereby improving the execution efficiency of the program.

[0049] 2. Improve code locality: Inlining can improve memory access patterns because the inlined code can be placed near the caller's code, which helps improve cache utilization.

[0050] 3. Optimized data flow analysis: Inlining allows the compiler to better analyze data flow and control flow because it has access to more contextual information, which helps further optimizations such as dead code elimination, constant propagation, etc.

[0051] 4. Avoid indirect jumps: Function inlining can avoid indirect jumps because the inlined code is directly embedded in the caller, so the compiler can generate more direct jump instructions.

[0052] 5. Support more complex optimization: Inlining provides a better foundation for more complex optimization techniques, such as loop unrolling and vectorization.

[0053] 6. Code size tradeoff: Although inlining can improve performance, it may also increase the size of the generated code. The compiler needs to make a tradeoff between optimizing performance and keeping the code compact.

[0054] In MLIR, function inlining can be implemented in a variety of ways, such as using MLIR's Passes (optimized by passes) or leveraging MLIR's high-level API to perform inlining manually. The design of MLIR allows compiler researchers and developers to define optimizations in a declarative way, which makes inlining and other optimization techniques easier to implement and combine. The following is a simplified MLIR code example showing how to represent a simple function inline:

[0055] ```mlir

[0056] / / Define a simple function

[0057] func@add(i32,i32)->i32{

[0058] %result=add%0,%1:i32

[0059] return %result:i32

[0060] }

[0061] / / Define a function that calls the above function

[0062] func@caller(i32)->i32{

[0063] %arg=call@add(%0,%0):(i32)->i32

[0064] return %arg:i32}

[0065] / / Use inline code

[0066] func@caller_inlined(i32)->i32{

[0067] %0=add%0,%0:i32 / / Here the add operation is used directly instead of calling the @add function return%0:i32

[0068] }

[0069] ```

[0070] In this example, the `@caller` function calls the `@add` function, and in `@caller_inlined`, the `@add` operation is inlined directly into `@caller`, thus avoiding the function call overhead. In real MLIR code, the inlining process may be more complicated, involving more context and optimization decisions.

[0071] 3. The user configures the quantum-classical real-time hybrid instruction set program and other control signals to the quantum controller through a classical computer.

[0072] 4. The user triggers the execution of the quantum controller through a classical computer. The quantum controller generates and reads the simulation waveform in real time according to the execution results of the instructions, and controls the quantum bit physical system to complete the quantum computing logic.

[0073] When a quantum program contains feedback control based on quantum bit measurement results, the method proposed in the present invention can deeply optimize functions in the program whose parameter values ​​have been determined at compile time and do not contain feedback control based on quantum bit measurement results, thereby reducing the classical logic execution overhead of the quantum coprocessor when executing quantum-classical real-time hybrid programs.

[0074] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A quantum-classical hybrid program optimization method, characterized in that: The following steps are involved: 1) Translate the quantum-classical real-time hybrid program described in a high-level programming language into an intermediate representation that can contain both quantum instructions and classical instructions; the intermediate representation uses functions as basic units, where the basic unit of a function is a basic code block, and the basic code block ends with a program flow control instruction, and uses a static single assignment format to represent the value of a classical variable; 2) At the intermediate representation level, the entire program is converted into a single function through function inlining, and the function uses basic code blocks and branch, jump and other instructions to express the control flow of the program; through function inlining technology, the function called by the target function is inlined into the target function, and this process can be iterated multiple times until the target function no longer calls other functions; The target function is expressed using a set of basic code blocks and program flow control instructions; 3) Pattern matching is used to realize the transmission of classical information and the replacement or elimination of some classical instructions; 4) An algorithm is constructed through an explicit value transfer chain so that any value used in the block but from outside the block is explicitly passed as a parameter to avoid problems caused by implicitly passing values ​​through block controls; 5) The code blocks in the function are converted into instruction streams without branch jump logic through basic code block inlining.

2. The quantum-classical hybrid program optimization method according to claim 1, characterized in that: An explicit value transfer chain construction algorithm is executed on other basic code blocks in the function except the basic code block serving as the entry point to ensure that any value used in the block but coming from outside the block is explicitly passed as a parameter; a classical optimization technique in quantum-classical hybrid logic with conditional branches is iteratively executed on the function until the function is transformed into a form containing only one basic code block; and the program containing only one basic code block is translated and output as a target quantum computing instruction set program.

3. The quantum-classical hybrid program optimization method according to claim 1, characterized in that: Additional compilation optimization steps can be inserted between the above steps.

4. The quantum-classical hybrid program optimization method according to claim 1, characterized in that: An algorithm for constructing an explicit value transfer chain at the compiler intermediate representation level for quantum-classical hybrid program optimization includes the following steps: any value used in a block but coming from outside the block is explicitly passed to the block as a parameter; the algorithm includes the following steps: 1) traverse all basic code blocks in the function, and for each basic code block, perform operations such as creating an external value set and traversing the block: and add the values ​​used whose operands are neither parameters of the block nor generated by other operations in the block to the external value set; - add the values ​​in the external value set as new parameters to the block, and update all operations using these values; 1-1) create an external Value set: use a data structure to store all values ​​used in the current block but defined in external blocks; 1-2) traverse the operations in the block: traverse each operation in the block through a loop; 1-3) if the operand used by the operation is neither a parameter of the block nor generated by other operations in the block, add it to the external value set; 1-4) add the values ​​in the external value set as new parameters to the block and update all operations that use these values; 2) if there is at least one basic code block whose parameters have changed during the traversal process, repeat the above traversal process until the parameters of all basic code blocks no longer change.

5. The quantum-classical hybrid program optimization method according to claim 1, characterized in that: Classical optimization techniques in quantum-classical hybrid logic with conditional branches can make the objective function contain as few classical instructions as possible and only one basic code block; The method comprises the following steps: - When the last instruction of the entry basic code block in the function is not a return instruction, the following iterations are performed: 1-1) using the determined classic numerical value, finding the classic instructions that subsequently use the classic value, performing compile-time calculations, obtaining the classic constant results, and replacing the classic instructions with the corresponding constant generation instructions; 1-2) if the last instruction in the basic code block is an unconditional jump instruction, inserting the basic code block pointed to by the unconditional jump instruction into the entry basic code block, and replacing the classic value passed by the jump instruction with the classic value in the entry basic block; deleting the unconditional jump instruction; 1-3) if the last instruction in the basic code block is a conditional jump instruction, selecting the target basic code block to jump to according to the classic value in the entry basic code block, and then inserting the target basic code block into the entry basic code block, and replacing the classic value passed by the jump instruction with the classic value in the entry basic block; deleting the conditional jump instruction; 1-4) if the number of iterations exceeds a given threshold, the program terminates execution and returns failure.

6. A quantum compiler for implementing the quantum-classical hybrid program optimization method according to any one of claims 1 to 5, characterized in that: The compiler is configured with: a parser for parsing and translating a quantum-classical hybrid program into an intermediate representation; an inliner for executing a function inlining technique; a value explicit transfer chain builder for building a value explicit transfer chain of a basic code block; and a classical optimizer for performing classical optimization on a quantum-classical hybrid logic containing conditional branches.

7. A computer-readable storage medium having a computer-executable program stored thereon, the program comprising instructions for executing the quantum-classical hybrid program optimization method according to any one of claims 1 to 5.