Font Size: a A A

Program Superoptimizer Guided By Neural Network

Posted on:2022-05-18Degree:MasterType:Thesis
Country:ChinaCandidate:H T FeiFull Text:PDF
GTID:2518306725483974Subject:Master of Engineering
Abstract/Summary:PDF Full Text Request
Program optimization is an important part of the compiler.It uses a series of conversion rules to transform the input program into the equivalent output program,which makes the output program executes faster or consumes less resources.The goal of superoptimization is to find the equivalent output program with the fastest execution speed and the least resource consumption for the input program.In a software system,the performance of the core code and core library play a decisive role in the performance of the entire system.Optimizing these codes can obtain greater performance benefits.In general,it is difficult for the compiler to achieve the effect of superoptimization,so in practice,experts are usually responsible for writing the superoptimization programs of the core code and core library.With the expansion of the number and scale of systems,manual optimization is more and more difficult to meet the requirements,so we need to apply superoptimizers to solve this problem.However,the existing superoptimizers has two shortcomings:first,the optimization speed is slow,the existing superoptimizers are usually based on exhaustive search or random search,which takes a long time;second,the ease of use is poor,users need to use the command line to call these superoptimizers,also need to manually write the relevant configuration files.Based on the above two shortcomings,we design the program superoptimizer guided by neural network,and the main work is as follows:1.Aiming at the problem of slow optimization speed:We train a neural network model that can be used for program superoptimization,and uses this model to optimize the input program without loop and pointer.The optimization program generated by the model is not necessarily equivalent to the input program,so the superoptimizer in this thesis uses the equivalence verification tool and the optimization method based on random search to further optimize the program generated by the model.The speed of model generation optimization program is very fast,it makes this superoptimizer reduce part or all of the search process,thus it speeds up the optimization speed.2.Aiming at the problem of poor ease of use:We add an interface to the superoptimizer,which is convenient for users to use.In addition,this superoptimizer improves the process of superoptimization,supports automatic generation of configuration files and test cases,and reduces the workload of users.The superoptimizer in this thesis is divided into five modules,which are encoding and decoding module,network training module,program preprocessing module,optimization execution module and statistical analysis module.The encoding and decoding module is responsible for the mutual conversion between the assembler and the matrix or vector.The network training module is responsible for learning optimization rules from training data and obtaining neural network models.The program preprocessing module is responsible for generating configuration files and test cases for the input program.The optimization execution module is responsible for using the neural network model to optimize the input program and generate an equivalent optimization program.The statistical analysis module is responsible for analyzing the optimization process of this superoptimizer and the optimization capability of the neural network model.Through the above work,we design and implement the program superoptimizer guided by neural network,and evaluate the superoptimizer through experiments.The experimental results show that compared with the existing well-known program superoptimizer,this superoptimizer improves the optimization speed by 22.1%while ensuring the quality of optimization results;After superoptimization,the execution speed of the equivalent output program is 10.7%faster than the input program.
Keywords/Search Tags:Superoptimization, Neural network, Assembler programs
PDF Full Text Request
Related items