Interpolation approximation-based transcendental function calculation system and method, chip and terminal equipment
By adopting interpolation approximation method in the transcendent function computing system, the problem that transcendent function calculation in the prior art cannot reduce costs while ensuring accuracy, and achieve high-precision and low-cost computing suitable for all transcendent functions.
Patent Information
- Application Number
- CN202480002156.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-02-11
AI Technical Summary
Existing transcendent function calculation methods cannot reduce costs while ensuring accuracy and cannot be applied to all transcendent functions.
A transcendent function calculation system based on interpolation approximation is adopted, which includes a single-precision floating-point number calculation module and a semi-precision floating-point number calculation module, and the transcendent function is calculated through the interpolation approximation method.
It realizes transcendent function calculations that reduce costs while ensuring high precision, and can be applicable to various transcendent functions, meeting the requirements of processor chips and their interface APIs.
Smart Images

Figure CN119422125A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing and artificial intelligence technology, and in particular to a transcendental function calculation system and method based on interpolation approximation, a chip and a terminal device. Background Art
[0002] Existing processor chips and their interface API (Application Programming Interface) have relatively strict accuracy requirements for floating-point calculations of transcendental functions, especially reciprocal operations, square root operations, floating-point division operations, trigonometric functions, etc.
[0003] At present, Newton iteration method, CORDIC algorithm and lookup table method are usually used to realize the calculation of transcendental functions. Among them, although Newton iteration method has very good convergence in transcendental function calculation and can achieve high precision, it is difficult to realize the calculation of transcendental functions such as logarithmic functions and trigonometric functions; in addition, with the improvement of iteration precision, the bit width required for floating-point multiplication operation in Newton iteration method also increases rapidly, resulting in the need for very large floating-point multipliers and adders to complete iterations. Although CORDIC algorithm can deal with the calculation of trigonometric functions relatively well, it also requires multiple iterations and is difficult to deal with other common transcendental functions, so its application range is relatively narrow. Although the lookup table method can achieve good precision and small area overhead, it is difficult to achieve the precision requirements required by processor chips and their interface APIs in high-precision calculations, such as the precision required by the standards and protocols used by GPU (Graphics Processing Unit, graphics processor) and its API (such as OpenCL3.0 (Open Computing Language, open computing language), Direct3D12 (a low-level graphics application programming API)). Summary of the invention
[0004] The purpose of the present invention is to provide a transcendental function calculation system and method, chip and terminal device based on interpolation approximation to solve the problem that the existing transcendental function calculation method cannot reduce the cost while ensuring accuracy and can be applicable to all transcendental functions.
[0005] In order to solve the above technical problems, the present invention provides a transcendental function calculation system based on interpolation approximation, comprising: An input module, used for inputting a floating point number with a preset number of digits, wherein the floating point number includes a single-precision floating point number and a half-precision floating point number; The single-precision floating-point number calculation module is used to perform transcendental function calculation on the input floating-point number in the calculation mode of single-precision floating-point multiplication, and output the calculation result in half-precision floating-point format; A half-precision floating-point number calculation module is used to perform transcendental function calculation on the input floating-point number in a half-precision floating-point multiplication manner and output the calculation result in a half-precision floating-point format; An output module is used to output the calculation results of the single-precision floating-point number calculation module and the half-precision floating-point number calculation module.
[0006] Optionally, in the transcendental function calculation system based on interpolation approximation, the single-precision floating-point number calculation module includes a single-precision floating-point converter, a mantissa corrector, a mantissa interpolator, an order calculator, a first single-precision floating-point multiplier generator, a second single-precision floating-point multiplier generator, a single-precision floating-point multiplier and a half-precision floating-point converter; the single-precision floating-point converter is used to convert the input half-precision floating-point number into a single-precision floating-point format; the mantissa corrector is used to correct the mantissa of the single-precision floating-point number converted by the single-precision floating-point converter; the mantissa interpolator is used to interpolate the mantissa corrected by the mantissa corrector; the order calculator Used to obtain the order of the single-precision floating-point number converted by the single-precision floating-point converter; the first single-precision floating-point multiplier generator is used to generate a first single-precision floating-point multiplier according to the output result of the mantissa interpolator and the output result of the order calculator; the second single-precision floating-point multiplier generator is used to generate a second single-precision floating-point multiplier according to the single-precision floating-point number converted by the single-precision floating-point converter; the single-precision floating-point multiplier is used to perform floating-point multiplication operations on the first single-precision floating-point multiplier and the second single-precision floating-point multiplier; the half-precision floating-point converter is used to convert the calculation result of the single-precision floating-point multiplier into a half-precision floating-point number.
[0007] Optionally, in the transcendental function calculation system based on interpolation approximation, the single-precision floating-point converter is used to convert the input half-precision floating-point number into a single-precision floating-point number of order 8.
[0008] Optionally, in the transcendental function calculation system based on interpolation approximation, the half-precision floating-point number calculation module includes a half-precision floating-point exponent expander, a mantissa corrector, a mantissa interpolator, an order calculator, a first extended half-precision floating-point multiplier generator, a second half-precision floating-point multiplier generator, a half-precision floating-point multiplier and a half-precision floating-point converter; the half-precision floating-point exponent expander is used to expand the order of the input half-precision floating-point number to a preset position; the mantissa corrector is used to correct the mantissa of the half-precision floating-point number expanded by the half-precision floating-point exponent expander; the mantissa interpolator is used to interpolate the mantissa corrected by the mantissa corrector; the order calculator Used to obtain the order of the half-precision floating-point number expanded by the half-precision floating-point order expander; the first extended half-precision floating-point multiplier generator is used to generate a first half-precision floating-point multiplier according to the output result of the mantissa interpolator and the output result of the order calculator; the second half-precision floating-point multiplier generator is used to generate a second half-precision floating-point multiplier according to the half-precision floating-point number expanded by the half-precision floating-point order expander; the half-precision floating-point multiplier is used to perform floating-point multiplication operations on the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; the half-precision floating-point converter is used to convert the calculation result of the half-precision floating-point multiplier into a half-precision floating-point number.
[0009] Optionally, in the transcendental function calculation system based on interpolation approximation, the half-precision floating-point order expander is used to expand the order of the input half-precision floating-point number to 6 bits.
[0010] Optionally, in the transcendental function calculation system based on interpolation approximation, the half-precision floating-point order expander is used to determine whether the non-regularized order of the input half-precision floating-point number is 0; if the non-regularized order is not 0, a preset order is added to the original order to obtain a new order, and a half-precision floating-point number after order expansion is obtained; if the non-regularized order is 0, a leading 0 calculation is performed, and the half-precision floating-point number is regularized according to the calculation result to obtain a half-precision floating-point number after order expansion.
[0011] Optionally, in the transcendental function calculation system based on interpolation approximation, the regularization processing step includes: Let the result of the leading 0 calculation be S; Shift the mantissa of the input half-precision floating-point number left by S, and subtract S from the preset order to get the new order; The converted half-precision floating-point number is obtained based on the left-shifted mantissa and the new exponent.
[0012] Optionally, in the transcendental function calculation system based on interpolation approximation, the half-precision floating-point multiplier includes an input unit, an order calculation unit, a mantissa calculation unit, a multiplication matrix unit, a divisibility unit and an output unit; the input unit is used to input the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; the order calculation unit is used to calculate the order of the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; the mantissa calculation unit is used to calculate the mantissa of the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; the multiplication matrix unit is used to perform floating-point multiplication operations according to the mantissa calculated by the mantissa calculation unit; the divisibility unit is used to round off the bit width of the floating-point number according to the divisibility flag; and the output unit is used to output the final floating-point multiplication operation result according to the rounding result of the divisibility unit and the order calculated by the order calculation unit.
[0013] Optionally, in the transcendental function calculation system based on interpolation approximation, the input unit includes two input terminals, wherein the bit width of one input terminal includes several bits of mantissa and 1 bit of implied 1, and the bit width of the other input terminal includes several bits of mantissa and 1 bit of implied 1, and the orders of the two input terminals are the same; the output terminal bit width of the output unit is maximum 33 bits and 1 bit of implied 1.
[0014] Optionally, in the transcendental function calculation system based on interpolation approximation, the transcendental function calculation system based on interpolation approximation also includes a half-precision divisibility checker, which is used to perform an integer divisibility check on the single-precision floating-point multiplier of the single-precision floating-point number calculation module and the half-precision floating-point multiplier of the half-precision floating-point number calculation module according to the floating-point number received by the input module to obtain an integer divisibility flag.
[0015] Optionally, in the transcendental function calculation system based on interpolation approximation, when the mantissa corrector corrects the mantissa, If the transcendental function is a trigonometric function, the trigonometric function is contracted to the preset domain, and the mantissa is corrected according to the mantissa of the floating-point number in the preset domain; If the transcendental function is a logarithmic function, the mantissa of the output value of the logarithmic function is corrected so that the mantissa reaches the accuracy requirement when it is close to 0; If the transcendental function is an exponential function, separate the integer part and the decimal part of the true value of the exponential function, and use the decimal part to calculate the mantissa to correct the mantissa; If the transcendental function is a square root related function, the mantissa is corrected according to the parity of the square root related function; If the transcendental function is a reciprocal function, the mantissa does not need to be corrected; If the transcendental function is a division function, the mantissa does not need to be corrected. Alternatively, if the dividend can be expressed as the product of an integer multiple of the divisor and a power of 2, the dividend is first rounded to retain a preset mantissa, and then rounded to the nearest half-precision floating-point even number to correct the mantissa.
[0016] Optionally, in the transcendental function calculation system based on interpolation approximation, the mantissa interpolator is used to perform secondary interpolation on the mantissa corrected by the mantissa corrector, wherein the calculation formula of the secondary interpolation is:
[0017] Among them, a, b and c are interpolation coefficients, which are generated by the high bits of the corrected mantissa through a lookup table; x is the low bits of the corrected mantissa, It is the bitwise inversion of x.
[0018] Optionally, in the transcendental function calculation system based on interpolation approximation, the number of bits of the floating-point number input by the input module is 32 bits; and the number of bits of the floating-point number output by the output module is 32 bits.
[0019] In order to solve the above technical problems, the present invention further provides a transcendental function calculation method based on interpolation approximation, which is applied to the transcendental function calculation system based on interpolation approximation as described in any one of the above items, and the transcendental function calculation method based on interpolation approximation includes: Construct a transcendental function calculation system; Inputting a floating point number with a preset number of digits into a transcendental function calculation system, wherein the floating point number includes a single-precision floating point number and a half-precision floating point number; Using the transcendental function calculation system, the input floating-point number is subjected to transcendental function calculation in the calculation method of single-precision floating-point multiplication, and the calculation result is output in half-precision floating-point format; using the transcendental function calculation system, the input floating-point number is subjected to transcendental function calculation in the calculation method of half-precision floating-point multiplication, and the calculation result is output in half-precision floating-point format.
[0020] In order to solve the above technical problems, the present invention further provides a chip, wherein the chip integrates the transcendental function calculation system based on interpolation approximation as described in any of the above items.
[0021] In order to solve the above technical problem, the present invention also provides a terminal device, including the chip as described above.
[0022] The transcendental function calculation system and method based on interpolation approximation, chip and terminal device provided by the present invention can perform high-precision and high-performance operations on single-precision floating-point numbers and half-precision floating-point numbers through a single-precision floating-point calculation module and a half-precision floating-point calculation module, which meets the requirements of the processor chip and its interface API. Not only can the transcendental function calculation method reduce costs while ensuring accuracy, but it can also be applied to various transcendental functions. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A structural block diagram of a transcendental function calculation system based on interpolation approximation provided in this embodiment; Figure 2 A schematic diagram of the internal structure of a transcendental function calculation system based on interpolation approximation provided in this embodiment; Figure 3 A schematic diagram of the structure of a half-precision floating-point multiplier provided in this embodiment; Figure 4 A comparison diagram of the calculation process of the single-precision floating-point number calculation module and the half-precision floating-point number calculation module provided in this embodiment; Figure 5 A schematic diagram of a transcendental function calculation method based on interpolation approximation provided in this embodiment; Figure 6 A schematic diagram of a process of performing mantissa interpolation calculation by the mantissa interpolator provided in this embodiment; Figure 7 A schematic diagram of a logic flow of regularizing a half-precision floating-point number by a half-precision floating-point order expander provided in this embodiment; Figure 8 A schematic diagram of the process of performing floating-point multiplication operation by the half-precision floating-point multiplier provided in this embodiment; The descriptions of the reference numerals are as follows: 100 - input module; 200-single precision floating point calculation module; 210-single precision floating point converter; 220-mantissa corrector; 230-mantissa interpolator; 240-order calculator; 250-first single precision floating point multiplier generator; 260-second single precision floating point multiplier generator; 270-single precision floating point multiplier; 280-half precision floating point converter; 300-half-precision floating-point calculation module; 310-half-precision floating-point order expander; 320-mantissa corrector; 330-mantissa interpolator; 340-order calculator; 350-first extended half-precision floating-point multiplier generator; 360-second half-precision floating-point multiplier generator; 370-half-precision floating-point multiplier; 371-input unit; 372-order calculation unit; 373-mantissa calculation unit; 374-multiplication matrix unit; 375-divisibility unit; 376-output unit; 380-half-precision floating-point converter; 400-output module; 500 - Half-precision divisibility checker. DETAILED DESCRIPTION
[0024] The transcendental function calculation system and method based on interpolation approximation, chip and terminal device proposed by the present invention are further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the accompanying drawings are all in a very simplified form and use non-precise proportions, which are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention. In addition, the structure shown in the accompanying drawings is often part of the actual structure. In particular, the emphasis that each drawing needs to show is different, and sometimes different proportions are used.
[0025] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present invention are used to distinguish similar objects in order to describe the embodiments of the present invention, rather than to describe a specific order or sequence. It should be understood that the structures used in this way can be interchanged under appropriate circumstances. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] A standard floating point number consists of three parts: sign, exponent, and mantissa. A single-precision floating point number consists of a 1-bit sign, an 8-bit exponent, and a 23-bit mantissa, and its dynamic range is [2 -127 ,2 128 ); while the half-precision floating point number includes 1 bit of sign, 5 bits of exponent and 10 bits of mantissa, its dynamic range under the regularization representation is [2 -15 ,2 16 ).
[0027] At present, taking GPU as an example, the mainstream API of GPU has strict precision calculation requirements on the formats of single-precision floating-point numbers and half-precision floating-point numbers, and requires that half-precision floating-point numbers must support an order of all 0, that is, a non-normalized format with a dynamic range of [2 -24 ,2 -15).
[0028] For floating-point numbers, their accuracy mainly depends on the mantissa, while the order provides the dynamic range. Specifically, the bit width of the mantissa determines the relative accuracy of the floating-point number, that is, the accuracy value represented by the lowest bit; the order affects the absolute accuracy of the floating-point number through the actual power bias.
[0029] Based on this, this embodiment provides a transcendental function calculation system based on interpolation approximation, such as Figure 1 As shown, it includes: an input module 100, used for inputting a floating-point number with a preset number of bits, the floating-point number includes a single-precision floating-point number and a half-precision floating-point number; a single-precision floating-point number calculation module 200, used for performing transcendental function calculation on the input floating-point number in the calculation mode of single-precision floating-point multiplication, and outputting the calculation result in a half-precision floating-point format; a half-precision floating-point number calculation module 300, used for performing transcendental function calculation on the input floating-point number in the calculation mode of half-precision floating-point multiplication, and outputting the calculation result in a half-precision floating-point format; an output module 400, used for outputting the calculation results of the single-precision floating-point number calculation module and the half-precision floating-point number calculation module, the calculation results are floating-point numbers, the floating-point number includes a single-precision floating-point number and a half-precision floating-point number.
[0030] The transcendental function calculation system based on interpolation approximation provided in this embodiment can perform high-precision and high-performance operations on single-precision floating-point numbers and half-precision floating-point numbers through the single-precision floating-point calculation module 200 and the half-precision floating-point calculation module 300, which meets the requirements of the processor chip and its interface API. It not only enables the transcendental function calculation method to reduce costs while ensuring accuracy, but also can be applied to various transcendental functions.
[0031] In this embodiment, the number of bits of the floating-point number input by the input module is 32 bits; the number of bits of the floating-point number output by the output module is 32 bits. Of course, in other embodiments, the number of bits of the floating-point number input and the number of bits of the floating-point number output can be any other number of bits, which is not specifically limited in this application.
[0032] Specifically, in this embodiment, if Figure 2 As shown, the single-precision floating-point number calculation module 200 includes a single-precision floating-point converter 210, a mantissa corrector 220, a mantissa interpolator 230, an order calculator 240, a first single-precision floating-point multiplier generator 250, a second single-precision floating-point multiplier generator 260, a single-precision floating-point multiplier 270, and a half-precision floating-point converter 280.
[0033] The input end of the single-precision floating-point converter 210 is connected to the output end of the input module 100, and is used to convert the input half-precision floating-point number into a single-precision floating-point format; the input end of the mantissa corrector 220 is connected to the output end of the single-precision floating-point converter 210, and is used to correct the mantissa of the single-precision floating-point number converted by the single-precision floating-point converter 210; the input end of the mantissa interpolator 230 is connected to the output end of the mantissa corrector 220, and is used to interpolate the mantissa corrected by the mantissa corrector 220; the input end of the order calculator 240 is connected to the output end of the single-precision floating-point converter 210, and is used to obtain the order of the single-precision floating-point number converted by the single-precision floating-point converter 210; the input end of the first single-precision floating-point multiplier generator 250 is connected to the output end of the mantissa interpolator 230 and the output end of the order calculator 240. The first single-precision floating-point multiplier generator 250 and the second single-precision floating-point multiplier generator 260 are connected to each other for generating a first single-precision floating-point multiplier according to an output result of the mantissa interpolator 230 and an output result of the order calculator 240; the second single-precision floating-point multiplier generator 260 has an input end connected to an output end of the single-precision floating-point converter 210 for generating a second single-precision floating-point multiplier according to the single-precision floating-point number converted by the single-precision floating-point converter 210; the single-precision floating-point multiplier 270 has an input end connected to an output end of the first single-precision floating-point multiplier generator 250 and an output end of the second single-precision floating-point multiplier generator 260 for performing floating-point multiplication operations on the first single-precision floating-point multiplier and the second single-precision floating-point multiplier; the half-precision floating-point converter 280 has an input end connected to an output end of the single-precision floating-point multiplier 270 for converting a calculation result of the single-precision floating-point multiplier 270 into a half-precision floating-point number.
[0034] In practical applications, if the input module 100 inputs a 32-bit single-precision floating-point number, it can be directly sent to the single-precision floating-point calculation module 200, and the single-precision floating-point converter 210 does not need to perform single-precision floating-point conversion on it; if the input is a 16-bit half-precision floating-point number, it is necessary to use the single-precision floating-point converter 210 to convert it into a single-precision floating-point format, that is, to expand it to an 8-bit order to convert the non-regularized half-precision floating-point input into a regularized single-precision floating-point format.
[0035] And, in this embodiment, if Figure 2 As shown, the half-precision floating-point number calculation module 300 includes a half-precision floating-point exponent expander 310, a mantissa corrector 320, a mantissa interpolator 330, an exponent calculator 340, a first extended half-precision floating-point multiplier generator 350, a second half-precision floating-point multiplier generator 360, a half-precision floating-point multiplier 370 and a half-precision floating-point converter 380.
[0036] The input end of the half-precision floating-point exponent expander 310 is connected to the output end of the input module 100, and is used to expand the exponent of the input half-precision floating-point number to a preset position; the input end of the mantissa corrector 320 is connected to the output end of the half-precision floating-point exponent expander 310, and is used to correct the mantissa of the half-precision floating-point number expanded by the half-precision floating-point exponent expander 310; the input end of the mantissa interpolator 330 is connected to the output end of the mantissa corrector 320, and is used to interpolate the mantissa corrected by the mantissa corrector 320; the input end of the order calculator 340 is connected to the output end of the half-precision floating-point exponent expander 310, and is used to obtain the order of the half-precision floating-point number expanded by the half-precision floating-point exponent expander 310; the input end of the first extended half-precision floating-point multiplier generator 350 is connected to the output end of the mantissa interpolator 330 and the input end of the order calculator 340. The output end of the second half-precision floating-point multiplier generator 360 is connected to the output end of the half-precision floating-point order expander 310, and is used to generate a second half-precision floating-point multiplier according to the half-precision floating-point number expanded by the half-precision floating-point order expander 310; the input end of the half-precision floating-point multiplier 370 is connected to the output end of the first extended half-precision floating-point multiplier generator 350 and the output end of the second half-precision floating-point multiplier generator 360, and is used to perform floating-point multiplication operations on the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; the input end of the half-precision floating-point converter 380 is connected to the output end of the half-precision floating-point multiplier 370, and is used to convert the calculation result of the half-precision floating-point multiplier 370 into a half-precision floating-point number.
[0037] In practical applications, since the order of half-precision floating-point numbers is 5, the minimum denormalization number that can be supported is 2 -24 When the order of the input half-precision floating-point number is expanded to 6 bits by the half-precision floating-point order expander 310, the minimum regularization number it can support is 2 -30 , at this time, all non-regularized inputs can be converted to regularized floating-point format.
[0038] Specifically, the half-precision floating-point exponent expander 310 provided in this embodiment determines whether the non-regularized order of the input half-precision floating-point number is 0 when performing order expansion; if the non-regularized order is not 0, a preset order is added to the original order to obtain a new order, and the half-precision floating-point number after order expansion is obtained; if the non-regularized order is 0, a leading 0 calculation is performed, and the half-precision floating-point number is regularized according to the calculation result, and the half-precision floating-point number after order expansion is obtained.
[0039] Among them, the steps of regularization processing include: first, set the result of the leading 0 calculation to S; then, shift the mantissa of the input half-precision floating point number left by S, and subtract S from the preset order to obtain a new order; finally, obtain the converted half-precision floating point number based on the mantissa after left shift and the new order.
[0040] Furthermore, in order to further improve the computing power of the floating-point division function, in this embodiment, a complete single-precision floating-point multiplier is used in the single-precision floating-point number calculation module 200. Since the single-precision floating-point multiplier 270 can also be used to implement half-precision floating-point transcendental function calculation, the half-precision floating-point division implemented by the single-precision floating-point operation circuit has a half-precision floating-point operation accuracy far exceeding that specified by the GPU API.
[0041] Furthermore, in order to ensure that the half-precision floating-point division operation can obtain the same high precision, in the present embodiment, in the half-precision floating-point number calculation module 300, a special floating-point multiplier having a bit width greater than that of the standard half-precision floating-point division is designed specifically for the half-precision floating-point division, namely, the half-precision floating-point multiplier 370. Figure 3 As shown, the half-precision floating-point multiplier 370 includes an input unit 371, an order calculation unit 372, a mantissa calculation unit 373, a multiplication matrix unit 374, a divisibility unit 375, and an output unit 376; the input unit 371 is used to input a first half-precision floating-point multiplier and a second half-precision floating-point multiplier; the input end of the order calculation unit 372 is connected to the output end of the input unit 371, and is used to calculate the order of the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; the input end of the mantissa calculation unit 373 is connected to the output end of the input unit 371, and is used to calculate the order of the first half-precision floating-point multiplier and the second half-precision floating-point multiplier. The mantissa of the half-precision floating-point multiplier; the input end of the multiplication matrix unit 374 is connected to the output end of the mantissa calculation unit 373, and is used to perform floating-point multiplication according to the mantissa calculated by the mantissa calculation unit 373; the input end of the integer division unit 375 is connected to the output end of the multiplication matrix unit 374, and is used to round off the bit width of the floating-point number according to the integer division flag; the input end of the output unit 376 is connected to the output end of the order calculation unit 372 and the output end of the integer division unit 375, and is used to output the final floating-point multiplication result according to the rounding result of the integer division unit 375 and the order calculated by the order calculation unit 372.
[0042] In actual applications, the bit width of one input terminal of the half-precision floating-point multiplier 370 includes several bits of mantissa and 1 implicit 1, and the bit width of the other input terminal includes several bits of mantissa and 1 implicit 1, and the orders of the two input terminals are the same, and the maximum bit width of the output terminal is 33 bits and 1 implicit 1.
[0043] In a specific embodiment, one input bit width of the half-precision floating-point multiplier 370 includes a 22-bit mantissa and 1 implicit 1, and the other input is a 10-bit mantissa of a standard half-precision floating-point number and 1 implicit 1, and the calculated output bit width is a maximum of 33 bits and 1 implicit 1. In order to support non-normalized half-precision floating-point numbers, the orders of these two input data are set to 6 bits. Figure 4 As shown, the transcendental function calculation system based on interpolation approximation provided in this embodiment can allow the half-precision floating-point number calculation module 300 and the single-precision floating-point number calculation module 200 to produce unequally identical calculation results in the secondary interpolation stage, but after the final output result is corrected by the half-precision floating-point multiplier 370, the half-precision floating-point number calculation module 300 and the single-precision floating-point number calculation module 200 have the same final calculated output result when the same input is used.
[0044] Preferably, in this embodiment, Figure 2 As shown, the transcendental function calculation system based on interpolation approximation also includes a half-precision divisibility checker 500, the input end of the half-precision divisibility checker 500 is connected to the input module 100, and the output end is connected to the single-precision floating-point multiplier 270 and the half-precision floating-point multiplier 370, and is used to perform an integer divisibility check on the single-precision floating-point multiplier 270 of the single-precision floating-point number calculation module 200 and the half-precision floating-point multiplier 370 of the half-precision floating-point number calculation module 300 according to the floating-point number received by the input module 100 to obtain an integer divisibility flag.
[0045] In addition, in this embodiment, the mantissa corrector 220, mantissa interpolator 230 and order calculator 240 in the single-precision floating-point number calculation module 200 can be the same as the mantissa corrector 320, mantissa interpolator 330 and order calculator 340 in the half-precision floating-point number calculation module 300, thereby reducing the development difficulty and workload of the transcendental function calculation system based on interpolation approximation.
[0046] Specifically, in this embodiment, when the mantissa corrector 220 / 320 corrects the mantissa, If the transcendental function is a trigonometric function, the trigonometric function is contracted to the preset domain, and the mantissa is corrected according to the mantissa of the floating-point number in the preset domain; If the transcendental function is a logarithmic function, the mantissa of the output value of the logarithmic function is corrected so that the mantissa reaches the accuracy requirement when it is close to 0; If the transcendental function is an exponential function, separate the integer part and the decimal part of the true value of the exponential function, and use the decimal part to calculate the mantissa to correct the mantissa; If the transcendental function is a square root related function, the mantissa is corrected according to the parity of the square root related function; If the transcendental function is a reciprocal function, the mantissa does not need to be corrected; If the transcendental function is a division function, the mantissa does not need to be corrected. Alternatively, if the dividend can be expressed as the product of an integer multiple of the divisor and a power of 2, the dividend is first rounded to retain a preset mantissa, and then rounded to the nearest half-precision floating-point even number to correct the mantissa.
[0047] And, the mantissa interpolator 230 / 330 is used to perform secondary interpolation on the mantissa corrected by the mantissa corrector, wherein the calculation formula of the secondary interpolation is:
[0048] Among them, a, b and c are interpolation coefficients, which are generated by the high bits of the corrected mantissa through a lookup table; x is the low bits of the corrected mantissa, It is the bitwise inversion of x.
[0049] This embodiment also provides a transcendental function calculation method based on interpolation approximation, such as Figure 5 As shown, the transcendental function calculation method based on interpolation approximation includes: S0, construct a transcendental function calculation system; S1, inputting a floating point number with a preset number of digits into a transcendental function calculation system; S2, using the transcendental function calculation system, performs transcendental function calculation on the input floating point number in the calculation method of single-precision floating point multiplication, and outputs the calculation result in half-precision floating point format; using the transcendental function calculation system, performs transcendental function calculation on the input floating point number in the calculation method of half-precision floating point multiplication, and outputs the calculation result in half-precision floating point format.
[0050] Specifically, in this embodiment, step S0 is to construct a transcendental function calculation system, which may be the transcendental function calculation system based on interpolation approximation mentioned above in this embodiment.
[0051] And, in this embodiment, step S1, inputting a floating point number of preset digits into the transcendental function calculation system, wherein the floating point number includes a single-precision floating point number and a half-precision floating point number. In practical applications, the floating point number can be one 32-bit single-precision floating point number or two half-precision floating point numbers.
[0052] Further, in this embodiment, step S2, using the transcendental function calculation system, the input floating point number is subjected to transcendental function calculation in the calculation mode of single-precision floating point multiplication, and the calculation result in half-precision floating point format is output; using the transcendental function calculation system, the input floating point number is subjected to transcendental function calculation in the calculation mode of half-precision floating point multiplication, and the calculation result in half-precision floating point format is output, wherein, The input floating point number is subjected to transcendental function calculation in the calculation mode of single-precision floating point multiplication, which can be implemented by using the single-precision floating point number calculation module 200, and the steps include: S211, converting the input floating point number into a single-precision floating point number.
[0053] Specifically, the single-precision floating-point converter 210 is used to convert the input half-precision floating-point number into a single-precision floating-point number with an order of 8, thereby converting the non-regularized half-precision floating-point input into a regularized single-precision floating-point format.
[0054] S212, performing mantissa correction and mantissa interpolation on the single-precision floating-point number in sequence to generate a first single-precision floating-point multiplier.
[0055] Specifically, in this embodiment, the method of performing mantissa correction using the mantissa corrector 220 includes: If the transcendental function is a trigonometric function, due to its periodicity, the trigonometric function can be contracted to a preset domain, which is usually small, and the mantissa is corrected according to the mantissa of the floating-point number in the preset domain; If the transcendental function is a logarithmic function, since the order of the input value only affects the integer part of the output result, its highest accuracy requirement occurs when the input value is 1, that is, when the output value is close to 0; if the accurate mantissa can meet the accuracy requirement when the output value is close to 0, then the accuracy requirement can definitely be met when it deviates from 0, so the mantissa of the output value of the logarithmic function when it is close to 0 is made to meet the accuracy requirement to correct the mantissa; If the transcendental function is an exponential function, the integer part and the decimal part of the true value of the exponential function are separated, wherein the integer part is equivalent to the order of the output result, and the decimal part is used to calculate the mantissa to correct the mantissa; If the transcendental function is a square root related function, the mantissa is corrected according to the parity of the square root related function; If the transcendental function is a reciprocal function, the mantissa does not need to be corrected; If the transcendental function is a division function, the mantissa does not need to be corrected, or, if the dividend can be expressed as the product of an integer multiple of the divisor and a power of 2, the dividend is first rounded to retain a preset mantissa, and then rounded to the nearest half-precision floating point even number to correct the mantissa. The preset mantissa can be 19.
[0056] This embodiment can ensure that the final calculation result meets the accuracy requirements of the processor and its interface API by correcting the output mantissa of the transcendental function.
[0057] And, in this embodiment, the method of performing mantissa interpolation using the mantissa interpolator includes: performing secondary interpolation on the corrected mantissa, wherein the calculation formula of the secondary interpolation is:
[0058] Among them, a, b and c are interpolation coefficients, which are generated by the high bits of the corrected mantissa through a lookup table; x is the low bits of the corrected mantissa, It is the bitwise inversion of x.
[0059] like Figure 6 As shown, the coefficient lookup table (constant coefficient lookup table, first-order coefficient lookup table and second-order coefficient lookup table) is used to look up the coefficients of the high bits in the corrected mantissa, the middle low bits in the mantissa are shifted using the lookup table coefficients corresponding to the middle high bits, the lowest bit in the mantissa is inverted and then shifted, and finally the lookup table coefficient corresponding to the highest bit in the mantissa and the shift results of other bits are concatenated to obtain the mantissa after quadratic interpolation.
[0060] Since the use of a lookup table for coefficient lookup requires a very large lookup table, which is unacceptable for chip area, this embodiment uses a relatively small number of high bits as the index value of the lookup table in the above manner, and the remaining low bits are used to interpolate the gaps in the lookup table to produce the corresponding results. Since the actual precision requirement for transcendental function calculation of half-precision floating-point numbers is much lower than that of single-precision floating-point numbers, this embodiment only uses a lookup table with a smaller bit width for the half-precision floating-point number circuit to ensure the calculation accuracy requirement.
[0061] In order to generate the first single-precision floating-point multiplier, not only the output result of the mantissa interpolator is needed, but also the order of the converted single-precision floating-point number needs to be obtained by using the order calculator. In this embodiment, the order here is 8. Afterwards, the result of the mantissa interpolation and the order are combined and assembled to obtain the first multiplier of the floating-point multiplication.
[0062] S213, performing a floating-point multiplication operation using the second single-precision floating-point multiplier and the first single-precision floating-point multiplier to obtain a single-precision operation result.
[0063] Specifically, in order to improve the computing power of the floating-point division function, in this embodiment, the floating-point multiplication operation is completed with one instruction using the single-precision floating-point multiplier 270. For single-precision floating-point division calculation, the reciprocal of the divisor and the dividend can be multiplied to achieve it. In this embodiment, a complete single-precision floating-point multiplier is used to achieve the division operation.
[0064] Since the single-precision floating-point calculation module can also be used to implement half-precision floating-point transcendental function calculations, the half-precision floating-point division implemented using it has a half-precision floating-point operation accuracy far exceeding that specified by the GPU API.
[0065] S214, converting the single-precision operation result into a half-precision floating point number.
[0066] The specific implementation method of the single-precision floating-point number calculation module of this embodiment is similar to the prior art. Those skilled in the art can obtain it based on the disclosure of this application and the prior art, and it will not be repeated here.
[0067] At the same time, the half-precision floating point calculation module 300 is used to perform the following calculation: S221, converting the input floating point number into a half-precision floating point number.
[0068] Specifically, since the original half-precision floating-point number has an order of 5, in order to convert it from a non-regularized input to a regularized floating-point format, its order is expanded to 6 bits, so that the minimum regularization number it can support is 2. -30 .
[0069] In this embodiment, if Figure 7 As shown, the method for converting an input floating-point number into a half-precision floating-point number includes: determining whether the non-regularized order of the input half-precision floating-point number is 0; if the non-regularized order is not 0, adding a preset order to the original order to obtain a new order, when the preset order is 16, the new order can be expressed as: new order = 16 + original order, and then obtaining the converted half-precision floating-point number, that is, the result of order expansion; if the non-regularized order is 0, performing a leading 0 calculation, and regularizing the half-precision floating-point number according to the calculation result, wherein the result of the leading 0 calculation is set to S, the mantissa of the input half-precision floating-point number is left-shifted by S, and S is subtracted from the preset order to obtain a new order, when the preset order is 16, the new order can be expressed as: new order = 16-S; the converted half-precision floating-point number is obtained according to the mantissa after the left shift and the new order.
[0070] S222, performing mantissa correction and mantissa interpolation on the half-precision floating-point number in sequence to generate a first half-precision floating-point multiplier.
[0071] Among them, the method of mantissa correction, mantissa interpolation and generating the first half-precision floating-point multiplier is similar to that in step S212, and will not be repeated in this application.
[0072] Preferably, in order to further reduce the bit width of the transcendental function coefficient lookup table and the bit width of the fixed-point multiplier required for quadratic interpolation, and to ensure calculation accuracy, in the present embodiment, when the transcendental function is a division function, if the dividend can be expressed as the product of an integer multiple of the divisor and a power of 2, that is, an integer division in floating-point format, the dividend is first rounded to retain a preset mantissa, and then rounded to the nearest half-precision floating-point even number to correct the mantissa.
[0073] S223, performing a floating-point multiplication operation using the second half-precision floating-point multiplier and the first half-precision floating-point multiplier to obtain a half-precision operation result.
[0074] Specifically, in this embodiment, first, a half-precision floating-point multiplier 370 is constructed, and the bit width of one input terminal of the half-precision floating-point multiplier 370 includes several bits of mantissa and 1 bit of implicit 1, and the bit width of the other input terminal includes several bits of mantissa and 1 bit of implicit 1, and the order of the two input terminals is consistent, and the maximum bit width of the output terminal is 33 bits and 1 bit of implicit 1. In a specific embodiment, the bit width of one input terminal of the half-precision floating-point multiplier 370 includes 22 bits of mantissa and 1 bit of implicit 1, and the bit width of the other input terminal includes 10 bits of mantissa and 1 bit of implicit 1, and the order of the two inputs is 6 bits, and the maximum output bit width is 33 bits and 1 bit of implicit 1.
[0075] Then, the second half-precision floating-point multiplier and the first half-precision floating-point multiplier are input into the half-precision floating-point multiplier 370 for floating-point multiplication to obtain a half-precision operation result. Figure 8 As shown, a 32-bit single-precision floating-point number, a 29-bit half-precision floating-point number, or a 17-bit half-precision floating-point number is input into one input end of the half-precision floating-point multiplier 370, and a 28-bit half-precision floating-point number or a 17-bit half-precision floating-point number is input into the other input end; the order calculation and the mantissa calculation are performed on the floating-point numbers input into the two input ends respectively, wherein the mantissa calculation results of the input end that can support single-precision floating-point numbers include: a single-precision mantissa of 24×24 bits and a half-precision mantissa of 22×11 bits, and the half-precision mantissa of the input end that only supports half-precision floating-point numbers is 22×11 bits; the two calculated mantissas are respectively sent to a 24×12-bit multiplication matrix for operation.
[0076] Afterwards, obtain the integer divisibility flag. Specifically, the half-precision integer divisibility checker 500 can be used to perform an integer divisibility check on the single-precision operation result and the half-precision operation result according to the input floating-point number to obtain the integer divisibility flag, and the value of the integer divisibility flag is 0 or 1; if the integer divisibility flag is 1, the half-precision mantissa obtained by the multiplication matrix operation is rounded to a preset position, for example, the half-precision mantissa is rounded to 19 bits; if the integer divisibility flag is 0, the half-precision mantissa obtained by the multiplication matrix operation is maintained; if the original input is single precision, it is rounded to single precision 24 bits; if the original input is half precision, it is rounded to half precision 11 bits × 2; according to the final mantissa, a 32-bit single-precision floating-point number or two 16-bit half-precision floating-point numbers are generated.
[0077] S224, converting the half-precision operation result into a half-precision floating point number.
[0078] Since the calculation result of the half-precision floating-point multiplier is rounded according to the integer divisibility flag, the final output result can be corrected so that when the input is the same, the final output result of the half-precision floating-point calculation module is consistent with the calculation result of the single-precision floating-point calculation module.
[0079] The transcendental function calculation method based on interpolation approximation provided in this embodiment can perform high-performance operations on transcendental functions such as reciprocal function, square root function, reciprocal square root function, sine function, cosine function, logarithmic function, exponential function, inverse tangent function, floating-point division function, etc. The transcendental function calculation method based on interpolation approximation provided in this embodiment can expand the input of half-precision floating-point transcendental function calculation to the range of non-regularized half-precision floating-point numbers, and expand the half-precision floating-point input range and precision; the transcendental function calculation method based on interpolation approximation provided in this embodiment realizes full-precision half-precision floating-point division calculation, and broadens the application scope of the transcendental function calculation system; the transcendental function calculation method based on interpolation approximation provided in this embodiment has a precision that can meet the requirements of the processor chip and its interface API.
[0080] This embodiment also provides a chip, which integrates the above-mentioned transcendental function calculation system based on interpolation approximation. In practical applications, the chip can be a processor chip such as GPU (Graphics Processing Unit), NPU (Neural Processing Unit), ISP (Image Signal Processing), VPU (Video Processing Unit), DPU (Display Processing Unit), etc.
[0081] This embodiment also provides a terminal device, including the above chip.
[0082] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other. In addition, the different parts between the various embodiments can also be used in combination with each other, and the present invention is not limited to this.
[0083] The transcendental function calculation system and method based on interpolation approximation, chip and terminal device provided in this embodiment include: an input module for inputting a floating-point number of preset digits, the floating-point number includes a single-precision floating-point number and a half-precision floating-point number; a single-precision floating-point number calculation module for performing transcendental function calculation on the input floating-point number in the calculation mode of single-precision floating-point multiplication, and outputting the calculation result in half-precision floating-point format; a half-precision floating-point number calculation module for performing transcendental function calculation on the input floating-point number in the calculation mode of half-precision floating-point multiplication, and outputting the calculation result in half-precision floating-point format; an output module for outputting the calculation results of the single-precision floating-point number calculation module and the half-precision floating-point number calculation module, the calculation result is a floating-point number, the floating-point number includes a single-precision floating-point number and a half-precision floating-point number. The single-precision floating-point number calculation module and the half-precision floating-point number calculation module can perform high-precision and high-performance calculations on single-precision floating-point numbers and half-precision floating-point numbers, which meets the requirements of the processor chip and its interface API, not only enabling the transcendental function calculation method to reduce costs while ensuring accuracy, but also being applicable to various transcendental functions.
[0084] The above description is only a description of the preferred embodiments of the present invention, and is not intended to limit the scope of the present invention. Any changes or modifications made by a person skilled in the art in the field of the present invention based on the above disclosure shall fall within the scope of protection of the claims.
Claims
1. A transcendental function calculation system based on interpolation approximation, characterized in that: include: An input module, used for inputting a floating point number with a preset number of digits, wherein the floating point number includes a single-precision floating point number and a half-precision floating point number; The single-precision floating-point number calculation module is used to perform transcendental function calculation on the input floating-point number in the calculation mode of single-precision floating-point multiplication, and output the calculation result in half-precision floating-point format; A half-precision floating-point number calculation module is used to perform transcendental function calculation on the input floating-point number in a half-precision floating-point multiplication manner and output the calculation result in a half-precision floating-point format; An output module is used to output the calculation results of the single-precision floating-point number calculation module and the half-precision floating-point number calculation module.
2. The transcendental function calculation system based on interpolation approximation according to claim 1, characterized in that: The single-precision floating-point number calculation module includes a single-precision floating-point converter, a mantissa corrector, a mantissa interpolator, an order calculator, a first single-precision floating-point multiplier generator, a second single-precision floating-point multiplier generator, a single-precision floating-point multiplier and a half-precision floating-point converter; The single-precision floating-point converter is used to convert the input half-precision floating-point number into a single-precision floating-point format; The mantissa corrector is used to correct the mantissa of the single-precision floating-point number converted by the single-precision floating-point converter; The mantissa interpolator is used to interpolate the mantissa corrected by the mantissa corrector; The order calculator is used to obtain the order of the single-precision floating-point number converted by the single-precision floating-point converter; The first single-precision floating-point multiplier generator is used to generate a first single-precision floating-point multiplier according to an output result of the mantissa interpolator and an output result of the order calculator; The second single-precision floating-point multiplier generator is used to generate a second single-precision floating-point multiplier according to the single-precision floating-point number converted by the single-precision floating-point converter; The single-precision floating-point multiplier is used to perform a floating-point multiplication operation on the first single-precision floating-point multiplier and the second single-precision floating-point multiplier; The half-precision floating-point converter is used to convert the calculation result of the single-precision floating-point multiplier into a half-precision floating-point number.
3. The transcendental function calculation system based on interpolation approximation according to claim 2, characterized in that: The single-precision floating-point converter is used to convert an input half-precision floating-point number into a single-precision floating-point number with an order of 8.
4. The transcendental function calculation system based on interpolation approximation according to claim 1, characterized in that: The half-precision floating-point number calculation module includes a half-precision floating-point order expander, a mantissa corrector, a mantissa interpolator, an order calculator, a first extended half-precision floating-point multiplier generator, a second half-precision floating-point multiplier generator, a half-precision floating-point multiplier and a half-precision floating-point converter; The half-precision floating point order expander is used to expand the order of the input half-precision floating point number to a preset position; The mantissa corrector is used to correct the mantissa of the half-precision floating-point number expanded by the half-precision floating-point exponent expander; The mantissa interpolator is used to interpolate the mantissa corrected by the mantissa corrector; The order calculator is used to obtain the order of the half-precision floating-point number expanded by the half-precision floating-point order expander; The first extended half-precision floating-point multiplier generator is used for generating a first half-precision floating-point multiplier according to an output result of the mantissa interpolator and an output result of the order calculator; The second half-precision floating-point multiplier generator is used to generate a second half-precision floating-point multiplier according to the half-precision floating-point number expanded by the half-precision floating-point exponent expander; The half-precision floating-point multiplier is used to perform a floating-point multiplication operation on the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; The half-precision floating-point converter is used to convert the calculation result of the half-precision floating-point multiplier into a half-precision floating-point number.
5. The transcendental function calculation system based on interpolation approximation according to claim 4, characterized in that: The half-precision floating-point order expander is used to expand the order of an input half-precision floating-point number to 6 bits.
6. The transcendental function calculation system based on interpolation approximation according to claim 4, characterized in that: The half-precision floating-point order expander is used to determine whether the non-regularized order of the input half-precision floating-point number is 0; if the non-regularized order is not 0, a preset order is added to the original order to obtain a new order, and a half-precision floating-point number after order expansion is obtained; if the non-regularized order is 0, a leading 0 calculation is performed, and the half-precision floating-point number is regularized according to the calculation result, and the half-precision floating-point number after order expansion is obtained.
7. The transcendental function calculation system based on interpolation approximation according to claim 6, characterized in that: The steps of the regularization process include: Let the result of the leading 0 calculation be S; Shift the mantissa of the input half-precision floating-point number left by S, and subtract S from the preset order to get the new order; The converted half-precision floating-point number is obtained based on the left-shifted mantissa and the new exponent.
8. The transcendental function calculation system based on interpolation approximation according to claim 4, characterized in that: The half-precision floating-point multiplier comprises an input unit, an order calculation unit, a mantissa calculation unit, a multiplication matrix unit, a divisibility unit and an output unit; The input unit is used for inputting the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; The order calculation unit is used to calculate the orders of the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; The mantissa calculation unit is used to calculate the mantissas of the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; The multiplication matrix unit is used for performing floating-point multiplication operation according to the mantissa calculated by the mantissa calculation unit; The integer division unit is used to round off the bit width of the floating point number according to the integer division flag; The output unit is used to output a final floating-point multiplication result according to the rounding result of the integer division unit and the order calculated by the order calculation unit.
9. The transcendental function calculation system based on interpolation approximation according to claim 8, characterized in that: The input unit includes two input terminals, wherein the bit width of one input terminal includes a number of bits of mantissa and 1 bit of implicit 1, and the bit width of the other input terminal includes a number of bits of mantissa and 1 bit of implicit 1, and the orders of the two input terminals are consistent; the output terminal bit width of the output unit is a maximum of 33 bits and 1 bit of implicit 1.
10. The transcendental function calculation system based on interpolation approximation according to claim 8, characterized in that: The transcendental function calculation system based on interpolation approximation also includes a half-precision divisibility checker, which is used to perform an integer divisibility check on the single-precision floating-point multiplier of the single-precision floating-point number calculation module and the half-precision floating-point multiplier of the half-precision floating-point number calculation module according to the floating-point number received by the input module to obtain an integer divisibility flag.
11. The transcendental function calculation system based on interpolation approximation according to any one of claims 2 to 10, characterized in that: When the mantissa corrector corrects the mantissa, If the transcendental function is a trigonometric function, the trigonometric function is contracted to the preset domain, and the mantissa is corrected according to the mantissa of the floating-point number in the preset domain; If the transcendental function is a logarithmic function, the mantissa of the output value of the logarithmic function is corrected so that the mantissa reaches the accuracy requirement when it is close to 0; If the transcendental function is an exponential function, separate the integer part and the decimal part of the true value of the exponential function, and use the decimal part to calculate the mantissa to correct the mantissa; If the transcendental function is a square root related function, the mantissa is corrected according to the parity of the square root related function; If the transcendental function is a reciprocal function, the mantissa does not need to be corrected; If the transcendental function is a division function, the mantissa does not need to be corrected. Alternatively, if the dividend can be expressed as the product of an integer multiple of the divisor and a power of 2, the dividend is first rounded to retain a preset mantissa, and then rounded to the nearest half-precision floating-point even number to correct the mantissa.
12. The transcendental function calculation system based on interpolation approximation according to any one of claims 2 to 10, characterized in that: The mantissa interpolator is used to perform secondary interpolation on the mantissa corrected by the mantissa modifier, wherein the calculation formula of the secondary interpolation is: Among them, a, b and c are interpolation coefficients, which are generated by the high bits of the corrected mantissa through a lookup table; x is the low bits of the corrected mantissa, It is the bitwise inversion of x.
13. The transcendental function calculation system based on interpolation approximation according to claim 1, characterized in that: The number of bits of the floating-point number input by the input module includes 32 bits; the number of bits of the floating-point number output by the output module includes 32 bits.
14. A transcendental function calculation method based on interpolation approximation, characterized in that: include: Construct a transcendental function calculation system; Inputting a floating point number with a preset number of digits into a transcendental function calculation system, wherein the floating point number includes a single-precision floating point number and a half-precision floating point number; Using a transcendental function calculation system, a transcendental function calculation is performed on an input floating point number in a single-precision floating point multiplication calculation mode, and a calculation result is output in a half-precision floating point format; The transcendental function calculation system is used to perform transcendental function calculation on the input floating point number in the calculation mode of half-precision floating point multiplication, and the calculation result is output in half-precision floating point format.
15. A chip, characterized in that: The chip integrates a transcendental function calculation system based on interpolation approximation as described in any one of claims 1 to 13.
16. A terminal device, characterized in that: Comprising the chip as claimed in claim 15.