Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
MULTIPURPOSE MULTIPLY-ACCUMULATOR ARRAY
Document Type and Number:
WIPO Patent Application WO/2023/129231
Kind Code:
A1
Abstract:
Embodiments of the present disclosure include a multipurpose multiply-accumulator (MAC) array circuit comprising one or more input memories for receiving operands and a plurality of multiply-accumulator circuits each selectively coupled to the one or more input memories to receive at least a pair of operands and generate a result. Each of the plurality of multiply-accumulator circuits receives operands from the one or more input memories independently. Additionally, selection of operands from the one or more input memories is controlled based on at least an operation and/or data types, where different operation and/or data types configure the plurality of multiply-accumulator circuits to receive different pairs of operands from the one or more input memories to execute particular operation types.

Inventors:
AVUDAIYAPPAN KARTHIKEYAN (US)
ANDREWS JEFFREY A (US)
Application Number:
PCT/US2022/044783
Publication Date:
July 06, 2023
Filing Date:
September 27, 2022
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
MICROSOFT TECHNOLOGY LICENSING LLC (US)
International Classes:
G06F7/544; G06F5/06
Domestic Patent References:
WO2021142713A12021-07-22
Foreign References:
US20210390076A12021-12-16
Attorney, Agent or Firm:
CHATTERJEE, Aaron C. et al. (US)
Download PDF:
Claims:
CLAIMS

1. A multipurpose multiply-accumulator (MAC) array circuit comprising: one or more input memories for receiving operands; and a plurality of multiply-accumulator circuits each selectively coupled to the one or more input memories to receive at least a pair of operands and generate a result, wherein each of the plurality of multiply-accumulator circuits receives operands from the one or more input memories independently, wherein selection of operands from the one or more input memories is controlled based on at least an operation type, wherein different operation types configure the plurality of multiply-accumulator circuits to receive different pairs of operands from the one or more input memories to execute particular operation types.

2. The circuit of claim 1, wherein selection of operands from the one or more input memories is further controlled based on a data type.

3. The circuit of claim 1, wherein the operation type is in the set of: a three- dimensional convolution, a matrix multiplication, a depth-wise convolution, and an MxN filter operations, where M and N are integers.

4. The circuit of claim 1, wherein the one or more input memories comprise a first first-in first-out memory (FIFO) configured to receive a plurality of first operands and a second first-in first-out memory (FIFO) configured to receive a plurality of second operands, wherein the first operands and second operands are coupled to the plurality of multiply- accumulator circuits as pairs of operands.

5. The circuit of claim 1, further comprising a state machine having at least one input to receive a signal indicting an operation and/or data types and a plurality of FIFO memory outputs configured to control loading of operands into the plurality of multiply- accumulator circuits based on the operation and/or data types.

6. The circuit of claim 1, further comprising a plurality of read logic circuits, wherein each of the plurality of multiply-accumulator circuits has an associated read logic circuit to control loading of operands.

7. The circuit of claim 6, wherein each read logic circuit comprises a read pointer and a state machine to control reading of operands by the read pointer.

8. The circuit of claim 6, further comprising a plurality of identifiers configured to specify a position of each of the plurality of multiply-accumulator circuits within the multipurpose multiply-accumulator (MAC) array circuit so that the plurality of multiply- accumulator circuits independently receive and operate on operands from the one or more memories.

9

9. The circuit of claim 8, wherein the read logic circuits read and assign operands to each multiply-accumulator circuit based on the operation type being performed and the identifier.

10. The circuit of claim 8, wherein the plurality of multiply-accumulator circuits receive operands from the at least one input memory without software interaction.

11. The circuit of claim 1, wherein the operation type is a three-dimensional convolution, and wherein, during execution, each multiply-accumulator circuit in each column receives a unique first operand, and wherein each multiply-accumulator circuit in each row receives a unique second operand, and wherein the plurality of multiply-accumulator circuits produce results at different times.

12. The circuit of claim 1, wherein the operation type is a depth-wise convolution, and wherein, during execution, each multiply-accumulator circuit in each row receives a different first operand and each multiply-accumulator circuit in each column a different second operand, and wherein each multiply-accumulator circuit receives a unique channel number from the first and second operands.

13. The circuit of claim 1, wherein the operation type is an MxN filter operations, where M and N are integers, and wherein the multiply-accumulator (MAC) array circuit is partitioned into a plurality of groups, and wherein different groups received the same filter elements and process different operands along at least one dimension.

14. The circuit of claim 1, wherein the operation type is a matrix multiplication, and wherein each multiply-accumulator circuit receives a different column and different row of two input vectors.

15. A method of performing multiple operation types in a multiply- accumulator (MAC) array circuit comprising: receiving operands in one or more input memories; controlling selection of operands from the one or more input memories based on an operation type, wherein different operation types configure a plurality of multiply- accumulator circuits to receive different pairs of operands from the one or more input memories to execute particular operation types; and selectively coupling each of a plurality of multiply-accumulator circuits to the one or more input memories to receive at least a pair of operands and generate a result, wherein each of the plurality of multiply-accumulator circuits receives operands from the one or more input memories independently.

Description:
MULTIPURPOSE MULTIPLY-ACCUMULATOR ARRAY

BACKGROUND

The present disclosure relates generally to digital circuits and systems, and in particular to a multipurpose multiply-accumulator array circuit.

Many modern digital systems and applications benefit from providing functionality to multiply digital values together and obtain results. From graphics processing to artificial intelligence, multiplication of digital values is a functionality in increasing demand. Many of these applications require digital systems that can multiply digital values together and accumulate (e g., add) the result. These applications may require increasing computational power and efficiency to handle the increasing number of computations required.

Multiply-accumulate (MAC) operations in many systems may vary according to the particular algorithm being executed. For example, some systems may require different MAC operations to perform N-dimensional (e.g., 3D) convolutions, MxN filtering, depth-wise convolutions, or matrix multiplications. Accordingly, developing a multiply-accumulator architecture that can handle multiple different types of operations without burdensome preprocessing or manipulations by software of input data in memory, may be very beneficial for various applications.

BRIEF DESCRIPTION OF THE DRAWINGS

Fig. 1 illustrates a multipurpose multiply-accumulate array circuit according to an embodiment. Fig. 2 illustrates a method according to an embodiment.

Fig. 3 illustrates a multipurpose multiply-accumulate array circuit according to another embodiment.

Fig. 4A illustrates an example multipurpose multiply-accumulate array circuit according to an embodiment.

Fig. 4B illustrates an example of a single multipurpose multiply-accumulate circuit according to an embodiment.

Fig. 5 illustrates 3D convolution according to an embodiment.

Fig. 6 illustrates depth-wise convolution according to an embodiment.

Fig. 7A illustrates an example input tensor according to an embodiment.

Fig. 7B illustrates an example filter according to an embodiment.

Fig. 7C illustrates operation of the MAC for a filter operation according to an embodiment.

DETAILED DESCRIPTION

Described herein is a multipurpose MAC array circuit. In the following description, for purposes of explanation, numerous examples and specific details are set forth in order to provide a thorough understanding of some embodiments. Various embodiments as defined by the claims may include some or all of the features in these examples alone or in combination with other features described below and may further include modifications and equivalents of the features and concepts described herein.

In some embodiments, features and advantages of the present disclosure include circuit techniques for performing multiple different types of operations in a multiply-accumulator (MAC) array circuit. For example, in various embodiments illustrated below, the same MAC array may be used to perform 3-dimensional (3D) convolution, depth-wise convolution, MxN filtering, and matrix multiplication. Advantageously, in some embodiments, no software controlled reconfiguration of the input data operands transferred from memory to the MAC array are required.

Fig. 1 illustrates a multipurpose MAC array circuit according to an embodiment. Operands 104 may be received and stored in a memory 102. Operands 104 are then selectively coupled from memory 102 to a multipurpose MAC array circuit 101 for processing according to a variety of operation types. MAC array 101 may comprise a plurality of multiply-accumulate circuits (referred to herein as MAC circuits or processing elements, PEs), such as PEs 103a-103mn, for example. The PEs may be arranged to form an array, such as an NxM array, where N and M are integers (e.g., a 16x16 array of PEs). Each PE may receive two operands (e.g., operand A, opA, and operand B, opB). When a MAC reads operands from memory, it receives one operand A data element and one operand B data element. Operands may be stored in a variety of formats, such as integers, floats, or other formats for storing values in a digital system. For example, each operand may be 2 bytes (2B) in size. Each PE performs a multiply-accumulate:

Result = MAC_Output = (Operand_A * Operand_B) + MAC_output_previous;

The result from each PE may be used in a variety of manners based on the operation being performed. Such an operation may take one cycle, for example.

Advantageously, each PE may receive operands from memory 102 independently. For example, in various embodiments and uses, each PE may be selectively coupled to memory, where the pair of inputs to the PE may be configured to receive data from different locations in memory 102. Accordingly, each PE may receive input operands from configurable locations in memory 102 independent of other PEs in the MAC array, based on an operation type or a data type (or both), for example, as well as a PE number in some embodiments described below. This technique results in a high degree of flexibility in how the PEs receive input operands and how the PEs may be used by the MAC array circuit to perform different operations, for example.

Multipurpose MAC array 101 may further receive an operation type and/or data type. Operation type and/or data type may be electronic signals (e.g., digital signals or bits) indicating which of a variety of operation types are to be performed by the multipurpose MAC array 101. The operation type and/or data type may control selection of operands 104 from memory 102 by each PE, where different operation types configure the PEs to receive different pairs of operands from memory 102 to execute the particular operation types (e.g., 3D convolutions, depth-wise convolution, filtering, and/or matrix multiplication). Examples of how different operation types are performed by changing how the operands are read from memory 102 and fed into the MAC array are described in more detail below.

Fig. 2 illustrates a method according to an embodiment. At 201, operands are received in one or more memories. At 202, an operation type and/or the associated data type are received by a MAC array circuit. At 203, selection of operands to be received by the MAC array from memory is controlled based on the operation type. At 204, the inputs of each PE are selectively coupled to memory based on the operation type and/or data type to receive pairs of operands and generate a result. At 205, the operation is performed, and a result is produced by each PE. As mentioned above and illustrated further below, selective coupling of operands to independent PEs advantageously allows the MAC array to perform multiple different operation types without any preprocessing and manipulation by SW of the input data.

Fig. 3 illustrates a multipurpose multiply-accumulate array circuit according to another embodiment. Features and advantages of the present disclosure include a MAC array circuit that may implement multiple different operation types. In this example, memory 302 is coupled to MAC array circuit 301 for selectively coupling operands 350 into PEs 311. In this example, MAC array circuit 301 further includes a state machine 310 having at least one input to receive the operation type and outputs configured to control loading of operands into the PEs based on the operation type and PE number. State machine 310 may be implemented as a hardwired digital circuit, for example, which may advantageously configure each PE to access particular memory locations based on the operation type, as well as a PE number, for example. This approach may eliminate the need for software to rearrange operands in memory prior to loading into the MAC array, for example.

Figs. 4A-B illustrate an example NxM MAC array circuit 401 according to an embodiment. In this example, MAC array circuit 401 is coupled to two (2) first-in first-out (FIFO) memories 402- 403. MAC array circuit 401 includesN rows and M columns ofPEs (e.g., 16x16 = 256 PEs). Each PE may have dedicated wires to couple to input operands from each of the FIFOs into the PE. For example, if the operands are 2 bytes each, then there are 16 unique 2B-wires from FIFO 402 to each row of MAC array 401 coupled to the 16 columns (i.e., 2Bxl6 per row output of FIFO 402 into the rows of MAC array 401), and there are 16 unique 2B-wires from FIFO 403 to each column of MAC array 401 coupled to the 16 rows (i.e., 2Bxl6 per column output of FIFO 403 into the rows of MAC array 401). Accordingly, each FIFO may supply each PE with its own unique set of operands A and B. Outputs from the PEs may be coupled to output FIFO memories 405, for example.

Fig. 4B illustrates an example of a single multipurpose multiply-accumulate circuit (PE) according to an embodiment. In this example, MAC array 401 comprises a plurality of read logic circuits. Each of the PEs has an associated read logic circuit to control loading of operands from memory 414 to the PE. Fig. 4B illustrates an example PE 410 in the i’th row and j’th column of the MAC array 401 PE 410 has an associated read logic circuit 411, which may include a state machine (SMij) 412 and a read pointer 413. In some embodiments, PEs in a MAC array (e.g., PE 410) may have a plurality of identifiers, also known as the PE identifier or number, configured to specify the position of each of the PEs within the MAC array 401, so that the plurality of PEs independently receive and operate on operands from the one or more memories. In some embodiments, read logic circuits (e.g., read logic circuit 411) read and assign operands to each PE based on the operation type being performed and the PE identifier or PE number. Accordingly, for example, the read logic, which reads from the FIFOs, reads and assigns operands to the MAC array’s PEs according to the operation being performed and the position of the PEs. This technique may be particularly advantageous because a MAC array can perform multiple linear algebraic operations such as Depth-wise convolution, MxN filter operation, and sparse matrix multiplication, all without any SW involvement to rearrange the input tensors, for example.

Fig. 5 illustrates 3D convolution according to an embodiment. Typically, for 3D convolution, each row of a MAC array would receive a unique operand A 501 and each column would receive a unique operand B 502. In a typical MAC array performing 3D convolution, operand A 501 is shared by all columns, and operand B 502 is shared by all rows. In the absence of zeros in both operands, in a 16x16 MAC array, it takes a PE 16 cycles to perform the 3D convolution operation and produce result 503. However, in some applications, each operand tends have a random percentage of zeros (referred to as sparsity), and hence it is possible to operate the PE in Fig. 4B such that it that can take anywhere from 1 to 16 cycles based on the number of non-zero operands. For example, if all 16 operands are zeros, it still takes 1 cycle for the PE to produce result 503. Using a MAC array according to the present disclosure (e.g., in Fig. 4A and 4B), operand A may not be shared by all columns. Instead, each column in each row, may receive its own unique operand A. Similarly, operand B shown above may not be shared by all rows. Instead, each row in each column may receive its own unique operand B. In such a MAC array with independent PEs, once a PE has completed producing a scalar result 503, it increments its read pointers to its two FIFO memories to fetch another set of operands, A and B to supply each PE with its own unique set of non-zero operands A and B. Accordingly, the independence of the PEs may produce results at different times and advantageously allow for acceleration of the operation if the operands are sparse. Fig. 6 illustrates depth-wise convolution according to an embodiment. A depth-wise convolution operation performs the function A[i]*B[i], In this example, operand A 601 and operand B 602 are tensors, whose height x width x channel dimension is 1x1x16 for illustrative purposes. It is to be understood that other size tensors may be used. For depth-wise convolution, during execution, each multiply-accumulator circuit in each row receives a different first operand and each multiply - accumulator circuit in each column receives a different second operand. Further, each multiply- accumulator circuit receives a unique channel number from the first and second operands. For instance, the following Table 1 shows the assignment of operands A and B to the 16 rows and columns of the MA to perform depth-wise convolution.

Table 1

In the above Table 1, the PEs in each row get a different operand A - rowO gets AO, rowl gets Al, and so on. Similarly, the PEs in each column get a different operand B - colO gets BO, coll gets Bl, and so on. Further, each PE in each row, gets a unique channel number from its two operands. Here, the 16 channels of operand A and B are assigned across the 16 columns. In the assignment shown above, the PEs may pick their own unique set of operands for Depth-wise convolution, based on their IDs, for example. However, as seen from the assignment above, the PEs in the same column know, based on their position, that they must all pick operands from the same channel. In the assignment shown above, PEs in column 0 operate on channel 0, PEs in column 1 operate on channel 1, and so on.

Fig. 7A illustrates an example input tensor according to an embodiment. In this example, a 3x3 filter operation is performed on an input tensor having a height = 4, width = 16, and channel depth = 4. Fig. 7B illustrates an example filter according to an embodiment. In this example, the filter tensor corresponds to one 3x3 filter for each output pixel. The assignment of input tensor operands to filter elements is shown in Fig. 7C, which illustrates operation of the PEs for the filter operation. Advantageously, the MAC array circuit is partitioned into a plurality of groups, and all PEs in a group may receive the same filter elements and process different operands along at least one dimension. For example, as illustrated in Fig. 7C, each of the 4 rows of the input (aka activation) tensor shown in Fig. 7A, is assigned to the 4 columns of PEs in one group in the MAC array. For example, columns 0, 1, 2, and 3 of PEs receive the first row in the activation tensor, columns 4, 5, 6, and 7 of PEs receive the second row in the activation tensor, columns 8, 9, 10, and 11 of PEs receive the third row in the activation tensor, and columns 12, 13, 14, and 15 of PEs receive the fourth row in the activation tensor. The four columns of PEs in each group, while they filter, each column receives a different channel element from the activation tensor. Here, it can be seen that each group of 4 columns of PEs 701-704 share the filter elements, while every group of PEs is processing different height-elements, and while every column of PEs in a group receives different channel elements. Thus, different groups process different operands along the height dimension. In one embodiment, the multipurpose MAC array may be configured to perform a matrix multiplication (Matmul) operation. For example, for a Matmul operation where a first matrix A is a 16x16 matrix having elements A0[15:0] ... Al 5[15 :0] and a second matrix B is a 16x16 matrix having elements B0[15:0] . .. B 15[15 : 0], the assignment of matrix elements to PEs is as shown in Table 2.

Table 2

In the above Table 2, PE0 is assigned the multiplication of the row A0[15:0] and column B0[ 15:0], PEI is assigned the multiplication of the row A0[15:0] and column Bl [15:0], and so forth for other PEs up to PE255, which is assigned the multiply-accumulation of row A15[15:0] and B15[15:0],

FURTHER EXAMPLES

Each of the following non-limiting features in the following examples may stand on its own or may be combined in various permutations or combinations with one or more of the other features in the examples below.

In one embodiment, the present disclosure includes a multipurpose multiply-accumulator (MAC) array circuit comprising: one or more input memories for receiving operands; and a plurality of multiply-accumulator circuits each selectively coupled to the one or more input memories to receive at least a pair of operands and generate a result, wherein each of the plurality of multiply- accumulator circuits receives operands from the one or more input memories independently, wherein selection of operands from the one or more input memories is controlled based on at least an operation type, wherein different operation types configure the plurality of multiply- accumulator circuits to receive different pairs of operands from the one or more input memories to execute particular operation types. In another embodiment, the present disclosure includes a method of performing multiple operation types in a multiply-accumulator (MAC) array circuit comprising: receiving operands in one or more input memories; controlling selection of operands from the one or more input memories based on an operation type, wherein different operation types configure the plurality of multiply- accumulator circuits to receive different pairs of operands from the one or more input memories to execute particular operation types; and selectively coupling each of a plurality of multiply- accumulator circuits to the one or more input memories to receive at least a pair of operands and generate a result, wherein each of the plurality of multiply-accumulator circuits receives operands from the one or more input memories independently.

In one embodiment, selection of operands from the one or more input memories is further controlled based on a data type.

In one embodiment, the operation type is in the set of: a three-dimensional convolution, a matrix multiplication, a depth-wise convolution, and an MxN filter operations, where M and N are integers.

In one embodiment, the one or more input memories comprise a first first-in first-out memory (FIFO) configured to receive a plurality of first operands and a second first-in first-out memory (FIFO) configured to receive a plurality of second operands, wherein the first operands and second operands are coupled to the plurality of multiply-accumulator circuits as pairs of operands.

In one embodiment, the MAC array circuit further comprises a state machine having at least one input to receive a signal indicting an operation and/or data types and a plurality of FIFO memory outputs configured to control loading of operands into the plurality of multiply-accumulator circuits based on the operation and/or data types.

In one embodiment, the MAC array circuit further comprises a plurality of read logic circuits, wherein each of the plurality of multiply-accumulator circuits has an associated read logic circuit to control loading of operands.

In one embodiment, each read logic circuit comprises a read pointer and a state machine to control reading of operands by the read pointer.

In one embodiment, the MAC array circuit further comprises a plurality of identifiers configured to specify a position of each of the plurality of multiply-accumulator circuits within the multipurpose multiply-accumulator (MAC) array circuit so that the plurality of multiply- accumulator circuits independently receive and operate on operands from the one or more memories.

In one embodiment, the read logic circuits read and assign operands to each multiply-accumulator circuit based on the operation type being performed and the identifier.

In one embodiment, the plurality of multiply-accumulator circuits receive operands from the at least one input memory without software interaction.

In one embodiment, the operation type is a three-dimensional convolution, and wherein, during execution, each multiply-accumulator circuit in each column receives a unique first operand, and wherein each multiply-accumulator circuit in each row receives a unique second operand, and wherein the plurality of multiply-accumulator circuits produce results at different times.

In one embodiment, the operation type is a depth-wise convolution, and wherein, during execution, each multiply-accumulator circuit in each row receives a different first operand and each multiply-accumulator circuit in each column a different second operand, and wherein each multiply-accumulator circuit receives a unique channel number from the first and second operands.

In one embodiment, the operation type is an MxN filter operations, where M and N are integers, and wherein the multiply-accumulator (MAC) array circuit is partitioned into a plurality of groups, and wherein different groups received the same filter elements and process different operands along at least one dimension.

In one embodiment, the operation type is a matrix multiplication, and wherein each multiply- accumulator circuit receives a different column and different row of two input vectors.

The above description illustrates various embodiments along with examples of how aspects of some embodiments may be implemented. The above examples and embodiments should not be deemed to be the only embodiments, and are presented to illustrate the flexibility and advantages of some embodiments as defined by the following claims. Based on the above disclosure and the following claims, other arrangements, embodiments, implementations and equivalents may be employed without departing from the scope hereof as defined by the claims.