Processors including double-multiply-double-add operators that can be driven by instructions with three operand references.

By using the FDMDA operator and FFDMDAW instruction, the inefficiency of polynomial, complex number, and matrix multiplication operations in the processor core instruction set was solved, achieving more efficient calculations and improving the performance of the processor core.

CN114691088BActive Publication Date: 2026-11-10KALRAY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111624919.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-12-29
Filing Date
2021-12-28
Publication Date
2026-11-10
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

Existing processor core instruction sets are inefficient at performing multiplication and addition operations with more than three operands, resulting in wasted resources and performance bottlenecks, especially in polynomial, complex number multiplication, and matrix multiplication calculations.

Method used

The FDMDA operator is introduced, which uses the FFDMDAW instruction in the instruction set to specify five operands by referencing three registers and simultaneously perform multiplication and addition operations, thus realizing polynomial evaluation, matrix multiplication and complex number operations.

Benefits of technology

It improves the computational efficiency of the processor core, reduces the number of instructions, and enhances the performance of polynomial, complex number, and matrix operations, especially significantly improving computational speed in deep learning and artificial intelligence applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691088B_ABST
    Figure CN114691088B_ABST
Patent Text Reader

Abstract

This invention relates to a method for processing data by a processor, the method comprising: the processor receiving an instruction including operator code associated with three register references, the three register references specifying a register configured to contain a multiplication operand pair and an addition operand, and a result register configured to receive the result of the operator; the operator code specifying an operator configured to compute the product of the multiplication operand pairs and add the product to the addition operand; the processor decoding the instruction to determine an operator to be executed and a register containing operands to be provided to the operator and the result of the operator; the processor's arithmetic circuitry driving the operator using the operands in the registers specified by the register references; and storing the result of the operator in the specified result register.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the implementation of digital processing hardware operators in processor cores, particularly operators that combine several numbers through multiplication and addition. Background Technology

[0002] The manipulated numbers can be encoded in different formats, such as fixed-point or floating-point, single-precision or double-precision, integer, and Galois field element representation. Combinatorial operations can include, for example, polynomial evaluation, complex number arithmetic, and matrix or vector multiplication.

[0003] Many applications involve the sum of products of numbers. This is the case, for example, with matrix multiplication or transcendental functions such as trigonometric and logarithmic functions, which are approximated by polynomials. Artificial intelligence techniques such as deep learning use matrix multiplication, which can have hundreds of rows and columns, as well as linear combinations for computation.

[0004] In major general-purpose processor cores, the sum of products of numbers is performed by relying on a hardware operator that performs fused multiply-add (FMA). Specifically, this operator performs the operation a·b+c with three operands a, b, and c (which can be floating-point numbers) in the following manner: first, the product of operands a and b is calculated, and then the product is added to operand c. The result of the addition is rounded to a number that can be represented in floating-point format. This number can be stored in a register for use as an addition operand in a new FMA operation.

[0005] Typically, instructions in a processor core instruction set accept no more than three explicit operands in the form of processor core register identifiers. That is, two source register identifiers contain the values ​​of the operands, and the destination register identifier is intended to receive the result of the operation.

[0006] For performance reasons, it is desirable to implement a processor core with hardware operators that combine multiple multiplication and addition operations, and to add instructions to the processor core's instruction set to activate these hardware operators.

[0007] Therefore, it is desirable to provide a processor core instruction set that includes instructions that can combine more than three operands without using more than three register identifiers, so as to evaluate, for example, polynomial, complex number multiplication, or matrix multiplication using a minimum number of instructions. Summary of the Invention

[0008] The embodiment relates to a method for processing data by a processor, the method comprising the steps of: the processor receiving an instruction including operator code associated with three register references, the three register references specifying registers configured to contain multiplication operand pairs and addition operands, and a result register configured to receive the result of the operator, the operator code specifying an operator configured to compute the product of the multiplication operand pairs and add the product to the addition operands; the processor decoding the instruction to determine the operator to be executed and registers containing operands to be provided to the operator and the result of the operator; the processor's arithmetic circuitry driving the operator using operands in the registers specified by the register references; and storing the result of the operator in the specified result register.

[0009] According to an embodiment, a register reference includes two register references that specify the following respectively: two pairs of consecutive registers in a register set configured to contain multiplication operands; or two sets of N consecutive registers in a register set configured to contain multiplication operands, wherein the operator is configured to compute N products from the N pairs of registers by associating a register in one set of the two sets with a corresponding register in the other set of the two sets.

[0010] According to an embodiment, a register reference includes: a register reference specifying the same register configured to contain an addition operand and receive a result provided by an operator; or a register reference specifying two consecutive registers in a register group, the two consecutive registers being configured to contain an addition operand and receive a result provided by an operator, respectively; or a register reference specifying a register configured to contain an addition operand and a register reference specifying a register configured to receive a result provided by an operator.

[0011] According to the embodiment, the product is calculated simultaneously, and the addition is performed simultaneously.

[0012] According to an embodiment, a register reference specifies multiple operand sets, and each specified register includes one operand from each operand set, while an operator is executed on each operand set, and a specified result register contains the result of the operator using the operand set.

[0013] According to an embodiment, the method includes the following steps: receiving a series of instructions for evaluating a polynomial, wherein the instructions in the series of instructions specify operators and five operands, each instruction being configured to evaluate two terms of a variable relating to a quadratic polynomial, wherein the quadratic polynomial is generated from the decomposition of the polynomial to be evaluated, and each instruction being configured to calculate the sum of the two terms and a third term of the quadratic polynomial; designating the result register of the instructions in the series of instructions as a product operand register to be multiplied by the square of the variable in subsequent instructions of the series of instructions; and executing the instructions in the series of instructions sequentially by the processor to calculate the value of the variable relating to the polynomial to be evaluated.

[0014] According to an embodiment, the polynomial to be evaluated is pre-decomposed into two polynomials, which respectively group terms containing variables raised to even powers and terms containing variables raised to odd powers. The instruction set includes two instruction sets for calculating the two polynomials respectively.

[0015] According to an embodiment, the method includes the following steps: receiving by a processor a series of instructions for evaluating the dot product of two vectors, the series of instructions including instructions specifying an operator, the instructions being configured to each compute two terms of the product and add them to the result obtained by executing the preceding instruction in the series of instructions specifying the operator; and the processor sequentially executing the instructions in the series of instructions.

[0016] According to an embodiment, the instructions include parameters that selectively indicate the sign of each product to be reversed before calculation.

[0017] According to an embodiment, the instructions include parameters that selectively indicate that registers of a specified multiplication operand, specified by one of the register references, should be swapped in pairs before the product is computed.

[0018] According to an embodiment, the method includes the following steps: receiving by a processor a series of instructions for evaluating the product of two complex numbers, the series of instructions including a specified operator and two instructions containing a register pair containing the real and imaginary parts of the two complex numbers respectively, one of the two instructions being configured to compute the real part of the product and the other of the two instructions being configured to compute the imaginary part of the product; and executing the instructions in the series of instructions by the processor.

[0019] According to the embodiments, operands are encoded in one of the following formats: single-precision or double-precision floating-point, fixed-point, integer, and numbers belonging to the Galois field.

[0020] According to an embodiment, the processor's arithmetic circuitry is configured to calculate products and sums through rounding operations without loss of precision.

[0021] The embodiments may also involve processors configured to implement previously defined methods.

[0022] According to an embodiment, the processor includes a plurality of processing units for driving in parallel a plurality of operators for calculating a product and adding the product to an addition operand.

[0023] According to an embodiment, the processor includes an operator that includes a plurality of multipliers and adders, each multiplier calculating the product of operand pairs, and the adders adding the products together with the addition operands. Attached Figure Description

[0024] Examples of embodiments of the invention will be described below in conjunction with the accompanying drawings, wherein:

[0025] Figure 1 This is a diagram of the double multiplication and double addition operator.

[0026] Figure 2 An example of a processor core architecture that can be used as the basis for this invention is shown.

[0027] Figure 3 This is a schematic diagram illustrating an example of incorporating double multiplication and double addition operators.

[0028] Figure 4 This is a diagram illustrating another example of incorporating double multiplication and double addition operators. Detailed Implementation

[0029] This disclosure provides a processor core having instructions in its instruction set for driving an FDMDA operator that combines two multiplications and two additions to perform the operation a1·b1+a2·b2+c. This operator performs the equivalent of two FMA operations. In an embodiment, the FDMDA operator is combined with three register references to specify the five operands of the operator and to specify the register that receives the result of the operation.

[0030] Figure 1 The fused multiply-add operator FDMDA is illustrated. This operator is associated with two pairs of multiplicative operands, or multiplicands (a1, b1) and (a2, b2), and an adder operand c. The multiplicand pairs (a1, b1) and (a2, b2) are provided to the respective multipliers. The resulting two products p1, p2 (referred to as "partial products") and the adder operand c are simultaneously added by the adder tree ADDT. The multiplicands and the addition operator can be in floating-point format with the same or different precisions, or in different formats such as fixed-point or integers. The result of the addition is processed by the normalization and rounding circuit NMRD to be converted back to the original floating-point format so that it can be reused as the adder operand c.

[0031] According to an embodiment, a register reference of the FDMDA operator specifies the register that contains the value of operand c and is used to provide the result of the operation.

[0032] According to another embodiment, the two operand pairs (a1, b1) and (a2, b2) are specified by two register references, where each register references two consecutive registers in the specified register set.

[0033] According to an exemplary embodiment, the processor core instruction set includes the instruction FFDMDAW, which specifies the FDMDA operator and is associated with a register reference, as follows:

[0034] FFDMDAW$r x =$r y r y+1 ,$r z r z+1 ,or

[0035] FFDMDAW$r x =$r y ,$r z .

[0036] In this representation, "$r x Specify the register r that contains operand c x Its purpose is to receive the result of the operation, "$r y r y+1 ,$r z r z+1 "or "$r y ,$r z "Specify two consecutive pairs of registers in the register set (r)" y ,r y+1 ) and (r z ,r z+1 Therefore, each pair of consecutive registers specified contains two operands. This instruction performs the operation: r x =r x +r y ·r z +r y+1 ·r z+1 .

[0037] According to an embodiment, the FFMDAW operator can be applied to representations of floating-point numbers, fixed-point numbers, integers, or numbers belonging to the Galois field, using single-precision or double-precision formats.

[0038] According to the embodiments, evaluating a polynomial Pn of degree n is generally expressed as:

[0039]

[0040] The polynomial Pn is decomposed into nested polynomials of degree 2, in the following form:

[0041] P n (x)=x 2 Q n-2 (x)+a1x+a0, when n is even, (2)

[0042] P n (x)=xQ n-1 (x)+a0, when n is odd, (3)

[0043] Q j (x)=x 2 Q j-2 (x)+a n-j+1 x+a n-j When n is even, j = 2, 4, 6, ..., n-2 (or, when n is odd, j is 2, 4, 6, ..., n-1). For example, a polynomial of degree 6 (n = 6) can be represented in the following form:

[0044] P6(x)=((a6x 2 +a5x+a4)x 2 +a3x+a2)x 2 +a1x+a0

[0045] A polynomial of degree 7 (n=7) can be represented in the following form:

[0046] P7(x)=((a7 ... 2 +a6x+a5)x 2 +a4x+a3)x 2 +a2x+a1)x+a0

[0047] The calculation of the polynomial P6(x) can be performed, for example, using the following sequence of instructions:

[0048] LW$r8 = x # Load x into register r8

[0049] FMULW$r9 = $r8, $r8 # Calculate x in register r9 2

[0050] LW$r7 = a6 # Loads a6 into register r7

[0051] LW$r6 = a5 # Load a5 into register r6

[0052] LW$r5 = a4 # Load a4 into register r5

[0053] LW$r4 = a3 # Load a3 into register r4

[0054] LW$r3 = a2 # Loads a2 into register r3

[0055] LW$r2 = a1 # Load a1 into register r2

[0056] LW$r1 = a0 # Load a0 into register r1

[0057] FFDMDAW$r5=$r6r7,$r8r9#Calculate r5=Q2(x=a6x 2 +a5x+a4

[0058] FDMDAW$r3=$r4r5,$r8r9#Calculate r3=Q4(x)=x 2 Q2(x)a3x+a2

[0059] FDMDAW$r1=$r2r3,$r8r9#Calculate r1=P6(x)=x 2 The text following the character "#" in Q4(x)a1x+a0 is an explanatory comment on the preceding instruction.

[0060] It can be observed that the polynomial P6(x) can be evaluated using only three consecutive FFDMDAW instructions, without having to pass intermediate results to another register. Generally, if n is even, a polynomial of degree n can be evaluated using n / 2 FFDMDAW instructions, while if n is odd, it can be evaluated using (n+1) / 2 FFDMDAW instructions.

[0061] According to another embodiment, polynomial P n It is decomposed into two polynomials P 2k and P 2k+1 or P 2k-1 So that when n is even (n = 2k), P n (x)=P 2k (x)+x·P 2k-1 (x), when n is odd (n = 2k + 1), P n (x)=x·P 2k+1 (x 2 )+P 2k (x 2 By setting X = x 2 Polynomial P 2k and P 2k+1 It has the following forms:

[0062]

[0063] Therefore, two independent polynomials are processed, where the decompositions defined by equations (2) and (3) can be applied to these two independent polynomials in an independent manner. If the processor core allows, especially in the case of SIMD ("Single Instruction Multiple Data") processor cores, the two polynomials P can be processed in parallel. 2k (X) and P 2k-1 (X)(or P) 2k+1 Evaluate (X).

[0064] The FFDMDAW command can also be used to calculate matrix multiplication or dot product with one or more of the following types of operations:

[0065]

[0066] Where V1 is the component (a0, a1, a2, ..., a n V2 is a vector of components (b0, b1, b2, ..., b) n The dot product of vectors V1 and V2 can be executed via the following instruction sequence, according to an embodiment:

[0067] LW$r1 = 0 # Initialize register r1

[0068] LW$r2 = a0 # Load a0 into register r2

[0069] LW$r3 = a1 # Load a1 into register r3

[0070] LW$r8 = b0 # Load b0 into register r8

[0071] LW$r9 = b1 # Load b1 into register r9

[0072] FFDMDAW$r1=$r2r3,$r8r9#Calculate r1=r1+a0·b0+a1·b1

[0073] LW$r2 = a2 # Loads a2 into register r2

[0074] LW$r3 = a3 # Loads a3 into register r3

[0075] LW$r8 = b2 # Load b2 into register r8

[0076] LW$r9 = b3 # Load b3 into register r9

[0077] FFDMDAW$r1=$r2r3,$r8r9#Calculate r1=r1+a2·b2+a3·b3

[0078] …

[0079] Therefore, each of the above FFDMDAW instructions calculates two consecutive products a. i ·b i and a i+1 ·b i+1 They are then added to the previous results stored in register r1.

[0080] According to an embodiment, the FFMDAW instruction can be associated with additional parameters, which are defined, for example, by suffixes that can take values ​​such as ".NP", ".PN", and ".NN", and specify whether the sign of the first product (r2·r4) or the sign of the second product (r3·r5) should be inverted in the calculation r1 = r1 + r2·r4 + r3·r5 performed by the FFMDAW operator. Therefore:

[0081] FFDMDAW.NP$r1=$r2r3,$r4r5

[0082] Perform the operation r1 = r1 - r2·r4 + r3·r5.

[0083] FFDMDAW.PN$r1=$r2r3,$r4r5

[0084] Perform the operation r1 = r1 + r2·r4 - r3·r5.

[0085] FFDMDAW.NN$r1=$r2r3,$r4r5

[0086] Perform the operation r1 = r1 - r2·r4 - r3·r5.

[0087] According to an embodiment, the FFDMDAW instruction can be associated with additional parameters, such as those defined by the suffix ".X" to specify that the two values ​​in a second pair of registers should be swapped before performing the calculation.

[0088] Therefore, FFDMDAW.X$r1=$r2r3,$r4r5

[0089] Perform the operation r1 = r1 + r2·r5 + r3·r4.

[0090] The combination of sign reversal and parameter swapping can be used, for example, to compute complex numbers z1 = a + b·i and z2 = c + d·i (where i 2 The product of z1 and z2 is useful. Therefore, the product z1·z2 = a·c – b·d + i(a·d + b·c) can be obtained by the following instruction:

[0091] LW$r0=0# Initialize register r0 to 0

[0092] LW$r1=0# Initialize register r1 to 0

[0093] LW$r2 = a # Load 'a' into register r2

[0094] LW$r3 = b # Load b into register r3

[0095] LW$r4 = c# loads c into register r4

[0096] LW$r5 = d # Load d into register r5

[0097] FFDMDAW.PN$r0=$r2r3,$r4r5#r0=r2·r4-r3·r5=a·c–b·d

[0098] FFDMDAW.X$r1=$r2r3,$r4r5#r1=r2·r5+r3·r4=a·d+b·c, registers r0 and r1 receive the real part (a·c–b·d) and imaginary part (a·d+b·c) of the product of complex numbers z1 and z2, respectively.

[0099] Similarly, the product of complex numbers can be calculated using the conjugate of another complex number:

[0100]

[0101] The product can be obtained using the following two commands.

[0102] FFDMDAW$r0=$r2r3,$r4r5#r0=r2·r4+r3·r5=a·c+b·d, and

[0103] FFDMDAW.NP.X$r1=$r2r3,$r4r5#r1=-r2·r5+r3·r4=-a·d+b·c.

[0104] It can be observed that these instructions allow for the separate specification of registers that receive the real and imaginary parts of the product. If the processor core allows it, especially in the case of processor cores with SIMD instructions, the dot product of vectors of complex numbers can therefore be computed in a single operation or in parallel, with the real and imaginary parts of the product obtained from the individual vectors specified in the instructions.

[0105] It should also be noted that the multiplicand pairs (a1, b1) and (a2, b2) can be specified in various other ways in the FFDMDAW instruction. For example, the instruction FFDMDAW $r1 = $r2r3, $r4r5 can specify the operation r1 = r2·r3 + r4·r5 + r1. In this case, the ".X" parameter is used to swap registers r3 and r5.

[0106] According to an embodiment, the FDMDAW instruction includes a fourth register reference to specify two distinct registers containing the addition operand c and the result of the operation, respectively. Therefore, for example, an instruction specifying the FDMDA operator can be expressed as follows:

[0107] FFDMDAW$r0=$r2r3,$r4r5,$r1#r0=r2·r4+r3·r5+r1.

[0108] According to another embodiment, the FFDMDAW register of the multiplicand of the instruction refers to a set of N consecutive registers in each specified processor core register file. For hardware reasons, N may be limited to a power of 2 (N = 2^N). n (n = 1, 2, 3, ...). Therefore, for example, the instruction specifying the FNMNA operator for N = 4 can be expressed as follows:

[0109] FFNMNAW$r1=$r4r5r6r7,$r8r9r10r11

[0110] #r1=r1+r4·r8+r5·r9+r6r·10+r7·r11, or

[0111] FFNMNAW$r1=$r4,$r8

[0112] #r1=r1+r4·r8+r5·r9+r6·r10+r7·r11.

[0113] Relations (2) and (3) can be generalized and adapted to cases where the FFNMNAW instruction can perform four or more multiplications and add all the resulting products to the addition operands. Therefore, depending on the number of multiplicand pairs specified in the FFNMNAW instruction, the polynomial to be evaluated can be decomposed into polynomials of degree 4 or higher. In this case, the “.X” parameter can be used in the FFNMNAW instruction to specify that the registers in each pair of registers in one of the specified sets of N registers should be swapped. Additionally, the instruction can be associated with “.N” / “.P” parameters for each register in one of the specified sets of N registers.

[0114] More generally, the FFMDDAW (or FFNMNAW) instruction can be extended to a SIMD instruction to process operand sets (each operand set containing Q elements) simultaneously to evaluate Q FDMDA (or FFNMNAW) operations. For example, in the instruction FFMDDAWQ$r0=$r2r3,$r4r5, each register ri (i=1,2,...5) contains Q=4 operands ri[j], j=1,2,3,4, and the instruction is executed by performing four operations:

[0115] r0[j]=r2[j]·r4[j]+r3[j]·r5[j], where j=1,2,3,4.

[0116] Therefore, the register specified in the FFDMDAWQ instruction is four times the size of the register specified in the FFDMDAW instruction.

[0117] Figure 2 An example of a processor core PRC that can have the FFDMDAW instruction in its instruction set is shown. This processor core has a pipeline with a depth of 7 stages, including the instruction prefetch stage PF, the instruction decode stage ID, the register fetch stage RR, and four instruction execution stages E1 through E4.

[0118] The PF level essentially includes a buffer PFB that stores preloaded instructions fed from the instruction cache ICH. The ID level includes the instruction decoding unit DEC, which controls the register file RF of the formation level RR. The decoding unit is configured to decode FFMDAW instructions. The register set RF manages the general-purpose registers GPR, which in this example are 64 64-bit registers r0 through r63. Depending on the instruction being decoded, the selected register is read from or written to one of the multiple parallel processing units forming the execution levels E1 through E4. These processing units may include a load / store unit LSU that accesses the data cache DCH, a floating-point unit FPU, a branch and compare unit BCU linked and configured to process instructions dedicated to it based on input from the decoder DEC, one or more arithmetic logic units ALU0, ALU1, and may include one or more operators of type FNMNA (N=2). n The multiplication unit (MAU) is a multiplication unit. The MAU can be merged with the FPU.

[0119] The processor core features a VLIW (Very Long Instruction Word) architecture. Therefore, the DEC (Decoding Unit) can handle groups of instructions to be executed simultaneously. Here, the core can execute up to five instructions concurrently: one in each of the E1-E4 execution levels and one in the BCU (Browser Control Unit) as described below.

[0120] The BCU unit is designed to support branch management and includes a set of system function registers (SFRs). These SFRs include a program counter (PC) configured to store the address of the currently executing instruction (or the address of the first instruction in a VLIW block), and a processor core status register (PS) defining the privilege ring in which the current instruction is executed, associated permissions, and masked exceptions. Repositories for the SPC and SPS are also provided for storing the program counter and processor core status register.

[0121] The processor core also includes various peripheral units, including the Interrupt Controller (ITC) that generates interrupts to the BCU based on external events, the Memory Management Unit (MMU) associated with the Address Translation Table (TLB), the Input / Output Interface (IF), the Performance Monitor (PM), the Cache Memory (DCH), etc.

[0122] Figure 3 The example operator OP represents the mixed-precision structure FDMDA(fp16 / fp32). Details of how normalized floating-point numbers are handled are not described, including some elements typically required such as denormalized numbers, undefined numbers (NaN), and infinite numbers.

[0123] The operator OP comprises multiple floating-point multiplication units FPM30, 31, each providing a fixed-point result. Each FPM unit receives a pair of multiplicands (a1, b1), (a2, b2) in, for example, format fp16 (or binary 16) or fp31 (or binary 32). Each multiplicand includes a sign bit S, an exponent EXP, and a mantissa MANT. The two mantissas are provided to multiplier 10, which computes the product of the mantissas MANT as an integer. The mantissa product is provided to alignment circuit 12, which is controlled by adder 14 that produces the sum of the exponents EXP of the multiplicands a1 and b1 (or a2 and b2). Alignment circuit 12 is configured to perform a conversion of the mantissa product considering the sum of the exponents, so that the product p of the multiplicands a1, b1 (or a2, b2) is provided as a fixed-point number.

[0124] The output of alignment circuit 12 is passed to negation circuit 16, which is configured to reverse the sign of the absolute value when the signs of the multiplicands are opposite. Therefore, the number generated by negation circuit 16 constitutes the output of one of multiplication units 30 and 31. Thus, each partial product a1·b1, a2·b2 is calculated by the corresponding multiplication unit 30 or 31. The partial products are then provided to adder 26.

[0125] Furthermore, the addition operand c provided to the operator OP, for example in fp32 (or binary 32) format, includes a sign bit S, an exponent EXP, and a mantissa MANT. The mantissa MANT is provided to alignment circuit 18, which is controlled by the exponent of operand c. Circuit 18 is configured to perform a conversion between the floating-point operand c and a fixed-point number.

[0126] The number provided by alignment circuit 18 is passed through negation circuit 20, which is controlled by the sign bit of operand c. Alternatively, negation circuit 20 can be omitted, and at negation circuit 16, the sign of the product can be reversed if the sign of the product is not equal to the sign of operand c.

[0127] Therefore, the fixed-point number provided by adder 26 is added to the addition operand c, which has been converted to a fixed-point number. Thus, alignment circuit 18 performs the conversion to a fixed-point number and adjusts the downstream processing accordingly. Specifically, the higher-order bits of operand c are provided to adder 22. On the side of the partial product summation, the 80+0 bits provided by adder 26 are padded with 24 fixed-value bits on the left and right (0 for a positive result, or 1 for a negative result).

[0128] Adder 22 receives the output of adder 26 and the high-order bits of the signed number provided by negation circuit 20. The low-order bits of the output of negation circuit 20 are used in downstream rounding calculations.

[0129] The output of adder 22 is processed by normalization and rounding circuit 24, which converts the fixed-point result of the addition into a floating-point number rs in fp32 format. The sizes of multiplication units 30, 31 and adders 22, 26 can be adjusted to perform lossless or rounding calculations. Furthermore, the rounding performed by circuit 24 can be correctly calculated.

[0130] therefore, Figure 3 The operator OP structure performs only one rounding operation when converting the final addition result to a floating-point number, and this single rounding operation can be correctly calculated in any case.

[0131] Of course, the number of multiplication units (FPMs) can be extended to more than two to execute FFNMNAW instructions with more than one pair of multiplicands. In practice, it can be observed that the multiplication units (FPMs) are independent of each other, as there is no need to compare the exponents of the partial products to perform relative alignment of the mantissas of the partial products. Each FPM unit converts to the same fixed-point format common to all numbers. Therefore, it is particularly easy to change the number of multiplication units (FPMs) as needed, since there is no interdependence between the multiplication units. Adjusting the structure of the multi-adder 26 according to the number of operands is also easy, as it is done according to system rules. Therefore, the complexity of the operator can remain proportional to the number of multiplication units.

[0132] according to Figure 4 In the illustrated embodiment, the FDMDA operator OP1 further includes an inverter circuit 35 that receives operands b1 and b2 for exchanging these operands according to a control signal xc. Therefore, given the state of signal xc, operand b1 is provided to multiplication unit 31 instead of unit 30, and operand b2 is provided to multiplication unit 30 instead of unit 31. The state of signal xc can be controlled by the instruction decoder DEC, depending on the presence of the parameter ".X" in the FDMDAW instruction.

[0133] Operator OP1 further includes two negation circuits 36 and 37, controlled by two signals n1 and n2 respectively, to invert the signs of the products at the outputs of multiplication unit 30 and multiplication unit 31 before they are added together in adder 26. The states of signals n1 and n2 are defined by the presence of any of the parameters “.NP”, “.PN”, or “.NN” associated with the instruction FFDMDAW.

[0134] It will be apparent to those skilled in the art that the present invention can have various alternatives and applications. In particular, in Figure 3 and Figure 4 The operators shown have been described as combinational logic circuits. In processor cores with relatively fast clock frequencies, the response time of combinational logic circuits may be too slow. In such cases, operators can have a pipelined structure by providing registers for storing intermediate results (e.g., storing the outputs of alignment circuits 12, 18 and / or circuits 30, 31 and 20). Reference Figure 3 and Figure 4 The described operators can be easily adapted to other precision formats, whether standardized or non-standardized.

Claims

1. A method for processing data by a processor, the method comprising the following steps: The processor receives instructions including operator codes associated with three register references, the three register references specifying registers configured to contain at least two pairs of multiplication operands and an addition operand, and a result register configured to receive the result of an operator, the operator codes specifying an operator configured to compute the product of the at least two pairs of multiplication operands and add the product to the addition operand; The instruction is decoded by the processor's instruction decoder to determine the operator to be executed and a register containing the operands to be provided to the operator and the result of the operator; The arithmetic circuitry of the processor uses operands in a register specified by the register reference to drive the operator; as well as The result of the operator is stored in the specified result register.

2. The method according to claim 1, wherein, The register reference includes two register references that specify the following items respectively: The register set consists of two consecutive pairs of registers configured to contain the multiplication operands, or The register set consists of two groups of N consecutive registers configured to contain the multiplication operands, wherein the operator is configured to compute N products from N pairs of registers by associating a register in one of the two groups with a corresponding register in the other of the two groups.

3. The method according to claim 1, wherein, The register references include: Specify a register reference that is configured to contain the addition operand and receive the result provided by the operator, or Register references to two consecutive registers in a specified register set, wherein the two consecutive registers are respectively configured to contain the addition operand and receive the result provided by the operator, or Register references specify the registers configured to contain the addition operands and register references specify the registers configured to receive the results provided by the operator.

4. The method according to claim 1, wherein, The product is calculated simultaneously, and the addition is performed simultaneously.

5. The method according to claim 1, wherein, The register reference specifies multiple operand sets, and each specified register includes one operand from each operand set. The operator is executed simultaneously on each operand set, and the specified result register contains the result of the operator using the operand sets.

6. The method according to claim 1, comprising the following steps: The processor receives a series of instructions for evaluating a polynomial, wherein the instructions in the series of instructions specify the operator and five operands, each instruction is configured to evaluate two terms of a variable relating to a quadratic polynomial, wherein the quadratic polynomial is generated from the decomposition of the polynomial to be evaluated, and each instruction is configured to calculate the sum of the two terms and a third term of the quadratic polynomial. The result register of an instruction in the instruction set is designated as the product operand register to be multiplied by the square of the variable in subsequent instructions in the instruction set, and The processor executes instructions in the instruction set sequentially to calculate the values ​​of the variables involved in the polynomial to be evaluated.

7. The method according to claim 6, wherein, The polynomial to be evaluated is pre-decomposed into two polynomials, which respectively group terms containing variables raised to even powers and terms containing variables raised to odd powers. The instruction set includes two instruction sets for calculating the two polynomials respectively.

8. The method according to claim 1, comprising the following steps: The processor receives a series of instructions for evaluating the dot product of two vectors, the series of instructions including instructions specifying the operator, the instructions being configured to each compute two terms of the product and add them to the result obtained by executing the preceding instruction in the series of instructions specifying the operator, and The processor executes instructions in the instruction set sequentially.

9. The method according to claim 1, wherein, The instruction includes parameters that selectively indicate the sign of each product to be reversed before adding the product to the addition operand.

10. The method according to claim 1, wherein, The instruction includes parameters that selectively indicate that the multiplication operands contained in a register specified by one of the register references of the specified multiplication operands should be swapped in pairs before the product is computed.

11. The method according to claim 1, comprising the following steps: The processor receives a series of instructions for evaluating the product of two complex numbers. The series of instructions includes two instructions specifying the operator and a pair of registers containing the real and imaginary parts of the two complex numbers, respectively. One instruction is configured to compute the real part of the product, and the other instruction is configured to compute the imaginary part of the product. The instruction configured to compute the imaginary part of the product is associated with a parameter indicating that the multiplication operands contained in a register specified by one of the register references indicating the multiplication operands of the instruction will be swapped before the product is computed. At least one of the two instructions is associated with a parameter selectively indicating that the sign of each product in the product will be inverted. The processor executes the instructions in the instruction set.

12. The method according to claim 1, wherein, The operands are encoded in one of the following formats: Single-precision or double-precision floating-point, Fixed point, Integers, and Numbers belonging to the Galois field.

13. The method according to claim 1, wherein, The processor's arithmetic circuitry is configured to calculate the product and add the product to the addition operands via rounding operations without loss of precision.

14. A processor configured to implement the method of claim 1.

15. The processor of claim 14, comprising a plurality of processing units configured to drive in parallel a plurality of operators for calculating the product and adding the product to an addition operand.

16. The processor of claim 14, further comprising an operator, the operator including a plurality of multipliers and an adder, each multiplier calculating the product of operand pairs, the adder adding the products together with addition operands.

Citation Information

Patent Citations

  • X87 fused multiplication-addition instruction and its use

    CN101145099A