Instruction compilation, branch prediction method, apparatus, and computing device

By adding compiler branch prediction instructions to the processor, the problem of inaccurate processor branch prediction is solved, improving the accuracy of branch prediction and processor performance.

CN123177887APending Publication Date: 2026-11-27DAMO (SHANGHAI) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510686748.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-26
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

The processor's branch prediction results are not accurate enough, which leads to a decrease in processing speed.

Method used

By combining the branch prediction results from the compiler and processor, and adding indication information such as static prediction flags to the instructions, hardware branch prediction can be guided, thereby improving the accuracy of branch prediction.

Benefits of technology

It improves the accuracy of branch prediction, reduces processor pipeline stalls caused by incorrect predictions, and enhances program execution speed and overall performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123177887A_ABST
    Figure CN123177887A_ABST
Patent Text Reader

Abstract

The application discloses an instruction compiling and branch prediction method, a device and a computing device. The method comprises the following steps: obtaining a first branch prediction result obtained by a compiler in branch prediction of a target branch statement; generating indication information used for indicating the first branch prediction result, wherein a processor obtains a target branch prediction result based on the indication information and a second branch prediction result, and the second branch prediction result is obtained by the processor in branch prediction of the target branch statement; and obtaining a compiled target branch instruction based on the indication information. The application solves the technical problem that the branch is processed according to the branch prediction result of the processor in the related art, and the processing is not accurate enough.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of processors, and more specifically, to an instruction compilation, branch prediction method, apparatus, and computing device. Background Technology

[0002] In programming languages, branch statements are a type of control flow statement. After source code is compiled into machine code, the compiler converts branch statements into a series of branch instructions. Branch instructions are divided into conditional jump instructions and unconditional jump instructions. As the name suggests, conditional jump instructions only jump when a certain condition is met; otherwise, execution continues to the next instruction. Processors typically execute instructions sequentially. When encountering a branch instruction, they need to determine whether a jump is necessary based on the actual situation, thus reducing execution speed. Therefore, it is necessary to predict the branch path. However, the prediction of branch instructions by the processor (Central Processing Unit) hardware is not accurate enough.

[0003] There is currently no effective solution to the above problems. Summary of the Invention

[0004] This application provides an instruction compilation, branch prediction method, apparatus, and computing device to at least solve the technical problem in the related art where processing branches based on the processor's branch prediction results leads to inaccurate processing.

[0005] According to one aspect of the embodiments of this application, an instruction compilation method is provided, comprising: obtaining a first branch prediction result obtained by the compiler performing branch prediction on a target branch statement; generating indication information for indicating the first branch prediction result, wherein the processor obtains a target branch prediction result based on the indication information and a second branch prediction result, the second branch prediction result being obtained by the processor performing branch prediction on the target branch statement; and obtaining a compiled target branch instruction based on the indication information.

[0006] Optionally, based on the instruction information, the compiled target branch instruction is obtained, including: compiling the target branch statement to obtain the initial branch instruction; and adding the instruction information to the initial branch instruction to obtain the target branch instruction.

[0007] Optionally, obtaining the first branch prediction result obtained by the compiler in performing branch prediction on the target branch statement includes: obtaining the target branch whose branch prediction probability is higher than a predetermined threshold obtained by the compiler in performing branch prediction on the target branch statement; and determining the target branch as the first branch prediction result.

[0008] Optionally, the indication information is a single-bit indicator.

[0009] According to another aspect of the embodiments of this application, a branch prediction method is also provided, comprising: obtaining indication information, wherein the indication information is used to instruct the compiler to perform branch prediction on a target branch statement to obtain a first branch prediction result; performing branch prediction on the target branch statement to obtain a second branch prediction result; and obtaining a target branch prediction result based on the indication information and the second branch prediction result.

[0010] Optionally, obtaining the target branch prediction result based on the indication information and the second branch prediction result includes: obtaining the first probability corresponding to the first branch prediction result and the second probability corresponding to the second branch prediction result; and obtaining the target branch prediction result based on the first probability and the second probability.

[0011] Optionally, the target branch prediction result is obtained based on the first probability and the second probability, including: obtaining the first weight corresponding to the first probability and the second weight corresponding to the second probability; and obtaining the target branch prediction result based on the first probability and the first weight, and the second probability and the second weight.

[0012] Optionally, the indication information is a single-bit indicator.

[0013] According to another aspect of the embodiments of this application, an instruction compilation apparatus is also provided, comprising: a first acquisition module, configured to acquire a first branch prediction result obtained by the compiler performing branch prediction on a target branch statement; a generation module, configured to generate indication information for indicating the first branch prediction result, wherein the processor obtains a target branch prediction result based on the indication information and a second branch prediction result, the second branch prediction result being obtained by the processor performing branch prediction on the target branch statement; and a compilation module, configured to obtain a compiled target branch instruction based on the indication information.

[0014] According to another aspect of the embodiments of this application, a branch prediction apparatus is also provided, comprising: a second acquisition module, configured to acquire indication information, wherein the indication information is used to instruct the compiler to perform branch prediction on a target branch statement to obtain a first branch prediction result; a first prediction module, configured to perform branch prediction on the target branch statement to obtain a second branch prediction result; and a second prediction module, configured to obtain a target branch prediction result based on the indication information and the second branch prediction result.

[0015] According to another aspect of the embodiments of this application, a compiler is also provided, including: a parsing component and an instruction generation component, wherein the parsing component is used to receive source code to be compiled; and the instruction generation component communicates with the parsing component and is used to generate target instructions from the source code according to the instruction compilation method of any one of the above.

[0016] According to another aspect of the embodiments of this application, a computing device is also provided, including: a memory storing an executable program; and a processor for running the program, wherein the program executes the instruction compilation and branch prediction methods in various embodiments of this application when it runs.

[0017] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored executable program, wherein the instruction compilation and branch prediction methods of various embodiments of this application are implemented when the executable program is executed by a processor.

[0018] In this embodiment, a first branch prediction result obtained by the compiler from branch prediction of the target branch statement is obtained; indication information for indicating the first branch prediction result is generated, wherein the processor obtains the target branch prediction result based on the indication information and the second branch prediction result, the second branch prediction result being obtained by the processor from branch prediction of the target branch statement; and the compiled target branch instruction is obtained based on the indication information. By combining the first branch prediction result obtained by the compiler from branch prediction of the target branch statement and the second branch prediction result obtained by the processor from branch prediction of the target branch statement, the accuracy of the final branch prediction result can be effectively improved, thereby solving the technical problem in related technologies where processing branches based on the processor's branch prediction result leads to inaccurate processing.

[0019] It is worth noting that the general description above and the detailed description that follow are merely for illustrative purposes and do not constitute a limitation on this application. Attached Figure Description

[0020] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0021] Figure 1 This is a hardware structure block diagram of a RISC-V system for implementing a branch prediction method according to an embodiment of this application;

[0022] Figure 2 This is a method of using the above according to an embodiment of this application. Figure 1 The diagram shows a System-on-Chip (SOC) based on the RISC-V architecture.

[0023] Figure 3 This is a flowchart of an instruction compilation method according to an embodiment of this application;

[0024] Figure 4This is a flowchart of a branch prediction method according to an embodiment of this application;

[0025] Figure 5 This is a schematic diagram of compiler-guided hardware branch prediction based on instruction flags according to an optional embodiment of the present invention;

[0026] Figure 6 This is a schematic diagram of assembly code according to an optional embodiment of the present invention;

[0027] Figure 7 This is a structural block diagram of an instruction compilation device according to an embodiment of the present invention;

[0028] Figure 8 This is a structural block diagram of a branch prediction device according to an embodiment of the present invention;

[0029] Figure 9 This is a structural block diagram of a computing device according to an embodiment of this application. Detailed Implementation

[0030] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0032] First, some nouns or terms that appear in the description of the embodiments of this application shall be interpreted as follows:

[0033] Branching statements: In programming languages, branching statements are a type of control flow statement. After the source code is compiled into machine code, the compiler converts the branching statements in the source code into a series of branch instructions. Computer instructions are usually executed sequentially, but branching instructions can jump to other locations to execute the next instruction. Branching instructions are divided into conditional jump instructions and unconditional jump instructions. As the name suggests, conditional jump instructions only jump when a certain condition is met; otherwise, execution continues to the next instruction.

[0034] Hardware branch prediction: This is a prediction performed by the CPU hardware during program execution. The CPU hardware analyzes the program's execution history to predict the execution direction of branch instructions, thereby preparing the instruction pipeline in advance and avoiding potential pauses during the actual execution of branch instructions, thus accelerating program execution.

[0035] Compiler branch prediction, also known as static branch prediction, involves the compiler analyzing source code during the compilation phase to determine the execution probability of branch statements and optimize the generated machine code. Compiler branch prediction differs from hardware branch prediction; compiler branch prediction predicts branch statements at the source code level, while hardware branch prediction predicts branch instructions at the hardware level.

[0036] Low Level Virtual Machine (LLVM): A modular, configurable compiler infrastructure project. It is not just a compiler, but a compiler framework that provides a series of tools and libraries for compiling, optimizing, analyzing, statically linking, and dynamically linking code.

[0037] The fifth-generation Reduced Instruction Set Computing (RISC-V) is an open, modular, and scalable instruction set architecture designed based on the principles of Reduced Instruction Set Computing (RISC). The RISC-V instruction set consists of a basic instruction set and optional standard extensions, such as multiplication and division (M-extensions), atomic operations (A-extensions), and compressed instructions (C-extensions). The RISC-V instruction set can be used to design processors ranging from microcontrollers to supercomputers. Due to its modular design, it can be easily adapted to different application areas, such as the Internet of Things (IoT), embedded systems, servers, and high-performance computing. Furthermore, the RISC-V instruction set is very concise, with most instructions using only 16 or 32 bits, which helps simplify processor design, increase code density, and, in some cases, improve performance.

[0038] The RISC-V LLVM compiler toolchain refers to a collection of compilers and related tools built using the LLVM architecture for RISC-V processors.

[0039] Executable files compiled by compilers typically contain numerous conditional branch instructions. These instructions only jump to the next instruction if a certain condition is met; otherwise, they execute the next instruction. Hardware usually uses heuristic algorithms (such as analyzing patterns in past execution records) to predict the direction of these branches, preparing in advance to speed up execution. However, hardware cannot perfectly predict the branch's direction in advance; incorrect predictions can actually further slow down execution.

[0040] Besides hardware branch prediction, compilers can also assist in branch prediction. Compiler branch prediction can arrange branch code blocks according to certain rules (such as the compiler's branch prediction results) during the compilation stage, making it easier for hardware branch prediction algorithms to discover patterns and improve accuracy.

[0041] For example, when using `_builtin_expect`, `likely`, `unlikely`, or Profile-Guided Optimization (PGO) for runtime analysis, the LLVM compiler obtains the jump probabilities of code blocks and places branches with higher execution probabilities below jump statements. This makes hardware branch prediction at runtime more accurate in predicting the next execution, as it detects more regularity in conditional jumps. `_builtin_expect`, `likely`, and `unlikely` are built-in compiler functions or macros used to provide hints to the compiler about the possible execution direction of a conditional branch. For example, `likely` means the compiler should assume this branch will be executed frequently, while `unlikely` implies the opposite. `_builtin_expect` is a more general function that allows developers to specify the expected branch result. PGO is a compiler optimization technique that optimizes based on actual runtime behavior data of the application. Before compilation, the compiler runs the program to collect performance data, including the frequency of branch jumps, and then uses this data during the second compilation to optimize code layout and other aspects to improve execution efficiency.

[0042] However, such branch prediction has the following problems: the accuracy of hardware branch prediction is limited by the irregularity of branch instructions, resulting in performance loss. The method of arranging code blocks can only enhance the regularity and improve the prediction success rate, but cannot force the hardware to predict accurately; compiler branch prediction is limited by the mobility of code blocks and cannot provide effective hardware branch prediction guidance in all scenarios; handwritten assembly code or C language inline assembly code lacks compiler participation, cannot specify the probability of branches, and cannot provide branch prediction information to the hardware.

[0043] In view of the above-mentioned problems in related technologies, this application provides an instruction compilation and branch prediction method. By combining a first branch prediction result obtained by the compiler from branch prediction of the target branch statement and a second branch prediction result obtained by the processor from branch prediction of the target branch statement, for example, by adding the compiler's first branch prediction result to the compiled branch instruction, the method can provide the hardware with compiler branch prediction information even when code blocks cannot be moved. It should be noted that the steps shown in the flowcharts can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0044] The method embodiment provided in Embodiment 1 of this application can be executed in a RISC-V system, RISC-V chip, or similar device. The method embodiment provided in Embodiment 1 of this application can also be executed in systems, chips, or similar devices with other architectures, such as Advanced Reduced Instruction Set Machines (ARM) architecture, x86 architecture, etc. Figure 1 A hardware block diagram of a RISC-V system for implementing a branch prediction method is shown. Figure 1 As shown, the RISC-V system can be divided into the following layers from bottom to top: Reduced Instruction Set Architecture 101 (including the basic instruction set 101-1 and extended instruction set 101-2), hardware layer 102 (including processor 102-1, peripheral hardware circuits 102-2, etc.), interface layer 103, operating system layer 104 (supporting multiple operating systems 104-1, 104-2, ..., 104-n, such as Linux, FreeSBD, RT-Tread, etc.), middleware and library layer 105 (including system library 105-1, API 105-2 and middleware services 105-3), and application layer 106 (including multiple user programs and services 106-1, 106-2, ..., 106-n). The RISC-V system also includes a toolchain 107 that runs from the underlying hardware to the application layer. This toolchain may include compilers and assemblers 107-1, linkers 107-2, debuggers 107-3, simulators and emulators 107-4, integrated development environments 107-5, hardware description language tools 107-6, performance analysis tools 107-7, and version control systems 107-8, etc.

[0045] The instruction set architecture 101 defines the basic operations and instruction sets supported by the processor 102-1, including the basic instruction set and the extended instruction set. The basic instruction set represents the basic integer instruction set, such as RV32I and RV64I, while the extended instruction set can be floating-point, atomic operations, compressed instructions, etc.

[0046] Interface layer 103 includes the specific design of the processor, such as pipeline design, cache structure, execution units, branch prediction, etc. This layer is the process of mapping abstract instructions to physical hardware.

[0047] The operating system layer 104 sits above the hardware, providing a hardware abstraction layer and management mechanisms, enabling applications to interact with the hardware through system calls. The operating system is responsible for managing processor resources, memory, device drivers, task scheduling, and more.

[0048] The middleware and library layer 105 provides a rich set of services and interfaces to help applications run more efficiently. For example, the standard library provides functions such as file operations and mathematical calculations, while middleware can provide complex services such as network communication and graphical user interfaces.

[0049] The application layer 106 utilizes the functions and services provided by the lower layer to implement specific application logic. These applications can be command-line tools, graphical interface applications, server-side services, etc.

[0050] Toolchain 107 is a key component connecting the underlying hardware to the upper-level software. The various tools in toolchain 107 play a role at different levels to support the entire process from hardware design to software development, ensuring the coherence and effectiveness of the entire system design.

[0051] It should be noted that the layered design of the RISC-V architecture allows for decoupling between different layers, enabling each layer to be developed and optimized independently.

[0052] In one alternative embodiment, Figure 2 The above demonstrates the use of Figure 1 The diagram shows a System-on-Chip (SOC) based on the RISC-V architecture. Figure 2 As shown, the SOC contains at least one RISC-V core 202 (only one is shown in the figure). The RISC-V core 202 is connected to peripheral devices via bus 204, including but not limited to ROM 206, RAM 208, timer 210, UART (Universal Asynchronous Receiver / Transmitter) 212, GPIO (General Purpose Input / Output) 214, SPI (Serial Peripheral Interface Bus) 216, etc.

[0053] Under the aforementioned operating environment, this application provides the following: Figure 3 The instructions shown are compiled using this method. Figure 3 This is a flowchart of an instruction compilation method according to an embodiment of this application. For example... Figure 3 As shown, the method includes the following steps:

[0054] S302, obtain the first branch prediction result obtained by the compiler from the branch prediction of the target branch statement.

[0055] As an optional embodiment, the execution entity of this method can be a compiler. This compiler can be of various types. It can be used to convert source code in different programming languages ​​into an executable program. During the conversion process, the compiler can predict branches in the source code, or accept branch prediction results from externally specified branch statements in the source code.

[0056] As an optional implementation, the target branch statement can be a two-branch statement, meaning it can correspond to two different branch paths. When obtaining the first branch prediction result obtained by the compiler from the branch prediction of the target branch statement, the compiler can predict the execution direction of the target branch statement based on its understanding of the source code, using a series of rules and algorithms; alternatively, the programmer can explicitly inform the compiler of the expected execution path of the target branch statement using the `likely`, `unlikely` macros, or the `__builtin_expect` function in the source code. When the compiler predicts the execution direction of the target branch statement based on its understanding of the source code, PGO optimization techniques can be used. After completing the analysis and data integration of the target branch statement, the compiler can generate the first branch prediction result, which reflects the compiler's static prediction of the most likely execution path of the target branch statement. By obtaining the first branch prediction result obtained by the compiler from the branch prediction of the target branch statement, the execution direction of the target branch statement can be predicted at the source code level.

[0057] As an optional implementation, the first branch prediction result obtained by the compiler from branch prediction of the target branch statement can be obtained in various ways. For example, the target branch whose branch prediction probability is higher than a predetermined threshold can be obtained; the target branch is then determined as the first branch prediction result. The compiler performs branch prediction on the target branch statement, obtaining the branch prediction probability of one branch. Since the target branch statement is a two-branch statement, the branch prediction probability of the other branch can be obtained based on the branch prediction probability of one branch. For example, if the branch prediction probability of branch one is 90%, the branch prediction probability of branch two can be directly obtained as 10%. When the predetermined threshold is 85%, branch one can be considered the target branch. Based on this, a target branch with a branch prediction probability higher than the predetermined threshold can be obtained. The predetermined threshold can be determined in various ways and can be used to distinguish between branches with a clear bias and branches without a clear bias, representing a standard where the branch execution probability is sufficiently high. By identifying the target branch whose branch prediction probability is higher than a predetermined threshold as the first branch prediction result, only the prediction results with high branch prediction probability, i.e. branches with obvious bias, can be retained in the first branch prediction results, thereby making the first branch prediction results more probable and reliable.

[0058] S304, Generate indication information to indicate the first branch prediction result, wherein the processor obtains the target branch prediction result based on the indication information and the second branch prediction result, wherein the second branch prediction result is obtained by the processor performing branch prediction on the target branch statement.

[0059] As an optional implementation, the first branch prediction result is obtained by the compiler's branch prediction of the target branch statement, representing only the branch prediction result at the source code level. The second branch prediction result is obtained by the processor's branch prediction of the target branch statement, representing only the branch prediction result at the hardware level. By generating indication information to indicate the first branch prediction result and passing the indication information to the processor, the processor combines the indication information with the second branch prediction result obtained by the processor's branch prediction of the target branch statement to obtain the target branch prediction result. This allows for multi-dimensional branch prediction of the target branch statement by combining branch predictions at both the source code level and the hardware level. By fusing prediction information from different levels, the accuracy of branch prediction can be optimized, resulting in a more accurate final target branch prediction result.

[0060] As an optional implementation, the indication information used to indicate the prediction result of the first branch can be implemented in various ways. For example, the indication information can be implemented through instruction set extensions. For instance, a static prediction flag can be added to the instruction code, supporting both jump and non-jump modes. This can be represented by `static_taken` and `static_not_taken`. `static_taken` can indicate that the compiler predicts the target branch statement will likely jump (i.e., execute branch one), while `static_not_taken` can indicate that the compiler predicts the target branch statement will likely not jump (i.e., execute branch two). By adding a static prediction flag to the instruction code, the prediction result of the first branch can be passed based on this flag. Instruction set extensions can be implemented in systems with various architectures, such as RISC-V systems, RISC-V chips, or similar devices, or in systems, chips, or similar devices with other architectures, such as ARM architecture and x86 architecture.

[0061] S306, based on the instruction information, obtains the compiled target branch instructions.

[0062] As an optional implementation, after generating the indication information to indicate the prediction result of the first branch, the compiler can pass this indication information to the processor in various ways. For example, the compiled target branch instruction can be obtained based on the indication information. For instance, the target branch statement can be compiled to obtain the initial branch instruction; the indication information can be added to the initial branch instruction to obtain the target branch instruction. The initial branch instruction obtained by compiling the target branch statement can be directly passed to the processor for execution, but directly passing the initial branch instruction cannot pass the compiler's branch prediction result for the target branch statement to the processor. Therefore, adding the indication information to the initial branch instruction to obtain the target branch instruction allows the processor to execute it normally and also informs the processor of the compiler's branch prediction result for the target branch statement. By directly adding the indication information at the instruction level, the compiler can provide the processor with precise branch prediction guidance, enabling the processor to immediately use the indication information to make prediction adjustments when executing the target branch instruction, thereby avoiding unnecessary misprediction, reducing the number of processor pipeline pauses caused by misprediction, and thus improving the program's running speed and overall performance.

[0063] By obtaining the first branch prediction result obtained by the compiler in predicting the target branch statement; generating indication information to indicate the first branch prediction result, wherein the processor obtains the target branch prediction result based on the indication information and the second branch prediction result, the second branch prediction result is obtained by the processor in predicting the target branch statement; and obtaining the compiled target branch instruction based on the indication information, the processor can combine the first branch prediction result obtained by the compiler in predicting the target branch statement and the second branch prediction result obtained by the processor in predicting the target branch statement, and determine the final target branch prediction result by combining the two branch prediction results, thereby effectively improving the accuracy of the final branch prediction result, and thus solving the technical problem in related technologies that processing branches based solely on the processor's branch prediction result is not accurate enough.

[0064] Under the aforementioned operating environment, this application also provides, for example: Figure 4 The branch prediction method shown. Figure 4 This is a flowchart of a branch prediction method according to an embodiment of this application. Figure 4 As shown, the method includes the following steps:

[0065] S402, Obtain instruction information, wherein the instruction information is used to instruct the compiler to perform branch prediction on the target branch statement to obtain the first branch prediction result.

[0066] As an optional embodiment, the execution entity of this embodiment's method can be a processor. This processor can be of various types used for branch prediction. The processor can be used to execute a program, and during program execution, the processor can perform branch prediction on the target branch statement in the program.

[0067] As an optional embodiment, the target branch statement can be a two-branch statement, meaning it can correspond to two different branch paths. Various methods can be used to obtain the instruction information. For example, the target branch instruction directly containing the instruction information can be obtained, and the processor can read this instruction information when executing the target branch instruction with the instruction information. This instruction information can be used to instruct the compiler to perform branch prediction on the target branch statement, obtaining the first branch prediction result. By obtaining the instruction information, the processor can explicitly obtain the first branch prediction result obtained by the compiler from performing branch prediction on the target branch statement.

[0068] As an optional implementation, the instruction information can be implemented in various ways when it is acquired. For example, it can be implemented through instruction set extensions. For instance, a static prediction flag can be added to the instruction code, supporting both jump and non-jump modes. This can be represented by `static_taken` and `static_not_taken`. `static_taken` indicates that the compiler predicts the target branch statement will likely jump (i.e., execute branch one), while `static_not_taken` indicates that the compiler predicts the target branch statement will likely not jump (i.e., execute branch two). By adding a static prediction flag to the instruction code, the prediction result of the first branch can be passed based on this flag. Instruction set extensions can be implemented in systems with various architectures, such as RISC-V systems, RISC-V chips, or similar devices, or in systems, chips, or similar devices with other architectures, such as ARM architecture and x86 architecture.

[0069] S404, perform branch prediction on the target branch statement to obtain the second branch prediction result.

[0070] As an optional embodiment, the processor can employ various methods when predicting the branch of the target branch statement to obtain the second branch prediction result. For example, the processor can predict the branch of the target branch statement based on its historical execution history, particularly its branch path records. Through historical execution data, the processor can identify frequently occurring branch paths, thereby obtaining the second branch prediction result. Alternatively, the processor can predict the branch of the target branch statement based on the historical execution history of the entire program, not just the target branch statement. Through the historical execution history of the entire program, the processor can capture broader patterns of program control flow, obtaining the second branch prediction result from a global perspective. When predicting the branch of the target branch statement, the processor can use heuristic algorithms or combine them with machine learning techniques, training complex neural network models to predict the branch execution result. Using heuristic algorithms or neural network models, the processor can more accurately predict the branch path of the target branch statement based on its historical execution history or the historical execution history of the entire program, thereby improving the accuracy of the second branch prediction result.

[0071] S406, Based on the indication information and the second branch prediction results, the target branch prediction results are obtained.

[0072] As an optional embodiment, various methods can be used to obtain the target branch prediction result based on the indication information and the second branch prediction result. For example, a first probability corresponding to the first branch prediction result and a second probability corresponding to the second branch prediction result can be obtained; the target branch prediction result is obtained based on the first probability and the second probability. For example, if the compiler obtains a first branch prediction result that is branch one of the target branch statement, with a first probability of 95%, and the processor obtains a second branch prediction result that is branch one of the target branch statement, with a second probability of 85%, the target branch prediction result is obtained as branch one of the target branch statement based on the first probability and the second probability. As another example, if the compiler obtains a first branch prediction result that is branch one of the target branch statement, with a first probability of 95%, and the processor obtains a second branch prediction result that is branch two of the target branch statement, with a second probability of 55%, the target branch prediction result is obtained as branch one of the target branch statement based on the first probability and the second probability. By combining the indication information and the second branch prediction result, along with their corresponding first and second probabilities, the prediction result with the higher probability can be determined as the target branch prediction result. Compared to the single first-branch prediction result and the second-branch prediction result, the target branch prediction result has a higher probability of occurrence, meaning that the target branch prediction result is more accurate.

[0073] As an optional implementation, various methods can be used to obtain the target branch prediction result based on the first probability and the second probability. For example, the first probability and the second probability can be directly compared, and the branch prediction result corresponding to the higher probability can be determined as the target branch prediction result. For example, if the first probability is 95% and the second probability is 85%, the branch prediction result corresponding to the first probability can be determined as the target branch prediction result based on the first probability and the second probability. Alternatively, certain weights or confidence thresholds can be set for the first probability and the second probability before determining the target branch prediction result. For example, the first weight corresponding to the first probability and the second weight corresponding to the second probability can be obtained; the target branch prediction result can be obtained based on the first probability and the first weight, as well as the second probability and the second weight. For example, if the first probability is 95% and the first weight is 0.7, the second probability is 85% and the second weight is 0.3, and the weights can be combined to obtain the weighted probabilities. The weighted first probability is 66.5%, and the weighted second probability is 25.5%. Based on the weighted first probability and the weighted second probability, the branch prediction result corresponding to the first probability can be determined as the target branch prediction result.

[0074] The first and second weights can be determined in various ways. For example, they can be determined based on the reliability of the first and second branch prediction results, with higher weights assigned to more reliable branch predictions. Reliability can be represented by confidence levels. Therefore, by obtaining the first weight corresponding to the first probability and the second weight corresponding to the second probability, the accuracy and reliability of the compiler's branch prediction and the processor's branch prediction can be characterized. By assigning different weights to different prediction sources, the processor can determine the execution path of a branch based on both the compiler's and its own branch predictions, considering both the source code and hardware levels, effectively improving prediction accuracy. The processor can dynamically adjust the first and second weights to adapt to different execution environments and program characteristics, thereby reducing branch prediction errors, avoiding pipeline stalls, shortening program execution time, increasing processor throughput, and ultimately improving overall system performance.

[0075] By acquiring instruction information, which instructs the compiler to perform branch prediction on the target branch statement to obtain a first branch prediction result; performing branch prediction on the target branch statement to obtain a second branch prediction result; and based on the instruction information and the second branch prediction result, obtaining the target branch prediction result, the first branch prediction result obtained by the compiler and the second branch prediction result obtained by the processor can be combined to effectively improve the accuracy of the final branch prediction result. This solves the technical problem in related technologies where processing branches based solely on the processor's branch prediction result is not accurate enough.

[0076] In conjunction with the above embodiments and optional embodiments, an optional implementation method is provided. In this optional implementation method, a compiler-guided hardware branch prediction method based on instruction flags (flags) is proposed. Figure 5 This is a schematic diagram of hardware branch prediction based on instruction flags, guided by an instruction flag, according to an optional embodiment of the present invention. Figure 5 As shown, the method includes the following processing.

[0077] S1 adds an extra flag to the RISC-V branch instructions to form a new branch instruction.

[0078] It's important to note that the flag can use two different directives to indicate different compiler branch predictions: `static_taken` and `static_not_taken`. `static_taken` indicates that this branch is likely to be jumped to, while `static_not_taken` indicates that this branch is unlikely to be jumped to.

[0079] A new branch instruction that adds an extra flag can guide the hardware to perform branch prediction based on different compiler branch prediction results. RISC-V branch instructions and new branch instructions that add an extra flag are represented in assembly code as follows: Figure 6 As shown, Figure 6 This is a schematic diagram of assembly code according to an optional embodiment of the present invention.

[0080] S2 uses the compiler's branch prediction mechanism to determine additional flags.

[0081] For the LLVM compiler, various compiler branch prediction mechanisms can be employed, such as Branch Probability Information (BPI) or Branch Frequency Information (BFI). Both BPI and BFI are important tools used by the compiler to analyze and predict the likelihood of conditional branch execution. BPI focuses on the possible execution direction of a branch, attempting to predict whether a branch will jump (True branch) or continue executing the next instruction (False branch). BFI, on the other hand, focuses on statistically analyzing the execution frequency of each branch, i.e., how many times the branch was jumped to during code execution, and how many times it directly executed subsequent instructions.

[0082] The LLVM compiler can receive direct hints from the source code. For example, through the `likely` and `unlikely` macros, or the `_builtin_expect` function, the compiler can obtain information about whether a branch will more frequently execute the True or False path. Alternatively, hints can be obtained through PGO, which collects real-world data on branch behavior and then uses this data to adjust the compiler's decisions, including branch layout.

[0083] After obtaining the compiler's branch prediction results, additional flags can be determined based on the results. For example, if the probability of a branch jumping to a True branch is greater than a threshold (e.g., 95%) or less than a threshold (e.g., 5%), meaning the compiler predicts that this branch is very likely to be executed or very unlikely to be executed, additional flags can be determined for the branch instruction, using the static_taken or static_not_taken flags to mark the branch instruction.

[0084] S3 replaces the original instructions with branch instructions that have a flag, guiding the hardware to make more accurate branch predictions.

[0085] By replacing the original instructions with branch instructions that include a flag, the static analysis results of the compiler can be directly embedded into the branch instructions, thus providing a more direct and reliable guide for hardware branch prediction.

[0086] Furthermore, when the hardware encounters branch instructions marked with `static_taken` or `static_not_taken`, it can use this information as an initial prediction basis. If the actual execution result matches the prediction, the confidence level of the hardware branch predictor increases; otherwise, it decreases, and the prediction strategy is gradually adjusted based on the number of incorrect predictions. This means that the hardware branch predictor not only uses the information from these flagged branch instructions the first time it encounters them, but also uses newly acquired data in subsequent executions to refine and update its prediction algorithm, striving to improve long-term prediction accuracy.

[0087] By incorporating a flag into branch instructions to guide hardware branch prediction, the branch path can be freely guided regardless of the actual code block location. This means it is not limited by compiler optimizations, and even with a fixed code block location, hardware branch prediction can be guided by the compiler's branch prediction. For assembly languages ​​that do not require compiler processing, adding a flag can also guide hardware branch prediction. By using a flag to guide the hardware, the accuracy of branch prediction is improved, unnecessary branch error recovery is reduced, and thus program execution speed is increased.

[0088] According to an embodiment of the present invention, an instruction compilation apparatus is provided. Figure 7 This is a structural block diagram of an instruction compilation device according to an embodiment of the present invention, such as... Figure 7 As shown, the device includes: a first acquisition module 702, a generation module 704, and a compilation module 706. The device will be described below.

[0089] The first acquisition module 702 is used to acquire the first branch prediction result obtained by the compiler from the branch prediction of the target branch statement; the generation module 704 is connected to the first acquisition module 702 and is used to generate indication information for indicating the first branch prediction result, wherein the processor obtains the target branch prediction result based on the indication information and the second branch prediction result, the second branch prediction result being obtained by the processor from the branch prediction of the target branch statement; the compilation module 706 is connected to the generation module 704 and is used to obtain the compiled target branch instruction based on the indication information.

[0090] It should be noted that the first acquisition module 702, generation module 704 and compilation module 706 mentioned above correspond to steps S302 to S306 in the embodiments. The multiple modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiments.

[0091] As an optional embodiment, the compilation module 706 includes a compilation unit and an append unit. The compilation unit compiles the target branch statement to obtain an initial branch instruction; the append unit, connected to the compilation unit, appends instruction information to the initial branch instruction to obtain the target branch instruction.

[0092] As an optional embodiment, the first acquisition module 702 includes a first acquisition unit and a first determination unit. The first acquisition unit is used to acquire the target branch whose branch prediction probability obtained by the compiler for the target branch statement is higher than a predetermined threshold. The first determination unit is connected to the first acquisition unit and is used to determine the target branch as the first branch prediction result.

[0093] As an optional embodiment, the above indication information is a single-bit indicator.

[0094] According to an embodiment of the present invention, a branch prediction device is provided. Figure 8 This is a structural block diagram of a branch prediction device according to an embodiment of the present invention, such as... Figure 8 As shown, the device includes: a second acquisition module 802, a first prediction module 804, and a second prediction module 806. The device will be described below.

[0095] The second acquisition module 802 is used to acquire instruction information, wherein the instruction information is used to instruct the compiler to perform branch prediction on the target branch statement to obtain a first branch prediction result; the first prediction module 804 is connected to the second acquisition module 802 and is used to perform branch prediction on the target branch statement to obtain a second branch prediction result; the second prediction module 806 is connected to the first prediction module 804 and is used to obtain a target branch prediction result based on the instruction information and the second branch prediction result.

[0096] It should be noted here that the second acquisition module 802, the first prediction module 804 and the second prediction module 806 mentioned above correspond to steps S402 to S406 in the embodiments. The multiple modules and the corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in the above embodiments.

[0097] As an optional embodiment, the second prediction module 806 includes a second acquisition unit and a first prediction unit. The second acquisition unit is used to acquire a first probability corresponding to the first branch prediction result and a second probability corresponding to the second branch prediction result; the first prediction unit is connected to the second acquisition unit and is used to obtain a target branch prediction result based on the first and second probabilities.

[0098] As an optional embodiment, the first prediction unit includes an acquisition subunit and a prediction subunit. The acquisition subunit is used to acquire a first weight corresponding to a first probability and a second weight corresponding to a second probability. The prediction subunit, connected to the acquisition subunit, is used to obtain a target branch prediction result based on the first probability and the first weight, and the second probability and the second weight.

[0099] As an optional embodiment, the above indication information is a single-bit indicator.

[0100] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0101] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0102] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, they can also be implemented by hardware. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a processor to execute the methods described in the various embodiments of this application.

[0103] Embodiments of this application may provide a computing device. Figure 9This is a structural block diagram of a computing device according to an embodiment of this application. Figure 9 As shown, the computing device may include one or more (only one is shown in the figure) processors 902, memory 904 and peripheral interfaces 906, wherein the processors 902, memory 904 and peripheral interfaces 906 are interconnected via a bus 908.

[0104] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the methods in the above embodiments. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0105] The processor can invoke information and application programs stored in the memory through a transmission device to execute the methods in the various embodiments of this application.

[0106] When the aforementioned computing device is a compiler, the computing device can execute the following methods, including: obtaining a first branch prediction result obtained by the compiler performing branch prediction on the target branch statement; generating indication information for indicating the first branch prediction result, wherein the processor obtains a target branch prediction result based on the indication information and a second branch prediction result, the second branch prediction result being obtained by the processor performing branch prediction on the target branch statement; and obtaining the compiled target branch instruction based on the indication information.

[0107] Optionally, the aforementioned computing device may also execute program code that performs the following steps: compiling the target branch statement to obtain the initial branch instruction; adding instruction information to the initial branch instruction to obtain the target branch instruction.

[0108] Optionally, the aforementioned computing device may also execute program code that performs the following steps: obtains the target branch predicted by the compiler for the target branch statement, and the resulting target branch has a branch prediction probability higher than a predetermined threshold; and determines the target branch as the first branch prediction result.

[0109] Optionally, the above indication information is a single-bit indicator.

[0110] When the aforementioned computing device is a processor, the computing device can perform the following method, including: obtaining instruction information, wherein the instruction information is used to instruct the compiler to perform branch prediction on the target branch statement to obtain a first branch prediction result; performing branch prediction on the target branch statement to obtain a second branch prediction result; and obtaining a target branch prediction result based on the instruction information and the second branch prediction result.

[0111] Optionally, the computing device may also execute program code that performs the following steps: obtaining a first probability corresponding to the first branch prediction result and a second probability corresponding to the second branch prediction result; and obtaining the target branch prediction result based on the first probability and the second probability.

[0112] Optionally, the aforementioned computing device may also execute program code that performs the following steps: obtaining a first weight corresponding to a first probability and a second weight corresponding to a second probability; and obtaining a target branch prediction result based on the first probability and the first weight, as well as the second probability and the second weight.

[0113] Optionally, the above indication information is a single-bit indicator.

[0114] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0115] Embodiments of this application also provide a computer-readable storage medium. Optionally, in this embodiment, the computer-readable storage medium can be used to store program code executed by the method provided in the above embodiments.

[0116] Optionally, in this embodiment, the storage medium can be located in any one of the computing devices in the computing device group.

[0117] Optionally, in this embodiment, the computer-readable storage medium includes a stored executable program, wherein the methods of various embodiments of the present application are implemented when the executable program is executed by a processor.

[0118] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: obtaining a first branch prediction result obtained by the compiler performing branch prediction on the target branch statement; generating indication information for indicating the first branch prediction result, wherein the processor obtains the target branch prediction result based on the indication information and the second branch prediction result, the second branch prediction result being obtained by the processor performing branch prediction on the target branch statement; and obtaining the compiled target branch instruction based on the indication information.

[0119] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: compiling the target branch statement to obtain an initial branch instruction; adding instruction information to the initial branch instruction to obtain the target branch instruction.

[0120] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: obtaining the target branch obtained by the compiler from branch prediction of the target branch statement, wherein the branch prediction probability is higher than a predetermined threshold; and determining the target branch as the first branch prediction result.

[0121] Optionally, the above indication information is a single-bit indicator.

[0122] Optionally, in this embodiment, the computer-readable storage medium may also be configured to store program code for performing the following steps: obtaining instruction information, wherein the instruction information is used to instruct the compiler to perform branch prediction on the target branch statement to obtain a first branch prediction result; performing branch prediction on the target branch statement to obtain a second branch prediction result; and obtaining a target branch prediction result based on the instruction information and the second branch prediction result.

[0123] Optionally, in this embodiment, the computer-readable storage medium may also be configured to store program code for performing the following steps:

[0124] Optionally, in this embodiment, the computer-readable storage medium may also be configured to store program code for performing the following steps: obtaining a first probability corresponding to the first branch prediction result and a second probability corresponding to the second branch prediction result; and obtaining a target branch prediction result based on the first probability and the second probability.

[0125] Optionally, in this embodiment, the computer-readable storage medium may also be configured to store program code for performing the following steps: obtaining a first weight corresponding to a first probability and a second weight corresponding to a second probability; and obtaining a target branch prediction result based on the first probability and the first weight, and the second probability and the second weight.

[0126] Optionally, the above indication information is a single-bit indicator.

[0127] Embodiments of this application also provide a compiler, which includes: a parsing component and an instruction generation component, wherein the parsing component is used to receive source code to be compiled; and the instruction generation component communicates with the parsing component to generate target instructions from the source code according to the instruction compilation method of any one of the above.

[0128] Embodiments of this application also provide a computer program product. Optionally, in this embodiment, the computer program product may include a computer program that, when executed by a processor, implements the methods provided in the embodiments described above.

[0129] Embodiments of this application also provide a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, it implements the method provided in the above embodiments.

[0130] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0131] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0132] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0133] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0134] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0135] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for compiling instructions, characterized in that, include: Obtain the first branch prediction result obtained by the compiler from the branch prediction of the target branch statement; Generate indication information to indicate the first branch prediction result, wherein the processor obtains the target branch prediction result based on the indication information and the second branch prediction result, wherein the second branch prediction result is obtained by the processor performing branch prediction on the target branch statement; Based on the indicated information, the compiled target branch instructions are obtained.

2. The method according to claim 1, characterized in that, The step of obtaining the compiled target branch instruction based on the instruction information includes: The target branch statement is compiled to obtain the initial branch instruction; The instruction information is added to the initial branch instruction to obtain the target branch instruction.

3. The method according to claim 1, characterized in that, The step of obtaining the first branch prediction result obtained by the compiler from the branch prediction of the target branch statement includes: The compiler performs branch prediction on the target branch statement, and the resulting target branch has a branch prediction probability higher than a predetermined threshold. The target branch is determined to be the prediction result of the first branch.

4. The method according to any one of claims 1 to 3, characterized in that, The indication information is a single-bit indicator.

5. A branch prediction method, characterized in that, include: Obtain instruction information, wherein the instruction information is used to instruct the compiler to perform branch prediction on the target branch statement to obtain the first branch prediction result; Perform branch prediction on the target branch statement to obtain the second branch prediction result; Based on the indicated information and the second branch prediction result, the target branch prediction result is obtained.

6. The method according to claim 5, characterized in that, The step of obtaining the target branch prediction result based on the indication information and the second branch prediction result includes: Obtain the first probability corresponding to the prediction result of the first branch, and the second probability corresponding to the prediction result of the second branch; Based on the first probability and the second probability, the target branch prediction result is obtained.

7. The method according to claim 6, characterized in that, The step of obtaining the target branch prediction result based on the first probability and the second probability includes: Obtain the first weight corresponding to the first probability and the second weight corresponding to the second probability; Based on the first probability and the first weight, and the second probability and the second weight, the target branch prediction result is obtained.

8. The method according to any one of claims 5 to 7, characterized in that, The indication information is a single-bit indicator.

9. An instruction compilation apparatus, characterized in that, include: The first acquisition module is used to acquire the first branch prediction result obtained by the compiler from the branch prediction of the target branch statement; A generation module is used to generate indication information for indicating the first branch prediction result, wherein the processor obtains a target branch prediction result based on the indication information and the second branch prediction result, wherein the second branch prediction result is obtained by the processor performing branch prediction on the target branch statement; The compilation module is used to obtain the compiled target branch instructions based on the indicated information.

10. A branch prediction device, characterized in that, include: The second acquisition module is used to acquire instruction information, wherein the instruction information is used to instruct the compiler to perform branch prediction on the target branch statement to obtain the first branch prediction result; The first prediction module is used to perform branch prediction on the target branch statement to obtain the second branch prediction result; The second prediction module is used to obtain the target branch prediction result based on the indication information and the second branch prediction result.

11. A compiler, characterized in that, Includes: a parsing component and an instruction generation component, wherein, The parsing component is used to receive the source code to be compiled; The instruction generation component communicates with the parsing component and is used to generate target instructions from the source code according to the instruction compilation method according to any one of claims 1 to 4.

12. A computing device, characterized in that, include: Memory, which stores executable programs; A processor, connected to the memory via a bus, is used to run the program, wherein the program, when running, performs the method of any one of claims 1 to 8.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein the method according to any one of claims 1 to 8 is implemented when the executable program is executed by a processor.

14. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 8.