Patent Description:
This application also claims the priority benefit to commonly owned <CIT>, entitled "Accelerated Mathematical Engine," and listing Peter Joseph Bannon, Kevin Altair Hurd, and Emil Talpes as inventors.

The present disclosure relates to an accelerated mathematical engine for operating on large amounts of data, and more particularly, to an accelerated mathematical engine for performing complex convolution operations based on matrix multiply operations.

One skilled in the art will recognize the ever-increasing demands of speed and performance on general processors and systems that are used to implement time-sensitive and complex mathematical operations. As these general systems are used to process large amounts of data and perform complex mathematical operations, the computational resources and the rate of calculations are limited by the capabilities of existing general hardware designs that perform those calculations. For example, general-purpose computing devices and processors that execute matrix operations may be unable to perform these operations in a timely manner under certain circumstances. Many conventional multipliers that perform digital signal processing operations rely on a series of software and hardware matrix manipulation steps (address generation, transpositions, bit-by-bit addition and shifting, etc.) and may represent a bottleneck within a time-sensitive system. Oftentimes, these manipulation steps require the use of a processor's arithmetic functions to generate intermediate results at the expense of wasting computing time due to the added steps of storing and fetching intermediate results from various locations to complete an operation.

<FIG> shows an example of a conventional multiplier system. Multiplier system <NUM> is a scalar machine that comprises computation unit <NUM>, registers <NUM>, cache <NUM>, and memory <NUM>. In operation, computation unit <NUM> uses registers <NUM> and cache <NUM> to retrieve data stored in memory <NUM>. Typically, computation unit <NUM> is a microprocessor, such as a CPU or GPU, capable of performing various computational procedures including matrix multiplication on input matrices to obtain a resultant matrix, e.g., by converting multiplications into additions and outputting the result into some internal register.

For example, a dot product that represents an output pixel of an image is typically generated by dot-multiplying individual matrix elements from two matrices to obtain partial results, which are then added to obtain the final dot product. A multiplication of individual matrix elements, i.e., a scalar multiplication, is typically performed on individual data elements by breaking up the dot multiplication into a series of individual sub-operations. As a result, partial products have to be stored and fetched from one or more of registers <NUM>, cache <NUM>, and memory <NUM> to complete a single arithmetic operation.

Computationally demanding applications, such as a convolution, oftentimes require a software function be embedded in computation unit <NUM> and used to convert convolution operations into alternate matrix-multiply operations. This is accomplished by rearranging and reformatting data into two matrices that then can be raw matrix-multiplied. However, there exists no mechanism to efficiently share or reuse data in scalar machine <NUM>, such that data necessary to execute each scalar operation has to be re-stored and re-fetched from registers many times. The complexity and managerial overhead of these operations becomes significantly greater as the amount of image data subject to convolution operations increases.

The inability to reuse much of the data in scalar machine <NUM> coupled with the added and inefficient steps of storing and fetching intermediate results from registers <NUM>, cache <NUM>, and memory <NUM> to complete an arithmetic operation are only some of the shortcoming of existing systems, such as multiplier system <NUM>.

Accordingly, what is needed are high-computational-throughput systems and methods that can perform matrix mathematical operations quickly and efficiently.

References will be made to embodiments of the invention, examples of which may be illustrated in the accompanying figures. These figures are intended to be illustrative, not limiting. Although the invention is generally described in the context of these embodiments, it should be understood that it is not intended to limit the scope of the invention to these particular embodiments. Items in the figures may be not to scale.

In the following description, for purposes of explanation, specific details are set forth in order to provide an understanding of the invention. It will be apparent, however, to one skilled in the art that the invention can be practiced without these details. Furthermore, one skilled in the art will recognize that embodiments of the present invention, described below, may be implemented in a variety of ways, such as a process, an apparatus, a system, a device, or a method on a tangible computer-readable medium.

Components, or modules, shown in diagrams are illustrative of exemplary embodiments of the invention and are meant to avoid obscuring the invention. It shall also be understood that throughout this discussion that components may be described as separate functional units, which may comprise sub-units, but those skilled in the art will recognize that various components, or portions thereof, may be divided into separate components or may be integrated together, including integrated within a single system or component. It should be noted that functions or operations discussed herein may be implemented as components. Components may be implemented in software, hardware, or a combination thereof. Many components are be formed through interconnection of many subcomponents. Sub components may be selected that are logically different in operation from what is shown herein, where these logically different subcomponents can be combined in the aggregate with other subcomponents provide similar or identical functionality at the aggregated component level to that described herein (e.g., active high signals can be active low, AND gates replaced with inverted-input NOR gates, etc.).

Furthermore, connections between components or systems within the figures are not intended to be limited to direct connections. Rather, data between these components may be modified, re-formatted, or otherwise changed by intermediary components. Also, additional or fewer connections may be used. It shall also be noted that the terms "coupled," "connected," or "communicatively coupled" shall be understood to include direct connections, indirect connections through one or more intermediary devices, and wireless connections.

Reference in the specification to "one embodiment," "preferred embodiment," "an embodiment," or "embodiments" means that a particular feature, structure, characteristic, or function described in connection with the embodiment is included in at least one embodiment of the invention and may be in more than one embodiment. Also, the appearances of the above-noted phrases in various places in the specification are not necessarily all referring to the same embodiment or embodiments.

The use of certain terms in various places in the specification is for illustration and should not be construed as limiting. A service, function, or resource is not limited to a single service, function, or resource; usage of these terms may refer to a grouping of related services, functions, or resources, which may be distributed or aggregated.

The terms "include," "including," "comprise," and "comprising" shall be understood to be open terms and any lists that follow are examples and not meant to be limited to the listed items and may include subsets or supersets of the items along with additional items. Any headings used herein are for organizational purposes only and shall not be used to limit the scope of the description or any claims.

Furthermore, one skilled in the art shall recognize that: (<NUM>) certain steps may optionally be performed; (<NUM>) steps may not be limited to the specific order set forth herein; (<NUM>)certain steps may be performed in different orders; and (<NUM>) certain steps may be done concurrently.

Although embodiments herein are discussed mainly in the context of convolutions, one of skill in the art will appreciate that a deconvolution and other matrix operations can also be structured as a matrix-matrix type multiply operation and, thus, the principles of the present invention are equally applicable to deconvolutions. Furthermore, other types of mathematical operations may be implemented in accordance with various embodiments of this disclosure.

<FIG> illustrates an exemplary matrix processor architecture for performing arithmetic operations according to various embodiments of the present disclosure. System <NUM> comprises logic circuit <NUM><NUM>, cache/buffer <NUM>, data formatter <NUM>, weight formatter <NUM>, data input matrix <NUM>, weight input matrix <NUM>, matrix processor <NUM>, output array <NUM>, postprocessing units <NUM>, and control logic <NUM>. Matrix processor <NUM> comprises a plurality of subcircuits <NUM> which contain Arithmetic Logic Units (ALUs), registers and, in some embodiments, encoders (such as booth encoders). Logic circuit <NUM> may be a circuit that represents N input operators and data registers. Logic circuit <NUM> may be circuitry that inputs M weight operands into matrix processor <NUM>. Logic circuit <NUM> may be circuitry that input image data operands into matrix processor <NUM>. Weight input matrix <NUM> and data input matrix <NUM> may be stored in various types of memory including SRAM devices. One skilled in the art will recognize that various types of operands may be input into the matrix processor <NUM>.

In operation according to certain embodiments, system <NUM> accelerates convolution operations by reducing redundant operations within the systems and implementing hardware specific logic to perform certain mathematical operations across a large set of data and weights. This acceleration is a direct result of methods (and corresponding hardware components) that retrieve and input image data and weights to the matrix processor <NUM> as well as timing mathematical operations within the matrix processor <NUM> on a large scale.

In embodiments, formatters <NUM><NUM>, which in example in <FIG> are implemented as in-line formatters. In certain embodiments, formatters <NUM><NUM> are discrete components and in other embodiments the formatters <NUM><NUM> are integrated together and/or with one or more other components. Each is implemented in hardware and converts a matrix to a vector on operands to be operated upon within the matrix processor <NUM>. In other embodiments, formatters <NUM><NUM> are implemented in software, although this typically produces a loss in speed. Data formatter <NUM> converts two-dimensional or three-dimensional (e.g., a <NUM> x <NUM> x <NUM> cube) data comprising data input matrix <NUM> into a single vector or string that may be represented by a row or column, thereby, linearizing or vectorizing data input matrix <NUM>. In detail, formatter <NUM> receives data input matrix <NUM> and prepares input data to be processed by matrix processor <NUM>. In embodiments, this is accomplished by mapping parameters of the data input matrix <NUM> into a suitable format according to the hardware requirements of matrix processor <NUM> such that matrix processor <NUM> can efficiently perform a matrix multiply as part of a convolution calculation when generating output pixels.

As an example, assuming matrix processor <NUM> comprises <NUM> rows and <NUM> columns, data mapped into a <NUM> x <NUM> format would cause matrix processor <NUM> to be utilized to its full computational capacity and, thus, provide a preferred efficiency. In that case, formatter <NUM> should produce an output that is <NUM>-columns wide. Similarly, formatter <NUM> should produce an output that is <NUM>-rows wide based on the weight input matrix <NUM>.

In embodiments, formatter <NUM> uses a number of multiplexers or switches to fetch some or all of data input matrix <NUM> and choose different elements therefrom in order to produce data that is then lined up according to the columns of matrix processor <NUM>. In embodiments, the selection ensures that the appropriate data from data input matrix <NUM> is passed to each of the columns at defined clock cycles. In embodiments, if weights are static, they may be pre-formatted offline, stored in memory, fetched only once, and fed directly into matrix processor <NUM> in a modified, vectorized format without the use of formatter <NUM>. In other embodiments, weights may be dynamically adjusted and fed into matrix processor <NUM> in accordance with various formatting and fetching operations. In embodiments, matrix processor <NUM> allows for column and row inputs of varying sizes. That is, matrix processor <NUM> is designed to compute NxM computations of arbitrary size.

In other embodiments, if the number of columns of the matrix processor <NUM> is limited (for example to N columns) such that the number of columns in the data input matrix <NUM> (for example X) is greater than the number of columns of the matrix processor <NUM> (i.e., X>N), then the control logic <NUM> may split the data input matrix <NUM> into multiple submatricies with each submatrix computed by a matrix processor <NUM>. In such instances, each matrix processor <NUM> may be running in a different thread. For example, if data input matrix <NUM> consists of <NUM> x <NUM> data points, and the matrix processor has <NUM> columns and <NUM> rows (i.e., <NUM> x <NUM> computations may occur in one clock cycle), the control logic <NUM> may split the data input matrix <NUM> into two submatricies (such as the left half of the data input matrix <NUM> and the right half of the data input matrix <NUM>). Each submatrix will consist of <NUM> x <NUM> data points. Each separately threaded matrix processor <NUM> can compute the output channels for the submatrix sent to it with results placed into the final output array <NUM>, which must be large enough to hold the values from all channels (that is <NUM> values). More generally, data input matrix <NUM> may be split into any number of submatricies and sent to different matrix processors <NUM>, each running in a separate thread. As with the output array <NUM>, the data input matrix <NUM>, data formatter <NUM>, cache/buffer <NUM>, logic circuit <NUM>, and post processing unit <NUM> must similarly be able to accommodate the larger data.

In alternative embodiments, a CNN may be computed between multiple matrix processors <NUM> by having control logic <NUM> splitting the computations along the inner product. The segments of the inner product are computed, each in a different matrix processor <NUM>, and then the input products added together to compute the output vector, which is then stored in output array <NUM>.

Unlike common software implementations of formatting functions that are performed by a CPU or GPU to convert a convolution operation into a matrix-multiply by rearranging data to an alternate format that is suitable for a fast matrix multiplication, various hardware implementations of the present disclosure re-format data on the fly and make it available for execution, e.g., <NUM> pieces of data every cycle, in effect, allowing a very large number of elements of a matrix to be processed in parallel, thus efficiently mapping data to a matrix operation. In embodiments, for 2N fetched input data 2N<NUM> compute data may be obtained in a single clock cycle. This architecture results in a meaningful improvement in processing speeds by effectively reducing the number of read or fetch operations employed in a typical processor architecture as well as providing a paralleled, efficient and synchronized process in performing a large number of mathematical operations across a plurality of data inputs.

In embodiments, to increase efficiency of matrix processor <NUM> that may have any arbitrary number of columns and rows, formatter <NUM><NUM> may reformat different shapes of input matrices data into the columns and rows suitable for matrix processor <NUM>. In embodiments, formatting is performed dynamically to accommodate processing of matrices having different input sizes. In embodiments, the reformatted matrixes comprising input channels are fed into cache/buffer <NUM>.

Cache/Buffer <NUM> may fetch data from data input matrix <NUM> only <NUM>/k times as various pieces of data may be reused, where k is the convolution kernel width. For example, for any given cycle, once a row is fetched, certain columns will have access to all the data in that row. In embodiments, cache/buffer <NUM> may be a local buffer that stores a local copy of data that may be reused by a convolution without having to re-access and read data from SRAM.

Once matrix processor <NUM> has completed a computation, a set of result may be shifted, e.g., from the accumulators in the bottom row of matrix processor <NUM>, e.g., to output flip-flops (not shown) that effectively form a shift register that receive a dot product. In embodiments, pulling or shifting results into output array <NUM>, e.g., one per clock cycle, from a row that corresponds to an output channel may be accomplished by a state machine (not shown). The state machine may perform additional operations on the output channel, for example, prior to sending data to SRAM and/or post processing unit <NUM>. The internal operation of matrix processor <NUM> will be described in more detail below.

In embodiments, matrix processor <NUM> comprises shadow resisters that enable parallel processing by storing a copy of the results that are passed through matrix processor <NUM> to output array <NUM>. In embodiments, moving an operation result from output register to shadow register involves loading the next set of values into the ALUs.

Once an accumulation has completed, a convolution may commence and accumulation may start over before all of the data of a prior convolution is output to output array <NUM>. As a result, in every clock cycle, the data in matrix processor <NUM> may move down by one row, such that for each cycle the last row may be output to output array <NUM>. In effect, this mode of operation ensures that a new calculation may be made in each consecutive cycle without any interruptions and independent of additional processing operations, such as storing data in SRAM, etc..

Post processing unit <NUM> may comprise or interact with a number of devices (not shown), such as a hardware-accelerated pooling unit, a DRAM that may be part of a direct memory access ("DMA") that retrieves data from memory and stores data (e.g., weights and results) in SRAM, and the like. The devices may be partially or entirely controlled by control logic <NUM>, which may also manage formatters <NUM><NUM> and other components within system <NUM>.

Not shown in <FIG> are auxiliary devices that perform management functions, such as a sequencer that generates addresses for reading the data, writes the results, and keeps track of where system <NUM> is in the convolution in order to calculate from where to get and how to execute the data that will be used in a subsequent step of the convolution.

In certain embodiments, weight input matrix <NUM> is physically split and drives weights from two different sides of matrix processor <NUM>, such that the two-dimensional array is split into two regions (e.g., a left-hand side and a right-hand side) that each receive a portion of the data in weight input matrix <NUM>. Such an implementation reduces data latency by taking advantage of the fact that weights are known. In embodiments, in order to reduce peak power consumption, the timing of operations may be chosen such that multiplications of weight and data are spread out over a certain number of cycles. This efficient timing of operations results in a reduction of energy consuming steps including a decrease in the number of read operations performed by the matrix processor and improving the efficiency of data movement within the matrix (e.g., between sub-circuits).

In embodiments, a state machine (not shown) that is configured to identify redundant data may be employed. Identified redundant data may be reused across columns, such that the data does not need to be re-fetched. The state machine may be configured to determine how and where to shift data that is to be executed, e.g., based on inputs related to image size, filter size, stride, number of channels, and similar parameters.

In embodiments, a booth encoder is shared across a number of elements in the multiplication architecture of matrix processor <NUM>. The booth encoder may be any booth encoder known in the art and may be used to multiply two numbers and encode one of the two numbers, e.g., from an <NUM>-bit value to a <NUM>-bit or any other value that makes multiplication operations easier on the multiplier logic and, thus, faster. In embodiments, the booth encoder may be applied in parallel across an entire row so as to share the same encoded, alternate weight value across all columns. By loading an operand across all columns, a multiplication may be performed in a single clock cycle across an entire row. The cost for leveraging re-encoding to share the same data (e.g., weights) across for N computational elements is thus paid only once for each column (or row). In comparison, in existing computing architectures, every single scalar would require a booth encoder for every single multiplication operation.

<FIG> illustrates details of an exemplary configuration of the matrix processor architecture shown in <FIG>. In embodiments, matrix processor <NUM> may accommodate a predetermined vector length on each axis. As depicted in <FIG>, matrix processor <NUM> may comprise an array of <NUM> x <NUM> tiles <NUM> that are arranged in a matrix format. Each tile <NUM> may comprise a matrix <NUM> that, in turn, comprises sub-circuits circuits <NUM>. As discussed in detail below with reference to <FIG>, each sub-circuit circuit <NUM> may be a cell capable of performing arithmetic operations. In embodiments, sub-circuit circuit <NUM> performs simultaneously multiplication, accumulation, and shift operations.

In embodiments, arithmetic operations are parallelized by utilizing multiple rows and columns of matrix processor <NUM> to generate an NxN tile output. For example, a given row size of <NUM> and a corresponding column size of <NUM> facilitate an output of <NUM>*<NUM> mathematical calculations. In other embodiments, the number of rows and columns may be different. That is, there may be N rows and M columns and an NxM tile output may be generated. For example, for a row size of <NUM> and a corresponding column size of <NUM>, an output of <NUM>*<NUM>,<NUM> calculations is generated in a single clock cycle.

<FIG> illustrates an exemplary multiply-and-add circuit implementation of the sub-circuit shown in <FIG>. As depicted in <FIG>, multiply-and-add circuit <NUM> comprises multiplier <NUM>, adder <NUM>, logic <NUM><NUM><NUM>, accumulator <NUM>, shadow register <NUM>, and output register <NUM>. In embodiments, accumulator <NUM> may be implemented as an accumulation register.

In embodiments, accumulator <NUM> may comprise a set of ALUs that comprise registers and shadow register <NUM> that may be configured to receive the outputs of the ALUs.

In operation, multiplier <NUM> receives and multiplies weights <NUM> and data <NUM> to generate products therefrom. Each product may be provided to adder <NUM> that, in response to receiving the product from multiplier <NUM>, adds the product to the current value of the accumulator <NUM>.

In embodiments, accumulator <NUM> generates an accumulated value that is stored, e.g., in output register <NUM>. The accumulated value is the result of a convolution and, as mentioned with reference to <FIG>, may correspond to the dot product of two formatted matrices.

In embodiments, a copy of the result in output register <NUM> may be provided to shadow register <NUM>, which may output result <NUM>, such that accumulator <NUM> can be accessed again to commence new calculations. In embodiments, multiply-and-add circuit <NUM> in <FIG> may perform a multiplication, an addition operation, and a shift operation at the same time, i.e., within a single cycle, thereby doubling the total number of operations that occur each cycle.

In embodiments, ClearAcc signal <NUM> clears the contents of accumulator <NUM>, e.g., when multiplier <NUM> performs a multiply operation, such that accumulation operations can start over. In embodiments, ResultEnable signal <NUM> is activated in response to a determination that data <NUM> is valid. It is understood that accumulator <NUM> may accumulate and save data, accumulate and clear data, or just clear data.

In embodiments, results are moved from output register <NUM> to shadow register <NUM> in a single clock cycle, i.e., without the need of intermediate execute and save operations.

<FIG> illustrates an exemplary convolution operation according to various embodiments of the present disclosure. Convolution <NUM> comprises input channels IC of input image <NUM>, weights <NUM>, dot product <NUM>, output channels OC, and accumulator <NUM>.

In embodiments, convolution operation <NUM> applies individual filters (i.e., weights) <NUM> to input image <NUM>, e.g., to detect small features within input image <NUM>. By analyzing a sequence of different features in a different order, macro features may then be identified in input image <NUM>. In other embodiments, input <NUM> is non-image data. For example, input <NUM> may be non-image sensor data, such as ultrasonic, radar, LIDAR, or other sensor data. Input <NUM> may also be general mathematical computations or any other types of data known to one of skill in the art.

Convolution <NUM> may use a different set of weights <NUM> for each input channel IC, as each input channel IC may contain a different set of information, and each weight matrix <NUM> may be designed to help identify a different feature. In embodiments, convolution <NUM> multiplies a rectangular input matrix <NUM> with a rectangular weight matrix <NUM> to obtain partial dot products. The partial dot products may then summed by adder <NUM> in order to generate an accumulated dot product <NUM> (i.e., an integer) that represents an output pixel <NUM> in the output image.

In embodiments, each pixel in output channel OC is generated by multiplier <NUM> and adder <NUM>. In embodiments, the value of the partial dot products correspond to the application of weight matrix <NUM> in its entirety to area <NUM> of the input image <NUM>. In other words, each weight <NUM> is dot multiplied by multiplier <NUM> with area <NUM> to produce a partial dot product, then the partial dot products are accumulated in accumulator <NUM> to generate an accumulated output that represents the convolution.

One or more input channels IC, e.g., one for each color (e.g., RGB) may be used. For example, each convolution may use weights <NUM> that represent three different matrices, one for each color. Each output channel OC <NUM> may be generated using a different filter or weight <NUM> that represents a different a feature in input data <NUM>. The number of output channels may depend on the number of features. The number of convolutions is equal to the number of output channels OC times the number of input channels IC, and each convolution may have N convolutions for each input channel IC. One skilled in the art will recognize that the number and type of input channels may vary and may include color and/or clear inputs.

As depicted in <FIG>, input matrix <NUM> is a Kx x Ky (i.e., <NUM> x <NUM>) matrix that may be combined with a <NUM> x <NUM> weight matrix <NUM> across <NUM> input channels, i.e., <NUM> x <NUM> x IC, such that the depths match and produce a single element, dot product <NUM>, in the output plane. Each dot product <NUM> in output channel <NUM> is the result of a dot multiplication.

<FIG> illustrate details of an exemplary convolution operation according to various embodiments of the present disclosure. Convolution <NUM> comprises input data matrix <NUM>, weight data matrix <NUM>, array <NUM>, and dot product <NUM>. In embodiments, array <NUM> is a matrix processor architecture as shown in <FIG> and <FIG>.

Input data matrix <NUM> in <FIG> comprises column <NUM> that, in embodiments, may be obtained by linearizing an input matrix, such as rectangular input matrix <NUM> shown in <FIG>, to obtain a vectorized form of the input matrix. Similarly, weight data matrix <NUM> comprises row <NUM> that may be a vectorized form of a weight matrix, such as rectangular weight matrix <NUM> in <FIG>. As an example, a <NUM> x <NUM> input matrix and <NUM> input channels may be re-formatted into a vector that comprises <NUM> x <NUM> x <NUM> = <NUM> elements from which a <NUM>-element column <NUM> may be produced for use in input data matrix <NUM>. Conversely, a <NUM> x <NUM> weight matrix for the same <NUM> input channels may be used to generate a <NUM>-element row <NUM> for use in weight data matrix <NUM>. One skilled in the art will recognize that the sizes of input matrices and number of input channels may vary across different applications.

In embodiments, the input channels and input weights drawn as rectangles in <FIG> are reformatted, e.g., by the formatter discussed with reference to <FIG>, into a vector formats (e.g., vectors having <NUM> elements) that are provided to a matrix multiplier/processor (denoted as element <NUM> <FIG>), such that a <NUM> x <NUM> element dot product operation can be performed in parallel. In detail, input data <NUM> and input weights <NUM> shown in <FIG> as rectangles for each input channel are reformatted into vector formats.

In embodiments, the resulting vector formats, illustrated in <FIG> as input data <NUM> and input weights <NUM> (e.g., each having comprising <NUM> elements) are provided to matrix processor or matrix multiplier <NUM> that performs a <NUM> x <NUM> element dot product operation in parallel. In embodiments, in the calculation of output channels, the same output pixels are produced using the same set of input data but different set of weights (i.e., filters), such that by reading the input data once many output channels can be generated at once. As stated above, it is understood that the number of input and output channels may be arbitrarily chosen.

It is further understood that input data matrix <NUM>, weight data matrix <NUM>, and array <NUM> may have different numbers of columns and rows as those depicted in <FIG>. In particular, the shapes of input data matrix <NUM> and weight data matrix <NUM> may be formatted such as to accommodate the columns and rows of any arbitrate configuration of array <NUM>. In addition, in circumstances in which weight data matrix <NUM> is known then row <NUM> may be generated and stored in a vectorized format without the use of a formatter.

In embodiments, dot product <NUM> in <FIG> is generated by dot-multiplying a vector corresponding to column <NUM> with a vector corresponding to row <NUM>. In embodiments, as shown in <FIG>, the next dot product <NUM> may be obtained by dot-multiplying a vector corresponding to column <NUM> with the vector corresponding to row <NUM>. As those of skill in the art will recognize, once all dot products in the first row of array <NUM> are filled, the dot product of the second row of array <NUM> may be calculated by dot-multiplying the elements in first column <NUM> of input data matrix <NUM> with the second row of weight data matrix <NUM>, etc..

It is important to note that <FIG> merely serve illustrative purposes and that the abovementioned dot-multiplications may be simultaneously performed to generate a one-shot matrix-matrix multiply operation.

<FIG> illustrates an exemplary deconvolution operation according to various embodiments of the present disclosure. Deconvolution system <NUM> comprises input channels IC of input image <NUM>, weights <NUM>, dot product <NUM><NUM>, and output channels OC. A person of skill in the art will recognize that, the deconvolution operation <NUM> is, in effect, is a mathematical transposition (approximately the inverse) of the convolution operation, for example, the convolution shown in <FIG>. One of skill in the art will further recognize that a neural network may be used to learn deconvolution operation <NUM> by applying procedures similar to those used for ordinary convolutional neural networks. For purposes of brevity, a description or functions of components similar to those in <FIG> is not repeated here.

In embodiments, deconvolution operation <NUM> in <FIG> reassembles matrices <NUM> by deconstructing dot product <NUM><NUM> using weights <NUM>. As with a convolution operation, deconvolution <NUM> may use a different set of weights <NUM> for each input channel IC. In embodiments, deconvolution <NUM> may be advantageously applied to an image to perform image deconvolution, for example to improve robustness against artifacts. Other applications may include analysis and restoration of image data, and the like.

<FIG> illustrates a process for performing arithmetic operations to accelerate convolutional neural networks according to various embodiments of the present disclosure.

Process <NUM> for performing arithmetic operations begins at step <NUM> when a first set of operands that may be representative of a row in a data matrix is received from a first logic circuit. This first set of operands may be vectorized such that the operands are aligned with inputs into a matrix processor. In certain embodiments, the size of the vectorized operands is directly related to the number of inputs into a matrix processor along on axis.

At step <NUM>, a second set of operands that may be representative of a column in a weight matrix is received from a second logic circuit. This second set of operands may be vectorized such that the operands are aligned within corresponding inputs into the matrix processor. In certain embodiments, the size of the vectorized operands is directly related to the number of inputs into the matrix process along a different axis.

At step <NUM>, the first set of operands is dot-multiplied with the second set of operands to obtain one or more dot-products. In certain embodiments, this set operation across the sets of operands is performed in a single clock cycle.

At step <NUM>, the dot-products may be used to convolve an image with a filter to produce a convolution result.

At step <NUM>, the convolution result is further processed to enhance the image output. This further processing may occur using a non-linear function, a normalization operation or a pooling operation.

One skilled in the art will recognize no computing system or programming language is critical to the practice of the present invention. One skilled in the art will also recognize that a number of the elements described above may be physically and/or functionally separated into sub-modules or combined together.

It shall be noted that elements of the claims below may be arranged differently including having multiple dependencies, configurations, and combinations. For example, in embodiments, the subject matter of various claims may be combined with other claims.

It will be appreciated to those skilled in the art that the preceding examples and embodiment are exemplary and not limiting to the scope of the present invention. It is intended that all permutations, enhancements, equivalents, combinations, and improvements thereto that are apparent to those skilled in the art upon a reading of the specification and a study of the drawings are included within the true scope of the present invention.

The present invention provides a matrix processor for accelerating convolutions in a neural network, the matrix processor comprising: a first input circuit arranged in a first dimension of a two-dimensional array, the first input circuit being coupled to receive N operands from a first logic circuit, the N operands being formatted in accordance with a first width related to the first dimension; a second input circuit arranged in a second dimension of the two-dimensional array, the second input circuit coupled to receive M operands from a second logic circuit, the M operands being formatted in accordance with a second width related to the second dimension; and a plurality of sub-circuits coupled to receive the N operands and the M operands, at least a subset of the plurality of sub-circuits comprising an arithmetic logic unit, an accumulator and a shadow register, the sub-circuits coupled within the two-dimensional array to perform an arithmetic operation on the N operands and the M operands.

The arithmetic operation may be a dot product calculation associated with a convolution operation.

The arithmetic logic unit may comprise a multiply-and-add circuit to generate the dot product.

The N operands may represent image data and the M operands may represent weight values.

At least some of the subcircuits may comprise an encoding element configured to encode values representing one or more of the M operands.

The encoding element may be a booth encoder.

The N operands may be formatted from a data input matrix.

The matrix processor may further comprise a state machine that uses at least one of a filter size and a stride to determine reusable operands within the N operands or the M operands.

Accelerated processing speed may be achieved by a reduction in read operations from a cache and accelerated data throughput via the plurality of sub-circuits.

The present invention further provides a system for accelerating convolutions in a neural network, the system comprising: a first logic circuit that generates N operands; a first input circuit arranged in a first dimension of a two-dimensional array, the first input circuit being coupled to receive the N operands from the first logic circuit; a second logic circuit that generates M operands; a second input circuit arranged in a second dimension of the two-dimensional array, the second input circuit being coupled to receive M operands from the second logic circuit; a matrix processor comprising a plurality of sub-circuits, the plurality of subcircuits configured to perform dot-multiplications of the N operands and the M operands to generate dot-products; and an output array coupled to the two-dimensional array, the two-dimensional array configured to use the dot-products to generate a result.

The N operands may be formatted from a data input matrix into a first vector and the M operands may be formatted from a weight input matrix into a second vector.

The first logic circuit may comprise a plurality of data registers that store the N operands, the plurality of data registers having a first width corresponding to the first dimension of the two dimensional array and the second logic circuit may comprise a plurality of weight registers that store the M weight operands, the plurality of weight registers having a second width corresponding to the second dimension of the two dimensional array.

The first width may correspond to a number of cycles that generate the result.

The data register and the weights register may be accessed only once to fetch respective a first and second number of elements.

The sub-circuits may comprise shadow registers configured to move data, in one or more clock cycles, to a shift register.

The system may further comprise a buffer coupled to at least one of the data input matrix and the weight input matrix, the buffer stores a copy of recently used data to enable reuse without refetching in subsequent cycles.

The result may be an output matrix that corresponds to an application of a filter to an area of an image.

The system may further comprise a state machine that uses at least one of a filter size and a stride to identify reusable data.

The present invention further provides a method for using a matrix multiplication circuit to make convolutional neural networks faster, the method comprising: receiving, from a first logic circuit, a first set of operands representative of a row in a data matrix; receiving, from a second logic circuit, a second set of operands representative of a column in a weight matrix; dot-multiplying the first set of operands with the second set of operands to obtain one or more dot-products; and using the dot-products to convolve an image with a filter to produce a convolution result.

Convolving the image may comprise processing the one or more dot-products by a convolution layer to generate a layer output.

Claim 1:
A matrix processor (<NUM>, <NUM>, <NUM>) for performing arithmetic operations, the matrix processor (<NUM>, <NUM>, <NUM>) comprising:
a plurality of sub-circuits (<NUM>, <NUM>, <NUM>) coupled within a two-dimensional array,
a first input circuit arranged in a first dimension of the two-dimensional array, the first input circuit being coupled to receive N operands from a first logic circuit (<NUM>), the N operands being formatted in accordance with a first width related to the first dimension and being representative of a row in an input data matrix (<NUM>), wherein columns (<NUM>, <NUM>) of the input data matrix (<NUM>) are vectorized forms of input matrices (<NUM>) corresponding to areas of input data (<NUM>); and
a second input circuit arranged in a second dimension of the two-dimensional array, the second input circuit coupled to receive M operands from a second logic circuit (<NUM>), the M operands being formatted in accordance with a second width related to the second dimension and being representative of a column in a weight data matrix (<NUM>), wherein rows (<NUM>) of the weight data matrix (<NUM>) are vectorized forms of weight matrices (<NUM>) corresponding to filters of a convolution operation (<NUM>), wherein:
the plurality of sub-circuits (<NUM>, <NUM>, <NUM>) is configured to perform dot multiplications of the N operands and the M operands to generate dot products (<NUM>, <NUM>, <NUM>) with each of the sub-circuits (<NUM>, <NUM>, <NUM>) being configured to perform a dot multiplication of a respective column (<NUM>, <NUM>) of the input data matrix (<NUM>) and a respective row (<NUM>) of the weight data matrix (<NUM>) to generate a dot product (<NUM>, <NUM>, <NUM>) representing the convolution of the corresponding area of the input data (<NUM>) with the corresponding filter of the convolution operation (<NUM>).