Floating-point continuous accumulation method and adder

CN120653221BActive Publication Date: 2026-08-14SHANGHAI SMARTLOGIC TECHNOLOGY LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0004]在高主频应用场景中,浮点加法器需要2周期或者多周期产生累加计算结果,无法实现在高主频下每个周期都进行有效数据计算

Benefits of technology

[0016]本申请提供一种浮点连续累加方法和加法器,该方法包括:在一个周期内,进行第一源操作数的尾数与第二源操作数的尾数的加法计算,得到累加结果,同时,获取下一第二源操作数;其中,源操作数为浮点格式;在下一周期内,根据累加结果的指数与下一第二源操作数的指数之间的关系,进行累加结果与下一第二源操作数之间的对阶;在后续的每个周期内,进行对阶后的累加结果的尾数与下一第二源操作数的尾数的加法计算,得到累加结果,同时,获取下一第二源操作数;根据累加结果的指数与下一第二源操作数的指数之间的关系,进行累加结果与下一第二源操作数之间的对阶。本申请提供的方法可以实现在高主频下每个周期都进行有效数据计算,进而提升运算效率,降低功耗。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653221B_ABST
    Figure CN120653221B_ABST
Patent Text Reader

Abstract

This application provides a floating-point continuous accumulation method and adder. The method includes: within one cycle, performing addition calculations of the mantissa of a first source operand and the mantissa of a second source operand to obtain an accumulation result, and simultaneously obtaining the next second source operand; wherein the source operands are in floating-point format; within the next cycle, performing alignment between the accumulation result and the next second source operand based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand; in each subsequent cycle, performing addition calculations of the mantissa of the aligned accumulation result and the mantissa of the next second source operand to obtain an accumulation result, and simultaneously obtaining the next second source operand; and performing alignment between the accumulation result and the next second source operand based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand. This method can achieve effective data calculation in each cycle at high clock frequencies, thereby improving computational efficiency and reducing power consumption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a floating-point continuous accumulation method and adder. Background Technology

[0002] A floating-point adder is a digital circuit or algorithm module used to perform floating-point addition operations.

[0003] For example, floating-point adders in computer processors such as CPUs and GPUs can perform floating-point addition operations, supporting high-performance computing in various fields such as scientific computing, graphics processing, and artificial intelligence.

[0004] In high-frequency applications, floating-point adders require two or more cycles to generate the cumulative calculation result, making it impossible to perform effective data calculation in each cycle at high frequencies. Summary of the Invention

[0005] To address one of the aforementioned technical deficiencies, this application provides a floating-point continuous accumulation method and adder.

[0006] The first aspect of this application provides a floating-point continuous accumulation method, the method comprising: Within one cycle, the mantissa of the first source operand and the mantissa of the second source operand are added together to obtain the accumulated result. At the same time, the next second source operand is obtained. The source operands are in floating-point format. In the next cycle, based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, the order between the accumulated result and the next second source operand is adjusted. In each subsequent cycle, the mantissa of the accumulated result after alignment is added to the mantissa of the next second source operand to obtain the accumulated result. At the same time, the next second source operand is obtained. Based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, alignment is performed between the accumulated result and the next second source operand.

[0007] Optionally, based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, the order of the accumulated result and the next second source operand is aligned, including: Determine whether the exponent of the accumulated result is the same as, or differs by 1 from, the exponent of the next second source operand; If the exponent of the accumulated result is the same as or differs by 1 from the exponent of the next second source operand, then the order of the accumulated result and the next second source operand is aligned according to the relationship between the exponent of the accumulated result and the exponent of the next second source operand. If the exponent of the accumulated result is not the same as the exponent of the next second source operand, and the difference is not 1, then the rounding point is determined; based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, the order between the accumulated result and the next second source operand is adjusted.

[0008] Optionally, based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, the order of the accumulated result and the next second source operand is aligned, including: The restriction code is determined based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand; Alignment is performed between the restriction code and the next second source operand.

[0009] Optionally, a restriction code is determined based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, including: The restriction code is determined based on the difference between the exponent of the accumulated result and the exponent of the next second source operand, as well as the number of leading zeros in the accumulated result; or, The restriction code is determined by the relationship between the exponent of the accumulated result and the exponent of the next second source operand using the restriction code encoder.

[0010] Optionally, determining the rounding point location includes: The rounding point is determined by the bitwise AND operation of the sign bit of the exponent difference between the two source operands that yield the accumulated result and the mantissa of the accumulated result. The mantissa of the accumulated result after alignment is added to the mantissa of the next second source operand to obtain the accumulated result, including: Based on the rounding point position, the mantissa of the accumulated result after alignment is added to the mantissa of the next second source operand to obtain the accumulated result.

[0011] In a second aspect, this application provides an adder comprising: an input preprocessing module, a fixed-point accumulation unit, and a continuous accumulation step difference preprocessing unit; in, The input preprocessing module is used to obtain the source operands; where the source operands are in floating-point format. The fixed-point accumulation unit is used to perform the addition of the mantissa of the first source operand and the mantissa of the second source operand within one cycle to obtain the accumulation result; The continuous accumulation step difference preprocessing unit is used to perform step alignment between the accumulation result and the next second source operand in the next cycle and each subsequent cycle, based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand. The fixed-point accumulation unit is also used to perform addition calculations on the accumulated result after alignment and the next second source operand in each subsequent cycle to obtain the accumulated result.

[0012] Optionally, the continuous accumulation step preprocessing unit is used to determine whether the exponent of the accumulation result is the same as or differs by 1 from the exponent of the next second source operand; If the exponent of the accumulated result is the same as or differs by 1 from the exponent of the next second source operand, then the order of the accumulated result and the next second source operand is aligned according to the relationship between the exponent of the accumulated result and the exponent of the next second source operand. If the exponent of the accumulated result is not the same as the exponent of the next second source operand, and the difference is not 1, then the rounding point is determined; based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, the order between the accumulated result and the next second source operand is adjusted.

[0013] Optionally, the continuous accumulation step difference preprocessing unit is used to determine the limit code based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand; and to perform order matching based on the limit code and the next second source operand.

[0014] Optionally, the continuous accumulation step difference preprocessing unit is used to determine the limit code based on the difference between the exponent of the accumulation result and the exponent of the next second source operand and the number of leading zeros in the accumulation result; or, the limit code is determined by the limit code encoder based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand.

[0015] Optionally, the continuous accumulation step difference preprocessing unit is used to determine the rounding point position based on the result of a bitwise AND operation between the sign bit of the exponent difference between the two source operands that yield the accumulation result and the mantissa of the accumulation result. The fixed-point accumulation unit is also used to perform addition calculations on the mantissa of the accumulated result after alignment and the mantissa of the next second source operand, based on the position of the rounding point, to obtain the accumulated result.

[0016] This application provides a floating-point continuous accumulation method and adder. The method includes: within one cycle, performing addition calculations of the mantissa of a first source operand and the mantissa of a second source operand to obtain an accumulation result, and simultaneously obtaining the next second source operand; wherein the source operands are in floating-point format; within the next cycle, performing alignment between the accumulation result and the next second source operand based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand; in each subsequent cycle, performing addition calculations of the mantissa of the aligned accumulation result and the mantissa of the next second source operand to obtain an accumulation result, and simultaneously obtaining the next second source operand; and performing alignment between the accumulation result and the next second source operand based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand. The method provided by this application can achieve effective data calculation in each cycle at high clock frequencies, thereby improving computational efficiency and reducing power consumption. Attached Figure Description

[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart illustrating a floating-point continuous accumulation method. Figure 2 A flowchart illustrating a floating-point continuous accumulation method provided in an embodiment of this application; Figure 3 A flowchart illustrating another floating-point continuous accumulation method provided in this application embodiment; Figure 4 This is a schematic diagram of the structure of a high-performance processor provided in an embodiment of this application; Figure 5 A schematic diagram of the architecture of a scalar processor provided for an embodiment of this application; Figure 6 A schematic diagram of a synchronization unit provided in an embodiment of this application; Figure 7 A schematic diagram of the architecture of a vector processor provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a vector operation unit provided in an embodiment of this application; Figure 9 This is a schematic diagram of another vector processor architecture provided in an embodiment of this application. Detailed Implementation

[0018] To make the technical solutions and advantages of the embodiments of this application clearer, the exemplary embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.

[0019] In the process of developing this application, the inventors discovered that a floating-point adder is a digital circuit or algorithm module used to perform floating-point addition operations. In high-frequency applications, floating-point adders require two or more cycles to generate the accumulated calculation result, making it impossible to perform effective data calculation in each cycle at high frequencies.

[0020] To address the aforementioned problems, this application provides a floating-point continuous accumulation method and adder. The method includes: within one cycle, performing addition of the mantissa of a first source operand and the mantissa of a second source operand to obtain an accumulation result, and simultaneously obtaining the next second source operand; wherein the source operands are in floating-point format; within the next cycle, performing alignment between the accumulation result and the next second source operand based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand; in each subsequent cycle, performing addition of the mantissa of the aligned accumulation result and the mantissa of the next second source operand to obtain an accumulation result, and simultaneously obtaining the next second source operand; and performing alignment between the accumulation result and the next second source operand based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand. The method provided by this application can achieve effective data calculation in each cycle at high clock frequencies, thereby improving computational efficiency and reducing power consumption.

[0021] This embodiment provides a method for continuous floating-point accumulation, which is based on the existing implementation process of floating-point accumulation. For example... Figure 1 As shown, in the existing floating-point accumulation schemes: (1) Get the first source operand (sa[63:0]) and the second source operand (sb[63:0]).

[0022] (2) After decoding the source operands, the exponents of the two source operands (sa_expt and sb_expt) are obtained.

[0023] (3) By judging whether sa_expt>sb_expt is true, the larger and smaller exponents of the first source operand (sa[63:0]) and the second source operand (sb[63:0]) are obtained, and the difference between the larger and smaller exponents is taken as the exponent difference.

[0024] (4) Shift the last digit to the right based on the difference in exponents.

[0025] (5) Add the last digits after shifting.

[0026] (6) Determine whether to continue accumulating.

[0027] (7) If the accumulation continues, the mantissa of the accumulated result is shifted and aligned with the next second source operand (at this time, a calculation result conforming to IEEE 754 will be generated). Repeat (5) to add the accumulated result (i.e., the calculation result conforming to IEEE 754) to the mantissa of the next second source operand to obtain a new accumulated result.

[0028] (8) If the sum is not continued, the mantissa of the sum is normalized and shifted to the left, rounded, and the calculation result is output.

[0029] The process of shifting the mantissa of the accumulated result and aligning it with the next second source operand (which will produce a calculation result that conforms to IEEE 754) requires one cycle to complete. Therefore, in the existing scheme, there will be a one-cycle interval between two adjacent additions, and continuous addition in a continuous cycle cannot be achieved.

[0030] The method provided in this embodiment is located in Figure 1 The dashed box in the shown accumulation process allows the method provided in this embodiment to achieve continuous floating-point accumulation by adding the mantissas to obtain the accumulation result and continuing to accumulate. In the next cycle, the accumulation result is added to the mantissa of the next second source operand to obtain a new accumulation result. This process is repeated until the output result is determined, thus realizing continuous floating-point accumulation.

[0031] See Figure 2 This embodiment provides a floating-point continuous accumulation method, the implementation process of which is as follows: 201. Within one cycle, perform the addition of the mantissa of the first source operand and the mantissa of the second source operand to obtain the cumulative result, and at the same time, obtain the next second source operand.

[0032] The source operands are in floating-point format. For example, the source operands are in FP64 format or FP32 format, etc.

[0033] Before implementing step 201, it will be done through Figure 1 The implementation block shown reads the first source operand (sa[63:0]) and the second source operand (sb[63:0]), dynamically identifies the format of the source operands, and triggers the corresponding processing channel based on the format of the source operands. In the processing channel, the source operands are decoded to obtain the exponents of the two source operands (sa_expt and sb_expt). The exponent difference is generated according to the relationship between the exponents of the two source operands (i.e., whether sa_expt>sb_expt is true), and the mantissa is shifted to the right. Then, step 201 is executed. Within one cycle, the mantissa of the first source operand and the mantissa of the second source operand are added to obtain the accumulated result. At the same time, the next second source operand is obtained.

[0034] The process of adding the mantissas of the first and second source operands to obtain the accumulated result is the same as in the existing method. When obtaining the next second source operand, it can be obtained via a bypass.

[0035] It should be noted that the "period" in this embodiment and subsequent embodiments refers to the clock cycle.

[0036] 202. In the next cycle, based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, the order between the accumulated result and the next second source operand is adjusted.

[0037] The implementation process of step 202 is as follows: Step 202-1: Determine whether the exponent of the accumulated result is the same as, or differs by 1 from, the exponent of the next second source operand. If the exponent of the accumulated result is the same as, or differs by 1 from, the next step is executed. If the exponent of the accumulated result is not the same as, and does not differ by 1 from, the next step is executed.

[0038] 202-2, based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, perform order alignment between the accumulated result and the next second source operand.

[0039] If the exponent of the accumulated result is the same as or differs by 1 from the exponent of the next second source operand, then alignment can be performed based on the near path implementation scheme. For example, alignment between the accumulated result and the next second source operand can be performed based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand.

[0040] The process of aligning the exponents of the accumulated result and the next second source operand, based on the relationship between the exponents of the accumulated result and the exponents of the next second source operand, is as follows: 1. Determine the restriction code based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand.

[0041] The restriction code indicates how many leading zeros need to be removed during left rounding, i.e., how many bits need to be left rounded. Since there is an order difference between the current accumulated result and the next floating-point number (i.e., the next second source operand), the order difference can take three forms: In the first case, the exponent of the accumulated result is greater than the exponent of the next floating-point number (i.e., the next second source operand), and the corrected exponent after subtracting the leading zero from the exponent of the accumulated result is greater than the exponent of the next floating-point number (i.e., the next second source operand).

[0042] In the second case, the exponent of the accumulated result is greater than the exponent of the next floating-point number (i.e., the next second source operand), but the corrected exponent after subtracting the leading zero from the exponent of the accumulated result is less than the exponent of the next floating-point number (i.e., the next second source operand).

[0043] In the third case, the exponent of the accumulated result is less than the exponent of the next floating-point number (i.e., the next second source operand).

[0044] For the first two types, left regression of the accumulated number needs to be restricted by a restriction code.

[0045] There are several ways to determine the limit code. For example, the limit code can be determined based on the difference between the exponent of the accumulated result and the exponent of the next second source operand, as well as the number of leading zeros in the accumulated result. Alternatively, the limit code can be determined using a limit code encoder based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand. In a limit code encoder, a compressor can be used to compress the exponent difference and other parameters to obtain the limit code.

[0046] 2. Align the limit code with the next second source operand.

[0047] This process is an existing alignment process, and the existing implementation scheme can be used.

[0048] If the exponent of the accumulated result is the same as, or differs by 1 from, the exponent of the next second-source operand, then only left reduction is needed. That is, the limit code is determined based on the difference between the exponents of the accumulated result and the next second-source operand, and the number of leading zeros in the accumulated result. Alternatively, the limit code can be determined using a limit code encoder based on the relationship between the exponents of the accumulated result and the next second-source operand. The limit code is then aligned with the exponent of the next second-source operand.

[0049] In addition, during alignment, since there is an exponential difference between the accumulated result and the next second source operand, there may be both left and right shifts during the alignment process with the next second source operand, which increases the overhead. However, the method in this embodiment can achieve only left shift and not right shift through the restriction code, thus reducing the shift overhead.

[0050] 202-3, Determine the rounding point. Based on the relationship between the exponent of the accumulated result and the exponent of the next second-source operand, perform exponent alignment between the accumulated result and the next second-source operand.

[0051] If the exponent of the accumulated result is not the same as the exponent of the next second source operand, and the difference is not 1, then the order can be aligned based on the far path implementation scheme. For example, first determine the rounding point position, and then align the order between the accumulated result and the next second source operand according to the relationship between the exponent of the accumulated result and the exponent of the next second source operand.

[0052] The process of determining the rounding point is as follows: the rounding point is determined by bitwise ANDing the sign bit of the exponent difference between the two source operands that yield the accumulated result with the mantissa of the accumulated result.

[0053] For example, the truth table corresponding to the sign bit is determined based on the sign bit of the difference between the exponents of the two source operands from which the accumulated result is obtained. The rounding point is determined by bitwise ANDing the corresponding truth table with the mantissa of the accumulated result.

[0054] This involves pre-storing a truth table corresponding to various sign bit cases. After obtaining the sign bit of the exponent difference between the two source operands for the accumulated result, the corresponding sign bit can be selected from the pre-stored truth table. The truth table generation scheme adopts an existing approach.

[0055] In addition, the mantissas of the accumulated result (e.g., 5 bits) are bit4, bit3, bit2, bit1, and bit0, which can be in the following three cases: If the LSB (Least Significant Bit) of the mantissa is bit5, then the G (Guard Bit) is bit4, the R (Round Bit) and S (Sticky Bit) are bit3-bit0 or together, and the CI (Carry Bit) is bit6 in this case.

[0056] If the LSB is at bit 4, then the G bit is at bit 3, the R bit and the S bit are at bits 2-0 or together, and in this case the CI bit is at bit 5.

[0057] If the LSB is at bit3, then the G bit is at bit2, the R bit is at bit1, the S bit is at bit0, and the CI bit is at bit4 in this case.

[0058] By performing a bitwise AND operation between the corresponding truth table and the mantissa of the accumulated result for each of the three cases, the rounding point can be obtained.

[0059] The rounding point is used for rounding. However, the rounding process is not implemented in a single cycle as in the existing scheme. Instead, the rounding is performed in the next cycle while the mantissa of the current accumulated result is added to the mantissa of the next second source operand (i.e., rounding and addition are performed simultaneously). This ensures that a floating-point number is accumulated once in each cycle, achieving continuous accumulation.

[0060] The process of aligning the exponents of the accumulated result and the next second source operand in step 202-3 is the same as the process of aligning the exponents of the accumulated result and the next second source operand in step 202-2. Please refer to the implementation process of step 102-2. It will not be repeated here.

[0061] If the exponent of the accumulated result is different from the exponent of the next second-source operand, and the difference is not 1, then the rounding point position is determined first (this rounding point position is used for rounding during the next accumulation cycle). This is determined by the bitwise AND of the sign bit of the difference between the exponents of the two source operands used to obtain the accumulated result and the mantissa of the accumulated result. Then, based on the relationship between the exponent of the accumulated result and the exponent of the next second-source operand, the order of the accumulated result and the next second-source operand is aligned.

[0062] 203. In each subsequent cycle, the mantissa of the accumulated result after alignment is added to the mantissa of the next second source operand to obtain the accumulated result. At the same time, the next second source operand is obtained. Based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, alignment is performed between the accumulated result and the next second source operand.

[0063] If the exponent of the accumulated result is the same as or differs by 1 from the exponent of the next second source operand, then in each subsequent cycle, when performing the addition calculation of the mantissa of the accumulated result after alignment with the mantissa of the next second source operand, the existing floating-point mantissa addition calculation scheme can be used.

[0064] If the exponent of the accumulated result is different from the exponent of the next second source operand, and the difference is not 1, then in each subsequent cycle, when adding the mantissa of the accumulated result after alignment to the mantissa of the next second source operand, the addition calculation will be performed according to the rounding point position to obtain the accumulated result.

[0065] If step 201 is implemented in the i-th cycle and step 202 is implemented in the (i+1)-th cycle, starting from the (i+2)-th cycle, a floating-point number will be accumulated in each cycle, thus achieving continuous floating-point accumulation starting from the (i+2)-th cycle.

[0066] The floating-point continuous accumulation method provided in this embodiment is implemented as follows: Figure 3 As shown, in the floating-point continuous accumulation method of this embodiment: (1) Get the first source operand (sa[63:0]) and the second source operand (sb[63:0]).

[0067] (2) After decoding the source operands, the exponents of the two source operands (sa_expt and sb_expt) are obtained.

[0068] (3) By judging whether sa_expt>sb_expt is true, the larger and smaller exponents of the first source operand (sa[63:0]) and the second source operand (sb[63:0]) are obtained, and the difference between the larger and smaller exponents is taken as the exponent difference.

[0069] (4) Shift the last digit to the right based on the difference in exponents.

[0070] (5) Add the mantissas after shifting through step 201, and at the same time, obtain the next second source operand.

[0071] (6) Determine whether to continue accumulating.

[0072] (7) If accumulation continues, the accumulation result is aligned with the next second source operand in step 202. Step (5) is repeated to add the shifted mantissas in step 201. At the same time, the next second source operand is obtained. Step (6) determines whether to continue accumulation. Step (7) If accumulation continues, the accumulation result is aligned with the next second source operand in step 202 until accumulation stops.

[0073] (8) If the sum is not continued, the mantissa of the sum is normalized and shifted to the left, rounded, and the calculation result is output.

[0074] The first execution of (7) requires one cycle to complete the alignment process between the accumulated result and the next second source operand through step 202. Subsequently, in each cycle, (5) adding the mantissa and obtaining the next second source operand, (6) confirming to continue accumulating, and (7) aligning the accumulated result with the next second source operand will be executed simultaneously until accumulating stops. In other words, an addition will be performed once in each subsequent cycle to achieve continuous addition in consecutive cycles.

[0075] The floating-point continuous accumulation method provided in this embodiment can complete the floating-point accumulation within one cycle. Existing floating-point accumulation schemes cannot directly align with the next floating-point number. Instead, they left-align to generate a calculation result conforming to IEEE 754, output this result, and then add it to the next floating-point number, and so on. Therefore, this calculation often requires two cycles to complete on high-frequency processors. Consequently, the new accumulated number also needs to wait for one cycle until the calculated number is generated before the next accumulation calculation can continue. The floating-point continuous accumulation method provided in this embodiment, after completing the alignment and accumulation of two floating-point numbers, directly aligns the accumulated result with the next floating-point number and then directly accumulates it with the newly input floating-point number in the next cycle.

[0076] It should be noted that, in order to store intermediate values ​​(such as intermediate accumulation results) in FP64 format throughout the continuous accumulation process, and only round them to FP32 in the final output, we can avoid successive truncation errors.

[0077] The floating-point continuous accumulation method provided in this embodiment supports mixed-precision arithmetic of multiple floating-point formats (FP64, FP32) and can realize the continuous floating-point accumulation of the source operand in each cycle. It is suitable for scenarios such as artificial intelligence inference, scientific computing and graphics processors, and can improve computing efficiency and reduce power consumption.

[0078] The floating-point continuous accumulation method provided in this embodiment requires no software preprocessing, and the accumulated error in the continuous accumulation operation conforms to IEEE 754, meeting the requirements of scientific computing scenarios.

[0079] The floating-point continuous accumulation method provided in this embodiment supports continuous accumulation of floating-point addition and conforms to the IEEE 754 standard. During the accumulation process, this method supports inputting one source operand per cycle, and the newly input source operand is added to the existing accumulated sum.

[0080] The floating-point continuous accumulation method provided in this embodiment performs error suppression during continuous accumulation. This method retains all intermediate precision and conforms to the IEEE 754 standard during continuous accumulation, performing rounding only once at the final output.

[0081] This embodiment provides a floating-point continuous accumulation method. Within one cycle, the mantissas of the first source operand and the second source operand are added to obtain the accumulation result. Simultaneously, the next second source operand is obtained. The source operands are in floating-point format. In the next cycle, based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand, the order of the accumulation result and the next second source operand is aligned. In each subsequent cycle, the mantissas of the aligned accumulation result are added to the mantissa of the next second source operand to obtain the accumulation result. Simultaneously, the next second source operand is obtained. Based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand, the order of the accumulation result and the next second source operand is aligned. This method can achieve effective data calculation in each cycle at high clock frequencies, thereby improving computational efficiency and reducing power consumption.

[0082] based on Figure 2 and / or Figure 3 Using the same inventive concept as the floating-point continuous accumulation method shown, this embodiment provides an adder, which includes: an input preprocessing module, a fixed-point accumulation unit, and a continuous accumulation step difference preprocessing unit.

[0083] in, The input preprocessing module is used to obtain the source operands. The source operands are in floating-point format.

[0084] The fixed-point accumulation unit is used to perform addition calculations on the mantissas of the first source operand and the mantissas of the second source operand within one cycle to obtain the accumulation result.

[0085] The continuous accumulation step difference preprocessing unit is used to perform step alignment between the accumulation result and the next second source operand in the next cycle and each subsequent cycle, based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand.

[0086] The fixed-point accumulation unit is also used to perform addition calculations on the accumulated result after alignment and the next second source operand in each subsequent cycle to obtain the accumulated result.

[0087] The continuous accumulation step preprocessing unit is used to determine whether the exponent of the accumulation result is the same as or differs by 1 from the exponent of the next second source operand.

[0088] If the exponent of the accumulated result is the same as or differs by 1 from the exponent of the next second source operand, then the order of the accumulated result and the next second source operand is aligned according to the relationship between the exponent of the accumulated result and the exponent of the next second source operand.

[0089] If the exponent of the accumulated result is different from the exponent of the next second-source operand, and the difference is not 1, then the rounding point is determined. Based on the relationship between the exponent of the accumulated result and the exponent of the next second-source operand, the order of the accumulated result and the next second-source operand is aligned.

[0090] The continuous accumulation step difference preprocessing unit is used to determine the limit code based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand. The limit code is then used to align the steps with the next second source operand.

[0091] The continuous accumulation step difference preprocessing unit is used to determine the limit code based on the difference between the exponent of the accumulation result and the exponent of the next second source operand, as well as the number of leading zeros in the accumulation result. Alternatively, the limit code can be determined by a limit code encoder based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand.

[0092] The continuous accumulation step difference preprocessing unit is used to determine the rounding point position based on the result of a bitwise AND operation between the sign bit of the exponent difference between the two source operands that yield the accumulation result and the mantissa of the accumulation result.

[0093] The fixed-point accumulation unit is also used to perform addition calculations on the mantissa of the accumulated result after alignment and the mantissa of the next second source operand, based on the position of the rounding point, to obtain the accumulated result.

[0094] The adder provided in this embodiment can perform addition calculations using the same set of fixed-point addition circuits and shift circuits for FP64 and FP32.

[0095] In addition, in the specific implementation, the processor of the device where the adder is located is a high-performance processor, which includes scalar processors and vector processors.

[0096] The connection between scalar processors and vector processors can be as follows: Figure 4 As shown.

[0097] In this architecture, scalar processors and vector processors share data storage. However, vector processors can only access the data storage and are executed solely by scalar processors.

[0098] A connection is established between scalar processors and vector processors. For example, scalar processors and vector processors can be connected via a dedicated instruction channel.

[0099] In addition, a high-performance processor may include two registers: one for the scalar processor and the other for the vector processor. The vector processor can read and write its corresponding register, while the scalar processor can read and write both its corresponding register and the register corresponding to the vector processor.

[0100] Scalar processors can read and write the registers of vector processors.

[0101] The scalar processor establishes a connection with global memory.

[0102] (a) Scalar Processor See Figure 5 The scalar processor includes: an instruction fetch unit, a register renaming unit, an arithmetic reserved stack unit, a memory reserved stack unit, a scalar arithmetic unit, a memory access unit, a program control unit, a synchronization unit, a pipeline control unit, a register file unit, and a special vector register file unit.

[0103] In addition, a scalar processor may include one or more other units, such as one or more other functional modules, one or more instruction caches, one or more data stores, one or more special vector registers, one or more status flag registers, etc.

[0104] 1. Instruction Fetch Unit The instruction fetch unit is used to fetch and dispatch instructions.

[0105] Specifically, the instruction fetch unit generates an instruction fetch request address, outputs the fetch request address to the instruction cache for instruction fetching, receives instructions from the instruction cache, and stores them in the data storage. Each cycle, it sequentially reads qualified instructions from the data storage, decodes and performs relevant checks on the read instructions, and then dispatches the checked instructions sequentially.

[0106] For example, the instruction fetch unit generates an instruction fetch request address and outputs it to the instruction cache for instruction fetching. It also receives instructions from the instruction cache and stores them in the data storage. In each cycle, it sequentially searches for one or more instructions from the qualified instructions, performs decoding and related checks, and dispatches the qualified instructions in sequence. At most, it dispatches one program control unit instruction and one synchronization unit instruction at a time. In addition, it can dispatch one or more scalar arithmetic unit instructions and one or more memory access unit instructions at a time.

[0107] 2. Register renaming unit The register renaming unit is used to receive instructions dispatched by the instruction fetch unit and to rename registers.

[0108] Specifically, the register renaming unit receives and stores instructions dispatched by the instruction fetch unit, renames special vector registers, performs instruction conditional decoding, and generates pipeline congestion signals. It receives data from one or more of the following: the scalar arithmetic unit, memory access unit, program control unit, synchronization unit, special vector registers, condition registers, and flag registers, and writes it back. It sends instructions to the arithmetic reserved stack unit, and stores them in one or more of the following: the program control unit, and the synchronization unit.

[0109] For example, the register renaming unit in a scalar processor is used to receive instructions dispatched by the instruction fetch unit and rename registers and special vector registers, decode instruction conditions, generate pipeline congestion signals, and simultaneously receive data from execution units (such as scalar arithmetic units, memory access units, program control units, and synchronization units) to write back registers, special vector registers, condition registers, and status flag registers and write them back to the corresponding registers.

[0110] Scalar processors support out-of-order write-back, resulting in high execution efficiency. They also distribute instructions to the arithmetic stack, storage stack, program control unit, or synchronization unit.

[0111] The register renaming unit bandwidth can be 6 bits, during which multiple (e.g., 4) input instructions can be valid at the same time.

[0112] There can be multiple condition registers, which are located in the register renaming unit.

[0113] The instructions for the scalar arithmetic unit and memory access unit support reading and writing condition registers.

[0114] The instructions for the synchronization unit support reading the condition register.

[0115] The program control unit's jump and function call instructions support reading the condition register.

[0116] When an instruction enters the condition register, the pipeline will be blocked if there are unexecuted instructions in the condition register.

[0117] In other words, the condition register is not renamed; when a read / write request occurs, a dispatch blocking mechanism is triggered to wait. The conditions register read / write rules are as follows: Reading rules: (1) All instructions in the scalar arithmetic unit, memory access unit, and synchronization unit support conditional execution and require reading the value of the condition register.

[0118] (2) The scalar arithmetic unit also supports read condition register instruction operations.

[0119] (3) The jump and function call instructions of the program control unit support reading condition register operations.

[0120] Write the rules: (1) The scalar arithmetic unit supports write condition register instructions.

[0121] (2) Scalar arithmetic unit logic instructions and comparison instructions support the option to write to the condition register.

[0122] When a previously issued instruction to write to the condition register has not yet finished executing, and another instruction to read or write to the same condition register enters, the pipeline becomes congested, generating a condition execution block signal, and waits for the previous condition register to finish writing.

[0123] In addition, the register renaming unit includes one or more physical registers and one or more logical registers.

[0124] Each of the following physical registers can be one of the following: scalar physical register, vector physical register, condition register, or flag register.

[0125] Any logic register can be one of the following: scalar logic register or vector logic register.

[0126] For example, a register renaming unit contains one or more physical registers, such as multiple 512-bit special vector registers, multiple condition registers, and a status flag register.

[0127] Among them, the special vector register is renamed, while the condition register and status flag register are not renamed.

[0128] There are multiple logical registers, such as read-only registers and multiple vector logical registers.

[0129] In addition, the mapping relationship between logical registers and physical registers is maintained by a register mapping table. The mapping relationship between vector logical registers and vector physical registers is maintained by a special vector register mapping table.

[0130] 1) Register Map Table Initially, the mapped physical registers for all entries corresponding to logical register indices in the register map are all 0. When an instruction is executed, or when an interrupt occurs, the logical register allocated to the relevant physical register is determined, and the mapping of the entries corresponding to the allocated logical register indices in the register map is updated to the identifier of the relevant physical register.

[0131] For example, a register map table with a depth of 32 bits and a width of 6 bits stores the mapping relationship between all logical registers and all physical registers. Initially, the register map table is invalid, and all entries mapping physical registers are all 0. When a physical register is allocated to a logical register, the entry in the register map table corresponding to the logical register index is changed to the ID of that physical register.

[0132] It should be noted that the register map is only updated when an instruction is actually executed. If the conditional execution instruction is not executed, the register map will not be updated. In addition, the register map will not be updated when a jump occurs. However, when an interrupt occurs, the interrupt return address must update the register map to ensure that the interrupt can return normally.

[0133] 2) Special Vector Register Mapping Table Initially, the mapped vector physical registers for all entries corresponding to vector logical register indices in the special vector register map are all 0. When an instruction is executed, the vector logical register allocated to the relevant vector physical register is determined, and the mapping of the entries corresponding to the allocated vector logical register indices in the special vector register map is updated to the identifier of the relevant vector physical register.

[0134] For example, the special vector register map table, with a depth of 4 bits and a width of 3 bits, stores the mapping relationship between all vector logic registers and all vector physical registers. Initially, the special vector register map table is invalid, and all entries mapping to vector physical registers are 0. When a vector physical register is allocated to a vector logic register, the entry in the special vector register map table corresponding to the vector logic register index is changed to the ID of that vector physical register.

[0135] It should be noted that the special vector register mapping table is only updated when the instruction is actually executed. If the conditional execution instruction is not executed, the special vector register mapping table will not be updated. In addition, the special vector register mapping table will not be updated when a jump occurs.

[0136] 3. Operations retain stack units The operation-reserved stack unit is the issue queue of scalar operation units.

[0137] The arithmetic stack is used to receive instructions, dispatch and rename information from the register renaming unit and push them into the queue. Ready instructions are popped into the scalar arithmetic unit for execution.

[0138] The stack space is reserved for operations and is also used to decode input instructions and store instruction type information.

[0139] In other words, the arithmetic reserve stack is the dispatch queue of the scalar arithmetic unit. The arithmetic reserve stack receives instructions and related dispatch and renaming information from the register renaming unit and pushes them into the queue. It also pops ready instructions onto the scalar arithmetic unit for execution. The arithmetic reserve stack decodes the input instructions and stores the instruction type information.

[0140] In practice, the depth of the operation reserve stack can be flexibly adjusted, such as a depth of 8. Multiple scalar operation units share one operation reserve stack unit.

[0141] The rules for issuing and receiving instructions that reserve stack space are as follows: (1) The output of the register renaming unit enters the operation reserve stack unit.

[0142] (2) When there is any free scalar arithmetic unit, it will fetch instructions and operands from the arithmetic reserve stack and execute them.

[0143] (3) The principle of fetching instructions from the operation reserved stack is to fetch executable instructions that can be sent from the operation reserved stack in the order from front to back.

[0144] (4) Whether it is possible to send a value based on the values ​​of all source registers or special vector registers or condition registers and status flag registers is ready to be determined.

[0145] (5) If there are multiple instructions that can be sent, send the oldest instruction first according to the order of instructions.

[0146] (6) If any scalar arithmetic unit is blocked, it can no longer receive new instructions.

[0147] (7) If the instruction previously sent to any scalar arithmetic unit was a division instruction, a new division instruction can only be sent to it after the division result is calculated and the calculation completion En signal is returned.

[0148] 4. Store and retain stack units The storage-reserved stack unit is the issue queue for memory access units.

[0149] The storage reserve stack unit is used to receive instructions and register renaming information from the register renaming unit and push them into the queue.

[0150] The storage reserve stack unit is also used to send a read request to the register renaming unit when the instruction address register is ready, and to save the read address operand.

[0151] The register renaming unit is also used to calculate the address after the instruction has obtained the address, decode the address, and save the decoded information.

[0152] The register renaming unit is also used to detect when the existence source register of any instruction is ready and the address decoding is complete, and then issue it to the memory access unit for execution.

[0153] In practice, the depth of the memory reservation stack unit can be flexibly adjusted, such as 16. Multiple memory access units share one memory reservation stack unit. The memory reservation stack unit is the issue queue for memory access units. The memory reservation stack unit receives instructions and register renaming information from the register renaming unit and pushes them into the queue. When the instruction address register in the memory reservation stack unit is ready, a read request is sent to the register renaming unit, and the read address operand is saved to the queue. After the instruction in the memory reservation stack unit obtains the address, it can calculate the address and decode the address, saving the resulting decoding information to the queue. When the source register of an instruction (such as a write instruction) is ready in the memory reservation stack unit and the address decoding is complete, it can be issued to the memory access unit for execution. Before issuance, a series of checks are performed, such as address type checks, address comparison checks, and address forward checks.

[0154] The rules for storing and reserving stack cells for sending and receiving instructions are as follows: (1) The output of the register renaming unit enters the memory retention stack unit.

[0155] (2) Once the source operand for the calculation address is ready, calculate the memory access address and store it in the memory reservation stack.

[0156] (3) Address-independent instructions: can be out of order. The out-of-order rules are: read instructions after read instructions, write instructions after read instructions, and read instructions after write instructions can all be sent out of order. Write instructions after write instructions need to be ordered (cannot be sent to different memory access units at the same time). Even if the address-independent write instructions are written after write instructions, the order still needs to be maintained.

[0157] (4) Address-related instructions: The order of reading instructions followed by writing instructions, writing instructions followed by reading instructions, writing instructions followed by writing instructions, and reading instructions followed by reading instructions must be guaranteed.

[0158] (5) When addresses are unrelated but are located in the same memory space as all instructions that have not been successfully sent (i.e. instructions on the way that have not been sent to the destination, including those at the memory access unit level and the memory access unit output level), they can be sent out of order to the same memory access unit, but they cannot be sent to two or more memory access units.

[0159] (6) Only one memory access instruction located in the same memory space but with unrelated addresses can be sent at the same time. Two or more memory access instructions cannot be sent at the same time.

[0160] (7) Address correlation judgment principle: whether addresses are related is: if they are located in different storage spaces, they are not related; if they are located in the same storage space, the address correlation is judged based on the data granularity.

[0161] 5. Scalar Operation Unit In a practical implementation, there can be one or more scalar operation units.

[0162] For example, a scalar processor includes two scalar arithmetic units, namely scalar arithmetic unit 0 and scalar arithmetic unit 1.

[0163] The scalar arithmetic unit is used to receive instructions and data sent by the arithmetic storage stack unit, perform operations on the data based on the instructions, and write the operation result back to the register renaming unit.

[0164] The scalar arithmetic unit is the computational unit of the scalar processor. It can perform various types of fixed-point and floating-point operations, such as addition, subtraction, multiplication, division, logical operations, comparison operations, and shifting. It receives instructions and data sent from the arithmetic stack, performs the operations, and writes the results back to the register file of the register renaming unit or the special vector register file.

[0165] The following are some example instructions. In actual implementation, the instructions are not limited to these, nor is it limited to including all of them.

[0166] Instructions at execution level one include: fixed-point addition and subtraction, logical instructions, shift instructions, fixed-point and floating-point comparison instructions, read / write Flag instructions, fixed-point and floating-point max / min instructions, ABS instructions, bit reversal instructions, selection instructions, special vector register dispatch instructions, read special vector register instructions, Byte reversal instructions, Merge instructions, immediate assignment instructions, FirstOne instructions, CRC instructions, floating-point classification instructions, floating-point partial field extraction instructions, and Rounding instructions.

[0167] Instructions with an execution level of three include: fixed-point multiplication instructions, fixed-to-floating-point conversion instructions, bit filtering instructions, count instructions, and floating-point addition and subtraction instructions.

[0168] Instructions that support bypass include: selection instructions, fixed-point addition and subtraction instructions, shift instructions, immediate assignment instructions, ABS instructions, logical instructions, comparison instructions, and maximum and minimum instructions.

[0169] The execution cycle of a division instruction is indeterminate and depends on the data of the divisor and dividend. Upon completion, the instruction generates a DivEn instruction, indicating its completion and outputting the result to the register file. No new division instructions can be input during the execution of a division instruction, but other scalar computation unit instructions can be input. The output result of the division is multiplexed with the output port of the first-stage pipeline. When the output port of the first-stage pipeline is not used by other scalar computation unit instructions, the division outputs its result and simultaneously outputs the DivEn flag. This DivEn flag is output to the arithmetic reserve stack, indicating that Div instructions can continue to be output to the current scalar computation unit. 6. Memory access unit In a practical implementation, there can be one or more memory access units.

[0170] For example, a scalar processor includes two memory access units, namely memory access unit 0 and memory access unit 1.

[0171] The memory access unit is used to receive instructions, data, and register information sent by the memory-reserved stack unit, and to read and write the data based on the instructions and register information.

[0172] The memory access unit is a functional module that executes memory access-related instructions in a scalar processor. The memory access unit receives instructions and data, as well as register-related information, from the memory-reserved stack. It executes the instructions accordingly, interacts with other units for data reading and writing, and writes data back to the register renaming unit for read and write instructions. This includes register-level read and write instructions, including 8-bit, 16-bit, 32-bit, 64-bit, or other bit granularities, as well as vector-level read and write instructions. Vector granularities include 128-bit, 256-bit, 512-bit, or other bit granularities. Different instructions have different processing times.

[0173] In addition, the memory access unit is responsible for providing the number of instructions required by the FENCE, and the memory access unit interacts with the memory reservation stack unit to complete the data storage configuration.

[0174] 7. Program Control Unit In practice, there is only one program control unit.

[0175] The program control unit receives instructions and data from the register renaming unit, processes the data based on the instructions, and outputs the processing results.

[0176] The program control unit is a functional module that executes instructions related to the execution order of the scalar processor's control program. The program control unit receives instructions and data from the register renaming unit, processes the data accordingly, and outputs the processing results to other modules of the scalar processor. Different instructions have different processing time cycles.

[0177] The program control unit is responsible for controlling the direction of program execution (such as stopping, interrupting, jumping, and function calling), involving the execution of related instructions and the reading and writing control of configuration information; the program control unit is responsible for the configuration and prefetching operation of the instruction cache, as well as the FENCE operation; the program control unit is responsible for the reading, writing and control of the counter, as well as the reading and writing of some other control information, etc.

[0178] 8. Synchronization Unit In practice, there is only one synchronization unit.

[0179] The synchronization unit is used for synchronizing the scalar processor and the vector processor.

[0180] like Figure 6 As shown, the synchronization unit establishes communication connections with the pipeline control unit, register renaming unit, program control unit, and vector processor.

[0181] The instructions for the synchronization unit come from the register renaming unit, and the reading and writing of data in the synchronization unit are all done in interaction with the register renaming unit.

[0182] The synchronization unit is used to receive the pause signal sent by the pipeline control unit and send the execution-level pause signal generated during communication with the vector processor to the pipeline control unit in order to generate the execution pause signal of the scalar processor.

[0183] The synchronization unit is used to generate instructions and transmit them to the program control unit.

[0184] In other words, the synchronization unit is the unit that synchronizes the scalar processor and the vector processor. It receives instructions and data from the register renaming unit, reads data from the vector processor and writes it back to the register file, and reads data from the register file unit or special vector register file unit and sends it to the vector processor. It is responsible for the startup and status query of the vector processor, such as querying the read and write FIFO (First Input First Output) in the vector program control unit of the vector processor, the configuration of the register file, the read or write of scalar registers, the status query of the register file, reading the FIFO depth, reading the startup vector processor instruction counter, etc., and providing synchronization unit instruction information to the program control unit.

[0185] The synchronization unit interacts with the pipeline control unit, register renaming unit, and program control unit within the scalar processor, as well as with the external vector processor, scalar processor, and vector processor transfer queue module. Synchronization unit instructions originate from the register renaming unit, and data reads and writes require interaction with this unit. It receives blocking signals from the pipeline control unit, generates its own execution-level blocking signal when communicating with the vector processor, and sends it to the pipeline control unit to generate the ExeStall signal affecting the entire scalar processor. The synchronization unit generates the instructions to be executed in the next cycle and transmits them to the program control unit for use by the program control unit's counter instructions. The synchronization unit interacts with the vector processor, including but not limited to: configuring the register file using special vector registers or registers, reading and writing scalar registers, and querying the write status of the register file. The scalar processor interacts with the scalar processor and vector processor transfer queue module, including but not limited to: starting the vector processor, querying the vector processor status, reading and writing FIFO data in the vector processor's instruction fetch unit, reading the FIFO depth, and reading the start vector processor instruction counter.

[0186] Therefore, in a specific implementation, the synchronization unit can have the following functions (it should be noted that the following functions are only examples, and other functions may also be available. This embodiment and subsequent embodiments do not limit the specific functions of the synchronization unit): The Startup Vector Processor function is used to start the vector processor, including immediate start and register start, such as pipeline waiting until the start is successful, or writing the result of the start success or failure back to the destination register.

[0187] The query vector processor execution status function supports option B.

[0188] The read / write FIFO function is located in the instruction fetch unit of the vector processor. For example, the FIFO has a bit width of 32 bits. The read / write function waits until the read / write operation is successful, or the result of the read / write operation is successfully or unsuccessfully written back to the register.

[0189] Write register file stack functionality, including special vector register write or register write.

[0190] The function allows reading and writing scalar registers, including reading and writing immediate indexes or register indexes.

[0191] The function queries the register file stack write-back status. If necessary, it waits until all writes to the register file stack are complete, or returns the result of whether the write to the register file stack is complete to the register.

[0192] When the relevant operation is not completed, a blocking signal is generated by the synchronization unit itself, and the unit blocks and waits. This signal is then sent to the pipeline control unit to generate a pipeline blocking signal.

[0193] A FIFO (such as a 32-bit deep FIFO) can be added between the scalar processor and the vector processor to store the vector processor start request. The read / write FIFO previously located in the vector processor is moved to the scalar processor and vector processor transfer queue module. The scalar processor and vector processor transfer queue module unit implements the functions of starting the vector processor, querying the vector processor execution status, reading and writing the FIFO, reading the FIFO depth, and reading the start vector processor instruction counter. The conditions for successfully starting the vector processor are that the start vector processor FIFO is not full, and the query of the vector processor execution status is successful. The conditions for the vector processor status to stop are that the vector processor has finished executing and the start vector processor FIFO is empty.

[0194] 9. Production line control unit The pipeline control unit is used to generate a pause signal for the pipeline and / or to generate start and stop signals for the scalar processor.

[0195] The pipeline control unit is the pipeline control unit of the scalar processor. It is connected to various units inside the scalar processor and is responsible for generating pipeline blocking signals, such as blocking in normal operation mode and blocking in debug mode.

[0196] The pipeline control unit also communicates with the communication and synchronization unit to generate signals for starting and stopping the scalar processor.

[0197] In addition, scalar processors can also perform conditional execution decoding in practical applications. For example, when performing conditional execution decoding, a scalar processor checks the preset bits of the instruction to determine the execution condition. If the condition is met, a valid instruction is output; otherwise, a null instruction is output. Here, a null instruction represents an empty instruction or an invalid instruction.

[0198] If a read / write operation is active in the condition register, pipeline blocking is triggered, waiting for the condition register write operation to complete before the read operation can proceed. There is no bypass for condition register reads and writes.

[0199] Taking two condition registers, namely condition register 0 and condition register 1, with the preset bits [29:28] as an example, when the scalar processor performs conditional execution decoding, it judges the execution conditions of the input instruction based on the [29:28] bits of the instruction set encoding. If the conditions are met, a valid instruction is output; otherwise, a null instruction is output.

[0200] In this instruction, bits [29:28] being 00 indicates that condition register 0 is 1 and the instruction is executed; bits [29:28] being 01 indicates that condition register 1 is 1 and the instruction is executed; bits [29:28] being 10 indicates that condition register 0 is executed; and bits [29:28] being 11 indicates that the instruction is executed without conditions. If the conditions are not met, the instruction is invalid and an empty instruction is output.

[0201] If there is a read / write dependency in the condition register, pipeline blocking is triggered, and the read operation is performed only after the condition register has been written. There is no bypass for condition register read / write operations.

[0202] (ii) Vector Processor See Figure 7 The vector processor includes: a vector program control unit, multiple functional units, a register file stack, and scalar registers.

[0203] In addition, the vector processor also includes: a private vector register for the vector interleaving unit and a private vector register for the vector access unit.

[0204] 1. Vector Program Control Unit Vector program control unit, used for instruction fetching and instruction issuing.

[0205] That is, the vector program control unit is used to retrieve instructions, determine whether to execute them, and issue instructions to functional units based on the determination result.

[0206] The vector program control unit is also used to control instruction jumps.

[0207] The vector program control unit has scalar computation capabilities.

[0208] The vector program control unit interacts with the scalar register.

[0209] In practical implementation, the vector program control unit is an instruction fetch and instruction issue unit. It fetches instructions from the cache based on the PC value, and after determining whether to execute, issues instructions to each functional unit based on the wait value (configured by the wait instruction). It also controls instruction jumps and has some scalar computation capabilities.

[0210] In addition, the vector program control unit is also used to receive start commands from other processing processors and start the vector processor. It also returns an indication signal to other processing processors indicating whether the vector processor has finished.

[0211] Taking other processing processors as scalar processors as an example, the vector program control unit receives the start command issued by the synchronization unit of the scalar processor, starts the vector processor to execute, and also returns an indication signal to the synchronization unit whether the vector processor execution has ended.

[0212] 2. Functional Units Functional units are used to perform functional processing according to instructions.

[0213] For example, a functional unit receives instructions from a vector program control unit, processes the data accordingly, and outputs the processing results at the address specified in the instructions.

[0214] The functional units include: one or more vector operation units, one or more vector interleaving units, and one or more vector access units.

[0215] 1) Vector operation unit Any vector operation unit is used to perform vector operations according to instructions.

[0216] like Figure 8 As shown, any vector operation unit includes: a floating-point multiply-add subunit, a floating-point multiply-accumulate subunit, a floating-point arithmetic subunit, a tensor multiplication subunit, and an intermediate result register.

[0217] The floating-point multiply-accumulate subunit and the floating-point arithmetic subunit share one issue slot. Therefore, a maximum of 8 instructions from the vector operation unit can be issued per cycle.

[0218] The floating-point multiplication-accumulation subunit and the tensor multiplication subunit share a single launch slot.

[0219] The floating-point multiply-accumulate subunit is a functional unit that executes instructions related to floating-point multiply-accumulate operations. For example, instructions related to floating-point multiply-accumulate operations include integer and floating-point vector multiplication and accumulation, multiplication, addition, tensor calculation, etc.

[0220] Each vector operation unit has its own intermediate result register.

[0221] One floating-point multiply-accumulate subunit, one floating-point multiply-accumulate subunit, one tensor multiplication subunit, and one floating-point arithmetic subunit share an intermediate result register.

[0222] (1) Floating-point multiply-accumulate and floating-point multiply-accumulate subunits, which can perform integer and floating-point vector multiplication, multiply-accumulate and other operations. Supported types include, but are not limited to, int32, fp32, and fp64.

[0223] (2) The floating-point arithmetic subunit can perform integer and floating-point vector arithmetic operations, such as comparison, addition, subtraction, bitwise operations, etc. Supported types include, but are not limited to, int8, uint8, int16, uint16, int32, uint32, bool, fp16, bf16, fp32, tf32, fp64.

[0224] (3) The tensor multiplication subunit can perform tensor multiplication, multiply-accumulate and other operations. Supported types include, but are not limited to, int8, bf16, fp16 and tf32.

[0225] 2) Vector interleaving unit Any vector interleaving unit is used to perform data interleaving and logical processing according to instructions.

[0226] The vector interleaving unit is the control and data processing unit within the vector processor. It is responsible for interleaving data, supporting logical and some fixed-point and floating-point calculations. It also supports numerous customized instructions, including table lookup, horizontal calculation, sparse matrix calculation, precision conversion, and FIFO (First Input First Output) functions. It executes instructions such as data broadcasting, extraction, and internal interleaving.

[0227] Each vector interleaving unit has a set of private vector registers; therefore, the private vector registers of each vector interleaving unit correspond one-to-one with the vector interleaving units.

[0228] 3) Vector Access Unit Each vector access unit is used to perform multi-mode memory access, address calculation, and scalar calculation according to instructions.

[0229] The vector access unit is the memory access unit within the vector processor, primarily responsible for reading / writing instructions and various scalar calculations.

[0230] The read / write instructions support multiple memory access modes, such as row mode, column mode, discrete mode, extended mode, and accumulation mode.

[0231] It supports multiple parameter configurations, with a maximum read / write instruction data width of up to 1024 bits. It executes instructions such as address calculation, load / store, etc.

[0232] All vector access units share a set of private vector registers, so the private vector registers of a vector access unit are shared by multiple vector access units.

[0233] 3. Register file stack The register file is used to receive and return data after read / write requests. The data is rearranged and then returned. It interacts with functional units for read / write operations. The configuration registers of the vector program control unit are configured using data within the register file.

[0234] The register file stack is a general-purpose vector register stack, which is the main storage unit within the vector processor. It is responsible for receiving read and write requests and returning data. In some functions, it can rearrange the data before returning it to the requesting module.

[0235] The register file stack interacts with functional units within the vector processor (such as the floating-point multiply-accumulate subunit, floating-point arithmetic subunit, floating-point multiply-accumulate subunit, and tensor multiplication subunit), and also supports configuring the instruction fetch unit configuration register using data in the register file stack.

[0236] The register file is also used to write data to other processing units. It receives status messages from other processing units indicating whether the data has been written.

[0237] Taking other processing processors as examples, such as scalar processors, the synchronization unit of a scalar processor can write data to the register file, and the register file can also receive status information from the synchronization unit of the scalar processor to query whether the data has been written.

[0238] The depth of the register file heap is configurable.

[0239] Figure 9 A schematic diagram of a vector processor is shown, comprising four vector operation units, four vector interleaving units, and four vector access units.

[0240] The vector processor provided in this embodiment supports the VLIW (Very Long Instruction Word) instruction set. Each VLIW can consist of one or more instructions, and each instruction corresponds to a functional unit.

[0241] In addition, read FIFO units and write FIFO units are set up between the vector processor and other computing processors.

[0242] The vector program control unit and other arithmetic processors both perform read operations on the read FIFO unit and write operations on the write FIFO unit.

[0243] Other processing units perform read or write operations on the vector register.

[0244] Taking other processing processors as examples, such as scalar processors, there are read FIFO and write FIFO units between the scalar processor and the vector processor for transmitting data. The scalar processor and the vector program control unit can perform read operations or write operations on the read and write FIFOs.

[0245] Meanwhile, the synchronization unit of the scalar processor can perform read or write operations on the scalar registers of the vector processor.

[0246] The device provided in this embodiment can perform effective data calculation in each cycle at a high clock frequency, thereby improving computing efficiency and reducing power consumption.

[0247] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of this application can be implemented in various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.

[0248] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0249] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0250] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0251] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0252] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0253] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. An adder, characterized in that, The adder includes: an input preprocessing module, a fixed-point accumulation unit, and a continuous accumulation step difference preprocessing unit; in, The input preprocessing module is used to obtain the source operands; wherein the source operands are in floating-point format; The fixed-point accumulation unit is used to perform addition calculations of the mantissa of the first source operand and the mantissa of the second source operand within one cycle to obtain the accumulation result; The continuous accumulation step difference preprocessing unit is used to perform step alignment between the accumulation result and the next second source operand in the next cycle and each subsequent cycle, based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand. The fixed-point accumulation unit is also used to perform addition calculation between the accumulated result after alignment and the next second source operand in each subsequent cycle to obtain the accumulated result; The processor in the device where the adder is located is a high-performance processor, which includes scalar processors and vector processors; The scalar processor includes: an instruction fetch unit for fetching and dispatching instructions; a register renaming unit for receiving instructions dispatched by the instruction fetch unit and register renaming; an operation reserve stack unit for receiving instructions, dispatch and renaming information from the register renaming unit, pushing them into a queue, and popping ready instructions to the scalar operation unit for execution; a storage reserve stack unit for receiving instructions and register renaming information from the register renaming unit and pushing them into a queue; a scalar operation unit for receiving instructions and data sent by the operation reserve stack unit, performing operations on the data based on the instructions, and writing the operation results back to the register renaming unit; a memory access unit for receiving instructions, data, and register information sent by the storage reserve stack unit, and reading and writing the data based on the instructions and register information; a program control unit for receiving instructions and data from the register renaming unit, processing the data based on the instructions, and outputting the processing results; a synchronization unit for synchronizing the scalar processor and the vector processor; a pipeline control unit for generating pipeline pause signals and / or generating scalar processor start and stop signals; a register file unit; and a special vector register file unit. The vector processor includes: a vector program control unit for instruction fetching and instruction issuance; multiple functional units for performing functional processing according to instructions; a register file stack and scalar registers for receiving read / write requests, returning data, rearranging the data, and returning it to the functional units for read / write interaction; private vector registers of vector interleaving units; and private vector registers of vector access units. Each vector interleaving unit has a set of private vector registers, and the private vector registers of each vector interleaving unit correspond one-to-one with the vector interleaving unit. All vector access units share a set of private vector registers, therefore the private vector registers of a vector access unit are shared by multiple vector access units.

2. The adder according to claim 1, characterized in that, The continuous accumulation step preprocessing unit is used to determine whether the exponent of the accumulation result is the same as or differs by 1 from the exponent of the next second source operand. If the exponent of the accumulated result is the same as or differs by 1 from the exponent of the next second source operand, then the order of the accumulated result and the next second source operand is aligned according to the relationship between the exponent of the accumulated result and the exponent of the next second source operand. If the exponent of the accumulated result is not the same as the exponent of the next second source operand, and the difference is not 1, then the rounding point is determined; based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand, the order between the accumulated result and the next second source operand is adjusted.

3. The adder according to claim 1 or 2, characterized in that, The continuous accumulation step difference preprocessing unit is used to determine the restriction code based on the relationship between the exponent of the accumulation result and the exponent of the next second source operand; and to perform order matching between the restriction code and the next second source operand.

4. The adder according to claim 3, characterized in that, The continuous accumulation step difference preprocessing unit is used to determine the restriction code based on the difference between the exponent of the accumulation result and the exponent of the next second source operand, as well as the number of leading zeros in the accumulation result. Alternatively, the restriction code can be determined by using a restriction code encoder based on the relationship between the exponent of the accumulated result and the exponent of the next second source operand.

5. The adder according to claim 4, characterized in that, The continuous accumulation step difference preprocessing unit is used to determine the rounding point position based on the result of a bitwise AND operation between the sign bit of the exponent difference between the two source operands that yielded the accumulation result and the mantissa of the accumulation result. The fixed-point accumulation unit is also used to perform addition calculations on the mantissa of the accumulated result after alignment and the mantissa of the next second source operand according to the rounding point position, so as to obtain the accumulated result.

Citation Information

Patent Citations

  • Floating-point accumulation / gradual decrease operational method with floating-point precision maintaining function

    CN103019647A

  • Interleaved pipeline of floating-point adders

    CN111752618A

  • Data processing method and device, chip, computer equipment and storage medium

    CN116974513A