Automatically identifying internal accuracy required for any function call based on program global target accuracy on any program

By reducing the precision of mathematical functions and using a combinatorial search algorithm, acceptable combinations that satisfy the global target precision are identified, thus solving the balance problem between precision and efficiency in computer programs and optimizing the execution efficiency and resource utilization of computer programs.

CN121986334APending Publication Date: 2026-05-05MITSUBISHI ELECTRIC CORP
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
MITSUBISHI ELECTRIC CORP
Filing Date
2024-05-21
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing technologies struggle to automatically and effectively determine the internal precision required by mathematical functions in computer programs to achieve global target precision, and they also fail to establish a good balance between precision and the efficiency and resource consumption of computer programs.

Method used

By reducing the precision of mathematical functions, simulating errors, and using combinatorial search algorithms, such as genetic algorithms, acceptable combinations that meet the global target precision are identified, and their resource consumption criteria are evaluated, thereby optimizing the execution efficiency of computer programs.

Benefits of technology

It achieves optimal computer program execution time and resource usage while meeting global target accuracy, thus providing the best efficiency for the computer program.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121986334A_ABST
    Figure CN121986334A_ABST
Patent Text Reader

Abstract

The invention relates to a computer-implemented method (10) for determining a required internal accuracy of at least one function in a computer program to achieve a target global accuracy (TGA), the computer-implemented method comprising at least one iteration of the following steps: reducing (S01) the accuracy of a reference implementation of the function to obtain a custom implementation, obtaining (S02) an error caused by a reduction in accuracy (S01) between a custom implementation and a reference implementation, obtaining (S03) a plurality of acceptable combinations of custom implementations satisfying said target global accuracy (TGA) based on said error, evaluating (S04) the execution efficiency of the acceptable combinations based on at least one resource consumption criterion, and when said at least one resource consumption criterion is satisfied, determining (S05) the execution efficiency of the acceptable combinations. And the required internal precision of the function is provided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to computer program development, and more specifically to methods and systems for identifying the intrinsic precision required by the mathematical functions of a computer program to achieve a target global precision. The target global precision corresponds to an upper limit of the total error, which itself depends on the mathematical function approximation and floating-point rounding errors. This disclosure also relates to a method for evaluating the time efficiency and resource efficiency of computer program execution relative to the identified intrinsic precision. Priority is claimed to European Patent Application EP 23306766.9, filed October 11, 2023, the contents of which are incorporated herein by reference. Background Technology

[0002] Numerical computing is widely used in various industrial fields, including signal and image processing, or embedded systems for automotive or nuclear power plant control.

[0003] However, due to the limited precision of computer arithmetic, such calculations are subject to inherent computational errors. In fact, computer programs do not use ideal and true mathematical numbers, but rather floating-point approximations that introduce rounding errors. For example, approximating exponential numbers exacerbates their input errors; conversely, logarithmic functions can mitigate rounding errors because they generally smooth the results.

[0004] This approximation accumulates during the execution of computer programs that typically implement loops, and in this case, the error becomes significant.

[0005] Furthermore, the implementation of mathematical functions may be influenced by the physical models / systems they describe; for example, trigonometric functions, where cosine or sine functions can be approximated by polynomial functions, have errors. Additionally, numerical simulations are always based on simplified models of physical phenomena. For instance, physical systems can be modeled using differential equations, which are solved by mathematical solvers (such as the Runge-Kutta method) to provide approximations of the true solution.

[0006] These two sources of error (i.e., floating-point rounding error and mathematical function approximation) constitute the total error. The total error depends on the internal numerical precision of the mathematical function implementation in the computer program. However, the required internal precision from the program's global precision is difficult to predict, and therefore it is difficult to ensure that the total error remains below the program's desired precision target.

[0007] Previous techniques have aimed to verify the numerical accuracy of computer programs using empirical / random techniques or formal verification methods. However, while these techniques can rely on knowledge of the accuracy of preparatory operations such as addition, subtraction, multiplication, and division (controlled by the IEEE-754 standard), the implementations of mathematical functions such as exponentiation, cosine, and sine are often dependent on hardware manufacturers, the libraries used, and the corresponding source code is not always accessible. Therefore, the resulting implementations are often proprietary, and their accuracy cannot be statically verified. Consequently, existing methods do not provide readily available systems and general solutions.

[0008] One possible way to circumvent this problem is to rely on known / owned implementations where accuracy is known and guaranteed. Function synthesis techniques combined with formal techniques are one possibility, and this is the subject of a previous patent (EP4235397). Nevertheless, before synthesizing a function implementation with a given desired accuracy, it is necessary to identify these desired intrinsic accuracies from the target accuracy of the numerical program under consideration.

[0009] Furthermore, in numerical computation, the precision of floating-point values ​​has a direct impact on the efficiency and speed of computer program execution. In fact, the nominal implementations of functions in computer programs (i.e., functions available in system libraries) are often very accurate, but their computation is usually too expensive and therefore too slow. In most cases, function implementations with lower precision are sufficient and can lead to better program performance, especially when the program contains many function calls. Therefore, striking the right balance between the precision and computational cost of computer programs is another important aspect to consider.

[0010] While current solutions allow for the determination of total error and required internal accuracy in some cases, these methods do not establish a fit between the identified internal accuracy and the overall efficiency and resource consumption of the computer program. Summary of the Invention

[0011] This disclosure aims to improve upon the aforementioned situation. Specifically, this disclosure aims to overcome at least some limitations of the prior art by proposing a method for automatically and efficiently determining the required internal precision of a computer program's mathematical functions relative to a global target precision. Furthermore, at least in some embodiments, this disclosure aims to propose a method for evaluating the optimal efficiency of higher precision and higher computational cost of a computer program relative to the identified internal precision. Therefore, the proposed method simulates the impact of various precision reduction combinations on the program's global precision based on stochastic techniques to identify the minimum acceptable precision while ensuring optimal program execution. The target global precision corresponds to the minimum acceptable precision of the computer program, i.e., the upper limit of the allowable total error.

[0012] Therefore, and according to the first aspect, this disclosure relates to a computer implementation method for determining the desired internal precision of at least one function implemented in a computer program to achieve a target global precision of the computer program. Thus, the computer implementation method includes at least one iteration of the following steps: - Reduce the precision of at least one reference implementation of the at least one function to obtain a custom implementation of the at least one function. - Based on common input values, obtain the error caused by the reduction in precision between the custom implementation and the reference implementation. Based on the error, multiple acceptable combinations of the custom implementation are obtained, which allow the target global accuracy of the computer program to be satisfied. - Evaluate the execution efficiency of at least one of the acceptable combinations based on at least one resource consumption criterion, wherein the execution efficiency evaluation gives the required internal accuracy of the at least one function when the at least one resource consumption criterion is met.

[0013] Therefore, the computer implementation method ensures the identification of combinations of the precision of different mathematical functions of a computer program that meet the global target precision (during the first three steps), while optimizing a given set of criteria (e.g., worst-case execution time, resource usage, etc. during the last step).

[0014] To this end, a first aspect of the computer implementation method includes evaluating the impact of reducing the precision of different mathematical functions of the computer program relative to the global target precision. To this end, in a first step, the computer program is instrumented to execute using a custom precision function (i.e., using a reduced internal precision function). This custom execution of the computer program results in custom output. Then, in a second step, the error of the custom output is evaluated, and in a third step, the internal precision is identified based on the error in achieving the target global efficiency. In other words, these internal precisions are a priori lower than the nominal precision while maintaining negligible error in the program results.

[0015] The second aspect of the computer implementation method is to evaluate during the fourth step whether the reduction in internal precision identified also reduces the execution time and resource costs of the computer program. Therefore, during the fourth step, at least one optimal combination solution is sought among the internal precisions identified in the third step that achieve at least one resource consumption criterion. Thus, the optimal combination solution constitutes the internal precision required by the computer program.

[0016] The computer implementation method may further include a preliminary step for determining a reference error by comparing the reference output of the at least one reference implementation with the corresponding ideal output of the ideal execution of the at least one function using a common input value.

[0017] Reference output is produced by the nominal execution of a function in a computer program, where the precision is nominal as defined in the program, such as in single-precision or double-precision floating-point format, and a reference implementation of the mathematical function is used, i.e., a reference implementation available in a system library, for example. Ideal output is produced by the ideal execution of a function, whose precision should be infinite and correspond to a true mathematical result. Since infinite precision is unattainable, ideal output corresponds to a higher-precision execution of the computer program, such as double precision rather than single precision, and is computationally expensive.

[0018] In a particular implementation, the reduction in accuracy of the first step also includes introducing random noise into the value provided to or by at least one reference implementation to obtain a custom implementation with a custom output.

[0019] In a particular implementation, the error determination in the second step includes calculating the error based on the custom output and based on the reference output. and .

[0020] In a particular implementation, the third step further includes comparing multiple error combinations relative to the target global accuracy, wherein: - When the combination of errors achieves the target global accuracy, the corresponding combination of the custom implementation is an acceptable combination of the custom implementation; - When the combination of errors does not achieve the target global accuracy, reject the corresponding combination implemented by the user.

[0021] Therefore, the acceptable combinations of errors and their corresponding combinations with the custom implementations identified in the third step constitute the internal precision required by the program. These internal precisions are not necessarily optimal for the efficient execution of the computer program, and thus can be further analyzed in the fourth step of the method detailed below.

[0022] The computer implementation method may also include iterating through the following steps until the target global accuracy is achieved by at least one combination of errors of at least one combination of custom implementations: - Obtain additional combinations of custom implementations, - Determine additional errors based on the additional combinations implemented in the custom way. - Compare the additional error with the target global accuracy.

[0023] In a particular implementation, at least one resource consumption criterion belongs to the group consisting of: - Worst-case execution time; - Average execution time; -Resource usage threshold; - Its combination.

[0024] The resource consumption criteria defined as inputs to the method in the preparatory steps include a stopping condition corresponding to a threshold for which the program's efficiency is considered sufficient. The resource consumption criteria are arbitrary and may include one or more criteria, such as a worst-case execution time (WCET) criterion corresponding to the maximum time the program might take to execute on a given fixed hardware platform. In other words, a WCET analysis of the program means measuring the upper limit of the execution time for the worst combination of input values. The resource consumption criterion can also be an average execution time (AET) criterion, corresponding to a reference execution time under typical conditions for typical hardware, taking into account a reference combination of input values. This criterion can also be defined as a resource usage threshold for the program, such as corresponding to the maximum acceptable use of memory, network, single / multiple CPUs / GPUs, etc.

[0025] In a particular implementation, the fourth step further includes exploring the space of acceptable combinations by utilizing a combinatorial search algorithm including a fitness function configured to identify the acceptable combinations that satisfy at least one resource consumption criterion.

[0026] Combinatorial search algorithms are used to efficiently explore the space of possible and acceptable precision combinations among those identified in the third step that achieve global target precision. To guide the exploration, a fitness function is implemented in the combinatorial search algorithm, configured to assign scores to solution candidates relative to the problem to be solved. In this disclosure, the fitness function is further constructed based on at least one resource consumption criterion and a pre-computed database of costs for various versions of the function implementation, depending on the function precision. More precisely, in this disclosure, the fitness function thus evaluates the adequacy of the identified intrinsic precision of the function (or custom implementation) relative to the computational resources and time of the computer program.

[0027] In a particular implementation, the combinatorial search algorithm is a genetic algorithm that includes gene mutation and crossover to explore at least a portion of custom-implemented combinations.

[0028] The idea behind genetic algorithms is to model natural selection, evolving generation after generation through gene mutation and crossover. A genetic algorithm includes a fitness function that selects the best custom output combination based on its fitness function score during the first generation (first iteration). Then, by combining their "genes" during crossover and mutation phases, the identified combinations are mixed together to create additional candidates for the next generation.

[0029] In a particular implementation, the fitness function enables the comparison of acceptable combinations of custom implementations relative to at least one resource consumption criterion, wherein: - When an acceptable combination of custom implementations satisfies at least one resource consumption criterion, the acceptable combination of custom implementations constitutes the required internal precision of at least one function; - If an acceptable combination of custom implementations does not meet at least one resource consumption criterion, then the acceptable combination of custom implementations is rejected.

[0030] The computer implementation method may also include repeating the following steps until an acceptable combination of custom implementations satisfies at least one resource consumption criterion: - Obtain additional custom implementations; - Repeat steps two and three until the additional error combination achieves the target global accuracy, thus providing an additional acceptable combination for the custom implementation; - Evaluate the execution efficiency of additional acceptable combinations of the custom implementation based on at least one resource consumption criterion.

[0031] When at least one resource consumption criterion is met—that is, when a stopping condition is achieved through one or more acceptable combinations of custom implementations—these correspond to the internal precision required by a computer program with the desired resource efficiency. These combinations then constitute the output of the process.

[0032] According to a second aspect, this disclosure relates to a computer program product including instructions that, when executed by at least one processor, configure the at least one processor to perform a method according to any embodiment of the present disclosure.

[0033] According to a third aspect, this disclosure relates to a computer-readable storage medium including instructions that, when executed by at least one processor, configure the at least one processor to perform a method according to any embodiment of this disclosure.

[0034] According to a fourth aspect, this disclosure relates to a system for determining the desired 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 a method according to any embodiment of the present disclosure. Attached Figure Description

[0035] The invention will be better understood after reading the following description, which is given by way of non-limiting example and is carried out with reference to the accompanying drawings, which illustrate: - Figure 1This diagram illustrates the main steps of an exemplary implementation of a computer-based method for determining the required internal precision of a computer program. - Figure 2 This is a diagram illustrating the preliminary steps of a computer implementation method. - Figure 3 This is a diagram illustrating a computer system that performs a computer-implemented method.

[0036] In these figures, the same reference numerals across different figures denote the same or similar elements. For clarity, unless otherwise explicitly stated, the elements shown are not drawn to scale.

[0037] Furthermore, the order of steps shown in these figures is provided for illustrative purposes only and is not intended to limit this disclosure. This disclosure can be applied to the same steps performed in a different order. Detailed Implementation

[0038] Figure 1 The main steps of a computer implementation method 10 for determining the required internal precision of a computer program are illustrated schematically.

[0039] Computer implementation method 10 is implemented by a computer system (in Figure 3 The computer system includes one or more processors Px (which may belong to the same computer or different computers) and one or more storage memories St (magnetic hard disk, optical disk, electronic storage, or any computer-readable storage medium) where a computer program product is stored as a set of program code instructions to be executed to implement all or part of the steps of the computer implementation method 10. The computer program product is loaded into execution memory Mem, which allows the processors Px to execute the computer implementation method 10. These components are connected together via a bus Bs.

[0040] Alternatively, or in combination thereof, the computer system may include one or more programmable logic circuits (FPGA, PLD, etc.) and / or one or more application-specific integrated circuits (ASICs), adapted to implement all or part of the steps of method 10. In other words, the computer system includes a set of means configured by software (a particular computer program product) and / or hardware (processor, FPGA, PLD, ASIC, etc.) to implement the steps of method 10.

[0041] The computer program being analyzed is its source code, which can be written in any computer language, such as C, C++, Fortran, Java, or Python. For example, the computer program is designed to run on an embedded system to perform tasks related to, for example, signal or image processing, automatic control, etc. The computer program includes assignments, control structures (conditional branches, switches, loops, etc.), mathematical operations (addition, multiplication, etc.), and uses or includes mathematical functions. Implementations (e.g., exp, log, sin, cos, etc.). For example, the computer program being analyzed can be fed with fields containing its floating-point values. Relevant input variables , where n corresponds to the total number of input variables.

[0042] The object of this invention is to determine which implementations of mathematical functions (among several possible implementations) are best suited in terms of computational accuracy to the requirements of a computer program. To achieve this result, method 10 is performed. Essentially, this method involves determining suitable combinations of implementations of mathematical functions to achieve a target global accuracy (TGA) for a computer program. This method specifically uses algorithms that allow the identification of combinations of custom implementations of functions (e.g., combinatorial search algorithms) and error comparison algorithms that allow determination of whether a given combination satisfies the target global accuracy (TGA). An example of an implementation of method 10 is described in detail below. Once one or more combinations of custom implementations of functions are determined, these combinations of custom implementations are used to determine whether certain efficiency criteria (e.g., in terms of execution time or memory allowed for program execution) are met.

[0043] In this implementation example, such as Figure 1 As shown, the computer implementation method 10 includes an optional pre-setting step S00 for receiving several inputs, which in... Figure 2 The preparatory steps S00 are shown in the diagram and described in more detail below. In summary, the preparatory steps S00 are provided from the reference implementation. Reference output Ideal output (From the ideal implementation) and the maximum error coefficients e and c, which are based on the over-approximation domain Random sampling of the values ​​evaluated above (where The value is calculated as l (where l is the number of samples).

[0044] The computer implementation method 10 also includes at least one iteration of the following steps: - Reduce (S01) the at least one function ( At least one reference implementation of ) The accuracy of ) to obtain the accuracy of the at least one function ( Custom implementation of ) ), -Based on common input values ​​(and their domains) Relevant parameters ), obtain (S02) by custom implementation ( ) and reference implementation ( Error caused by the decrease in precision between (S01) ) -Based on the error To obtain (S03) multiple acceptable combinations of custom implementations ( The acceptable combination allows the computer program to meet its target global accuracy (TGA). - Based on at least one resource consumption criterion, evaluate (S04) the execution efficiency of at least one of the acceptable combinations. When the at least one resource consumption criterion is met, the evaluation step provides at least one function ( The required internal precision.

[0045] The first step of the precision reduction simulation, S01, involves randomly reducing the internal precision of each operation / function call encountered in the computer program CPx. Therefore, the computer program CPx utilizes functions here... Custom implementation The execution, with custom-reduced internal precision, provides a custom output for each randomly sampled sample from S00. (That is, the same input values ​​used to obtain the outputs of the reference and ideal implementations of functions in program CPx).

[0046] To provide this custom implementation with reduced accuracy For example, in one exemplary implementation, random degradation is achieved by introducing random noise onto the inputs of function and operation calls of the computer program CPx. Internal precision degradation is cumulative within the computer program CPx.

[0047] To illustrate, consider, for example, a custom implementation where the cosine function has 20 bits of internal precision, with a reference precision of 53 bits (corresponding to significant number precision). Each time the cosine function is encountered during the custom execution of the computer program CPx, the resulting output is subject to random noise starting from the 21st bit in the 53-bit reference representation, resulting in a reduction in precision. Furthermore, this reduction in precision from the 21st bit onwards accumulates with each subsequent call to the cosine function in the computer program CPx, affecting the previously degraded cosine function output. In other words, this method allows the simulation of using a lower-precision implementation (relative to the reference implementation) when executing the computer program CPx.

[0048] For custom execution of the program, other methods can be implemented to effectively reduce precision and analyze the effects of the reduction: for example, by replacing the values ​​of these bits with 0, or by grabbing bits above a given index (bits 21 to 53). Alternatively, another approach could be to directly use one or more downgraded implementations of some functions, if such implementations are available. Other classic tools can also be used for this purpose.

[0049] In addition, in custom implementation The first iteration of step S01 is performed on the initial combination of reduced internal precision. The choice of the initial combination of internal precision can be arbitrary or random. For example, in a simplified manner, a custom combination of the internal precision of the cosine / sine function of the computer program CPx could be: 30 / 10 bits, 10 / 30, 15 / 25, 30 / 30, etc. (or any other value), and it can be applied to all other functions (exponential, logarithmic, etc.) and operations in the computer program CPx. To accelerate analysis, the selection of the initial combination can also be guided to eliminate outliers (e.g., if the global result must meet a high target precision, then the internal precision is very low, and vice versa). In a preferred example, the initial combination of internal precision corresponds to the median of the reference internal precision of the computer program CPx. The computer program CPx is run as many times as the number of custom combinations (four times in the simplified example above).

[0050] according to Figure 1 Then, perform the second step S02 to evaluate the total error, which corresponds to the mathematical function approximation and the floating-point rounding approximation (caused by degradation). Evaluate the reference output of the nominal execution. (For example, pre-calculated in preparatory step S00) and the custom output of custom execution calculated in step S01. The total error between them, where:

[0051] Among them, the value Corresponding to the total error coefficient, the value The constant part corresponding to the error. It is a specific absolute value, therefore it does not depend on calculation. In this case, the total error is usually written as:

[0052] Otherwise, in In such cases, the total error can be evaluated, for example, by using interpolation methods and over-approximations on random sampling, or a combination of both.

[0053] Subsequently, for each combination of custom implementations, in the error portion and constant part The total error coefficient obtained by separating between and And the maximum error coefficients e and c (pre-calculated in preparatory step S00). For example, for four custom combinations of the internal precision of the cosine / sine function, as described above (i.e., 30 / 10 digits, 10 / 30, 15 / 25, 30 / 30), the value is calculated for each combination. and .

[0054] Then, in the third step S03, these obtained error coefficients are compared with the TGA. Therefore, the TGA value constitutes the custom output provided in the accuracy reduction step S01. Acceptable combinations. Error values ​​from unimplemented TGA constitute a custom output. The rejection combination.

[0055] Acceptable combinations of recognized custom outputs This corresponds to the required internal precision of the computer program CPx.

[0056] In the case of rejected combinations, such as Figure 1 As shown, a custom output with reduced internal precision is generated through a combinatorial search algorithm. Additional combinations. This algorithm is used to explore custom outputs. The additional possible combinations of space.

[0057] Custom output Additional combinations depend on the chosen discrete and combinatorial search algorithm. One could consider relying on genetic algorithms or any relevant type of combinatorial search algorithm, such as greedy algorithms or metaheuristics, or using machine learning methods alone or in addition.

[0058] In a preferred embodiment, a genetic algorithm is used. In this case, additional mutation combinations for the custom output are generated, for example, through gene mutation and / or crossbreeding generation after generation (iteration after iteration).

[0059] Taking the example that the initial precision combination of the cosine / sine function is 30 / 10 bits, for instance, the combinatorial search algorithm can generate additional precision test combinations of 20 / 40 bits, or 30 / 15 bits, or 10 / 30 bits in the next generation.

[0060] Additional combinations of custom outputs are implemented and the process returns to steps S02 and S03. Therefore, steps S01, S02, and S03 are executed until an acceptable combination of custom outputs implementing the TGA is identified.

[0061] Then, according to Figure 1Method 10 includes an efficiency analysis at step S04 to assess whether the identified internal accuracy also ensures efficient computer program execution in terms of resources, time, and other criteria. This analysis is performed on all identified combinations that achieve the TGA by a fitness function relative to the input resource consumption criteria (criters). The fitness function is configured to associate the score at each combination with its fit to the selected resource consumption criteria (criters). Furthermore, achieving a resource consumption criterion (criterion) means that the evaluation of that criterion (the criteria) by the fitness function meets a stopping condition.

[0062] The fitness function, resource consumption criteria (standards), and stopping conditions are predetermined and implemented in the preparatory step S00.

[0063] Therefore, the combination of custom implementations of the resource consumption criteria (criteria) identified by the fitness function corresponds to the required internal precision for optimizing the efficiency of the computer program CPx, and constitutes the final output of method 10.

[0064] Method 10 is configured to stop after identifying a first combination with the required internal precision to achieve a resource consumption criterion (criteria). For this purpose, the stopping condition included within the resource consumption criterion (criteria) corresponds to a threshold at which efficiency is considered sufficient.

[0065] However, the method can also be configured to iterate the entire process back to step S01, where the output is customized. The additional combinations are generated by a combinatorial search algorithm and are relative to the combinations with the desired internal precision identified from step S04. For example, a fixed number of iterations to be achieved can be set in the preparatory step S00 to force the method to iterate in order to potentially find one or more better combinatorial solutions.

[0066] As mentioned earlier, custom output The generation of these additional combinations depends on the algorithm chosen. In a preferred embodiment, a genetic algorithm is used.

[0067] The selected algorithm can be configured to test several configurations of additional combinations with lower precision at each iteration in order to identify the most efficient (in the sense of resource consumption criteria) combination of internal precision after step S04.

[0068] Otherwise, in step S04, combinations of custom implementations that do not achieve the resource consumption criterion (criterion) are rejected. In this case, the selected combinatorial search algorithm iterates through additional combinations with internal precision to provide additional custom output. Return to step S01, which reduces precision.

[0069] In this implementation, the combinatorial search algorithm is configured to generate additional combinations relative to the best combination identified for implementing the TGA in step S03. For example, if a 30 / 10-bit cosine / sine precision combination is identified by the fitness function in step S04 as more efficient than a 5 / 45-bit combination, the combinatorial search algorithm will test, for example, an additional 10 / 30-bit precision combination based on their respective scores. It is also preferable to select the lowest possible additional combination to better optimize computer program efficiency, in this case, for example, 25 / 5 bits.

[0070] Method 10 iterates from step S01 to step S04 until at least one combination of custom implementations is finally identified by the fitness function to achieve the resource consumption criterion (criterion), i.e., the stopping condition is met.

[0071] Furthermore, it is necessary to anticipate situations where no feasible solution is found. For example, if the process reaches a very large number of iterations (which can be defined in the S00 preparatory steps), it can be considered impossible to find a combination of solutions that achieve the TGA and / or reach the stopping condition. This may be the case if the TGA and / or resource consumption criteria (guidelines) are theoretically unachievable, for example, for hardware other than the recommended hardware, or if too many cost criteria are included. In this case, automatic and / or user-authorized methods can be used to modify the TGA / criteria values, or to instruct the computer program CPx that it cannot implement the input, or even to propose the closest internal accuracy solution that is identified but does not meet the TGA and / or criteria.

[0072] The computer implementation method 10 may also include several other related information outputs, such as, for example, the data log of the memory used, the computation time of each combination, the VPREC (or similar / used tool) output from the precision reduction step S03, etc.

[0073] like Figure 2 As shown, the preparatory step S00 includes receiving method inputs, such as the computer program to be evaluated, the desired TGA, and resource consumption criteria (criteria) with their associated stopping conditions. The desired TGA and resource consumption criteria (criteria) are arbitrary and depend on the application domain. For example, the TGA can be defined as the minimum number of bits to be achieved, in which case it corresponds to the percentage of result error and depends on the size of the input and output data. The definitions of the combinatorial algorithm / genetic algorithm and fitness function are also pre-computed and implemented within the computer method 10 at this stage.

[0074] Preliminary step S00 also includes a preliminary analysis of the computer program CPx. Therefore, at each statement in the analyzed program, particularly at the location of mathematical function calls, a first over-approximation calculation of the domain of floating-point values ​​is performed. This calculation results in random sampling of values ​​over said domain. This can be accomplished, for example, using an abstract interpretation tool for floating-point arithmetic, an automated formal method for automatically verifying simple properties of a program.

[0075] When the program under consideration is part of a large part of development, domain evaluation can be used to determine the domain of values ​​that the program's input variables can take. If the program is independent, this information may be unknown (therefore, the domain is the entire range of floating-point values) or specified by the developer.

[0076] The next stage of the method may then include instrumenting the program to execute it for different combinations of randomly sampled values. For this purpose, parameter initialization is performed, wherein the computer program is executed in nominal execution and optionally in ideal execution.

[0077] In nominal execution, a computer program is executed on a pre-computed random sample of over-approximation domain values ​​in a nominal floating-point format (e.g., single-precision or double-precision). Nominal execution results in floating-point numbers for different values ​​of the random sample. Reference output.

[0078] In ideal execution, a computer program executes in an infinite or ideal (higher precision) floating-point format, such as executing with arbitrarily large precision of 100 bits when the nominal precision is double, or using double precision when the nominal precision is single. This results in an ideal output of randomly sampled, distinct values. Such an ideal output should correspond to a true mathematical result. This formal computation is resource-intensive. If there is sufficient confidence in the accuracy of the computer program, ideal execution may not be necessary.

[0079] Then, the maximum error between the reference output and the ideal output for nominal and ideal execution is evaluated separately, where:

[0080] Here, the value e corresponds to the maximum error coefficient, and the value c corresponds to the constant part. c is a specific absolute value and therefore does not depend on calculation. When c=0, the maximum error is therefore written as:

[0081] Otherwise, in In such cases, the maximum error can be assessed using interpolation methods and over-approximations on random sampling.

[0082] Then, as described above, the result output of the preparatory step S00 is processed in steps S01 to S04. , 、e、c.

Claims

1. A computer implementation method (10) for determining at least one function implemented in a computer program ( The required internal precision of the computer program is used to achieve the target global precision (TGA), wherein, The method includes at least one iteration of the following steps: - Reduce (S01) the at least one function ( At least one reference implementation of ) The accuracy of ) to obtain the accuracy of the at least one function ( Custom implementation of ) ), - Based on the common input value, obtain (S02) the custom implementation ( ) and the reference implementation ( Error caused by the decrease in precision between (S01) ), -Based on the error ( ), to obtain the custom implementation described in (S03) Multiple acceptable combinations of the computer program, which allow the target global accuracy (TGA) to be satisfied. - Based on at least one resource consumption criterion, evaluate (S04) the execution efficiency of at least one of the acceptable combinations, and when the at least one resource consumption criterion is met, the evaluation of the execution efficiency gives the at least one function ( The required internal precision.

2. The method (10) according to claim 1, further comprising a preparatory step (S00), the preparatory step being used to compare the at least one reference implementation using the common input value. Reference output of ) ) and the at least one function ( The ideal output corresponding to the ideal execution of ) To determine the reference error (e, c).

3. The method (10) according to claim 1, wherein, The accuracy reduction step (S01) includes adjusting the accuracy provided to the at least one reference implementation ( ) or implemented by at least one of the references ( The provided value introduces random noise to obtain a custom output. The custom implementation of ) ).

4. The method (10) according to claim 3, wherein, The error determination step (S02) includes based on the custom output ( ) and based on the reference output ( ) Calculation error and .

5. The method (10) according to claim 4, wherein, The step (S03) further includes comparing the error relative to the target global accuracy (TGA). Multiple combinations of ), where: - When the combination of errors achieves the target Total Global Accuracy (TGA), the corresponding combination for the custom implementation is the custom implementation ( Acceptable combinations; - Reject custom implementations when the combination of errors fails to achieve the target Total Global Accuracy (TGA). The corresponding combination of ).

6. The method (10) according to claim 1, wherein, The method (10) further includes iterating through the following steps until the target global accuracy (TGA) is achieved by a custom implementation ( At least one combination of errors of at least one combination are realized: - Obtain (S01) custom implementation ( Additional combinations of ) -Based on custom implementation ( The additional combination of ) determines (S02) additional error ( ), - to the additional error ( The target global accuracy (TGA) is compared with that of the target (S03).

7. The method (10) according to claim 1, wherein, The at least one resource consumption standard belongs to the group consisting of the following: - Worst case execution time (WCET); - Average execution time (AET); -Resource usage threshold; - Its combination.

8. The method (10) according to any one of claims 1 to 7, wherein, The evaluation step (S04) also includes exploring custom implementations using a combinatorial search algorithm that includes a fitness function. The fitness function is configured to identify acceptable combinations that satisfy the at least one resource consumption criterion, given the space of acceptable combinations.

9. The method (10) according to claim 8, wherein, The combined search algorithm is a genetic algorithm that includes gene mutation and hybridization to explore custom implementations ( At least a part of the combination of ).

10. The method (10) according to claim 8, wherein, The fitness function enables a custom implementation to be compared relative to the at least one resource consumption criterion. Acceptable combinations of ), where: -When the custom implementation ( When an acceptable combination of the custom implementations satisfies the at least one resource consumption criterion, the acceptable combination constitutes the at least one function. The required internal precision; -When the custom implementation ( If the acceptable combination of ) does not meet at least one of the resource consumption criteria, the custom implementation is rejected. Acceptable combinations of ).

11. The method (10) according to claim 7 or claim 8, wherein, The method (10) further includes repeating the following steps until a custom implementation is achieved ( An acceptable combination of the above-mentioned resource consumption criteria is: - Obtain (S01) additional custom implementation ( ), - Repeat steps (S02) and (S03) until the additional combination of errors achieves the target global accuracy (TGA), providing a custom implementation ( Additional acceptable combinations, -Based on the at least one resource consumption criterion, evaluate (S04) the custom implementation ( The execution efficiency of the additional acceptable combination of ) 12. A computer program product comprising instructions that, when executed by at least one processor, configure the at least one processor to perform the method according to any one of claims 1 to 11.

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 according to any one of claims 1 to 11.

14. A system for determining the desired 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.

Citation Information

Patent Citations

  • Method and system for converting an input computer program into an output computer program achieving a target global accuracy

    EP4235397A1