Font Size: a A A

A Floating Point Program Precision Loss Detection Method Based On Dynamic Program Analysi

Posted on:2024-04-01Degree:MasterType:Thesis
Country:ChinaCandidate:Y G ZhangFull Text:PDF
GTID:2568307106483214Subject:Electronic information
Abstract/Summary:
Floating-point operations are widely used in modern computer systems,such as scientific computing,image processing,sound processing,and other fields.However,due to the limitations of floating-point representation and precision,floating-point operations may generate errors and lead to precision loss in floating-point programs.This precision loss problem not only affects the precision and reliability of the floating-point program itself,but also affects the upper-level software system that calls the floating-point program,thus affecting the reliability of the whole software system.Therefore,it is necessary to detect the precision loss in floating-point programs.The inherent storage form of floating-point data makes it impossible to fully represent all real numbers,and the rounding error and error accumulation in floating-point operations make it difficult to detect the precision loss in floating-point programs.In this paper,a dynamic analysis method is proposed to detect the precision loss of floating-point programs.The main research and contributions of this paper are as follows:A floating-point program precision loss detection method based on dynamic program analysis is proposed.The first step is to generate input data,combine the floating-point distribution characteristics with the execution frequency of floating-point program code segments,generate appropriately sized and uniformly distributed input data,detect and exclude specific precision operations in floating-point programs,generate abstract syntax trees by analyzing the organization of source code with the help of LLVM’s front-end Clang tool,locate floating-point data declarations and operations,and generate higher precision MPFR With the help of Dyninst staking framework,we run floating-point operations and higher precision MPFR operations at the same time,perform statement-level precision loss detection,record the precision loss change at each step of the floating-point program,generate a precision loss change graph,and locate the location of floating-point precision loss.A floating-point program input data generation method is proposed.According to the uneven distribution of floating-point numbers,all indices in the input domain of the floating-point program are traversed,and small-scale floating-point numbers are randomly generated for different indices to ensure the uniform distribution of floating-point numbers,and then the large-scale input data are generated by combining the execution frequency of the floating-point program code segment.The MPFR code segment with higher precision is automatically generated by floating-point data declaration and operation.After locating the floating-point data declaration and operation,the midfix expression is transformed into a suffix expression to solve the problem of operator priority of the midfix expression,and by traversing the suffix expression,the corresponding MPFR value declaration is generated if the traversal is a value,and the corresponding MPFR function operation is generated if the traversal is an operator,which requires attention to the data type matching problem.In this paper,by testing the commonly used functions in GSL library and some test cases in FPPench,the relative error of the method in this paper is improved by43% on average compared with the random input data generation method for detecting GSL functions,and the relative error is improved by 1.8 bits on average compared with the Herbgrind tool for testing on FPPench.
Keywords/Search Tags:Floating point program, Precision loss detection, MPFR, LLVM, Dyninst
Related items