Transcendental function computation system and method based on interpolation approximation, and chip and terminal device

The transcendental function calculation system based on interpolation approximation solves the problems of high hardware resource consumption and narrow applicability in existing technologies, and realizes high-precision and low-cost transcendental function calculation.

WO2026064993A1PCT designated stage Publication Date: 2026-04-02VERISILICON MICROELECTRONICS (SHANGHAI) CO LTD +4
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2026-04-02

AI Technical Summary

Technical Problem

Existing methods for calculating transcendental functions require a large amount of hardware resources and have a narrow range of applications, making it difficult to reduce costs while ensuring accuracy.

Method used

A transcendental function computation system based on interpolation approximation is adopted, including single-precision and half-precision floating-point calculation modules. High-precision calculation is achieved through interpolation and order processing, and it is suitable for various transcendental functions.

Benefits of technology

It reduces hardware costs while maintaining accuracy, and is applicable to all transcendental function calculations, meeting the requirements of processor chips and their interface APIs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024121175_02042026_PF_FP_ABST
    Figure CN2024121175_02042026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present invention are a transcendental function computation system and method based on interpolation approximation, and a chip and a terminal device. The method comprises: an input module inputting floating-point numbers having a preset number of bits; a single-precision floating-point number computation module performing transcendental function computation on the input floating-point numbers in the computation mode of single-precision floating-point multiplication, and outputting computation results in a half-precision floating-point format; a half-precision floating-point number computation module performing transcendental function computation on the input floating-point numbers in the computation mode of half-precision floating-point multiplication, and outputting computation results in a half-precision floating-point format; and an output module outputting the computation results. By means of a single-precision floating-point number computation module and a half-precision floating-point number computation module, high-precision and high-performance operations can be performed on single-precision floating-point numbers and half-precision floating-point numbers, such that the requirements of processor chips and their interface APIs are met, thereby enabling the transcendental function computation method to not only reduce costs while ensuring precision, but also be applicable to various types of transcendental functions.
Need to check novelty before this filing date? Find Prior Art

Description

Transcendental function calculation system and method based on interpolation approximation, chip and terminal device TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing and artificial intelligence, and particularly relates to a transcendent function calculation system and method based on interpolation approximation, a chip and a terminal device. BACKGROUND

[0002] The existing processor chip and its interface API (Application Programming Interface) have relatively strict accuracy requirements for floating-point calculation of transcendental functions, especially reciprocal operation, square root operation, floating-point division operation, and trigonometric functions.

[0003] Currently, Newton iteration method, CORDIC algorithm and lookup table method are usually used to realize the calculation of transcendental functions. Among them, Newton iteration method has very good convergence in the calculation of transcendental functions and can achieve high accuracy, but it is difficult to realize the calculation of logarithmic function and trigonometric function and other transcendental functions. In addition, with the improvement of iteration accuracy, the bit width required for floating-point multiplication operation in Newton iteration method increases rapidly, resulting in the need for very large floating-point multiplier and adder to complete iteration. CORDIC algorithm can better cope with the calculation of trigonometric functions, but it needs multiple iterations and is difficult to cope with other common transcendental functions, so its application range is narrow. Although the lookup table method can achieve good accuracy and has small area overhead, it is difficult to achieve the accuracy required by the processor chip and its interface API in high-precision calculation, such as the accuracy required by the standard and protocol (such as OpenCL3.0 (Open Computing Language), Direct3D12 (a bottom layer graphics application programming API)) applied by GPU (Graphics Processing Unit) and its API. TECHNICAL PROBLEM

[0004] The existing transcendental function calculation method not only needs to consume a large amount of hardware (such as floating-point multiplier and adder) to realize multiple iterations to ensure operation accuracy, but also has a narrow application range, and the calculation of some transcendental functions is difficult to realize. TECHNICAL SOLUTION

[0005] The present application relates to the technical field of data processing and artificial intelligence, and particularly relates to a transcendent function calculation system and method based on interpolation approximation, a chip and a terminal device.

[0006] To solve the above technical problems, the present application provides a kind of based on interpolation approximation Transcendental function computing system, comprising:

[0007] Input module, for inputting the floating point number of pre-set bit, the floating point number includes single precision floating point number and half precision floating point number;

[0008] Single precision floating point number calculation module, for the floating point number of input with single precision floating point multiplication calculation mode Transcendental function calculation is carried out, and the calculation result of half precision floating point format is output;

[0009] Half precision floating point number calculation module, for the floating point number of input with half precision floating point multiplication calculation mode Transcendental function calculation is carried out, and the calculation result of half precision floating point format is output;

[0010] Output module, for outputting the calculation result of single precision floating point number calculation module and half precision floating point number calculation module.

[0011] Optionally, in the based on interpolation approximation Transcendental function computing system, the single precision floating point number calculation module includes single precision floating point converter, tail number modifier, tail number interpolator, order calculator, first single precision floating point multiplier generator, second single precision floating point multiplier generator, single precision floating point multiplier and half precision floating point converter;The single precision floating point converter is used to convert the input half precision floating point number into single precision floating point format;The tail number modifier is used to modify the tail number of single precision floating point number converted by the single precision floating point converter;The tail number interpolator is used to interpolate the tail number after modification of the tail number modifier;The order calculator is used to obtain the order of 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 first single precision floating point multiplier according to the output result of the tail number interpolator and the output result of the order calculator;The second single precision floating point multiplier generator is used to generate 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 carry out floating point multiplication operation to 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 half precision floating point number.

[0012] Optionally, in the based on interpolation approximation Transcendental function computing system, the single precision floating point converter is used to convert the input half precision floating point number into single precision floating point number with order 8.

[0013] Optionally, in the transfinite function calculation system based on interpolation approximation, the half-precision floating point calculation module comprises a half-precision floating point exponent expander, a mantissa corrector, a mantissa interpolator, an exponent 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 configured to expand the exponent of the input half-precision floating point number to a preset bit; the mantissa corrector is configured to correct the mantissa of the half-precision floating point number expanded by the half-precision floating point exponent expander; the mantissa interpolator is configured to interpolate the mantissa corrected by the mantissa corrector; the exponent calculator is configured to obtain the exponent of the half-precision floating point number expanded by the half-precision floating point exponent expander; the first extended half-precision floating point multiplier generator is configured to generate a first half-precision floating point multiplier according to the output of the mantissa interpolator and the output of the exponent calculator; the second half-precision floating point multiplier generator is configured 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 configured to perform floating point multiplication operation on the first half-precision floating point multiplier and the second half-precision floating point multiplier; and the half-precision floating point converter is configured to convert the calculation result of the half-precision floating point multiplier into a half-precision floating point number.

[0014] Optionally, in the transfinite function calculation system based on interpolation approximation, the half-precision floating point exponent expander is configured to expand the exponent of the input half-precision floating point number to 6 bits.

[0015] Optionally, in the transfinite function calculation system based on interpolation approximation, the half-precision floating point exponent expander is configured to determine whether the un-normalized exponent of the input half-precision floating point number is 0; if the un-normalized exponent is not 0, a preset exponent is added to the original exponent to obtain a new exponent, and the half-precision floating point number after the expansion of the exponent is obtained; if the un-normalized exponent is 0, leading zero calculation is performed, and the half-precision floating point number is normalized according to the calculation result, and the half-precision floating point number after the expansion of the exponent is obtained.

[0016] Optionally, in the transfinite function calculation system based on interpolation approximation, the step of normalization comprises:

[0017] Let the result of the leading zero calculation be S;

[0018] The mantissa of the input half-precision floating point number is left shifted by S, and a new exponent is obtained by subtracting S from the preset exponent;

[0019] The converted half-precision floating point number is obtained according to the mantissa after the left shift and the new exponent.

[0020] Optionally, in the transfinite function calculation system based on interpolation approximation, the half-precision floating point multiplier comprises an input unit, an exponent calculation unit, a mantissa calculation unit, a multiplication matrix unit, an integer division unit and an output unit; the input unit is configured to input the first half-precision floating point multiplier and the second half-precision floating point multiplier; the exponent calculation unit is configured to calculate the exponents of the first half-precision floating point multiplier and the second half-precision floating point multiplier; the mantissa calculation unit is configured 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 configured to perform floating point multiplication operation according to the mantissas calculated by the mantissa calculation unit; the integer division unit is configured to round the bit width of the floating point number according to an integer division flag; and the output unit is configured to output the final floating point multiplication operation result according to the rounding result of the integer division unit and the exponents calculated by the exponent calculation unit.

[0021] Optionally, in the transfinite function calculation system based on interpolation approximation, the input unit comprises two input ends, one of which has a bit width comprising a number of mantissas and 1 bit of implicit 1, and the other of which has a bit width comprising a number of mantissas and 1 bit of implicit 1, and the exponents of the two input ends are consistent; and the bit width of the output end of the output unit is at most 33 bits and 1 bit of implicit 1.

[0022] Optionally, in the transfinite function calculation system based on interpolation approximation, the transfinite function calculation system based on interpolation approximation further comprises a half-precision integer division checker, which is configured to perform integer division checking 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 division flag.

[0023] Optionally, in the transfinite function calculation system based on interpolation approximation, when the mantissa modifier modifies the mantissa, the mantissa modifier is configured to,

[0024] if the transfinite function is a trigonometric function, the trigonometric function is contracted into a preset definition domain, and the mantissa is modified according to the mantissa of the floating point number in the preset definition domain;

[0025] if the transfinite function is a logarithmic function, the mantissa is modified so that the mantissa of the output value of the logarithmic function when approaching 0 meets the accuracy requirement;

[0026] if the transfinite function is an exponential function, the mantissa is modified by separating the integer part and the decimal part of the real value of the exponential function and calculating the mantissa using the decimal part;

[0027] if the transfinite function is a square root related function, the mantissa is modified according to the parity of the square root related function;

[0028] If the transcendental function is a reciprocal function, the mantissa does not need to be corrected;

[0029] If the transcendental function is a division function, the mantissa does not need to be corrected, or if the dividend can be expressed as an integer multiple of the divisor and a power of 2, the dividend is rounded to a preset bit mantissa, and then rounded to the nearest half-precision floating-point even number to correct the mantissa.

[0030] Optionally, in the transcendental function calculation system based on interpolation approximation, the mantissa interpolator is configured to perform secondary interpolation on the mantissa corrected by the mantissa corrector, and the calculation formula of the secondary interpolation is:

[0031]

[0032] wherein a, b and c are interpolation coefficients generated by the high bits of the corrected mantissa through a lookup table; x is the low bits of the corrected mantissa, and is the bitwise complement of x.

[0033] Optionally, in the transcendental function calculation system based on interpolation approximation, the floating-point number input by the input module has 32 bits; and the floating-point number output by the output module has 32 bits.

[0034] To solve the above technical problems, the present application 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 of the above, and the transcendental function calculation method based on interpolation approximation comprises:

[0035] constructing a transcendental function calculation system;

[0036] inputting a floating-point number with a preset number of bits to the transcendental function calculation system, wherein the floating-point number comprises a single-precision floating-point number and a half-precision floating-point number;

[0037] performing transcendental function calculation on the input floating-point number in a single-precision floating-point multiplication manner by using the transcendental function calculation system, and outputting a calculation result in a half-precision floating-point format; performing transcendental function calculation on the input floating-point number in a half-precision floating-point multiplication manner by using the transcendental function calculation system, and outputting a calculation result in a half-precision floating-point format.

[0038] To solve the above technical problems, the present application further provides a chip integrated with the transcendental function calculation system based on interpolation approximation as described in any of the above.

[0039] To solve the above technical problems, the present application further provides a terminal device comprising the chip as described above. Advantages

[0040] The transcendent function calculation system and method, chip and terminal device based on interpolation approximation provided by the application can perform high-precision and high-performance operation on single-precision floating point numbers and half-precision floating point numbers through the single-precision floating point number calculation module and the half-precision floating point number calculation module, meet the requirements of the processor chip and its interface API, not only make the transcendent function calculation method be able to reduce the cost while ensuring the precision, but also be applicable to various transcendent functions. BRIEF DESCRIPTION OF DRAWINGS

[0041] Fig. 1 is a structural block diagram of the transcendent function calculation system based on interpolation approximation provided by the embodiment;

[0042] Fig. 2 is a schematic diagram of the internal structure of the transcendent function calculation system based on interpolation approximation provided by the embodiment;

[0043] Fig. 3 is a schematic diagram of the structure of the half-precision floating point multiplier provided by the embodiment;

[0044] Fig. 4 is a comparison diagram of the calculation processes of the single-precision floating point number calculation module and the half-precision floating point number calculation module provided by the embodiment;

[0045] Fig. 5 is a schematic diagram of the transcendent function calculation method based on interpolation approximation provided by the embodiment;

[0046] Fig. 6 is a schematic diagram of the process of the mantissa interpolator performing mantissa interpolation calculation provided by the embodiment;

[0047] Fig. 7 is a schematic diagram of the logic flow of the half-precision floating point exponent expander performing normalization on the half-precision floating point number provided by the embodiment;

[0048] Fig. 8 is a schematic diagram of the process of the half-precision floating point multiplier performing floating point multiplication operation provided by the embodiment;

[0049] Among them, the following is explained:

[0050] 100-input module;

[0051] 200-single-precision floating point number calculation module; 210-single-precision floating point converter; 220-mantissa corrector; 230-mantissa interpolator; 240-exponent 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;

[0052] 300 - half-precision floating-point computation module; 310 - half-precision floating-point exponent expander; 320 - mantissa corrector; 330 - mantissa interpolator; 340 - exponent 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 - exponent calculation unit; 373 - mantissa calculation unit; 374 - multiplication matrix unit; 375 - integer division unit; 376 - output unit; 380 - half-precision floating-point converter;

[0053] 400 - output module;

[0054] 500 - half-precision integer division checker. Embodiments of the present application

[0055] The transfinite function computation system and method, chip and terminal device based on interpolation approximation according to the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the accompanying drawings are all very simplified and use non-precise proportions, only for the purpose of conveniently and clearly assisting in the description of the embodiments of the present application. In addition, the structures shown in the drawings are often part of the actual structures. In particular, the emphasis of each drawing is different, and sometimes different proportions are used.

[0056] It should be noted that "first", "second", and the like in the specification and claims of the present application and the accompanying drawings are used to distinguish similar objects in order to describe the embodiments of the present application, and are not intended 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 inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0057] [Corrected according to Rule 91 11.04.2025] Standard floating-point numbers mainly include three parts: sign, exponent and mantissa. Among them, single-precision floating-point numbers include 1-bit sign, 8-bit exponent and 23-bit mantissa, and the dynamic range is [2 -127 ,2 128 ); while half-precision floating-point numbers include 1-bit sign, 5-bit exponent and 10-bit mantissa, and the dynamic range in the normalized representation is [2 -15 ,2 16 ).

[0058] [Corrected according to Rule 91 11.04.2025] At present, taking a GPU as an example, the mainstream API of the GPU has strict precision calculation requirements for the format of single-precision floating-point numbers and half-precision floating-point numbers, and requires that the half-precision floating-point numbers must support the order of all 0, that is, a non-normalized format, and the dynamic range of which is [2 -24 ,2 -15 ).

[0059] For floating-point numbers, the precision mainly depends on the mantissa part, and the order part provides the dynamic range. Specifically, the bit width of the mantissa part determines the relative precision of the floating-point number, that is, the precision value represented by the lowest bit; and the order part affects the absolute precision of the floating-point number through the actual power offset.

[0060] Based on this, the embodiment provides a transfinite function calculation system based on interpolation approximation, as shown in FIG. 1, comprising: an input module 100 configured to input floating-point numbers with a preset bit number, the floating-point numbers including single-precision floating-point numbers and half-precision floating-point numbers; a single-precision floating-point number calculation module 200 configured to perform transfinite function calculation on the input floating-point numbers in a single-precision floating-point multiplication calculation manner, and output a calculation result in a half-precision floating-point format; a half-precision floating-point number calculation module 300 configured to perform transfinite function calculation on the input floating-point numbers in a half-precision floating-point multiplication calculation manner, and output a calculation result in a half-precision floating-point format; and an output module 400 configured to output the calculation results of the single-precision floating-point number calculation module and the half-precision floating-point number calculation module, the calculation results being floating-point numbers, the floating-point numbers including single-precision floating-point numbers and half-precision floating-point numbers.

[0061] The transfinite function calculation system based on interpolation approximation provided in the embodiment can perform high-precision and high-performance operation on single-precision floating-point numbers and half-precision floating-point numbers through the single-precision floating-point number calculation module 200 and the half-precision floating-point number calculation module 300, which meets the requirements of a processor chip and an interface API of the processor chip. The transfinite function calculation system not only enables the calculation method of the transfinite function to reduce costs while ensuring precision, but also can be applied to various transfinite functions.

[0062] In the embodiment, the bit number of the floating-point numbers input by the input module is 32 bits; and the bit number of the floating-point numbers output by the output module is 32 bits. Of course, in other embodiments, the bit number of the input floating-point numbers and the bit number of the output floating-point numbers can be any other bit number, which is not specifically limited in the present application.

[0063] Specifically, in the embodiment, as shown in FIG. 2, 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.

[0064] The input end of the single-precision floating-point converter 210 is connected with the output end of the input module 100, for converting the input half-precision floating-point number into single-precision floating-point format; the input end of the mantissa modifier 220 is connected with the output end of the single-precision floating-point converter 210, for modifying 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 with the output end of the mantissa modifier 220, for interpolating the mantissa modified by the mantissa modifier 220; the input end of the exponent calculator 240 is connected with the output end of the single-precision floating-point converter 210, for obtaining the exponent 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 with the output end of the mantissa interpolator 230 and the output end of the exponent calculator 240, for generating the first single-precision floating-point multiplier according to the output result of the mantissa interpolator 230 and the output result of the exponent calculator 240; the input end of the second single-precision floating-point multiplier generator 260 is connected with the output end of the single-precision floating-point converter 210, for generating the second single-precision floating-point multiplier according to the single-precision floating-point number converted by the single-precision floating-point converter 210; the input end of the single-precision floating-point multiplier 270 is connected with the output end of the first single-precision floating-point multiplier generator 250 and the output end of the second single-precision floating-point multiplier generator 260, for performing floating-point multiplication operation on the first single-precision floating-point multiplier and the second single-precision floating-point multiplier; the input end of the half-precision floating-point converter 280 is connected with the output end of the single-precision floating-point multiplier 270, for converting the calculation result of the single-precision floating-point multiplier 270 into half-precision floating-point number.

[0065] In actual application, if the input module 100 inputs 32-bit single-precision floating-point number, it can be directly sent into the single-precision floating-point calculation module 200, and the single-precision floating-point converter 210 does not need to convert it into single-precision floating-point format; if the input is 16-bit half-precision floating-point number, it needs to be converted into single-precision floating-point format by the single-precision floating-point converter 210, i.e. expanded to 8-bit exponent, so as to convert the non-normalized half-precision floating-point input into normalized single-precision floating-point format.

[0066] In addition, in the embodiment, as shown in FIG. 2, the half-precision floating-point calculation module 300 comprises a half-precision floating-point exponent expander 310, a mantissa modifier 320, a mantissa interpolator 330, an exponent calculator 340, a first expanded 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.

[0067] The input end of the half-precision floating point exponent expander 310 is connected with the output end of the input module 100, for expanding the exponent of the input half-precision floating point number to a preset bit; the input end of the mantissa modifier 320 is connected with the output end of the half-precision floating point exponent expander 310, for modifying the mantissa of the half-precision floating point number obtained by the half-precision floating point exponent expander 310; the input end of the mantissa interpolator 330 is connected with the output end of the mantissa modifier 320, for interpolating the mantissa modified by the mantissa modifier 320; the input end of the exponent calculator 340 is connected with the output end of the half-precision floating point exponent expander 310, for obtaining the exponent of the half-precision floating point number obtained by the half-precision floating point exponent expander 310; the input end of the first expanded half-precision floating point multiplier generator 350 is connected with the output end of the mantissa interpolator 330 and the output end of the exponent calculator 340, for generating the first half-precision floating point multiplier according to the output result of the mantissa interpolator 330 and the output result of the exponent calculator 340; the input end of the second half-precision floating point multiplier generator 360 is connected with the output end of the half-precision floating point exponent expander 310, for generating the second half-precision floating point multiplier according to the half-precision floating point number obtained by the half-precision floating point exponent expander 310; the input end of the half-precision floating point multiplier 370 is connected with the output end of the first expanded half-precision floating point multiplier generator 350 and the output end of the second half-precision floating point multiplier generator 360, for performing floating point multiplication operation 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 with the output end of the half-precision floating point multiplier 370, for converting the calculation result of the half-precision floating point multiplier 370 into a half-precision floating point number.

[0068] [Corrected according to Rule 91, 11.04.2025] In practical application, since the exponent of the half-precision floating point number is 5, the smallest non-normalized number that can be supported is 2 -24 While the exponent of the input half-precision floating point number is expanded to 6 bits by the half-precision floating point exponent expander 310, the smallest normalized number that can be supported is 2 -30 At this time, all non-normalized inputs can be converted into normalized floating point format.

[0069] Specifically, when the half-precision floating point exponent expander 310 performs exponent expansion, it judges whether the non-normalized exponent of the input half-precision floating point number is 0; if the non-normalized exponent is not 0, a preset exponent is added to the original exponent to obtain a new exponent, and the half-precision floating point number after exponent expansion is obtained; if the non-normalized exponent is 0, leading zero calculation is performed, and the half-precision floating point number is normalized according to the calculation result, and the half-precision floating point number after exponent expansion is obtained.

[0070] The step of the regularization processing includes: firstly, setting the result of the leading 0 calculation as S; then, left shifting the mantissa of the input half-precision floating point number by S, and subtracting S from the preset order to obtain a new order; and finally, obtaining the converted half-precision floating point number according to the left-shifted mantissa and the new order.

[0071] Further, in order to further improve the computing power of the floating point division function, in the single-precision floating point number calculation module 200, a complete single-precision floating point multiplier is used. Since the single-precision floating point multiplier 270 can also be used to implement the half-precision floating point transcendental function calculation, the half-precision floating point division implemented by the single-precision floating point operation circuit has a precision far exceeding the half-precision floating point operation precision specified by the GPU API.

[0072] In addition, in order to ensure that the half-precision floating point division operation can also obtain high precision, in the half-precision floating point number calculation module 300, a special floating point multiplier with a bit width greater than that of the standard half-precision floating point division, i.e., the half-precision floating point multiplier 370, is specially designed for half-precision floating point division. As shown in FIG. 3, 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, an integer division 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 orders 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 mantissas of the first half-precision floating point multiplier and the second 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 operation according to the mantissas 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 truncate 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 operation result according to the truncation result of the integer division unit 375 and the order calculated by the order calculation unit 372.

[0073] In actual application, the bit width of one input end of the half-precision floating point multiplier 370 includes a plurality of mantissas and 1 bit of implicit 1, the bit width of the other input end includes a plurality of mantissas and 1 bit of implicit 1, and the orders of the two input ends are consistent, and the maximum bit width of the output end is 33 bits and 1 bit of implicit 1.

[0074] In one embodiment, one input of the half-precision floating-point multiplier 370 has a bit width of 22 bits for the mantissa and 1 bit for the implicit 1, and the other input is a standard half-precision floating-point number with a mantissa of 10 bits and 1 bit for the implicit 1, and the output bit width after calculation is maximally 33 bits and 1 bit for the implicit 1. In order to support non-normalized half-precision floating-point numbers, the orders of both input data are set to 6 bits. Thus, as shown in FIG. 4, the hyperbolic function calculation system based on the interpolation approximation provided in this embodiment can allow the half-precision floating-point calculation module 300 and the single-precision floating-point calculation module 200 to generate different calculation results in the quadratic interpolation stage, but after the final output result is corrected by the half-precision floating-point multiplier 370, the final calculation output results of the half-precision floating-point calculation module 300 and the single-precision floating-point calculation module 200 are the same when the same input is used.

[0075] Preferably, in this embodiment, as shown in FIG. 2, the hyperbolic function calculation system based on the interpolation approximation further comprises a half-precision integer division checker 500, which is connected to the input module 100 at the input end and connected to the single-precision floating-point multiplier 270 and the half-precision floating-point multiplier 370 at the output end, and is used to perform integer division checking on the single-precision floating-point multiplier 270 of the single-precision floating-point calculation module 200 and the half-precision floating-point multiplier 370 of the half-precision floating-point calculation module 300 according to the floating-point numbers received by the input module 100, to obtain an integer division flag.

[0076] In addition, in this embodiment, the mantissa corrector 220, the mantissa interpolator 230 and the order calculator 240 in the single-precision floating-point calculation module 200 can be the same as the mantissa corrector 320, the mantissa interpolator 330 and the order calculator 340 in the half-precision floating-point calculation module 300, thereby reducing the development difficulty and workload of the hyperbolic function calculation system based on the interpolation approximation.

[0077] Specifically, in this embodiment, when the mantissa is corrected by the mantissa corrector 220 / 320, the mantissa is corrected according to the mantissa of the floating-point number in the preset domain.

[0078] If the hyperbolic function is a trigonometric function, the trigonometric function is contracted into a preset domain, and the mantissa is corrected according to the mantissa of the floating-point number in the preset domain;

[0079] If the hyperbolic function is a logarithmic function, the mantissa is corrected by making the mantissa of the output value of the logarithmic function close to 0 meet the accuracy requirement;

[0080] If the hyperbolic function is an exponential function, the mantissa is corrected by separating the integer part and the decimal part of the real value of the exponential function and calculating the mantissa by using the decimal part;

[0081] If the transcendental function is a square root function, the mantissa is modified according to the parity of the square root function;

[0082] If the transcendental function is an inverse function, the mantissa does not need to be modified;

[0083] If the transcendental function is a division function, the mantissa does not need to be modified, or if the dividend can be expressed as an integer multiple of the divisor and a power of 2, the dividend is rounded to a preset bit mantissa, and then rounded to the nearest half-precision floating-point even number to modify the mantissa.

[0084] In addition, the mantissa interpolator 230 / 330 is used for secondary interpolation of the mantissa modified by the mantissa modifier, and the calculation formula of the secondary interpolation is:

[0085]

[0086] Wherein, a, b and c are interpolation coefficients generated by the high bits of the modified mantissa through a lookup table; x is the low bits of the modified mantissa, and is the bitwise complement of x.

[0087] The embodiment also provides a transcendental function calculation method based on interpolation approximation, as shown in FIG. 5, the transcendental function calculation method based on interpolation approximation comprises the following steps:

[0088] S0, constructing a transcendental function calculation system;

[0089] S1, inputting a floating-point number with a preset number of bits to the transcendental function calculation system;

[0090] S2, using the transcendental function calculation system to calculate the input floating-point number in a single-precision floating-point multiplication manner, and outputting a calculation result in a half-precision floating-point format; using the transcendental function calculation system to calculate the input floating-point number in a half-precision floating-point multiplication manner, and outputting a calculation result in a half-precision floating-point format.

[0091] Specifically, in the embodiment, step S0, the transcendental function calculation system can be the transcendental function calculation system based on interpolation approximation described above.

[0092] In addition, in the embodiment, step S1, a floating-point number with a preset number of bits is input to 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 actual application, the floating-point number can be one 32-bit single-precision floating-point number or two half-precision floating-point numbers.

[0093] Further, in the present embodiment, in step S2, the input floating-point number is calculated by the transcendental function calculation system in the calculation mode of single-precision floating-point multiplication, and the calculation result in half-precision floating-point format is output; the input floating-point number is calculated by the transcendental function calculation system in the calculation mode of half-precision floating-point multiplication, and the calculation result in half-precision floating-point format is output, wherein,

[0094] The transcendental function calculation of the input floating-point number in the calculation mode of single-precision floating-point multiplication can be implemented by using the single-precision floating-point number calculation module 200, and the steps include:

[0095] S211, converting the input floating-point number into a single-precision floating-point number.

[0096] 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, so as to realize the conversion of the non-normalized half-precision floating-point input into the normalized single-precision floating-point format.

[0097] S212, sequentially performing the mantissa correction and the mantissa interpolation on the single-precision floating-point number to generate a first single-precision floating-point multiplier.

[0098] Specifically, in the present embodiment, the method for performing the mantissa correction by using the mantissa corrector 220 includes:

[0099] If the transcendental function is a trigonometric function, due to its periodicity, the trigonometric function can be contracted into a preset definition domain, which is usually small, and the mantissa is corrected according to the mantissa of the floating-point number in the preset definition domain;

[0100] If the transcendental function is a logarithmic function, since the order of the input value only affects the integer part of the output result, the highest precision requirement occurs when the input value is 1, i.e., when the output value is close to 0; if the accurate mantissa obtained when the output value is close to 0 can meet the precision requirement, then when deviating from 0, the precision requirement can also be met, so that the mantissa of the output value of the logarithmic function close to 0 is corrected to meet the precision requirement;

[0101] If the transcendental function is an exponential function, the integer part and the decimal part of the real 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 for correction;

[0102] If the transcendental function is a square root related function, the mantissa is corrected according to the parity of the square root related function;

[0103] If the transcendental function is an inverse function, the mantissa does not need to be corrected;

[0104] If the transcendental function is a division function, the mantissa does not need to be corrected, or if the dividend can be expressed as an integer multiple of the divisor and a power of 2, the dividend is rounded to a preset bit mantissa, and then rounded to the nearest half-precision floating-point even number to correct the mantissa. The preset bit mantissa can be 19.

[0105] The 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.

[0106] In addition, in the embodiment, the method for performing mantissa interpolation using the mantissa interpolator includes twice interpolating the corrected mantissa, and the calculation formula of the twice interpolation is:

[0107]

[0108] where a, b, and c are interpolation coefficients generated by the high bits of the corrected mantissa through a lookup table; x is the low bits of the corrected mantissa, and is the bitwise complement of x.

[0109] As shown in FIG. 6, the high bits of the corrected mantissa are first searched for coefficients through a coefficient lookup table (a constant coefficient lookup table, a first-order coefficient lookup table, and a second-order coefficient lookup table), the middle low bits of the mantissa are shifted using the lookup table coefficients corresponding to the middle high bits, the lowest bits of the mantissa are shifted after being inverted, and finally the lookup table coefficients corresponding to the highest bits of the mantissa and the shift results of the other bits are spliced to obtain the twice-interpolated mantissa.

[0110] Since a very large lookup table is needed for complete coefficient searching using a lookup table, which is unacceptable in terms of chip area, the embodiment uses a smaller 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 corresponding results in the gaps of the lookup table. Since the actual accuracy requirement of the half-precision floating-point transcendental function calculation is much lower than that of the single-precision floating-point number, the embodiment only uses a smaller bit width lookup table for the half-precision floating-point circuit to ensure the calculation accuracy requirement.

[0111] 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 exponent of the converted single-precision floating-point number is obtained using the exponent calculator, which is 8 in this embodiment. Then, the result of the mantissa interpolation and the exponent are combined and spliced to obtain the first multiplier of the floating-point multiplication.

[0112] S213, floating-point multiplication is performed using the second single-precision floating-point multiplier and the first single-precision floating-point multiplier to obtain a single-precision operation result.

[0113] Specifically, in order to improve the computing power of the floating point division function, in the embodiment, the single-precision floating point multiplier 270 is used to complete the floating point multiplication operation in one instruction. For single-precision floating point division calculation, the reciprocal of the divisor can be multiplied by the dividend to realize it, and the embodiment uses a complete single-precision floating point multiplier to realize the division operation.

[0114] Since the single-precision floating point number calculation module can also be used to realize the half-precision floating point transcendental function calculation, when it is used to realize the half-precision floating point division, it has far exceeded the half-precision floating point operation accuracy specified by the GPU API.

[0115] S214, converting the single-precision operation result into a half-precision floating point number.

[0116] The specific implementation of the single-precision floating point number calculation module of the embodiment is similar to the prior art, and those skilled in the art can learn it on the basis of the disclosure of the present application combined with the prior art, which will not be repeated here.

[0117] At the same time, the half-precision floating point number calculation module 300 is used to perform the following calculation:

[0118] S221, converting the input floating point number into a half-precision floating point number.

[0119] [Corrected according to Rule 91 11.04.2025] Specifically, since the original half-precision floating point number has a degree of 5, in order to convert it from a non-normalized input to a normalized floating point format, the degree is expanded to 6 bits, so that the smallest normalized number it can support is 2 -30 .

[0120] In the embodiment, as shown in FIG. 7, the method for converting the input floating point number into a half-precision floating point number includes: judging whether the non-normalized degree of the input half-precision floating point number is 0; if the non-normalized degree is not 0, adding a preset degree to the original degree to obtain a new degree, when the preset degree is 16, the new degree can be represented as: new degree = 16 + original degree, and then the converted half-precision floating point number is obtained, that is, the result of the degree expansion; if the non-normalized degree is 0, leading zero calculation is performed, and the half-precision floating point number is normalized according to the calculation result, wherein the result of the leading zero calculation is S, the mantissa of the input half-precision floating point number is left shifted by S, and the new degree is obtained by subtracting S from the preset degree, when the preset degree is 16, the new degree can be represented as: new degree = 16-S; the converted half-precision floating point number is obtained according to the left shifted mantissa and the new degree.

[0121] S222, sequentially performing mantissa correction and mantissa interpolation on the half-precision floating point number to generate a first half-precision floating point multiplier.

[0122] The mantissa correction, the mantissa interpolation and the way of generating the first half-precision floating-point multiplier are similar to those in step S212, and thus will not be described herein.

[0123] Preferably, in order to further reduce the bit width of the transcendental function coefficient lookup table and the fixed-point multiplier bit width required by the quadratic interpolation, and to ensure the calculation accuracy, in the embodiment, when the transcendental function is a division function, if the dividend can be expressed as an integer multiple of the divisor and a power of 2, i.e., an integer division in the floating-point format, the dividend is first rounded to a preset bit mantissa, and then rounded to the nearest half-precision floating-point even number, so as to correct the mantissa.

[0124] S223, performing floating-point multiplication on the second half-precision floating-point multiplier and the first half-precision floating-point multiplier to obtain a half-precision operation result.

[0125] Specifically, in the embodiment, first, the half-precision floating-point multiplier 370 is constructed, one input end of the half-precision floating-point multiplier 370 has a bit width including a plurality of bit mantissas and 1 bit of implicit 1, the other input end has a bit width including a plurality of bit mantissas and 1 bit of implicit 1, the orders of the two input ends are consistent, and the output end has a maximum bit width of 33 bits and 1 bit of implicit 1. In a specific embodiment, one input end of the half-precision floating-point multiplier 370 has a bit width including 22 bit mantissas and 1 bit of implicit 1, the other input end has a bit width including 10 bit mantissas and 1 bit of implicit 1, the orders of the two inputs are 6 bits, and the output has a maximum bit width of 33 bits and 1 bit of implicit 1.

[0126] 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 to perform floating-point multiplication to obtain a half-precision operation result. In a specific embodiment, as shown in FIG. 8, a 32-bit single-precision floating-point number or 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 floating-point numbers input into the two input ends are subjected to order calculation and mantissa calculation, respectively, wherein the mantissa calculation result of the input end supporting the single-precision floating-point number includes: a single-precision mantissa of 24x24 bits and a half-precision mantissa of 22x11 bits, and the half-precision mantissa of the input end supporting only the half-precision floating-point number is 22x11 bits; the two calculated mantissas are sent into a 24x12-bit multiplication matrix for operation.

[0127] Afterwards, an integer division flag is obtained. Specifically, the half-precision integer division checker 500 can be used to perform integer division checking on the single-precision operation result and the half-precision operation result according to the input floating-point number, to obtain the integer division flag, which has a value of 0 or 1. If the integer division flag is 1, the half-precision mantissa obtained by the matrix multiplication is rounded to a preset bit, for example, to 19 bits. If the integer division flag is 0, the half-precision mantissa obtained by the matrix multiplication 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 x 2. A 32-bit single-precision floating-point number or two 16-bit half-precision floating-point numbers are generated according to the final mantissa.

[0128] S224, convert the half-precision operation result into a half-precision floating-point number.

[0129] Since the calculation result is rounded according to the integer division flag in the calculation of the half-precision floating-point multiplier, the final output result can be corrected, so that 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 when the same input is used.

[0130] The transcendental function calculation method based on interpolation approximation provided in this embodiment can perform high-performance operation 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, and floating-point division function. 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-normalized half-precision floating-point numbers, expand the half-precision floating-point input range and precision, and realize full-precision half-precision floating-point division calculation, thereby widening the application range of the transcendental function calculation system. The transcendental function calculation method based on interpolation approximation provided in this embodiment can meet the requirements of processor chips and their interface APIs in terms of precision.

[0131] This embodiment also provides a chip integrated with the above-described transcendental function calculation system based on interpolation approximation. In actual applications, the chip can be a GPU (Graphics Processing Unit, graphics processor), NPU (Neural Processing Unit, neural network processor), ISP (Image Signal Processing, image signal processor), VPU (Video Processing Unit, video processor), DPU (Display Processing Unit, display processor), or other processor chip.

[0132] The embodiment also provides a terminal device, comprising the chip.

[0133] It should be noted that the embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts of each embodiment can be referred to each other. In addition, the different parts of each embodiment can also be used in combination with each other, and the application is not limited in this regard.

[0134] The system and method, chip and terminal device for computing transcendental functions based on interpolation approximation provided by the embodiment include: an input module configured to input a floating-point number with a preset bit number, the floating-point number including a single-precision floating-point number and a half-precision floating-point number; a single-precision floating-point number calculation module configured to perform transcendental function calculation on the input floating-point number in a single-precision floating-point multiplication calculation mode, and output a calculation result in a half-precision floating-point format; a half-precision floating-point number calculation module configured to perform transcendental function calculation on the input floating-point number in a half-precision floating-point multiplication calculation mode, and output a calculation result in a half-precision floating-point format; and an output module configured to output the calculation results of the single-precision floating-point number calculation module and the half-precision floating-point number calculation module, the calculation results being floating-point numbers, the floating-point numbers including single-precision floating-point numbers and half-precision floating-point numbers. The single-precision floating-point number calculation module and the half-precision floating-point number calculation module can perform high-precision and high-performance operations on single-precision floating-point numbers and half-precision floating-point numbers, meet the requirements of a processor chip and an interface API thereof, not only enable the calculation method of the transcendental functions to reduce costs while ensuring accuracy, but also can be applied to various transcendental functions.

[0135] The above description is only a description of the preferred embodiments of the application, and does not limit the scope of the application. Any modification or modification made by a person skilled in the art based on the above disclosure is within the protection scope of the claims. Industrial applicability

[0136] The system for computing transcendental functions based on interpolation approximation provided by the 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 number calculation module and the half-precision floating-point number calculation module, meet the requirements of a processor chip and an interface API thereof, not only enable the calculation method of the transcendental functions to reduce costs while ensuring accuracy, but also can be applied to various transcendental functions.

[0137] The method for computing transcendental functions based on interpolation approximation provided by the 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, and floating-point division function.

[0138] The hyperbolic function calculation method based on interpolation approximation provided in the embodiment can expand the input of the semi-precision floating point hyperbolic function calculation to the non-regularized semi-precision floating point range, and expand the semi-precision floating point input range and precision.

[0139] The hyperbolic function calculation method based on interpolation approximation provided in the embodiment can realize the full-precision semi-precision floating point division calculation, and widen the application range of the hyperbolic function calculation system.

[0140] The hyperbolic function calculation method based on interpolation approximation provided in the embodiment can meet the requirements of the processor chip and the interface API.

Claims

1. A system for computing transcendental functions based on interpolation approximation, characterized by, The method comprises the following steps: An input module is configured to input a floating-point number with a preset number of bits, wherein the floating-point number comprises a single-precision floating-point number and a half-precision floating-point number; A single-precision floating-point number calculation module is configured to perform transcendental function calculation on the input floating-point number in a single-precision floating-point multiplication calculation mode, and output a calculation result in a half-precision floating-point format; A half-precision floating-point number calculation module is configured to perform transcendental function calculation on the input floating-point number in a half-precision floating-point multiplication calculation mode, and output a calculation result in a half-precision floating-point format; An output module is configured 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 system for computing transcendental functions based on interpolation approximation according to claim 1, wherein, The single-precision floating-point number calculation module comprises a single-precision floating-point converter, a mantissa corrector, a mantissa interpolator, an exponent 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 configured to convert the input half-precision floating-point number into a single-precision floating-point format; The mantissa corrector is configured to correct the mantissa of the single-precision floating-point number converted by the single-precision floating-point converter; The mantissa interpolator is configured to interpolate the mantissa corrected by the mantissa corrector; The exponent calculator is configured to obtain the exponent of the single-precision floating-point number converted by the single-precision floating-point converter; The first single-precision floating-point multiplier generator is configured to generate a first single-precision floating-point multiplier based on the output result of the mantissa interpolator and the output result of the exponent calculator; The second single-precision floating-point multiplier generator is configured to generate a second single-precision floating-point multiplier based on the single-precision floating-point number converted by the single-precision floating-point converter; The single-precision floating-point multiplier is configured to perform 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 configured to convert the calculation result of the single-precision floating-point multiplier into a half-precision floating-point number.

3. The system for computing transcendental functions based on interpolation approximation according to claim 2, wherein, The single-precision floating-point converter is configured to convert the input half-precision floating-point number into a single-precision floating-point number with an exponent of 8.

4. The system for computing transcendental functions based on interpolation approximation according to claim 1, wherein, The half-precision floating-point number calculation module comprises a half-precision floating-point exponent extender, a mantissa corrector, a mantissa interpolator, an exponent 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 extender is configured to extend the exponent of the input half-precision floating-point number to a preset bit; The mantissa corrector is configured to correct the mantissa of the half-precision floating-point number extended by the half-precision floating-point exponent extender; The mantissa interpolator is configured to interpolate the mantissa corrected by the mantissa corrector; The exponent calculator is configured to obtain the exponent of the half-precision floating-point number extended by the half-precision floating-point exponent extender; The first extended half-precision floating-point multiplier generator is configured to generate a first half-precision floating-point multiplier based on the output result of the mantissa interpolator and the output result of the exponent calculator; The second half-precision floating-point multiplier generator is configured to generate a second half-precision floating-point multiplier based on the half-precision floating-point number extended by the half-precision floating-point exponent extender; The half-precision floating-point multiplier is configured to perform floating-point multiplication operation on the first half-precision floating-point multiplier and the second half-precision floating-point multiplier; and The half-precision floating-point converter is configured to convert the calculation result of the half-precision floating-point multiplier into a half-precision floating-point number. The half-precision floating-point multiplier is configured to perform floating-point multiplication on the first half-precision floating-point multiplier and the second half-precision floating-point multiplier. The half-precision floating-point converter is configured to convert the calculation result of the half-precision floating-point multiplier into a half-precision floating-point number.

5. The hypertranscendental function computation system based on interpolation approximation according to claim 4, characterized in that, The half-precision floating-point exponent expander is configured to expand the exponent of an input half-precision floating-point number to 6 bits.

6. The hypertranscendental function computation system based on interpolation approximation according to claim 4, wherein, The half-precision floating-point exponent expander is configured to determine whether the un-normalized exponent of an input half-precision floating-point number is 0; if the un-normalized exponent is not 0, a preset exponent is added to the original exponent to obtain a new exponent, and a half-precision floating-point number with the expanded exponent is obtained; if the un-normalized exponent is 0, leading zero calculation is performed, and the half-precision floating-point number is normalized according to the calculation result to obtain a half-precision floating-point number with the expanded exponent.

7. The hypertranscendental function computation system based on interpolation approximation according to claim 6, wherein, The normalization process comprises the following steps: Let the result of the leading zero calculation be S; The mantissa of the input half-precision floating-point number is left shifted by S, and a new exponent is obtained by subtracting S from the preset exponent; The converted half-precision floating-point number is obtained according to the left-shifted mantissa and the new exponent.

8. The hypertranscendental function computation system based on interpolation approximation according to claim 4, characterized in that, The half-precision floating-point multiplier comprises an input unit, an exponent calculation unit, a mantissa calculation unit, a multiplication matrix unit, an integer division unit and an output unit. The input unit is configured to input the first half-precision floating-point multiplier and the second half-precision floating-point multiplier. The exponent calculation unit is configured to calculate the exponents of the first half-precision floating-point multiplier and the second half-precision floating-point multiplier. The mantissa calculation unit is configured 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 configured to perform floating-point multiplication according to the mantissas calculated by the mantissa calculation unit. The integer division unit is configured to round the bit width of the floating-point number according to an integer division flag. The output unit is configured to output the final floating-point multiplication result according to the rounding result of the integer division unit and the exponent calculated by the exponent calculation unit.

9. The hypertranscendental function computation system based on interpolation approximation according to claim 8, characterized in that, The input unit comprises two input terminals, one of which has a bit width comprising a plurality of mantissa bits and 1 bit of implicit 1, and the other of which has a bit width comprising a plurality of mantissa bits and 1 bit of implicit 1, and the exponents of the two input terminals are consistent; the output terminal of the output unit has a maximum bit width of 33 bits and 1 bit of implicit 1.

10. The hypertranscendental function computation system based on interpolation approximation according to claim 8, wherein, The hyperbolic function calculation system based on interpolation approximation further comprises a half-precision integer division checker configured to perform integer division checking on the single-precision floating-point multiplier of the single-precision floating-point calculation module and the half-precision floating-point multiplier of the half-precision floating-point calculation module according to the floating-point numbers received by the input module, to obtain an integer division flag.

11. The interpolation-approximation-based transcendental function calculation system according to any one of claims 2 to 10, characterized in that, When the mantissa is corrected, in the half-precision floating-point exponent expander, if the hyperbolic function is a trigonometric function, the trigonometric function is contracted to a preset definition domain, and the mantissa is corrected according to the mantissa of the floating-point number in the preset definition domain; if the hyperbolic function is a logarithmic function, the mantissa of the output value of the logarithmic function when approaching 0 is made to meet the accuracy requirement to correct the mantissa; if the hyperbolic function is an exponential function, the integer part and the decimal part of the real value of the exponential function are separated, and the mantissa is calculated by using the decimal part to correct the mantissa. If the transcendental function is a square root function, the mantissa is modified according to the parity of the square root function; If the transcendental function is an inverse function, the mantissa does not need to be modified; If the transcendental function is a division function, the mantissa does not need to be modified, or if the dividend can be expressed as an integer multiple of the divisor and a power of 2, the dividend is rounded to a preset number of bits, and then rounded to the nearest half-precision floating-point even number to modify the mantissa.

12. The interpolation-approximation-based transcendental function computation system according to any one of claims 2 to 10, characterized in that, The mantissa interpolator is configured to perform secondary interpolation on the mantissa modified by the mantissa modifier, and a calculation formula of the secondary interpolation is: Wherein, a, b and c are interpolation coefficients generated by high bits of the modified mantissa through a lookup table; x is a low bit of the modified mantissa, and is a bitwise complement of x.

13. The interpolation-approximation-based transcendental function computation system according to claim 1, characterized by, The input module inputs a floating-point number with a bit number including 32 bits; and the output module outputs a floating-point number with a bit number including 32 bits.

14. A method for computing a transcendental function based on an interpolation approximation, characterized in that, The method comprises: Constructing a transcendental function calculation system; Inputting a floating-point number with a preset number of bits 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; Using the transcendental function calculation system to perform transcendental function calculation on the input floating-point number in a single-precision floating-point multiplication manner, and outputting a calculation result in a half-precision floating-point format; Using the transcendental function calculation system to perform transcendental function calculation on the input floating-point number in a half-precision floating-point multiplication manner, and outputting a calculation result in a half-precision floating-point format.

15. A chip, characterized by The chip is integrated with the transcendental function calculation system based on interpolation approximation according to any one of claims 1-13.

16. A terminal device, comprising: The chip according to claim 15 is included. The method comprises: Constructing a transcendental function calculation system; Inputting a floating-point number with a preset number of bits 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; Using the transcendental function calculation system to perform transcendental function calculation on the input floating-point number in a single-precision floating-point multiplication manner, and outputting a calculation result in a half-precision floating-point format; Using the transcendental function calculation system to perform transcendental function calculation on the input floating-point number in a half-precision floating-point multiplication manner, and outputting a calculation result in a half-precision floating-point format. The chip is integrated with the transcendental function calculation system based on interpolation approximation according to any one of claims 1-13. The chip according to claim 15 is included.

Citation Information

Patent Citations

  • Method and device for achieving low delay basic transcendental function based on mixed model CORDIC algorithmic

    CN103677738A

  • Floating point multiply-add unit with fusion precision conversion function and application method of floating point multiply-add unit

    CN115390790A

  • CORDIC device applied to floating point processor and floating point processor

    CN118092852A

  • Reduced floating-point precision arithmetic circuitry

    US20180081632A1

  • Apparatus and Methods for Performing Multiple Transcendental Function Operations

    US20190138570A1