Light ray tracing accuracy detection method and system based on high error interval of floating point calculation expression

By parsing floating-point calculation expressions in ray tracing applications into abstract syntax trees and generating high error intervals for error detection, the existing ray tracing error detection problems are solved, and more efficient and accurate are achieved The error detection provides guidance information to improve the accuracy of ray tracing.

CN118897931APending Publication Date: 2024-11-05Chinese People's Liberation Army Cyberspace Force Information Engineering University
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411086079.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

The existing ray tracing error detection methods have problems such as inefficiency and inaccurate error detection, especially in dynamic detection, where time overhead is high and critical error points may be missed.

Method used

By parsing the floating-point calculation expression in the ray tracing application into an abstract syntax tree, extracting sub-expression construction equations, using the sympy library for solving and designing solution filtering rules to obtain potential high error points, generating high error intervals for error detection, Finally, the accuracy of ray tracing is judged based on the maximum error.

Benefits of technology

Improve the efficiency and accuracy of ray tracing error detection, overcome the problem of high time overhead and the problem of possible missing maximum error in existing methods, can quickly and effectively judge the accuracy of ray tracing, and provide improved ray tracing accuracy Guidance information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118897931A_ABST
    Figure CN118897931A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of ray tracing, in particular to a ray tracing accuracy detection method and system based on a floating point calculation expression high error interval, and the method comprises the steps: extracting a floating point calculation expression from a ray tracing application program, and analyzing the floating point calculation expression into an abstract syntax tree; extracting a plurality of sub-expressions from the abstract syntax tree, and constructing each sub-expression into an equation; solving the constructed equation, and then obtaining a feasible solution through a solution screening rule, namely obtaining a potential high error point; generating high error intervals according to the potential high error points, and performing error detection on each derived high error interval to obtain a maximum error; and judging the accuracy of ray tracing according to the obtained maximum error. According to the method, error detection is carried out by using the floating point expression extracted from the ray tracing application program, so that the accuracy of ray tracing is quickly and effectively judged, and meanwhile, the detection efficiency is improved by reducing the detection interval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of ray tracing technology, and in particular to a ray tracing accuracy detection method and system based on a high error interval of a floating point calculation expression. Background Art

[0002] Accurate simulation of ray tracing is an extremely complex challenge in the field of computer graphics. Since the late 1970s and early 1980s, ray tracing has achieved initial success using numerical methods. Over time, the requirements for the temporal and spatial accuracy of ray tracing have become higher and higher, and these numerical models have developed into one of the most complex software projects in the world. They need to process massive amounts of data and millions of lines of code, and rely on the powerful computing power of supercomputers to support them. A large number of floating-point calculations in the ray tracing process will inevitably introduce errors, which directly affect the accuracy of ray tracing simulations. Therefore, effectively detecting these errors is crucial to verifying the accuracy of ray tracing. In ray tracing applications, a large number of floating-point operations can be abstracted into a series of floating-point expressions.

[0003] Currently, popular floating-point calculation expression error detection methods are divided into static detection and dynamic detection. Static detection uses theories such as abstract interpretation, interval or affine algorithms, and symbolic execution to estimate error bounds, but these estimated results are often higher than the actual values; while dynamic detection relies on the analysis of the application and uses a search-based method to find the maximum error. Despite this, dynamic detection has a large time overhead in the overall program analysis, the process is cumbersome and complicated, and because the search strategy has not been fully formed, the key maximum error point may be missed. In addition, once the detection scope changes, the existing search process cannot be reused and the search needs to be re-executed. Summary of the invention

[0004] In view of the difficulty of comprehensive analysis and low detection efficiency of ray tracing applications, the present invention proposes a ray tracing accuracy detection method and system based on the high error interval of floating-point calculation expressions, aiming to use floating-point expressions extracted from ray tracing applications for error detection, so as to quickly and effectively judge the accuracy of ray tracing; at the same time, the detection efficiency is improved by narrowing the detection interval.

[0005] To achieve the above purpose, the technical solution adopted is:

[0006] A ray tracing accuracy detection method based on a high error interval of a floating point calculation expression, comprising:

[0007] Extract floating-point calculation expressions from the ray tracing application, and parse the floating-point calculation expressions into an abstract syntax tree;

[0008] Extract multiple sub-expressions from the abstract syntax tree, and construct each sub-expression into an equation;

[0009] Solve the constructed equations, and then obtain feasible solutions through solution screening rules, that is, obtain potential high error points;

[0010] Generate a high error interval according to the potential high error points, perform error detection on each derived high error interval, and obtain the maximum error;

[0011] The accuracy of ray tracing is judged based on the maximum error obtained.

[0012] According to the ray tracing accuracy detection method based on the high error interval of floating-point calculation expressions of the present invention, further, the floating-point calculation expression is parsed into an abstract syntax tree by lexical analysis and syntax analysis to parse the expression into a syntax tree, and the syntax tree contains two different nodes: operands and operators.

[0013] According to the ray tracing accuracy detection method based on the high error interval of the floating-point calculation expression of the present invention, further, multiple sub-expressions are extracted including: for the entire floating-point calculation expression, the expression that only contains part of the calculation is called a sub-expression, and after all these sub-expressions are extracted, they are constructed into corresponding equations according to the operators.

[0014] According to the ray tracing accuracy detection method based on the high error interval of the floating point calculation expression of the present invention, further, the constructed equation is solved, and then a feasible solution is obtained through a solution screening rule, that is, a potential high error point is obtained, comprising: firstly using a solver developed based on the sympy library to solve and calculate the extracted equation, and then through conditional number analysis, corresponding equation solution screening rules are designed for different operators, and after solution screening according to the above rules, a deduplication operation is performed on the solution set; the solution screening rules are as follows:

[0015]

[0016] The solution after deduplication is the potential high error point.

[0017] According to the ray tracing accuracy detection method based on the high error interval of the floating point calculation expression of the present invention, further, the high error interval is generated according to the potential high error point, and the calculation formula is as follows:

[0018]

[0019] Among them, abs is the absolute value function, interval is the generated high error interval, x is the solution of the equation, lb is the lower bound of the interval of the expression f(x), ub is the upper bound of the interval of the expression f(x), and ε is the neighborhood size for generating the high error interval.

[0020] According to the ray tracing accuracy detection method based on the high error interval of the floating point calculation expression of the present invention, further, error detection is performed on each derived high error interval to obtain the maximum error, including: large-scale sampling is performed on each high error interval, the total number of samples is M, uniform sampling is performed on the interval to generate M test cases, the error value under each test case is calculated using the ULP error calculation formula, and the maximum error is selected.

[0021] According to the ray tracing accuracy detection method based on the high error interval of the floating point calculation expression of the present invention, further, the ULP error calculation formula is as follows:

[0022]

[0023] Wherein, f(x0) represents the calculated value of the floating-point expression extracted from the ray tracing application when f(x) is at x=x0, that is, the floating-point calculation result; o((fx0)) represents the exact value of the floating-point expression extracted from the ray tracing application when f(x) is at x=x0, that is, the real number calculation result, and ULP(·) represents the minimum precision unit.

[0024] According to the ray tracing accuracy detection method based on the high error interval of the floating-point calculation expression of the present invention, further, the accuracy of the ray tracing is judged according to the maximum error. The larger the maximum error, the less accurate the ray tracing, and the smaller the maximum error, the more accurate the ray tracing.

[0025] Furthermore, the present invention also proposes a ray tracing accuracy detection system based on a high error interval of a floating point calculation expression, comprising an expression extraction module, an equation construction module, an equation solving module, an error detection module and a judgment module, wherein:

[0026] An expression extraction module, used to extract floating-point calculation expressions from a ray tracing application and parse the floating-point calculation expressions into an abstract syntax tree;

[0027] An equation construction module, used for extracting multiple sub-expressions from the abstract syntax tree and constructing each sub-expression into an equation;

[0028] The equation solving module is used to solve the constructed equations and then obtain feasible solutions through solution screening rules, that is, to obtain potential high error points;

[0029] An error detection module is used to generate a high error interval according to potential high error points, and perform error detection on each derived high error interval to obtain a maximum error;

[0030] The judgment module is used to judge the accuracy of ray tracing according to the obtained maximum error.

[0031] The beneficial effects achieved by adopting the above technical solution are:

[0032] 1. The present invention converts ray tracing applications into floating-point calculation expressions, providing a new approach for ray tracing accuracy verification.

[0033] 2. The present invention reduces the detection interval of the expression extracted by the ray tracing application and improves the detection efficiency. First, the sub-expression extracted from the floating-point calculation expression is converted into an equation and then solved. Then, the solution screening rule is determined through conditional number analysis to obtain a feasible solution and construct a high error interval. Only the high error interval needs to be error detected, and there is no need to detect the entire detection interval, which greatly reduces the detection range and improves the detection efficiency.

[0034] 3. The present invention first converts the problem of verifying the accuracy of ray tracing into the problem of detecting floating-point expression errors extracted from the ray tracing application, and then regards the floating-point expression error detection as an interval reasoning problem rather than a search problem. This overcomes the limitations of the search algorithm in dynamic detection of floating-point programs, namely, the problems of high time overhead and missing the maximum error, and can provide guiding information for subsequent improvement of the accuracy of ray tracing. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings of the embodiments of the present invention, wherein the drawings are only used to illustrate some embodiments of the present invention, but not to limit all embodiments of the present invention thereto.

[0036] Figure 1 It is one of the flow charts of the method for detecting the accuracy of ray tracing based on the high error interval of floating point calculation expression according to an embodiment of the present invention;

[0037] Figure 2 This is a second flow chart of a method for detecting ray tracing accuracy based on a high error interval of a floating point calculation expression according to an embodiment of the present invention;

[0038] Figure 3 is a diagram showing an example structure of an abstract syntax tree according to an embodiment of the present invention;

[0039] Figure 4 This is an example diagram of extracting sub-expressions from an abstract syntax tree according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings of specific embodiments of the present invention to clearly and completely describe the exemplary scheme of the embodiment of the present invention. Unless otherwise defined, the technical terms or scientific terms used in the present invention should be the common meanings understood by people with ordinary skills in the field.

[0041] This embodiment discloses a ray tracing accuracy detection method based on a high error interval of a floating point calculation expression, such as Figure 1 and Figure 2 As shown, the following steps are included:

[0042] Step S101: extract floating-point calculation expressions from a ray tracing application, and parse the floating-point calculation expressions into an abstract syntax tree (AST).

[0043] Suppose a floating point expression is extracted from a ray tracing application: Assume that the detection interval is [-100000, 100000].

[0044] Parsing floating-point calculation expressions into abstract syntax trees is done by parsing expressions into a syntax tree through lexical analysis and syntax analysis. The syntax tree contains two different nodes: operands and operators. The constructed abstract syntax tree structure is as follows: Figure 3 shown.

[0045] Step S102: extract multiple sub-expressions from the abstract syntax tree, and construct each sub-expression into an equation.

[0046] For the entire floating-point calculation expression, the expression that only contains part of the calculation is called a sub-expression. After extracting these sub-expressions, they are constructed into corresponding equations according to the operators.

[0047] In this example, 7 sub-expressions can be obtained from the abstract syntax tree, such as Figure 4 As shown, they are: ①x+1.0 These sub-expressions are considered as expressions that may trigger high errors.

[0048] The above 7 sub-expressions are constructed into the following equations:

[0049]

[0050] Step S103: Solve the constructed equation, and then obtain feasible solutions through solution screening rules, that is, obtain potential high error points.

[0051] First, the equation obtained in step S102 is input to a solver developed based on the sympy library for solution calculation, and then the corresponding equation solution screening rules are designed for different operators through conditional number analysis (as shown in Table 1). For example, the sin function may have multiple solutions in an interval, but only the required number of feasible solutions are retained after solution screening. After solution screening according to the solution screening rules, the solution set is deduplicated.

[0052] Table 1 Solution screening rules

[0053]

[0054] The final solutions are: x1=-1, x2=+∞, x3=-∞, x4=-2, x5=1, which are potential high error points.

[0055] Step S104: Generate a high error interval according to the potential high error point, perform error detection on each derived high error interval, and obtain the maximum error.

[0056] Generating a high error interval means generating a test interval near the solution of the equation. Because the solution is a concept in the real number domain, it is necessary to generate a part of corresponding points in the floating point domain, and the size of the interval is consistent with the distribution law of floating point numbers. The closer to the origin, the denser it is, and the farther away from the origin, the sparser it is.

[0057] Generate a high error interval based on potential high error points, and the calculation formula is as follows:

[0058]

[0059] Among them, abs is the absolute value function, interval is the generated high error interval, x is the solution of the equation, lb is the lower bound of the interval of the expression f(x), ub is the upper bound of the interval of the expression f(x), and ε is the neighborhood size for generating the high error interval, because a neighborhood near the solution is required to generate the high error interval.

[0060] The five points obtained in step S103 correspond to five high error intervals:

[0061]

[0062] Large-scale sampling is performed on each derived high error interval, and the test case generation method is uniform sampling, that is, M test cases are uniformly generated in the interval. Specifically, large-scale sampling is performed on the above 5 high error intervals, and the total number of sampling points is 500,000. The number of sampling points in each interval is: 500,000 / 5=100,000. Uniform sampling is performed on each interval, and then the error value under each test case is calculated using the ULP error calculation formula shown below, and the maximum error is selected. The test case that triggers the maximum error obtained by this floating-point calculation expression is x=-0.9999231248343890, and the maximum relative error is 4.69E-16, which is converted into a ULP error of 4.71ULP. For floating point numbers, only when the error is less than 2ULP can it be considered that there is no error. The error result of 4.71ULP indicates that the ray tracing application has an error in the test case of x = -0.9999231248343890, which will reduce the correctness of ray tracing and provide guidance information for subsequent ray tracing optimization. The error measurement standard used in this embodiment is ULP error. In the field of floating point calculation, the minimum precision unit ULP is usually used as the error measurement standard. For a floating point expression z = (-1) s ×d0d1…d n ×2 E And its actual value, minimum precision unit ULP and ULP error (error ulp ) can be expressed as:

[0063]

[0064]

[0065] Wherein, f(x0) represents the calculated value of the floating-point expression extracted from the ray tracing application when f(x) is x=x0, i.e., the floating-point calculation result; o((fx0)) represents the exact value of the floating-point expression extracted from the ray tracing application when f(x) is x=x0, i.e., the real number calculation result, ULP(·) represents the minimum precision unit, s(sign) is the sign bit, d0d1...d n is the mantissa (significand), that is, the effective digits of z, n is the length of the effective digits, that is, the precision of the floating point number, and E (exponent) is the exponent.

[0066] Step S105: Determine the accuracy of ray tracing according to the maximum error obtained in step S104.

[0067] The accuracy of ray tracing is judged based on the maximum error. The larger the maximum error, the less accurate the ray tracing, and the smaller the maximum error, the more accurate the ray tracing.

[0068] Corresponding to the above method, this embodiment also discloses a ray tracing accuracy detection system based on a high error interval of a floating-point calculation expression, comprising an expression extraction module, an equation construction module, an equation solving module, an error detection module and a judgment module, wherein:

[0069] The expression extraction module is used to extract floating-point calculation expressions from the ray tracing application and parse the floating-point calculation expressions into an abstract syntax tree.

[0070] The equation construction module is used to extract multiple sub-expressions from the abstract syntax tree and construct each sub-expression into an equation.

[0071] The equation solving module is used to solve the constructed equations and then obtain feasible solutions through solution screening rules, that is, to obtain potential high error points.

[0072] The error detection module is used to generate a high error interval according to the potential high error point, and perform error detection on each derived high error interval to obtain the maximum error.

[0073] The judgment module is used to judge the accuracy of ray tracing according to the obtained maximum error.

[0074] By comparing with the three most advanced and widely used dynamic detection tools known so far, these three tools are S3FP, ATOMU and EIFFEL, among which S3FP detects errors through random sampling, Atomu searches based on atomic state functions, and EIFFEL infers error intervals through clustering and polynomial fitting. The maximum relative error obtained by the present invention for this expression in the interval [-100000, 100000] is 4.69E-16, and the result reported by S3fp is 9.11E-17, which is better than S3fp; ATOMU did not search out a maximum error in this interval, that is, no error result was reported, and it is obvious that the detection effect is better than ATOMU; the error reported by the EIFFEL tool is a relative error. For this expression, the result reported by EIFFEL is 3.94E-16, which is better than EIFFEL. It can be seen that the ray tracing accuracy detection method based on conditional number analysis to infer the high error interval of the expression is better than the existing detection method, and the accuracy of the ray tracing technology can be judged according to the maximum error.

[0075] Unless otherwise specifically stated, the relative steps, numerical expressions and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present invention.

[0076] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0077] The units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person of ordinary skill in the art may use different methods to implement the described functions for each specific application, but such implementation is not considered to be beyond the scope of the present invention.

[0078] Those skilled in the art will appreciate that all or part of the steps in the above method can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, such as a read-only memory, a disk or an optical disk. Optionally, all or part of the steps in the above embodiment can also be implemented using one or more integrated circuits, and accordingly, each module / unit in the above embodiment can be implemented in the form of hardware or in the form of software function modules. The present invention is not limited to any specific form of combination of hardware and software.

[0079] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A method for detecting the accuracy of ray tracing based on the high error interval of floating point calculation expressions, characterized in that: Include: Extract floating-point calculation expressions from the ray tracing application, and parse the floating-point calculation expressions into an abstract syntax tree; Extract multiple sub-expressions from the abstract syntax tree, and construct each sub-expression into an equation; Solve the constructed equations, and then obtain feasible solutions through solution screening rules, that is, obtain potential high error points; Generate a high error interval according to the potential high error points, perform error detection on each derived high error interval, and obtain the maximum error; The accuracy of ray tracing is judged based on the maximum error obtained.

2. The ray tracing accuracy detection method based on the high error interval of floating point calculation expression according to claim 1 is characterized in that: Parsing a floating-point calculation expression into an abstract syntax tree is to parse the expression into a syntax tree through lexical analysis and syntax analysis. The syntax tree contains two different nodes: operands and operators.

3. The ray tracing accuracy detection method based on the high error interval of floating point calculation expression according to claim 1 is characterized in that: Extract multiple sub-expressions: For the entire floating-point calculation expression, the expression that only contains part of the calculation is called a sub-expression. After extracting all the sub-expressions, they are constructed into corresponding equations according to the operators.

4. The ray tracing accuracy detection method based on the high error interval of floating point calculation expression according to claim 1 is characterized in that: Solve the constructed equations, and then obtain feasible solutions through solution screening rules, that is, obtain potential high error points, including: first use the solver developed based on the sympy library to solve the extracted equations, and then analyze the conditional number to design corresponding equation solution screening rules for different operators. After screening the solutions according to the above rules, remove duplicates from the solution set; the solution screening rules are as follows: The solution after deduplication is the potential high error point.

5. The ray tracing accuracy detection method based on the high error interval of floating point calculation expression according to claim 1 is characterized in that: The high error interval is generated based on the potential high error point. The calculation formula is as follows: Among them, abs is the absolute value function, interval is the generated high error interval, x is the solution of the equation, lb is the lower bound of the interval of the expression f(x), ub is the upper bound of the interval of the expression f(x), and ε is the neighborhood size for generating the high error interval.

6. The ray tracing accuracy detection method based on the high error interval of floating point calculation expression according to claim 5, characterized in that: Error detection is performed on each derived high error interval to obtain the maximum error, including: large-scale sampling is performed on each high error interval, the total number of samples is M, uniform sampling is performed on the interval to generate M test cases, the error value under each test case is calculated using the ULP error calculation formula, and the maximum error is selected.

7. The method for detecting the accuracy of ray tracing based on the high error interval of floating point calculation expression according to claim 6, characterized in that: The ULP error calculation formula is as follows: Wherein, f(x0) represents the calculated value of the floating-point expression extracted from the ray tracing application when f(x) is at x=x0, that is, the floating-point calculation result; o((fx0)) represents the exact value of the floating-point expression extracted from the ray tracing application when f(x) is at x=x0, that is, the real number calculation result, and ULP(·) represents the minimum precision unit.

8. The ray tracing accuracy detection method based on the high error interval of floating point calculation expression according to claim 1, characterized in that: The accuracy of ray tracing is judged based on the maximum error. The larger the maximum error, the less accurate the ray tracing, and the smaller the maximum error, the more accurate the ray tracing.

9. A ray tracing accuracy detection system based on high error interval of floating point calculation expression, characterized in that: It includes expression extraction module, equation construction module, equation solving module, error detection module and judgment module, among which: An expression extraction module, used to extract floating-point calculation expressions from a ray tracing application and parse the floating-point calculation expressions into an abstract syntax tree; An equation construction module, used for extracting multiple sub-expressions from the abstract syntax tree and constructing each sub-expression into an equation; The equation solving module is used to solve the constructed equations and then obtain feasible solutions through solution screening rules, that is, to obtain potential high error points; An error detection module is used to generate a high error interval according to potential high error points, and perform error detection on each derived high error interval to obtain a maximum error; The judgment module is used to judge the accuracy of ray tracing according to the obtained maximum error.

10. An electronic device, characterized in that: include: at least one processor, and a memory coupled to the at least one processor; The memory stores a computer program, and the computer program can be executed by the at least one processor to implement the method according to any one of claims 1 to 8.