CN115393167A - Double-precision data truncation calculation structure in graphics processor and calculation method thereof - Google Patents
Double-precision data truncation calculation structure in graphics processor and calculation method thereof Download PDFInfo
- Publication number
- CN115393167A CN115393167A CN202211002002.5A CN202211002002A CN115393167A CN 115393167 A CN115393167 A CN 115393167A CN 202211002002 A CN202211002002 A CN 202211002002A CN 115393167 A CN115393167 A CN 115393167A
- Authority
- CN
- China
- Prior art keywords
- precision
- calculation
- data
- truncation
- requirement
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/20—Processor architectures; Processor configuration, e.g. pipelining
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/60—Memory management
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Image Generation (AREA)
Abstract
The invention belongs to the technical field of computer hardware, and relates to a double-precision data truncation calculation structure in a graphics processor and a calculation method thereof, wherein the use principle of the method is as follows: 1) When data input is confirmed, errors are introduced; 2) Confirming the calculation precision required by the post-stage calculation; 3) According to the input and the subsequent-stage calculation precision proportion, the truncation deviation proportion is confirmed, so that the direction of data truncation is enabled, and the percentage truncation can be controlled. The method solves the error influence caused by data precision in the fields of graphic images and the like, and can efficiently avoid the influence caused by the precision error of the preceding stage calculation after double-precision selection.
Description
Technical Field
The invention relates to the technical field of computer hardware, in particular to data calculation in a Graphic Processor Unit (GPU) in the field of graphic image processing, and particularly relates to a calculation method for double-precision data truncation in a graphic processor.
Background
In the field of graphic images, a graphic processor plays an important role, the calculation related to various primitives in graphic display is completed by the graphic processor, the adopted calculation data formats are different for different attribute calculations, the geometric stage has higher requirement on precision, and floating point operation is adopted; in the pixel stage, the requirement for precision is slightly reduced, and fixed point number calculation is adopted. However, in any data format, it is a key point for data accuracy control. Therefore, there is a need in the art for an accuracy data truncation algorithm that achieves a trade-off in data accuracy while meeting the computational accuracy requirements.
Disclosure of Invention
Based on the technical problems in the background art, the present invention provides a method for calculating truncation of double-precision data in a graphics processor, which uses the following principles: 1) When data input is confirmed, errors are introduced; 2) Confirming the calculation precision required by the post-stage calculation; 3) And confirming the truncation deviation proportion according to the input and later-stage calculation precision ratio, thereby determining the data truncation direction and controllable percentage truncation. The technical scheme provided by the invention can meet different precision requirements through the precision control unit, different implementation modes are selected, and the precision calculation unit can realize corresponding precision selection operation according to the selection result of the precision implementation modes. The method solves the error influence caused by data precision in the fields of graphic images and the like, and can efficiently avoid the influence caused by the precision error of the preceding stage calculation after double-precision selection and selection.
The technical solution of the invention is as follows: a double-precision data truncation calculation structure in a graphics processor is characterized in that: the device comprises a data input unit, a precision control logic unit, a data selection logic unit and a precision calculation logic unit;
the data input unit is binary, and if the input data is a decimal number or a hexadecimal data source, the data needs to be converted;
the precision control logic unit configures a precision mode selection signal according to the actual application requirement and the design precision requirement;
the data selection logic unit is used for selecting bit segments needing precision calculation;
the precision calculation logic unit is calculation logic for realizing precision, and after the multi-bit section corresponding to the calculation precision is selected, the unit performs logic operation on data and finally data.
A calculation method based on a double-precision data truncation calculation structure in a graphic processor is characterized in that: the method comprises the following steps:
step 1: when data input is confirmed, errors are introduced due to the truncating operation of the previous stage;
step 2: confirming the required precision of the post-stage module for the input data calculation;
and step 3: according to the input and post-stage calculation precision ratio, confirming whether the data is larger or smaller due to truncation of the pre-stage data, and accordingly determining the trend of truncation of the data at the present stage;
if the loss of the data is 0-0.25 due to preceding stage truncation, when the data is subjected to double-precision truncation judgment, the data can be judged according to two-bit binary numbers near precision bits, and a truncation area is divided into four segments and is specifically determined according to the loss of the digital precision.
In the calculation process of the graphics processor, fixed point addition operation is used, and a precision calculation logic unit is required to be used for the precision requirement when calculation is carried out and after the precision requirement is determined;
in the calculation process of the graphics processor, fixed-point multiplication operation is used, and a precision calculation logic unit is required to be used for the precision requirement when calculation is carried out and after the precision requirement is determined;
in the calculation process of the graphic processor, the fixed-point division operation is used, and when the calculation is carried out, after the precision requirement is determined, a precision calculation logic unit is required to be used for the precision requirement;
in the calculation process of the graphics processor, floating point addition operation is used, and when calculation is carried out, after the precision requirement is determined, a precision calculation logic unit is required to be used for the precision requirement.
In the graph calculation process, the data format can be in a multi-style mode, multiple data bit widths are supported, reasonable precision deviation is selected according to the distribution characteristics of data, zero-leaning selection and selection can be achieved, zero-leaning selection and selection are carried out, and a precision control unit and a precision calculation unit need to be used.
The invention has the advantages that: the invention is from the technical field of computer hardware, can be used in multiple fields, can solve the corresponding problems in the process of high-precision data calculation, improves the data calculation precision and enables the calculation result to be more suitable for the reality.
Drawings
FIG. 1 is a diagram of the overall implementation of the accuracy control and calculation of the present invention;
FIG. 2 is a diagram of a configuration of a precision control unit in the configuration of the present invention;
fig. 3 is a unit for calculating accuracy in the structure of the present invention.
Detailed Description
The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings and the specific embodiments. It is obvious that the described embodiments are only a part of the embodiments of the present invention, rather than the whole embodiments, and that all other embodiments, which can be derived by a person skilled in the art without inventive step based on the embodiments of the present invention, belong to the scope of protection of the present invention.
The calculation involves various data precisions, including fixed point number processing, floating point number processing and the like, and the method can be used for processing how to adopt proper precision.
In the processing of the point primitive, when the coordinates and all attributes carried by the point primitive are calculated, precision truncation is reasonably used according to calculation resources, so that the precision control requirement needs to be transmitted.
In the process of processing the line graphics primitive, when the coordinates and all attributes carried by the line graphics primitive are calculated, the accuracy requirement needs to be transmitted according to the calculation resources and the accuracy requirement.
In the process of processing the line strip graphics primitive, when the coordinates and all attributes carried by the line strip graphics primitive are calculated, the accuracy requirement needs to be transmitted according to the calculation resources and the accuracy requirement.
In the processing of the line ring primitive, when the common point in the coordinate is calculated, the higher precision requirement needs to transmit the stricter precision control requirement.
In the process of processing the triangle primitives, parameters required for filling the triangle primitives are calculated, and reasonable precision control is required according to different calculation objects and different precision requirements and resources of calculation.
In the processing of the triangle with the primitives, parameters required for filling the triangle primitives are calculated, particularly for the calculation of the common point of two adjacent triangles, the precision is extremely strict, the precision requirements are different according to different calculation objects, and reasonable precision control is required according to resources possessed by the calculation.
In the process of processing the triangle fan primitives, parameters required for filling the triangle primitives are calculated, particularly for the calculation of the common point of two adjacent triangles, the precision is extremely strict, and reasonable precision control is required according to the calculation objects and the precision requirements, and the resources of the calculation.
In the processing of the quadrilateral primitives, for various operations involved in the graph calculation process, the precision requirements are required, and the precision control unit is used for performing precision control according to the calculation precision requirements.
In the processing of the quadrilateral strip primitives, for various operations involved in the calculation process of the graph, the precision requirement is required to be sent to a precision control unit according to the precision requirement of each calculation, and the precision control unit is used for carrying out precision control.
In the process of processing the quadrilateral fan graphics primitives, for various operations involved in the calculation process of the graph, the accuracy requirement needs to be sent to an accuracy control unit according to the accuracy requirement of each calculation, and the accuracy control unit is used for performing accuracy control.
In the graphic calculation process, the data format can be multi-bit, 16bit, 32bit, 64bit, 256bit and various extension bits, and when various data are calculated, the precision selection is all used by a precision control unit and a precision calculation unit.
The dot pattern is used for scanning control, a scanning area needs to be calculated, a scanning circle area needs to be calculated after anti-aliasing is started, and a precision control selection and precision calculation unit needs to be used for truncating precision calculation results involved in the calculation process.
When the line graphics primitives are subjected to graphics primitive calculation, interpolation coefficients required by a Bresenham algorithm are mainly provided, wherein fixed point and floating point operations are involved, and for various precision calculation results, selection and rejection are required according to data format requirements, and precision control and precision calculation units are required;
when the line zone primitive is calculated, besides the calculation precision requirement of the interpolation coefficient, the problem of common point errors needs to be considered, the errors are large, two adjacent lines are not connected, and drawing errors occur, so that truncation needs to be performed according to strict calculation precision, and the precision truncation requirement needs to be improved.
When the line ring primitive is calculated, besides the calculation precision requirement of the interpolation coefficient, the problem of common point errors needs to be considered, the errors are large, two adjacent lines are not connected, and drawing errors occur, so that truncation needs to be performed according to strict calculation precision, and the precision truncation requirement needs to be improved.
During the calculation of the triangle primitive, the calculation of a side function, the calculation of an attribute interpolation coefficient, the calculation of coordinates, colors, texture attributes, fog attributes and the like are involved, the anti-aliasing function is started, the perspective correction function, the polygon offset and other functions are started, the attribute precision of the graph calculation needs to be strictly controlled, and when data truncation is carried out, a precision control unit and precision calculation logic need to be used.
When the triangle with the primitive is calculated, besides the functions of side function calculation, attribute interpolation coefficient calculation, coordinate, color, texture attribute, fog attribute and the like, starting the anti-aliasing function, starting the perspective correction function, polygon offset and the like, the accuracy of the calculated attribute of the graph is strictly controlled, the calculation accuracy of the common side is also considered, the graph calculation error caused by the separation of the common side is prevented, and an accuracy control unit and an accuracy calculation logic are used when data truncation is carried out.
Furthermore, the calculation accuracy of the center point of the triangle fan needs to be considered, so that the graph calculation error caused by the separation of the center point is prevented, and when data truncation is carried out, an accuracy control unit and an accuracy calculation logic need to be used.
When the quadrilateral strip primitive is calculated, besides the functions of side function calculation, attribute interpolation coefficient calculation, coordinate, color, texture attribute, fog attribute and the like, starting the anti-aliasing function, starting the perspective correction function, polygon offset and the like, the accuracy of the calculated attribute of the graph is strictly controlled, and the data accuracy problem caused by different quadrilateral midline calculation needs to be considered due to different splitting methods, and an accuracy control unit and an accuracy calculation logic need to be used.
Furthermore, the square strip also needs to consider the common edge calculation precision, so as to prevent graph calculation errors caused by common edge separation, and when data truncation is carried out, a precision control unit and precision calculation logic need to be used.
Furthermore, the quadrilateral fan also needs to consider the central point calculation precision to prevent the graph calculation error caused by the central point separation, and a precision control unit and a precision calculation logic need to be used when data truncation is carried out.
The precision control unit supports multi-region precision control distribution, can transmit precision control requirements according to data calculation characteristics in the field and the range possibly caused by errors, reasonably selects a precision calculation mode, and needs to use the precision calculation unit.
More specifically: as shown in fig. 1, a block diagram of the structure of the precision control and precision calculation is described. The method comprises four parts of data input, precision control requirement, data selection logic and precision calculation realization.
As shown in fig. 2, it is shown that reasonable data bits are selected for performing the accuracy control calculation according to the received accuracy control requirement. For example, 32-bit fixed-point data is input, the data format is 1; and the multi-bit can be selected for data precision calculation according to the error distribution of specific application data.
As shown in fig. 3, the accuracy of the single-bit or multi-bit is calculated according to the data bits selected by the data accuracy control unit, and how to calculate the accuracy is determined according to the distribution of the selected bits and the application data.
Finally, it should be noted that the above embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art; the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (3)
1. A double-precision data truncate calculation structure in a graphics processor, characterized in that: the device comprises a data input unit, a precision control logic unit, a data selection logic unit and a precision calculation logic unit;
the data input unit is a binary number, and if the input data is a decimal number or a hexadecimal data source, the data needs to be converted;
the precision control logic unit configures a precision mode selection signal according to the actual application requirement and the design precision requirement;
the data selection logic unit is used for selecting bit segments needing precision calculation;
the precision calculation logic unit is calculation logic for realizing precision, and after the multi-bit section corresponding to the calculation precision is selected, the unit performs logic operation on data and finally data.
2. A method for computing a double-precision data truncating computation structure in a graphics processor according to claim 1, wherein: the method comprises the following steps:
step 1: when data input is confirmed, errors are introduced due to preceding truncation operation;
step 2: confirming the required precision of the post-stage module for the input data calculation;
and step 3: according to the input and post-stage calculation precision ratio, confirming whether the data is larger or smaller due to the truncation of the preceding-stage data, and accordingly determining the trend of truncation of the present-stage data;
if the loss of the data due to pre-stage truncation is 0-0.25, when the double-precision truncation judgment is carried out on the data, the judgment can be carried out according to a two-bit binary number near a precision bit, and a truncation area is divided into four segments and is specifically determined according to the loss of the numerical precision.
3. The method of claim 2, wherein the double-precision data truncation calculation structure comprises: in the calculation process of the graphic processor, fixed point addition operation is used, and a precision calculation logic unit is required to be used for the precision requirement when calculation is carried out and after the precision requirement is determined;
in the calculation process of the graphic processor, fixed-point multiplication operation is used, and a precision calculation logic unit is required to be used for the precision requirement when calculation is carried out and after the precision requirement is determined;
in the calculation process of the graphic processor, the fixed-point division operation is used, and when the calculation is carried out, after the precision requirement is determined, a precision calculation logic unit is required to be used for the precision requirement;
in the calculation process of the graphic processor, floating point addition operation is used, and during calculation, after the precision requirement is determined, a precision calculation logic unit is required to be used for the precision requirement.
In the graph calculation process, the data format can be in a multi-style mode, multiple data bit widths are supported, reasonable precision deviation is selected according to the distribution characteristics of data, zero-leaning selection and selection can be achieved, zero-leaning selection and selection are carried out, and a precision control unit and a precision calculation unit need to be used.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211002002.5A CN115393167A (en) | 2022-08-20 | 2022-08-20 | Double-precision data truncation calculation structure in graphics processor and calculation method thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211002002.5A CN115393167A (en) | 2022-08-20 | 2022-08-20 | Double-precision data truncation calculation structure in graphics processor and calculation method thereof |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115393167A true CN115393167A (en) | 2022-11-25 |
Family
ID=84121303
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211002002.5A Pending CN115393167A (en) | 2022-08-20 | 2022-08-20 | Double-precision data truncation calculation structure in graphics processor and calculation method thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115393167A (en) |
-
2022
- 2022-08-20 CN CN202211002002.5A patent/CN115393167A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5862066A (en) | Methods and apparatus for fast check of floating point zero or negative zero | |
JP5294313B2 (en) | Bezier curve drawing device, Bezier curve drawing method and program | |
JP5657671B2 (en) | Tessellation engine and its application | |
US9829956B2 (en) | Approach to power reduction in floating-point operations | |
JP2910979B2 (en) | Method and apparatus for generating sub-pixel mask in computer graphic system | |
US7385611B1 (en) | Decompression of block encoded texture data | |
US20140354666A1 (en) | Vertex parameter data compression | |
US20200279415A1 (en) | Efficiently Computed Distance Fields | |
US7180518B2 (en) | Image processing apparatus, image processing system, and image processing method | |
US6865301B1 (en) | Reducing aliasing artifacts when shaping a digital image | |
US20230377265A1 (en) | Systems for Efficiently Rendering Vector Objects | |
CN115393167A (en) | Double-precision data truncation calculation structure in graphics processor and calculation method thereof | |
US6711603B1 (en) | Fractional, arithmetic unit, fractional arithmetic method, set-up engine for handling graphic images and computer-readable medium | |
US20080001966A1 (en) | Straight line drawing method, straight line drawing program and straight line drawing apparatus | |
US6559856B1 (en) | Apparatus for fixed-point graphics and method therefor | |
CN116700664B (en) | Method and device for determining square root of floating point number | |
US5303339A (en) | Three-dimensional graphic processing apparatus | |
CN116700666A (en) | Floating point number processing method and device | |
JP3384470B2 (en) | Numerical value conversion device and method, and coordinate value integer conversion device and method | |
TW202143163A (en) | Graphics processing unit and computer-implemented method | |
JPH09223243A (en) | Rendering method | |
US9911229B2 (en) | Transmission and configuration of three dimensional digital content | |
JP4198899B2 (en) | 3D graphics processing device | |
US20230368454A1 (en) | Graphics Processing Unit Instancing Control | |
WO2022021073A1 (en) | Multi-operator operation method and apparatus for neural network model |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |