Method and system for converting an input computer program into an output computer program - Patent Application 20070123333

The method addresses the challenge of ensuring global accuracy in computer programs by using composite functions derived from dependency graphs and formal verification to replace black-box mathematical functions, achieving precise output programs.

JP2024545362AActive Publication Date: 2024-12-05MITSUBISHI ELECTRIC R&D CENTRE EUROPE BV
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2024555617
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-02-25
Filing Date
2023-01-30
Publication Date
2024-12-05
Estimated Expiration
2043-01-30

AI Technical Summary

Technical Problem

Existing methods fail to guarantee that global errors due to floating point rounding and mathematical function approximations in computer programs are kept below a target upper limit, especially when using black-box implementations of mathematical functions, and formal verification is not possible.

Method used

A method that combines value range determination tools and synthesis tools using dependency graphs to convert an input computer program into an output program with a target global accuracy by replacing mathematical function calls with composite functions achieving specific internal precision, and optionally annotating and formally verifying the output program.

Benefits of technology

Ensures that the output computer program achieves a predetermined global accuracy by replacing mathematical function calls with composite functions that meet internal precision requirements, allowing formal verification of the global accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024545362000001_ABST
    Figure 2024545362000001_ABST
Patent Text Reader

Abstract

The present disclosure relates to a computer-implemented method of converting an input computer program into an output computer program having a target global precision, the method including receiving a target internal precision for each mathematical function contained in the input computer program, and analyzing the input computer program to determine a dependency graph describing dependencies between mathematical function calls. The mathematical functions are processed according to the dependency graph by: for each processed mathematical function, using a value range determination tool, generating a value range for the processed mathematical function based on each composite mathematical function obtained for the mathematical functions on which the processed mathematical function depends according to the dependency graph; and using a composition tool, generating a composite mathematical function having the target internal precision. The output computer program is generated by replacing each mathematical function call with a call to its corresponding composite mathematical function.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present disclosure relates to computer program development, and more particularly to a method and system for converting an input computer program that includes mathematical functions applied to floating-point variables into an output computer program that achieves a target global precision, where the target global precision corresponds to an upper bound on the global errors allowed in the output computer program, where these errors are related to approximations of the mathematical functions and / or floating-point rounding errors. [Background technology]

[0002] Numerical calculations are ubiquitous in various industrial areas that require them, such as signal processing or image processing, automatic control, etc. For example, such numerical calculations are widely used in computer programs of embedded systems for diverse applications such as automobile control or nuclear plant control.

[0003] However, such numerical calculations have inherent computational errors associated with the approximations made.

[0004] For example, computer programs running on embedded systems suffer from rounding errors due to the finite number of significant digits in computer arithmetic, especially floating-point arithmetic. Indeed, such computer programs do not use the actual numbers, but rather use the corresponding floating-point approximations, which introduce errors. While these errors may be negligible in some cases, they may accumulate during the execution of a computer program and become non-negligible, especially in the presence of nested loops.

[0005] Another source of computational errors is the approximations made when implementing mathematical functions. For example, the implementation of mathematical functions of physical systems relies on approximations due to floating-point arithmetic, but also on the mathematical model of the physical system being approximated itself. For example, trigonometric functions such as cosine and sine functions are approximated by polynomial functions, but these polynomials introduce errors into the numerical calculations. Also, if a physical system is modeled, for example, by differential equations, such differential equations can be solved by mathematical functions (e.g., Runge-Kutta methods), but the obtained solutions are only approximations of the actual solutions of the differential equations that model the physical system.

[0006] These two sources of error (i.e., floating-point rounding errors and mathematical function approximations) are particularly difficult to predict and debug. This is especially true when using mathematical function libraries, such as libm, in computer programs, because the actual implementations of the mathematical functions are typically black boxes and architecture-dependent.

[0007] However, it is important to be able to determine the global error inherent in a computer program (i.e., floating-point rounding errors and / or approximations of mathematical functions) and to be able to ensure that the global error of a computer program is maintained below a desired target upper bound.

[0008] Current solutions target the verification of the numerical accuracy of computer programs. These techniques are either empirical / probabilistic or based on formal verification methods. Tools from the former category give results for any computer program with mathematical function calls, while tools from the latter category cannot be used with black-box implementations of mathematical functions and cannot statically verify their accuracy.

[0009] Thus, with current solutions, in some cases it is possible to determine the global error (although it is not possible to formally prove it when black-box implementations of the mathematical functions are used), but it is not possible to guarantee that the global error due to floating-point rounding errors and / or approximations of the mathematical functions is kept below a target upper bound. Summary of the Invention [Problem to be solved by the invention]

[0010] The present disclosure aims to improve this situation, in particular by overcoming at least some of the limitations of the prior art mentioned above, by proposing a solution that makes it possible to obtain computer programs with a given target global accuracy (i.e. a global error below a given upper limit), even when black-box implementations of mathematical functions are used.

[0011] Furthermore, in at least some embodiments, the present disclosure aims to propose a solution that makes it possible to formally prove that a obtained computer program achieves a target global accuracy. [Means for solving the problem]

[0012] To this end, according to a first aspect, the present disclosure relates to a computer-implemented method of converting an input computer program into an output computer program having a target global precision, the input computer program comprising a mathematical function applied to floating-point variables, the target global precision corresponding to a bound on a global error due to approximation of the mathematical function and / or floating-point rounding errors. The method comprises: receiving a target internal precision for each mathematical function included in the input computer program, the target internal precision corresponding to a respective limit of internal error of the mathematical function required to achieve a target global precision; analyzing the input computer program to obtain a dependency graph describing dependencies between mathematical function calls; Including, The method comprises: Processing a mathematical function according to a dependency graph; Further comprising: The processing step includes, for each mathematical function to be processed, using a value range determination tool to generate a value range for each variable of the mathematical function to be processed based on any composite mathematical function obtained for the mathematical functions on which the mathematical function to be processed depends according to the dependency graph; generating a synthetic mathematical function having a target internal precision for the mathematical function to be processed based on a value range of each variable of the mathematical function to be processed using a synthesis tool; Including, The method further includes generating an output computer program by replacing, in the input computer program, each mathematical function call with a call of its corresponding composite mathematical function.

[0013] The proposed solution therefore relies on mathematical function composition to replace implementations of mathematical functions (which may be black boxes, have insufficient target internal precision, or are too complex to be formally verified) with synthetic implementations that achieve a target internal precision (a target precision local to the corresponding mathematical function) that together make it possible to achieve a target global precision set for the computer program.

[0014] A synthesis tool usually requires prior knowledge of the range of values ​​of variables used by the mathematical function to be synthesized. Such value ranges can be determined by using value range determination tools such as abstract interpretation tools or statistical tools. However, in the case of overlapped mathematical functions, i.e. mathematical functions that are called in another mathematical function, the value range of the calling mathematical function depends on the called mathematical function and may change when the synthesized function is used instead. Therefore, when determining the value range of the calling mathematical function, it has to be done by replacing the called mathematical function with a call of the corresponding synthesized implementation. Therefore, the proposed solution determines a dependency graph between calls of mathematical functions, and the mathematical functions are processed (synthesized) according to the order provided by the dependency graph. The called mathematical function is processed first to obtain its synthesized version that achieves the target internal precision of this mathematical function. The synthesized version of the called mathematical function is then used during the processing of the calling mathematical function, in particular during the determination of the value range of the variables of the calling mathematical function that are subsequently used by the synthesis tool.

[0015] Thus, by combining a value range determination tool (e.g., an abstract interpretation tool) with a synthesis tool according to a dependency graph that describes the dependencies between calls of mathematical functions, the present disclosure enables the transformation of an input computer program into an output computer program that achieves a target global precision, provided that achieving the target internal precision of the mathematical functions enables achieving the target global precision of the entire output computer program.

[0016] In particular embodiments, the conversion method may further comprise one or more of the following optional features, taken alone or in any technically possible combination:

[0017] In certain embodiments, the conversion method further includes annotating the output computer program based on the target global accuracy, and verifying the annotations of the output computer program by using a formal verification tool.

[0018] Thus, by annotating the output computer program with a target global accuracy, it is possible to formally verify that the target global accuracy is indeed achieved by the output computer program.

[0019] In certain embodiments, the output computer program is further annotated based on the range of values ​​of the mathematical functions and the target internal precision of the composite mathematical functions.

[0020] In particular embodiments, the formal verification tool is a deductive verification tool.

[0021] In particular embodiments, the deductive verification tool uses an automated theorem prover.

[0022] In particular embodiments, the deductive verification tool uses an automated theorem prover that has different proof burdens for approximations of mathematical functions and proof burdens for floating-point rounding errors.

[0023] In a particular embodiment, when the generated output computer program does not achieve the target global accuracy, the method comprises the steps of: updating the target internal accuracy by further constraining all or a portion of the target internal accuracy; iteratively processing the mathematical functions of the input computer program to generate an updated composite mathematical function based on an updated target internal precision; generating an output computer program based on the updated composite mathematical function; The method further includes repeating:

[0024] Thus, if the target internal precision is not sufficient to achieve the target global precision of the output computer program, it is possible to iteratively increase the constraint on all or part of the target internal precision (i.e., iteratively decrease the target upper bound on the internal error of all or part of the mathematical function) until the generated composite mathematical function provides an output computer program that actually achieves the set target global precision.

[0025] In a particular embodiment, for the same mathematical function having different call locations in the input computer program, different composite mathematical functions are composed.

[0026] In fact, the same mathematical function may be called at different locations in an input computer program without necessarily having the same target internal precision for all call locations. In such cases, it is possible to generate different composite mathematical functions with different respective target internal precisions for the same mathematical function, for example to reduce the computational complexity at the call locations that tolerate larger internal errors.

[0027] In certain embodiments, the value range determination tool is an abstract interpretation tool.

[0028] According to a second aspect, the present disclosure relates to a computer program product comprising instructions which, when executed by at least one processor, cause the at least one processor to perform a conversion method according to any one of the embodiments of the present disclosure.

[0029] According to a third aspect, the present disclosure relates to a computer-readable storage medium comprising instructions that, when executed by at least one processor, cause the at least one processor to perform a conversion method according to any one of the embodiments of the present disclosure.

[0030] According to a fourth aspect, the present disclosure relates to a system for converting an input computer program into an output computer program having a target global precision, the input computer program including a mathematical function applied to floating-point variables, the target global precision corresponding to a limit on global error due to approximation of the mathematical function and / or floating-point rounding errors, the system comprising at least one processor and at least one memory, the at least one processor being configured to perform a conversion method according to any one of the embodiments of the present disclosure.

[0031] The invention will be better understood on reading the following description, which is given by way of example and in no way limiting, and is made with reference to the figures.

[0032] In these figures, the same reference numbers indicate the same or similar elements throughout the figures. For clarity, elements illustrated are not to scale unless expressly specified otherwise.

[0033] Additionally, the order of steps depicted in the figures is provided for illustrative purposes only and is not intended to limit the disclosure, which may also be applicable when the same steps are performed in different orders. [Brief description of the drawings]

[0034] [Figure 1] FIG. 2 is a diagram illustrating the main steps of an exemplary embodiment of a method for converting an input computer program into an output computer program. [Diagram 2] FIG. 13 is a diagram illustrating an example of an input computer program. [Figure 3A] FIG. 3 illustrates an example of a possible dependency graph for the input computer program of FIG. 2. [Figure 3B] FIG. 3 illustrates an example of a possible dependency graph for the input computer program of FIG. 2. [Figure 4]2 is a schematic diagram of the execution of the successive steps of the method for conversion of an input computer program; [Diagram 5] FIG. 5 is a schematic diagram of a dependency graph of the input computer program considered in FIG. 4; [Figure 6] 5 is a schematic diagram of the execution of successive steps of the method for conversion of another input computer program; [Figure 7] FIG. 7 is a schematic diagram of a dependency graph of the input computer program considered in FIG. 6; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0035] FIG. 1 illustrates generally the main steps of a method 10 for converting an input computer program into an output computer program.

[0036] The transformation method 10 is executed by a computer system (not shown). In a preferred embodiment, the computer system comprises one or more processors (which may belong to the same computer or to different computers) and one or more memories (magnetic hard disks, optical disks, electronic memories or any computer readable storage medium) in which a computer program product is stored in the form of a set of program code instructions executed to perform all or part of the steps of the transformation method 10. Alternatively, or as a combination thereof, the computer system may comprise one or more programmable logic circuits (FPGA, PLD, etc.) and / or one or more dedicated integrated circuits (ASICs, etc.) adapted to perform all or part of the above steps of the transformation method 10. In other words, the computer system comprises a set of means configured by software (certain computer program products) and / or hardware (processors, FPGAs, PLDs, ASICs, etc.) to perform the steps of the transformation method 10.

[0037] In this disclosure, the goal of the conversion is to achieve a target global precision, which corresponds to an upper limit on the tolerable global error, which corresponds to a combination of errors due to all mathematical function approximations and all floating-point rounding errors performed by the output computer program.

[0038] The input computer program corresponds to a computer program in source code that may be written in any computer language, for example the C or C++ computer language or the Fortran computer language. The input computer program is intended to run on an embedded system to perform tasks related to, for example, signal or image processing, automatic control, etc. The input computer program contains assignments applied to floating-point variables, control structures (conditional branches, switches, loops, etc.), mathematical operations (addition, multiplication, etc.) and mathematical function calls (exp, log, sin, cos, etc.). By way of non-limiting example, the mathematical functions are functions contained in the library libm.

[0039] As mentioned above, the implementations of mathematical functions contained in the input computer program are usually black boxes, in the sense that their source code is not available: usually, their implementations are included as calls to mathematical functions in external libraries, such as the libm library.

[0040] As shown in Fig. 1, the conversion method 10 comprises a step S10 of receiving a target internal precision for each mathematical function used in the input computer program. The target internal precision of a mathematical function corresponds to an upper limit of the internal error corresponding to the errors due to all approximations (of the mathematical model) and all floating-point rounding errors made in the considered mathematical function. Thus, the target internal precision considers the errors local to the associated mathematical function, while the target global precision considers the global errors at the computer program level that depend, among other things, on the local errors of all called mathematical functions. In the present disclosure, the target internal precision obtained is such that, if the implementations of the mathematical functions allow the achievement of their respective target internal precisions, the target global precision is also achieved by the computer program (or at least is considered to be so).

[0041] How the target internal precision is actually determined is outside the scope of this disclosure, and it is assumed that the target internal precision is provided as an input to the conversion method 10. However, it should be noted that such a target internal precision can be obtained, for example, by using statistical tools such as Monte Carlo operations. Indeed, such techniques can be used to determine the impact of precision reduction of a given mathematical function of a computer program, and thus to evaluate the impact of the internal precision of said given mathematical function on the global precision of the computer program (see, for example, [Defour2020]).

[0042] It should be noted that in the present disclosure, it is possible to obtain a single target internal precision for each mathematical function, regardless of the number of different call positions of the same mathematical function, or to obtain several different target internal precisions for the same mathematical function, for example, one for each call position of this mathematical function or one for each different target internal precision obtained for the same mathematical function. In fact, when a given mathematical function (e.g., sin) has several call positions in a computer program, the contribution of the mathematical function to the global error may vary from call position to call position. As will be described later, the call of the mathematical function is replaced by a call of a composite mathematical function having a desired target internal precision, so that different composite mathematical functions can be generated for different call positions of the same mathematical function. Of course, it is also possible to generate a single composite mathematical function of a given mathematical function and achieve a target internal precision corresponding to the lowest value of the upper limit of the internal error that can achieve the target global precision.

[0043] 1, the conversion method 10 also includes a step S11 of analysing the input computer program to determine a dependency graph describing the dependencies between calls of mathematical functions. Essentially, during the analysis step S11, the computer system implementing the conversion method 10 analyses the input computer program to identify the mathematical functions called by the input computer program and their call locations, as well as to identify mathematical functions that are called to process the results of previous calls of mathematical functions (i.e. to identify dependencies between calls of mathematical functions).

[0044] Fig. 2 shows a schematic representation of the source code of a simple exemplary input computer program. In this example, the input computer program calls four different mathematical functions: log2 (logarithm base 2), pow (power), exp (exponential function) and log (logarithm). As can be seen from Fig. 2, the variables received by the mathematical function pow as input do not depend on the result of any other mathematical function, and the result of the mathematical function pow is not used by another mathematical function. The variables received by the mathematical function log as input do not depend on the result of any other mathematical function, and the result of the mathematical function log is not used by another mathematical function. The variables received by the mathematical function exp as input do not depend on the result of any other mathematical function, but the result of this mathematical function exp is used by the mathematical function log2, which is called inside the loop. The result of the mathematical function log2, which is called inside the loop, is not used by another mathematical function. On the other hand, the mathematical function log2 is also called outside the loop, and the variables received by this mathematical function as input do not depend on the result of another mathematical function, and the result of this mathematical function exp is not used by another mathematical function.

[0045] Figure 3A shows a schematic representation of a dependency graph where each invocation of the same mathematical function is associated with a respective target internal precision. Thus, the mathematical function log2, which is called twice in the input computer program of Figure 2, appears twice in the dependency graph. Each mathematical function that does not use the result of another mathematical function is the origin of a dependency path. In the example of Figure 3A, there are four such paths starting from the mathematical functions log2, pow, exp, and log.

[0046] FIG. 3B shows a schematic representation of a dependency graph when the same mathematical function is associated with a single target internal precision, regardless of the number of call sites in the input computer program. Thus, the mathematical function log2, which is called twice in the input computer program of FIG. 2, appears only once in the dependency graph. Since the mathematical function log2, which is called inside the loop, processes the result of the mathematical function exp, the call site of this mathematical function log2 is considered to be the call site that requires the lowest value of the upper limit of the internal error of this mathematical function, so that only this call site is considered in the dependency graph. In FIG. 3B, there are three paths starting from the mathematical functions pow, exp, and log.

[0047] It should be noted that step S10 can also be performed after performing step S11 to first create a list of the mathematical functions to be called and then obtain a target internal precision for each of those mathematical functions based on this list. For example, it is possible to obtain a target internal precision for each occurrence of each mathematical function in the dependency graph.

[0048] When the computer system obtains the target internal precision of the mathematical functions of the input computer program and the dependency graph, the computer system processes the mathematical functions according to the dependency graph, in particular, the mathematical functions on the same path are processed successively from the origin of the path, and a composite mathematical function of each mathematical function in the dependency graph is generated.

[0049] More specifically, for each processed mathematical function, the conversion method 10 includes the following steps S12 and S13. - S12 uses a value range determination tool to generate a value range for each variable of the mathematical function to be processed based on each composite mathematical function obtained for the mathematical functions on which the mathematical function to be processed depends according to the dependency graph. - S13 uses a synthesis tool to generate a synthetic mathematical function having a target internal precision of the mathematical function to be processed based on the value range of each variable of the mathematical function to be processed.

[0050] For example, considering the dependency graph in FIG. 3B, three paths are processed.

[0051] A path that has the mathematical function pow as its origin contains only the mathematical function pow. Therefore, the mathematical function pow is processed first, and a value range determination tool is used to generate value ranges for its input and output variables. Since the mathematical function pow does not depend on other mathematical functions, no other composite mathematical functions are used to generate the value range of the mathematical function pow. Then, a synthesis tool is used to generate a composite mathematical function pow with the required target internal precision. The same is true for paths that have the mathematical function log as their origin.

[0052] The path that has the mathematical function exp as an origin also includes the mathematical function log2. Thus, the mathematical function exp is processed first and a value range determination tool is used to generate value ranges for its input and output variables. Because the mathematical function exp does not depend on another mathematical function, no other composite mathematical functions are used to generate a value range for the mathematical function exp. A synthesis tool is then used to generate a composite mathematical function exp with the required target internal precision. Then, the mathematical function log2 is processed and a value range determination tool is used to generate value ranges for its input and output variables. Because the mathematical function log2 depends on the mathematical function exp, a composite implementation of the mathematical function exp is used by the value range determination tool to generate a value range for the mathematical function log2. Then, a synthesis tool is used to generate a composite mathematical function log2 with the required target internal precision.

[0053] Any value range determination tool known to those skilled in the art can be used to determine the value range, for example, a statistical tool such as a Monte Carlo calculation can be used to determine the value range of a mathematical function.

[0054] In a preferred embodiment, an abstract interpretation tool is used to determine the value ranges. Any abstract interpretation tool known to those skilled in the art can be used. For example, Fluctuat is an abstract interpretation tool developed at CEA (French Atomic Energy and Alternative Energies Commission) that is designed to analyze floating-point rounding errors in large C / C++ computer programs in a fully automated manner (see [Goubault2013]). Fldlib is another example of an abstract interpretation tool that can be used, developed by Vedrine et al. RAI (Runtime Abstract Interpretation, see [Ve'drine2021]) is another exemplary tool that combines abstract interpretation and runtime verification and can be used to determine the value ranges of variables of mathematical functions in a dependency graph.

[0055] Any synthesis tool known to those skilled in the art can be used to generate synthetic mathematical functions. For example, Sollya [Chevillard2010] is a synthesis tool that can be used to develop safe floating-point computer programs. Given a mathematical expression, Sollya attempts to provide both a polynomial approximation of this expression and an upper bound on the error committed when approximating this expression. Sollya then proposes a floating-point implementation of the polynomial approximation that keeps the error in a reasonable interval. In other words, Sollya provides an implementation of the mathematical function where the contribution of rounding errors does not destroy the quality of the polynomial approximation. The Metalibm ANR project is also working on developing tools to automate the generation of mathematical functions and digital filters that meet several criteria, such as target accuracy, memory, speed, architecture, etc. All Metalibm tools are capable of generating C functions that meet user criteria, and the target accuracy criteria are achieved by using the Sollya theory.

[0056] When all paths of the dependency graph have been processed, a composite mathematical function of each mathematical function (and possibly each call position of the same mathematical function) is obtained that achieves the target internal precision set for each mathematical function called in the input computer program. The conversion method 10 includes a step S14 of generating an output computer program by replacing each mathematical function call in the input computer program with a call to its corresponding composite mathematical function. Thus, in the output computer program, each mathematical function call has been replaced with a call to a composite mathematical function that has a known (white box) implementation and achieves the target internal precision. The output computer program will in principle achieve the target global precision set for this program if the target internal precisions jointly enable the achievement of the target global precision.

[0057] At this stage, the target global precision of the output computer program is not formally proven. However, if necessary, the conversion method 10 can further include automatically annotating the output computer program based on the target global precision and preferably on predefined value ranges of the input variables of the input computer program (e.g., received together with the target global precision). Based on such annotation, and with the implementation of the composite mathematical function now known, it is possible to formally prove the target global precision set for the output computer program using a formal verification tool during an optional formal verification step S15 of the conversion method 10.

[0058] In a preferred embodiment, the output computer program may be further annotated based on the value ranges of the mathematical functions and the target internal precision of the composite mathematical function to formally prove the target internal precision of the composite mathematical function of the output computer program.

[0059] Any formal verification tool known to those skilled in the art can be used for the formal verification of the output computer program. For example, formal verification of computer programs enriched with annotations (assertions) of numerical precision can be done using deductive verification tools that automatically release the proof burden to dedicated provers. For example, some Frama-C [Kirchner2015] plugins have included methods and rounding error analysis functions in their specification language. This was first used in the Caduceus plugin [Boldo2007] based on the Why platform, which is responsible for communicating with dedicated provers such as Gappa or the Coq proof assistant. Another non-limiting example of a deductive verification tool that can be used is the Jessie plugin [Ayad2010] based on the Why3 theory of floating-point numbers.

[0060] Examples of provers that deductive verification tools can use are automated theorem provers such as CoqInterval [Daumas2005] and Gappa [Daumas2010]. CoqInterval is a tool for the Coq Proof Assistant based on the Flocq Coq formalism of floating-point arithmetic and interval arithmetic (intervals with floating-point lower and upper bounds). Using interval arithmetic, the tool can automatically prove inequalities over real-valued expressions. Thus, the tool can be used to bound the approximation error of algebraic expressions that approximate mathematical functions or models. Gappa is a tool designed to verify the arithmetic properties of simple numerical programs. Gappa is particularly good at automatically proving bounds on the rounding error of algorithms under some assumptions. Also, from the Gappa script, a proof is obtained that can be automatically checked by the Coq Proof Assistant so that the bounds are formally verified. Additionally, synthesis tools such as the Sollya tool and the Metalibm tool may generate Gappa scripts that the Gappa tool can use to formally prove the target internal precision of synthetic mathematical functions generated by such synthesis tools.

[0061] Thus, the conversion method 10 can formally prove the target global precision of the output computer program and the target internal precision of the composite implementations of the mathematical functions, if necessary. If the target internal precisions of all the composite mathematical functions are proved, but the target global precision of the output computer program is not proved, this means that the target internal precision obtained during step S10 is not sufficient to achieve the target global precision. If it is essential to achieve the target global precision set for the output computer program, it is possible to repeat the steps of the conversion method 10 by stepwise further constraining all or part of the target internal precision set for the mathematical functions until an output computer program is generated that achieves the target global precision. In the present disclosure, "further constraining" the target internal precision means decreasing the target upper limit of the internal error of the corresponding mathematical function.

[0062] Figure 4 shows three mathematical functions f 1 , f 2 and f 3 1 shows a schematic representation of the execution of the successive steps of the transformation method 10 when considering an exemplary input computer program including: 1 , f 2 and f 3 The dependency graph of is shown in Figure 5, with the mathematical function f as the starting point. 1 followed by a mathematical function f 2 And then f 3 and a single path having

[0063] The conversion method takes as input the following: - input computer programs (source code), - a target global accuracy ε set for the output computer program, -mathematical function f 1 , f 2 and f 3 The target internal accuracy ε set for each 1 , ε2 and ε 3 .

[0064] As shown in FIG. 4, the conversion method 10 processes the mathematical function according to the dependency graph in FIG. 5, and converts the mathematical function f 1 An abstract interpretation tool (e.g., Fluctua) is used to interpret the mathematical function f 1 Value range of D 1 The synthesis tool generates a mathematical function f 1 , range of values ​​D 1 and the target internal precision ε 1 Using the composite mathematical function p 1 In this example, the synthesis tool generates a target internal precision ε 1 D 1 In p 1 Assured by the predicate C as a certificate 1 Also synthesized.

[0065] Next, the mathematical function f 2 is processed. An abstract interpretation tool is used to interpret the composite mathematical function p 1 By using the range of values ​​D 2 The synthesis tool generates a mathematical function f 2 , range of values ​​D 2 and the target internal precision ε 2 Using the composite mathematical function p 2 and Certificate C 2 Generate.

[0066] Next, the mathematical function f 3 is processed. An abstract interpretation tool is used to interpret the composite mathematical function p 2 and the composite mathematical function p 1 By using the range of values ​​D 3 The synthesis tool generates a mathematical function f 3 , range of values ​​D 3 and the target internal precision ε 3 Using the composite mathematical function p 3 and Certificate C 3 Generate.

[0067] As shown in FIG. 4, the conversion method 10 then converts the mathematical function f 1 , f 2 and f 3 Each call to 1 , p 2 and p 3 (composite mathematical function) to generate an output computer program.

[0068] As mentioned above, in some cases the output computer program may also be enriched with some annotations corresponding to, for example, the following assumptions, proof obligations or local assertions: global pre-conditions on the output computer program, which may be provided by the user, including value ranges for the inputs of the output computer program; a global post-condition on the output computer program corresponding to the satisfaction of a target global precision ε that must be satisfied by the entire output computer program; -Value range D at the call point of the composite mathematical function (respectively, the loop entry point) 1 , D 2 and D. 3 The corresponding assertions (respectively, loop invariants), -Value range D 1 , D 2 and D. 3 The target internal accuracy ε 1 , ε 2 and ε 3 The composite mathematical functions p 1 , p 2 and p 3 Postconditions.

[0069] All these annotations can then be used by, for example, a deductive validation tool, based on, for example, Why3 or Frama-C.

[0070] Optionally, the conversion method 10 then performs a formal verification of the automatically generated annotations, taking into account a formal proof of the target global precision as the final goal. In the example shown in FIG. 4, the conversion method 10 uses a deductive verification tool to offload the proof burden (annotation) to a dedicated automated theorem prover. For example, - the burden of proof regarding methodological (mathematical) errors can be released to tools such as Interval, a tool based on interval arithmetic that automatically checks for inequalities on real arithmetic expressions, or Sollya, which is based on Metalibm technology; -The burden of proof regarding rounding errors can be offloaded to a dedicated theorem prover, e.g. Gappa, which proves the target internal precision, -The proof burden for an abstract interpretation tool like Fluctua is already guaranteed since abstract interpretation is a formal method, and therefore it can be reused as a back-end prover. -The proof burden regarding statistical tools used to determine value ranges for mathematical functions can be offloaded to abstract interpretation tools or interactive theorem provers.

[0071] Figure 6 shows three mathematical functions f 1 , f 2 and f 3 1 shows a schematic representation of the execution of the successive steps of the conversion method 10 when considering another exemplary input computer program including: 1 , f 2 and f 3 The dependency graph for is shown in Figure 7 and contains the following two paths: - Mathematical function f as starting point 1 followed by a mathematical function f 2 a first pass having - the mathematical function f as the starting point (and as a single mathematical function) 3 The second pass has

[0072] These two passes are processed in parallel, as shown in Figure 6. Otherwise, the steps of the conversion method 10 remain unchanged.

[0073] Therefore, the present disclosure proposes a methodology for automatically generating, from an input computer program, an output computer program that achieves a target global accuracy with respect to approximations of mathematical functions and floating-point rounding errors. This is achieved by combining a value range determination tool (such as an abstract interpretation tool or a statistical tool) and a synthesis tool based on a dependency graph that describes the dependencies between calls of mathematical functions. If necessary, the target global accuracy of the output computer program can also be formally verified by annotating the output computer program and using, for example, a deductive (formal) verification tool.

[0074] The proposed transformation method 10 is fully automatic, provides comprehensive guarantees of numerical accuracy, and optimizes mathematical function implementations. The transformation method 10 reduces both development and verification time for software that relies on intensive use of floating-point numerical computations.

[0075] It should be emphasized that the present disclosure is not limited to the above exemplary embodiments, and variations of the above exemplary embodiments are also within the scope of the present disclosure.

[0076] (References) [Defour2020] Defour, D., de Oliveira Castro, P., Is,toan, M., & Petit, E. (2020, June), “Custom-precision mathematical library explorations for code profiling and optimization”, In 2020 IEEE 27th Symposium on Computer Arithmetic (ARITH) (pp. 121-124), IEEE. [Goubault2013] Goubault, E., Putot, S. (2013, June), “Static analysis by abstract interpretation of numerical programs and systems, and FLUCTUAT”, In International Static Analysis Symposium (pp. 1-3), Springer, Berlin, Heidelberg. [Ve'drine2021] Ve'drine, F., Jacquemin, M., Kosmatov, N., & Signoles, J. (2021), “Runtime Abstract Interpretation for Numerical Accuracy and Robustness”, In International Conference on Verification, Model Checking, and Abstract Interpretation (pp. 243-266), Springer, Cham. [Chevillard2010] Chevillard S., Joldes, M., & Lauter C. (2010, September), “Sollya: An environment for the development of numerical codes”, In International Congress on Mathematical Software (pp. 28-31), Springer, Berlin, Heidelberg. [Kirchner2015] Kirchner F., Kosmatov N., Prevosto V., Signoles J., & Yakobowski B. (2015), “Frama-C: A software analysis perspective”, Formal Aspects of Computing, 27(3), pp. 573-609. [Boldo2007] Boldo S., & Fillia^tre J. C. (2007, June), “Formal verification of floating-point programs”, In 18th IEEE Symposium on Computer Arithmetic (ARITH'07) (pp. 187-194), IEEE. [Ayad2010] Ayad A., & Marche' C. (2010, July), “Multi-prover verification of floating-point programs”, In International Joint Conference on Automated Reasoning (pp. 127-141), Springer, Berlin, Heidelberg. [Daumas2005] Daumas M., Melquiond G., & Munoz C. (2005, June), “Guaranteed proofs using interval arithmetic”, In 17th IEEE Symposium on Computer Arithmetic (ARITH'05) (pp. 188-195), IEEE. [Daumas2010] Daumas M., & Melquiond G. (2010), “Certification of bounds on expressions involving rounded operators”, ACM Transactions on Mathematical Software (TOMS), 37(1), pp. 1-20.

Claims

1. 1. A computer-implemented method of transforming an input computer program into an output computer program that achieves a target global precision, the input computer program including a mathematical function applied to floating-point variables, the target global precision corresponding to a bound on global error due to approximation of the mathematical function and / or floating-point rounding errors, the method comprising: receiving a target internal precision for each mathematical function included in the input computer program, the target internal precision corresponding to a respective limit of internal error of the mathematical function required to achieve the target global precision; analyzing the input computer program to determine a dependency graph describing dependencies between mathematical function calls; Including, The method comprises: processing the mathematical function according to the dependency graph; Further comprising: The processing step includes, for each mathematical function to be processed: generating, using a value range determination tool, a value range for each variable of the processed mathematical function based on each composite mathematical function obtained for a mathematical function on which the processed mathematical function depends according to the dependency graph; generating a synthetic mathematical function having a target internal precision for the processed mathematical function based on a value range for each variable of the processed mathematical function using a synthesis tool; Including, The computer-implemented method further comprises generating the output computer program by replacing, in the input computer program, each of the mathematical function calls with a corresponding call of a composite mathematical function.

2. The method of claim 1 , further comprising annotating the output computer program based on the target global accuracy and verifying the annotations of the output computer program by using a formal verification tool.

3. The method of claim 2 , wherein the output computer program is further annotated based on value ranges of the mathematical functions and a target internal precision of the composite mathematical function.

4. The method of claim 2 or 3, wherein the formal verification tool is a deductive verification tool.

5. The method of claim 4 , wherein the deductive verification tool uses an automated theorem prover.

6. The method of claim 5 , wherein the deductive verification tool uses an automated theorem prover with different proof burdens for approximations of mathematical functions and proof burdens for floating-point rounding errors.

7. When the generated output computer program does not achieve the target global accuracy, the method continues with the following steps until an output computer program that achieves the target global accuracy is generated: updating the target internal accuracy by further constraining all or a portion of the target internal accuracy; iterating processing of the mathematical functions of the input computer program to generate an updated composite mathematical function based on an updated target internal precision; generating the output computer program based on the updated composite mathematical function; The method of claim 2 or 3, further comprising repeating:

8. The method according to any one of claims 1 to 3, wherein for a same mathematical function having different call positions in the input computer program, different composite mathematical functions are composed.

9. The method according to any one of claims 1 to 3, wherein the value range determination tool is an abstract interpretation tool.

10. A computer program product comprising instructions which, when executed by at least one processor, cause said at least one processor to perform the method of any one of claims 1 to 3.

11. A computer readable storage medium comprising instructions which, when executed by at least one processor, cause the at least one processor to perform the method of any one of claims 1 to 3.

12. 4. A system for converting an input computer program into an output computer program having a target global precision, the input computer program comprising a mathematical function applied to floating-point variables, the target global precision corresponding to a limit on global error due to approximation of the mathematical function and / or floating-point rounding errors, the system comprising at least one processor and at least one memory, the at least one processor being configured to perform the method of any one of claims 1 to 3.

Citation Information

Patent Citations

  • Program conversion method, data processor using the same and program

    JP2004062830A

  • Compiling techniques for providing limited accuracy and enhanced performance granularity

    US20100125836A1

  • Acceleration of shader programs by compiler precision selection

    WO2020247073A1