Method and system for performing sparse sub-manifold deconvolution on GPU

By performing index unrolling and matrix multiplication on a sparse submanifold deconvolution method, the inefficiency of sparse submanifold convolution in terms of hardware resources and computation time is solved, and more efficient sparse submanifold convolution operations are achieved.

CN118587079APending Publication Date: 2024-09-03IMAGINATION TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410235036.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2023-03-02
Filing Date
2024-03-01
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Existing technologies struggle to efficiently implement sparse submanifold convolutions on graphics processing units, particularly due to inefficiencies in terms of hardware resources and computation time.

Method used

By performing index unrolling and matrix multiplication on a graphics processing unit, combined with a method for deconvolution of sparse submanifolds, the method includes receiving a dense input tensor, identifying the target position of the output tensor, performing index unrolling and folding operations to generate a sparse output tensor.

Benefits of technology

It improves the hardware efficiency and computation speed of sparse submanifold convolution, and reduces the consumption of storage and computing resources, especially in the case of sparse input data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587079A_ABST
    Figure CN118587079A_ABST
Patent Text Reader

Abstract

Methods and systems for performing sparse sub-manifold deconvolution on a GPU. The sparse sub-manifold deconvolution may represent a direct convolution between an input tensor of the sparse sub-manifold deconvolution and each of the plurality of sub-filters, where each of the plurality of sub-filters includes a subset of weights of a filter of the sparse sub-manifold deconvolution. The method includes: receiving, at a graphics processing unit, an input tensor in a dense format; receiving, at the graphics processing unit, information identifying a target location of an output tensor for sparse sub-manifold deconvolution; performing, at the graphics processing unit, an index expansion operation on the input tensor based on the identified output tensor target position to generate, at each sub-window of the input tensor, an input matrix including input tensor elements relating to at least one identified target position of the output tensor; and performing, at the graphics processing unit, a matrix multiplication between the weight matrix and the input matrix to generate an output matrix including the output tensor elements at the identified target locations.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to UK patent application number 2303116.4 filed on March 2, 2023, UK patent application number 2303117.2 filed on March 2, 2023, UK patent application number 2303118.0 filed on March 2, 2023, UK patent application number 2303119.8 filed on March 2, 2023 and UK patent application number 2303120.6 filed on March 2, 2023, which are incorporated herein by reference in their entirety. Technical Field

[0003] The present application relates to methods and systems for performing sparse submanifold deconvolution on a graphics processing unit (GPU). Background Art

[0004] As known to those skilled in the art, a point cloud is a set of individual data points plotted in a two-dimensional (2D) or three-dimensional (3D) space. For example, each point in a 3D point cloud can represent a measurement at a specific x, y, and z position. Point clouds can be used to represent objects in space. Point clouds can be generated by sensors, such as but not limited to LiDAR scanners or depth cameras. As known to those skilled in the art, LiDAR scanners use light in the form of pulsed lasers to measure distances. Since point clouds typically do not have a point at every possible coordinate, point clouds are considered sparse data sets.

[0005] There are various real-world artificial intelligence applications that can utilize point clouds, such as augmented / virtual reality (e.g., layout detection of interior scenes) and autonomous driving (e.g., extracting drivable areas). Therefore, performing deep learning tasks on point clouds has received great attention from academia and industry, and artificial neural networks (referred to herein as neural networks) have been developed to process point clouds, which may be referred to herein as point cloud neural networks. As known to those skilled in the art, a neural network includes one or more interconnected layers that can be used in machine learning applications. In particular, neural networks can be used in signal processing applications, including but not limited to image processing applications and computer vision applications.

[0006] Figure 1 An example neural network 100 is shown that includes a plurality of layers 102, 104, 106. Each layer 102, 104, 106 receives input data and processes the input data according to the layer to produce output data. The output data is provided as input data to another layer or is output as final output data of the neural network. For example, in Figure 1In the neural network 100 of FIG. 1 , the first layer 102 receives raw input data 108 for the neural network 100, and processes the input data according to the first layer 102 to generate output data 110. The output data 110 of the first layer 102 becomes the input data of the second layer 104, and the second layer 104 processes the input data 110 according to the second layer 104 to generate output data 112. The output data 112 of the second layer 104 becomes the input data of the third layer 106, and the third layer 106 processes the input data 112 according to the third layer 106 to generate output data 114. Then, the output data 114 of the third layer 106 is output as the final output data of the neural network. In the case where the neural network is used for classification, the final output data can be a length vector A, where A is the number of categories, and each value in the vector represents the probability of a certain category.

[0007] The data input to and output from a neural network layer can be described as tensors. As known to those skilled in the art, a tensor is a general term for vectors and matrices, and can be viewed as an n-dimensional array. A vector is a one-dimensional tensor, and a matrix is ​​a two-dimensional tensor. Tensors in neural networks are usually four-dimensional, but not necessarily. Figure 2 , which shows an example four-dimensional (4D) tensor 200, in which one dimension has been suppressed for visualization purposes (e.g., corresponding to the batch size). The 4D tensor 200 can be described as including one or more 3D tensors, where each 3D tensor includes C data planes. Each plane has a height H and a width W. Each plane can be referred to as a channel of the tensor. The number of 3D tensors can be referred to as the batch size. In a traditional neural network, each 3D tensor can be, for example, an image. The elements of a tensor can be referred to as tensors, similar to the elements of a picture being called pixels.

[0008] The processing performed on the input tensors of a layer depends on the type of layer. For example, each layer of a neural network can be one of a number of different types. Common neural network layer types include, but are not limited to, convolutional layers, activation layers, normalization layers, pooling layers, fully connected layers, and batch normalization layers. It will be apparent to those skilled in the art that these are merely example neural network layer types and that other neural network layer types may exist.

[0009] For a convolutional layer, the input tensor is convolved with the weights associated with the layer. Specifically, each convolutional layer is convolved with a number of weights w1…w gThe plurality of weights may also be referred to as filter weights or coefficients. The weights are grouped to form one or more filters. Each filter moves or slides on the input tensor in one or more dimensions according to the stride in that dimension, and calculates the dot product of the input data and the weight of the filter at each filter position. The elements of the input tensor applied to the filter weights at a specific filter position are called windows of the input tensor. Each filter may have a bias, which is added to the result of the corresponding dot product.

[0010] There are many different types of convolutional layers. Traditional neural networks usually have one or more 2D or 3D convolutional layers. In a 2D convolution (which may be referred to as a standard 2D convolution in this article), each filter has a dimension K H xK W xC in (That is, each filter may include a set of K H xK W xC in Weight w), where C in is the number of input tensor channels such that each filter generates an output channel. Each filter channel can be described as a H xK W Therefore, depending on the number of channels, the filter may include one or more kernels. Each filter is separately H and W Sliding over the input tensor in both the H and W dimensions is called the stride of the convolution.

[0011] Reference Figure 3 , which shows that the input tensor 302 with height H, width W and channels (ie, C=1) is formed with a kernel size K H xK W The filter 304 has a set of weights and a stride of 1 between channels (ie, s H =s W=1). Filter 304 is convolved with input tensor 302 to produce one channel or one plane of output tensor 306. Specifically, filter 304 slides over input tensor 302 in width dimension W and height dimension H, one element at a time, and generates a dot product of the input element and the weight at each filter position. In this example, the first position of the filter relative to input tensor 302 is when the center of the filter w(0,0) is aligned with x(1,1), so that the first element of the output y(0,0) is equal to the dot product of the input elements in window 308 and the weight of filter 304. Similarly, the last position of the filter relative to input tensor 302 is when the center of filter w(0,0) is aligned with x(3,3), so that the last element of output tensor y(2,2) is equal to the dot product of the input elements in window 310 and the weight of filter 304. 3D convolution is similar to 2D convolution, except that the filter also slides over the input tensor in a third (e.g., z or channel) dimension.

[0012] However, the point cloud neural network may include one or more 2D or 3D sparse submanifold convolution layers. A 2D / 3D sparse submanifold convolution is the same as its corresponding standard 2D / 3D convolution, except that the output elements are calculated only for the positions of the filter where one or more predetermined elements of the filter kernel are aligned with the active position of the input tensor. The active position of the input tensor is the height and width position of the input tensor where at least one channel of the input tensor has a non-zero value or element at that position. The one or more predetermined elements of the filter kernel may include the center element of the filter kernel and / or one or more elements near the center of the filter kernel. In the examples described herein, the single predetermined element of the filter kernel is the center element of the filter kernel. However, it will be apparent to those skilled in the art that this is merely an example. Sparse submanifold convolution is designed to operate on sparse input tensors.

[0013] Reference Figure 4 , which shows that the input tensor 402 with height H, width W and channels (ie, C=1) is formed with a kernel size K H xK W The filter 404 has a set of weights and a stride of 1 between channels (ie, s H =s W=1), where one or more predetermined elements of the filter kernel include the element at the center of the filter kernel (i.e., w(0,0)). The input tensor 402 has only three non-zero elements, so the input tensor 402 has three active positions - p1, p2, p3. Therefore, there are only three positions of the filter relative to the input tensor 402 (or three windows of the input tensor), represented as 406, 408, 410, where the center of the filter 404 is aligned with the active position (which will be referred to as the active window of the input tensor in this document). Therefore, only three elements q1, q2, q3 of the output tensor 412 are generated. The output element q1 is equal to the dot product of the elements in the first active window 406 and the weight of the filter 404, the output element q2 is equal to the dot product of the elements of the second active window 408 and the weight of the filter 404, and the output element q3 is equal to the dot product of the elements of the third active window 410 and the weight of the filter 404. 3D sparse submanifold convolution is similar to 2D sparse submanifold convolution, except that the filter slides over the input tensor in the third (e.g. z) dimension as well.

[0014] As sparse submanifold convolution layers become increasingly popular in neural networks, it is particularly important to be able to implement sparse submanifold convolutions in a hardware efficient manner (e.g., in a manner that requires less silicon area and / or less processing power).

[0015] The embodiments described below are provided by way of example only and are not intended to limit implementations that address any or all of the disadvantages of known methods and systems for implementing sparse submanifold convolutions. Summary of the invention

[0016] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.

[0017] The present invention describes a method for performing sparse submanifold deconvolution on a graphics processing unit, which sparse submanifold deconvolution can be represented as a direct convolution between an input tensor of the sparse submanifold deconvolution and each of a plurality of subfilters, wherein each of the plurality of subfilters includes a weight subset of the filter of the sparse submanifold deconvolution. The method includes: receiving an input tensor in a dense format on a graphics processing unit; receiving information on a graphics processing unit that can identify a target position of an output tensor of the sparse submanifold deconvolution; based on the identified output tensor target position, performing an index expansion operation on the input tensor on the graphics processing unit to generate an input matrix including input tensor elements related to at least one identified target position of the output tensor in each subwindow of the input tensor; and performing a matrix multiplication between the weight matrix and the input matrix on the graphics processing unit to generate an output matrix including output tensor elements at the identified target position.

[0018] In a first aspect, a method for implementing sparse submanifold deconvolution on a graphics processing unit is provided, wherein the sparse submanifold deconvolution can be represented as a direct convolution between an input tensor of the sparse submanifold deconvolution and each of a plurality of subfilters, wherein each of the plurality of subfilters includes a weight subset of the filter of the sparse submanifold deconvolution. The method includes: receiving an input tensor in a dense format on a graphics processing unit; receiving information on a target position of an output tensor of the sparse submanifold deconvolution on a graphics processing unit; performing an index expansion operation on the input tensor on a graphics processing unit based on the identified output tensor target position to generate an input matrix including input tensor elements related to at least one identified target position of the output tensor in each subwindow of the input tensor; and performing a matrix multiplication between a weight matrix and an input matrix on the graphics processing unit to generate an output matrix including output tensor elements at the identified target position.

[0019] The output tensor may have at least a height dimension, a width dimension, and a channel dimension, and the target position of the output tensor may be the height and width positions of the output tensor.

[0020] The information identifying the target locations of the output tensor may include a target location list including height and width coordinates of each target location of the output tensor.

[0021] A sub-window of the input tensor may be a window of the input tensor used to compute at least one output tensor element of one of the direct convolutions.

[0022] Performing an indexed unroll operation on the input tensor may include identifying, from the identified target positions of the output tensor and one or more parameters of the sparse submanifold deconvolution, each subwindow of the input tensor associated with at least one identified target position of the output tensor.

[0023] A subwindow of the input tensor may be associated with a target position if the subwindow is used to generate an element of the output tensor of the sparse submanifold deconvolution at that target position.

[0024] The elements of a channel of an output tensor of the sparse submanifold deconvolution may be divided into a plurality of blocks, wherein each element in the block is generated by the same subwindow of the input tensor and a different subfilter of the filter, and identifying a subwindow of the input tensor associated with the identified target position may include identifying a block of the output tensor of which the identified target position forms a part, and mapping the identified block of the output tensor to the subwindow of the input tensor used to generate the block.

[0025] The identified block of the output tensor can be mapped to a sub-window of the input tensor using the position in the output tensor of the predetermined element of the block and one or more parameters of the sparse submanifold deconvolution.

[0026] Performing an indexed unroll operation on the input tensor may include identifying elements of each relevant sub-window from one or more parameters of the sparse sub-manifold deconvolution.

[0027] Identifying elements of the relevant sub-window may include identifying a position in the input tensor of a predetermined element within the sub-window, and implementing a series of nested loops to move the element from the identified position in the sub-window, the series of nested loops including a loop for each dimension of the sub-window.

[0028] Performing an index expansion operation on the input tensor may include storing elements of each relevant sub-window in an input matrix.

[0029] The method may further include receiving an input matrix of zeros, and the elements of the relevant sub-window of the input tensor may be stored in the received input matrix.

[0030] Performing an indexed expansion operation on the input tensor may include identifying, from one or more parameters of the sparse submanifold deconvolution, which of a plurality of sub-filters is associated with each identified target position of the output tensor.

[0031] The elements of a channel of the output tensor may be divided into a plurality of blocks, wherein each element in the block is generated by the same subwindow of the input tensor and a different subfilter of the filter, and identifying which of the plurality of subfilters is associated with an identified target position of the output tensor may include identifying the block of which the target position forms a part, and the position within the block at which the target position is located.

[0032] The input matrix may include a column for each relevant sub-window of the input tensor, and each column of the input matrix may include an element of the input tensor in the corresponding relevant sub-window.

[0033] The weight matrix may include a row for each sub-filter associated with at least one identified target location of the output tensor, and each row of the weight matrix may include all of the weights forming the corresponding sub-filter.

[0034] The method may also include performing, at the graphics processing unit, an index folding operation on the output matrix based on the identified target location of the output tensor to generate an output tensor in a dense format.

[0035] Performing an index folding operation on the output matrix may include identifying elements in the output matrix corresponding to the identified target positions of the output tensor based on the identified target positions of the output tensor and one or more parameters of the sparse submanifold deconvolution, and storing each element of the identified target positions in the output matrix at the target positions corresponding to a channel of the output tensor.

[0036] For each relevant sub-window, the output matrix may include an element for each relevant sub-filter, and an element of the output matrix is ​​determined to correspond to an identified target location if the element is generated by the sub-window and sub-filter that are associated with the identified target location.

[0037] The method may also include receiving a zero output tensor at the graphics processing unit, and the elements of the output matrix corresponding to the identified target positions are written to the received output tensor.

[0038] Performing the index folding operation on the output matrix may also include storing a zero at each position of the output tensor that does not include an element of the output matrix.

[0039] A second aspect provides a graphics processing unit configured to execute the method of the first aspect.

[0040] A graphics processing unit may be embodied in hardware on an integrated circuit.

[0041] A third aspect provides a computer-readable storage medium having computer-readable code stored thereon, wherein the computer-readable code is configured to cause a graphics processing unit to execute the method of the first aspect when the code is executed.

[0042] The method of the first aspect may be implemented as part of processing data according to a neural network to perform a signal processing task.

[0043] The input tensor of the first aspect may include image data, such that performing sparse submanifold deconvolution comprises a method for processing image data.

[0044] Image data may include point cloud datasets generated by image sensors.

[0045] The sparse submanifold deconvolution of the first aspect may be a 3D sparse submanifold deconvolution, and the input tensor may include a 3D point cloud dataset.

[0046] A fourth aspect provides a method for implementing standard convolution on a central processing unit, the method comprising: receiving an input tensor in a dense format on the central processing unit; based on the identified active position of the input tensor, performing an index expansion operation on the input tensor on the central processing unit to generate an input matrix composed of input tensor elements at each non-zero window of the input tensor; and performing matrix multiplication between a weight matrix and the input matrix on the central processing unit to generate an output matrix composed of output tensor elements of a standard convolution based on the non-zero window of the input tensor.

[0047] The fifth aspect provides a method for implementing a sequence of two sparse submanifold convolutions, the method comprising: receiving an input tensor in a dense format to the first sparse submanifold convolution of the sequence on a graphics processing unit; identifying an active position of the input tensor on the graphics processing unit; based on the identified active position, performing an index expansion operation on the input tensor on the graphics processing unit to generate an input matrix including input tensor elements in each active window of the input tensor; performing matrix multiplication between a weight matrix and the input matrix on the graphics processing unit to generate an output matrix, the output matrix consisting of output tensor elements of the first sparse submanifold convolution based on the active window; providing the output matrix as an input tensor to a neural network accelerator in a sparse format to constitute a second sparse submanifold convolution of the sequence; for each position of the second sparse submanifold convolution kernel, performing a 1x1 convolution between the received input matrix and the filter weights of the sparse submanifold convolution at the kernel position on the neural network accelerator to generate multiple partial outputs; and combining appropriate partial outputs of the multiple partial outputs to generate a sparse format output tensor of the second sparse submanifold convolution. When the GPU includes a convolution accelerator such that the GPU may be viewed as an NNA, or may be viewed as including an NNA, the steps of the above method identified as being performed by the NNA may be performed by the convolution accelerator of the GPU.

[0048] The neural network accelerator, convolution processing unit, convolution engine, and graphics processing unit described herein may be included in hardware on an integrated circuit. A method of manufacturing the neural network accelerator, convolution processing unit, convolution engine, or graphics processing unit described herein in an integrated circuit manufacturing system may be provided. An integrated circuit definition data set may be provided, which, when processed in the integrated circuit manufacturing system, configures the system to manufacture an integrated circuit embodying the neural network accelerator, convolution processing unit, convolution engine, or graphics processing unit described herein. A non-transitory computer-readable storage medium may be provided, having stored thereon a computer-readable description of a neural network accelerator, convolution processing unit, convolution engine, or graphics processing unit, which, when processed in the integrated circuit manufacturing system, causes the integrated circuit manufacturing system to manufacture an integrated circuit embodying the neural network accelerator, convolution processing unit, convolution engine, or graphics processing unit.

[0049] An integrated circuit manufacturing system may be provided, comprising: a non-transitory computer-readable storage medium having stored thereon a computer-readable description of the neural network accelerator, convolution processing unit, convolution engine, or graphics processing unit described herein; a layout processing system configured to process the computer-readable description to generate a circuit layout description of an integrated circuit embodying the neural network accelerator, convolution processing unit, convolution engine, or graphics processing unit; and an integrated circuit generation system configured to manufacture an integrated circuit embodying the neural network accelerator, convolution processing unit, convolution engine, or graphics processing unit according to the circuit layout description.

[0050] A computer program code for performing any of the methods described herein may be provided. A non-transitory computer readable storage medium having computer readable instructions stored thereon may be provided, which, when executed at a computer system, causes the computer system to perform any of the methods described herein.

[0051] As will be apparent to those skilled in the art, the above-described features may be combined as appropriate and may be combined with any of the aspects of the examples described herein. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Examples will now be described in detail with reference to the accompanying drawings, in which:

[0053] Figure 1 is a schematic diagram of an example neural network;

[0054] Figure 2 is a schematic diagram showing an example tensor;

[0055] Figure 3 is a schematic diagram illustrating an exemplary 2D convolution;

[0056] Figure 4 is a schematic diagram illustrating an exemplary 2D sparse submanifold convolution;

[0057] Figure 5 is a flowchart of an example method for performing sparse submanifold convolution using a GPU;

[0058] Figure 6 is a diagram illustrating an example method for generating an active position list for an example input tensor;

[0059] Figure 7 is a schematic diagram illustrating an example expansion operation;

[0060] Figure 8 is a schematic diagram illustrating an example index expansion operation to implement a sparse submanifold convolution;

[0061] Fig. 9 is a schematic diagram showing an example padded input tensor;

[0062] Fig.10 is a schematic diagram showing an example matrix multiplication between a weight matrix and an input matrix to implement a sparse submanifold convolution;

[0063] Fig.11 is a schematic diagram illustrating an example index folding operation to implement sparse submanifold convolution;

[0064] Fig.12 is a graph of the average duration of example sparse submanifold convolutions implemented on a GPU for 3D input tensors of different sizes using different methods and different levels of sparsity;

[0065] Fig.13 is a flow chart of an example method for implementing sparse submanifold convolution using a neural network accelerator;

[0066] Fig.14 is a schematic diagram showing dense and sparse formats of example tensors;

[0067] Fig.15 is a schematic diagram illustrating sub-filters of an example filter to implement sparse submanifold convolution;

[0068] Fig.16 It is shown that the use Fig.15 The sub-filter pair Fig.14 Schematic diagram of performing 1x1 convolution on a sparse format input tensor to implement an example sparse submanifold convolution;

[0069] Fig.17 It is shown Fig.16 Schematic diagram of matrix multiplication between the 1x1 convolution output of and the corresponding scattering matrix to implement an example sparse submanifold convolution;

[0070] Fig.18 It shows that Fig.17 Schematic diagram of combining the matrix multiplication outputs of to implement an example sparse submanifold convolution;

[0071] Fig.19 According to the first example implementation Fig.13 Methods for exemplifying sparse submanifold convolutions with example inference graphs;

[0072] Fig. 20 According to the second example implementation Fig.13 Methods for inference graphs with examples for sparse submanifold convolutions;

[0073] Fig.21 is a flowchart of an example method for implementing standard convolution using a GPU;

[0074] Fig. 22 is a diagram illustrating performing an example index expansion operation on an example input tensor to implement an example standard convolution;

[0075] Fig.23 is a schematic diagram showing identification of a window of which each of a plurality of active locations forms a part to perform a standard convolution;

[0076] Fig.24 is a diagram illustrating performing an example unfolding operation on another example input tensor to implement an example standard convolution;

[0077] Fig.25 It is shown Fig.24 Schematic diagram of the matrix multiplication between the input matrix and the weight matrix generated in to implement an example standard convolution;

[0078] Fig.26 It shows Fig.25 A schematic diagram of performing an example index folding operation on the output of a matrix multiplication of to implement an example standard convolution;

[0079] Fig. 27 is a graph of the average duration of an example 2D convolution operation implemented on a GPU or CPU using different methods for different sizes of 2D input tensors and different levels of sparsity;

[0080] Fig.28 is a schematic diagram illustrating an exemplary 2D convolution;

[0081] Fig.29 is a schematic diagram illustrating an exemplary 2D deconvolution;

[0082] Fig.30 is a schematic diagram illustrating an exemplary 2D deconvolution;

[0083] Fig.31 is a schematic diagram showing an exemplary 2D deconvolution implementation using a transposed sparse matrix;

[0084] Fig.32 is a schematic diagram showing an exemplary 2D deconvolution implementation using a padded input tensor;

[0085] Fig.33 is a schematic diagram showing an exemplary 2D deconvolution implemented using multiple direct convolutions;

[0086] Fig.34 is a schematic diagram showing an exemplary 2D deconvolution implemented using multiple direct convolutions of sub-filters;

[0087] Fig.35 is a schematic diagram showing the output of interleaved multiple direct convolutions;

[0088] Fig.36 is a flowchart of an example method for implementing deconvolution using a GPU;

[0089] Fig.37 is a schematic diagram showing performing an example deconvolution by performing an example index expansion operation on an example input tensor to produce an input matrix;

[0090] Fig.38 It is shown Fig.37 Schematic diagram of matrix multiplication between the input matrix and the weight matrix to perform an example deconvolution;

[0091] Fig.39 It shows Fig.38 Schematic diagram of performing an index folding operation on the output matrix of to perform an example deconvolution;

[0092] Fig.40 is a flowchart of an example method for implementing sparse submanifold convolution using a GPU;

[0093] Fig.41 is a schematic diagram showing performing an example index expansion operation on an input tensor to produce an input matrix to implement an example sparse submanifold deconvolution;

[0094] Fig.42 It is shown Fig.41 Schematic diagram of matrix multiplication between an input matrix and a weight matrix to implement an example sparse submanifold deconvolution;

[0095] Fig.43 It shows Fig.42 Schematic diagram of performing an index folding operation on the output matrix of to implement an example sparse submanifold deconvolution;

[0096] Fig.44 is a block diagram of an exemplary neural network accelerator for implementing any of the NNA-based methods described herein;

[0097] Fig.45 yes Fig.44 A block diagram of an exemplary embodiment of a convolution processing unit of FIG.

[0098] Fig.46 yes Fig.45 A block diagram of an exemplary implementation of a convolution engine;

[0099] Fig.47 is a block diagram of an example computer system in which a graphics processing unit and / or a neural network accelerator described herein may be implemented; and

[0100] Fig.48 is a block diagram of an integrated circuit manufacturing system for generating an integrated circuit embodying a graphics processing unit, a neural network accelerator, a convolution processing unit, or a convolution engine described herein.

[0101] The accompanying drawings show various examples. It will be appreciated by the skilled person that the element boundaries (e.g., boxes, groups of boxes, or other shapes) shown in the accompanying drawings represent an example of boundaries. In some examples, it may be the case that an element can be designed as multiple elements, or multiple elements can be designed as one element. Where appropriate, common reference numerals are used throughout the accompanying drawings to indicate similar features. DETAILED DESCRIPTION

[0102] The following description is presented by way of example to enable one skilled in the art to make and use the invention.The present invention is not limited to the embodiments described herein, and various modifications to the disclosed embodiments will be apparent to those skilled in the art.

[0103] Embodiments are now described by way of example only.

[0104] As described above, as sparse submanifold convolution layers become increasingly popular in neural networks, it is particularly important to be able to implement sparse submanifold convolutions in a hardware efficient manner (e.g., in a manner that requires less silicon area or less processing power).

[0105] Methods known to the applicant, without admitting that they are known or well-known outside the applicant company, for implementing sparse submanifold convolution on a GPU, such as the methods implemented by TorchSparse and SpConv, include performing a gather operation, a matrix multiplication (MatMul) operation, and a scatter operation. Specifically, in the GPU implementation: (1) determine the active points in the input tensor; (2) then build a HashMap to store the information of the (active) points that need to be multiplied by each weight; (3) then use a gather operation to generate an input data matrix (or a set of input data matrices) and a parameter / weight matrix (or a set of parameter matrices) from the HashMap, so that each (active) point is multiplied by the relevant weight; (4) perform a matrix multiplication between the input matrix and the parameter matrix / matrix to generate partial results; and (5) then perform a scatter add operation, based on the HashMap, to combine the partial results to generate the final output and place them in the correct position in the output tensor. However, the gather and scatter operations can be time and resource intensive to implement.

[0106] Thus, the inventors have developed methods for implementing sparse submanifold convolutions in a more hardware efficient manner than methods known to the applicant, using a GPU and / or a neural network accelerator (NNA) to exploit the hardware features of the GPU and NNA, respectively. In particular, the methods described herein for implementing submanifold convolutions are particularly adapted to take into account the internal functionality of the GPU and / or NNA. In particular, as described in more detail below, the GPU-based methods are designed to exploit the parallel architecture (e.g., SIMD architecture) of the GPU, and the NNA-based methods are designed to exploit the architecture of the NNA, which enables the convolution operation to be implemented in a hardware efficient (in terms of time and resources) manner.

[0107] GPU implementation of sparse submanifold convolution

[0108] The inventors have determined that sparse submanifold convolutions can be efficiently performed on a GPU by performing an index expansion operation on an input tensor in a dense format to generate an input matrix for an active window of the input tensor, performing a matrix multiplication between a weight matrix and the input matrix, and optionally performing an index folding operation on the output of the matrix multiplication to generate an output tensor in a dense format. GPUs are typically implemented using a single instruction multiple data (SIMD) architecture. The inventors have determined that the index expansion operation, matrix multiplication, and index folding operations can be performed very efficiently in parallel using a SIMD architecture, thereby allowing sparse submanifold convolutions to be performed in a very hardware and resource efficient manner using the specific hardware structure of a GPU in the manner described herein.

[0109] Reference Figure 5, which shows an example method 500 for implementing sparse submanifold convolution using a GPU. Method 500 begins at block 502, where an input tensor in dense format is received at a GPU. The input tensor in dense format, which may also be referred to as a densified input tensor, includes every possible element of the tensor, regardless of whether the element is in an active position. As described above, an active position or location in an input tensor is a height and width position or location (also referred to as x, y position, y, x position, column and row position, or row and column position) in which at least one channel of the input tensor has a non-zero value. For example, if the element in the height and width position (1, 2) of the first channel of the input tensor is not zero, the element is in an active position, and the elements in the height and width position (1, 2) of other channels are also in active positions, regardless of whether they are non-zero. In contrast, the input tensor in sparse format only includes elements of the corresponding tensor in dense format that are in active positions or locations. In other words, the input tensor in sparse format does not include elements of the input tensor in dense format that are in inactive positions or locations. For example, if all elements at the height and width position (1, 1) of the dense format input tensor are zero, the height and width position (1, 1) is not an active position, and thus the sparse version of the input tensor will not include any elements at the height and width position (1, 1) of the dense format input tensor. Once the dense format input tensor has been received, the method 500 proceeds to block 504.

[0110] At block 504, the GPU identifies active locations or positions in the received input tensor. As described above, an active location is a height and width location or position of the input tensor where at least one channel of the input tensor has a non-zero value. Each active location or position can be identified by a set of indices - a height or row index, and a width or column index.

[0111] Any suitable technique may be used to identify active locations or positions in a received input tensor. For example, there are software modules available, such as A non-zero function in , which can run efficiently on the GPU, and when the GPU is provided with an input tensor, will return a list of non-zero coordinates of the input tensor. This list will include the coordinates of each non-zero element in the input tensor. This means that if there are two channels with non-zero elements at the same height and width position, then for each channel, that height and width position will be identified twice. Since the active position is the height and width position where at least one channel has a non-zero value, the list of coordinates generated by the non-zero function can be further processed to identify only the unique height and width positions or coordinates in the list. In other words, the list of coordinates generated by the non-zero function can be further processed to eliminate duplicate height and width positions or coordinates. In another example, the from_dense function of SpConv can be first used (which relies on to_sparse function of ) to generate a sparse format tensor in coordinate format from a dense format input tensor, and then identify the active position from the sparse format tensor to identify the active position or position in the received input tensor.

[0112] In some cases, the output of this block 504 may be a list of height and width (or column and row) coordinates or indices of the active positions. For example, Figure 6 An exemplary 6x6 input tensor 602 with a single channel is shown. The input tensor 602 has only two active positions 604, 606. Thus, the output of block 504 for this example input tensor 602 may be an active position list 608 that includes the height and width coordinates or indices of each of the two active positions 604, 606. Specifically, the active position list 608 may include an entry for each active position that identifies the height (e.g., row) and width (e.g., column) location or position. For example, Figure 6 As shown, the active position list 608 may include an entry for a first active position 604 whose position is identified as height (row) 1 and width (column) 1, and an entry for a second active position 606 whose position is identified as height (row) 3 and width (column) 3.

[0113] Once the active location or position in the received input tensor is identified, method 500 proceeds to block 506 .

[0114] At block 506, the GPU performs an index expansion operation (also referred to as a sparse expansion operation) on the received input tensor based on the active positioning or position identified in block 504 to generate an input matrix including elements of the active window of the input tensor. In a standard expansion operation (also referred to as an image to column (im2col) operation or a default expansion operation), the elements of the input tensor in each window are placed in the columns of the input matrix. As described above, each window generates an output element in each channel of the output tensor. Therefore, if there are P elements in each channel of the output tensor (meaning P windows of the input tensor), there will be P columns in the input matrix of the standard expansion operation. The expansion operation can also be described as a flattening operation. The standard expansion operation will now be explained by example.

[0115] Reference Figure 7 , which shows the Figure 6The example 6x6 input tensor 602 performs a standard unfold operation to perform a 2D convolution of a filter with a 3x3 kernel to generate an input matrix 702. In this example, each channel of the output tensor will have size 4x4, so there are sixteen elements in each channel of the output tensor. Each element in a channel of the output tensor is generated from a different window of the input tensor 602. Since sixteen windows of the input tensor are used to generate the output tensor, there are sixteen columns in the input matrix 702. Each column of the input matrix 702 includes the elements of one window of the input tensor 602, where each element in the window is placed in a different row. In this example, each window includes a 3x3 block of elements in the input tensor 602, so there are nine elements per window. Therefore, the input matrix 702 has nine rows. Each row corresponds to a position in a window, and the elements of the window are placed in the row according to their position in the window. In Figure 7 In the example shown, the elements in the window are spread out from left to right and from top to bottom, so that the elements in the upper left corner of the window are placed in the first row, the elements in the center of the window are placed in the fifth row, and the elements in the lower right corner of the window are placed in the last or ninth row. For example, the elements in the first window 704 of the input tensor 602 are placed in the first column 706 of the input matrix 702, as shown in FIG. Figure 7 and the elements in the last window 708 of the input tensor 602 are placed in the last column 710 of the input matrix 702, as shown Figure 7 However, it will be apparent that this is merely an example and that the elements of the windows may be placed in any order in the input matrix as long as the elements of each window are placed in the same order (e.g., the elements of the first window are placed in the columns in the same order as the elements of the second window are placed in the second column).

[0116] Despite Figure 7 In the example of , the input tensor 602 has only one channel, but it is apparent that the standard unrolling operation can be equally applied to input tensors with more than one channel by adding n rows to the input matrix for each additional channel, where n is the number of elements in the filter kernel. For example, where each kernel is 3x3 so that each window includes 9 elements of the input tensor for each channel, then 9 rows are added to the input matrix for each additional channel of the input tensor.

[0117] However, as explained above, in a sparse submanifold convolution, elements of the output tensor are generated only for windows of the input tensor (which may be referred to herein as active windows) in which one or more predetermined elements of the window (the central element in this example) are active. Therefore, only the columns of the input matrix 702 corresponding to the active windows are used in the sparse submanifold convolution. Therefore, there are many columns in the input matrix generated by the standard expansion operation that are not needed for the sparse submanifold convolution.

[0118] Therefore, the inventors have developed an index expansion operation in which the input tensor includes only columns for each active window, where the active window is identified from the active location or position identified in block 504. Specifically, the index expansion operation uses the active location or position and the sparse submanifold convolution parameters (e.g., stride, dilation, kernel size) to determine the active window of the input tensor, and then generates an input matrix having columns for each active window, where each column includes elements in the corresponding active window. For example, Figure 8 As shown, if the Figure 6 If a sparse submanifold convolution with a 3x3 kernel with a stride of 1 is performed on the input tensor 602 (with only two active positions), there are only two active windows 804, 806. Therefore, the index expansion operation performed on the input tensor 602 produces an input matrix 802 with only two columns - the first column corresponds to the first active window 804 with the first active position at the center, and the second column corresponds to the second active window 806 with the second active position at the center.

[0119] In some cases, padding can be applied to the input tensor so that any active point on the edge of the input tensor (i.e., in the first / last column or first / last row) can be the center of the window. The number of padding rows and columns added is based on the size of the kernel. For example, in a filter with a kernel of height K H In this case, you can fill The rows are added to the top and bottom of the input tensor respectively; and the kernel of the filter has width K w In this case, you can fill Columns are added to the left and right sides of the input tensor respectively. For example, Fig. 9 As shown, for a 3x3 kernel, padding rows 902, 904 may be added to the top and bottom of the input tensor 602, respectively, and padding columns 906, 908 may be added to the left and right sides of the tensor, respectively. If the input tensor has been padded in this manner and the stride is one in each dimension, there will be an active window for each active position of the input tensor, and the input matrix generated by the index expansion operation will have a column for each active position.

[0120] In contrast to the standard expansion operation, using the index expansion operation to generate the input matrix can significantly reduce the size of the input matrix, which can significantly reduce the computation of the matrix multiplication (described below) that implements block 508. Table 1 shows an example input tensor of size [1, 1, 1000, 1000] (i.e., one batch, one channel, height 1000, and width 1000), for a sparse submanifold convolution with a 3x3 kernel, stride and dilation of 1, no padding, and different levels of sparsity, the size of the input matrix generated using the index expansion operation compared to the size of the input matrix generated using the standard expansion operation. In general, the sparser the input tensor, the smaller the input matrix generated by the index expansion operation, and with respect to Figure 5 The described method is more memory efficient.

[0121] Table 1

[0122]

[0123]

[0124] The index expansion operation can be implemented on the GPU in any suitable manner. In one example, where there is an active window for each active position, the index expansion operation can be implemented by indexing each active position (e.g., from 0 to the number of active positions), and for each active position / location, using multiple nested loops (one for each dimension of the window) to identify surrounding positions / locations (i.e., positions / locations in the window of the input tensor centered on the active position). For example, where the window is a 2D window with a height dimension and a width dimension, there may be one loop for the height dimension and one loop for the width dimension. Specifically, for a 2D convolution with a 2D window, equal loops can be created for the height and width dimensions, respectively. The GPU is then configured to loop from -offset to +offset from the respective active positions. In the case where the window is a 3D window with a channel dimension, there may be an additional loop that loops through the channels. The elements at each identified position are then copied to the appropriate position in the input matrix. As described above, each column in the input matrix can correspond to an active window. The values ​​at the offset positions starting from the top left can be sorted from top to bottom. This can be achieved by having a separate thread for each active position. Since the same operation is performed on each active position, this can be efficiently implemented by a SIMD architecture, such as applying a single instruction (or instruction set) to multiple input data (i.e., multiple active positions).

[0125] If there are fewer active windows than active positions due to stride, dilation, or other sparse submanifold convolution parameters, the index expansion operation can be implemented on the GPU by performing a validity check to determine whether the active position produces or induces an active window before identifying positions / positions surrounding the active position (e.g., using the nested loops), and only identifying surrounding positions / positions and adding elements from the identified positions to the input matrix if the active position causes an active window.

[0126] In some cases, in addition to receiving input tensors and active positions in dense format, the index expansion operation can also receive a zero input matrix with a desired shape (e.g., height = number of elements x channels per kernel, width = number of active windows), and the GPU can be configured to write the active window elements to the appropriate locations in the received input matrix.

[0127] Once the GPU has performed the index expand operation on the input tensor to generate an input matrix having elements for each active window of the input tensor, the method 500 proceeds to block 508 .

[0128] At block 508 , the GPU performs a matrix multiplication operation (which may be referred to as a MatMul operation) between the weight matrix and the input matrix generated in block 506 to generate an output matrix. Fig.10 The weight matrix 1002 is shown with Figure 8 An example of a matrix multiplication between the input matrices 802 of . The weight matrix 1002 may include a row for each filter and a column for each weight in the filter. For example, in Fig.10 In , there are five filters with 3x3 kernels and one channel (thus each filter includes nine weights). Therefore, the weight matrix 1002 includes five rows and nine columns. Each column corresponds to a position in the filter, and the weights of the filters are placed in the column according to their position in the filter. Fig.10 In the example shown, the weights of the filter are spread out from left to right and from top to bottom, so that the weights in the upper left corner of the filter are placed in the first column, the weights in the center of the filter are placed in the fifth column, and the weights in the lower right corner of the filter are placed in the last or ninth column. It will be apparent to those skilled in the art that this is merely an example, and the weights can be placed in any order in the weight matrix, as long as their order corresponds to the order of the elements of each active window in the input matrix. Specifically, if the element at position (-1, -1) of the active window is placed in row 0, then the weight at position (-1, -1) of the filter should be placed in column 0.

[0129] The matrix multiplication between the weight matrix 1002 and the input matrix 802 generates an output matrix 1004 that includes an output element for each channel of the output tensor for each active window (i.e., for each filter of the sparse submanifold convolution). The output matrix 1004 may have a column for each active window and a row for each output channel, such that each column includes an output element of the corresponding active window for each output channel. Fig.10 In the example shown, there are two active windows and five output channels, so the example output matrix 1004 has two columns and five rows. Matrix multiplication can be parallelized on a GPU, for example, by processing each column of the input matrix in a separate thread.

[0130] Once the GPU has performed the matrix multiplication, the method 500 may end, or the method 500 may proceed to block 510. Specifically, the output matrix 1004 generated in block 508 includes all non-zero elements of the output tensor (in other words, the output matrix corresponds to the output tensor in sparse format), so the output matrix 1004 may simply be output, or the output tensor in dense format may first be generated from the output matrix 1004. When the method is executed as part of a neural network, whether the output matrix is ​​converted to an output tensor in dense format may depend on what input tensor format the next layer of the neural network expects.

[0131] At block 510, the GPU performs an index folding operation on the output matrix generated in block 508 to generate an output tensor 1102 in dense format. The index folding operation is the opposite of the index unfolding operation performed in block 506. Specifically, the index folding operation uses the active window to generate an output tensor in dense format (e.g., a densified output tensor) from the output matrix 1004 generated in block 508. In other words, the index folding operation generates an output tensor in which the elements of the output matrix 1004 are in the correct positions of the output tensor in dense format and are zero elsewhere.

[0132] The standard folding operation (which may also be referred to as a column-to-image (col2im) operation) receives an output matrix in a dense format, i.e., an output matrix comprising a row for each output channel, each output channel having an output element for each element of the channel, and transforms each row of the received matrix into a plane of the output tensor according to the size of the channels of the output tensor. For example, if the size of each channel of the output tensor is 5x5, the standard folding operation places every five elements in the same row of the received matrix in different rows of the corresponding channel. For example, the first five elements in the first row of the received matrix will be placed in the first row of the first channel of the output tensor, the next five elements in the first row of the received matrix will be placed in the second row of the first channel, and so on; the first five elements in the second row of the received matrix will be placed in the first row of the second channel of the output tensor, the next five elements in the second row of the received matrix will be placed in the second row of the second channel, and so on.

[0133] Compared to the standard folding operation, the index folding operation receives an output matrix in a sparse format, i.e., the received matrix does not include an element for each element of the output tensor in a dense format. The index folding operation also receives information indicating the position in the output tensor corresponding to each active window of the input tensor (this can be information (e.g., index) of the active position identified in the identification block 504; information (e.g., index of the element of each active window) that specifically identifies the active window (can be generated as part of block 506); or information (can be generated as part of block 506) that specifically identifies the position in the output tensor corresponding to each active window). The elements of the sparse output matrix are then placed at the correct positions of the output tensor in a dense format using the information indicating the position in the output tensor corresponding to each active window. Elements at all other positions can then be set to zero.

[0134] In the case where there is an active window at each active position (e.g., because the input is padded and the stride is 1 in all directions), the height and width of the input tensor will be the same as the height and width of the output tensor, and the elements in the sparse output matrix 1004 can simply be placed in the same position in the output tensor as the corresponding active position. For example, in this case, if the active window is centered at the active position (1, 1), the output element based on the active window will be placed at the position (1, 1) of the corresponding output channel. However, if there is no active window at each active position, and the received information does not explicitly identify the output position corresponding to each active window, the position of each element in the output matrix 1004 is determined based on the received information and / or the parameters of the sparse submanifold convolution. For example, the active window can be determined from the active position, and the parameters of the sparse submanifold convolution (e.g., filter dimension, stride, dilation) and the position in the output tensor corresponding to each active window can be determined from the active window and the parameters of the sparse submanifold convolution.

[0135] Fig.11 Shows the Fig.10 1004. It can be seen that based on the active position list 608 and the sparse submanifold convolution parameters, it can be determined that each element of the output matrix 1004 associated with the first active window will be placed at the position (0, 0) of the corresponding channel of the output tensor 1102, and each element in the output matrix 1004 associated with the second active window will be placed at the position (2, 2) of the corresponding channel of the output tensor 1102.

[0136] The index folding operation can be implemented on the GPU in any suitable manner. In one example, where there is an active window for each active position of the input tensor, the index folding operation can be implemented on the GPU by, for example, creating an index for each active position / position (e.g., from 0 to n where there are n+1 active positions in the input tensor). Then, for each active position / position, the GPU can be configured to determine the associated position in the output tensor from the position and kernel parameters of the corresponding active position, and then loop through each output channel and place or copy the appropriate elements of the output matrix at the determined position in the corresponding channel of the output tensor. Each active position can get its own thread.

[0137] In the case where there are fewer active windows than active positions, due to, for example, stride, dilation, or other convolution parameters, then the index folding operation may be implemented on the GPU in the following manner: prior to determining the associated position of the active position in the output tensor, performing a validity check on the active position to determine whether the active position produces or induces an active window, and determining the associated position in the output tensor and performing a copy only if the active position causes an active window. For example, if the stride is two for a sparse submanifold convolution, the validity check may include determining whether the active position is at or on an odd index, and if the active position is determined to be at or on an odd index, determining that the active position does not cause an active window.

[0138] In some cases, the index folding operation may receive an output tensor of zeros of appropriate dimensions, and may write elements of the received matrix to the received output tensor, in addition to receiving the sparse submanifold convolution parameters, information identifying the active window, and the output matrix generated in block 508. In this case, it may not be necessary to explicitly write zeros to the output tensor at locations that do not include elements of the output matrix.

[0139] Once the index folding operation has been performed, method 500 may end.

[0140] In the above example, the rows of the weight matrix correspond to the filters (i.e., include all weights of the filters), and the columns of the input matrix correspond to the windows of the input tensor (i.e., include all elements in the window of the input tensor), and the weight matrix is ​​multiplied with the input matrix so that the dot product of the rows of the weight matrix and the columns of the input matrix is ​​calculated to obtain the output matrix. However, it will be apparent to those skilled in the art that this is merely an example, and in other examples, the rows and columns of the weight matrix and the input matrix may be reversed (in other words, the weight matrix and the input matrix may be transposed), and the transposed input matrix may be multiplied with the transposed weight matrix to obtain the transposed of the output matrix.

[0141] In some cases, the input matrix may be transposed after the index expansion operation, and the output matrix may be transposed before the index folding operation. However, the weight matrix may be transposed offline and only provided as input to the GPU. In some cases, where a sequence of two or more sparse submanifold convolutions is performed, only the input matrix of the first sparse submanifold convolution may be transposed, and only the output matrix of the last sparse submanifold convolution may be transposed. Specifically, the intermediate convolutions are performed only with the transposed matrices.

[0142] As described in more detail below, testing has shown that the described method of implementing sparse submanifold convolutions can allow sparse submanifold convolutions to be implemented more efficiently in terms of computational time and resources than known GPU-based methods.

[0143] Test Results

[0144] Reference Fig.12 , which shows (i) different sizes of 3D input tensors (MNIST); (ii) different methods (TorchSparse, SpConv, PyTorch Conv3D and the one described in this paper) Figure 5 related methods, called “sparse unfolding” methods); and (iii) the average duration (in milliseconds) of implementing example sparse submanifold convolutions on a GPU with different levels of sparsity. Table 2 summarizes the sparse submanifold convolution implementation methods and Fig.12 Different combinations of input tensor sparsity shown in .

[0145] Table 2

[0146]

[0147]

[0148] from Fig.12 It can be seen that this article is about Figure 5 The described method for implementing sparse submanifold convolution outperforms known GPU-based methods for implementing sparse submanifold convolution when the input data is highly sparse (e.g., at least 90% sparse).

[0149] NNA implementation of sparse submanifold convolution

[0150] Executing the forward and backward passes of a neural network on a CPU or GPU is typically expensive in terms of computation, bandwidth, and power. Therefore, neural network accelerators (NNAs) have been developed that allow neural networks to be implemented in a hardware efficient manner (e.g., in a manner that requires less silicon area or less processing power).

[0151] NNA is hardware designed to accelerate neural network processing. As known to those skilled in the art, a hardware accelerator is hardware designed to perform a specific set of one or more functions more efficiently than a general-purpose processing unit such as a central processing unit (CPU). Therefore, compared to a general-purpose CPU that can be configured to perform any number of functions, an accelerator can only perform a limited set of one or more functions. NNA has one or more network processing hardware units (which may be referred to as processing units for short), each of which is designed to accelerate one or more neural network operations. Therefore, a graphics processing unit (GPU) having one or more network processing hardware units designed to accelerate one or more neural network operations can be understood as NNA itself or including NNA. Neural network operations are defined herein as operations for implementing all or part of a neural network layer. A neural network layer can be implemented by one or more neural network operations. Exemplary neural network operations include, but are not limited to, convolution operations, nonlinear operations, pooling operations, and normalization operations.

[0152] Thus, the NNA may have, for example, a convolution processing unit configured to accelerate convolution operations, an activation processing unit configured to accelerate nonlinear operations, a pooling processing unit configured to accelerate pooling operations, and / or a normalization processing unit configured to accelerate normalization operations. It will be apparent to those skilled in the art that this is only an example set of network processing hardware units that the NNA may have, and that the NNA may have additional network processing hardware units, fewer network processing hardware units, or a different combination of network processing hardware units. Fig.44 An example NNA is described.

[0153] The inventors have determined that sparse submanifold convolutions can be efficiently performed using an NNA by performing a 1x1 convolution between an input tensor in a sparse format and the weight (one or more) at each kernel position to generate a partial output, and then combining the appropriate partial outputs to generate a final output element. The combination of the partial outputs generated by the 1x1 convolution can be implemented in a variety of different ways. In some cases, where, for example, the NNA includes a hardware component that can perform a scattered addition operation, the combination of the partial outputs can be achieved by using the hardware component to perform a scattered addition operation on the partial outputs. In other cases, where, for example, the NNA does not have a hardware component that can perform a scattered addition operation, the combination can be achieved by performing a matrix multiplication between the output of each 1x1 convolution and the corresponding scattering matrix, and combining the results of the matrix multiplication. These methods take advantage of the hardware structure of the NNA, which allows convolution operations to be performed in a hardware-efficient manner.

[0154] Reference Fig.13, which illustrates an example method 1300 for implementing sparse submanifold convolution using an NNA. The method 1300 begins at block 1302, where an input tensor in sparse format is received at the NNA. As described above, the input tensor in dense format includes every element of the input tensor regardless of whether the element is in an active position. In contrast, the input tensor in sparse format only includes the elements of the input tensor in dense format that are in active positions. For example, Fig.14 Shows Figure 4 An input tensor of with three active positions / locations (p1, p2, p3) in dense format 402 and the same input tensor in sparse format 1404. Fig.14 As can be seen in , the input tensor in sparse format 1404 includes only the elements of the input tensor in dense format 402 that are at active locations or positions. Fig.14 In the example shown, the input tensor in dense format 402 has only one channel, so the input tensor in sparse format has only one channel; however, if the input tensor in dense format has multiple channels, the input tensor in sparse format will also have multiple channels. In other words, for each active position, the input tensor in sparse format will include an element for each channel. Once the input tensor in sparse format is received at the NNA, the method 1300 proceeds to block 1304.

[0155] At block 1304, the NNA performs a 1x1 convolution on the received input tensor for each position or location within the kernel of the filter(s) of the sparse submanifold convolution using the weight(s) at the kernel position or location. As described above, the NNA typically includes hardware, such as a convolution processing unit (i.e., a convolution hardware accelerator), to accelerate the convolution operation. Therefore, the NNA can efficiently perform 1x1 convolution using such hardware.

[0156] As described above, the sparse submanifold convolution applies one or more filters of weights to an active window of the input tensor. Each filter of the sparse submanifold convolution may be referred to herein as a sparse submanifold filter. Each sparse submanifold filter includes one or more filters of size K. H xK W The kernel of K H is the height of the kernel (i.e., the number of weights in the height or y dimension), and K W is the width of the kernel (i.e., the number of weights in the width or x dimension). Thus, each kernel consists of K H xK W weights, each at a different position or location within the kernel. Fig.15 shows a single 3x3 kernel Figure 4An exemplary sparse submanifold filter 404 of FIG. The kernel includes nine different weights, each weight at a different location or position within the kernel. Each location or position in the kernel can be identified by a set of height and width (or y and x) coordinates or indices. For example, Fig.15 The nine positions within the kernel 404 in can be represented as height and width coordinates or index pairs, where (0,0) is the center of the kernel. For example, the nine positions within the kernel can be represented by the following indexes (-1,-1), (-1,0), (-1,1), (0,-1), (0,0), (0,1), (1,-1), (1,0), (1,1). It will be apparent to those skilled in the art that this is merely one example of an index that can be used to identify a position or location within a kernel.

[0157] For each position within the kernel of the sparse submanifold filter, the weight(s) at that position are extracted to form a subfilter. For example, the weight at position (-1, -1) forms one subfilter, the weight at position (-1, 0) forms another subfilter, and so on. Fig.15 Shown by Fig.15 The nine sub-filters 1504, 1506, 1508, 1510, 1512, 1514, 1516, 1518, 1520 generated by the example sparse sub-manifold filter 404. It will be apparent to those skilled in the art that due to Fig.15 The sparse submanifold filter 404 includes only one channel, so each subfilter includes only one channel. However, if the sparse submanifold filter has multiple channels, each subfilter will also have multiple channels. In other words, for each channel of the filter, the subfilter includes a weight at a specific kernel position. For example, if the sparse submanifold filter includes three channels, each subfilter includes three weights, one weight for each channel.

[0158] Then, a 1x1 convolution is performed on the received dense format input tensor for each kernel position using the sub-filter(s) corresponding to that position (i.e., using the weights at that kernel position). The term "1x1" convolution is used herein to refer to a convolution with size 1x1 (i.e., K H =K W = 1). For example, if the sparse submanifold convolution is Fig.15 The filter 404 is applied to Fig.14 If the input tensor is in dense format 402, there are nine kernel locations, so, for example Fig.16As shown, nine 1x1 convolutions 1602, 1604, 1606, 1608, 1610, 1612, 1614, 1616, 1618 are performed on the input tensor in sparse format 1404, where each 1x1 convolution applies (multiple) sub-filters 1504, 1506, 1508, 1510, 1512, 1514, 1516, 1518, 1520 corresponding to a specific position within the kernel. For example, the first 1x1 convolution 1602 applies the first sub-filter 1504 (the sub-filter corresponding to the first kernel position (-1, -1)) to the input tensor in the sparse format 1404; the second 1x1 convolution 1604 applies the second sub-filter 1506 (the sub-filter corresponding to the second kernel position (-1, 0)) to the input tensor in the sparse format 1404; the third 1x1 convolution 1606 applies the third sub-filter 1508 (the sub-filter corresponding to the third kernel position (-1, 1)) to the input tensor in the sparse format 1404, and so on.

[0159] Each 1x1 convolution generates tensors 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1636, which include partial outputs that can be combined to generate elements of the output tensor. Specifically, each element of the output tensor can be represented as K H xK W The sum of dot products, where each dot product is the dot product of the weight at one kernel position with the element of the input tensor at the corresponding position in a window of the input tensor. In the case where the corresponding position in the window is inactive, the dot product will be zero and can be ignored. The 1x1 convolution output will produce a dot product for each kernel position for each active position, so any element in the output can be generated by combining the partial outputs generated by the 1x1 convolution.

[0160] For ease of explanation, Fig.16 In the example of , there is only one sparse submanifold convolution filter, so each 1x1 convolution has only one filter. This means that each 1x1 convolution output tensor 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1636 has only one channel. However, it will be apparent to those skilled in the art that if there are multiple sparse submanifold filters, each 1x1 convolution will have multiple filters producing multi-channel outputs.

[0161] Once the 1x1 convolution is performed, method 1300 proceeds to block 1306.

[0162] At block 1306, the NNA combines the appropriate partial outputs generated in block 1306 to generate active elements of the output tensor (ie, elements of the output tensor at active positions).

[0163] The appropriate partial outputs to be combined can be determined from the active positions of the input tensors and the sparse submanifold convolution parameters (e.g., kernel size, stride, dilation). For example, for Figure 4 Example sparse submanifold convolution, the output tensor has only three active positions (q1, q2, q3). Figure 4 As shown, the element or value q1 at the first active position in the first (and only) channel of the output tensor 412 is equal to the dot product of the first active window 406 of the input tensor 402 and the filter 404, and will therefore be equal to p1*w(0,0)+p2*w(1,1). Fig.16 It can be seen that the first output of the fifth 1x1 convolution 1610q1-5 is equal to p1*w(0,0); and the second output of the ninth 1x1 convolution 1618q2-9 is equal to p2*w(1,1). Therefore, q1 can be generated by combining q1-5 and q2-9.

[0164] The element or value q2 at the second active position in the first (and only) channel of the output tensor 412 is equal to the dot product of the second active window 408 of the input tensor 402 and the filter 404, and will therefore be equal to p1*w(-1,-1)+p2*w(0,0)+p3*w(1,0). Fig.16 It can be seen that the first output q1-1 of the first 1x1 convolution 1602 is equal to p1*w(-1,-1); the second output q2-5 of the fifth 1x1 convolution 1610 is equal to p2*w(0,0); and the third output q3-8 of the eighth 1x1 convolution 1616 is equal to p3*w(1,0). Therefore, q2 can be generated by combining q1-1, q2-5 and q3-8.

[0165] Finally, the element or value q3 at the third active position in the first (and only) channel of the output tensor is equal to the dot product of the third active window 410 of the input tensor 402 and the filter 404, and will therefore be equal to p2*w(-1,0)+p3*w(0,0). Fig.16 It can be seen that the second output q2-2 of the second 1x1 convolution 1604 is equal to p2*w(-1,0); and the third output q3-5 of the fifth 1x1 convolution 1610 is equal to p3*w(0,0). Therefore, q3 can be generated by combining q2-2 and q3-5. This is summarized in Table 3.

[0166] Table 3

[0167]

[0168] The combination of appropriate partial outputs generated at block 1304 can be implemented in a variety of different ways. In some cases, the combination of appropriate partial outputs can be implemented by the NNA in the following ways: (i) performing matrix multiplication between each channel of each 1x1 convolution output tensor and the corresponding scattering matrix to group or compare the partial outputs associated with each output element; and (ii) combining the grouped or compared partial outputs via addition operations. As described above, the NNA typically includes hardware, such as a convolution processing unit (i.e., a convolution hardware accelerator), to accelerate convolution operations. Hardware that efficiently performs convolution operations can also efficiently perform matrix multiplication. Therefore, the NNA can use such hardware to efficiently perform matrix multiplication. The NNA may also include hardware that is configured to use another tensor (which may be referred to as an element-by-element operation processing unit) to accelerate the execution of per-element operations on the input tensor, such as but not limited to addition and multiplication. Such hardware is capable of performing addition operations efficiently (in terms of processing resources and time).

[0169] In these cases, the scattering matrix for each 1x1 convolution may identify elements in the output tensor of the 1x1 convolution that are associated with an element of the output tensor, and, if associated, which element of the output tensor it is associated with. The scattering matrix for the 1x1 convolution is configured so that when applied to a channel of the output tensor of the 1x1 convolution, the result is a matrix containing only the associated partial outputs and indicating which element of the output tensor each partial output is associated with. In some cases, the scattering matrix may include only ones and zeros. In some cases, the scattering matrix may be configured so that when the scattering matrix is ​​multiplied by a channel of the output tensor of the 1x1 convolution, the result is a matrix containing only the partial outputs that are associated with an element of the output tensor, and each associated partial output is in a row (or column) of the matrix corresponding to the corresponding element of the output tensor.

[0170] Among them, Fig.16As shown, each channel of the output tensor of the 1x1 convolution includes a row for each active position of the input tensor, and each row includes (multiple) partial outputs associated with the corresponding active position, and each scattering matrix may include a column for each active position of the input tensor and a row for each active position of the output tensor. Then, if the partial output in row A of the 1x1 convolution output tensor is associated with the active position B of the final output tensor, the scattering matrix may include a "1" in row B and column A. For example, if the partial output in the first row of the 1x1 convolution output tensor is associated with the second active element of the final output tensor, a "1" may be placed at position (2, 0) of the scattering matrix, where the positions in the scattering matrix are identified by (row, column), and the row and column numbering starts at 0. When the number of active positions in the input tensor is the same as the number of active positions in the output tensor (e.g., due to padding and stride of 1), each scattering matrix may be an NxN matrix, where N is the number of active positions in the input tensor. However, if the number of active positions in the tensor is greater than the number of active positions in the output tensor, each scattering matrix may be an MxN matrix, where M <N。

[0171] Reference Fig.17 , which shows that (i) Fig.16 Example scattering matrices 1702, 1704, 1706, 1708, 1710 of 1x1 convolutions to achieve Figure 4 and (ii) matrix multiplication 1712, 1714, 1716, 1718, 1720 of scattering matrices 1702, 1704, 1706, 1708, 1710 with corresponding 1x1 convolution outputs 1620, 1622, 1628, 1634, 1636. Figure 4 As shown, in this example sparse submanifold convolution, there are three active positions (p1, p2, p3) in the input tensor, and there are three active positions (q1, q2, p3) in the final output tensor, so each scattering matrix 1702, 1704, 1706, 1708, 1710 includes 3 rows and 3 columns. If the partial output in row A of the 1x1 convolution output is related to the active position B in the final output tensor, the scattering matrix includes "1" in row B and column A; otherwise, the scattering matrix includes "0" in row B and column A.

[0172] As described above with respect to Table 3, the first partial output (q1-1) of the first 1x1 convolution (i.e., the 1x1 convolution associated with the kernel position (-1, -1)) is associated with the second active element (q2) of the final output tensor. Therefore, the scattering matrix 1702 of the first 1x1 convolution has a "1" at position (1, 0) (i.e., second row, first column). The other partial outputs of the first 1x1 convolution are independent of the active elements of the final output tensor, so the remaining elements of the scattering matrix 1702 are set to "0". Multiplying this scattering matrix 1702 with the output of the first 1x1 convolution 1620 produces a matrix 1722 with the first partial output (q1-1) in the second row. All other elements of the output matrix 1722 are zero. This indicates that the first partial output is associated with the active position of the final output tensor, specifically, the second active position of the final output tensor.

[0173] Similarly, since the second partial output (q2-2) of the second 1x1 convolution (i.e., the 1x1 convolution associated with the kernel position (-1, 0)) is associated with the third active element (q3) of the final output tensor, the scattering matrix 1704 of the second 1x1 convolution has a "1" at position (2, 1) (i.e., the third row, second column). Multiplying this scattering matrix 1704 with the output of the second 1x1 convolution 1622 produces a matrix 1724 with the second partial output (q2-2) in the third row. All other elements of the output matrix 1724 are zero. This indicates that the second partial output is associated with the active position of the final output tensor, specifically, the third active position of the final output tensor.

[0174] Since the first, second, and third partial outputs of the fifth 1x1 convolution (i.e., the 1x1 convolution associated with kernel position (0, 0)) are associated with the first, second, and third active elements (q1, q2, q3) of the final output tensor, respectively, the scattering matrix 1706 of the fifth 1x1 convolution has "1" at positions (0, 0) (i.e., first row, first column), (1, 1) (i.e., second row, second column), and (2, 2) (i.e., third row, third column). Multiplying this scattering matrix 1706 with the output of the fifth 1x1 convolution 1628 produces a matrix 1726 having the first, second, and third partial outputs in the first, second, and third rows, respectively. This indicates that the first, second, and third partial outputs are associated with the active positions of the final output tensor, specifically, the first, second, and third active positions, respectively.

[0175] Since the third partial output (q3-8) of the eighth 1x1 convolution (i.e., the 1x1 convolution associated with kernel position (1, 0)) is associated with the second active element (q2) of the final output tensor, the scattering matrix 1708 of the eighth 1x1 convolution has a "1" at position (1, 2) (i.e., second row, third column). Multiplying this scattering matrix 1708 with the output of the eighth 1x1 convolution 1634 produces a matrix 1728 with the third partial output (q3-8) in the second row. All other elements of the output matrix 1728 are zero. This indicates that the third partial output is associated with the active position of the final output tensor, specifically, the second active position of the final output tensor.

[0176] Finally, since the second partial output (q2-9) of the ninth 1x1 convolution (i.e., the 1x1 convolution associated with kernel position (1, 1)) is associated with the first active element (q1) of the final output tensor, the scattering matrix 1710 of the ninth 1x1 convolution has a "1" at position (0, 1) (i.e., first row, second column). Multiplying this scattering matrix 1710 with the output of the ninth 1x1 convolution 1636 produces a matrix 1730 with the second partial output (q2-9) in the first row. All other elements of the output matrix 1730 are zero. This indicates that the second partial output is associated with the active position of the final output tensor, specifically, the first active position of the final output tensor.

[0177] In this example, the other 1x1 convolutions do not produce partial outputs related to the active positions of the final output tensor, so the scatter matrix for each of these 1x1 convolutions (not shown) is zero.

[0178] It can be seen that multiplying the scattering matrix and the 1x1 convolution output identifies the relevant partial outputs and groups the partial outputs associated with each output element together, i.e., th All partial elements associated with the output element are placed at the output i of the matrix multiplication th In line.

[0179] The scatter matrix can be generated offline (e.g., by a component external to the NNA, such as a CPU or GPU) and provided as input to the NNA. For example, the CPU or GPU can be configured to identify active locations from a dense format input tensor (e.g., using non-zero Function). The CPU or GPU can then be configured to generate a HashTable from the identified active positions and sparse submanifold convolution parameters (e.g., kernel size, stride, dilation), wherein the sparse submanifold convolution parameters store information indicating which active position of the input tensor needs to be multiplied by which kernel position or offset and which active position of the output tensor is associated with it. An exemplary HashMap is shown in Table 4 below. The exemplary HashMap is similar to that shown in Table 3. By using data structures well known in the literature, the HashMap can be efficiently generated on the GPU in a parallel manner.

[0180] Table 4

[0181] p1,w(-1,-1),q2 p2,w(-1,0),q3 p1,w(0,0),q1 p2,w(0,0),q2 p3,w(0,0),q3 p3,w(1,0),q2 p2,w(1,1),q1

[0182] In this example, once the matrix multiplication between the scatter matrix and the corresponding 1x1 convolution output has been completed, the partial outputs identified as being associated with each of the output elements are combined to generate the final output element. This can be achieved by one or more tensor addition operations. In a tensor addition operation, each element of the first tensor is added to the corresponding element of the second tensor. For example, Fig.18 As shown, the active elements (q1, q2, q3) of the output tensor 1802 are generated by matrices 1722, 1724, 1726, 1728, 1730 generated by matrix multiplications 1712, 1714, 1716, 1718, 1720, respectively.

[0183] exist Figures 14 to 18 In the example shown, the input tensor and the output tensor have only one channel. However, it will be apparent to those skilled in the art that the same techniques can be applied to sparse submanifold convolutions of input tensors and / or output tensors with multiple channels. For example, in the case where the input tensor has multiple channels (i.e., C in >1), instead of each 1x1 convolution simply computing the product of the input element x with the corresponding weight w, each 1x1 convolution computes the dot product of the input element and the corresponding weight at the same position in each channel. out >1), which means that the sparse submanifold convolution has multiple filters, then each 1x1 convolution will generate a channel for each filter. Then, in the matrix multiplication stage, each scattering matrix is ​​multiplied with each channel of the corresponding 1x1 convolution output to produce a 3D tensor, and then tensor addition is performed on a per-channel basis.

[0184] Reference Fig.19, which shows an example inference graph 1900 for performing a sparse submanifold 2D convolution with a filter of 256 3x3 kernels on an input tensor with 1000 active positions and 128 channels according to the above method (i.e., 1x1 convolution, matrix multiplication and addition), where the stride is 1 in the height and width dimensions. Therefore, the input tensor in sparse format is a [1, 128, 1, 1000] tensor of the form [batch, channels, height, width], i.e., for each active position of the input tensor, the input tensor in sparse format has an element for each channel.

[0185] Since the kernel is 3x3, there are nine kernel positions, so nine 1x1 convolutions are performed on the input tensor in sparse format, one convolution for each kernel position. Since there are 256 filters, each 1x1 convolution receives a [256, 128, 1, 1] weight tensor of the form [output channel, input channel, kernel height, kernel width]. In other words, the weight tensor includes 256 filters of size 128x1x1. Therefore, the output of each 1x1 convolution is a [1, 256, 1, 1000] tensor of partial outputs, that is, the output tensor of each 1x1 convolution has 256 channels and each channel has 1000 partial outputs.

[0186] A matrix multiplication is performed on the output of each 1x1 convolution, where the corresponding scattering matrix is ​​multiplied with each channel of the 1x1 convolution output. In this example, the number of active positions (1000) in the input tensor is the same as the number of active positions (1000) in the output tensor, so each scattering matrix is ​​a 1000x1000 matrix. Therefore, the result of each matrix multiplication operation is a [1, 256, 1, 1000] tensor that includes the partial output of the corresponding 1x1 convolution associated with the active output position.

[0187] The outputs of the matrix multiplication are then combined through a series of tensor addition or accumulation operations. Each addition or accumulation operation adds elements at corresponding positions. Fig.19 In the example shown, the first addition operation combines the first two matrix multiplication outputs, and then each additional addition operation combines the addition operation output with the matrix multiplication output. Therefore, the final output tensor in sparse format is a [1, 256, 1, 1000] tensor.

[0188] The efficiency of implementing operations on an NNA can be measured by the number of multiply-accumulate (MAC) operations to achieve the operation, where a MAC operation is an operation that computes the product of two numbers and adds the product to another number. The number of MACs to achieve sparse submanifold convolution in this manner (i.e., via 1x1 convolution, matrix multiplication, addition operations) can be expressed by equation (1), where K is the size of the kernel (i.e., K=K H ×K W), N is the number of active positions in the input tensor, C in is the number of channels in the input tensor, and C out is the number of channels in the output tensor (equal to the number of filters).

[0189] MACs = K × N × C in ×C out +K×N 2 ×C out (1)

[0190] In other cases, rather than combining the relevant partial outputs produced by the 1x1 convolution in block 1304 via matrix multiplication with a scatter matrix and an addition operation, where the NNA has a hardware component, such as a processor, that can selectively combine elements of one or more received tensors, the combining of the relevant partial outputs can then be performed by the hardware component. In these cases, the hardware component can be configured to receive the output of the 1x1 convolution and information identifying which partial outputs are associated with each active element of the final output tensor. The hardware component (e.g., a processor) can then be configured to retrieve the partial outputs associated with each output element and combine them (e.g., via an addition operation) to generate that output element.

[0191] For example, if Fig.16 1x1 convolution shown in is performed in block 1304, then information indicating that partial outputs q1-5 and q2-9 are associated with the first active output element q1; partial outputs q1-1, q2-5 and q3-8 are associated with the second active output element q2; and partial outputs q2-2 and q3-5 are associated with the third active output element q3 can be provided to the hardware component (e.g., processor) of the NNA. The hardware component can then retrieve or select the identified partial outputs and combine them in the identified manner. Similar to the way a scattering matrix can be generated offline (i.e., by an external component of the NNA), the information identifying which partial outputs are associated with each output element can be generated offline from, for example, a HashTable.

[0192] Reference Fig. 20 , which shows an example inference graph 2000 for performing a sparse submanifold 2D convolution with a filter of 256 3x3 kernels on an input tensor with 1000 active positions and 128 channels according to the second method described above (i.e., 1x1 convolution with scatter addition by the hardware component of the NNA), where the stride is 1 in the height and width dimensions. Therefore, the input tensor in sparse format is a [1, 128, 1, 1000] tensor of the form [batch, channels, height, width], i.e., for each active position of the input tensor, the input tensor in sparse format has an element for each channel.

[0193] like Fig.19 As shown in the inference diagram of , since the kernel is 3x3, there are nine kernel positions, so nine 1x1 convolutions are performed on the input tensor in sparse format, one convolution for each kernel position. Since there are 256 filters, each 1x1 convolution receives a [256, 128, 1, 1] weight tensor of the form [output channel, input channel, kernel height, kernel width]. In other words, the weight tensor includes 256 filters of size 128x1x1. Therefore, the output of each 1x1 convolution is a [1, 256, 1, 1000] tensor of partial outputs, that is, the output tensor of each 1x1 convolution has 256 channels and each channel has 1000 partial outputs.

[0194] However, instead of performing matrix multiplication and addition via a hardware accelerator of the NNA, the output of the 1x1 convolution is provided to a hardware component of the NNA, such as a processor, which can selectively combine elements of the 1x1 convolution output and identify information of the partial output associated with each active element of the output tensor.

[0195] The maximum number of MACs that implement sparse submanifold convolution in this way (i.e., via 1x1 convolution + scatter-add operation) can be expressed by equation (2), where K is the kernel size (i.e., K = K H ×K W ), N is the number of active positions in the input tensor, C in is the number of channels in the input tensor, and C out is the number of channels in the output tensor (equal to the number of filters). K×N×C in ×C out The MAC operation is used to perform 1x1 convolution, and K×N×C out The MAC operation is used to perform scatter-add.

[0196] MACs = K × N × C in ×C out +K×N×C out (2)

[0197] It will be apparent to those skilled in the art that references herein to rows and columns of tensors and matrices are exemplary only, and that rows and columns may be switched as desired. From equations (1) and (2), it can be seen that in some cases, performing a scatter-add operation may be more efficient than combining the relevant partial outputs via matrix multiplication and addition.

[0198] Although the above description Fig.13Block 1306 of method 1300 is implemented by an NNA, but in some cases it may be more efficient to perform all or part of the combination of the partial outputs generated by the 1x1 convolution on a GPU or CPU. For example, in some cases one or more of the matrix multiplications may be performed on a CPU or GPU, and / or one or more of the addition operations may be performed on a CPU or GPU. Similarly, in some cases one or more of the scatter addition operations may be performed on a CPU or GPU. Whether it is more efficient to implement all or part of block 1306 on a CPU or GPU may depend on the configuration of the NNA.

[0199] Test Results

[0200] Table 5 shows the results of implementing 3x3 sparse submanifold convolutions on an input tensor with 1000 active positions, and as a standard convolution on a 256x256 input tensor with 1.25% density (i.e., 1000 active positions) using the first NNA method described above (1x1 convolution, matrix multiplication, addition), the second NNA method described above (1x1 convolution, scattered addition via the NNA processor) when running on the applicant's PowerVR 3NX NNA at 800MHz and 20.48GB / s. In these tests, the MatMuls of the first NNA method was implemented on the CPU, so the time spent implementing MatMuls is not included in the timing numbers in Table 5; and the scattered addition operations performed by the processor of the NNA are not included in the timing numbers in Table 5.

[0201] Table 5

[0202] Inferences per second Delay(ms) NNA Method 1 430.0 2.32 NNA Method 2 637.7 1.56 Standard 2D convolution 74.9 13.35

[0203] The number of MACs to implement a standard 2D convolution is represented by Equation (3). This can be written in terms of N as shown in Equation (4), where denseRatio is as shown in Equation (5).

[0204] MACs = K × H out ×W out ×C in ×C out (3)

[0205]

[0206]

[0207] From Table 5, it can be seen that sparse submanifold convolutions can be implemented more efficiently using NNAs by any of the described methods exploiting the sparsity of the NNA input and hardware components than implementing them as standard convolutions on the NNA.

[0208] Table 6 shows the results of implementing a 3x3 sparse submanifold convolution on an input tensor with 1000 active positions, and as a standard convolution on a 256x256 input tensor with 1.25% density (i.e., 1000 active positions), using the second NNA approach described above (1x1 convolution, scatter-add via the NNA processor), when running on the applicant's PowerVR 4NX MC1 NNA at 1.5GHz and 38.4GB / s.

[0209] Table 6

[0210] Inferences per second Delay(ms) NNA Method 2 1261.58 0.79 Standard 2D convolution 140.39 7.12

[0211] Tables 5 and 6 show that sparse submanifold convolutions can be implemented significantly faster via NNA using the described method(s) (exploiting the sparsity of the input tensor) than implementing them as standard 2D convolutions via NNA (not exploiting the sparsity of the input tensor).

[0212] Combination of GPU and NNA implementation of sparse submanifold convolution

[0213] A combination of the above GPU and NNA implementations can be used to implement a sequence of sparse submanifold convolutions. Specifically, the first sparse submanifold convolution in the sequence can be implemented according to the above description of Figure 5 The GPU method described in is implemented without the final index folding operation (so that the output is only the active points in the output tensor, in other words, the output tensor is in sparse format). This unfolded output is then provided as input to the GPU method described above for Fig.13 The NNA method described in can be used to perform the next sparse submanifold convolution in the sequence. For each subsequent sparse submanifold convolution in the sequence, the NNA method can be used. Then, after performing the last sparse submanifold convolution in the sequence, an index expansion operation can be performed to generate the final output tensor in dense format.

[0214] A method for implementing a sequence of two sparse submanifold convolutions may include: receiving an input tensor in a dense format for a first sparse submanifold convolution of a sequence at a graphics processing unit; identifying an active position of the input tensor at the graphics processing unit; performing an index expansion operation on the input tensor based on the identified active position to generate an input matrix including elements of the input tensor in each active window of the input tensor; performing a matrix multiplication between a weight matrix and the input matrix at the graphics processing unit to generate an output matrix based on the active window, the output matrix including elements of the output tensor of the first sparse submanifold convolution; providing the output matrix as an input tensor in a sparse format for a second sparse submanifold convolution of the sequence to a neural network accelerator; performing a 1x1 convolution between the received input matrix and the filter weights of the sparse submanifold convolution at each position of a kernel of the second sparse submanifold convolution at the neural network accelerator to generate multiple partial outputs; and combining appropriate partial outputs of the multiple partial outputs to generate an output tensor of the second sparse submanifold convolution in a sparse format. When the GPU includes a convolution accelerator such that the GPU may be viewed as an NNA, or may be viewed as including an NNA, the steps of the above method identified as being performed by the NNA may be performed by the convolution accelerator of the GPU.

[0215] It has been described above how to implement sparse submanifold convolution on a GPU using index expansion and folding operations. The inventors have determined that similar index expansion and folding operations can be used to more efficiently implement standard convolution, standard deconvolution, and sparse submanifold deconvolution with sparse input on a GPU. Methods for implementing these convolutions and deconvolutions using similar index expansion and folding operations will now be described. Each of these methods is particularly suitable for taking into account the internal functions of a GPU. In particular, the described methods are designed to exploit the parallel architecture of a GPU (e.g., a SIMD architecture).

[0216] GPU implementation of standard convolution operation

[0217] As mentioned above, Figure 3 In a standard 2D convolution, each filter has dimension K H xK W xC in (That is, each filter may include a set of K H xK W xC in Weight w), where C in is the number of input tensor channels such that each filter generates an output channel. Each filter channel can be described as a H xK W Therefore, depending on the number of input channels, the filter may include one or more kernels. Each filter is separately H andW The convolution slides over the input tensor in both the H and W dimensions, which is called the stride of the convolution. Aside from the presence of an extra dimension, a 3D convolution is the same as a 2D convolution.

[0218] The inventors have determined that by using the same Figure 5 Similar index expansion and folding operations described in method 500 are used to more efficiently perform standard 2D and 3D convolutions with sparse inputs on the GPU to implement sparse submanifold convolutions on the GPU.

[0219] Reference Fig.21 , which shows an example method 2100 for implementing a standard convolution using a GPU. Method 2100 begins at block 2102, where an input tensor in dense format is received at a GPU. As described above, the input tensor in dense format, which may also be referred to as a densified input tensor, includes each element of the complete tensor, regardless of whether the element is in an active position. In contrast, the input tensor in sparse format only includes elements of the input tensor in dense format that are in an active position or position. Once the input tensor in dense format has been received, method 2100 proceeds to block 2104.

[0220] At block 2104, the GPU identifies an active location or position in the received input tensor. As described above, an active location of an input tensor is a height and width location or position where at least one channel of the input tensor has a non-zero value. Each active location or position can be identified by a set or pair of indices - a height or row index, and a width or column index. Any suitable technique may be used to identify an active location or position in the received input tensor, such as, but not limited to, the above-mentioned Figure 5 The technique of block 504 of method 500 .

[0221] In some cases, the output of this block 2104 may be a list of height and width (or column and row) coordinates or indices of the active positions. As described above, Figure 6 An active position list 608 of an example 6x6 input tensor 602 is shown with two active positions 604, 606. Specifically, Figure 6 As shown, the active position list 608 includes an entry for a first active position 604 whose position is identified as height (row) 1 and width (column) 1, and an entry for a second active position 606 whose position is identified as height (row) 3 and width (column) 3.

[0222] Once the active location or position in the received input tensor is identified, method 2100 proceeds to block 2106.

[0223] At block 2106, the GPU performs an index expansion operation (also referred to as a sparse convolution expansion operation) on the received input tensor based on the active position or location identified in block 2104 to generate an input matrix including elements of a non-zero window of the input tensor. A non-zero window is a window of the input tensor used in a standard convolution that includes at least one non-zero element. As described above with respect to Figure 7 As described, in a standard expansion operation (e.g., an im2col operation), the input matrix is ​​generated from an input tensor that contains one column for each window of the input tensor used in the standard convolution, where each column contains the elements of the input tensor in the corresponding window. As described above, each window of the input tensor generates an output element for each channel of the output tensor. Therefore, if there are P elements in each channel of the output tensor (meaning there are P windows of the input tensor), there will be P columns in the input matrix generated by the standard expansion operation.

[0224] However, in the case where the window includes all zeros (which may be referred to as a zero window), there is no need to calculate the output based on the window. Instead, zeros may be placed at corresponding output positions. Thus, only the output corresponding to the non-zero window may be calculated.

[0225] Therefore, the inventors have developed an index expansion operation for the standard convolution operation, in which an input matrix is ​​generated that includes only columns for each non-zero window of the input tensor, where the non-zero windows of the input tensor are identified from the active location or position identified in block 2104 and the convolution parameters (e.g., kernel size, stride, dilation, etc.). Specifically, the index expansion operation of the standard convolution operation uses the active location or position, and the convolution parameters (e.g., stride, dilation, kernel size) to identify the non-zero windows of the input tensor, and generates an input matrix with one column for each non-zero window, which contains the elements of the input tensor in the non-zero window. For example, if Figure 6 The input tensor 602 with only two active positions will be convolved with a filter with a 3x3 kernel with a stride of 1 so that there are twelve non-zero windows, as Fig. 22 As shown, the index expansion operation performed on the input tensor of the convolution produces an input matrix 2202 having twelve columns. The first column 2208 of the input matrix 2202 corresponds to the first non-zero window 2204 of the input tensor 602, and the last (or twelfth) column 2210 of the input matrix 2202 corresponds to the last non-zero window 2206 of the input tensor 602. It can be seen that Fig. 22 The input matrix 2202 does not include the Figure 7 The third, fourth, ninth and fourteenth columns of the input matrix 702 of , because each of these columns includes only zero values.

[0226] In contrast to the standard expansion operation, using the index expansion operation to implement the standard convolution can significantly reduce the size of the input matrix. This can significantly reduce the computation to implement the matrix multiplication of block 2108 (described below). In general, the sparser the input tensor, the smaller the input matrix generated by the index expansion operation, and the smaller the input matrix generated by the index expansion operation. Fig.21 The described method is more memory efficient.

[0227] The index expansion operation may be implemented on the GPU in any suitable manner. In one example, the GPU may be configured to determine, for each identified active position, which window or windows the active position forms part of based on the parameters of the convolution (kernel dimension, stride, dilation), and identify each such window as a non-zero window. Each non-zero window may be identified by a particular position in the window, such as, but not limited to, the first (e.g., upper left) element of the window, the middle element of the window, or the last (e.g., lower right) element of the window. For example, Fig.23 An input tensor 2302 is shown with four active positions numbered 1 to 4, which are inputs to a 3x3 convolution with a stride of 2 in the height and width dimensions. In this example, the GPU can perform an index expansion operation by determining, for each of the four active positions, which window or windows the active position falls into. For example, the GPU can determine that the first active position falls within only one window 2304; the GPU can determine that the second active position falls within two windows 2306, 2308; the GPU can determine that the third active position falls within four windows 2310, 2312, 2314, 2316; and the GPU can determine that the fourth active position falls within two windows 2318, 2320. The analysis of each active position can be performed by a separate thread, so that the active position analysis can be performed in parallel.

[0228] Once the non-zero windows have been identified, the elements forming each non-zero window are extracted from the input tensor and placed in a column of the input matrix. The elements forming each non-zero window may be extracted using any suitable technique. For example, the elements forming each non-zero window may be identified by indexing each non-zero window (e.g., from 0 to the number of non-zero windows), and for each non-zero window, multiple nested loops (one for each dimension of the window) are used to identify the elements in the non-zero window, one for each dimension. For example, where the window is a 2D window having a height dimension and a width dimension, there may be one loop for the height and another loop for the width that may be implemented. Specifically, for a 2D convolution with a 2D window, equal loops may be created for the height and width dimensions, respectively. The GPU can then be configured to loop from -offset to +offset from the non-zero window center. In the case where the window is a 3D window with a channel dimension, there may also be a loop looping through the channels. The element at each identified position is then copied to the appropriate location in the input matrix.

[0229] As mentioned above, each column in the input matrix corresponds to a non-zero window. The values ​​at the offset positions starting from the top left can be sorted from top to bottom. Fig.23 In the example shown, there are only 4 windows, and each window is active, so the input matrix will include columns for each window. It will be apparent to those skilled in the art that this is merely an example method of identifying an element of each non-zero window, and that the elements of each non-zero window may be identified in another manner. Specifically, it will be apparent to those skilled in the art that there are other methods of traversing / indexing each element in a window.

[0230] Reference Fig.24 , which shows another example of performing an index expansion operation on the input tensor of an example 2D convolution operation. In this example, the 2D convolution is a 3x3 convolution with a stride of 2 in the height and width dimensions with padding, respectively. The input tensor 2402 is a 17x21 matrix with eight active positions (identified by gray shading). The active positions are listed in Table 7.

[0231] Table 7

[0232]

[0233] As described above, in some examples, performing an index expansion operation to implement a standard convolution may include determining, for each active position (each element shown in gray) of the input tensor 2402, a window into which the active position falls. Fig.24 , the center of each 3x3 window of the input tensor used in the convolution is outlined in bold. Since the stride is greater than 1 in this example, each element of the input tensor 2402 is not the center of the window. For example, position (0, 0) of the input tensor is the center of the window of the input tensor for this example convolution, but position (0, 1) is not the center of the window of the input tensor for this example convolution. It will be apparent to those skilled in the art that this is merely an example technique for identifying windows. In other examples, each window may be identified by another element / position of the window. As described in more detail below, each window of the input tensor is mapped to (or used to generate) one element of each channel of the output tensor.

[0234] The window of the input tensor that the active position falls into can be determined based on the index of the active position and the convolution parameters (e.g., kernel size, stride, and padding). In general, the size of the kernel and stride determines the number of windows to which the active position belongs. For example, a 3x3 kernel with a stride of 2x2 has 2x2 different cases, as described in more detail below, in one case the active position will form part of only one window, in another case the active position will form part of two windows, in another case the active position will form part of two windows, and in another case the active position will form part of four windows. In contrast, a 3x3 kernel with a stride of 1x1 has only one case, and each active position will form part of nine different windows.

[0235] exist Fig.24 In the example shown, based on the convolution parameters (e.g., kernel size (3x3) and stride (2x2) and padding (1 row on top and bottom, 1 column on the right and left), any active position with an even index (e.g., both the horizontal index and the width index are even) will be the center of the window and will not belong to any other window. For example, active positions (2, 2) and (12, 20) belong to only one window, and these active positions are the windows at their centers. Specifically, active position (2, 2) falls within the window centered at (2, 2), and active position (12, 20) falls within the window centered at (12, 20). In contrast, an active position with at least one odd index will belong to at least two windows. Specifically, For each odd index, the active position will belong to two windows. The center positions of these windows can be determined by subtracting 1 from each odd index (or selecting the closest even index in one direction) and adding 1 to each odd index (or selecting the closest even index in the other direction). For example, the active position (13, 2) with one odd index belongs to the first window centered at (12, 2) and the second window centered at (14, 2). Similarly, the active position (9, 13) with two odd indices belongs to the first window centered at (8, 12), the second window centered at (8, 14), the third window centered at (10, 12), and the fourth window centered at (10, 14). Fig.24 The active windows into which each position of the active positions of the input tensor 2402 falls are shown in Table 7. Fig.24 Each of the windows identified by “x” in the input tensor 2402 includes at least one active position and is therefore a non-zero window.

[0236] Once the non-zero windows have been identified, the elements forming each non-zero window are extracted from the input tensor 2402 and placed in a column of the input matrix 2404. As described above, Fig.24In the example shown, the center of each non-zero window is identified by an "x". Thus, for each "x" shown in the input tensor 2402, the elements forming a 3x3 window centered at that location are extracted. For example, for an "x" at (0, 18), the elements forming a 3x3 window 2406 centered at (0, 18) are extracted from the input tensor 2402 and placed in the first column 2408 of the input matrix 2404. Since there are fifteen non-zero windows in this example, there are fifteen columns of the input matrix 2404.

[0237] In some cases, in addition to receiving input tensors and active positions in dense format, the index expansion operation can also receive a zero input matrix with a desired shape (e.g., height = number of elements x channels per kernel, width = number of non-zero windows), and the GPU can be configured to write the non-zero window elements to the appropriate locations in the input matrix.

[0238] Once the GPU has performed an index expansion operation on the input tensor to generate an input matrix having an element for each non-zero window of the input tensor, method 2100 proceeds to block 2108.

[0239] At block 2108, the GPU performs a matrix multiplication operation (which may be referred to as a MatMul operation) between the weight matrix and the input matrix generated in block 2106 to generate an output matrix. Fig.25 An example weight matrix 2502 is shown with Fig.24 An example matrix multiplication between the input matrices 2404 of . The weight matrix may include a row for each filter and a column for each weight in the filter. Fig.25 In the example shown, there is only one filter with a 3x3 kernel and one channel (thus nine weights per filter). Therefore, the weight matrix 2502 includes one row and nine columns. Each column corresponds to a position in the filter, and the weights of the filter are placed in the column according to its position in the filter. Fig.25 In the example shown, the weights of the filter are spread out from left to right and top to bottom so that the weight in the upper left corner of the kernel is placed in the first column, the weight in the center of the filter is placed in the fifth column, and the weight in the lower right corner of the kernel is placed in the last or ninth column. It will be apparent to those skilled in the art that this is merely an example, and the weights can be placed in any order in the weight matrix, as long as their order corresponds to the order of the elements of each non-zero window in the input matrix. Specifically, if the element at position (-1, -1) of the non-zero window is placed in input matrix row 0, the weight at position (-1, -1) of the filter should be placed in weight matrix column 0.

[0240] The matrix multiplication between the weight matrix 2502 and the input matrix 2404 generates an output matrix 2504 that includes an output element for each channel of the output for each non-zero window (i.e., for each filter). The output matrix 2504 may have a column for each non-zero window and a row for each output channel, such that each column includes an output element for the corresponding non-zero window for each output channel. Fig.25 In the example shown, there are fifteen non-zero windows and one output channel, so the example output matrix 2504 has fifteen columns and one row. Matrix multiplication can be parallelized on a GPU, for example, by processing each column of the input matrix in a separate thread.

[0241] Once the GPU has performed the matrix multiplication, the method 2100 can end, or the method 2100 can proceed to block 2110. Specifically, the output matrix 2504 generated in block 2108 includes all non-zero elements of the output tensor (in other words, the output matrix corresponds to the output tensor in sparse format), so the output matrix 2504 can be simply output, or the output tensor in dense format can be generated from the output matrix 2504 first.

[0242] At block 2110, the GPU performs an index folding operation on the output matrix generated in block 2108 to generate an output tensor in dense format. The index folding operation is the opposite of the index unfolding operation performed in block 2106. Specifically, each non-zero window can be mapped to a 2D position in the output tensor in dense format, and the index folding operation uses this information to generate an output tensor in dense format (e.g., a densified output tensor) from the output matrix generated in block 2108. In other words, the index folding operation generates an output tensor in which each element of the output matrix is ​​in the correct position and is zero elsewhere.

[0243] As described above, a standard folding operation (e.g., a col2im operation) receives an output matrix in a dense format, i.e., an output matrix comprising a row for each output channel, each output channel having an output element for each element of that channel, and transforms each row of the received matrix into a plane of the output tensor according to the size of the channels of the output tensor.

[0244] Compared to the standard folding operation, the index folding operation receives an output matrix in a sparse format, i.e., the received matrix does not necessarily include the value or element of each element of the output tensor. The index folding operation also receives information indicating the output position corresponding to each non-zero window. The information indicating the output position corresponding to each non-zero window can be the coordinates of the active position in the input tensor determined in block 2104; the position of the non-zero window identified in block 2106 to perform the index expansion operation; or the coordinates of the position corresponding to each non-zero window in the output tensor (which can be determined as part of the index expansion operation in block 2106). The elements of the sparse output matrix are then placed at the correct position of the output tensor in a dense format using the position corresponding to each non-zero window in the output tensor. The elements at all other positions of the output tensor can then be set to zero.

[0245] If the coordinates of the position of the output tensor corresponding to each non-zero window are not explicitly provided, they can be determined based on the information provided. For example, as described above, the non-zero windows can be identified from the active positions of the input tensor and the convolution parameters (e.g., stride, kernel size, etc.). Each non-zero window can then be mapped to a 2D position in the output tensor based on the convolution parameters. For example, Fig.26 As shown, each window of the input tensor 2402 is mapped to a position in the final output tensor 2602. In this example, since there is a row and column of padding in each dimension, the kernel size is 3x3, and the stride is 2, the position in the output tensor corresponding to a particular window can be determined by dividing the index of the non-zero window center by the stride (i.e., 2 in this case). For example, a window centered at position (2, 2) of the input tensor 2402 is mapped to position (1, 1) of the output tensor. Therefore, each element of the output matrix can be mapped to position (y, x) by mapping each element of the output matrix to position (y, x). Fig.25 The index folding operation is performed on the output matrix 2504 of , where y = the y position of the center of the corresponding window / 2, and x = the x position of the center of the corresponding window / 2. Table 7 shows the mapping between each window in the non-zero window and the position in the output tensor 2602, and Fig.26 shows the pairing of output positions according to those windows from Fig.25 The dense format final output tensor 2602 is generated by the output matrix 2504 of . Although it has been described that the non-zero window is identified based on the position of its center element, it will be apparent to those skilled in the art that this is merely an example and other positions in the window (e.g., the first position or the last position) can be used to (i) identify the window; and (ii) identify the corresponding position in the output tensor.

[0246] The index folding operation can be implemented on the GPU by creating an index for each non-zero window (e.g., from 0 to n in the case where there are n+1 non-zero windows). For each non-zero window, the GPU can then be configured to determine the associated position in the output tensor from a certain position in the window (e.g., the center of the window) and the convolution parameters, and then loop through each output channel and place or copy the appropriate elements of the output matrix in the determined position in the corresponding channel of the output tensor. Each non-zero window can get its own thread so that the index folding operation can be performed in parallel on the GPU.

[0247] In some cases, the index folding operation may receive a zero output tensor of appropriate dimensions and may write elements of the received matrix to the received output tensor in addition to receiving information indicating the location of the final output tensor corresponding to each non-zero window, the convolution parameters, and the output matrix generated in block 2108. In this case, zeros may not be explicitly added to the locations of the output tensor that do not contain elements of the output matrix.

[0248] Once the index folding operation has been performed, method 2100 may end.

[0249] Test Results

[0250] Tables 8, 9 and 10 show the average time or duration (in milliseconds) of implementing 2D convolution on a GPU for 2D input tensors of size 128x128, 1000x1000 and 10000x10000 using different methods and different sparsity levels, respectively. The method comprises: (1) Fig.21 The methods described are referred to as the “index unfold / fold” method; (2) the PyTorch Conv2D method; (3) the PyTorch Un / Fold method; and (4) the UnFoldNd method.

[0251] Table 8

[0252]

[0253]

[0254] Table 9

[0255]

[0256] Table 10

[0257]

[0258] UnFoldNd, PyTorch Conv2D, and PyTorch Un / Fold methods are known 2D convolution methods that do not consider sparsity. Therefore, the time to implement a 2D convolution operation using these methods does not differ due to sparsity, because each method performs the same operation regardless of sparsity (i.e., performs a full 2D convolution). As can be seen from Tables 8 to 10, when the input is large enough and the sparsity is high enough (e.g., 80% or higher), this paper Fig.21 The described method for implementing standard 2D convolution consistently outperforms these known 2D convolution methods.

[0259] Reference now Fig. 27 , which shows a graph of the average duration (in milliseconds) of implementing an example 2D convolution on a GPU or CPU for: (i) different sizes of 2D input tensors (MNIST); (ii) different methods (FoldNd, PyTorch Conv2D, PyTorch Fold, and the one proposed in this paper) Fig.21 The method described above is referred to as the "index expansion / collapse" method); and (iii) with different levels of sparsity. Table 11 summarizes Fig. 27 2D convolution implementations shown with different combinations of input tensor sparsity.

[0260] Table 11

[0261]

[0262]

[0263] from Fig. 27 It can be seen that when the input data is highly sparse (the sparsity is at least 80% when implemented on the GPU and at least 90% when implemented on the CPU), the above Figure 21 to Figure 26 The method described here outperforms known methods for implementing 2D convolution. Thus, when the method is executed on a GPU and a CPU, it has a significant speedup for highly sparse input data. Fig.21 The method 2100 may also be executed on a CPU.

[0264] GPU implementation of standard deconvolution operation

[0265] Deconvolution is also called convolution transpose or fractional stride convolution, which is the opposite of convolution. Specifically, convolution can usually be represented as the input vector A V The matrix multiplication between A and the sparse matrix C is shown in Equation (6), where the non-zero elements of the sparse matrix C are the weights w of the filter W. The input vector A Vis the elements of the input tensor expanded from left to right and top to bottom (and front to back if 3D). For example, Fig.28 As shown, the input vector A of the 5x 5 input tensor A2804 V 2802 is a flattened 25-element vector. Similarly, the output vector B V are the elements of the expanded output tensor B. For example, Fig.28 As shown, the output vector B of the 2x 2 output tensor B2808 is V 2806 is a flattened 4-element vector. Fig.28 An example sparse matrix C2810 of an example filter 2812 is also shown.

[0266] B V =C×A V (6)

[0267] In contrast, in deconvolution, the corresponding direct convolution sparse matrix C is transposed to generate the transposed sparse matrix C T , and in the input vector A V with the transposed sparse matrix C T , performs matrix multiplication between them and processes the input tensor A, as shown in equation (7).

[0268] B V =C T ×A V (7)

[0269] As known to those skilled in the art, a matrix is ​​transposed by converting its rows to columns and vice versa. For example, Fig.29 Shows Fig.28 The transposed sparse matrix C2810 of T 2902. It can be seen that Fig.28 The first row of the sparse matrix C 2810 has become Fig.29 The transposed sparse matrix C T The first column of 2902, Fig.28 The second row of the sparse matrix C2810 has become Fig. 9 The transposed sparse matrix C T The second column of 2902, and so on. Fig.29 The deconvolution output vector B is also shown V 2904 and input vector A V 2906.

[0270] Where convolution may produce an output tensor B that is smaller in height and / or width dimensions relative to the input tensor A, deconvolution may produce an output tensor B that is larger in height and / or width dimensions relative to the input tensor A. For example, Fig.30As shown, the deconvolution between the 2x2 input tensor A 3002 and the 3x3 filter W 3004, with a stride of 2 in the height and width dimensions, produces a 5x5 output tensor B 3006. Therefore, deconvolution can be used in a neural network to perform upsampling. However, deconvolution can also or alternatively be used in a neural network to perform image segmentation, image super-resolution and / or object detection. Deconvolution can also be used to train a neural network. Specifically, during training, forward propagation and backpropagation of the neural network can be implemented. In the forward propagation of the neural network, data is processed according to the layers of the DNN. For example, if the neural network includes a convolution layer followed by a pooling layer, the input data of the neural network is processed according to the convolution layer, and the output of the convolution layer is processed according to the pooling layer. In the backpropagation of the neural network, the data is backpropagated through the neural network so that the reverse operation performed during the forward propagation process is performed on the data. Therefore, deconvolution can be used in the backpropagation of the neural network to implement the reverse operation of the convolution operation during the forward propagation process.

[0271] As described in the applicant's GB patent No. 2582352, which is incorporated herein by reference in its entirety, deconvolution can be achieved by performing multiple direct or standard convolutions to deconvolutions on the input tensor and interleaving the outputs of the direct convolutions to generate the outputs of the deconvolutions. Specifically, each filter of the deconvolution is divided into multiple sub-filters; a convolution operation is performed between each sub-filter and the input tensor to generate a sub-output tensor; and the elements of the sub-output tensors are interleaved to generate the final output channels.

[0272] For example, Fig.31 shows that a 5-element input tensor A = [a1 a2 a3 a4 a5]3102 produces a 10-element output tensor B = [b1 b2 b3 b4 b5 b6 b7 b8 b9 b 10 ]3104 is a deconvolution between the 3 weight filters W = [w1 w2 w3] of FIG. 3104. As described above, the deconvolution can be represented as the input vector A and the transposed sparse matrix C T 3106. Fig.32 As shown, deconvolution is equivalent to padding the input tensor A with zeros between each element, so that the input elements are separated by strides in the height and width dimensions and on one or more edges, and replacing the padded input tensor A with P With the reflection version of the filter W R Perform convolution.

[0273] from Fig.31 and Fig.32 It can be seen that each even output element is equal to the i-th th and (i+1)th thThe dot product of the input elements with the third and first filter weights w3 and w1, where i = n / 2 and n is the number of output elements. Therefore, it can be done by adding the first sub-filter W to the input tensor A. s1 = [w3 w1] to generate even output elements. Similarly, each odd output element is equal to the i-th th Input element a i The product of the second filter weight w2, where i = (n + 1) / 2, and n is the number of output elements. Therefore, it can be obtained by multiplying the input tensor A with the second sub-filter W s2 = [0 w2] to generate odd output elements. The final output tensor B of the deconvolution can then be generated by interleaving the outputs of the first and second convolutions, as Fig.33 Specifically, the final output tensor B of the deconvolution can be generated by alternating between the outputs of the first and second direct convolutions.

[0274] In general, the number of sub-filters (per filter) that implement a particular deconvolution is based on the stride of the deconvolution. In particular, there will be stride_h*stride_w*stride_p sub-filters per filter, where stride_h is the stride in the height dimension, stride_w is the stride in the width dimension, and stride_p is the stride in the p or channel dimension. For example, if the filter W is one-dimensional (1D) in the width dimension, there will be stride_w sub-filters. In particular, in the case of deconvolution using a 1D filter and stride_w=4, there will be 4 sub-filters. If the filter W is two-dimensional (2D) and the filter is moved in the width and height dimensions relative to the input tensor A, there will be stride_w*stride_h sub-filters. If the filter W is three-dimensional (3D), the number of sub-filters may depend on the number of directions or dimensions in which the filter is moved relative to the input tensor. For example, in 2D deconvolution, the 3D filters are only moved in the width and height dimensions (or x and y dimensions) relative to the 3D input tensor, so each filter will only have stride_w*stride_h sub-filters. In contrast, in 3D convolution, the 3D filters are moved in the height, width, and p dimensions relative to the 3D input tensor, so each filter will have stride_h*stride_w*stride_p sub-filters.

[0275] Typically, the dimension of each sub-filter kernel will be w_sub_filter_max*h_sub_filter_max, where and

[0276] In some cases, the sub-filters of filter W can be generated by forming a stride_w*stride_h*stride_p basis block of filter weights from the starting point of filter W. The starting point of the filter is the filter weight that is aligned with a specific input element to generate an output element for that input element. The starting point of the filter is usually the first filter weight, the last filter weight, or the center filter weight, but it can be any filter weight. Once the basis block is formed, start with one of the filter weights in the basis block and generate a reflected version of the filter, forming each sub-filter from the filter weights in increments of stride.

[0277] For example, Fig.34 As shown, deconvolution with a 3x3 filter 3402, and a stride of 2 in the width and height dimensions, produces four 2x2 sub-filters 3404, 3406, 3408 and 3410.

[0278] A direct convolution with stride 1 is then performed between the input tensor and each sub-filter. Therefore, each sub-filter generates a sub-output tensor. The elements of the sub-output tensors corresponding to the same filter are then interleaved to generate the channels of the output tensor. In general, the output elements of the sub-output tensors are interleaved in sub-filter order according to the stride in each direction. Specifically, if the stride of the deconvolution in the width dimension is greater than 1 (i.e., stride_w>1), each row of the output tensor channel is generated by selecting elements from the stride_w sub-output tensors in a cyclic manner. If the stride of the deconvolution in the height dimension is greater than 1 (i.e., stride_h>1), each stride_h sub-output tensor is generated by selecting elements from the same stride_w sub-output tensor. th For example, if the deconvolution generates an output tensor with 4x4 channels with stride_w=2 and stride_h=2, it will have four sub-filters, numbered 1 to 4. The first and third rows of channels of the output tensor 3502 are generated by alternating between the elements of the 1st and 2nd sub-output tensors, while the second and fourth rows are generated by alternating between the elements of the 3rd and 4th sub-output tensors, as shown in Fig.35 shown.

[0279] The inventors have determined that by using the same Figure 5 Similar index expansion and folding operations described in method 500 to implement sparse submanifold convolution on a GPU can efficiently perform standard 2D and 3D deconvolution with sparse input on a GPU.

[0280] Reference now Fig.36, which shows an example method 3600 for implementing standard deconvolution on a GPU. Method 3600 begins at block 3602, where an input tensor in dense format is received at the GPU. As described above, the input tensor in dense format, which may also be referred to as a densified input tensor, includes each element of the complete tensor, regardless of whether the element is in an active position. In contrast, the input tensor in sparse format only includes the elements of the input tensor in dense format that are in an active position. Once the input tensor in dense format has been received, method 3600 proceeds to block 3604.

[0281] At block 3604, the GPU identifies active locations in the received input tensor. As described above, an active location in the input tensor is a height and width location where at least one channel of the input tensor has a non-zero value or element. Each active location or position can be identified by a set or pair of indices - a height or row index, and a width or column index. Any suitable technique may be used to identify the active location or position in the received input tensor, such as, but not limited to, the above-mentioned Figure 5 The technique of block 504 of method 500 .

[0282] In some cases, the output of this block 3604 may be a list of height and width (or column and row) coordinates or indices of the active positions. As described above, Figure 6 An active position list 608 of an example 6x6 input tensor 602 is shown with two active positions 604, 606. Specifically, Figure 6 As shown, the active position list 608 includes an entry for a first active position 604 whose position is identified as height (row) 1 and width (column) 1, and an entry for a second active position 606 whose position is identified as height (row) 3 and width (column) 3.

[0283] Once the active location in the received input tensor has been identified, method 3600 proceeds to block 3606.

[0284] At block 3606, the GPU performs an index expansion operation (which may also be referred to as a sparse deconvolution expansion operation) on the received input tensor based on the active position identified in block 3604 to generate an input matrix including elements of non-zero subwindows of the input tensor. As described above, deconvolution can be achieved by performing a direct convolution between the input tensor and each of a plurality of subfilters and interleaving the results of the direct convolution. A non-zero subwindow is a window of the input tensor used in a direct convolution having at least one non-zero element. The size of the subwindow of the deconvolution is based on the size of the subfilter. As described above, the size of the subfilter is based on the size and stride of the deconvolution filter. Specifically, as described above, the size of the subfilter for 2D deconvolution will be w sub_filter_max ×h sub_filter_max ×Cin ,in and For example, as mentioned above about Fig.34 As mentioned above, a 3x3 2D deconvolution with a stride of two in the width and height dimensions has four 2x2 sub-filters (per filter). Therefore, in this example, each sub-window of the input tensor is a 2x2 window.

[0285] Performing an index expansion operation may include: identifying non-zero subwindows of the input tensor from the active positions of the input tensor identified in block 3604 and deconvolution parameters (e.g., stride, dilation, kernel size); and for each non-zero subwindow, extracting elements of the non-zero subwindow from the input tensor and placing them in an input matrix. In some cases, the input matrix includes a column for each non-zero subwindow and a row for each position in the subwindow, and all elements forming a non-zero subwindow are placed in the same column. In some cases, the elements in the subwindow are expanded from left to right and from top to bottom, so that the element in the upper left corner of the subwindow is placed in the first row, and the element in the lower right corner of the subwindow is placed in the last row. However, it will be apparent to those skilled in the art that this is merely an example.

[0286] The index expansion operation can be implemented on the GPU in any suitable manner. In one example, the GPU can be configured to determine, for each identified active position of the input tensor, which sub-window(s) of the input tensor the active position constitutes according to the parameters of the deconvolution (kernel dimension, stride, dilation), and identify each such sub-window as a non-zero sub-window. Each non-zero sub-window can be identified by a specific position in the window, including but not limited to the first (e.g., upper left) element of the sub-window, the middle element of the sub-window, or the last (e.g., lower right) element of the sub-window.

[0287] For example, Fig.37 An exemplary padded input tensor 3702 for a 3x3 deconvolution with a stride of 2 is shown. The input tensor 3702 has four active positions (shown in gray shading) and are listed in Table 12. In this example, each 3x3 filter will be split into four 2x2 sub-filters, as Fig.24 As shown, each subwindow will be a 2x2 window, and the subwindows will be separated by one element. Therefore, in this example, each active position will belong to four 2x2 subwindows. The lower right position of each of the four subwindows can be determined by the H, W position of the active position as follows: Subwindow 1: (H, W), Subwindow 2: (H, W+1), Subwindow 3: (H+1, W), Subwindow 4: (H+1, W+1). For example, the active position (1,1) belongs to the four subwindows with the last element (1,1), (1,2), (2,1) and (2,2). Fig.37The subwindow to which each active position of the input tensor belongs is shown in Table 12. Each identified subwindow includes at least one active position, so each of these subwindows is a non-zero subwindow. The lower right position of each non-zero subwindow is Fig.37 It is marked as 'x'.

[0288] Table 12

[0289]

[0290]

[0291]

[0292] Once the non-zero subwindows have been identified, the elements forming each unique non-zero subwindow can be extracted from the input tensor and placed in the input matrix. It should be noted that more than one active position can belong to the same non-zero subwindow, but the elements of the subwindow only need to be placed in the input matrix once. This can be achieved by indexing each unique non-zero subwindow (e.g., from 0 to the number of unique non-zero subwindows), and for each non-zero subwindow, using one or more nested loops to identify the elements in the non-zero subwindow. There can be one loop for each dimension of the subwindow. For example, if the subwindow is a 2D window with height and width dimensions, there can be a height loop and a width loop. Specifically, when the deconvolution is a 2D deconvolution and the subwindow is 2D, an offset can be created for the height and width dimensions, which is equal to Where k is the size of the subkernel in that dimension, then the height loop can be configured to loop from Y-offset_y to Y, and the width loop can be configured to loop from X-offset_x to X, where Y, X are the lower right corners of the subwindow. If the subwindow is 3D and has more than one channel, then the channel loop can be configured to loop through the channels. The element at each identified position is then copied to the appropriate location in the input matrix.

[0293] For example, as mentioned above, the lower right corner of each non-zero subwindow is Fig.37, identified as 'x' in the input tensor 3702. Therefore, for each 'x' identified in the input tensor 3702, the elements forming a 2x2 window (the lower right corner of the window is the 'x' position) are extracted and placed in the columns of the input matrix 3704. For example, for the first 'x' at (1,1), the elements forming a 2x2 sub-window 3706 with a lower right corner at (1,1) are extracted from the input tensor 3702 and placed in the first column 3708 of the input matrix 3704. In this example, the elements in the sub-window are expanded from left to right and from top to bottom, so that the element in the upper left corner of the sub-window is placed in the first row and the element in the lower right corner of the sub-window is placed in the last row or fourth row. However, it will be apparent to those skilled in the art that this is only an example. Since in this example, there are sixteen non-zero sub-windows (4 for each active position of the input tensor 3702), the input matrix 3704 includes sixteen columns.

[0294] In some cases, in addition to receiving an input tensor, an active position, and one or more deconvolution parameters in a dense format, an index expansion operation may also receive an input matrix of zeros having a desired shape (e.g., height = elements per subkernel x number of channels of the input tensor, width = number of non-zero subwindows), and the GPU may be configured to write the non-zero subwindow elements to the appropriate locations in the input matrix.

[0295] Once the GPU has performed an index expansion operation on the input tensor to generate an input matrix having an element for each unique non-zero subwindow of the input tensor, method 3600 proceeds to block 3608.

[0296] At block 3608, the GPU performs a matrix multiplication operation (which may be referred to as a MatMul operation) between the weight matrix and the input matrix generated in block 3606 to generate an output matrix.

[0297] Fig.38 Shows Fig.37 An example matrix multiplication between the exemplary weight matrix 3802 and the input matrix 3704. The weight matrix may include a row for each sub-filter and a column for each weight in the sub-filter. Figure 37 to Figure 39 In the example shown, there are four 2x2 sub-filters (and therefore 4 weights per sub-filter). Therefore, the weight matrix 3802 includes four rows and four columns. Each column corresponds to a position in a sub-filter, and the weights of the sub-filters are placed in the column according to their position in the sub-filter. Fig.38In the example shown, the weights in the subfilters are expanded from left to right and from top to bottom, so that the weights in the upper left corner of the subfilter are placed in the first column, and the weights in the lower right corner of the subfilter are placed in the last column. It will be apparent to those skilled in the art that this is only an example, and the weights may be placed in any order in the weight matrix as long as the order of the weights corresponds to the order of the elements of each subwindow in the input matrix. Specifically, if the element at position (-1, -1) of the subwindow is placed in row 0 of the input matrix, the weight at position (-1, -1) of the subfilter will be placed in column 0 of the weight matrix.

[0298] The matrix multiplication between the weight matrix 3802 and the input matrix 3704 generates an output matrix 3804 that includes an output element for each sub-filter for each non-zero sub-window. The output matrix 3804 may have a column for each non-zero sub-window and a row for each sub-filter, such that each column includes an output element for the corresponding non-zero sub-window of each sub-filter. Fig.38 In the example shown, there are sixteen non-zero sub-windows, four sub-filters (per filter), and one output channel (i.e., one filter), so the example output matrix 3804 has fifteen columns and four rows. Matrix multiplication can be parallelized on the GPU, for example, by processing each column of the input matrix in a separate thread.

[0299] Once the GPU has performed the matrix multiplication, method 3600 can end, or method 3600 can proceed to block 3610. Specifically, the output matrix 3804 generated in block 3608 includes all non-zero elements of the output tensor, so the output matrix 3804 can be simply output, or the output tensor in dense format can be generated from the output matrix 3804 first.

[0300] At block 3610, the GPU performs an index folding operation on the output matrix generated in block 3608 to generate an output tensor in dense format. The index folding operation is the opposite of the index unfolding operation. Specifically, each non-zero sub-window can be mapped to multiple locations of the output tensor (one for each sub-filter of the filter), and the index folding operation uses this information to generate an output tensor in dense format (e.g., a densified output tensor) from the output matrix generated in block 3608. In other words, the index folding operation uses this information to generate an output tensor in which each element in the output matrix is ​​in the correct position and is zero elsewhere.

[0301] As described above, a standard folding operation (e.g., a col2im operation) receives an output matrix in a dense format, i.e., an output matrix comprising a row for each output channel, each output channel having an output element for each element of that channel, and transforms each row of the received matrix into a plane of the output tensor according to the size of the channels of the output tensor.

[0302] Compared to the standard folding operation, the index folding operation receives the output matrix in a sparse format, that is, the received matrix does not include the value or element of each element of the output tensor. The index folding operation also receives information indicating multiple positions of the output tensor associated with each non-zero sub-window. This information may include information identifying the active position in the input tensor (from which the position of the output tensor associated with each non-zero sub-window can be determined), information identifying the non-zero sub-window (from which the position of the output tensor associated with each non-zero sub-window can be determined), or information that explicitly identifies the position coordinates of the output tensor associated with each non-zero window (for example, it can be determined as part of block 3606). The received information is then used to place the elements of the sparse output matrix in the correct position of the output tensor in a dense format. The elements at all other positions can then be set to zero.

[0303] For example, as described above, non-zero subwindows can be identified from the active position and deconvolution parameters (e.g., stride, kernel size, etc.). Each non-zero subwindow can then be mapped to multiple positions in the output tensor, one position per subfilter. Fig.39 As shown, each sub-window of the input tensor 3702 is mapped to a 2x2 block of positions (i.e., one position per sub-filter) in the output tensor 3904. The upper left position in the 2x2 block corresponds to sub-filter 1, the upper right position in the 2x2 block corresponds to sub-filter 2, the lower left position in the 2x2 block corresponds to sub-filter 3, and the lower right position in the 2x2 block corresponds to sub-filter 4. Each sub-window can be mapped to a corresponding 2x2 block in the output tensor based on the position of the sub-window in the input tensor and the deconvolution parameters. Fig.39 In the example shown, the subwindow with the lower right position Y,X is mapped to the 2x2 block of the output, where the upper left corner of the 2x2 block in the output is at (stride * Y, stride * X), the top right corner of the 2x2 block in the output is at (stride * Y, stride * X+1), the lower left corner of the 2x2 block in the output is at (stride * Y+1, stride * X), and the lower right corner of the 2x2 block in the output is at (stride * Y+1, stride *X+1). For example, with a stride of 2, the subwindow with the bottom-right position (1,1) is mapped to a 2x2 block of the output tensor consisting of positions (2,2), (2,3), (3,2), and (3,3).

[0304] Table 12 shows the mapping between each non-zero sub-window in the output tensor and the corresponding 2x2 block, and Fig.39 Shows the subwindow output position mapping from Fig.38 The dense format final output tensor 3904 generated by the output matrix 3804 of . Although it has been described that the subwindow is identified by the lower right (or last) position of the subwindow, it is obvious to those skilled in the art that this is only an example, and other positions in the subwindow (e.g., the first position or the middle position) can be used to (i) identify the subwindow; and (ii) identify the corresponding position in the output tensor. This mapping between non-zero subwindows and positions in the output tensor can be performed as part of block 3606 or as part of block 3610.

[0305] The index folding operation can be implemented on the GPU by creating an index for each non-zero subwindow (e.g., from 0 to n in the case where there are n+1 non-zero subwindows). For each non-zero subwindow, the GPU can then be configured to determine the associated position in the output tensor from a certain position in the subwindow (e.g., the lower right corner of the subwindow) and the deconvolution parameters, and then loop through each subfilter and place or copy the element in the output matrix corresponding to the subfilter in the determined position of the output tensor. Each non-zero subwindow can get its own thread so that the index folding operation can be performed in parallel on the GPU.

[0306] In some cases, the index folding operation may receive a zero output tensor of appropriate dimensions, and may write elements of the received matrix to the received output tensor, in addition to receiving information indicating the location of the output tensor associated with each non-zero sub-window, the deconvolution parameters, and the output matrix generated in block 3608. In this case, there is no need to explicitly place zeros at locations of the output tensor that are not associated with non-zero sub-windows.

[0307] Once the index folding operation has been performed, method 3600 can end.

[0308] GPU implementation of sparse submanifold deconvolution

[0309] Sparse submanifold deconvolution is similar to sparse submanifold convolution in that not all elements of the output tensor are generated. However, if the output generated for sparse submanifold convolution is driven by the active positions in the input tensor, the output generated for sparse submanifold deconvolution is driven by the desired active positions in the output tensor, which can be referred to as scattering positions or target positions.

[0310] The inventors have determined that by using the same Figure 5 Similar index expansion and folding operations described in method 500 to implement sparse submanifold convolution on a GPU can efficiently perform sparse submanifold 2D and 3D deconvolution on a GPU.

[0311] Reference now Fig.40 , which shows an example method 4000 for implementing sparse submanifold deconvolution on a GPU. Method 4000 begins at block 4002, where an input tensor in dense format is received at the GPU. As described above, the input tensor in dense format, which may also be referred to as a densified input tensor, includes each element of the full input tensor, regardless of whether the element is in an active position. In contrast, the input tensor in sparse format only includes the elements of the input tensor in dense format that are in active positions. Once the input tensor in dense format has been received, method 4000 proceeds to block 4004.

[0312] At block 4004, the GPU receives information identifying active locations of the output tensor, which may be referred to as target locations or scatter locations of the output tensor. Each active location or position may be identified by a set or pair of indices—a height or row index, and a width or column index.

[0313] For example, a GPU may receive an instruction to generate Fig.41 The information of the nine positions of the output tensor 4102 of the 3x3 deconvolution with a stride of 2 is shown in gray in FIG. These target positions are listed in Table 13 below.

[0314] Once the active position in the output tensor has been received, method 4000 proceeds to block 4006.

[0315] At block 4006, the GPU performs an index expansion operation (which may also be referred to as a sparse submanifold deconvolution expansion operation) on the received input tensor based on the output tensor active position identified in block 4004 to generate an input matrix including elements of a subwindow of the input tensor that generates the identified output position. As described above, deconvolution can be achieved by performing a direct convolution between the input tensor and each of a plurality of subfilters and interleaving the results of the direct convolution. The subwindow of the deconvolution is based on the size of the subfilter. As described above, the size of the subfilter is based on the size of the filter and the stride of the deconvolution. For example, as described above with respect to Fig.34 As mentioned above, a 3x3 deconvolution with a stride of two in the width and height dimensions has four 2x2 sub-filters (per filter). Therefore, in this example, each sub-window of the input tensor is a 2x2 window.

[0316] Performing an index expansion operation may include: identifying a subwindow of the input tensor and a subfilter for each active position of the output tensor identified in block 4004, from the active position of the output tensor and the deconvolution parameters (e.g., stride, dilation, kernel size); and for each identified subwindow, extracting the elements of the subwindow from the input tensor and placing them in an input matrix. In some cases, the input matrix may include a column for each identified subwindow and a row for each position in the subwindow, and all elements forming the subwindow are placed in the same column. In some cases, the elements in the subwindow are expanded from left to right and from top to bottom, so that the element in the upper left corner of the subwindow is placed in the first row and the element in the lower right corner of the subwindow is placed in the last row. However, it will be apparent to those skilled in the art that this is merely an example.

[0317] The index expansion operation can be implemented on the GPU in any suitable manner. In one example, the GPU can be configured to determine, for each identified active position of the output, which sub-window of the input tensor and which sub-filter of the multiple sub-filters are used to generate (multiple) elements at the output position according to the parameters of the deconvolution (kernel dimension, stride, dilation). Each sub-window can be identified by a specific position in the sub-window, including but not limited to the first (e.g., upper left) element of the sub-window, the middle element of the sub-window, or the last (e.g., lower right) element of the sub-window.

[0318] For example, Fig.41 An exemplary filled input tensor 4104 is shown from which the identified active positions in the output tensor 4102 are to be generated. In this example, each 3x3 filter will be split into four 2x2 sub-filters, such as Fig.24 As shown, each subwindow will be a 2x2 window, and the subwindows will be separated by one element in the height and width dimensions. Each subwindow of the input tensor 4102 will generate a 2x2 block of output elements (one element per subfilter). The element associated with the first subfilter will be located in the upper left corner of the 2x2 output element block, the element associated with the second subfilter will be located in the upper right corner of the 2x2 output element block, the element associated with the third subfilter will be located in the lower left corner of the 2x2 output element block, and the element associated with the fourth subfilter will be located in the lower right corner of the 2x2 output element block. Therefore, the output tensor can be divided into 2x2 blocks, where each element in the block is generated by the same subwindow of the input, but with different subfilters.

[0319] If each 2x2 block of the output tensor is defined by its bottom-right position, then the 2x2 block to which the active position in the output tensor belongs will have its bottom-right position defined by the nearest multiple of two greater than or equal to the index. For example, the active position (2,2) has two even indices, so the bottom-right position of the associated 2x2 block is (2,2); the active position (4,11) has one even index and one odd index, so the bottom-right position of the associated 2x2 block is (4,12). The 2x2 block of the output to which each active position of the output belongs is defined in Fig.41 are shown in and listed in Table 13.

[0320] Table 13

[0321]

[0322]

[0323] The relevant 2x2 subwindow of the input tensor can then be identified from the relevant 2x2 block of the output tensor by dividing the index of the relevant 2x2 block of the output tensor by the stride (e.g. 2) in this example. For example, the relevant 2x2 subwindow of the elements of the tensor belonging to the 2x2 block of the output defined by (0,20) is the 2x2 subwindow of the input tensor defined by (0,10). The 2x2 subwindow of the input tensor associated with each active position in the output tensor is in Fig.41 and listed in Table 13.

[0324] The subfilters associated with the active position of the output tensor are based on where the active position is located within the associated 2x2 block in the output tensor. If the active position is in the top left corner of the block of the output tensor, then subfilter 1 is relevant, if the active position is in the top right corner of the block of the output tensor, then subfilter 2 is relevant, if the active position is in the bottom left corner of the block of the output tensor, then subfilter 3 is relevant, and if the active position is in the bottom right corner of the block of the output tensor, then subfilter 4 is relevant. The subfilters associated with each active position in the output tensor are in Fig.41 and listed in Table 13.

[0325] Once the relevant subwindows and subfilters have been identified, the elements forming each identified subwindow are extracted from the input tensor and placed in the input matrix. This can be achieved by indexing each uniquely relevant subwindow (e.g., from 0 to the number of relevant subwindows), and for each uniquely relevant subwindow, using multiple nested loops to identify the elements in that subwindow (one nested loop for each dimension of the subwindow). For example, where the subwindows are two-dimensional, having a height dimension and a width dimension, there can be one offset loop for the height dimension and one offset loop for the width dimension. Specifically, for a 2D sparse submanifold deconvolution of a 2D subfilter having a height dimension and a width dimension, an offset can be created for each of the height and width dimensions, the offset being equal to Where k is the size of the sub-filter in that dimension, then the height loop can be configured to loop from Y-offset_y to Y, and the width loop can be configured to loop from X-offset_x to X, where Y, X is the lower right corner of the sub-window. If the sub-window is 3D and contains more than one channel, a channel loop can also be set to loop through the channels. The input tensor element at each identified position is then copied to the appropriate position in the input matrix.

[0326] For example, for Fig.41 For each associated subwindow of the input tensor 4104 identified in Table 13, the elements forming the subwindow are extracted from the input tensor 4104 and placed in the columns of the input matrix 4106. For example, the subwindow associated with the first active position (0,19) of the output tensor 4102 is the subwindow of the input tensor 4104 with the lower right position (0,10), so the elements forming the 2x2 subwindow are extracted from the input tensor 4104 and placed in the first column 4108 of the input matrix 4106. In this example, the elements in the subwindow are expanded from left to right and from top to bottom, so that the element in the upper left corner of the subwindow is placed in the first row, and the element in the lower right corner of the subwindow is placed in the last row or fourth row. However, it will be apparent to those skilled in the art that this is only an example. Since in this example, there are eight uniquely associated subwindows, the input matrix 4106 includes eight columns.

[0327] In some cases, in addition to receiving the input tensors and the active positions and output tensors in dense format, the index expansion operation can also receive a zero input matrix of the desired shape (e.g., height = elements per sub-kernel x number of input channels, width = number of uniquely related sub-windows), and the GPU can be configured to write the sub-window elements to the appropriate locations in the input matrix.

[0328] Once the GPU has performed an index expansion operation on the input tensor to generate an input matrix having elements for each relevant sub-window of the input tensor, method 4000 proceeds to block 4008.

[0329] At block 4008, the GPU performs a matrix multiplication operation (which may be referred to as a MatMul operation) between the weight matrix and the input matrix generated in block 4006 to generate an output matrix.

[0330] Fig.42 Shows Fig.41 An example matrix multiplication between the exemplary weight matrix 4202 of and the input matrix 4106. The weight matrix may include a row for each relevant sub-filter and a column for each weight in the sub-filter. Figure 41 to Figure 43 In the example shown, there are four 2x2 subfilters (and therefore 4 weights per subfilter), and each subfilter is associated with at least one target position in the output tensor. Therefore, the weight matrix 4202 includes four rows and four columns. Each column corresponds to a position in a subfilter, and the weights of the filter are placed in the column according to its position in the subfilter. Fig.42 In the example shown, the weights in the subfilters are expanded from left to right and from top to bottom, so that the weights in the upper left corner of the subfilter are placed in the first column, and the weights in the lower right corner of the subfilter are placed in the last column. It will be apparent to those skilled in the art that this is only an example, and the weights may be placed in any order in the weight matrix as long as the order of the weights corresponds to the order of the elements of each subwindow in the input matrix. Specifically, if the element at position (-1, -1) of the subwindow is placed in row 0 of the input matrix, the weight at position (-1, -1) of the subfilter will be placed in column 0 of the weight matrix.

[0331] The matrix multiplication between the weight matrix 4202 and the input matrix 4106 generates an output matrix 4204 that includes output elements for each correlation subfilter for each correlation subwindow. The output matrix 4204 may have a column for each correlation subwindow and a row for each subfilter, such that each column includes an output element for the corresponding correlation subwindow of each correlation subfilter. Fig.42 In the example shown, there are eight correlation subwindows and four correlation subfilters, so the example output matrix 4204 has eight columns and four rows. Matrix multiplication can be parallelized on a GPU, for example, by processing each column of the input matrix in a separate thread.

[0332] Once the GPU has performed the matrix multiplication, method 4000 can end, or method 4000 can proceed to block 4010. Specifically, the output matrix 4204 generated in block 4008 includes all elements of the output tensor target position, so the output matrix 4204 can be simply output, or the output tensor in dense format can be generated from the output matrix 4204 first.

[0333] At block 4010, the GPU performs an index folding operation on the output matrix generated in block 4008 to generate an output tensor in a dense format. The index folding operation is the opposite of the index unfolding operation. Specifically, the index folding operation uses the target output positions and the relevant sub-filter information to generate an output tensor in a dense format (e.g., a densified output tensor) from the output matrix generated in block 4008. In other words, the index folding operation generates an output tensor in which the required elements in the output matrix are in the correct positions and are zero elsewhere.

[0334] As described above, a standard folding operation (e.g., a col2im operation) receives an output matrix in a dense format, i.e., an output matrix comprising a row for each output channel, each output channel having an output element for each element of that channel, and transforms each row of the received matrix into a plane of the output tensor according to the size of the channels of the output tensor.

[0335] Compared to the standard folding operation, the index folding operation receives an output matrix in a sparse format, i.e., the received matrix does not necessarily include the values ​​or elements of each element of the output tensor. The index folding operation used to implement the sparse submanifold deconvolution also receives information (e.g., an index) indicating the target position in the output tensor, and information indicating the relevant sub-filter for each desired position in the output tensor (this can be the relevant sub-filter (if calculated in block 4006), or information (e.g., deconvolution parameters such as kernel size, stride, etc.) that can be used to determine the relevant sub-filter for the active position in the output tensor). The target position information and the information indicating the sub-filter associated with each target position are used to identify the desired elements of the sparse output matrix and place them in the correct position of the output tensor in a dense format. Elements at all other positions can then be set to zero.

[0336] The index folding operation can be implemented on the GPU by creating an index for each active position in the output tensor (e.g., from 0 to n if there are n+1 active positions in the output tensor). For each active position in the output tensor, the GPU can then be configured to select an appropriate element from the output tensor and place it at the active position in the channel of the output tensor. For example, Fig.43 It shows which elements are selected from the output matrix 4204 and where they are placed in the final output tensor 4302.

[0337] In some cases, the index folding operation may receive a zero output tensor of appropriate dimensions and may write elements of the received output matrix to the received output tensor in addition to receiving the target output positions and information indicating the relevant sub-filters, deconvolution parameters, and output matrix generated in block 4008. In this case, zeros may not be explicitly placed at non-target positions of the output tensor.

[0338] Once the index folding operation has been performed, method 4000 can end.

[0339] Neural Networks

[0340] Any of the above methods for implementing convolution or deconvolution can be implemented as part of processing data according to a neural network to perform tasks such as signal processing, such as but not limited to image processing tasks or computer vision tasks. For example, Figure 5 method or Fig.13 The method can be used to implement sparse submanifold 2D or 2D convolutional layers of neural networks; Fig.21 The method can be used to implement standard 2D or 3D convolutional layers of neural networks; Fig.36 The method can be used to implement standard 2D or 3D deconvolution layers; and Fig.40 The method can be used to implement sparse submanifold 2D or 3D deconvolution layers. Fig.36 The method can also be used to perform back propagation of a neural network to achieve the reverse operation of a 2D or 3D convolutional layer in a neural network. Fig.40 The method can also be used to perform back-propagation of a neural network to achieve the reverse operation of a 2D or 3D sparse submanifold convolutional layer in a neural network.

[0341] The above methods have been shown to be particularly effective in performing convolution and deconvolution on highly sparse input data (e.g., sparsity above 80%), in terms of time and computational resources.

[0342] Example NNA

[0343] Reference now Fig.44 , which shows a method suitable for implementing the NNA-based methods described herein (e.g., regarding Fig.13An example neural network accelerator (NNA) 4400 for implementing the method described herein (described herein). The neural network accelerator 4400 includes an input unit 4402, a plurality of processing units 4404, 4406, 4408, 4410, an output unit 4412, and interconnect hardware 4414, which statically or dynamically connect other units (e.g., the input unit 4402, the processing units 4404, 4406, 4408, 4410, and the output unit 4412). The NNA 4400 is configured to: receive input data (input tensors); implement all or part of one or more layers of a neural network by processing the input data (input tensors) using one or more processing units to generate output data (output tensors); and output the output data (output tensors) from the NNA. Receiving input data at the NNA and processing the input data using one or more processing units is called a hardware pass process of the NNA. One or more hardware passes of the NNA can implement a neural network. For example, in a first hardware pass, input data may be input to the NNA by a convolution processing unit to be processed according to a convolution layer, and then the output of the first hardware pass may be input to the NNA in a second hardware pass and processed by a pooling processing unit according to a pooling layer. The neural network may be mapped to the hardware pass process of the NNA in any suitable manner.

[0344] Input unit 4402 is hardware configured to receive input data and store it to neural network accelerator 4400. The input data may be received from an external memory (i.e., a memory external to NNA 4400). In some examples, input unit 4402 may include one or more buffers to store the received input data. Fig.44 The example NNA 4400 includes a single input unit 4402, but other example NNAs may include multiple input units. The term "input data to the NNA" is used herein to refer to input data to be processed by one or more processing units (which may or may not be equivalent to input data to a layer of a neural network), and can be distinguished from other parameters used in the neural network (e.g., weights, biases, etc.). In some cases, other input parameters may be input to the NNA in another manner (e.g., loaded into an internal or external storage unit associated with a particular processing unit). For example, the weights and biases of a convolutional layer may be loaded into a buffer linked to or forming part of a convolution processing unit 4404.

[0345] Each processing unit 4404, 4406, 4408, 4410 is itself an accelerator configured to accelerate the execution of one or more neural network operations on input data. Specifically, each processing unit 4404, 4406, 4408, 4410 is configured to receive an input tensor and perform one or more operations on the input tensor through hardware logic to generate an output tensor. Fig.44 The NNA 4400 includes a convolution processing unit 4404 configured to accelerate convolution operations. Fig.45 and Fig.46 An exemplary embodiment of a convolution processing unit 4404 is described. However, the NNA 4400 may include one or more other processing units. For example, the NNA 4400 may also include one or more of an element-by-element operation processing unit 4406, which is configured to accelerate per-element operations (e.g., addition, multiplication, etc.) performed on input tensors and may receive a secondary input tensor that can be used to implement per-element operations, an activation processing unit 4408 configured to accelerate nonlinear operations, and a pooling processing unit 4410 configured to accelerate pooling operations.

[0346] The element-wise operation processing unit 4406 is hardware that is configured to receive input data (e.g., input tensor) and optionally perform element-wise operations on the input data (e.g., input tensor) using another data set (e.g., another tensor) that can be obtained or retrieved from external memory (e.g., memory external to the NNA). An element-wise operation is the same operation performed on each element of the input data / tensor (e.g., each input data value or each tensor). Element-wise operations that can be performed on the input data include, but are not limited to, addition, multiplication, maximum, and minimum.

[0347] The other data set / tensor may be of the same size (e.g., having the same number of dimensions) as the input data / tensor, such that corresponding elements of the two tensors are combined using element-wise operations. Alternatively, the other data set / tensor and the input data / tensor may have different sizes or dimensions. For example, if the mismatching dimension of one of the tensors has a size of 1, a broadcasting technique may be used to perform element-wise operations between the input data / tensor and the other data set / tensor, where the smaller tensor is broadcast (or expanded) to the size of the other tensor. For example, a tensor of size [N, H, W, C] = [1, 10, 1, 10] may be element-wise combined with a tensor of size [N, H, W, C] = [1, 10, 10, 10] by expanding the W dimension of the first tensor.

[0348] It will be apparent to those skilled in the art that this is merely an exemplary set of processing units, and that other NNAs may have additional processing units, fewer processing units, and / or different processing units, depending on factors such as the type of neural network they are intended to process. In some cases, one or more processing units may be combined.

[0349] Output unit 4412 is hardware configured to receive output tensors generated by processing input data via one or more processing units 4404, 4406, 4408, 4410. In some cases, output unit 4412 may have a buffer or other storage device for temporarily storing all or a portion of the output tensors before outputting the output tensors from NNA 4400. In some cases, output unit 4412 may be configured to save the output tensors in external memory (i.e., memory external to the neural network accelerator).

[0350] The interconnect hardware 4414 statically or dynamically connects input units, one or more processing units, and output units to allow input data of the neural network accelerator to flow through (e.g., be processed by) one or more processing units and then be output from the neural network accelerator. In some cases, the interconnect hardware 4414 may include fixed hardware connections between the input unit 4402, the processing units 4404, 4406, 4408, 4410, and the output unit 4412, which allow data to flow through the units in a limited number of ways. However, in other cases, the interconnect hardware 4414 may include hardware that can dynamically connect the units 4402-4412 of the neural network accelerator in a variety of different ways in response to one or more control signals. For example, the interconnect hardware 4414 may include a cross switch, and the units 4402-4412 may be connected to the cross switch so that the cross switch can dynamically connect the units in a variety of different ways in response to one or more control signals. For example, in one hardware pass, the crossbar may connect the output of input unit 4402 to the input of convolution processing unit 4404, connect the output of convolution processing unit 4404 to the input of element-by-element operation processing unit 4406, and then connect the output of element-by-element operation processing unit 4406 to the input of output unit 4412, such that the input data of the hardware pass is processed by convolution processing unit 4404 and then by element-by-element operation processing unit 4406. In another hardware pass, the crossbar may connect the output of input unit 4402 to the input of convolution processing unit 4404, and then connect the output of convolution processing unit 4404 to the input of output unit 4412, such that the input data of the hardware pass is only processed by convolution processing unit 4404. Thus, in these cases, the connections between units 4402-4412 of the neural network accelerator (and therefore the manner in which data can flow through the NNA units) are not fixed or static.

[0351] Although not shown, the units 4402-4412 and interconnect hardware 4414 of the NNA may receive control information for each hardware transfer process, which control information indicates which units will be active or used in the hardware transfer process and how each active unit and interconnect hardware 4414 will be configured for the hardware transfer process. The control information may also indicate other information, such as the format of the input and output data of the unit.

[0352] In some cases, the neural network accelerator 4400 may also include an embedded processor 4416 that can receive control instructions to perform more complex operations (e.g., scatter-add operations).

[0353] Reference now Fig.45 , which shows Fig.44 4. In this example, the convolution processing unit 4404 includes multiple convolution engines 4502, multiple accumulators 4504, and an accumulation buffer 4506.

[0354] Each convolution engine 4502 includes hardware logic configured to receive a set of weights {k1, k2 ..., k8} representing all or part of a filter, and a set of input data values ​​{x1, x2, ..., x8} representing all or part of a window of input data, and perform a multiplication and accumulation calculation on the received weights and input data values. In some examples, such as Fig.46 As shown, each convolution engine 4502 may include a plurality of multipliers 4602, each of which is configured to convert the weight (k i ) and the corresponding input data value (x i ) are multiplied to produce a multiplication output value. Multiplier 4602 is followed by a plurality of adders 4604. The adders can form an adder tree to calculate the sum of the multiplication outputs. Fig.46 In the example of , convolution engine 4502 includes eight multipliers 4602, but in other examples, there may be more or fewer multipliers. For example, in some cases, there may be 128 multipliers. Typically, if there are Z multipliers, the adder tree includes Z-1 adders. Fig.45 The exemplary convolution processing unit 4404 includes four convolution engines 4502, however, it is obvious to those skilled in the art that this is just an example and there may be only one convolution engine, there may be two convolution engines, or there may be more than two convolution engines.

[0355] Since the convolution engine 4502 may go through more than one hardware pass to generate a complete filter result (for example, because the convolution engine may only receive and process a portion of the filter weights and / or a portion of the input data values ​​of the window in the cycle), the convolution processing unit 4404 may include multiple accumulators 4504. The pass process of the convolution engine includes receiving a set of weights and a set of input data values ​​and performing a multiply-add operation on them. Each accumulator 4504 receives the output of a convolution engine 4502 and adds the output to the previous convolution engine output associated with the same filter. Since the convolution engine 4502 may not generate or produce outputs associated with the same filter in consecutive cycles, partial results of one or more filters can be stored in the accumulation buffer 4506, and then the accumulation buffer 4506 can provide the appropriate partial results to the accumulator 4504 in each cycle.

[0356] In some cases, the convolution processing unit 4404 may include or have access to an input buffer 4508 for storing elements of the input tensor and a coefficient buffer 4510 for storing weights of the convolution. In some cases, the input buffer 4508 may be implemented as multiple memory banks. In these cases, there may be a multiplexer (not shown) for each convolution engine 4502 that is coupled to each memory bank of the input buffer to allow data stored in any memory bank to be selectively directed to any convolution engine 4502.

[0357] Fig.47 An example computer system in which a neural network accelerator and / or a graphics processing unit described herein may be implemented is shown. The computer system includes a CPU 4702, a GPU 4704, a memory 4706, a neural network accelerator (NNA) 4708 (which may be any of the neural network accelerators described herein), and other devices 4714, such as a display 4716, a speaker 4718, and a camera 4722. The components of the computer system may communicate with each other via a communication bus 4720. In other examples, the GPU 4704 may itself be the NNA, or the GPU 4704 may include the NNA.

[0358] Figures 44 to 46 The neural network accelerator, convolution processing unit, and convolution engine are shown to include multiple functional blocks. This is merely schematic and is not intended to define a strict division between different logical elements of such entities. Each functional block may be provided in any suitable manner. It should be understood that the intermediate values ​​described herein formed by the neural network accelerator or graphics processing unit do not need to be physically generated by the neural network accelerator or graphics processing unit at any point in time, and may simply represent logical values ​​that conveniently describe the processing performed by the neural network accelerator or graphics processing unit between its input and output.

[0359] The neural network accelerator and graphics processing unit described herein may be embodied in hardware on an integrated circuit. The neural network accelerator or graphics processing unit described herein may be configured to perform any of the methods described herein. In general, any of the functions, methods, techniques, or components described above may be implemented in software, firmware, hardware (e.g., fixed logic circuitry), or any combination thereof. The terms "module," "functionality," "component," "element," "unit," "block," and "logic" may be used herein to generally represent software, firmware, hardware, or any combination thereof. In the case of a software implementation, a module, functionality, component, element, unit, block, or logic represents a program code that, when executed on a processor, performs a specified task. The algorithms and methods described herein may be performed by one or more processors that execute code that causes the processor to perform the algorithm / method. Examples of computer-readable storage media include random access memory (RAM), read-only memory (ROM), optical disks, flash memory, hard disk memory, and other memory devices that can use magnetic, optical, and other technologies to store instructions or other data and can be accessed by a machine.

[0360] As used herein, the terms computer program code and computer readable instructions refer to any kind of executable code for a processor, including code expressed in a machine language, an interpreted language, or a scripting language. Executable code includes binary code, machine code, byte code, code that defines an integrated circuit (e.g., a hardware description language or a netlist), and code expressed in a programming language code such as C, Java, or OpenCL. Executable code can be, for example, any kind of software, firmware, script, module, or library that, when properly executed, processed, interpreted, compiled, run in a virtual machine or other software environment, causes a processor of a computer system supporting the executable code to perform the tasks specified by the code.

[0361] A processor, computer or computer system may be any kind of device, machine or special purpose circuit, or a collection or part thereof, which has processing capabilities so that instructions can be executed. A processor may be or include any kind of general or special purpose processor, such as a CPU, GPU, NNA, system on chip, state machine, media processor, application specific integrated circuit (ASIC), programmable logic array, field programmable gate array (FPGA), etc. A computer or computer system may include one or more processors.

[0362] It is also intended to cover software that defines the configuration of hardware as described herein, such as HDL (Hardware Description Language) software, such as for designing integrated circuits or for configuring programmable chips to implement desired functions. That is, a computer-readable storage medium may be provided having encoded thereon computer-readable program code in the form of an integrated circuit definition data set, which, when processed (i.e., run) in an integrated circuit manufacturing system, configures the system to manufacture a neural network accelerator or graphics processing unit configured to perform any of the methods described herein, or to manufacture a neural network accelerator or graphics processing unit that includes any of the devices described herein. The integrated circuit definition data set may be an integrated circuit description, among others.

[0363] Thus, a method of manufacturing a neural network accelerator or a graphics processing unit as described herein at an integrated circuit manufacturing system may be provided. In addition, an integrated circuit definition data set may be provided that, when processed in an integrated circuit manufacturing system, causes the method of manufacturing a neural network accelerator or a graphics processing unit to be performed.

[0364] The integrated circuit definition data set may be in the form of computer code, for example as a netlist, code for configuring a programmable chip, as a hardware description language that defines hardware suitable for fabrication at any level in an integrated circuit, including as register transfer level (RTL) code, as a high-level circuit representation such as Verilog or VHDL, and as a low-level circuit representation such as OASIS (RTM) and GDSII. Higher-level representations that logically define hardware suitable for fabrication in an integrated circuit (such as RTL) may be processed at a computer system configured to generate a manufacturing definition of the integrated circuit in the context of a software environment that includes definitions of circuit elements and rules for combining those elements to generate a manufacturing definition of the integrated circuit so defined by the representation. As is typically the case with software executed at a computer system to define a machine, one or more intermediate user steps (e.g., providing commands, variables, etc.) may be required to configure the computer system to generate a manufacturing definition of the integrated circuit to execute code that defines the integrated circuit to generate the manufacturing definition of the integrated circuit.

[0365] Now refer to Fig.48 An example is described of processing an integrated circuit definition data set at an integrated circuit manufacturing system to configure the system to manufacture a neural network accelerator or a graphics processing unit.

[0366] Fig.48An example of an integrated circuit (IC) manufacturing system 4802 is shown, the IC manufacturing system being configured to manufacture a neural network accelerator or a graphics processing unit as described in any of the examples herein. Specifically, the IC manufacturing system 4802 includes a layout processing system 4804 and an integrated circuit generation system 4806. The IC manufacturing system 4802 is configured to receive an IC definition data set (e.g., defining a neural network accelerator or a graphics processing unit as described in any of the examples herein), process the IC definition data set, and generate an IC (e.g., which embodies a neural network accelerator or a graphics processing unit as described in any of the examples herein) based on the IC definition data set. Processing of the IC definition data set configures the IC manufacturing system 4802 to manufacture an integrated circuit that embodies a neural network accelerator or a graphics processing unit as described in any of the examples herein.

[0367] The layout processing system 4804 is configured to receive and process an IC definition data set to determine a circuit layout. Methods for determining a circuit layout based on an IC definition data set are known in the art and may, for example, involve synthesizing RTL code to determine a gate-level representation of a circuit to be generated, such as in terms of logic components (e.g., NAND, NOR, AND, OR, MUX, and FLIP-FLOP components). By determining location information for the logic components, the circuit layout may be determined by the gate-level representation of the circuit. This may be done automatically or with user involvement in order to optimize the circuit layout. When the layout processing system 4804 has determined the circuit layout, it may output the circuit layout definition to the IC generation system 4806. The circuit layout definition may be, for example, a circuit layout description.

[0368] As is known in the art, IC generation system 4806 generates ICs according to the circuit layout definition. For example, IC generation system 4806 may implement a semiconductor device manufacturing process to generate ICs, which may involve a multi-step sequence of photolithography and chemical processing steps during which electronic circuits are gradually formed on a wafer made of semiconductor material. The circuit layout definition may be in the form of a mask that may be used in a photolithography process to generate ICs according to the circuit definition. Alternatively, the circuit layout definition provided to IC generation system 4806 may be in the form of a computer readable code that IC generation system 4806 may use to form a suitable mask for generating the IC.

[0369] The different processes performed by IC manufacturing system 4802 may all be performed in one location, such as by one party. Alternatively, IC manufacturing system 4802 may be a distributed system such that some processes may be performed in different locations and may be performed by different parties. For example, some of the following stages may be performed in different locations and / or by different parties: (i) synthesizing RTL code representing an IC definition data set to form a gate-level representation of a circuit to be produced; (ii) generating a circuit layout based on the gate-level representation; (iii) forming a mask based on the circuit layout; and (iv) using the mask to manufacture the integrated circuit.

[0370] In other examples, processing of an integrated circuit definition data set at an integrated circuit manufacturing system may configure the system to manufacture a neural network accelerator without processing the IC definition data set to determine a circuit layout. For example, an integrated circuit definition data set may define a configuration of a reconfigurable processor (such as an FPGA), and processing of the data set may configure the IC manufacturing system to generate a reconfigurable processor having the defined configuration (e.g., by loading the configuration data into the FPGA).

[0371] In some embodiments, when processed in an integrated circuit manufacturing system, the integrated circuit manufacturing definition data set can enable the integrated circuit manufacturing system to generate an apparatus as described herein. Fig.48 The configuration of an integrated circuit manufacturing system in the described manner can be used to manufacture the devices described herein.

[0372] In some examples, the integrated circuit definition data set may include software that runs on, or in combination with, hardware defined at the data set. Fig.48 In the example shown, the IC generation system may be further configured by the integrated circuit definition dataset to load firmware onto the integrated circuit according to the program code defined at the integrated circuit definition dataset when manufacturing the integrated circuit, or otherwise provide the integrated circuit with program code for use with the integrated circuit.

[0373] Compared with known implementations, the implementation of the concepts set forth in this application in devices, equipment, modules and / or systems (and in the methods implemented herein) can improve performance. Performance improvements may include one or more of improved computing performance, reduced latency, increased throughput and / or reduced power consumption. During the manufacture of such devices, devices, modules and systems (e.g., in integrated circuits), a trade-off may be made between performance improvements and physical implementations to improve manufacturing methods. For example, a trade-off may be made between performance improvements and layout area to match the performance of known implementations, but using less silicon. For example, this can be accomplished by reusing functional blocks in a serial manner or sharing functional blocks between elements of devices, devices, modules and / or systems. In contrast, the concepts set forth in this application that cause improvements in the physical implementation of devices, devices, modules and systems (such as reduced silicon area) may be weighed against performance improvements. This can be accomplished, for example, by manufacturing multiple instances of a module within a predefined area budget.

[0374] Applicants hereby independently disclose each individual feature described herein and any combination of two or more such features, to the extent that such feature or combination can be implemented based on the specification as a whole in view of the common general knowledge of a person skilled in the art, regardless of whether such feature or combination of features solves any problem disclosed herein. In view of the foregoing, it will be clear to a person skilled in the art that various modifications can be made within the scope of the present invention.

Claims

1. A method (4000) for performing sparse submanifold deconvolution on a graphics processing unit, the sparse submanifold deconvolution being representable as a direct convolution between an input tensor of the sparse submanifold deconvolution and each of a plurality of subfilters, wherein each of the plurality of subfilters comprises a subset of weights of a filter of the sparse submanifold deconvolution, the method (4000) comprising: Receiving (4002) an input tensor in a dense format at a graphics processing unit; Receiving (4004) at a graphics processing unit information identifying a target location of an output tensor of a sparse submanifold deconvolution; Based on the identified output tensor target locations, performing (4006) an index expansion operation on the input tensor at the graphics processing unit to generate an input matrix including input tensor elements associated with at least one identified target location of the output tensor in each subwindow of the input tensor; and A matrix multiplication is performed (4008) on the graphics processing unit between the weight matrix and the input matrix to generate an output matrix including output tensor elements at the identified target locations.

2. The method (4000) of claim 1, wherein the output tensor has at least a height dimension, a width dimension, and a channel dimension, and the target position of the output tensor is the height and width position of the output tensor.

3. The method (4000) of claim 2, wherein the information identifying the target locations of the output tensor comprises a target location list comprising height and width coordinates of each target location of the output tensor.

4. The method (4000) of claim 1, wherein a sub-window of the input tensor is a window of the input tensor used to compute at least one output tensor element of one of the direct convolutions.

5. A method (4000) according to any one of claims 1 to 4, wherein performing an index expansion operation on the input tensor includes identifying each subwindow of the input tensor associated with at least one identified target position of the output tensor from the identified target positions of the output tensor and one or more parameters of the sparse submanifold deconvolution.

6. A method (4000) according to claim 5, wherein a subwindow of the input tensor is associated with a target position if the subwindow is used to generate an element of the output tensor of the sparse submanifold deconvolution at the target position.

7. A method (4000) according to claim 5, wherein the elements of the channels of the output tensor of the sparse submanifold deconvolution are divided into multiple blocks, wherein each element in the block is generated by the same subwindow of the input tensor and a different subfilter of the filter, and identifying the subwindow of the input tensor associated with the identified target position includes identifying a block of the output tensor of which the identified target position forms a part, and mapping the identified block of the output tensor to the subwindow of the input tensor used to generate the block.

8. The method (4000) of claim 7, wherein the identified block of the output tensor is mapped to a subwindow of the input tensor using a position in the output tensor of a predetermined element of the block and one or more parameters of a sparse submanifold deconvolution.

9. A method (4000) according to any one of claims 1 to 4, wherein performing an index expansion operation on the input tensor includes identifying elements of each relevant sub-window from one or more parameters of the sparse submanifold deconvolution.

10. A method (4000) according to claim 9, wherein identifying elements of the relevant sub-window includes identifying the position in the input tensor of a predetermined element within the sub-window, and implementing a series of nested loops to move the element from the identified position in the sub-window, the series of nested loops including a loop for each dimension of the sub-window.

11. The method (4000) of any one of claims 1 to 4, wherein performing an index expansion operation on an input tensor comprises storing elements of each relevant sub-window in an input matrix.

12. The method (4000) of claim 11, further comprising receiving a zero input matrix, and the elements of the relevant sub-window of the input tensor are stored in the received input matrix.

13. A method (4000) according to any one of claims 1 to 4, wherein performing an index expansion operation on the input tensor includes identifying which of a plurality of sub-filters is associated with each identified target position of the output tensor from one or more parameters of the sparse submanifold deconvolution.

14. A method (4000) according to claim 13, wherein the elements of a channel of an output tensor are divided into multiple blocks, wherein each element in the block is generated by the same sub-window of the input tensor and a different sub-filter of the filter, and identifying which of the multiple sub-filters is associated with the identified target position of the output tensor, includes identifying the block of the output tensor of which the identified target position forms a part, and the position within the block where the identified target position is located.

15. A method (4000) according to any one of claims 1 to 4, wherein the input matrix includes a column for each relevant subwindow of the input tensor, and each column of the input matrix includes an element of the input tensor in the corresponding relevant subwindow.

16. A method (4000) according to any one of claims 1 to 4, wherein the weight matrix includes a row for each sub-filter associated with at least one identified target position of the output tensor, and each row of the weight matrix includes all weights forming the corresponding sub-filter.

17. The method (4000) according to any one of claims 1 to 4 also includes performing (4010) an index folding operation on the output matrix based on the identified target location of the output tensor at a graphics processing unit to generate an output tensor in a dense format.

18. A method (4000) according to claim 17, wherein performing an index folding operation on the output matrix includes identifying elements in the output matrix corresponding to the identified target positions of the output tensor based on the identified target positions of the output tensor and one or more parameters of the sparse submanifold deconvolution, and storing each element of the identified target positions in the output matrix at the target positions corresponding to the channels of the output tensor.

19. A graphics processing unit, configured to execute the method (4000) of any one of claims 1 to 18.

20. A computer-readable storage medium having computer-readable code stored thereon, wherein the computer-readable code is configured to cause a graphics processing unit to execute the method (4000) of any one of claims 1 to 18 when the code is run.