Processing for multiple input data sets
By optimizing buffer usage through sequential and parallel computations in a computation engine, the method addresses inefficiencies in neural network architectures, enhancing resource utilization and reducing power consumption and chip space for processing multiple data sets.
Patent Information
- Application Number
- JP2024081350
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2018-03-22
- Filing Date
- 2024-05-17
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2039-03-19
AI Technical Summary
Existing neural network architectures face challenges in efficiently utilizing computational resources and reducing buffer requirements while processing multiple input data sets, leading to increased power consumption and chip space, especially in deep neural networks.
A method for operating a computation engine that schedules multilayer neural network computations for multiple contexts, optimizing buffer usage by performing lower layer computations sequentially for each context and higher layer computations in parallel, while minimizing the size of required buffers.
This approach maximizes computational resource utilization and reduces buffer requirements, thereby decreasing power consumption and chip space, enabling efficient processing of multiple input data sets in neural networks.
Smart Images

Figure 2024116153000001_ABST
Abstract
Description
[Technical field]
[0001]
[0001] An artificial neural network is a computing system with an architecture based on biological neural networks. An artificial neural network can be trained to learn how to perform a particular computational task using training data. For example, the training data may include image data associated with a given object. A trained artificial neural network can process multiple images (or multiple image sets) representing different contexts (e.g., captured in different locations, at different times, by different people, and carrying different information) to determine whether an image or image set contains image data of the given object. Summary of the Invention [Means for solving the problem]
[0002]
[0002] A neural network may include a set of processing nodes. Each processing node may process a portion of the input data to generate an output, and a final decision may be generated based on a combination of the outputs of the set of processing nodes. As part of the processing, each processing node may perform a set of arithmetic operations, e.g., floating point multiplication and addition. The arithmetic operations of the processing nodes may be performed by circuits and data paths optimized for high speed arithmetic operations, such as a graphics processing unit (GPU). [Brief description of the drawings]
[0003] [Figure 1] FIG. 1 illustrates an exemplary data processing device for processing images using the techniques disclosed herein. [Figure 2A] FIG. 1 is a simplified block diagram of a predictive model using techniques disclosed herein, in accordance with some aspects of the present disclosure. [Figure 2B]FIG. 1 is a simplified block diagram of a predictive model using techniques disclosed herein, in accordance with some aspects of the present disclosure. [Figure 2C] FIG. 1 is a simplified block diagram of a predictive model using techniques disclosed herein, in accordance with some aspects of the present disclosure. [Figure 2D] FIG. 1 is a simplified block diagram of a predictive model using techniques disclosed herein, in accordance with some aspects of the present disclosure. [Figure 3A] FIG. 3 is a simplified block diagram of some of the internal components of an apparatus for implementing the predictive model of FIG. 2 in accordance with some aspects of the present disclosure. [Figure 3B] FIG. 3 is a simplified block diagram of some of the internal components of an apparatus for implementing the predictive model of FIG. 2 in accordance with some aspects of the present disclosure. [Figure 3C] FIG. 3 is a simplified block diagram of some of the internal components of an apparatus for implementing the predictive model of FIG. 2 in accordance with some aspects of the present disclosure. [Figure 4] FIG. 1 illustrates an example sequence for operating a computing system to perform multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Diagram 5] FIG. 1 illustrates an example sequence for operating a computing system to perform multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 6] 1 is an exemplary flowchart of a method for operating a computing system to perform multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 7A] FIG. 1 illustrates an example of a scheduling scheme for scheduling multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 7B] FIG. 1 illustrates an example of a scheduling scheme for scheduling multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 7C] FIG. 1 illustrates an example of a scheduling scheme for scheduling multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 7D] FIG. 1 illustrates an example of a scheduling scheme for scheduling multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 7E] FIG. 1 illustrates an example of a scheduling scheme for scheduling multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 7F] FIG. 1 illustrates an example of a scheduling scheme for scheduling multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 7G] FIG. 1 illustrates an example of a scheduling scheme for scheduling multi-layer neural network processing of multiple data sets in accordance with some aspects of the present disclosure. [Figure 8] FIG. 2 is an exemplary flow diagram for scheduling operation of a computation engine in accordance with some aspects of the present disclosure. [Figure 9] FIG. 2 illustrates an example of a computing device in accordance with some aspects of the present disclosure. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0004]
[0011] In the following description, various embodiments are described. For purposes of explanation, specific configurations and details are shown in order to provide a thorough understanding of the embodiments. However, it will be apparent to those skilled in the art that the embodiments may be practiced without the specific details. Furthermore, well-known features may be omitted or simplified so as not to obscure the described embodiments.
[0005]
[0012] An embodiment of the present disclosure relates to a method of operating a computation engine to perform computations for a multi-layer neural network for multiple contexts. The multi-layer neural network may include a first neural network layer, a second neural network layer that receives data from the first neural network layer, and a third neural network layer that receives data from the second neural network layer. In one example, the computation engine can be configured as a first neural network layer to perform computations for the first context, and then as a second neural network layer to perform computations for the first context, and can store an output of the second neural network layer computations for the first context. The computation engine can then switch back to the first neural network layer to perform computations for the second context, and then as a second neural network layer to perform computations for the second context. The output of the second neural network layer computations for the second context can be stored. The computation engine can then be configured as a third neural network layer to perform computations for the first context and computations for the second context in parallel.
[0006]
[0013] An embodiment of the present disclosure also relates to a method for scheduling operations in a computation engine for performing multi-layer neural network computations for multiple contexts. With reference to the above example, the scheduling method may include determining execution batches for computations of various neural network layers for various contexts. The scheduling may start with a highest-level neural network layer (e.g., the third neural network layer) and determine one or more execution batches for the highest-level neural network layer. Then, one or more execution batches for lower layers (e.g., the second neural network layer) may be determined and scheduled before the execution batch for the highest-level neural network layer. The determination of the execution batches may be based on available buffer space. If the buffer cannot provide the space required for the computation of one neural network layer for all contexts, the computation may be split into multiple batches, and the splitting may be performed such that the buffer can provide sufficient space to store the output data generated from the previous execution batch (to be provided to the future execution batch) as well as the input / output data of the running batch;
[0007]
[0014] An artificial neural network (hereinafter, "neural network") may include multiple processing nodes. In the case of a deep neural network (DNN), the processing nodes may be divided into layers including, for example, an input layer, several intermediate layers (also known as hidden layers), and an output layer. Each processing node of the input layer receives an element of an input set and scales the element with a weight to indicate the element's influence on the output. The processing nodes in the intermediate layer may combine the scaled elements received from each processing node of the input layer to calculate a set of intermediate outputs. For example, each processing node in the intermediate layer may generate an intermediate output by calculating a sum of the products of the elements and the weights and then applying an activation function to the sum. The intermediate output from each processing node of one intermediate layer may be considered as an activated vote (or no vote) associated with a weight indicating the influence of the vote to determine the intermediate output of the next intermediate layer. The output layer may generate a sum of the scaled intermediate outputs from the final intermediate layer and generate a binary output (e.g., "yes" or "no") based on whether the sum of the scaled intermediate outputs exceeds a threshold. Due to the combination of scaled elements between layers, the size of the higher layers (e.g., the output layer, the intermediate layer immediately before the output layer, etc.) is usually smaller than the size of the lower layers (e.g., the input layer, the intermediate layer immediately after the input layer, etc.).
[0008]
[0015] As described below, the processing node may be implemented with a circuit and data path optimized for high-speed arithmetic operations, such as a graphics processing unit (GPU). For example, the circuit may include an array of computation units linked together via a data path. The computation units may retrieve one or more weights and one or more inputs from a buffer to perform a scaling operation (e.g., scaling an input by a set of weights) and / or an addition operation (e.g., combination of scaled inputs received from another computation unit). To perform multi-layer neural network processing, the data path may be configured to retrieve different sets of weights and inputs associated with different neural network layers from different buffers at different times and forward the weights and inputs to the computation units to perform the calculations. For example, in a first time period, the computation units may be configured as an input layer, and the data path may be configured to retrieve a first set of weights and an input dataset from a buffer and forward the first set of weights and the input dataset to the computation units. The computation units may perform the scaling and combination operations to calculate a first set of intermediate outputs and store the first set of intermediate outputs in a buffer separately from the weights and input dataset to avoid overwriting of the weights and input dataset to be delivered to the computation units. In a second time period, the computation unit may be configured as a first hidden layer to compute a second set of intermediate outputs, and the data path may be configured to retrieve the first set of intermediate outputs and the second set of weights from the buffer and send the first set of intermediate outputs and the second set of weights to the computation unit to perform the computation. The process may be repeated until the computation unit performs the computation for the output layer.
[0009]
[0016] Such a configuration can reduce the number of computation units required to perform neural network processing, but the utilization of the computation units may decrease during processing. For example, as described above, the size of the upper layer is usually smaller than the size of the lower layer. If an array of computation units is configured to perform neural network processing on a single set of input data, the number of computation units involved in the calculation may decrease as data propagates from the lower layer to the upper layer. When the calculation for the upper layer is being performed, some of the computation units included in the calculation for the lower layer may be idle, leading to a decrease in utilization of the computation units.
[0010]
[0017] To achieve higher utilization, the array of computing units can be configured to process multiple input data sets (or input data associated with various contexts) in a lock-step manner. For example, the array of computing units can be configured to sequentially perform computations for lower layers (e.g., input layer, lower hidden layer, etc.) for each context, where the computations for the lower layers may include larger input data sets and weight sets and require more computing units and more buffer space. After the computations for the lower layers are completed, the computation results can be stored in a buffer. The array of computing units can then be configured to perform parallel computations for multiple contexts of the next layer (e.g., upper hidden layer, output layer, etc.) based on the computation results of the lower layers stored in the buffer. The computations for the next layer may include smaller input data sets and weight sets and can be processed by a smaller number of computing units, and the buffer can also accommodate input and output data for the next layer computations of a larger number of contexts.
[0011]
[0018] Although such a configuration can maintain a relatively high utilization rate, a large buffer may be required to store the entire computation result for a particular layer of the neural network and provide intermediate output for the computation for the next layer. When a large number of data sets are input to the array of computation units to further improve the utilization rate for the computation of the upper layers, the required size of the buffer may further increase. A larger number of memory units and associated interface circuits may be required to implement the buffer. All of these may increase the power consumption and chip space, which may significantly limit the deployment of computing devices and applications for computation and problem solving using neural network architectures.
[0012]
[0019] SUMMARY OF THE DISCLOSURE Embodiments of the present disclosure relate to a method for operating a computation engine to perform computations for a multi-layer neural network for multiple contexts. In one example, a method includes performing, using a computational engine, a first computational task associated with a first neural network layer for the first context generating first data; performing, using the computational engine, a second computational task associated with a second neural network layer for the first context generating second data based on the first data; storing the second data in a memory device; performing, using the computational engine, a third computational task associated with the first neural network layer for the second context generating third data; performing, using the computational engine, a fourth computational task associated with the second neural network layer for the second context generating fourth data based on the third data; storing the fourth data in the memory device; and performing, using the computational engine, fifth and sixth computational tasks in parallel based on the second data and the fourth data stored in the memory device, the fifth and sixth computational tasks being associated with a third neural network layer for the first context and the second context, respectively.
[0013]
[0020] The embodiments of the present disclosure also relate to a method for scheduling operations in a computation engine for performing multi-layer neural network computation for multiple contexts. With reference to the above example, the scheduling method may include: determining a first execution batch including a fifth computation task and a sixth computation task; determining a second execution batch including the second computation task and a third execution batch including a fourth computation task, both of which are executed before the first execution batch, based on the memory device having sufficient capacity to store the input data and output data of the second computation task and the output data of the fourth computation task; and determining a fourth execution batch including the first computation task to be executed between the second execution batch and the third execution batch, based on the memory having sufficient capacity to store the input data and output data of the first computation task and the output data of the fourth computation task. The first, second, third, and fourth execution batches may be executed according to the order determined above to perform the exemplary method of multi-layer neural network computation for multiple contexts described above.
[0014]
[0021] Compared with the above-mentioned lock-step method, the embodiment of the present disclosure can operate with a smaller buffer for storing intermediate output of the calculation. As an illustrative example, in the lock-step method, the calculation engine can complete the first neural network layer calculation for both the first context and the second context, and then proceed to execute the second neural network layer calculation for both the first context and the second context, followed by the third neural network layer calculation for both the first context and the second context. The calculation engine can execute the first neural network layer calculation for the first context followed by the second context. To support batch processing, the buffer needs to provide a first storage space for storing the input and output of the ongoing first neural network layer calculation of the second context, as well as a second storage space for storing the output of the completed first neural network layer calculation of the first context (to be provided as an input to the second neural network layer calculation of the first context after the first neural network layer calculation of the second context is completed).
[0015]
[0022] On the other hand, in an embodiment of the present disclosure, the computation engine can complete the first neural network layer computation and the second neural network layer computation for the first context, store the second neural network layer output of the first context, and then proceed to perform the first neural network layer computation for the second context. To support the first neural network layer computation for the second context, the buffer may need to provide a first storage space (identical to the first storage space required in the illustrative example of the lock-step method described above) for the input data and output data of the first neural network layer computation for the second context. The buffer also needs to provide a second storage space to store the output of the completed second neural network layer computation of the first context. The second storage space in this case may be smaller than the second storage space of the lock-step example described above. This is because the size of the second neural network layer is usually smaller than the size of the first neural network layer, and the output data size of the second neural network layer is also usually smaller than the output data size of the first neural network layer. Therefore, smaller buffers can be used to store intermediate results as the computation engine progresses through the layers.
[0016]
[0023] In embodiments of the present disclosure, computations on various input data sets can be arranged to maximize utilization of computational resources (e.g., by enabling simultaneous upper-tier computations on multiple input data sets) while reducing buffer usage. As a result, smaller memory devices can be used to support the computations, thereby reducing chip space and power consumption.
[0017]
[0024] 1 illustrates an exemplary classifier device 100 for processing a data sequence using the techniques disclosed herein. The classifier device 100 may be, for example, a computing device that operates a software application 102 and a predictive model 103 to predict information contained in a data sequence and perform a predetermined function based on the prediction. For example, the classifier device 100 may be part of an image recognition service provided to identify specific objects (e.g., text, people, etc.) from an image. It is understood that the image recognition service is provided merely as an illustrative example and that the techniques disclosed herein may be used for other data processing applications including, for example, text-based data processing (e.g., processing search queries), audio data processing, etc.
[0018]
[0025] The image recognition service may be provided in a multi-tenant computing services system. A multi-tenant computing services system may typically include multiple servers that can host data and can be used by multiple clients or organizations to run instances, such as virtual machine instances or bare metal instances (e.g., an operating system running directly on server hardware). Instances, such as bare metal or virtual machines, may be allocated to clients when the clients need them, and may be closed down when they are no longer needed so that resources can be reallocated to other clients. In this disclosure, the terms "tenant," "client," and "customer" may be used interchangeably, but such terms do not necessarily imply the existence of any particular business arrangement. The term "instance" may refer to an instance running, for example, directly on server hardware or as a virtual machine. Different types of instances generally correspond to different hardware capabilities and / or hardware arrangements (e.g., different amounts of available memory and / or processing hardware). In the example of FIG. 1, the multi-tenant computing services system can provide image recognition services when a client needs them and shut them down when they are no longer needed so that the resources supporting the image recognition services (e.g., access to software application 102 and the underlying hardware resources for processing software application 102) can be reallocated to other clients.
[0019]
[0026] As shown in FIG. 1, the software application 102 may receive pixel data of an image 104 from a user. The image 104 may include an array of pixels. The software application 102 may perform analysis on the pixel data to predict one or more objects 106 depicted in the image 104. The analysis may include, for example, comparing the pixel data to a set of predefined image features. As described in more detail below, the software application 102 may utilize a predictive model 203 to calculate a set of scores based on the pixel data of the image 104. The set of scores may represent, for example, the likelihood that the image 104 includes the predefined image features. The software application 102 may then determine other information regarding the content of the image 104 based on the scores. For example, based on the scores, the software application 102 may determine that the image 104 is an image of a panda.
[0020]
[0027] The predictive model 103 may be in the form of an artificial neural network. The artificial neural network may include multiple processing nodes, each configured to process a portion of the input pixel data or further process intermediate outputs from other processing nodes. Figure 2A shows an example of a predictive model 103 using the techniques disclosed herein. In the example of Figure 2A, the predictive model 103 may be a multi-layer neural network, such as a deep neural network (DNN), a convolutional neural network (CNN), etc. The predictive model 103 may include an input layer 207, a set of hidden layers including hidden layers 209 and 211, and an output layer (not shown in Figure 2A).
[0021]
[0028] The layer 207 may process pixel data representing various portions of the image 104. In the example of FIG. 2A, the layer 207 may process pixel data of the image 104. Each processing node of the layer 207 processes pixel values (e.g., x0, x1, x2, ... x3) corresponding to a given pixel in the image 104. n) and are assigned to transmit one or more weights with the received pixel values to layer 209. If the predictive model 203 is a DNN, each processing node of layer 207 may be assigned a set of weights defined based on matrix W1. Each processing node of layer 207 may transmit the received pixel values and assigned weights to each processing node of layer 209. If the predictive model 103 is a CNN, a group of processing nodes of layer 207 may share a set of weights, and each group may transmit the set of weights and pixel values received by the group of processing nodes to a single processing node of layer 209.
[0022]
[0029] Layer 209 may process the scaled outputs from layer 207 to generate a set of intermediate outputs. For example, assuming that processing node 210a of layer 209 is connected to n processing nodes in layer 207, processing node 210a may generate a sum of the scaled outputs received from layer 207 based on the following equation:
[0023]
[0030] JPEG2024116153000002.jpg7113
[0024]
[0031] Here, Sum 210a W1 represents the sum generated by processing node 210a. i x i represents the scaling of a particular pixel value (e.g., x0) with an associated weight (e.g., W10) by a processing node of layer 207. If the predictive model 203 is a DNN, each processing node of layer 209 generates a sum based on the scaling of pixel values from each processing node of layer 207, and then calculates a sum (e.g., Sum 210a ) may be generated. The sum may also represent a dot product between an input vector that includes several elements (e.g., pixel values) and a weight vector (e.g., W1).
[0025]
[0032] On the other hand, if the predictive model 103 is a CNN, each processing node of the layer 209 may generate a sum based on scaling of pixel values from a group of processing nodes of the layer 207. The sum may represent a convolution result between a group of pixel values and a filter including weight values. FIG. 2B shows an example of a convolution operation that the layer 209 may perform. In FIG. 2B, the filter 230 may include a two-dimensional array of weights. The weights of the filter 230 may represent a spatial distribution of pixels for some features to be detected from the image. The two-dimensional array may have a height of R rows and a width of S columns, which is typically smaller than the input image with a height of H pixels and a width of W pixels. Each weight may be mapped to a pixel in a rectangular block of pixel values with the same R rows and S columns. A processing node of layer 209 (e.g., processing node 210a) may receive, from a group of processing nodes of input layer 207, group 240 of pixel values corresponding to a first rectangular block of pixels from the input image, and generate a convolution output 242 based on a sum of multiplication results between each weight of filter 230 and each corresponding pixel in group 240 according to Equation 1 to generate an inner product between the matrix represented by filter 230 and the matrix represented by group 240. Another processing node of layer 209 may receive, from another group of processing nodes of input layer 207, group 244 of pixel values corresponding to a second rectangular block of pixels from the input image, and generate a convolution output 246 based on a sum of multiplication results between each weight of filter 230 and each corresponding pixel in group 244 according to Equation 1 to generate an inner product between the matrix of filter 230 and the matrix represented by group 240. In some examples, each convolution output of FIG. 2B (e.g., convolution output 242, convolution output 246, etc.) may correspond to an output of a processing node of layer 209. In some examples, the pixel data in the input image may be referred to as the input feature map to indicate that the pixels are processed by the same filter (or the same set of filters) that correspond to a particular feature, and the convolution output may be referred to as the output feature map to indicate that the output is the result of processing the input feature map with a filter.
[0026]
[0033] As shown in FIG. 2B, the convolution operations may be arranged in a sliding window such that the second rectangular block overlaps or is otherwise adjacent to the first rectangular block in the input image. For example, in the example of FIG. 2B, D may be the distance (in pixels) of the stride of the sliding window for each convolution operation, such that the block of pixels corresponding to group 244 may be located at a distance D (in pixels) from the block of pixels corresponding to group 240, and the next block of pixels may also be located at the same distance D from group 244. Other processing nodes in layer 209 may also receive groups of pixels corresponding to other rectangular blocks and generate other intermediate outputs. The convolution output may be part of a convolution output array 280 with a height of E rows and a width of F columns. The array of convolution outputs may have a smaller height and a smaller width than the input image. The rectangular blocks of convolution outputs may be further grouped, and a convolution operation may be performed in layer 211 between the group of convolution outputs and another set of filter weights to generate another set of convolution outputs.
[0027]
[0034] In some examples, a convolution operation may be performed between multiple images and multiple filters. For example, with reference to FIG. 2C, a set of C filters 260 may correspond to a number (C) of images 270, and a convolution operation may be performed between each filter in the set of filters 260 and a block of pixels on a corresponding one of the images 270. The convolution results for each filter-image pair may be summed to generate a convolution output as follows:
[0028]
[0035] JPEG2024116153000003.jpg8156
[0029]
[0036] Here, the convolution operation is done on an image (or pixel array) X C eD+r,fD+swhich may refer to the value of a pixel at an image with index c in a number (C) image 370 having a horizontal pixel coordinate of eD+r and a vertical pixel coordinate of fD+s. D is the stride distance of the sliding window, while e and f correspond to the position of the output in the convolution output array, which may correspond to a particular sliding window. Furthermore, r and s correspond to a particular position in the sliding window. A pixel at location (r,s) and an image with index c may be represented by weights W in the corresponding filter of the same index c at the same (r,s) location. c r,s Equation 2 can also be used to express the convolution output 0 e,f To compute, each pixel in the sliding window (indexed by (e,f)) is assigned a corresponding weight W c r,s It is shown that the images may be multiplied by . A partial sum of the multiplication products within each sliding window for each of the images in the image set may be calculated, and then a sum of the partial sums for all images in the image set may be calculated.
[0030]
[0037] Moreover, in some examples, multiple sets of filters can be used to perform a convolution operation on the set of images to generate a set of convolved output arrays, with each convolved output array corresponding to a set of filters. For example, the multiple sets of filters can correspond to multiple image features to be detected from the set of images, with each convolved output array corresponding to a detection result for each image feature from the set of images. For example, if M sets of filters are applied to C images to generate M convolved output arrays, Equation 2 can be updated as follows:
[0031]
[0038] JPEG2024116153000004.jpg8165
[0032]
[0039] Here, the convolution output is 0 e,f m and weight Wc,m r,s has an index m that corresponds to one of the M sets of filters.
[0033]
[0040] FIG. 2D illustrates an example of C sets of input data sets (C=3) to be convolved with M sets of filters (M=2). Each set of input data corresponds to an entry of a pixel group. For example, each of pixel groups 282, 286, and 290 may correspond to one input data set. Each of the M sets of filters includes a set of C filters corresponding to the C sets of input pixel arrays. In the example of FIG. 2D, there are two filter sets, a first filter set includes filter arrays 284a, 284b, and 284c, and a second filter set includes filter arrays 288a, 288b, and 288c. The convolution operation produces M sets of output data sets, each output data set corresponding to a convolution output array. In the example of FIG. 2D, two convolution output arrays 294 and 296 are produced. Each convolution output array corresponds to convolving one set (of the M sets) of filters with the input pixel array. For example, the first element O of the convolution output array 294 0,0 0 may be generated by the sum of the dot products between pixel group 282 and filter array 284a, the dot products between pixel group 286 and filter array 284b, and the dot products between pixel group 290 and filter array 284c.
[0034]
[0041] Referring again to FIG. 2A, one processing node of the layer 209 may be configured to generate one convolution output array, and the set M of processing nodes of the layer 209 may correspond to the set M of convolution output arrays. The processing nodes of the layer 209 may also post-process each convolution output with, for example, an activation function to generate a final output for the layer 209. The activation function may convert the convolution output (or a subsample) into a decision of whether to forward the convolution output (or a subsample) to an upper layer. The generation of the decision may be similar to the firing of a biological neuron. One example of the activation function may be the rectified linear unit (ReLu) defined according to the following equation:
[0035]
[0042] ReLu(y)=max(0,y) (Eq. 4)
[0036]
[0043] The processing nodes of layer 209 (e.g., processing node 210a) may process the convolution output subsamples with a ReLu function to generate intermediate outputs based on Equation 4. In addition, the processing nodes of layer 209 may also perform other post-processing operations, such as pooling operations, to reduce the number of intermediate outputs. Layer 209 may provide the post-processed intermediate outputs to layer 211, which may perform additional convolution operations based on different sets of filters. The outputs from each processing node of layer 211 may be forwarded to other higher intermediate layers, or to an output layer (not shown in FIG. 2A). The output layer may, for example, form an output vector representing the probability that a particular image feature is included in image 104 of FIG. 2A (or the set of images represented by the set of input pixel arrays of FIG. 2D) to determine whether an image or set of images associated with a particular context includes an image of a panda. For example, the output vector may be compared to a reference vector associated with a panda nose object, or a reference vector associated with a panda, and a decision may be made based on the comparison result. Multiple instances of model 103 can be used to process multiple images (or multiple sets of images) associated with multiple contexts to produce decisions for each of the contexts.
[0037]
[0044] FIG. 3A illustrates an apparatus 300 according to some embodiments of the present disclosure. The apparatus 300 may be part of a computer system, e.g., a host server. The apparatus 300 may be part of a multi-tenant computation service system and may communicate with a host device (not shown in FIG. 3A) to provide computational and memory resources to the computation service. For example, referring back to FIG. 1, the apparatus 300 may provide computational and memory resources to computations using the predictive model 103. The host device may run a software application 102 and communicate with the apparatus 300 to perform one or more image recognition tasks based on computations using the predictive model 103. The host device may transmit multiple image datasets associated with multiple contexts and provide the multiple image datasets to the apparatus 300, which may generate multiple outputs, e.g., predict whether each of the multiple image datasets includes a predetermined object.
[0038]
[0045] In the example of FIG. 3A, the apparatus 300 may include a neural network processor 302, a direct memory access (DMA) controller 316, and a host interface 314 coupled to a memory 312 via an interconnect 318. As described in more detail, the neural network processor 302 may provide computational resources to support computations with the predictive model 103. The memory 312 may be configured to store instructions received from a host device, input data (e.g., pixel groups 282, 286, and 290 of FIG. 2D), and weights (e.g., filter arrays 284a, 284b, 284c, 288a, 288b, and 288c). The memory 312 may also be configured to store outputs of the neural network processor 302 (e.g., convolution output arrays 294 and 296 of FIG. 2D). The memory 312 may include any suitable memory, such as, for example, dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate DRAM (DDR DRAM), storage class memory (SCM), flash memory devices, etc.
[0039]
[0046] The DMA controller 316 may be configured to perform DMA operations to transfer data between the neural network processor 302 and the host device. For example, as described above, the host device may store instructions, input data, and weights in the memory 312. The host device may provide memory addresses of the stored instructions, data, and weights (e.g., in the form of memory descriptors) to the neural network processor 302. The neural network processor 302 may then retrieve the stored instructions, data, and weights based on the memory addresses provided by the host device. The neural network processor 302 may also store computation results (e.g., one or more image recognition decisions) in the memory 312 and provide memory addresses of the stored results to the host device.
[0040]
[0047] The host interface 314 may be configured to enable communication between a host device and the neural network processor 302. For example, the host interface 314 may be configured to transmit memory descriptors including memory addresses of stored data (e.g., input data, weights, computation results, etc.) between the host device and the neural network processor 302. The host interface 314 may include, for example, a Peripheral Component Interconnect Express (PCIe) interface, or any suitable interface for communicating with a host device.
[0041]
[0048] The neural network processor 302 can provide computational resources to support computation with one or more instances of the predictive model 103. In the example of FIG. 3A, the neural network processor 302 can include a state buffer 322, a computation engine 324, an output buffer 328, a post processor 329, and a computation controller 330.
[0042]
[0049] The state buffer 322 may be configured to provide caching of data used for computation in the computation engine 324. The data cached in the state buffer 322 may include, for example, input data and weights obtained from the memory 312, as well as intermediate outputs of computation in the computation engine 324. Caching may reduce the impact of memory access bottlenecks (e.g., caused by latencies in the memory 312, the DMA controller 316, the interconnect 318, etc.) on the performance of the computation engine 324. The state buffer 322 may be controlled by the computation controller 330 to pre-fetch a set of weights to the computation engine 324 and then fetch the input data as a sequential stream to the computation engine 324, which performs the computation and generates a sequential stream of intermediate output data. The stream of intermediate output data may be collected in the output buffer 328 and post-processed by the post-processor 329. The post-processed stream of intermediate output data may be stored in the state buffer 322. The intermediate output data may be stored in a location in the state buffer 322 separate from where the input data and weights are stored, e.g., to avoid overwriting input data that has not yet been fetched to the computation engine 324. The state buffer 322 may be an on-chip memory device and may include, for example, a static random access memory (SRAM).
[0043]
[0050] The computation engine 324 may include a set of circuits configured to perform one or more arithmetic operations included in the neural network computation. For example, the computation engine 324 may include a set of multipliers that perform scaling of input data with associated weights, as described above, and a set of adders that generate sums of multiplication results that represent dot products and convolution results. The computation engine 324 may obtain the weights used for scaling from the state buffer 322. As described in more detail below, the computation engine 324 may obtain the input to be scaled from the state buffer 322 or from the output buffer 328.
[0044]
[0051] In some examples, the computation engine 324 may be controlled (e.g., by the computation controller 330) to sequentially perform computations for various neural network layers to reduce the size of the weights stored in the state buffer 322. For example, the computation engine 324 may be controlled to perform arithmetic operations for one neural network layer (e.g., layer 207) in one time period and then perform arithmetic operations for the next neural network layer (e.g., layer 209) in the next time period. In such a configuration, the state buffer 322 may pre-fetch and cache a set of weights for one neural network layer instead of caching multiple sets of weights for multiple neural network layers to support the arithmetic operations in the computation engine 324. As a result, the size required for the state buffer 322 may be reduced, and the chip size as well as the power consumption of the neural network processor 302 may also be reduced. On the other hand, as described above, the state buffer 322 needs to provide storage space for both input data (and weights) and output data for computation of at least one neural network layer computation for one context (e.g., an image, a set of images, audio data, or other data associated with a context) to avoid overwriting input data with output data for the computation.
[0045]
[0052] 3B shows an example of the internal structure of the computation engine 324. The computation engine 324 may include an array of processing elements (PEs) arranged in multiple rows and columns. The PEs in a row are connected to an internal row bus XBUS INTERNAL , but each of the PEs 11, 21, 31, ..., x1 is connected to an external row bus XBUS EXTERNAL Moreover, the PEs in one column are connected to the external circuit via the internal column bus YBUS. INTERNAL PE11, PE12, PE13, . . . PE1y are connected to each other via an external row bus YBUS EXTERNALAs will be explained in more detail below, the external row bus XBUS EXTERNAL and the external row bus YBUS EXTERNAL can be configured, for example, to provide data from state buffer 322 and output buffer 328 to the PE array in order to scale the computational operations for a particular neural network layer.
[0046]
[0053] In some configurations, each column of PEs may perform the scale and sum calculations for one processing node of predictive model 103 (e.g., one of processing nodes 208a, 210a, 212a, etc.), while each row of PEs may perform the scale and sum calculations for one input data set. As an illustrative example, to perform the calculations for layer 209, each of PEs 11, 12, 13, ... 1y in the first row may be connected to an XBUS EXTERNAL 2D. Additionally, each of PEs 11, 21, 31, ..., x1 in the first column can receive elements of filter sets 284a, 284b, and 284c to generate the output of convolution output array 294 in FIG. 2D. Additionally, each of PEs 21, 22, 23, ..., 2y in the second row can receive the pixel values of pixel group 282 in FIG. 2D from XBUS 11, 21, 31, ..., x1 in the first column can receive elements of filter sets 284a, 284b, and 284c to generate the output of convolution output array 294 in FIG. 2D. EXTERNAL2D from the first column, while each of the PEs 12, 22, 32, ...x2 in the second column can receive elements of filter sets 288a, 288b, and 288c to generate the output of the convolution output array 296 in FIG. 2D. Each of the PEs includes a multiplier that performs a multiplication function between the received pixel value and the received weight to generate a multiplication result. In addition, each of the PEs also includes an adder that accumulates the multiplication results within one column of the PEs. For example, PE11 generates a first multiplication result based on a first pixel value and a first weight, and passes the first multiplication result to PE21 via the YBUS. PE21 generates a second multiplication result based on a second pixel value and a second weight, adds the second multiplication result to generate a partial sum, and passes the partial sum to PE31 via another YBUS. Other PEs in the same column as PE11, 21, and 31 also perform multiplication and accumulation. PEx1 then generates the convolution output 242 and sends it to YBUS EXTERNAL The convolution output can be sent via
[0047]
[0054] In some configurations, the PEs of the computation engine 324 can be used to implement multiple instances of the predictive model 103. For example, when processing higher-level layers with a small number of processing nodes and a small number of input data, PEs in the same row can be used to process input data sets of different contexts (corresponding to different images or different sets of images captured by different people at different locations, times, or otherwise conveying different information). For example, PE11 may be configured to process one input data set of a first context, while PE12 may be configured to process another input data set of a second context. Both PE11 and PE12 can store the same set of weights and apply the same set of weights to the input data. A first row (including PE11, 21, ... x1) may be configured to process multiple input data sets of the first context, while a second row (including PE12, 22, ... x2) may be configured to process multiple input data sets of the second context.
[0048]
[0055] 3C shows an example of the internal structure of a PE 340, which may be any one of the PEs described in FIG. 3B. The PE 340 may include a splitter 350, a multiplier 353, and an adder 356. The splitter 350 receives an input XBUS (e.g., INPUT ) and extracts input values and weights. For example, PE11 can receive a set of data from XBUS IN The splitter 350 of PE11 can receive a set of input values and weights for not only PE11 but also other PEs in the same row from the XBUS. IN The adder 356 can extract the input value (e.g., IN351) and the weight value (e.g., W352) for the PE11 from the above data and provide the extracted value to the multiplier 353 to generate the multiplication result (e.g., M354). INPUT ) to the multiplication result (e.g., M354) to generate the partial sum, and output it to the output YBUS (e.g., YBUS OUTPUT ) to the next PE in the same column. The PE can send the partial sum to the next PE in the same column via the output XBUS ( OUTPUT ) to the next PE in the same row via XBUS IN You can also transfer data.
[0049]
[0056] Referring again to FIG. 3A, the neural network processor 302 further includes an output buffer 328 and a post-processor 329. The output buffer 328 includes a set of registers that store the output of the computation engine 324. The post-processor 329 may include circuitry (e.g., a multiplexer circuit configured as a mapping table) that applies one or more activation functions (e.g., a ReLu function) to the output of the computation engine 324. The post-processor 329 may also include circuitry that performs a pooling operation to reduce the size of the output. The post-processor 329 may store the post-processed output in the state buffer 322.
[0050]
[0057] The calculation controller 330 is an XBUS EXTERNAL and YBUS EXTERNAL The computation controller 330 may control the computation in the computation engine 324 by determining input data and weights to be provided to the computation engine 324 via the XBUS. For example, the computation controller 330 may control the computation engine 324 to sequentially perform computations for each neural network layer by providing input data and weights associated with each neural network layer at various times. As an illustrative example, as a first step, the computation controller 330 may obtain input pixel data and weights associated with a scaling operation in layer 209 and transmit the input pixel data and weights to the computation engine 324 via the XBUS. EXTERNAL The input pixel data and weights can be provided to the computation engine 324 via the YBUS. The computation engine 324 then generates the output and EXTERNAL , to the activation engine 326 via 210a ) may be generated. The intermediate output may be stored in an output buffer 328. If the subsequent calculation is for the same input data set in the next layer (e.g., layer 211), the calculation controller 330 retrieves the intermediate outputs stored in the output buffer 328 and transfers them to the XBUS 316 from the state buffer 322 to start the calculation in layer 211. EXTERNAL The intermediate outputs as well as the new set of weights can be provided to the computation engine 324 via the computation controller 330. On the other hand, if the intermediate outputs are not used in subsequent computations, the computation controller 330 can store the intermediate outputs in the state buffer 322. The process can be repeated for each layer until the computations at the output layer are completed. The order of computations can be determined by a scheduler module 332 that operates a pre-determined scheduling scheme described below.
[0051]
[0058] As described above, in DNNs and CNNs, the size of a higher level hidden layer is usually smaller than the size of a lower level hidden layer. Thus, as the neural network calculation proceeds through the neural network layers toward the output layer, the computational resources used for the calculation for the layer may decrease over time. Referring to the example of FIG. 3B, the layer 209 may include the same number of processing nodes as the number of PE columns in the computation engine 324. Thus, when performing the calculation for the layer 209, every column in the computation engine 324 is involved in the calculation, and each column of PEs generates an output corresponding to one processing node of the layer 209. However, if the layer 211 has only half of the processing nodes of the layer 209, half of the columns of PEs are not required for the calculation and may be idle, leading to an insufficient utilization of the computation engine 324. To improve the utilization of the computation engine 324, the computation controller 330 may control the computation engine 324 to process multiple input data sets (e.g., multiple images or other contexts) and generate multiple outputs for the multiple input data sets, as described above.
[0052]
[0059] Referring now to Figure 4, Figure 4 shows an example of a sequence 400 for operating the computation engine 324 to process multiple input data sets. The blocks on the left side show a sequence of computations in the computation engine 324, while the blocks on the right side show a corresponding sequence of intermediate outputs stored in the state buffer 322. The storage of weights in the state buffer 322 is not shown in Figure 4.
[0053]
[0060] In some examples, the sequence 400 can be executed to operate the computation engine 324 in a lock-step manner. For example, computations for lower-level neural network layers can be executed sequentially for each input data set (when computational resource requirements are substantial and the computation engine 324 is fully utilized). After the computations for one neural network layer for all input data sets (of various contexts) are completed, the computation engine 324 then executes the computations for the next neural network layer. When the computations reach higher-level neural network layers with reduced computational resource requirements, the computation controller 330 can execute parallel computations on the input data sets to maintain the utilization of the computation engine 324. As described herein and depicted in the figures, "C-1" may refer to the first context, "C-2" may refer to the second context, "C-3" may refer to the third context, and "C-4" may refer to the fourth context.
[0054]
[0061] At T0, the computation controller 330 can control the computation engine 324 to perform the L0 neural network layer (e.g., layer 209) computation for C-1, thereby fully utilizing the computation engine 324. At T0, the state buffer 322 needs to provide storage space to store the input data (and weights) for the C-1 L0 computation as well as the output data of the C-1 L0 computation.
[0055]
[0062] After the L0 neural network layer calculation for C-1 is completed at T1, the calculation controller 330 can store the output data of the L0 calculation for C-1 in the state buffer 322, and then control the calculation engine 324 to execute the L0 neural network layer calculation for C-2. At T1, the state buffer 322 needs to provide storage space to store the input data and output data of the ongoing L0 calculation for C-2, and the output data of the completed L0 calculation for C-1.
[0056]
[0063] At T2, the computation controller 330 can control the computation engine 324 to execute the L0 neural network layer computation for C-3. At T2, the state buffer 322 needs to provide storage space to store the input and output data of the ongoing L0 computation for C-3 and the output data of the completed L0 computation for C-1 and C-2.
[0057]
[0064] At T3, the computation controller 330 can control the computation engine 324 to execute the L0 neural network layer computation for C-4. At T3, the state buffer 322 needs to provide storage space to store the input and output data of the ongoing L0 computation for C-4 and the output data of the completed L0 computation for C-1, C-2, and C-3.
[0058]
[0065] At T4, the computation controller 330 can switch the computation engine 324 to perform L1 neural network layer computation (e.g., layer 211). The computation controller 330 can control the computation engine 324 to perform L1 computation for C-1 and C-2 in parallel. At T4, the state buffer 322 needs to provide storage space to store the output data of the ongoing L1 computation for C-1 and C-2, and the output data of the completed L0 computation for C-1, C-2, C-3, and C-4. The total size of the data stored at T4 may be the largest compared to other stages of the sequence 400.
[0059]
[0066] At T5, the computation controller 330 can control the computation engine 324 to perform L1 computation for C-3 and C-4. At T5, the state buffer 322 needs to provide storage space to store the output data of the ongoing L1 computation for C-3 and C-4, as well as the output data of the completed L0 computation for C-3 and C-4. Because the L1 computation for C-1 and C-2 is completed at T5 and their output data is not needed, the output data of the completed L0 computation for C-1 and C-2 can be deleted (or overwritten by the output data of the L1 computation for C-3 and C-4).
[0060]
[0067] At T6, the computation controller 330 can switch the computation engines 324 to perform L2 neural network layer computations (e.g., output layer). The computation controller 330 can control the computation engines 324 to perform L2 computations for C-1, C-2, C-3, and C-4 in parallel. At T6, the state buffer 322 needs to provide storage space to store output data of ongoing L2 computations for C-1, C-2, C-3, and C-4, as well as input data for those computations (e.g., output data of L1 computations for C-1, C-2, C-3, and C-4).
[0061]
[0068] 4 allows the computation engine 324 to be kept at full capacity, but requires a large state buffer 322 to store the output of the low-level neural network (e.g., L0) computations for multiple contexts, such as time T4. These intermediate outputs are typically large in size and require a significant amount of on-chip memory space for storage.
[0062]
[0069]
[0033] Referring now to Figure 5, Figure 5 illustrates an example sequence 500 for operating the computation engines 324 to process multiple input data sets. The sequence 500 can be performed to operate the computation engines 324 in a non-lock-step manner. The blocks on the left side illustrate a sequence of computations in the computation engines 324, while the blocks on the right side illustrate a corresponding sequence of intermediate outputs stored in the state buffer 322. The storage of weights in the state buffer 322 is not shown in Figure 5.
[0063]
[0070] At T0, the computation controller 330 can control the computation engine 324 to perform the L0 neural network layer (e.g., layer 209) computation for C-1, thereby fully utilizing the computation engine 324. At T0, the state buffer 322 needs to provide storage space to store the input data (and weights) for the C-1 L0 computation as well as the output data of the C-1 L0 computation.
[0064]
[0071] After the L0 neural network layer calculation for C-1 is completed at T1, the calculation controller 330 can store the output data of the L0 calculation for C-1 in the state buffer 322, and then control the calculation engine 324 to execute the L0 neural network layer calculation for C-2. At T1, the state buffer 322 needs to provide storage space to store the input data and output data of the ongoing L0 calculation for C-2, and the output data of the completed L0 calculation for C-1.
[0065]
[0072] At T2, the computation controller 330 can switch the computation engine 324 to perform the L1 neural network layer computations (e.g., layer 211) for C-1 and C-2. At T2, the state buffer 322 needs to provide storage space to store input data for the ongoing L1 computations (e.g., output data of the L0 computations for C-1 and C-2), as well as output data generated by the L1 computations.
[0066]
[0073] At T3, the computation controller 330 can once again switch the computation engine 324 to perform the L0 neural network layer computation for C-3. At T3, the state buffer 322 needs to provide storage space to store the output data of the completed L1 computation for C-1 and C-2, as well as the input and output data for the ongoing L0 computation for C-3.
[0067]
[0074] At T4, the computation controller 330 can control the computation engine 324 to execute the L0 neural network layer computation for C-4. At T4, the state buffer 322 needs to provide storage space to store the output data of the completed L1 computation for C-1 and C-2, the output data of the completed L0 computation for C-3, and the input data and output data for the ongoing L0 computation for C-4. Compared to T4 in the sequence 400, the required size of the state buffer 322 can be reduced by storing the L0 output data for fewer contexts (usually larger than the upper neural network layers).
[0068]
[0075] At T5, the computation controller 330 can control the computation engines 324 to execute the L1 neural network computations for C-3 and C-4 in parallel. At T5, the state buffer 322 needs to provide storage space to store the output data of the completed L1 computations for C-1 and C-2, and the input and output data for the ongoing L1 computations for C-3 and C-4. The input data for the ongoing L1 computations for C-3 and C-4 includes the output data of the completed L0 computations for C-3 and C-4.
[0069]
[0076] At T6, the computation controller 330 can switch the computation engines 324 to perform L2 neural network layer computations (e.g., output layer). The computation controller 330 can control the computation engines 324 to perform L2 computations for C-1, C-2, C-3, and C-4 in parallel. At T6, the state buffer 322 needs to provide storage space to store output data of ongoing L2 computations for C-1, C-2, C-3, and C-4, as well as input data for those computations (e.g., output data of L1 computations for C-1, C-2, C-3, and C-4).
[0070]
[0077] 6 illustrates an example flow diagram of a process 600 for processing multiple data sets associated with different contexts in a multi-layer neural network according to some aspects of the disclosure. The multi-layer neural network may include a first neural network layer (e.g., layer 209), a second neural network layer (e.g., layer 211) that depends on the first neural network layer, and a third neural network layer (e.g., output layer) that depends on the second neural network layer. The process may be implemented by various systems described above, such as, for example, the computational controller 330 and the computational engine 324.
[0071]
[0078] In operation 602, a computational engine (e.g., computational engine 324) may be configured as a first neural network layer to process a first dataset (e.g., of a first context) to generate a first layer output for the first dataset.
[0072]
[0079] At operation 604, the computational engine, while configured as a first neural network layer, may process a second dataset (e.g., of a second context) to generate a first layer output for the second dataset.
[0073]
[0080] In operation 606, the computational engine may be configured as a second neural network layer and process the first layer output of the first dataset and the first layer output of the second dataset to generate a second layer output of the first dataset (in the first context) and a second layer output of the second dataset (in the second context), respectively.
[0074]
[0081] At operation 608, the computational engine is configured to return to the first neural network layer after generating the second layer output for the first dataset and the second layer output for the second dataset at operation 606, and the computational engine can process a third dataset (e.g., for a third context) to generate a first layer output for the third dataset.
[0075]
[0082] At operation 610, the computational engine, while configured as a first neural network layer, may process a fourth dataset (e.g., for a fourth context) to generate a first layer output for the fourth dataset.
[0076]
[0083] In operation 612, the computational engine may be configured as a second neural network and may process the first layer output of the third data set (for the third context) and the first layer output of the fourth data set (for the fourth context) to generate a second layer output of the third data set and a second layer output of the fourth data set, respectively.
[0077]
[0084] In operation 614, the computational engine may be configured as a third neural network and may process the second layer output of the first dataset (for the first context), the second layer output of the second dataset (for the second context), the second layer output of the third dataset (for the third context), and the second layer output of the fourth dataset (for the fourth context) to generate a third layer output of the first dataset, a third layer output of the second dataset, a third layer output of the third dataset, and a third layer output of the fourth dataset, respectively.
[0078]
[0085] In some examples, rearrangement of the order of computation from a lock-step sequence (e.g., of FIG. 4) to a non-lock-step sequence (e.g., of FIG. 5) may be based on a scheduling scheme. The scheduling scheme may be used to determine a sequence of execution batches, each execution batch including one or more computation tasks for a neural network layer to execute in parallel in the computation engine 324. Each computation task may be executed for a context, and each of the execution batches is executed at different times. The objective of the scheduling scheme may be to maximize each execution batch size (e.g., the number of parallel computation tasks executed), subject to the constraints of available space in the state buffer 322 as well as inter-layer data dependencies.
[0079]
[0086] In some examples, the scheduler module 332 of the computation controller 330 can apply a graph reduction scheme to determine a graph of dependencies between computations of various neural network layers for various contexts. The scheduler module 332 can then traverse the graph starting from the computations of higher neural network layers and determine the sequence of computation tasks. The determination can be based on the number of parallel computation tasks that the state buffer can support and the inter-layer data dependencies. As described above, to support parallel execution of several computation tasks of a neural network layer, the state buffer needs to have sufficient capacity to store both input data and output data of several computation tasks. After determining the first execution batch size for the first neural network layer (e.g., layer 211 of FIG. 2A), the scheduler module 332 can traverse the dependency graph and determine whether the state buffer can support several computation tasks for a second neural network layer (e.g., layer 209 of FIG. 2A) that provides input data to the first neural network layer. If the state buffer cannot support some of the computation tasks for the second neural network layer, the scheduler may divide some of the computation tasks for the second neural network layer into multiple execution batches. The determination of the multiple execution batches may be to maximize the number of parallel computation tasks for the second neural network layer in each execution batch, under the constraint that the state buffer has sufficient capacity to store the output data of the previous execution batch as well as the input / output data of the ongoing execution batch. After determining the execution batches for the second neural network layer, the scheduler may traverse the dependency graph to determine computation tasks for a third neural network (e.g., layer 207 in FIG. 2A) that provides input data for the second neural network layer, and repeat the execution batches until the determination operation, under the constraint of the state buffer capacity described above.
[0080]
[0087] 7A-7G, which illustrate an example of a scheduling scheme. FIG. 7A illustrates an example of a dependency graph of neural network layer computations for contexts C-1, C-2, C-3, and C-4 of FIGS. 4 and 5. In this example, it can be assumed that the computation engine 324 imposes no constraints on the number of computational tasks that can be executed simultaneously, with the only constraints arising from inter-layer dependencies and the capacity of state buffers. In this illustrative example, the size of the state buffers may be 2 units.
[0081]
[0088] In the example of FIG. 7A, each bubble (i.e., circle) may correspond to an external input for a computation task or context of a neural network layer, and the number in the bubble indicates the size of the output data to be generated by the computation task, or the size of the external input data. The size of the output data (or the external input data) is related to the size of the state buffer, both in the same units. Each execution batch may include one or more bubbles of the same neural network layer. Paired bubbles are linked by respective arrows whose direction indicates data dependency. The number adjacent to the arrow may indicate the size of the weight value used for the computation task of the neural network layer. The weight value may be shared between bubbles in one execution batch. Referring to the dependency graph of the context C-1, the L0 (neural network layer 0) computation task may receive image data of size 0.5 units as an external input, and weights of size 0.3 units as input data. The L0 computation task may generate output data of size 0.3 units. The L1 (neural network layer 1) computation task can receive as input data the output data of the L0 computation task (with a size of 0.3 units) and weights with a size of 0.25 units. Furthermore, the L2 (neural network layer 2) computation task can receive as input data the output data of the L1 computation task (with a size of 0.2 units) and weights with a size of 0.1 units. Moreover, the L2 computation task can generate output data with a size of 0.1 units.
[0082]
[0089] FIG. 7B illustrates a scheduling operation 702. In operation 702, the scheduler determines a first batch size for L2 computation. To support concurrent L2 computation for C-1, C-2, C-3, and C-4, the state buffer needs to have the capacity to store the input and output data of the concurrent L2 computation. The input data includes L1 output data for four contexts with a total size of 0.8 units (0.2×4) and a shared weight of 0.1 units, while the output data size is 0.4 units (0.1×4). The required capacity is 1.3 units (0.8+0.4+0.1), which is less than the capacity of the state buffer (2 units). Based on this, the scheduler can include L2 computation tasks for all four contexts in the first execution batch to be executed at time T1.
[0083]
[0090] 7C and 7D show a scheduling operation 704. In operation 704, the scheduler determines whether the L1 computations of the four contexts can be executed in the second execution batch. The scheduler can determine whether the state buffer has the capacity to store the input data and output data of the simultaneous L1 computations for all four contexts. Referring to FIG. 7C, the input data includes L0 output data for four contexts with a total size of 1.2 units (0.3×4) and a shared weight with a size of 0.25 units, but the output data size is 0.8 units (0.2×4). The required capacity is 2.25 units (1.2+0.8+0.25), which exceeds the capacity of the state buffer. Based on this determination, the scheduler can divide the L1 computations into two or more execution batches. For example, the scheduler may determine the number of L1 computational tasks that can be included in an execution batch based on the state buffer having sufficient capacity to store input data and output data of several L1 computational tasks in that execution batch, as well as output data of L1 computational tasks of previous execution batches.
[0084]
[0091] As an illustrative example, referring to FIG. 7D, the scheduler may determine a second execution batch including L1 computation tasks for C-2 and C-3, and a third execution batch including L1 computation tasks for C-1 and C-2. The third execution batch should be executed before the second execution batch. The total input / output data size of the second execution batch may be 1.25 units (0.2×2+0.3×2+0.25), while the output data size of the third execution batch is 0.4 units (0.2×2). Based on the total data size (1.65 units) being smaller than the capacity of the state buffer, the scheduler schedules the second execution batch at time T2 and the third execution batch at time T3.
[0085]
[0092] 7E and 7F show a scheduling operation 706. In operation 706, the scheduler determines whether the L0 calculations for C-2 and C-3 can be executed in parallel as a single batch (to provide input data for the second execution batch). Referring to FIG. 7E, in order to support the parallel L0 calculations for C-2 and C-3 to be executed between times T1 and T2 (to avoid the state buffer needing to store the output of the L0 calculations for C-1, C-2, C-3, and C-4), the state buffer needs to store the input-output data of the parallel L0 calculations for C-2 and C-3, as well as the output data of the third execution batch. The total input-output data size of the L0 calculations for C-2 and C-3 is 1.9 units (0.5×2+0.3×2+0.3), while the output data size of the third execution batch is 0.4 units. Based on the total data size (2.3 units) exceeding the capacity of the state buffer, the scheduler decides to split the L0 calculations into two batches. For example, referring to Figure 7F, the scheduler may determine a fourth execution batch including L0 calculations for C-4 and a fifth execution batch including L0 calculations for C-3. The scheduler may also determine that the state buffer has sufficient capacity to store the input data and output data for the fourth execution batch (having a data size of 1.3 units), the output data for the fifth execution batch (having a data size of 0.3 units), and the output data for the third execution batch (having a data size of 0.4 units), all of which have a total data size of 2 units. The scheduler may then schedule the fourth execution batch at time T4 and the fifth execution batch at time T5.
[0086]
[0093] FIG. 7G illustrates a scheduling operation 708. In operation 708, the scheduler determines whether the L0 computations for C-1 and C-2 can be executed in parallel as a single batch (to provide input data for the third execution batch). Referring to FIG. 7G, in order to support the parallel L0 computations for C-1 and C-2 to be executed before the execution batch determined in operations 702-706, the state buffer needs to store input / output data for the parallel L0 computations for C-1 and C-2. The total input / output data size of the L0 computations for C-1 and C-2 is 1.9 units (0.5×2+0.3×2+0.3), which is below the capacity of the state buffer. The scheduler can then include the L0 computations for C-1 and C-2 in the sixth execution batch and schedule the sixth execution batch at T6.
[0087]
[0094] 8 illustrates an example flow diagram of a process 800 for scheduling operations in a computation engine (e.g., computation engine 324) coupled with a memory device (e.g., state buffer 322). The process may be implemented by various systems described above, such as, for example, scheduler module 332 of neural network processor 302.
[0088]
[0095] In operation 802, the scheduler module may determine a set of computational tasks to be executed, the set of computational tasks including a first computational task, a second computational task, a third computational task, and a fourth computational task, where the third computational task and the fourth computational task generate input data for the first computational task and input data for the second computational task, respectively.
[0089]
[0096] In operation 804, the scheduling module may determine a first execution batch including the first computational task and the second computational task based on the state buffer having sufficient capacity to hold input / output data of both the first computational task and the second computational task.
[0090]
[0097] At operation 806, the scheduling module may determine whether the memory device has sufficient capacity to hold the input and output data of both the third and fourth computational tasks. If the memory device has sufficient capacity to hold the input and output data of both the third and fourth computational tasks (at operation 808), the scheduling module may at operation 810 determine a second execution batch including the third and fourth computational tasks and schedule the second execution batch to be executed before the first execution batch.
[0091]
[0098] On the other hand, if the memory device does not have sufficient capacity to hold the input and output data of both the third and fourth computational tasks (at Operation 808), but does have sufficient capacity to hold the output data of the third computational task and the input and output data of the fourth computational task (at Operation 812), the scheduling module may determine a third execution batch including the third computational task, at Operation 814. The scheduling module may also determine a fourth execution batch including the fourth computational task, at Operation 816. The scheduling module may schedule the third execution batch to be executed first, followed by the fourth execution batch, followed by the first execution batch.
[0092]
[0099] In the example process 800, the first and second computational tasks may be second neural network layer computational tasks for the first and second contexts, respectively. Moreover, the third and fourth computational tasks may be first neural network layer computational tasks for the first and second contexts, respectively.
[0093]
[0100] 9 illustrates an example of a computing device 900. The functionality and / or some components of the computing device 900 may be used without limitation with other embodiments disclosed elsewhere in this disclosure. The computing device 900 may perform computations to facilitate processing of tasks. As an illustrative example, the computing device 900 may be part of a server in a multi-tenant computing service system. Various hardware and software resources of the computing device 900 (e.g., hardware and software resources associated with providing image recognition services) may be allocated to clients on demand.
[0094]
[0101] In one example, computing device 900 may include processing logic 902, a bus interface module 908, a memory 910, and a network interface module 912. These modules may be hardware modules, software modules, or a combination of hardware and software. In some examples, the modules may be used interchangeably with components or engines without departing from the scope of the present disclosure. Computing device 900 may include additional modules not illustrated herein. In some implementations, computing device 900 may include fewer modules. In some implementations, one or more modules may be combined into one module. One or more modules may be in communication with each other via a communication channel 914. The communication channel 914 may include one or more buses, meshes, matrices, fabrics, combinations of these communication channels, or some other suitable communication channel.
[0095]
[0102] The processing logic 902 may include one or more integrated circuits, which may include an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a system on a chip (SoC), a network processing unit (NPU), a processor configured to execute instructions, or any other circuit configured to perform logical and floating point operations. Examples of processors that may be included in the processing logic 1102 may include processors developed by ARM®, MIPS®, AMD®, Intel®, Qualcomm®, and the like. In some implementations, a processor may include multiple processing cores, and each processing core may be configured to execute instructions independently of the other processing cores. Furthermore, in some implementations, each processor or processing core may implement multiple processing threads that execute instructions on the same processor or processing core while maintaining logical separation between the multiple processing threads. Such processing threads executing on a processor or processing core may be exposed to software as separate logical processors or processing cores. In some implementations, multiple processors, processing cores, or processing threads executing on the same core may share certain resources, such as, for example, a bus, a level 1 (L1) cache, and / or a level 2 (L2) cache. The instructions executed by the processing logic 902 may be stored in a computer-readable storage medium, for example, in the form of a computer program. The computer-readable storage medium may be non-transitory. In some cases, the computer-readable medium may be part of the memory 910. The processing logic 902 may also include hardware circuitry for performing artificial neural network calculations, including, for example, the SoC 302.
[0096]
[0103] Access to the processing logic 902 can be granted to a client to provide a personal assistant service requested by the client. For example, the computing device 900 can host a virtual machine capable of executing an image recognition software application. The image recognition software application, when executed, can access the processing logic 902 to, for example, predict objects contained in an image. As another example, access to the processing logic 902 can also be granted as part of a bare metal instance, where an image recognition software application running on a client device (e.g., a remote computer, a smartphone, etc.) can directly access the processing logic 902 to perform recognition of an image.
[0097]
[0104] Memory 910 may include volatile or non-volatile, or both volatile and non-volatile types of memory. Memory 910 may include, for example, random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory, and / or some other suitable storage medium. In some cases, some or all of memory 910 may be internal to computing device 900, and in other cases, some or all of memory may be external to computing device 900. Memory 910 may store an operating system including executable instructions that, when executed by processing logic 902, provide an execution environment for executing instructions that provide computing device 900 with network functionality. Memory 910 may also store software applications, for example, for performing artificial neural network calculations. For example, memory 910 may store software routines associated with the calculation of Equations 1-4 above. If processing logic 902 is in the form of an FPGA, memory 910 may store netlist data representing various logic circuit components of processing logic 902.
[0098]
[0105] The bus interface module 908 may enable communication with external entities, such as a host device and / or other components within the computing system, via an external communication medium. The bus interface module 908 may include a physical interface for connecting to a cable, socket, port, or other connection to the external communication medium. The bus interface module 908 may further include hardware and / or software for managing incoming and outgoing transactions. The bus interface module 908 may implement a local bus protocol, such as a Peripheral Component Interconnect (PCI)-based protocol, Non-Volatile Memory Express (NVMe), Advanced Host Controller Interface (AHCI), Small Computer System Interface (SCSI), Serial Attached SCSI (SAS), Serial AT Attachment (SATA), Parallel ATA (PATA), some other standard bus protocol, or a proprietary bus protocol. The bus interface module 908 may include a physical layer for any of these bus protocols, including connectors, power management, and error handling, among others. In some implementations, the computing device 900 may include multiple bus interface modules for communicating with multiple external entities. These multiple bus interface modules may implement the same local bus protocol, different local bus protocols, or a combination of the same and different bus protocols.
[0099]
[0106] The network interface module 912 may include hardware and / or software for communicating with a network. The network interface module 912 may include, for example, a physical connector or port for a wired connection to a network and / or an antenna for wireless communication to a network. The network interface module 912 may further include hardware and / or software configured to implement a network protocol stack. The network interface module 912 may communicate with a network using, for example, a network protocol such as TCP / IP, InfiniBand, RoCE, Institute of Electrical and Electronics Engineers (IEEE) 802.11 wireless protocol, User Datagram Protocol (UDP), Asynchronous Transfer Mode (ATM), Token Ring, Frame Relay, High-Level Data Link Control (HDLC), Fiber Distributed Data Interface (FDDI), and / or Point-to-Point Protocol (PPP), among others. In some implementations, the computing device 900 may include multiple network interface modules, each configured to communicate with a different network. For example, in these implementations, the computing device 900 may include a network interface module for communicating with a wired Ethernet network, a wireless 802.11 network, a cellular network, an InfiniBand network, etc. In some embodiments, the computing device 900 may receive a set of parameters, such as the aforementioned weight vectors for generating the forget gate coefficients, input coefficients, output coefficients, etc., from a server via the network interface module 912.
[0100]
[0107] The various components and modules of computing device 900 described above may be implemented as discrete components, as a system on a chip (SoC), as an ASIC, as an NPU, as an FPGA, or any combination thereof. In some embodiments, the SoC or other components may be communicatively coupled to another computing system to provide various services such as traffic monitoring, traffic shaping, computing, etc. In some embodiments of the present technology, the SoC or other components may include multiple subsystems as disclosed herein.
[0101]
[0108] The modules described herein may be software modules, hardware modules, or a suitable combination thereof. When the modules are software modules, they may be embodied on a non-transitory computer-readable medium and processed by any processor of the computer system described herein. It should be noted that the described processes and architectures may be executed in either real-time or asynchronous mode, prior to any user interaction. The modules may be organized in the manner suggested in FIG. 9, and / or the functionality described herein may be provided by one or more modules existing as separate modules, and / or the module functionality described herein may be spread across multiple modules.
[0102]
[0109] The specification and drawings are accordingly to be regarded in an illustrative rather than a restrictive sense, however it will be apparent that various modifications and changes may be made therein without departing from the broader spirit and scope of the present disclosure as set forth in the appended claims.
[0103]
[0110] Other variations are within the spirit of the present disclosure. Thus, the disclosed techniques are susceptible to various modifications and alternative constructions, several illustrated embodiments of which are shown in the drawings and described in detail above. It should be understood, however, that there is no intention to limit the disclosure to the specific form or forms disclosed, but on the contrary, the intention is to cover all modifications, alternative constructions, and equivalents that are within the spirit and scope of the present disclosure, as defined in the appended claims. Some exemplary embodiments are described by the following clauses. 1. A method for processing multiple data sets in a multi-layer neural network, the multi-layer neural network comprising a first neural network layer, a second neural network layer that processes an output generated by the first neural network layer, and a third neural network layer that processes an output generated by the second neural network layer, the method comprising: storing the first data set in a memory; processing the first data set from the memory to generate a first layer output for the first data set using a first neural network layer; storing a first layer output of a first dataset in a memory; Deleting the first data set from the memory; appending a second dataset to a first layer output of a first dataset stored in a memory; processing a second data set from the memory to generate a first layer output for the second data set using the first neural network layer; adding the first layer output of the second data set to the first layer output of the first data set stored in the memory; Deleting the second data set from the memory; and processing the first layer output of the first data set and the first layer output of the second data set from the memory to generate, using a second neural network layer, a second layer output of the first data set and a second layer output of the second data set, respectively; storing the second layer output of the first data set and the second layer output of the second data set in a memory; removing the first layer output of the first data set and the first layer output of the second data set from the memory; appending a third dataset to the second layer output of the first dataset and the second layer output of the second dataset stored in the memory; processing a third dataset from the memory to generate a first layer output of a third dataset after a second layer output of the first dataset and a second layer output of the second dataset have been generated using the first neural network layer; storing the first layer output of the third dataset in a memory; and Removing the third data set from the memory; and appending a fourth dataset to the second layer output of the first dataset, the second layer output of the second dataset, and the first layer output of the third dataset stored in the memory; processing a fourth data set from the memory to generate a first layer output for the fourth data set using the first neural network layer; adding the first layer output of the fourth dataset to the first layer output of the third dataset, the second layer output of the first dataset, and the second layer output of the second dataset stored in the memory; removing the fourth data set from the memory; and processing the first layer output of the third data set and the first layer output of the fourth data set to generate a second layer output of the third data set and a second layer output of the fourth data set, respectively, using a second neural network layer; adding the second layer output of the third dataset and the second layer output of the fourth dataset to the second layer output of the first dataset and the second dataset stored in the memory; processing the second layer output of the first dataset, the second layer output of the second dataset, the second layer output of the third dataset, and the second layer output of the fourth dataset from the memory to generate a third layer output of the first dataset, a third layer output of the second dataset, a third layer output of the third dataset, and a third layer output of the fourth dataset, respectively, using a third neural network layer; storing the third layer output of the first dataset, the third layer output of the second dataset, the third layer output of the third dataset, and the third layer output of the fourth dataset in a memory; A method comprising: 2. The method of clause 1, wherein the second layer output of the first dataset and the second layer output of the second dataset are stored in memory by at least overwriting the first layer output of the first dataset stored in memory. 3. The method of any preceding clause, further including controlling the memory to provide space to simultaneously store the fourth dataset, the first layer output of the fourth dataset, the first layer output of the third dataset, the second layer output of the first dataset, and the second layer output of the second dataset. 4. The method of any preceding clause, wherein a data size of the first layer output of the first dataset is greater than a data size of the second layer output of the first dataset, and a data size of the second layer output of the first dataset is greater than a data size of the third layer output of the first dataset. 5. A method for processing data, comprising: configuring a computational engine in a first configuration to implement a first layer of a neural network; processing first data associated with the first context using a computational engine in the first arrangement to generate a first layer output for the first context; configuring the computational engine in the second configuration to implement a second layer of the neural network; processing the first data of the first context using a computation engine in the second arrangement to generate a second layer output of the first context; switching the computation engine from the second configuration back to the first configuration; processing second data associated with the second context using a computational engine in the first arrangement to generate a first layer output for the second context; configuring the computation engine to revert to a second configuration to implement a second layer of the neural network; processing the first layer output of the second context in the second configuration to generate a second layer output of the second context; configuring the computational engine in the third configuration to implement a third layer of the neural network; processing the second layer output of the first context and the second layer output of the second context using a computation engine in the third configuration to generate a third layer output of the first context and a third layer output of the second context; A method comprising: 6. processing third data related to a third context using a computational engine in the first arrangement to generate a first layer output for a third context; processing the first layer output of the third context and the first layer output of the first context using a computation engine in the second configuration to generate a second layer output of the third context and a second layer output of the first context, respectively; The method of clause 5, further comprising: 7. storing the first layer output of the first context and the first layer output of the third context in a memory device; configuring a first portion of the computational engine to receive as an input a first layer output of a first context from a memory device; configuring a second portion of the computational engine to receive as an input the first layer output of a third context from the memory device; processing a first layer output of a first context using a first portion of a computational engine; using a second portion of the computational engine to process the first layer output in a third context; and The method of clause 6, further comprising: 8. The method of clause 7, wherein the processing of the first layer output of the first context using the first portion of the computational engine and the processing of the first layer output of the third context using the second portion of the computational engine are performed in parallel. 9. Processing fourth data related to the fourth context using the computational engine in the first arrangement to generate a first layer output for the fourth context; processing the first layer output of the second context and the first layer output of the fourth context using a computation engine in the second configuration to generate a second layer output of the second context and a second layer output of the fourth context, respectively; 9. The method of any of clauses 5 to 8, further comprising: 10. storing the first layer output of the second context and the first layer output of the fourth context in a memory device; configuring a first portion of the computational engine to receive as an input a first layer output of a second context from a memory device; configuring a second portion of the computational engine to receive as an input the first layer output of the fourth context from the memory device; processing the first layer output of the second context using a first portion of the computational engine; using a second portion of the computational engine to process the first layer output of the fourth context; and 10. The method of clause 9, further comprising: 11. The method of clause 10, wherein the processing of the first layer output of the second context using the first portion of the computational engine and the processing of the first layer output of the fourth context using the second portion of the computational engine are performed substantially in parallel. 12. storing the second layer output of the first context in a memory device; storing in the memory device second data associated with the second context in addition to the second layer output of the first context; storing the first layer output of the second context in the memory device along with the second layer output of the first context and second data related to the second context; 12. The method of any of clauses 5 to 11, further comprising: 13. Overwriting at least a portion of the second data associated with the second context or the first layer output of the second context stored in the memory device with the second layer output of the second context. The method of clause 12, further comprising: 14. Configuring a third portion of the computational engine to receive as an input the second layer output of the first context from the memory device; configuring a fourth portion of the computational engine to receive as an input the second layer output of the second context from the memory device; processing the second layer output of the first context using a third portion of the computational engine; and processing the second layer output in the second context using a fourth portion of the computational engine; The method of clause 13, further comprising: 15. The method of clause 14, wherein the processing of the second layer output of the first context using a third portion of the computational engine and the processing of the second layer output of the second context using a fourth portion of the computational engine are performed substantially in parallel. 16. The method of any of clauses 5 to 15, wherein processing first data associated with the first context using a computational engine in the first configuration to generate a first layer output for the first context includes performing one or more convolution computations between the first data and a set of weights associated with the first layer of the neural network. 17. Processing results of the one or more convolution computations by the activation function engine to generate a first layer output for the first context. The method of clause 16, further comprising: 18. A memory device configured as a state buffer; a computational engine coupled to a memory device and comprising an array of processing elements, each of the array of processing elements comprising an adder and a multiplier; An integrated circuit comprising: The calculation engine is Retrieving a first set of weights associated with a second layer of the neural network from a state buffer; performing a first set of additions and multiplications between the first set of weights and the first data to generate a second layer output of the first data; Retrieving a second set of weights associated with the first layer of the neural network from the state buffer after the second layer output of the first data is generated; performing a second set of additions and multiplications between the second set of weights and the second data to generate a first layer output of the second data; performing a third set of additions and multiplications between the first set of weights and the first layer output of the second data to generate a second layer output of the second data; Retrieving a third set of weights associated with a third layer of the neural network from the state buffer; and performing a fourth set of additions and multiplications between the third set of weights and the second layer output of the first data to generate a first result of processing the first data; and performing a fifth set of additions and multiplications between the third set of weights and the second layer output of the second data to generate a second result of processing the second data; and
[0023] a fourth set of additions and multiplications and a fifth set of additions and multiplications are performed by different portions of the array of processing elements; Integrated circuits. 19. The calculation engine storing the second layer output of the first data in a state buffer; performing a fourth set of additions and multiplications between the third set of weights and the second layer output of the first data obtained from the state buffer; 19. The integrated circuit of clause 18, further configured to: 20. The integrated circuit of clause 18 or 19, wherein the computational engine is configured to perform the fourth set of additions and multiplications and the fifth set of additions and multiplications substantially in parallel. 21. Determining a schedule for performing neural network computations for a first context and a second context, wherein performing the neural network computations for each context includes performing a sequence of computation tasks for a respective context, each sequence of computation tasks including a first computation task using a first neural network layer, a second computation task using a second neural network layer, and a third computation task using a third neural network layer, the third computation task of a context configured to process an output of the second computation task of a context, and the second computation task of a context configured to process an output of the first computation task of a context; Determining the schedule determining a first execution batch including a third computation task of a first context and a third computation task of a second context, the first execution batch being determined based on a state buffer having sufficient capacity to hold input data and output data of the third computation task of the first context and the third computation task of the second context; determining, determining whether the state buffer has sufficient capacity to hold input data and output data of the first context and the second computational task of the second context; in response to determining that the state buffer does not have sufficient capacity to hold input data and output data of the first context and the second computational task of the second context, determining a second execution batch to be executed before the first execution batch and a third execution batch to be executed before the second execution batch, where the second execution batch includes a second computational task of a first context and the third execution batch includes a second computational task of a second context, and the second execution batch and the third execution batch are determined based on a state buffer having sufficient capacity to hold output data of the second computational task of the second context and input data and output data of the second computational task of the first context; determining a fourth execution batch to be executed before the second execution batch, the fourth execution batch including a first computational task of a first context, the fourth execution batch being determined based on the state buffer having sufficient capacity to hold input data and output data of the first computational task of the first context and output data of the second computational task of the second context; executing a third execution batch; and executing a fourth execution batch after the third execution batch; executing the second execution batch after the fourth execution batch; executing the first execution batch after the second execution batch; A method comprising: 22. Determining whether the state buffer has sufficient capacity to hold a set of weights for the first context and the second computational task of the second context, in addition to input data and output data for the first context and the second computational task of the second context. Further comprising: determining a second execution batch to be executed before the first execution batch and a third execution batch to be executed before the second execution batch is based on the state buffer having insufficient capacity to hold the set of weights, the input data, and the output data of the second computational task of the first context and the second context; Section 21 Method. 23. Maximizing a first number of second computational tasks to be included in a second execution batch and a second number of second computational tasks to be included in a third execution batch, such that a total data size of the input data and output data of the first number of second computational tasks and the output data of the second number of second computational tasks is less than a capacity of a state buffer when the second execution batch is executed. 23. The method of clause 21 or 22, further comprising: 24. Determining a fifth execution batch to be executed before the third execution batch, where the third execution batch includes a first computational task of a second context, and the fifth execution batch is determined based on the state buffer having sufficient capacity to hold input data and output data of the first computational task of the second context; executing the fifth execution batch before the third execution batch; 24. The method of any of clauses 21 to 23, further comprising: 25. Determining a set of computational tasks to be executed, the set of computational tasks including a first computational task, a second computational task, a third computational task, and a fourth computational task, the third computational task and the fourth computational task generating input data for the first computational task and input data for the second computational task, respectively; determining a first execution batch including the first computational task and the second computational task based on the memory device having sufficient capacity to hold input / output data of both the first computational task and the second computational task; determining a second execution batch including at least a third computational task to be executed before the first execution batch; determining whether to include the fourth computational task in the second execution batch based on whether the memory device has sufficient capacity to hold the input data and the output data of both the third computational task and the fourth computational task; executing a second execution batch; executing the first execution batch after the second execution batch; A method comprising: 26. Determining a second batch of execution determining that the memory device does not have sufficient capacity to hold the input data and output data of both the third computational task and the fourth computational task, but has sufficient capacity to hold the input data and output data of the third computational task and the output data of the fourth computational task; determining a second batch of execution including a third computational task; determining a third execution batch including a fourth computational task to be executed before the second execution batch; wherein the method comprises: Executing a third execution batch before a second execution batch The method of clause 25, including 27. The set of computational tasks further includes a fifth computational task and a sixth computational task that generate input data for the third computational task and the input data for the fourth computational task, respectively; The method is determining a fourth batch of execution including a fifth computational task; and determining a fifth batch of execution including a sixth computational task; and executing a fourth execution batch before the second execution batch; executing the fifth execution batch before the third execution batch; 27. The method of claim 26, further comprising: 28. determining a fourth execution batch to be executed between the third execution batch and the second execution batch based on determining that the memory device does not have sufficient capacity to store the output data of the fifth computational task, the output data of the sixth computational task, and the input data and output data of the fourth computational task, and that the memory device has sufficient capacity to store the output data of the fourth computational task and the input data and output data of the fifth computational task. The method of clause 27, further comprising: 29. Determining a fourth execution batch to be executed before the third execution batch and before the second execution batch based on determining that the memory device has sufficient capacity to store the output data of the fifth computational task, the output data of the sixth computational task, and the input data and the output data of the fourth computational task. 29. The method of clause 27 or 28, further comprising: 30. Determining a second batch of execution determining a second batch of execution including the third computational task and the fourth computational task based on determining that the memory device has sufficient capacity to hold the input data and the output data of both the third computational task and the fourth computational task; any of the methods set forth in clauses 25 to 29, including 31. The set of computational tasks further includes a fifth computational task and a sixth computational task that generate input data for the third computational task and the input data for the fourth computational task, respectively; The method is determining a third computation batch based on whether the memory device has sufficient capacity to hold the input data and the output data of both the fifth computation task and the sixth computation task; executing a third execution batch before the second execution batch; The method of clause 30, further comprising: 32. Determining a third batch of execution determining that the memory device does not have sufficient capacity to store the input data and output data of both the fifth computational task and the sixth computational task, but has sufficient capacity to store the input data and output data of the fifth computational task and the output data of the sixth computational task; determining a third execution batch including a fifth computational task; and determining a fourth execution batch including a sixth computational task to be executed before the third execution batch; wherein the method comprises: Executing the fourth batch The method of clause 31, including 33. Determining a third batch of execution determining that the memory device has sufficient capacity to store input data and output data for both the fifth computational task and the sixth computational task; determining a third execution batch including a fifth computational task and a sixth computational task; (c) the method of any one of clauses 31 or 32, 34. The method of any of clauses 25 to 33, wherein executing the second execution batch includes performing the first computational task and the second computational task substantially in parallel. 35. The method of any of clauses 25 to 34, wherein the first computational task and the third computational task are for processing first data associated with a first context, and the second computational task and the fourth computational task are for processing second data associated with a second context. 36. The method of any of clauses 25 to 35, wherein the third computational task and the fourth computational task are associated with computations for a first neural network layer, and the first computational task and the second computational task are associated with computations for a second neural network layer that processes data from the first neural network layer. 37. A memory device configured as a state buffer; a computational engine coupled to the memory device; determining a set of computational tasks to be executed on the computational engine, the set of computational tasks including a first computational task, a second computational task, a third computational task, and a fourth computational task, the third computational task and the fourth computational task generating input data for the first computational task and input data for the second computational task, respectively; determining a first execution batch including the first computational task and the second computational task based on the memory device having sufficient capacity to hold input / output data of both the first computational task and the second computational task; determining a second execution batch to be executed before the first execution batch based on whether the memory device has sufficient capacity to hold the input data and the output data of both the third computational task and the fourth computational task; executing a second execution batch in the computation engine; executing the first execution batch in the computation engine after the execution of the second execution batch is completed; a controller configured to 1. An integrated circuit comprising: 38. The controller determining that the memory device does not have sufficient capacity to hold the input data and output data of both the third computational task and the fourth computational task, but has sufficient capacity to hold the input data and output data of the third computational task and the output data of the fourth computational task; determining that the second execution batch includes a third computational task; determining a third execution batch including a fourth computational task to be executed before the second execution batch; allocating a first memory space in the memory device for storing input data of a fourth computational task and a second memory space in the memory device for storing output data of the fourth computational task; executing a third execution batch in the computation engine by controlling the computation engine to read input data of a fourth computation task from the first memory space and store output data of the fourth computation task in the second memory space; storing output data of the fourth computational task in a memory device during execution of the second execution batch in the computational engine; 38. The integrated circuit of clause 37, further configured to: 39. The set of computational tasks further includes a fifth computational task and a sixth computational task that generate input data for the third computational task and the input data for the fourth computational task, respectively; The controller determining a fourth batch of execution including a fifth computational task; and determining a fifth batch of execution including a sixth computational task; and executing a fourth execution batch in the computation engine prior to executing the second execution batch; executing a fifth execution batch in the calculation engine before executing the third execution batch; 39. The integrated circuit of clause 38, further configured to: 40. The first computational task, the third computational task, and the fifth computational task are associated with a third neural network layer computation, a second neural network layer computation, and a first neural network layer computation of the neural network model for the first context, respectively; The second computational task, the fourth computational task, and the sixth computational task are associated with a third neural network layer computation, a second neural network layer computation, and a first neural network layer computation of the neural network model for the second context, respectively; Section 39 Integrated Circuits.
[0104]
[0111] In the context of describing the disclosed embodiments (particularly in the context of the claims below), the use of the terms "a" and "an" and "the" and similar referents should be construed to cover both the singular and the plural, unless otherwise indicated herein or clearly contradicted by context. The terms "comprises," "has," "includes," and "including" should be construed as open-ended terms (i.e., meaning "including, but not limited to"), unless otherwise noted. The term "connected" should be construed as partially or wholly contained, connected, or joined together, even if there is something intervening. The recitation of ranges of values herein is intended only to serve as a shorthand method of individually referring to each individual value falling within the range, unless otherwise indicated herein, and each individual value is incorporated herein as if it were individually recited herein. All methods described herein can be performed in any suitable order, unless otherwise indicated herein or clearly contradicted by context. The use of any and all examples or exemplary language (e.g., "etc.") provided herein is intended only to better illuminate embodiments of the disclosure and does not limit the scope of the disclosure unless otherwise claimed. No language in the specification should be construed as indicating any non-claimed element as essential to the practice of the disclosure.
[0105]
[0112] Selection language such as the phrase "at least one of X, Y, or Z" is to be understood within the context as being used generally to state that an item, term, etc. is X, Y, or Z, or any combination thereof (e.g., X, Y, and / or Z), unless otherwise indicated. Thus, such selection language generally does not and should not imply that a particular embodiment requires that at least one X, at least one Y, or at least one Z, respectively, be present.
[0106]
[0113] Various embodiments of the present disclosure are described herein, including the best mode known to the inventor for carrying out the present disclosure. Variations of those embodiments may become apparent to those skilled in the art upon reading the foregoing description. The inventor expects those skilled in the art to make appropriate use of such variations, and the inventor intends that the present disclosure be practiced in ways other than as specifically described herein. Accordingly, the present disclosure includes all modifications and equivalents of the subject matter recited in the claims appended hereto as permitted by applicable law. Moreover, any combination of the above-described elements in all possible variations thereof is encompassed by the present disclosure, unless otherwise indicated herein or clearly contradicted by context.
Claims
1. 1. A method for processing data, comprising the steps of: configuring a computational engine in a first configuration to implement a first layer of a neural network; processing first data associated with a first context using the computational engine in the first configuration to generate a first layer output for the first context; configuring the computation engine in a second configuration to implement a second layer of the neural network; processing the first layer output of the first context using the computation engine in the second configuration to generate a second layer output of the first context; switching the computation engine from the second configuration back to the first configuration; processing second data associated with the second context using the computational engine in the first configuration to generate a first layer output for the second context; configuring the computation engine to revert to the second configuration to implement the second layer of the neural network; processing the first layer output of the second context in the second configuration to generate a second layer output of the second context; configuring the computation engine in a third configuration to implement a third layer of the neural network; processing the second layer output of the first context and the second layer output of the second context using the computation engine in the third configuration to generate a third layer output of the first context and a third layer output of the second context; A method comprising:
2. processing third data associated with the third context using the computational engine in the first configuration to generate a first layer output for the third context; processing the first layer output of the third context and the first layer output of the first context using the computation engine in the second configuration to generate a second layer output of the third context and the second layer output of the first context, respectively; The method of claim 1 further comprising:
3. storing the first layer output of the first context and the first layer output of the third context in a memory device; configuring a first portion of the computational engine to receive as an input the first layer output of the first context from the memory device; configuring a second portion of the computational engine to receive as an input the first layer output of the third context from the memory device; processing the first layer output of the first context using the first portion of the computational engine; processing the first layer output of the third context using the second portion of the computational engine; The method of claim 2 , further comprising:
4. 4. The method of claim 3, wherein the processing of the first layer output of the first context using the first portion of the computation engine and the processing of the first layer output of the third context using the second portion of the computation engine are performed in parallel.
5. processing fourth data associated with the fourth context using the computational engine in the first configuration to generate a first layer output for the fourth context; processing the first layer output of the second context and the first layer output of the fourth context using the computation engine in the second configuration to generate the second layer output of the second context and the second layer output of the fourth context, respectively; The method of claim 1 , further comprising:
6. storing the first layer output of the second context and the first layer output of the fourth context in a memory device; configuring a first portion of the computational engine to receive as an input the first layer output of the second context from the memory device; configuring a second portion of the computational engine to receive as an input the first layer output of the fourth context from the memory device; processing the first layer output of the second context using the first portion of the computational engine; processing the first layer output of the fourth context using the second portion of the computational engine; The method of claim 5 further comprising:
7. 7. The method of claim 6, wherein the processing of the first layer output of the second context using the first portion of the computation engine and the processing of the first layer output of the fourth context using the second portion of the computation engine are performed substantially in parallel.
8. storing the second layer output of the first context in a memory device; storing the second data associated with the second context in addition to the second layer output of the first context in the memory device; storing the first layer output of the second context in the memory device along with the second layer output of the first context and the second data associated with the second context; The method of claim 1 , further comprising:
9. overwriting at least a portion of the second data associated with the second context or the first layer output of the second context stored in the memory device with the second layer output of the second context. The method of claim 8 further comprising:
10. configuring a third portion of the computational engine to receive as an input the second layer output of the first context from the memory device; configuring a fourth portion of the computational engine to receive as an input the second layer output of the second context from the memory device; processing the second layer output of the first context using the third portion of the computational engine; processing the second layer output of the second context using the fourth portion of the computational engine; The method of claim 9 further comprising:
11. 11. The method of claim 10, wherein the processing of the second layer output of the first context using the third portion of the computation engine and the processing of the second layer output of the second context using the fourth portion of the computation engine are performed substantially in parallel.
12. 12. The method of claim 1, wherein processing the first data associated with the first context using the computational engine in the first configuration to generate the first layer output for the first context comprises performing one or more convolution computations between the first data and a set of weights associated with the first layer of the neural network.
13. a memory device configured as a state buffer; a computational engine coupled to the memory device and comprising an array of processing elements, each of the array of processing elements comprising an adder and a multiplier; An integrated circuit comprising: The computation engine, Obtaining a first set of weights associated with a second layer of a neural network from the state buffer; performing a first set of additions and multiplications between the first set of weights and the first data to generate a second layer output of the first data; obtaining a second set of weights associated with a first layer of the neural network from the state buffer after the second layer output of the first data is generated; performing a second set of additions and multiplications between the second set of weights and the second data to generate a first layer output of second data; performing a third set of additions and multiplications between the first set of weights and the first layer output of the second data to generate a second layer output of the second data; obtaining a third set of weights associated with a third layer of the neural network from the state buffer; performing a fourth set of additions and multiplications between the third set of weights and the second layer output of the first data to generate a first result of processing the first data; and performing a fifth set of additions and multiplications between the third set of weights and the second layer output of the second data to generate a second result of processing the second data; and configured to: the fourth set of additions and multiplications and the fifth set of additions and multiplications are performed by different portions of the array of processing elements. Integrated circuits.
14. The computation engine, storing the second layer output of the first data in the state buffer; performing the fourth set of additions and multiplications between the third set of weights and the second layer output of the first data obtained from the state buffer; The integrated circuit of claim 13 , further configured to:
15. 15. An integrated circuit as claimed in claim 13 or 14, wherein the computational engine is configured to perform the fourth set of additions and multiplications and the fifth set of additions and multiplications substantially in parallel.
Citation Information
Patent Citations
Arithmetic processor and arithmetic processing method
JP2009080693A
Processing for multiple input datasets
JP2022137247A
Calculation processing apparatus and method
US20100214936A1
Multi-threaded streaming data decoding
US8213518B1
