Search

CN-121986334-A - Automatically identifying internal precision required by any function call according to global target precision of program on any program

CN121986334ACN 121986334 ACN121986334 ACN 121986334ACN-121986334-A

Abstract

The invention relates to a computer implemented method (10) for determining a required internal precision of at least one function in a computer program to achieve a target global precision (TGA), the computer implemented method comprising at least one iteration of reducing (S01) the precision of a reference implementation of the function to obtain a custom implementation, obtaining (S02) an error caused by the reduced precision (S01) between the custom implementation and the reference implementation, obtaining (S03) a plurality of acceptable combinations of custom implementations meeting the target global precision (TGA) based on the error, evaluating (S04) an execution efficiency of the acceptable combinations based on at least one resource consumption criterion, and providing the required internal precision of the function when the at least one resource consumption criterion is met.

Inventors

  • F. Faisol
  • B. Boyer

Assignees

  • 三菱电机株式会社

Dates

Publication Date
20260505
Application Date
20240521
Priority Date
20231011

Claims (14)

  1. 1. A computer implemented method (10) for determining at least one function implemented in a computer program ) To achieve a Target Global Accuracy (TGA) of the computer program, wherein the method comprises at least one iteration of the steps of: -reducing (S01) said at least one function [ ] ) Is realized by at least one reference of ) To obtain the accuracy of the at least one function [ ] ) The custom realization of% ), -Obtaining (S02) the custom implementation based on the common input value ) And the reference is realized ) Error caused by the reduction of precision (S01) ), -Based on said error ) Obtaining (S03) the custom implementation ) Which allows to meet the Target Global Accuracy (TGA) of the computer program, -Evaluating (S04) the execution efficiency of at least one of said acceptable combinations based on at least one resource consumption criterion, said evaluation of the execution efficiency giving said at least one function when said at least one resource consumption criterion is fulfilled ) Is provided for the required internal accuracy of (a).
  2. 2. The method (10) according to claim 1, further comprising a preliminary step (S00) for comparing the at least one reference implementation by using the common input value ) Reference output of ) And said at least one function ) Corresponding ideal output of ideal execution of (a) ) To determine the reference error (e, c).
  3. 3. The method (10) according to claim 1, wherein the accuracy reducing step (S01) comprises implementing ± for the at least one reference provided to ) Or by said at least one reference ) The provided value introduces random noise to obtain a self-defined output ) The custom implementation of )。
  4. 4. A method (10) according to claim 3, wherein the error determining step (S02) comprises outputting [ ] based on the customization ) And based on reference output ) Calculating errors And 。
  5. 5. The method (10) of claim 4, wherein said step (S03) further comprises comparing an error relative to said Target Global Accuracy (TGA) ) Wherein: When the combination of errors achieves the Target Global Accuracy (TGA), the corresponding combination of custom realizations is custom realizations ) Acceptable combinations of (3); -rejecting custom implementation when the combination of errors does not achieve the Target Global Accuracy (TGA) ) Corresponding combinations of (a) and (b).
  6. 6. The method (10) of claim 1, wherein the method (10) further comprises iterating until the Target Global Accuracy (TGA) is achieved by customization ) At least one combination of errors of at least one combination of: -obtaining (S01) custom implementation ) Is added to the combination of the (a) and (b), -Custom based implementation ) Determining (S02) an additional error [ (] with respect to the additional combination of ), -Adding said additional error to [ ] ) Is compared to the Target Global Accuracy (TGA) (S03).
  7. 7. The method (10) of claim 1, wherein the at least one resource consumption criterion belongs to the group comprising: -Worst Case Execution Time (WCET); -Average Execution Time (AET); -a resource usage threshold; -combinations thereof.
  8. 8. The method (10) according to any one of claims 1 to 7, wherein the step (S04) of evaluating further comprises exploring a custom implementation using a combined search algorithm comprising fitness functions ) Is configured to identify the acceptable combination that meets the at least one resource consumption criterion.
  9. 9. The method (10) of claim 8, wherein the combinatorial search algorithm is a genetic algorithm comprising mutation and hybridization of genes to explore custom implementations ) At least a portion of the combination of (a) and (b).
  10. 10. The method (10) of claim 8, wherein the fitness function enables comparison of custom implementations ± with respect to the at least one resource consumption criterion ) Wherein: -when said custom is implemented ) The custom-implemented acceptable combinations constitute the at least one function when the acceptable combinations of the at least one resource consumption criteria are met ) Is used for the internal precision required; -when said custom is implemented ) Rejecting the custom implementation when the acceptable combination of the at least one resource consumption criterion is not met ) Acceptable combinations of (a) are provided.
  11. 11. The method (10) of claim 7 or claim 8, wherein the method (10) further comprises repeating the steps until a custom implementation ± ) Meets the at least one resource consumption criterion: -obtaining (S01) an additional custom implementation ), -Repeating steps (S02) and (S03) until additional combinations of errors achieve said Target Global Accuracy (TGA), providing a custom implementation [ ) Is a combination of the additional acceptable combinations of (a), -Evaluating (S04) a custom implementation based on said at least one resource consumption criterion ) The execution efficiency of the additional acceptable combinations of (a).
  12. 12. A computer program product comprising instructions which, when executed by at least one processor, configure the at least one processor to perform the method of any one of claims 1 to 11.
  13. 13. A computer-readable storage medium comprising instructions that, when executed by at least one processor, configure the at least one processor to perform the method of any one of claims 1 to 11.
  14. 14. A system for determining a required internal precision of a function implemented in a computer program to achieve a target global precision of the computer program, the system comprising at least one processor and at least one memory, wherein the at least one processor is configured to perform the method (10) according to any one of claims 1 to 11.

Description

Automatically identifying internal precision required by any function call according to global target precision of program on any program Technical Field The present disclosure relates to computer program development, and more particularly to a method and system for identifying the internal precision required for a mathematical function of a computer program that achieves a target global precision. The target global precision corresponds to the upper limit of the total error, which itself depends on mathematical function approximation and floating point rounding errors. The present disclosure also relates to a method for evaluating the time efficiency and resource efficiency of computer program execution with respect to the identified internal accuracy. Priority is claimed from European patent application EP 23306766.9 filed on 10/11 of 2023, the contents of which are incorporated herein by reference. Background Numerical computation is widely used in various industrial fields including signal and image processing, or embedded systems for automobile or nuclear power plant control, and the like. However, such calculations are subject to inherent calculation errors due to the limited arithmetic accuracy of the computer. In practice, computer programs do not use ideal and true mathematical numbers, but rather use floating point approximations that introduce rounding errors. For example, an approximation exponent exacerbates its input error, whereas a logarithmic function may mitigate rounding errors because it generally smoothes the result. This approximation accumulates during the execution of a computer program that typically implements loops, and in this case the error becomes significant. Furthermore, mathematical function implementations may be affected by the physical model/system they describe, such as trigonometric functions, where cosine or sine functions may be approximated by polynomial functions with errors. Furthermore, numerical simulations are always based on simplified models of physical phenomena. For example, a physical system may be modeled with differential equations that are solved by a mathematical solver, such as the Dragon-Kutta (Runge-Kutta) method, to provide an approximation of the true solution. These two error sources (i.e., floating point rounding errors and mathematical function approximations) constitute the total error. The total error depends on the internal numerical precision of the implementation of the mathematical function in the computer program. However, the required internal precision from the global precision of the program is difficult to predict, and thus it is difficult to ensure that the total error remains below the desired precision target of the program. Previous techniques have proposed targeting the verification of the numerical accuracy of computer programs by using empirical/random techniques or based on formal verification methods. However, while these techniques may rely on knowledge of the accuracy of preliminary operations such as addition, subtraction, multiplication, and division (controlled by the IEEE-754 standard), the implementation of mathematical functions such as exponents, cosine, sine, etc. typically depends on the hardware manufacturer, on the library used, and the corresponding source code is not always accessible. Thus, the resulting implementation is typically proprietary and its accuracy cannot be statically verified. Thus, existing approaches do not provide readily available systems and general solutions. One possible way to bypass this problem is to rely on known/owned implementations for which accuracy is known and guaranteed. The function synthesis technique combined with the formal technique is one possibility, which is the subject of the previous patent (EP 4235397). Nevertheless, these required internal accuracies need to be identified from the target accuracies of the numerical program under consideration before synthesizing a function implementation with a given required accuracy. Furthermore, in numerical computation, the precision of floating point values has a direct impact on the efficiency and speed of execution of computer programs. In fact, the nominal implementation of functions in a computer program (i.e. functions available in a system library) is often very accurate, but their calculation is often too expensive and therefore too slow. In most cases, a function implementation with lower precision is sufficient and may lead to better program performance, especially when the program contains many function calls. Thus, establishing a correct balance between the accuracy and computational cost of a computer program is another important aspect to consider. While current solutions allow for the determination of total errors and required internal accuracy in some cases, these methods do not establish an adaptation of the identified internal accuracy to the overall efficiency and resource consumption of the computer program. D