Compilation optimization method for conditional transfer prediction direction transformation

A technology of prediction direction and optimization method, applied in the direction of code compilation, program code conversion, program control design, etc., can solve problems such as reducing program performance and affecting compiler instruction scheduling, so as to avoid program modification, reduce performance loss, and improve accuracy. rate effect

Inactive Publication Date: 2021-03-23
JIANGNAN INST OF COMPUTING TECH
View PDF2 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

The first is the inherent disadvantage of embedded assembly: it will cut the original complete program into two independent sections, which will affect the instruction scheduling of the compiler and reduce the performance of the program.
In addition, whether the location of the direction switching instruction inserted into the branch predictor is appropriate directly affects whether its function can be effectively played. Using embedded assembly requires the programmer to analyze the control flow behavior characteristics of the program in detail, and find out the location where the branch prediction often fails according to the actual running results. This is also a lot of work and challenges

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Compilation optimization method for conditional transfer prediction direction transformation
  • Compilation optimization method for conditional transfer prediction direction transformation
  • Compilation optimization method for conditional transfer prediction direction transformation

Examples

Experimental program
Comparison scheme
Effect test

Embodiment

[0022] Embodiment: A compiling optimization method for conditional branch prediction direction transformation, based on the following presets: by default, the prediction method of the branch predictor is that the backward branch instruction (the offset is a negative value) is always predicted as a jump , forward branch instructions are always predicted not to jump;

[0023] After the program is compiled and run, when the user finds that the actual running time of the program is quite different from the expected execution time, perform performance analysis through gdb debugging or performance counter information statistics, and when it is found that frequent branch prediction failures have brought serious performance When losing, perform the following steps:

[0024] S1. The compiler recompiles the source program, and adds a compilation optimization option for branch prediction direction transformation during compilation;

[0025] S2. The compiler performs control flow analysi...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a compilation optimization method for conditional transfer prediction direction transformation. When serious performance loss caused by frequent branch prediction failure is found, the following steps are executed: S1, recompiling a source program, and adding compilation optimization options for transfer prediction direction transformation during compilation; S2, performingcontrol flow analysis on the source program, dividing the source program into a plurality of basic blocks, identifying conditional branch statements contained in the innermost layer of circulation ofthe source program, dividing the conditional branch statements into a plurality of independent basic blocks, and marking the first basic block with a special attribute of branch prediction failure; S3, inserting a transfer predictor direction switching instruction into the initial position of the basic block with the branch prediction failure special attribute; S4, enabling the compiler to continue to perform the remaining compiling process to generate the target code. According to the method, the problems of performance loss and potential errors caused by an embedded assembly mode can be avoided, the condition transfer prediction accuracy can be improved, and the purpose of reducing the performance loss is achieved.

Description

technical field [0001] The invention relates to a compilation optimization method for conditional transfer prediction direction transformation, belonging to the technical field of computer compilation optimization. Background technique [0002] Pipeline technology is an optimization technology commonly used in current processors. For branch instructions, if there is no branch prediction, the processor needs to wait for the execution of the branch instruction to end before sending the next instruction to the first stage of the pipeline (instruction fetch stage), which will cause the pipeline to stall and seriously affect performance. There are many mechanisms for branch prediction, and the transfer prediction bit is one of the important means. When using the branch prediction bit for branch prediction, the implementation mechanism is as follows: if the branch prediction bit is "0", it is predicted that no jump will occur, and the next instruction immediately following the cu...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/41G06F9/30
CPCG06F8/41G06F9/30058
Inventor 管茂林钱宏吴伟朱琪武文浩陈惠阳祖斌赵美佳
Owner JIANGNAN INST OF COMPUTING TECH
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products