Method for computing multiple operands and apparatus therefor

By designing the operation device to allocate to different processing circuits according to the mantissa width of the operand, and using the order concept multiplexing hardware, the hardware resource waste problem of floating point and fixed-point number multiplication and accumulation operations in deep learning is solved, and efficient operation is achieved and save chip area.

CN119088337APending Publication Date: 2024-12-06SHANGHAI CAMBRICON INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310659159.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-05
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In the field of deep learning, processors need to process multiplication and multiplication and accumulation operations of multiple floating-point and fixed-point numbers. The existing technology is difficult to effectively utilize hardware resources, resulting in waste of chip area and reduced computing efficiency.

Method used

A calculation device is designed to compare the mantissa widths of operands and allocate them to different processing circuits for calculations, and multiply and accumulate parts of floating-point numbers and fixed-point numbers by multiplexing part of the hardware to save hardware overhead.

Benefits of technology

It realizes the maximum saving of hardware overhead while ensuring processing efficiency, reducing chip area, covering multiple data types of multiplication and accumulation operations, and improving the processor's multiplexing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088337A_ABST
    Figure CN119088337A_ABST
Patent Text Reader

Abstract

The present invention relates to a method and apparatus for operating multiple operands, in which the apparatus of the present invention is included in an integrated circuit device in which one or more combined processing devices are integrated, the combined processing devices being an artificial intelligence arithmetic unit for supporting various deep learning and machine learning algorithms, and intelligent processing requirements in complex scenes in the fields of computer vision, voice, natural language processing, data mining and the like are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention generally relates to the field of computers, and more specifically to an apparatus for calculating multiple operands, an integrated circuit apparatus and a board thereof, and a method for calculating multiple operands, a computer-readable storage medium, a computer program product, and a computer apparatus thereof. Background Art

[0002] Fixed-point or floating-point operations are often required in the computer field, especially in deep learning algorithms, where multiplication and multiplication-accumulation operations account for more than 90% of operations. Multiplication-accumulation refers to a series of operands multiplied by two, and then the results of the multiplication are added up, for example:

[0003] z=a0·b0+a1·b1+a2·b2+a3·b3

[0004] Where a and b are operands.

[0005] Multiplication and multiplication-accumulation operations are widely used, so computers often have to deal with multiplication-accumulation operations in multiple data formats, including not only floating-point numbers such as FP16 and FP32, and fixed-point numbers such as INT4 and INT8. The data formats of floating-point numbers also vary greatly, such as TF32's exponent bits are 8 bits and mantissa bits are 10 bits, FP8's exponent bits are 4 bits and mantissa bits are 3 bits, or FP8's exponent bits are 5 bits and mantissa bits are 2 bits. When the processor performs data multiplication or multiplication-accumulation operations, how to reasonably set the processor's processing bit width according to the different types of data formats to be supported in the design of the chip and processor, avoid idleness and waste of hardware resources, and minimize the chip area as much as possible while ensuring processing efficiency, is an urgent problem to be solved in the field of deep learning. Summary of the invention

[0006] In order to at least partially solve the technical problems mentioned in the background technology, the solution of the present invention provides a device for calculating multiple operands and its integrated circuit device and board, as well as a method for calculating multiple operands and its computer-readable storage medium, computer program product, and computer device.

[0007] In one aspect, the present invention discloses a device for operating multiple operands, the device comprising: a comparison circuit for identifying the bit width of the mantissa bits of the operands and comparing the bit width of the mantissa bits with a bit width threshold; an allocation circuit for allocating the operands whose bit width of the mantissa bits is greater than the bit width threshold to a first operation circuit for operation, otherwise to a second operation circuit for operation, the first operation circuit and the second operation circuit both comprising an exponent processing circuit and a mantissa processing circuit, the processing bit width of the mantissa processing circuit of the first operation circuit being greater than the processing bit width of the mantissa processing circuit of the second operation circuit.

[0008] In one aspect, the present invention discloses a device, wherein at least one mantissa processing circuit of the second operation circuit multiplexes a mantissa processing circuit of the first operation circuit.

[0009] In one aspect, the present invention discloses a device, wherein at least one exponential processing circuit of the second operation circuit multiplexes an exponential processing circuit of the first operation circuit.

[0010] In one aspect, the present invention discloses a device, when the mantissa processing circuits of multiple second operation circuits reuse the mantissa processing circuit of one first operation circuit, the mantissa processing circuits of multiple second operation circuits operate simultaneously; and / or when the exponent processing circuits of multiple second operation circuits reuse the exponent processing circuit of one first operation circuit, the exponent processing circuits of multiple second operation circuits operate simultaneously.

[0011] In one aspect, the present invention discloses a device, wherein the operand comprises a floating point number, and the floating point number comprises at least one of FP32, TF32, BF16, FP16, UHP, FP8, and FP12.

[0012] In one aspect, the present invention discloses a device, wherein the sign bit of the FP12 format is 1 bit, the exponent bit is 8 bits, and the mantissa bit is 3 bits.

[0013] In one aspect, the present invention discloses a device, wherein the sign bit of the FP12 format is 1 bit, the exponent bits are 5 bits, and the mantissa bits are 6 bits.

[0014] In one aspect, the present invention discloses a device, wherein the sign bit of the FP12 format is 1 bit, the exponent bits are 4 bits, and the mantissa bits are 7 bits.

[0015] In one aspect, the present invention discloses a device, wherein the bit width threshold is 5.

[0016] In one aspect, the present invention discloses a device, wherein the processing bit width of the mantissa processing circuit in the first operation circuit is 10 bits, and the processing bit width of the mantissa processing circuit in the second operation circuit is 3 bits or 4 bits.

[0017] In one aspect, the present invention discloses a device, wherein the processing bit width of the exponent processing circuit of the first operation circuit is 8 bits, and the processing bit width of the exponent processing circuit of the second operation circuit is 5 bits or 8 bits.

[0018] In one aspect, the present invention discloses a device, wherein the first operation circuit and the second operation circuit are multiplication operation circuits, or the first operation circuit and the second operation circuit are factorial accumulation circuits.

[0019] In one aspect, the present invention discloses a device, wherein the factorial accumulation circuit includes: a factorial module for identifying a reference value of the exponents of the multiple operands; a multiplication module for performing a multiplication operation on the mantissas of two operands to be multiplied among the multiple operands to obtain a partial product of the mantissas; and accumulating the partial products to obtain a product result of the mantissas of the two operands; a shift module for shifting the product result according to a difference between the reference value and the exponents of the two operands; and an addition module for performing an addition operation on the shifted product result to obtain a multiplication and accumulation result of the multiple operands.

[0020] In one aspect, the present invention discloses a device, further comprising a switching module, configured to determine whether the plurality of operands are floating point numbers or fixed point numbers.

[0021] In one aspect, the present invention discloses a device, wherein when the plurality of operands are fixed-point numbers, the switch module controls the pair-order module to be closed.

[0022] In one aspect, the present invention discloses a device, wherein when the plurality of operands are fixed-point numbers, the switch module controls the shift module to be turned off.

[0023] In one aspect, the present invention discloses a device, wherein the reference value is a maximum value of exponents of the plurality of operands.

[0024] In one aspect, the present invention discloses a device, wherein the rank module groups the plurality of operands, the reference value is the maximum value of the exponents of the operands in each cluster, and the multiplication module and the shift module perform operations in cluster units.

[0025] In one aspect, the present invention discloses a device, further comprising: a conversion module, configured to convert the precision of the multiplication-accumulation result.

[0026] In one aspect, the present invention discloses a device, wherein the converted precision is FP38, the exponent bits of FP38 are 9 bits, and the mantissa bits of FP38 are 28 bits.

[0027] In another aspect, the present invention discloses an integrated circuit device, comprising any one of the above-mentioned devices.

[0028] In another aspect, the present invention discloses a board comprising the above-mentioned integrated circuit device.

[0029] In another aspect, the present invention discloses a method for operating multiple operands, the method comprising: identifying the bit width of the mantissa bits of the operands, and comparing the bit width of the mantissa bits with a bit width threshold, allocating the operands whose bit width of the mantissa bits is greater than the bit width threshold to a first operation circuit for operation, otherwise allocating them to a second operation circuit for operation, the first operation circuit and the second operation circuit both comprising an exponent processing circuit and a mantissa processing circuit, the processing bit width of the mantissa processing circuit of the first operation circuit being greater than the processing bit width of the mantissa processing circuit of the second operation circuit.

[0030] In another aspect, the present invention discloses a method, wherein at least one mantissa processing circuit of the second operation circuit multiplexes a mantissa processing circuit of the first operation circuit.

[0031] In another aspect, the present invention discloses a method, wherein at least one exponential processing circuit of the second operation circuit multiplexes an exponential processing circuit of the first operation circuit.

[0032] In another aspect, the present invention discloses a method, when the mantissa processing circuits of multiple second operation circuits reuse the mantissa processing circuit of one first operation circuit, the mantissa processing circuits of multiple second operation circuits operate simultaneously; and / or when the exponent processing circuits of multiple second operation circuits reuse the exponent processing circuit of one first operation circuit, the exponent processing circuits of multiple second operation circuits operate simultaneously.

[0033] In another aspect, the present invention discloses a method, wherein the operand comprises a floating point number, and the floating point number comprises at least one of FP32, TF32, BF16, FP16, UHP, FP8, and FP12.

[0034] In another aspect, the present invention discloses a method, wherein the sign bit of the FP12 format is 1 bit, the exponent bit is 8 bits, and the mantissa bit is 3 bits.

[0035] In another aspect, the present invention discloses a computer-readable storage medium having stored thereon a computer program code of a method for operating multiple operands, wherein when the computer program code is executed by a processing device, any of the above-described methods is executed.

[0036] In another aspect, the present invention discloses a computer program product, comprising a computer program for calculating a plurality of operands, wherein when the computer program is executed by a processor, the steps of any one of the above methods are implemented.

[0037] In another aspect, the present invention discloses a computer device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any one of the above methods.

[0038] In the operation of deep learning, the multiplication circuit or multiplication-accumulation circuit of fixed-point or floating-point numbers includes at least an exponential processing circuit and a mantissa processing circuit, wherein the mantissa processing circuit has a larger overhead than the exponential processing circuit and occupies a larger chip area. The present invention sets a plurality of operation circuits in the chip, and the mantissa processing circuits in different operation circuits can process different mantissa bit widths. Operands with different mantissa bit widths are assigned to different operation circuits for multiplication-accumulation or multiplication operations. When the mantissa of the operand is shorter, it is assigned to the operation circuit that processes the shorter mantissa bit width, so as to save hardware overhead to the greatest extent and reduce chip area.

[0039] The present invention is based on multiplication-accumulation operations and utilizes the concept of order to make part of the floating-point operations the same as the fixed-point operations. In this way, part of the same operations can be reused to perform the multiplication-accumulation operations of fixed-point numbers, thereby achieving the technical effect of covering the multiplication-accumulation operations of floating-point numbers and the multiplication-accumulation operations of fixed-point numbers. The fixed-point operation circuit is no longer required to be separately set up, thus saving hardware overhead and reducing chip area. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts. Among them:

[0041] Figure 1A is a structural diagram of a board card according to an embodiment of the present invention;

[0042] Figure 1B is a structural diagram showing an integrated circuit device according to an embodiment of the present invention;

[0043] Figure 2A is a structural diagram showing an apparatus for calculating multiple operands according to an embodiment of the present invention;

[0044] Figure 2B is a structural diagram showing the multiplexing of the mantissa processing circuit according to an embodiment of the present invention;

[0045] Figure 2C is a schematic diagram showing the data structure of FP12 according to an embodiment of the present invention;

[0046] Figure 3 is a schematic diagram showing a factorial accumulation circuit according to an embodiment of the present invention;

[0047] Figure 4 is a schematic diagram showing that the alignment module of the embodiment of the present invention adopts a unified alignment;

[0048] Figure 5is a schematic diagram showing an alignment module of a cluster alignment solution according to an embodiment of the present invention;

[0049] Figure 6 is a schematic diagram showing a screening module according to an embodiment of the present invention;

[0050] Figure 7 is a schematic diagram showing a multiplier in a multiplication module;

[0051] Figure 8 is a schematic diagram showing that a switching module controls other modules according to an embodiment of the present invention;

[0052] Fig. 9 is a schematic diagram showing the operation of a fixed-point multiplication and accumulation method according to an embodiment of the present invention;

[0053] Fig.10 is a flow chart showing a method for calculating operands according to one embodiment of the present invention;

[0054] Fig.11 is a flow chart showing a method for multiplying and accumulating multiple operands according to another embodiment of the present invention;

[0055] Fig.12 FIG. 4 is a flowchart showing a method for multiplying and accumulating multiple operands according to another embodiment of the present invention. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0057] It should be understood that the terms "first", "second", "third" and "fourth" etc. in the claims, specifications and drawings of the present invention are used to distinguish different objects rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present invention indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.

[0058] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the claims, the singular forms of "a", "an" and "the" are intended to include the plural forms unless the context clearly indicates otherwise. It should also be further understood that the term "and / or" used in the specification of the present invention and the claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0059] As used in this specification and claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context.

[0060] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0061] Figure 1A FIG. 1 is a schematic diagram showing the structure of a board 10 according to an embodiment of the present invention. Figure 1A As shown, the board 10 includes a chip 101, which is a system-on-chip (SoC), or system on chip, integrated with one or more combined processing devices, which are artificial intelligence computing units that support various deep learning and machine learning algorithms to meet the intelligent processing needs in complex scenarios in the fields of computer vision, speech, natural language processing, data mining, etc. In particular, deep learning technology is widely used in the field of cloud intelligence. A notable feature of cloud intelligence applications is the large amount of input data, which places high demands on the storage capacity and computing power of the platform. The board 10 of this embodiment is suitable for cloud intelligence applications and has huge off-chip storage, on-chip storage, and powerful computing power.

[0062] The chip 101 is connected to an external device 103 via an external interface device 102. The external device 103 is, for example, a server, a computer, a camera, a display, a mouse, a keyboard, a network card, or a wifi interface. The data to be processed can be transmitted from the external device 103 to the chip 101 via the external interface device 102. The calculation result of the chip 101 can be transmitted back to the external device 103 via the external interface device 102. According to different application scenarios, the external interface device 102 can have different interface forms, such as a PCIe interface.

[0063] The board 10 also includes a storage device 104 for storing data, which includes one or more storage units 105. The storage device 104 is connected to the control device 106 and the chip 101 through a bus and transmits data. The control device 106 in the board 10 is configured to control the state of the chip 101. To this end, in an application scenario, the control device 106 may include a microcontroller (MCU).

[0064] Figure 1B 1 is a block diagram showing the combined processing device in the chip 101 of this embodiment. Figure 1B As shown in , the combined processing device 20 includes a computing device 201 , an interface device 202 , a processing device 203 and an off-chip memory 204 .

[0065] The computing device 201 is configured to execute user-specified operations, and is mainly implemented as a single-core intelligent processor or a multi-core intelligent processor to perform deep learning or machine learning calculations. It can interact with the processing device 203 through the interface device 202 to jointly complete the user-specified operations.

[0066] The interface device 202 is used to transmit data and control instructions between the computing device 201 and the processing device 203. For example, the computing device 201 can obtain input data from the processing device 203 via the interface device 202 and write it into a storage device on the computing device 201 chip. Further, the computing device 201 can obtain control instructions from the processing device 203 via the interface device 202 and write them into a control cache on the computing device 201 chip. Alternatively or optionally, the interface device 202 can also read data from the storage device on the computing device 201 chip and transmit it to the processing device 203.

[0067] The processing device 203, as a general processing device, performs basic controls including but not limited to data handling, starting and / or stopping the computing device 201. Depending on the implementation, the processing device 203 can be a central processing unit (CPU), a graphics processing unit (GPU), or one or more types of processors in other general and / or special processors. These processors include but are not limited to digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., and their number can be determined according to actual needs. As mentioned above, only with respect to the computing device 201 of the present invention, it can be regarded as having a single-core structure or a homogeneous multi-core structure. However, when the computing device 201 and the processing device 203 are integrated and considered together, the two are regarded as forming a heterogeneous multi-core structure.

[0068] The off-chip memory 204 is used to store data to be processed, and is a DDR memory, which is usually 16G or larger in size and is used to save data of the computing device 201 and / or the processing device 203 .

[0069] The computing device 201 of this embodiment includes a device for operating multiple operands. Different data formats of the operands are used. According to the bit width of the mantissa bits, at least two operation circuits are set in the processor to process multiplication or multiplication-accumulation operations of operands with different mantissa bit widths, thereby reducing hardware overhead.

[0070] The computing device 201 of this embodiment includes a device for calculating multiple operands. The concept of rank is used to make some operations of floating-point numbers after rank the same as those of fixed-point numbers, and the hardware of the same operations can be reused. In this way, the multiplication and accumulation device of this embodiment can effectively cover the multiplication and accumulation operations of floating-point numbers and the multiplication and accumulation operations of fixed-point numbers.

[0071] There are two forms of numerical representation in computers: fixed-point numbers and floating-point numbers.

[0072] The data format of fixed-point numbers is divided into a 1-bit sign bit (sign) and multiple bits of mantissa bits (mantissa). The sign bit is used to determine the positive or negative value of the fixed-point number. The mantissa bits are used to determine the value of the fixed-point number. Fixed-point numbers refer to numbers in which the decimal point is fixed in position. Fixed-point numbers are divided into fixed-point integers and fixed-point decimals. Since the decimal point position is fixed, the decimal point does not need to be represented, and the value can be calculated according to the agreed position. Computers usually represent fixed-point numbers as pure decimals or pure integers. If the value is a pure decimal, the decimal point is preset between the sign bit and the highest bit of the mantissa. If the value is a pure integer, the decimal point is preset to the right of the lowest bit of the mantissa.

[0073] The format for expressing floating-point numbers in computers is standardized in IEEE 754. Taking a 37-bit single-precision floating-point number (FP38) as an example, it consists of 1 sign bit, 9 exponent bits (exp) and 28 mantissa bits, and is used to represent the following values:

[0074] Value = sign × mantissa × 2 exp-127

[0075] The exponent has 9 bits, which results in a very large range of exponents. IEEE 754 further stipulates that there is an implicit digit to the left of the decimal point, which is usually 1, so the number of digits of the mantissa in the above single-precision number is actually 29 bits.

[0076] Since the above representation method limits the range and precision of floating-point numbers, floating-point numbers can only be represented approximately for calculation, so the problem of rounding has to be considered. In the decimal system, if you want to retain two decimal places, that is, keep the values ​​of the tenth and hundredth places, then the reserved digit is the lowest digit of the value, that is, the hundredth digit, and the approximate digit is the first digit to be discarded, that is, the thousandth digit, and all digits after the thousandth digit are collectively called sticky bits, and all the information of the sticky bits is lost. For binary, if you want to retain two decimal places, then the second digit to the right of the decimal point is the reserved digit, the third digit to the right of the decimal point is the approximate digit, and all decimal digits from the fourth digit to the right of the decimal point are sticky bits.

[0077] To this end, IEEE 754 defines four different rounding methods: rounding to even numbers, rounding to zero, rounding down, and rounding up. IEEE 754 uses rounding to even numbers by default.

[0078] With the continuous development of machine learning technology, the data formats of floating-point numbers are becoming more and more diverse, including at least: FP32, TF32, BF16, FP16, UHP, and FP8. Among them, the sign bit of FP32 is 1 bit, the exponent bit is 8 bits, and the mantissa bit is 23 bits. The sign bit of TF32 is 1 bit, the exponent bit is 8 bits, and the mantissa bit is 10 bits. The sign bit of BF16 is 1 bit, the exponent bit is 8 bits, and the mantissa bit is 7 bits. The sign bit of FP16 is 1 bit, the exponent bit is 5 bits, and the mantissa bit is 10 bits. UHP has no sign bit, the exponent bit is 6 bits, and the mantissa bit is 10 bits. FP8 has two formats, one with a sign bit of 1 bit, an exponent bit of 4 bits, and a mantissa bit of 3 bits, and the other with a sign bit of 1 bit, an exponent bit of 5 bits, and a mantissa bit of 2 bits.

[0079] The exponent bit width of a floating-point number determines the data expression range, and the mantissa bit width determines the data expression accuracy. The data formats of the above floating-point numbers can be roughly divided into two categories. The first category has a longer mantissa bit width, such as FP32, TF32, BF16, FP16, and UHP, and the second category has a shorter mantissa bit width, such as two formats of FP8. In addition, the exponent bit width of the first type of floating-point numbers is also longer, and the exponent bit width of the second type of floating-point numbers is also shorter. Different types of floating-point numbers have different exponent bit widths and mantissa bit widths, different data expression ranges, and different data expression accuracy, which can adapt to various application scenarios in the field of machine learning, the processing capabilities of various software or hardware carriers, or the complex requirements of different usage stages.

[0080] The data expression range and data accuracy of the first type of floating-point numbers mentioned above are guaranteed, but when used in software and hardware operating carriers, it requires a large resource overhead. In scenarios where the accuracy requirements are not high, it will cause a waste of computing resources, storage resources, and transmission resources, reduce computing efficiency, and occupy a large chip area. The second type of floating-point numbers can improve the computing efficiency of software and hardware operating carriers and reduce chip area on the premise of meeting the accuracy requirements, but there is a large loss in data expression range and data expression accuracy compared to the first type of floating-point numbers.

[0081] Therefore, in the design of the processor's arithmetic circuit, the circuit design overhead of the multiplication operation is mainly considered. In order to meet the requirements of the multiplication and multiplication-accumulation operations of various types of floating-point numbers mentioned above, designing a more general multiplication circuit to improve the circuit reuse efficiency is the focus of the arithmetic unit design.

[0082] like Figure 2AAs shown, the present invention proposes a device for operating multiple operands, and a first operation circuit and a second operation circuit for processing different bit widths are set. The device 2000 for operating multiple operands proposed by the present invention includes a comparison circuit 2001 and an allocation circuit 2002. The comparison circuit 2001 is used to identify the bit width of the mantissa bits of the operands and compare the bit width of the mantissa bits with the bit width threshold; the allocation circuit 2002 is used to allocate the operands whose bit width of the mantissa bits is greater than the bit width threshold to the first operation circuit for operation, otherwise to the second operation circuit for operation, the first operation circuit and the second operation circuit both include an exponent processing circuit and a mantissa processing circuit, and the processing bit width of the mantissa processing circuit of the first operation circuit is greater than the processing bit width of the mantissa processing circuit of the second operation circuit.

[0083] The operands in the present invention may be data to be processed or operated received by the processor or each circuit module inside the processor, or may be operands in ISA (Instruction Set Architecture) instructions received by the processor, which will not be described in detail here.

[0084] In an embodiment of the present invention, the first operation circuit and the second operation circuit can be a multiplication operation circuit, or a multiplication-accumulation circuit or a factorial-accumulation circuit, or other operation circuits or operation circuits that require a larger hardware overhead in the mantissa processing part when processing floating-point numbers, such as a shift circuit, a comparison circuit, etc. The present invention is not limited to this.

[0085] In an embodiment of the present invention, operation circuits with different processing bit widths can be respectively set. The exponential processing circuits of the first operation circuit and the second operation circuit can be reused, and the exponential processing circuit can be set according to the larger value of the exponential processing bit width in the processing bit width requirements of the exponential processing circuits of the first operation circuit and the second operation circuit, so as to be reused by the exponential processing circuits of the first operation circuit and the second operation circuit. For example, if the exponential bit width processing requirements of the exponential processing circuit of the first operation circuit are 8 bits, 5 bits and 6 bits, and the exponential bit width processing requirements of the exponential processing circuit of the second operation circuit are 8 bits, 4 bits and 5 bits, then an exponential processing circuit with an 8-bit processing bit width can be set for reuse by the first operation circuit and the second operation circuit, saving chip area while supporting floating-point operations of multiple data types.

[0086] In the embodiment of the present invention, since the processing bit width of the mantissa processing circuit of the second operation circuit is smaller than the processing bit width of the mantissa processing circuit of the first operation circuit, the mantissa processing circuit of one first operation circuit can be reused as the mantissa processing circuit of at least one second operation circuit, thereby saving chip area and supporting floating-point operations of multiple data types. Figure 2BAs shown, the first operation circuit is an FP16 operation circuit, and the processing bit width of the mantissa processing circuit of the FP16 operation circuit is 10 bits (i.e., a mantissa processing circuit with a 10-bit width). If the processing bit width of the mantissa processing circuit of the second operation circuit is 3 bits (i.e., a mantissa processing circuit with a 3-bit width), the mantissa processing circuit with a 10-bit width can be used as 2 or 3 mantissa processing circuits with a 3-bit width, and the multiplexed mantissa processing circuits with a 3-bit width can work independently, without separately setting a mantissa processing circuit with a 3-bit width outside the mantissa processing circuit with a 10-bit width, that is, the second operation circuit can reuse the hardware structure of the first operation circuit (FP16 operation circuit). The multiplexing circuit in this embodiment can enable the processor or chip to support floating-point numbers of more data types while saving chip area.

[0087] When multiple short-bit-width mantissa processing circuits reuse long-bit-width mantissa processing circuits, multiple short-bit-width mantissa processing circuits can work simultaneously. For example, when a 10-bit-width mantissa processing circuit is reused as 2 or 3 3-bit-width mantissa processing circuits, 2 or 3 3-bit-width mantissa processing circuits can work simultaneously, that is, 2 or 3 3-bit-width mantissa floating-point operations can be processed simultaneously, thereby doubling the computing power of the operation circuit.

[0088] The operands in the embodiments of the present invention may include fixed-point numbers and floating-point numbers. When the operand is a fixed-point number, the exponential processing circuit in each operation circuit may not be used, and the present invention does not limit this. For the convenience of description, the subsequent embodiments of the present invention are all illustrated by floating-point numbers, and the present invention can also produce the same beneficial effects for the processing of fixed-point numbers, which will not be described in detail later.

[0089] The operands in the embodiments of the present invention include floating point numbers, and the floating point numbers include at least one of FP32, TF32, BF16, FP16, UHP, FP8, and FP12.

[0090] like Figure 2C As shown, the present invention proposes a new data format FP12, and the data format of FP12 can be any of the following three:

[0091] 1. 1 sign bit, 8 exponent bits, and 3 mantissa bits. (Can be referred to as 183 format)

[0092] 2. 1 sign bit, 5 exponent bits, and 6 mantissa bits. (Can be referred to as 156 format)

[0093] 3. 1 sign bit, 4 exponent bits, and 7 mantissa bits. (Can be referred to as 147 format)

[0094] It is understandable that the FP12 floating point number in the 183 format has a similar bit width to the mantissa bit of the second type of floating point number, but has a larger data expression range than the second type of floating point number. The FP12 floating point number in the 156 format and the 147 format has a similar bit width to the exponent bit of the second type of floating point number, but has a higher precision expression than the second type of floating point number. In addition to the above two types of floating point numbers, the FP12 format provides more flexible data expression for upper-layer applications.

[0095] In the design of processor arithmetic circuits, compared with addition circuits and comparison circuits, the arithmetic logic of multiplication circuits is more complex, and both the arithmetic unit and data storage require a larger chip area and a larger hardware overhead. For multiplication circuits, long-bit-width multiplication circuits require a larger hardware overhead than short-bit-width multiplication circuits. For example, the hardware overhead of a 10-bit-width multiplication circuit is much greater than that of a 3-bit-width multiplication circuit. Larger hardware overhead means that a larger chip area is required or more energy is consumed during operation, a larger space is occupied during data storage, and a larger bandwidth is occupied during data transmission.

[0096] In the embodiment of the present invention, the bit width threshold can be set as needed, for example, different mantissa processing circuits can be set in the processor according to the type of software model, the category of data to be processed, and the processing requirements. For example, the bit width threshold can be 5, or 6, or 4, etc., whichever is set as needed.

[0097] Specifically, when the bit width threshold is 5, the bit width of each mantissa bit of FP32, TF32, BF16, FP16, UHP, FP12 in 156 format and FP12 in 147 format is greater than 5, and it is allocated to the first operation circuit for operation. The processing bit width of the mantissa processing circuit in the first operation circuit can be set to 10 bits, and the processing bit width of the exponent processing circuit of the first operation circuit is 8 bits. The bit width of the mantissa bit of FP8 and FP12 in 183 format is less than 5, and it is allocated to the second operation circuit for operation. The processing bit width of the mantissa processing circuit in the second operation circuit can be set to 3 bits or 4 bits, and the processing bit width of the exponent processing circuit of the second operation circuit is 5 bits or 8 bits. The mantissa processing circuit with a 3-bit or 4-bit width saves a lot of hardware overhead compared to the mantissa processing circuit with a 10-bit width, and the combination of the mantissa processing circuits with a 10-bit width and a 3-bit or 4-bit width can cover the above-mentioned various types of floating-point number operations, realize the high reuse of the operation circuit, and save the chip area to the maximum extent. The exponent processing circuit and the mantissa processing circuit in the first operation circuit and the second operation circuit can also be set to other bit widths to meet the processing requirements of different types of floating-point numbers, and the present invention does not limit this.

[0098] In an embodiment of the present invention, the above-mentioned operation circuits of different bit widths are set in the processor to meet the processing of floating-point numbers in different quantity formats. The FP12 data format proposed in the present invention, while having the advantages of the above-mentioned two types of floating-point numbers, can directly reuse the operation circuits of the processors designed for the above-mentioned two types of floating-point numbers, without separately setting operation circuits of different bit widths. While providing more flexible data expression, it does not increase the chip area, thereby further improving the processing efficiency of the processor.

[0099] In an embodiment of the present invention, the first operation circuit and the second operation circuit may be multiplication circuits, or the first operation circuit and the second operation circuit may be factorial accumulation circuits, or the first operation circuit and the second operation circuit may be other operation circuits such as shift circuits.

[0100] In an embodiment of the present invention, in addition to the first operation circuit and the second operation circuit, a third operation circuit or more operation circuits may be provided, and the mantissa bits that can be processed by the mantissa processing circuits between the operation circuits are different, and the present invention does not limit this. When there are more than two operation circuits, more than one bit width threshold may be set, and after comparing the bit width of the mantissa bits of the operand with multiple bit width thresholds, the operand may be assigned to a suitable operation device for operation. The present invention will not elaborate on this.

[0101] In the embodiment of the present invention, the comparison circuit and the allocation circuit in the device for calculating multiple operands can be implemented by various hardware circuits such as comparators, and the present invention does not limit the specific hardware circuit implementation.

[0102] In an embodiment of the present invention, the first operation circuit and the second operation circuit, or more operation circuits, can reuse the same hardware circuit structure, and after the data path, control path, data transmission bandwidth and each storage space are configured accordingly, they can be configured as different operation circuits using the control signal of the control circuit and the preset hardware circuit configuration method. For example, a hardware circuit structure with a processing bit width wide enough can be set, and its processing bit width can be set according to requirements to meet the maximum exponent bit width and mantissa bit width in various types of floating-point numbers, or even set to be able to simultaneously complete the maximum bit width processing requirements of twice or more. For example, according to the processing requirements of TF32, the bit width of the exponent processing circuit of the hardware circuit structure is set to 8 bits, and the processing bit width of the mantissa processing circuit is set to 10 bits. After configuration with the control signal and the hardware circuit configuration method, this operation circuit can be used to calculate floating-point numbers of types such as FP32, BF16, FP16, UHP, FP8 and FP12.

[0103] The above-mentioned device for calculating multiple operands allocates different types of floating-point numbers to the first calculation circuit or the second calculation circuit, and the first calculation circuit and the second calculation circuit perform corresponding calculation operations. When the calculation results of the first calculation circuit and the calculation results of the second calculation circuit need to be further calculated to obtain the final result, a calculation device such as an adder can be arranged after the first calculation circuit and the second calculation circuit to complete the corresponding calculation, and the present invention does not limit this.

[0104] In an embodiment of the present invention, the exponent processing circuit and the mantissa processing circuit may include one or more processing circuits that need to perform various logical operations or calculation operations on the exponent or mantissa. For example, the exponent processing circuit of a floating point number can perform comparison operations, addition operations, multiplication operations, etc., and the mantissa processing circuit of a floating point number can perform addition operations, multiplication operations, comparison operations, shift operations, etc. The present invention does not limit this. For example, in the factorial multiplication and accumulation operation circuit of the present invention, the factorial module is a processing circuit that operates on the exponent, and the multiplication module, the shift module and the addition module are processing circuits that operate on the mantissa.

[0105] In an embodiment of the present invention, when part or all of the operating functions of the exponent processing circuit and the mantissa processing circuit are identical or overlapped, the circuit structure of the identical or overlapped part of the operating functions can be reused by the exponent processing circuit and the mantissa processing circuit.

[0106] The following content describes a factorial accumulation circuit according to an embodiment of the first operation circuit and / or the second operation circuit.

[0107] Figure 3 The multiplication and accumulation device of the computing device 201 comprises a factorial module 301 , a multiplication module 302 , a shift module 303 , an addition module 304 , a normalization module 305 , a rounding module 306 and a switching module 308 .

[0108] The following first describes the multiplication and accumulation operation with n floating-point numbers as operands.

[0109] The order matching module 301 is used to identify the base values ​​of the exponents of multiple operands, and other operands can be ordered based on the base values ​​to facilitate subsequent accumulation calculations. This embodiment does not limit the order matching method, and the order matching scheme of the order matching module 301 will be described exemplarily below.

[0110] The alignment module 301 may adopt a unified alignment solution. Figure 4A schematic diagram showing that the alignment module 301 adopts a unified alignment. The alignment module 301 can be a binary tree structure, and the basic unit in the structure is a comparison unit 401, which is a comparator used to compare the exponents of two operands. The comparison unit 401 receives and compares the exponent bits of the two operands (such as the exponent value exp1 of operand 1 and the exponent value exp2 of operand 2), and outputs the larger one max(exp1, exp2). The larger exponent value then enters the comparison unit 401 of the next level for comparison in pairs, until the highest level comparison unit 401 selects the one with the largest exponent max(exp1, exp2,…, exp1) of the n operands. n The purpose of the unified order scheme is to find the maximum exponent of all operands max(exp1, exp2, ..., exp n ) is used as a reference value for the shift module 303 to perform the order shift.

[0111] The present invention does not limit the structure of the comparison unit 401. Those skilled in the art can make appropriate changes according to actual conditions, such as setting an eight-to-one comparator to compare eight operands as a group and sequentially find the one with the largest exponent among the n operands.

[0112] The order module 301 can also adopt a cluster order scheme. The order module 301 first finds the maximum value of the exponent bit in the n operands, and uses the exponent bit as a reference value to filter out the cluster. The exponent values ​​of the operands in the cluster are relatively close, and direct accumulation does not affect the accuracy. After filtering out the cluster, the order module 301 continues to group the operands that have not yet been grouped in the above manner, and repeats the operation until all operands are classified.

[0113] Figure 5 The schematic diagram of the alignment module 301 when the cluster alignment scheme is adopted in this embodiment is shown. The alignment module 301 includes an identification module 501 , a screening module 502 and a clustering module 503 .

[0114] The identification module 501 has similar Figure 4The structure is used to identify the reference value, and the reference value is the maximum value of the exponent bits of all operands that have not been grouped. At the beginning, none of the n operands are grouped, and the identification module 501 finds the maximum value of the exponent bits of all operands, and sets this exponent maximum value as the reference value. The screening module 502 is used to compare this reference value with the exponent values ​​of all operands. If the difference is within a certain range, it is screened into a cluster (for example, the first cluster). The cluster module 503 excludes the operands in the first cluster and sorts out the operands that have not been grouped. The identification module 501, the screening module 502 and the cluster module 503 re-find the reference value based on the updated ungrouped operands, establish a cluster (for example, the second cluster), and update the ungrouped operands until all operands are grouped. Therefore, the n operands will be divided into multiple clusters (the first cluster to the mth cluster), and the reference values ​​of each cluster are different, and the difference between the exponent values ​​of the operands in each cluster and their corresponding reference values ​​is within a certain range. In other words, the exponent values ​​of the operands in each cluster are similar.

[0115] Figure 6 A schematic diagram of the screening module 502 is shown, which includes a subtractor 601 , a comparator 602 , a first register 603 and a second register 604 .

[0116] Subtractor 601 is used to obtain the difference between each exponent value and the reference value based on the result (i.e., the reference value) of identification module 501. There are several implementations of subtractor 601, for example: subtractor 601 has multiple subtraction units, receives the exponent values ​​and reference values ​​of several ungrouped operands at a time, and performs subtraction operation on the exponent values ​​of these operands and the reference value to obtain the difference between each exponent value and the reference value; or inputs an ungrouped operand each time and performs subtraction operation with the reference value until all ungrouped operands are calculated. The present invention does not limit the implementation of subtractor 601.

[0117] The comparator 602 receives the difference value from the subtractor 601 to determine whether the difference value is less than a threshold value, that is, to determine whether the difference between the exponent value of each operand and the reference value is within a threshold value range. The threshold value can be any number, such as 32. If the difference value of the operand is less than the threshold value, the operand is sent to the first register 603 for storage. If the difference value of the operand is not less than the threshold value, the operand is sent to the second register 604 for storage. In other words, the comparator 602 divides the operands into two categories according to the size of the exponent value. The first register 603 is used to store operands whose difference value is less than the threshold value, and the second register 604 is used to store operands whose difference value is not less than the threshold value.

[0118] Since the operands stored in the first register 603 have an exponent difference less than the threshold, it means that the exponent value of the operands in the first register 603 is not much different from the reference value. When the subsequent accumulation is performed, the mantissa will not lose too much precision when the mantissa is shifted due to the large difference in the exponent value. All operands in the first register 603 are grouped into a cluster, ready for subsequent modules to process together. The first register 603 generates different clusters in each round of clustering, such as the first cluster to the mth cluster. However, the exponent value of the operands stored in the second register 604 is too different from the reference value. If accumulation is performed, the mantissa will lose too much precision when it is shifted, so it is sent back to the clustering module 503 and the identification module 501 for re-grouping.

[0119] The cluster module 503 is used to update the operands in the second register 604 to ungrouped operands, that is, the cluster module 503 overwrites the original operands with the operands in the second register 604, so that the ungrouped operands after the update are not all operands, but only the operands in the second register 604. The cluster module 503 sends the updated ungrouped operands to the identification module 501 to identify the operands with the largest index value among the ungrouped operands, and then the screening module 202 screens out the operands whose index value difference with the reference value is less than the threshold value as the next cluster.

[0120] In summary, when this embodiment adopts the cluster alignment scheme, the alignment module 301 divides the n operands into a number of clusters according to the exponent bit values. Figure 3 , the multiplication module 302 may include a plurality of multipliers for performing multiplication operations on the mantissas of two operands to be multiplied among the plurality of operands (such as the mantissa man1 of operand 1 and the mantissa man2 of operand 2) to obtain a partial product of the mantissas. Specifically, the multiplier may include a compression unit and a Wallace tree unit, wherein the compression unit is used to perform Radix-4 Booth compression on the two mantissas, and the Wallace tree unit is used to accumulate the compressed mantissas to obtain a partial product. In a specific implementation of the present invention, the multiplier may be implemented in a variety of ways, which is not limited by the present invention. For example Figure 3 As shown, the multiplication module 302 further includes an adder, which is used to perform accumulation operation on the above partial products to obtain the product result of the mantissas of the two operands. Thus, the product of the two operands is obtained.

[0121] Figure 7 FIG. 4 is a schematic diagram of a multiplier in a multiplication module, which includes a compression unit 701 and a Wallace tree unit 702 .

[0122] The compression unit 701 is used to perform Booth compression on the shifted product result.

[0123] The Wallace tree unit 702 is used to accumulate the compressed product results to obtain a multiplication-accumulation result. Since the Wallace tree only supports the complement operation, and the operation of the multiplication-accumulation device is completed under the original code, the Wallace tree unit 702 needs to convert the original code and the complement code. Specifically, the Wallace tree unit 702 includes a first converter 703, a Wallace tree adder 704 and a second converter 705.

[0124] The first converter 703 is used to convert the compressed mantissa into a complement code for the Wallace tree adder 704 to perform operand accumulation operation. The Wallace tree adder 704 is used to accumulate the compressed product result complement code to obtain the accumulation result, that is, the accumulation value complement code. The Wallace tree adder 704 is a multi-stage two-input addition unit, for example, it can be a five-stage two-input addition unit: including a first-stage addition unit, a second-stage addition unit, a third-stage addition unit, a fourth-stage addition unit and a fifth-stage addition unit. Each stage of the addition unit adds the operands in pairs, so the fifth-stage addition unit obtains the accumulated sum of 32 operands. The second converter 705 is used to convert the accumulation result complement code into the accumulation result original code to complete the partial product of the operand.

[0125] The shift module 303 is used to shift the product result from the multiplication module 302 according to the difference between the reference value found by the order module 301 and the exponents of the two operands. The shift module 303 includes a plurality of barrel shift units, which are a combinational logic circuit having a plurality of data inputs and a plurality of data outputs, and a control input for specifying how to move the data. The barrel shift units are used to shift the corresponding mantissas based on the difference. First, the mantissa is restored, and 0 is added after the mantissa, and all the shifted mantissas have a threshold minus one digit.

[0126] If the alignment module 301 adopts a unified alignment method, the shift module 303 may include n shift units, each of which is used to shift the mantissa of one operand. Since the reference value is the maximum value of the exponent bits of the n operands, the exponent bits of all operands are aligned with the reference value, and their mantissa bits are shifted accordingly. After the shift, the mantissa bits of all operands are the reference value minus one bit.

[0127] If the alignment module 301 adopts a cluster alignment method, taking a cluster including 32 operands as an example, the shift module 303 may include 32 shift units, each of which is used to shift the mantissa of one operand. Since the reference value is the maximum value of the exponent bits in the 32 operands, the exponent bits of the operands in the cluster are all aligned to the corresponding reference value, and their mantissa bits are shifted accordingly. If the threshold is set to 32, there will be no exponent bit difference greater than 32 in the cluster, so after the shift, the mantissa bits of all operands are the threshold minus one bit, that is, 31 bits. Each cluster is shifted in this way.

[0128] When the shift module 303 determines that the number of bits shifted out of the shifted mantissa is all 0, under the principle of rounding down to even numbers of IEEE 754, the shift module 303 sets all the sticky bits of the shifted mantissa to 0; when the shift module 303 determines that the number of bits shifted out of the shifted mantissa is all 1, the sticky bits are all set to 1.

[0129] The adding module 304 is used to perform an addition operation on the shifted product results to obtain a multiplication-accumulation result of n operands.

[0130] When the alignment module 301 adopts cluster alignment, the multiplication module 302, the shift module 303 and the addition module 304 all perform operations in cluster units, and finally the addition module 304 adds up the multiplication and accumulation results of each cluster to generate the multiplication and accumulation results of n operands.

[0131] The normalization module 305 is used to normalize the multiplication and accumulation result of the mantissa. By adding and subtracting the exponent value, the mantissa is shifted left or right to restore the shift operation of the shift module 303.

[0132] The rounding module 306 is used to perform rounding operation on the normalized multiplication-accumulation result, such as rounding to an even number, rounding to zero, rounding down, or rounding up. The rounding method is determined according to actual needs.

[0133] The switch module 308 identifies whether the operand is a floating point number or a fixed point number according to the control signal of the previous stage or the data format of the operand (for example, whether the operand has an exponent bit), and determines whether the order module 301, the shift module 303, the normalization module 305, and the rounding module 306 are turned on or off according to whether the operand is a floating point number or a fixed point number. If the operand is a floating point number, the switch module 308 controls the order module 301, the shift module 303, the normalization module 305, and the rounding module 306 to be in the on mode, and performs the above-mentioned operations.

[0134] The following describes a multiplication-accumulation operation with n fixed-point numbers as operands.

[0135] Since the principle of the fixed-point multiplication and accumulation operation is the same as that of the floating-point multiplication operation, both use the Wallace tree to calculate the partial sums first and then accumulate all the partial sums, the multiplication module 302 and the addition module 304 can be reused in the fixed-point multiplication and accumulation operation.

[0136] When the operand is a fixed-point number, the switching module 308 controls the alignment module 301, the shift module 303, the normalization module 305 and the rounding module 306 to be in the shutdown mode. The specific shutdown method is as follows. Since fixed-point numbers do not have exponent bits and do not need to be aligned, the switching module 308 can directly cut off the power supply of the alignment module 301 to prevent it from operating. As for the shift module 303, the normalization module 305 and the rounding module 306, although these modules have no effect on the multiplication and accumulation operations of fixed-point numbers, the output of the previous stage needs to be transmitted to the next stage, so the power supply cannot be directly cut off like the alignment module 301. A shutdown method is as follows: Figure 8 As shown, a demultiplexer is configured before these modules, for example, a first demultiplexer 901 is configured before the shift module 303, a second demultiplexer 902 is configured before the normalization module 305, and a third demultiplexer 903 is configured before the rounding module 306. The control signal of the switching module 308 controls the first demultiplexer 901 to decouple the shift module 303, controls the second demultiplexer 902 to decouple the normalization module 305, and controls the third demultiplexer 903 to decouple the rounding module 306, so that these modules are bypassed, and the input of the demultiplexer (the output of the previous stage) is directly output to the next stage.

[0137] Since the switching module 308 turns off the alignment module 301, the shift module 303, the normalization module 305 and the rounding module 306, Figure 3 The actual operation module of the multiplication and accumulation device when multiplying and accumulating fixed-point numbers is as follows Fig. 9 As shown, only the multiplication module 302 and the addition module 304 are in operation to calculate the mantissa of the operand. The operation mode of the multiplication module 302 and the addition module 304 when the operand is a fixed-point number is no different from that when the operand is a floating-point number, so it is not repeated. The output of the addition module 304 is the multiplication and accumulation result of n fixed-point numbers.

[0138] This embodiment is based on the module of floating-point multiplication and accumulation operations, and uses the concept of order to make some floating-point operations the same as fixed-point operations, so that some modules can be reused to perform fixed-point multiplication and accumulation operations, achieving a technical effect of a set of hardware covering floating-point multiplication and accumulation operations and fixed-point multiplication and accumulation operations. This embodiment can at least support multiplication and accumulation operations in data formats such as FP32, TF32, FP16, BF16, INT16, INT8, INT4, FP8 and FP12.

[0139] Another embodiment of the present invention is a factorial multiplication and accumulation circuit comprising a factorial module 301, a multiplication module 302, a shift module 303, an addition module 304, a normalization module 305, a rounding module 306 and a switching module 308. The operation of these modules is similar to that of Figure 3 The multiplication and accumulation device also includes a rounding circuit and a conversion circuit. Figure 1A and Figure 1B structure, and the multiplication and accumulation device is also arranged in the computing device 201.

[0140] The rounding circuit is disposed between the multiplication module 302 and the shift module 303 to round the product of two operands, such as rounding to an even number, rounding to zero, rounding down or rounding up, and the rounding method is determined according to actual needs. The shift module 303 shifts the rounded product result.

[0141] The conversion circuit is configured after the rounding module 306 to convert the precision of the multiplication and accumulation result. In a possible case, it is converted to a higher precision to improve the precision of the multiplication and accumulation result so that the subsequent modules can perform operations based on the operands with higher precision. The conversion process does not involve the value of the sign bit, that is, the sign bit does not change.

[0142] If the operands before and after the conversion have the same number of exponent bits, the exponent bits remain unchanged, and only the different mantissa bits need to be converted to be consistent.

[0143] If the number of exponent bits and mantissa bits of the operands before and after the conversion are different, for example, converting an FP16 operand into an FP38 operand, since FP16 has 5 exponent bits and 10 mantissa bits, the conversion method is different based on whether the exponent value is 0 during the conversion.

[0144] When the exponent value of FP16 is not 0, the exponent is 2 0 =1 as an example, the exponent bit of FP16 is 0x10, while the exponent bit of FP38 is 0x90, so when converting, the exponent value needs to be added with 0x90. Since the bit width of the mantissa bit of FP16 is 10 bits and the bit width of the mantissa bit of FP38 is 28 bits, when converting, the mantissa bit needs to be shifted left by 18 bits and the value of the remaining low-order mantissa bits is set to 0.

[0145] When the exponent value of FP16 is 0, its value is 0.xxxxx, because the minimum exponent value that FP16 can represent is 2. -14, after conversion to FP38, the exponent bit must not be 0, so in addition to shifting the mantissa left by 18 bits, it is necessary to continue to shift left until the highest bit 1 is omitted. The exponent value needs to be added with 0x90 and then subtracted (the additional left shift value – 1). Then confirm that the highest bit of the mantissa of FP16 is 1. When performing the mantissa conversion, it is necessary to shift left until the highest bit 1 is omitted, and then set the value of the remaining low-order mantissa bits to 0.

[0146] The switching module 308 determines whether the operand is a floating point number or a fixed point number according to the control signal of the previous stage or the data format of the operand, and determines whether the order module 301, the shift module 303, the normalization module 305, the rounding module 306, the rounding circuit and the conversion circuit are turned on or off according to whether the operand is a floating point number or a fixed point number. If the operand is a floating point number, the above modules are switched to the on mode, and each module performs the operations described above. When the operand is a fixed point number, the switching module 308 controls the order module 301, the shift module 303, the normalization module 305, the rounding module 306, the rounding circuit and the conversion circuit to be in the off mode, wherein the control method of the order module 301, the shift module 303, the normalization module 305, and the rounding module 306 is the same as the previous embodiment. Therefore, the control method of the rounding circuit and the conversion circuit is that the fourth demultiplexer is configured before the rounding circuit, and the fifth demultiplexer is configured before the conversion circuit. The control signal of the switching module 308 controls the fourth demultiplexer decoupling rounding circuit and controls the fifth demultiplexer decoupling conversion circuit. Therefore, the actual operation module of the multiplication and accumulation device when multiplying and accumulating fixed-point numbers is also the same. Fig. 9 As shown, only the multiplication module 302 and the addition module 304 are in operation to calculate the mantissa of the operand.

[0147] This embodiment not only introduces the concept of order, but also effectively covers the multiplication and accumulation operations of floating-point numbers and fixed-point numbers with only one set of hardware, and can also convert the precision of the operation results to facilitate the subsequent modules to perform operations. This embodiment can at least support multiplication and accumulation operations in data formats such as FP32, TF32, FP16, BF16, INT16, INT8, INT4, FP8 and FP12.

[0148] Another embodiment of the present invention provides a method for calculating multiple operands, such as Fig.10 As shown, the method includes:

[0149] Step 5000, identifying the bit width of the mantissa bits of the operand, and comparing the bit width of the mantissa bits with a bit width threshold,

[0150] Step 5001, allocate the operand whose mantissa bit width is greater than the bit width threshold to the first operation circuit for operation, otherwise allocate it to the second operation circuit for operation, wherein the processing bit width of the mantissa processing circuit of the first operation circuit is greater than the processing bit width of the mantissa processing circuit of the second operation circuit.

[0151] Another embodiment of the present invention provides the above method, wherein at least one mantissa processing circuit of the second operation circuit multiplexes a mantissa processing circuit of the first operation circuit.

[0152] Another embodiment of the present invention provides the above method, wherein at least one exponential processing circuit of the second operation circuit multiplexes an exponential processing circuit of the first operation circuit.

[0153] Another embodiment of the present invention provides the above method, wherein when the mantissa processing circuits of a plurality of the second operation circuits reuse the mantissa processing circuit of the first operation circuit, the mantissa processing circuits of the plurality of the second operation circuits operate simultaneously; and / or when the exponent processing circuits of a plurality of the second operation circuits reuse the exponent processing circuit of the first operation circuit, the exponent processing circuits of the plurality of the second operation circuits operate simultaneously.

[0154] Another embodiment of the present invention provides the above method, wherein the operand includes a floating point number, and the floating point number includes at least one of FP32, TF32, BF16, FP16, UHP, FP8, and FP12.

[0155] Another embodiment of the present invention provides the above method, wherein the sign bit of the FP12 format is 1 bit, the exponent bit is 8 bits, and the mantissa bit is 3 bits.

[0156] Another embodiment of the present invention provides the above method, wherein the sign bit of the FP12 format is 1 bit, the exponent bits are 5 bits, and the mantissa bits are 6 bits.

[0157] Another embodiment of the present invention provides the above method, wherein the sign bit of the FP12 format is 1 bit, the exponent bits are 4 bits, and the mantissa bits are 7 bits.

[0158] Another embodiment of the present invention provides the above method, wherein the bit width threshold is 5.

[0159] Another embodiment of the present invention provides the above method, wherein the processing bit width of the mantissa processing circuit in the first operation circuit is 10 bits, and the processing bit width of the mantissa processing circuit in the second operation circuit is 3 bits or 4 bits.

[0160] Another embodiment of the present invention provides the above method, wherein the processing bit width of the exponential processing circuit of the first operation circuit is 8 bits, and the processing bit width of the exponential processing circuit of the second operation circuit is 5 bits or 8 bits.

[0161] Another embodiment of the present invention provides the above method, wherein the first operation circuit and the second operation circuit are multiplication circuits, or the first operation circuit and the second operation circuit are factorial accumulation circuits.

[0162] The following content is a method for multiplying and accumulating multiple operands provided by an embodiment of the present invention when the first operation circuit and / or the second operation circuit is a factorial accumulation circuit.

[0163] Fig.11 A flowchart of a method for multiplying and accumulating multiple operands according to another embodiment of the present invention is shown. In step 1301, it is determined whether the operand is a floating point number or a fixed point number.

[0164] If it is a floating point number, execute step 1302 to identify the reference values ​​of the exponents of multiple operands. This step can adopt a unified order scheme. The unified order is to compare the exponents of two operands with all operands to be calculated as units, output the larger one, and then enter the next level for comparison until the one with the largest exponent of n operands is selected as the reference value.

[0165] This step can also use a clustering scheme. First find the maximum value of the exponent bit in the n operands, use the exponent value as the reference value, and group the operands whose exponent value and the reference value are within the threshold range into a cluster. The exponent values ​​of the operands in the cluster are relatively close, and direct accumulation does not affect the accuracy. Then continue to group the operands that have not yet been grouped in the above manner, and repeat this operation until all operands are grouped.

[0166] In step 1303, the mantissas of two operands to be multiplied among the multiple operands are multiplied to obtain a partial product of the mantissas. Specifically, in this step, the two mantissas are firstly subjected to Radix-4 Booth compression, and then the compressed mantissas are accumulated to obtain a partial product.

[0167] In step 1304, the partial products are accumulated to obtain the product of the mantissas of the two operands. Thus, the product of the two operands is obtained.

[0168] In step 1305, the product result is shifted according to the difference between the reference value and the exponents of the two operands. If step 1302 adopts a unified order alignment method, then in this step, the exponent bits of all operands are all aligned with the reference value, and their mantissa bits are shifted accordingly. After the shift, the mantissa bits of all operands are the reference value minus one digit. If step 1302 adopts a cluster order alignment method, since the reference value is the maximum value of the exponent bits of the operands in the same cluster, the exponent bits of the operands in the cluster are all aligned with the corresponding reference value, and their mantissa bits are shifted accordingly. Each cluster is shifted in this way.

[0169] In step 1306, the shifted product results are added to obtain the multiplication and accumulation results of the n operands. In this step, the shifted mantissa is first converted into a complement code, the complement code of the shifted product results is Booth compressed, and then the compressed product results are accumulated to obtain the multiplication and accumulation result, and finally the complement code of the multiplication and accumulation result is converted into the original code of the multiplication and accumulation result.

[0170] When step 1302 adopts cluster alignment, steps 1303 to 1306 are all operated on a cluster basis, and finally in step 1306 the multiplication and accumulation results of each cluster are summed up to become the multiplication and accumulation results of n operands.

[0171] In step 1307 , the multiplication and accumulation result of the mantissa is normalized. The mantissa is shifted left or right by addition and subtraction operations of the exponent value to restore the shift in step 1305 .

[0172] In step 1308, the normalized product result is rounded, for example, rounded to an even number, rounded to zero, rounded down, or rounded up, and the rounding method is determined according to actual needs. Thus, the multiplication and accumulation result of the floating point number is obtained.

[0173] If the operand is a fixed-point number, step 1309 is executed to perform a multiplication operation on the mantissas of two operands to be multiplied among the multiple operands to obtain a partial product of the mantissas. Specifically, in this step, the two mantissas are firstly subjected to Radix-4 Booth compression, and then the compressed mantissas are accumulated to obtain a partial product.

[0174] In step 1310, the partial products are accumulated to obtain the product of the mantissas of the two operands. Thus, the product of the two operands is obtained.

[0175] In step 1311, the product results are added to obtain the multiplication and accumulation results of the n operands. In this step, the mantissa is first converted into a complement code, the complement code of the product result is Booth compressed, and then the compressed product results are accumulated to obtain the multiplication and accumulation result, and finally the complement code of the multiplication and accumulation result is converted into the original code of the multiplication and accumulation result. Thus, the multiplication and accumulation operation result of the fixed-point number is obtained.

[0176] Since the principle of the multiplication and accumulation operation of fixed-point numbers is the same as that of the multiplication operation of floating-point numbers, both of which first calculate the partial sums and then accumulate all the partial sums, step 1303 (step 1309), step 1304 (step 1310) and step 1306 (step 1311) can be reused in the multiplication and accumulation operation of floating-point numbers and fixed-point numbers.

[0177] This embodiment is based on the process of floating-point multiplication and accumulation operations, and uses the concept of order to make some floating-point operations the same as fixed-point operations. In this way, some steps can be reused to perform fixed-point multiplication and accumulation operations, so as to achieve the technical effect of simplifying multiplication and accumulation operations.

[0178] Fig.12 A flowchart of a method for multiplying and accumulating multiple operands according to another embodiment of the present invention is shown. In step 1401, it is determined whether the operand is a floating point number or a fixed point number.

[0179] If it is a floating point number, execute step 1402 to identify the reference values ​​of the exponents of the multiple operands. This step can also adopt a unified order scheme or a cluster order scheme. In step 1403, the mantissas of the two operands multiplied by each other in the multiple operands are multiplied to obtain the partial product of the mantissas. In step 1404, the above partial products are accumulated to obtain the product result of the mantissas of the two operands. So far, the product of the two operands is obtained.

[0180] In step 1405, a rounding operation is performed on the product of the two operands, such as rounding to an even number, rounding to zero, rounding down, or rounding up. The rounding method is determined according to actual needs.

[0181] In step 1406, the product result is shifted according to the difference between the reference value and the exponent of the two operands. In step 1407, the shifted product result is added to obtain the multiplication and accumulation result of the n operands. When step 1402 adopts cluster order, steps 1403 to 1407 are all operated in cluster units, and finally in step 1407, the multiplication and accumulation results of each cluster are summed up to become the multiplication and accumulation result of the n operands. In step 1408, the multiplication and accumulation result of the mantissa is normalized. In step 1409, the normalized product result is rounded.

[0182] In step 1410, the precision of the multiplication-accumulation result is converted, for example, the precision of the multiplication-accumulation result is increased to FP38, so that the subsequent modules can perform operations based on operands with higher precision. Thus, the multiplication-accumulation operation result of the floating point number is obtained.

[0183] If the operand is a fixed-point number, step 1411 is executed to perform a multiplication operation on the mantissas of two operands to be multiplied among the multiple operands to obtain a partial product of the mantissas. In step 1412, the partial products are accumulated to obtain a product result of the mantissas of the two operands. In step 1413, the product results are added to obtain a multiplication-accumulation result of n operands. Thus, the multiplication-accumulation operation result of the fixed-point number is obtained.

[0184] Since the principle of the multiplication and accumulation operation of fixed-point numbers is the same as that of the multiplication operation of floating-point numbers, both of which first calculate the partial sums and then accumulate all the partial sums, step 1403 (step 1411), step 1404 (step 1412) and step 1407 (step 1413) can be reused in the multiplication and accumulation operation of floating-point numbers and fixed-point numbers.

[0185] This embodiment is based on floating-point multiplication and accumulation operations, and uses the concept of order to make some operations of floating-point numbers the same as fixed-point operations, so that some steps can be reused to perform fixed-point multiplication and accumulation operations, thereby achieving the technical effect of simplifying multiplication and accumulation operations. This embodiment can also convert the precision of the operation result to facilitate subsequent operations.

[0186] Another embodiment of the present invention is a computer-readable storage medium having a computer program code of a method for multiplying and accumulating multiple operands stored thereon. When the computer program code is executed by a processor, the following is performed: Fig.11 or Fig.12 The methods of each embodiment are shown.

[0187] Another embodiment of the present invention is a computer program product, comprising a computer program for multiplying and accumulating a plurality of operands, characterized in that when the computer program is executed by a processor, Fig.11 or Fig.12 The steps of the method are shown.

[0188] Another embodiment of the present invention is a computer device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement Fig.11 or Fig.12 The steps of the method are shown.

[0189] The present invention is based on the multiplication and accumulation operations of floating-point numbers, and utilizes the concept of order to make part of the operations of floating-point numbers the same as those of fixed-point numbers. In this way, part of the same operations can be reused to perform the multiplication and accumulation operations of fixed-point numbers, thereby achieving the technical effect of covering the multiplication and accumulation operations of floating-point numbers and the multiplication and accumulation operations of fixed-point numbers.

[0190] According to different application scenarios, the electronic equipment or device of the present invention may include a server, a cloud server, a server cluster, a data processing device, a robot, a computer, a printer, a scanner, a tablet computer, a smart terminal, a PC device, an Internet of Things terminal, a mobile terminal, a mobile phone, a driving recorder, a navigator, a sensor, a camera, a camera, a video camera, a projector, a watch, a headset, a mobile storage, a wearable device, a visual terminal, an automatic driving terminal, a vehicle, a household appliance, and / or a medical device. The vehicle includes an airplane, a ship, and / or a vehicle; the household appliance includes a television, an air conditioner, a microwave oven, a refrigerator, an electric rice cooker, a humidifier, a washing machine, an electric light, a gas stove, and a range hood; the medical device includes a nuclear magnetic resonance apparatus, a B-ultrasound apparatus, and / or an electrocardiograph. The electronic equipment or device of the present invention can also be applied to the Internet, the Internet of Things, a data center, energy, transportation, public administration, manufacturing, education, power grid, telecommunications, finance, retail, construction sites, medical treatment and other fields. Further, the electronic equipment or device of the present invention can also be used in the cloud, edge end, terminal and other application scenarios related to artificial intelligence, big data and / or cloud computing. In one or more embodiments, electronic devices or apparatuses with high computing power according to the solution of the present invention can be applied to cloud devices (such as cloud servers), while electronic devices or apparatuses with low power consumption can be applied to terminal devices and / or edge devices (such as smart phones or cameras). In one or more embodiments, the hardware information of the cloud device and the hardware information of the terminal device and / or edge device are compatible with each other, so that according to the hardware information of the terminal device and / or edge device, appropriate hardware resources can be matched from the hardware resources of the cloud device to simulate the hardware resources of the terminal device and / or edge device, so as to complete the unified management, scheduling and collaborative work of end-to-end or cloud-edge-to-end.

[0191] It should be noted that, for the purpose of simplicity, the present invention describes some methods and embodiments thereof as a series of actions and combinations thereof, but those skilled in the art will appreciate that the scheme of the present invention is not limited by the order of the described actions. Therefore, based on the disclosure or teaching of the present invention, those skilled in the art will appreciate that some of the steps therein may be performed in other orders or simultaneously. Further, those skilled in the art will appreciate that the embodiments described in the present invention may be regarded as optional embodiments, i.e., the actions or modules involved therein are not necessarily necessary for the implementation of one or some schemes of the present invention. In addition, depending on the different schemes, the present invention also has different emphases on the description of some embodiments. In view of this, those skilled in the art will appreciate that the parts not described in detail in a certain embodiment of the present invention may also refer to the relevant descriptions of other embodiments.

[0192] In terms of specific implementation, based on the disclosure and teachings of the present invention, those skilled in the art can understand that several embodiments disclosed in the present invention can also be implemented in other ways not disclosed herein. For example, with respect to the various units in the electronic device or device embodiments described above, this article splits them on the basis of considering the logical functions, and there may be other ways of splitting them in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features or functions in the units or components can be selectively disabled. In terms of the connection relationship between different units or components, the connection discussed in the above text in conjunction with the accompanying drawings can be a direct or indirect coupling between units or components. In some scenarios, the aforementioned direct or indirect coupling involves a communication connection using an interface, wherein the communication interface can support electrical, optical, acoustic, magnetic or other forms of signal transmission.

[0193] In the present invention, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units. The aforementioned components or units may be located at the same location or distributed on multiple network units. In addition, according to actual needs, some or all of the units may be selected to achieve the purpose of the scheme described in the embodiment of the present invention. In addition, in some scenarios, multiple units in the embodiment of the present invention may be integrated into one unit or each unit may exist physically separately.

[0194] In some other implementation scenarios, the above-mentioned integrated unit can also be implemented in the form of hardware, that is, a specific hardware circuit, which may include digital circuits and / or analog circuits, etc. The physical implementation of the hardware structure of the circuit may include but is not limited to physical devices, and the physical devices may include but are not limited to devices such as transistors or memristors. In view of this, the various devices described herein (such as computing devices or other processing devices) can be implemented by appropriate hardware processors, such as central processing units, GPUs, FPGAs, DSPs, and ASICs, etc. Further, the aforementioned storage unit or storage device may be any appropriate storage medium (including magnetic storage media or magneto-optical storage media, etc.), which may be, for example, a variable resistive memory (Resistive Random Access Memory, RRAM), a dynamic random access memory (Dynamic Random Access Memory, DRAM), a static random access memory (Static Random Access Memory, SRAM), an enhanced dynamic random access memory (Enhanced Dynamic Random Access Memory, EDRAM), a high bandwidth memory (High Bandwidth Memory, HBM), a hybrid memory cube (Hybrid Memory Cube, HMC), ROM and RAM, etc.

[0195] The embodiments of the present invention are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A device for operating a plurality of operands, characterized in that: The device comprises: A comparison circuit is used to identify the bit width of the mantissa bits of the operand and compare the bit width of the mantissa bits with a bit width threshold, An allocation circuit is used to allocate the operand whose mantissa bit width is greater than a bit width threshold to the first operation circuit for operation, otherwise allocate it to the second operation circuit for operation, the first operation circuit and the second operation circuit both include an exponent processing circuit and a mantissa processing circuit, and the processing bit width of the mantissa processing circuit of the first operation circuit is greater than the processing bit width of the mantissa processing circuit of the second operation circuit. 2 . The device according to claim 1 , wherein at least one mantissa processing circuit of the second operation circuit multiplexes a mantissa processing circuit of the first operation circuit. 3 . The device according to claim 1 , wherein at least one exponential processing circuit of the second operation circuit multiplexes an exponential processing circuit of the first operation circuit.

4. According to the device according to claims 2 and 3, when the mantissa processing circuits of multiple second operation circuits reuse the mantissa processing circuit of one first operation circuit, the mantissa processing circuits of multiple second operation circuits work simultaneously; and / or when the exponent processing circuits of multiple second operation circuits reuse the exponent processing circuit of one first operation circuit, the exponent processing circuits of multiple second operation circuits work simultaneously.

5. The apparatus according to claim 1, wherein the operand comprises a floating point number, and the floating point number comprises at least one of FP32, TF32, BF16, FP16, UHP, FP8, and FP12.

6. The apparatus according to claim 5, wherein the sign bit of the FP12 format is 1 bit, the exponent bit is 8 bits, and the mantissa bit is 3 bits.

7. The apparatus according to claim 5, wherein the sign bit of the FP12 format is 1 bit, the exponent bit is 5 bits, and the mantissa bit is 6 bits.

8. The apparatus according to claim 5, wherein the sign bit of the FP12 format is 1 bit, the exponent bit is 4 bits, and the mantissa bit is 7 bits. 9 . The device according to claim 1 , wherein the bit width threshold is 5.

10. The device according to claim 1, wherein the processing bit width of the mantissa processing circuit in the first operation circuit is 10 bits, and the processing bit width of the mantissa processing circuit in the second operation circuit is 3 bits or 4 bits.

11. The device according to claim 1, wherein the processing bit width of the exponential processing circuit of the first operation circuit is 8 bits, and the processing bit width of the exponential processing circuit of the second operation circuit is 5 bits or 8 bits.

12. The device according to claim 1, wherein the first operation circuit and the second operation circuit are multiplication circuits, or the first operation circuit and the second operation circuit are factorial accumulation circuits.

13. The apparatus according to claim 12, wherein the factorial accumulation circuit comprises: an order module for identifying reference values ​​of exponents of the plurality of operands; a multiplication module, configured to perform a multiplication operation on the mantissas of two operands to be multiplied among the plurality of operands to obtain a partial product of the mantissas; and perform an accumulation operation on the partial product to obtain a product result of the mantissas of the two operands; A shift module, used for shifting the multiplication result according to the difference between the reference value and the exponents of the two operands; The addition module is used to perform addition operation on the shifted product results to obtain the multiplication and accumulation results of the multiple operands.

14. The apparatus according to claim 13, further comprising a switching module for determining whether the plurality of operands are floating point numbers or fixed point numbers. 15 . The apparatus according to claim 14 , wherein when the plurality of operands are fixed-point numbers, the switching module controls the parallel order module to be closed. 16 . The apparatus according to claim 14 , wherein when the plurality of operands are fixed-point numbers, the switching module controls the shifting module to be turned off.

17. The apparatus according to claim 13, wherein the reference value is a maximum value of exponents of the plurality of operands.

18. The apparatus according to claim 13, wherein the order module groups the plurality of operands, the reference value is a maximum value of exponents of operands in each cluster, and the multiplication module and the shift module perform operations in cluster units.

19. The apparatus according to claim 13, further comprising: The conversion module is used to convert the precision of the multiplication and accumulation result.

20. The apparatus according to claim 19, wherein the converted precision is FP38, the exponent bits of FP38 are 9 bits, and the mantissa bits of FP38 are 28 bits.

21. An integrated circuit device comprising a device according to any one of claims 1 to 20.

22. A card comprising the integrated circuit device according to claim 21.

23. A method for operating multiple operands, characterized in that: The method comprises: identifying a bit width of the mantissa bits of the operand and comparing the bit width of the mantissa bits to a bit width threshold, The operand whose mantissa bit width is greater than the bit width threshold is allocated to the first operation circuit for operation, otherwise it is allocated to the second operation circuit for operation, the first operation circuit and the second operation circuit both include an exponent processing circuit and a mantissa processing circuit, and the processing bit width of the mantissa processing circuit of the first operation circuit is greater than the processing bit width of the mantissa processing circuit of the second operation circuit.

24. The method according to claim 23, wherein at least one mantissa processing circuit of the second operation circuit multiplexes a mantissa processing circuit of the first operation circuit. 25 . The method according to claim 23 , wherein at least one exponential processing circuit of the second operation circuit multiplexes an exponential processing circuit of the first operation circuit.

26. According to the method described in claims 24 and 25, when the mantissa processing circuits of multiple second operation circuits reuse the mantissa processing circuit of one first operation circuit, the mantissa processing circuits of multiple second operation circuits operate simultaneously; and / or when the exponent processing circuits of multiple second operation circuits reuse the exponent processing circuit of one first operation circuit, the exponent processing circuits of multiple second operation circuits operate simultaneously.

27. The method according to claim 23, wherein the operand comprises a floating point number, and the floating point number comprises at least one of FP32, TF32, BF16, FP16, UHP, FP8, and FP12.

28. The method according to claim 27, wherein the sign bit of the FP12 format is 1 bit, the exponent bit is 8 bits, and the mantissa bit is 3 bits.

29. A computer-readable storage medium having stored thereon a computer program code for a method of operating a plurality of operands, wherein when the computer program code is executed by a processing device, the method according to any one of claims 23 to 28 is executed.

30. A computer program product comprising a computer program for operating on a plurality of operands, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 23 to 28 are implemented.

31. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 23 to 28.