A compilation self-tuning method
Through the combination of the architecture-oriented performance monitoring interface library, customized environment parameter configuration mechanism, and compiled self-tuning feedback unit, the self-tuning process and architecture information are deeply integrated, and the problem of failure to fully utilize the performance dividend in the existing technology is solved, and efficient compiled self-tuning is achieved.
Patent Information
- Application Number
- CN202110330631.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-26
- Publication Date
- 2025-05-16
- Estimated Expiration
- 2041-03-26
AI Technical Summary
The existing compiled self-tuning framework has not fully integrated self-tuning process and architecture information in deep optimization, and cannot fully utilize the performance dividends of the processor and system software environment.
Using an architecture-oriented performance monitoring interface library, a file-based customized environment parameter configuration mechanism, and a customized compiled self-tuning feedback unit, it realizes highly customized and fully automatic tuning of the compilation option combination by deeply integrating the self-tuning process and architecture information.
It realizes highly customized and fully automatic tuning of the compilation option combination, fully utilizes the performance dividends of the processor and system software environment, and improves the efficiency of the compilation self-tuning process.
Smart Images

Figure CN114217805B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a compilation self-tuning method, belonging to the technical field of compilation optimization. Background Art
[0002] In the field of high-performance computing, people's demand for system performance is particularly urgent. However, the process of code tuning often requires a lot of manpower and resources: on the one hand, the increasing complexity of modern processor architecture has further increased the difficulty of tuning; on the other hand, although a large number of compilation optimizations have been designed to assist people in optimizing the code, how to combine these compilation optimizations is also one of the challenges faced by code tuning.
[0003] In order to fully utilize the performance advantages of computer systems, users often need to tune applications for target architectures. Mainstream compilers provide a variety of optimization technologies to optimize code compilation to achieve the goals of improving code performance, reducing target code performance, and reducing code execution power consumption. People can combine compilation optimizations with compiler self-tuning technology, and use automated iterative feedback to assist in code tuning, which can greatly improve code optimization efficiency and reduce the demand for manpower and material resources.
[0004] The existing compiler self-tuning framework adopts a general design concept, which can improve the portability of the framework itself and meet the needs of general code tuning. However, for performance-sensitive applications, in order to fully tap the performance potential of the computing system, the code must be deeply optimized in combination with the processor architecture. In terms of deep code optimization, the existing compiler self-tuning framework does not deeply integrate the self-tuning process with the architecture information, and cannot fully utilize the performance dividends brought by certain customized designs of the processor and system software environment. Summary of the invention
[0005] The purpose of the present invention is to provide a compilation self-tuning method to achieve highly customized fully automatic tuning of compilation option combinations, which can give full play to the performance benefits brought by certain customized designs of processors and system software environments and improve the efficiency of the compilation self-tuning process.
[0006] To achieve the above object, the technical solution adopted by the present invention is: to provide a compilation self-tuning method based on the following configuration:
[0007] Architecture-oriented performance monitoring interface library, used to collect runtime information of programs and guide the self-tuning process;
[0008] A file-based customized environment parameter configuration mechanism is used to customize the system software environment according to the configuration file;
[0009] Customized compiled self-tuning feedback unit, used to optimize the self-tuning feedback process based on architecture information;
[0010] The following steps are involved:
[0011] S1. The user manually inserts the code according to the needs or uses the compiler to automatically insert the code;
[0012] S2. Use the architecture-oriented performance monitoring interface library to collect information data when the code is running;
[0013] S3. According to the memory access intensity and computation intensity, the target codes are divided into the following four categories: access intensive, computation intensive, both access and computation intensive, and neither access and computation intensive;
[0014] S4, passing the classification information of the target code in S3 to S11, for customizing and optimizing the compilation self-tuning feedback process;
[0015] S5. A file-based customized environment parameter configuration mechanism, which configures system environment parameters including operating system version, compiler version, basic library version, processor and hardware accelerator version by modifying configuration files;
[0016] S6. Customized environment parameter configuration mechanism based on files. By modifying the configuration file, general compilation optimization options are configured and the probability of enabling self-tuning is set to 10%.
[0017] S7, file-based customized environment parameter configuration mechanism, configures the architecture-oriented customized compilation optimization options by modifying the configuration file, and sets the self-tuning enable probability to 20%;
[0018] S8, analyzing the general compilation optimization options and the architecture-oriented customized compilation optimization options, and classifying the compilation optimization options according to the four types described in S3;
[0019] S9. Customized environment parameter configuration mechanism based on files. According to the compilation commands, running commands and tuning requirements of actual applications, the environment parameters of the self-tuning process are configured by modifying the configuration files.
[0020] S10, passing the configuration information of the environment parameters in S9 to S11, for customizing and optimizing the compilation self-tuning feedback process;
[0021] S11, a file-based customized environment parameter configuration mechanism, adjusts the enabling probability of general compilation optimization options and customized compilation optimization options according to the classification information of the target code determined in S3, and increases the enabling probability of compilation optimization options with the same code optimization type by 5% by modifying the configuration file;
[0022] S12, the customized compilation self-tuning feedback unit automatically tunes the compilation options according to the compilation option enablement probabilities determined in S6 and S7 and the dynamically adjusted enablement probabilities determined in S11, and evaluates the performance acceleration of the enabled compilation option combination through iterative feedback;
[0023] S13. Obtain a set of compilation optimization option combinations, so that the combination can further improve the running performance of the program based on the baseline compilation options.
[0024] The further improved scheme in the above technical scheme is as follows:
[0025] 1. In the above scheme, the environment parameters described in S9 include compilation options, linking options, running parameters, and the number of tuning iterations.
[0026] Due to the application of the above technical solution, the present invention has the following advantages compared with the prior art:
[0027] The present invention proposes a compilation self-tuning method, which can sense and utilize the software environment of the target computer system, deeply integrate the self-tuning process with the architecture information, and realize highly customized fully automatic tuning of the compilation option combination. It can give full play to the performance dividends brought by certain customized designs of the processor and system software environment, and improve the efficiency of the compilation self-tuning process. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Attached Figure 1 This is the principle block diagram of the compilation self-tuning method. DETAILED DESCRIPTION
[0029] Embodiment: The present invention provides a compilation self-tuning method, which describes a complex software and hardware environment based on a configuration file, automatically traverses compilation option combinations, and selects the optimal solution from the traversed combinations, specifically comprising the following steps:
[0030] S1. The user uses the compiler to automatically insert the main function in the code;
[0031] S2. Use the architecture-oriented performance monitoring interface library to collect information data when the code is running;
[0032] S3, identifying the target code type as computationally intensive according to the memory access intensity and computational intensity;
[0033] S4, passing the classification information of the target code in S3 to S11, for customizing and optimizing the compilation self-tuning feedback process;
[0034] S5. The user configures the system environment parameters including the operating system kernel version (Linux 3.10.0), compiler version (gcc 7.1.0), and processor (Intel Xeon Silver 4114) by modifying the configuration file according to the actual environment.
[0035] S6. Configure the general compilation optimization options by modifying the configuration file and set the self-tuning enable probability to 10%;
[0036] S7. Configure the architecture-oriented custom compilation optimization options by modifying the configuration file, and set the self-tuning enable probability to 20%;
[0037] S8. Analyze general compilation optimization options and architecture-oriented customized compilation optimization options, and mark computationally intensive compilation optimization options;
[0038] S9. The user configures the environment parameters of the self-tuning process according to the actual application situation, setting the compilation option to "-O2 -funroll-loops", the link option to "-lm", and the number of tuning iterations to "30";
[0039] S10, passing the configuration information of the environment parameters in S9 to S11, for customizing and optimizing the compilation self-tuning feedback process;
[0040] S11. According to the classification information of the target code determined in S3, the enabling probability of the general compilation optimization options and the customized compilation optimization options is adjusted. By modifying the configuration file, the enabling probability of the compilation optimization options with the same code optimization type is increased by 5% to 15%.
[0041] S12: Automatically tune the compilation options according to the compilation option enablement probabilities determined in S6 and S7 and the dynamically adjusted enablement probabilities determined in S11, and evaluate the performance acceleration of the enabled compilation option combination through iterative feedback.
[0042] S13. The result of the automatic compilation tuning method is a set of compilation optimization option combinations, which enables the combination to further improve the running performance of the program based on the baseline compilation options.
[0043] Users update configuration files to describe system environment parameters, optimize environment parameters, etc. according to actual application requirements, and complete automatic updates of configuration files through scripts;
[0044] The adjustment of the enable probability of the compilation optimization option is completed in a static manner, which will limit the efficiency of tuning. The "dynamic adjustment + static adjustment" method is used to further optimize the adjustment strategy of the enable probability.
[0045] The further explanation of the above embodiment is as follows:
[0046] The present invention senses the target processor architecture information through interaction with the system software interface, performs iterative feedback evaluation on code deep optimization, and utilizes architecture-based deep compilation optimization technology to further improve the efficiency of compilation self-tuning and code optimization process.
[0047] The integration of compilation self-tuning and software ecology is achieved mainly from two aspects:
[0048] The first is the runtime library of the performance analysis tool based on the hardware structure. By calling the customized performance analysis interface, it can obtain accurate runtime information and provide more accurate data support for iterative feedback of compilation and tuning.
[0049] The second is a file-based customized environment parameter configuration mechanism. By configuring compilation commands, general compilation optimization options, customized compilation optimization options, and the probability of enabling compilation optimization options, it is possible to use the existing optimizations in the system environment to accelerate the self-tuning process.
[0050] The technology of the present invention mainly includes: customized optimization of the compilation self-tuning process by the software ecosystem, fine-grained environment parameter configuration based on configuration files, customized configuration of the compilation option enabling probability, and dynamic adjustment of the compilation option enabling probability.
[0051] The present invention provides a compilation self-tuning method, the principle block diagram is as follows Figure 1 As shown, the work includes three parts: architecture-oriented performance monitoring interface library, file-based customized environment parameter configuration mechanism, and customized compilation self-tuning feedback process.
[0052] S1: The architecture-oriented performance monitoring interface library is mainly responsible for collecting the runtime information of the program and guiding the next self-tuning process, as follows:
[0053] 1. Users can manually insert stubs into the code according to their needs, or use the compiler to automatically insert stubs into the code;
[0054] 2. Use the performance monitoring interface to collect code runtime data;
[0055] 3. Classify the target code into four categories according to the memory access intensity (global memory access / number of instructions) and the computation intensity (number of instructions / number of execution cycles): a) memory access intensive, b) computation intensive, c) both memory access and computation intensive, and d) neither memory access nor computation intensive;
[0056] 4. Pass the classification information of the target code to S3 to customize and optimize the compilation self-tuning feedback process.
[0057] S2: The file-based customized environment parameter configuration mechanism refers to the use of configuration files to customize the system software environment, mainly including:
[0058] 1. Configure the system environment parameters, including the operating system version, compiler version, basic library version, processor and hardware accelerator version;
[0059] 2. Configure the general compilation optimization options and set the self-tuning enable probability to 10%;
[0060] 3. Configure the architecture-oriented custom compilation optimization options and set the self-tuning enable probability to 20%;
[0061] 4. Analyze the general compilation optimization options and the architecture-oriented customized compilation optimization options, and classify the compilation optimization options according to the four types described in item 3 of S1;
[0062] 4. Configure the environmental parameters of the self-tuning process;
[0063] 5. The environment parameter configuration information is passed to S3 to customize and optimize the compilation self-tuning feedback process.
[0064] S3: Customized compilation self-tuning feedback process refers to optimizing the self-tuning feedback process based on the architecture-related information of S1 and S2. The details are as follows:
[0065] 1. According to the code classification information determined by S1, the enabling probability of general compilation optimization options and customized compilation optimization options is dynamically adjusted. The enabling probability of compilation optimization options with the same code optimization type is increased by 5%;
[0066] 2. Automatically tune the compilation options according to the compilation option enablement probability determined by S2 and the dynamically adjusted enablement probability.
[0067] When using the above-mentioned compilation self-tuning method, it can sense and utilize the software environment of the target computer system, deeply integrate the self-tuning process with the architecture information, and realize highly customized fully automatic tuning of the compilation option combination. It can give full play to the performance dividends brought by certain customized designs of the processor and system software environment, and improve the efficiency of the compilation self-tuning process.
[0068] In order to facilitate a better understanding of the present invention, the terms used in this article are briefly explained below:
[0069] Compilation optimization: Eliminate the inefficiencies that may be introduced in high-level language translation through code transformation and other means, and improve the performance, power consumption, size and other indicators of the target program.
[0070] Compilation optimization pass: The process of scanning the source program or its equivalent intermediate language program from beginning to end and completing the specified optimization tasks.
[0071] Iterative feedback: refers to the activity of repeating the feedback process in order to approach the desired goal or result. Each repetition of the process is called an iteration, and the result of each iteration guides the process of the next iteration, which is called feedback.
[0072] User-friendliness: refers to the complexity of subjective operations when users operate the system. For example, the lower the subjective operation complexity, the easier the system is to use, which means that the system is more user-friendly.
[0073] Software ecosystem: A description of a computer system's software stack and collection of application software.
[0074] Compilation self-tuning process: The process of optimizing the target code by automatically combining compilation optimizations.
[0075] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A compilation self-tuning method, characterized in that: Based on the following configuration: Architecture-oriented performance monitoring interface library, used to collect runtime information of programs and guide the self-tuning process; A file-based customized environment parameter configuration mechanism is used to customize the system software environment according to the configuration file; Customized compiled self-tuning feedback unit, used to optimize the self-tuning feedback process based on architecture information; The following steps are involved: S1. The user manually inserts the code according to the needs or uses the compiler to automatically insert the code; S2. Use the architecture-oriented performance monitoring interface library to collect information data when the code is running; S3. According to the memory access intensity and computation intensity, the target codes are divided into the following four categories: access intensive, computation intensive, both access and computation intensive, and neither access and computation intensive; S4, passing the classification information of the target code in S3 to S11, for customizing and optimizing the compilation self-tuning feedback process; S5. A file-based customized environment parameter configuration mechanism, which configures system environment parameters including operating system version, compiler version, basic library version, processor and hardware accelerator version by modifying configuration files; S6. Customized environment parameter configuration mechanism based on files. By modifying the configuration file, general compilation optimization options are configured and the probability of enabling self-tuning is set to 10%. S7, file-based customized environment parameter configuration mechanism, configures the architecture-oriented customized compilation optimization options by modifying the configuration file, and sets the self-tuning enable probability to 20%; S8, analyzing the general compilation optimization options and the architecture-oriented customized compilation optimization options, and classifying the compilation optimization options according to the four types described in S3; S9. Customized environment parameter configuration mechanism based on files. According to the compilation commands, running commands and tuning requirements of actual applications, the environment parameters of the self-tuning process are configured by modifying the configuration files. S10, passing the configuration information of the environment parameters in S9 to S11, for customizing and optimizing the compilation self-tuning feedback process; S11, a file-based customized environment parameter configuration mechanism, adjusts the enabling probability of general compilation optimization options and customized compilation optimization options according to the classification information of the target code determined in S3, and increases the enabling probability of compilation optimization options with the same code optimization type by 5% by modifying the configuration file; S12, the customized compilation self-tuning feedback unit automatically tunes the compilation options according to the compilation option enablement probabilities determined in S6 and S7 and the dynamically adjusted enablement probabilities determined in S11, and evaluates the performance acceleration of the enabled compilation option combination through iterative feedback; S13. Obtain a set of compilation optimization option combinations, so that the combination can further improve the running performance of the program based on the baseline compilation options.
2. A compile self-tuning method according to claim 1, characterized in that: The environment parameters described in S9 include compilation options, linking options, operation parameters, and the number of tuning iterations.
Citation Information
Patent Citations
Compiling option tuning method and device, processor chip and server
CN112433706A
Multi-target-oriented fine-grained compilation self-tuning method
CN112527300A