Method, apparatus and article of manufacture for increasing utilization of neural network (NN) accelerator circuitry for shallow layers of a NN by reformatting one or more tensors
By reformatting input tensors using Z-measure format and fractional striding, the method addresses the inefficiencies in AI accelerator circuits for shallow layers, enhancing performance and reducing latency on mobile devices.
Patent Information
- Application Number
- JP2023568735
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2021-09-24
- Filing Date
- 2022-07-28
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2042-07-28
AI Technical Summary
Existing AI accelerator circuits for shallow layers of neural networks suffer from low utilization and inefficiency due to the configuration-dependent processing of initial input tensors, which results in significant processing time and routing bottlenecks, limiting performance on mobile devices with size, thermal, and power constraints.
The method involves reformatting input tensors using a Z-measure format and fractional striding techniques to increase MAC circuit utilization by simultaneously processing activations of multiple points in the kernel, reducing the depth of the input tensor and optimizing the processing of shallow layers.
This approach enhances the performance of AI accelerator circuits by improving the utilization of MAC circuits, reducing overall network latency and power consumption, and optimizing memory usage, particularly for mobile devices with limited resources.
Smart Images

Figure 2024536663000001_ABST
Abstract
Description
[Technical field]
[0001] The present disclosure relates generally to accelerator circuits, and more particularly to methods, apparatus, and articles of manufacture for increasing utilization of a neural network (NN) for accelerator circuits in shallow layers of an NN by reformatting one or more tensors. [Background technology]
[0002] The demand for image processing capabilities has expanded beyond high-powered dedicated desktop hardware and has become an expectation for personal and / or otherwise mobile devices, which typically have processing capabilities limited by size constraints, thermal management constraints, and / or power constraints. [Brief description of the drawings]
[0003] [Figure 1] FIG. 1 is a graphical diagram showing how the dimensionality of the input tensor changes as the depth of the neural network increases.
[0004] [Diagram 2] FIG. 1 is a block diagram of an exemplary system-on-chip (SoC) including an exemplary central processing unit (CPU), an exemplary system memory, an exemplary direct memory access (DMA) circuit, and an exemplary artificial intelligence (AI) accelerator circuit.
[0005] [Diagram 3] 1 illustrates an example tensor.
[0006] [Figure 4] 3 illustrates exemplary tensor data stored in the system memory of FIG. 2.
[0007] [Diagram 5] 1 illustrates an exemplary memory containing an exemplary pointer table and corresponding tensor data.
[0008] [Figure 6] FIG. 2 is a graph illustrating a data layout in a memory without storage element pointers.
[0009] [Figure 7] FIG. 2 is a graph illustrating a data layout in a memory with storage element pointers.
[0010] [Figure 8] 3 is a block diagram illustrating an example implementation of the example data replication pre-processing circuit of FIG. 2.
[0011] [Figure 9] FIG. 1 is a dataflow diagram illustrating an example reshaping of (a) an example input tensor convolved with an example set of weights to determine an example output tensor to (b) an example reformatted input tensor convolved with an example reformatted set of weights to determine an example output tensor.
[0012] [Figure 10] 3 is a block diagram illustrating an example implementation of the example fractional stride pre-processing circuit of FIG. 2.
[0013] [Figure 11] 3 is a block diagram illustrating an example implementation of the example MAC circuit of FIG. 2.
[0014] [Figure 12] FIG. 13 is a dataflow diagram illustrating an example convolution of an example input tensor with no padding and an example set of 3×3×3 weight kernels with a stride of 1 to determine an example output tensor.
[0015] [Figure 13]FIG. 13 is a data flow diagram illustrating an example convolution of an example reformatted input tensor without padding with an example set of reformatted 1×3×9 weight kernels with a stride of 1 to determine the example output tensor of FIG.
[0016] [Figure 14] FIG. 13 is a dataflow diagram illustrating an example convolution of an example reformatted input tensor without padding with an example 3×3×3 weight kernel with a stride of 1 and one or more weight sparsity bitmaps to facilitate sophisticated fractional striding.
[0017] [Figure 15] FIG. 13 is a dataflow diagram illustrating an example convolution of an example input tensor with no padding and an example set of 3×3×3 weight kernels with a stride of 2 to determine an example output tensor.
[0018] [Figure 16] FIG. 16 is a data flow diagram illustrating an example convolution of an example reformatted input tensor without padding with an example set of reformatted 1×3×9 weight kernels with a stride of 2 to determine the example output tensor of FIG.
[0019] [Figure 17] FIG. 13 is a dataflow diagram illustrating an example convolution of an example reformatted input tensor without padding with an example 3×3×3 weight kernel with a stride of 2 and one or more weight sparsity bitmaps to facilitate sophisticated fractional striding.
[0020] [Figure 18]FIG. 13 is a dataflow diagram illustrating an example convolution of an example input tensor with padding and an example set of 3×3×3 weight kernels with a stride of 1 to determine an example output tensor.
[0021] [Figure 19] FIG. 19 is a dataflow diagram illustrating an example convolution of an example reformatted input tensor with padding with an example set of reformatted 1×3×9 weight kernels with a stride of 1 to determine the example output tensor of FIG.
[0022] [Figure 20] FIG. 13 is a dataflow diagram illustrating an example convolution of an example reformatted input tensor with padding with an example 3×3×3 weight kernel with a stride of 1 and one or more weight sparsity bitmaps to facilitate sophisticated fractional striding.
[0023] [Figure 21] 10 is a flowchart representative of example machine-readable instructions and / or example operations that may be executed and / or instantiated by a processor circuit to implement the data replication pre-processing circuitry of FIG. 2 and / or FIG. 8.
[0024] [Figure 22] 11 is a flowchart representative of example machine-readable instructions and / or example operations that may be executed and / or instantiated by a processor circuit to implement the fractional stride pre-processing circuit of FIG. 2 and / or FIG. 10.
[0025] [Diagram 23]FIG. 23 is a block diagram of an exemplary processing platform including a processor circuit configured to execute the exemplary machine-readable instructions of FIG. 21 for implementing the data replication pre-processing circuitry of FIG. 2 and / or FIG. 8 and / or the exemplary machine-readable instructions of FIG. 22 for implementing the fractional stride pre-processing circuitry of FIG. 2 and / or FIG. 10.
[0026] [Figure 24] FIG. 24 is a block diagram of an example implementation of the processor circuit of FIG. 23.
[0027] [Diagram 25] FIG. 24 is a block diagram of another exemplary implementation of the processor circuit of FIG. 23.
[0028] [Figure 26] 21 and / or 22 to client devices associated with end users and / or consumers (e.g., for license, sale and / or use), retailers (e.g., for sale, resale, license and / or sublicense), and / or original equipment manufacturers (OEMs) (e.g., for inclusion in products distributed to retailers and / or to other end users, such as direct purchase customers).
[0029] The drawings are not to scale. Generally, the same reference numbers are used throughout the drawings and the accompanying specification to refer to the same or similar parts. As used herein, unless otherwise stated, connection references (e.g., attached, coupled, connected, and joined) can include intermediate members between the elements referenced by the connection reference, and / or relative movement between those elements. Thus, a connection reference does not necessarily infer that two elements are directly connected and / or fixed to each other.
[0030] Unless expressly stated otherwise, descriptors such as "first," "second," "third," etc. are used herein without any negation or otherwise implying any sense of priority, physical order, placement in a list, and / or ordering in any manner, but are merely used as labels and / or arbitrary names to distinguish elements to facilitate understanding of the disclosed examples. In some instances, the descriptor "first" may be used to refer to an element in the detailed description, while the same element may be referenced in a claim recited with a different descriptor such as "second" or "third." In such instances, it should be understood that such descriptors are merely used to clearly distinguish elements that may otherwise share, for example, the same name. As used herein, the term "communicating," including variations thereof, encompasses direct communication and / or indirect communication through one or more intermediate components and does not require direct physical (e.g., wired) communication and / or constant communication, but rather additionally includes selective communication at periodic intervals, scheduled intervals, aperiodic intervals, and / or one-time events.
[0031] As used herein, a "processor circuit" is defined to include (i) one or more special-purpose electrical circuits that are structured to perform certain operations and that include one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors), and / or (ii) one or more general-purpose semiconductor-based electrical circuits that are programmed with instructions to perform certain operations and that include one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). Examples of processor circuits include programmed microprocessors, field programmable gate arrays (FPGAs) that can instantiate instructions, central processing units (CPUs), graphics processor units (GPUs), digital signal processors (DSPs), XPUs or microcontrollers, and integrated circuits such as application specific integrated circuits (ASICs). For example, an XPU may be implemented by a heterogeneous computing system that includes multiple types of processor circuits (e.g., one or more FPGAs, one or more CPUs, one or more GPUs, one or more DSPs, etc., and / or combinations thereof), and an application programming interface (API) that can assign computing tasks to any of the multiple types of processing circuits best suited for performing the computing tasks. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0032] Typical computing systems, including personal computers and / or mobile devices, use advanced image processing or computer vision algorithms to automate tasks that human vision can perform. Computer vision tasks include acquiring, processing, analyzing, and / or understanding digital images. Such tasks facilitate, in part, the extraction of dimensional data from digital images to generate numerical and / or symbolic information. Computer vision algorithms can use the numerical and / or symbolic information to make decisions and / or otherwise perform actions associated with three-dimensional (3D) pose estimation, event detection, object recognition, video tracking, among others. Thus, it is important to perform such tasks quickly (e.g., in real-time or near-real-time) and efficiently to support augmented reality (AR), virtual reality (VR), robotics, and / or other applications.
[0033] Advanced image processing or computer vision algorithms may use convolutional neural networks (CNNs). CNNs are deep artificial neural networks that are typically used to classify images, cluster images by similarity (e.g., image search), and / or perform object recognition in images using convolution. As used herein, a convolution is defined as a function derived from two given functions by an integral that describes how the shape of one of the functions is modified by the shape of the other function. Thus, CNNs may be used to identify faces, individuals, road signs, animals, etc., contained in an input image by passing the output of one or more filters corresponding to image features (e.g., horizontal lines, two-dimensional (2D) shapes, etc.) of the input image to identify matches of image features in the input image. CNNs obtain vectors (e.g., subdivided from a multidimensional array) that need to be stored and / or used in computations to perform one or more functions. Thus, CNNs may receive multidimensional arrays (e.g., tensors) that include data corresponding to one or more images. To perform a convolution, a processor circuit applies one or more filters and activation functions to an input tensor (e.g., a multidimensional array, a 3D array, etc.) to generate an output tensor. As used herein, the term tensor refers to a dimensional set of data. Tensors may be categorized by rank, which is independent of the dimensionality of the tensor. For example, a tensor of rank zero corresponds to a scalar value, a tensor of rank one corresponds to a vector value, a tensor of rank two corresponds to a matrix value, and a tensor of rank three or greater corresponds to a tensor value.
[0034] Artificial intelligence (AI) accelerator circuits, including neural computation engines (NCEs) and neural network accelerators (NNAs), are dedicated hardware circuits for executing the operations of an AI model (e.g., a neural network (NN) model). For example, such operations can be divided into two phases: a learning / training phase and an inference phase. In the learning / training phase, a training algorithm is used to train the model to operate according to patterns and / or associations based on training data, for example. Generally, a model includes internal parameters that guide how input data is transformed into output data, such as through a series of nodes and connections in the model to transform the input data into output data.
[0035] Once trained and deployed, a model may be run in an inference phase to process data. In the inference phase, data to be analyzed (e.g., real data) is input to the model, and the model is executed to create an output. This inference phase may be thought of as the AI model "wanting" to generate an output (e.g., by running the model to apply learned patterns and / or associations to real data) based on what it has learned from training. In some examples, the input data undergoes pre-processing before being used as an input to the AI model. Additionally, in some examples, the output data may undergo post-processing after being generated by the AI model in order to convert the output into a useful result (e.g., data, a representation of instructions executed by a machine, etc.).
[0036] There are a growing number of architectures for NNs across a variety of use cases, including computer vision, speech recognition, and image and video processing. Exemplary NN architectures include ResNet-50, MobileNet, EfficientNet, and TinyYolo. Each of these exemplary NN architectures includes many processing layers, with each processing layer having very high computational requirements, including many multiplication and addition (MAC) operations. Additionally, each layer in the NN architecture receives an input tensor that includes one or more channels. The one or more channels correspond to the depth of the corresponding input tensor.
[0037] A common feature of most NN architectures is that the initial input layer to the NN contains three channels. For example, in some CNNs (e.g., for computer vision, image and video processing, etc.), the input layer, when implemented, performs convolutions on an image. In such examples, image pixels are fed into the CNN and typically contain only three channels (e.g., red, green, and blue (RGB) values) that are considered very shallow compared to the input tensors to subsequent layers of the CNN.
[0038] Modern CNNs, when implemented, typically apply 32, 64, or 96 filters to an input image. Thus, the input tensor to the next layer of the CNN is much deeper than the input image, with the depth corresponding to the number of filters (e.g., 32, 64, 96, etc.). As the CNN gets deeper, the channel depth of the input tensor typically ranges from 256 to 2,048 channels. Conversely, the spatial dimensions of the tensor (e.g., height and width) tend to decrease as the CNN gets deeper. Figure 1 is a graphical illustration 100 showing how the dimensionality of the input tensor changes as the depth of the NN increases. The graphical illustration 100 shows how the dimensionality of the input tensor changes as the depth of the ResNet-50 NN increases.
[0039] In the illustrated example of FIG. 1, the graph diagram 100 includes an exemplary first plot 102 and an exemplary second plot 104. In the example of FIG. 1, the first plot 102 represents the spatial dimension of the input tensor as the depth of the ResNet-50 NN increases. In the example of FIG. 1, the second plot 104 represents the depth of the input tensor as the depth of the ResNet-50 NN increases. In the exemplary first layer of the ResNet-50 NN, the input image is 224×224 pixels resulting in a spatial dimension of 50,176 pixels (point 106) with a channel depth of 3 (point 108). While the first plot 102 progresses to 56×56 pixels, 28×28 pixels, 14×14 pixels, and 7×7 pixels, the second plot 104 increases from 64 channels to 2,048 channels as the depth of the ResNet-50 NN increases. The final layer (e.g., the deepest layer) of the ResNet-50 NN is a fully connected layer as opposed to a convolutional layer, so the first plot 102 grows from 7×7 pixels to 32×32 pixels (block 110).
[0040] As shown in FIG. 1, apart from the first layer, the input tensors to most layers of a NN have a significant depth. Since deep input tensors comprise most of the computations of an AI accelerator circuit, an industry-wide trend is for AI accelerator circuits to become increasingly efficient at processing deep tensors. For example, an AI accelerator circuit includes a number of MAC circuits arranged in an array and optimized to process deeper input tensors. To achieve high utilization, such MAC circuits of an exemplary AI accelerator circuit require a minimum number of channels in the corresponding input tensor. Most convolutional layers with input tensors having a depth of 32 or more achieve utilization rates close to 100%, with the degradation due to processing overhead being in the low single digits. In contrast, the utilization of input layers when processed in the same manner as those layers with deeper input tensors achieves MAC utilization rates of <30%.
[0041] Therefore, the lack of depth of the input tensor to the first layer of the NN reduces the efficiency of the AI accelerator circuitry and leads to low utilization of the MAC circuitry. Due to the low utilization of the MAC circuitry combined with the relatively large size (in terms of width and height) of the first input tensor, the first input tensor to the NN contributes a significant proportion of the overall processing time of the NN. Therefore, adding depth to the input tensor to the first layer of the NN can improve the performance of the processing of the first layer.
[0042] Existing AI accelerator circuits use hardware logic that exclusively processes the initial input tensor to improve the processing efficiency of relatively shallow input tensors. This hardware logic relies on a configuration where the kernel dimensions and strides allow for overlap of input activations that are reused to increase utilization. Such hardware logic requires the initial input tensor to be formatted in a planar format. Thus, existing AI accelerator circuits are configuration dependent, which results in slow processing of the initial input tensor.
[0043] Additionally, the dedicated hardware logic consumes area and requires dedicated interconnects between the MAC circuits and memory in existing AI accelerator circuits. Such dedicated interconnects introduce routing bottlenecks and limit the maximum frequency at which the MAC array can operate. Additionally, the dedicated hardware logic and interconnects are only used to process the first input tensor, while input tensors to deeper layers in the network are processed by different circuits. As the industry moves toward AI accelerator circuits with large MAC arrays, scaling such dedicated hardware logic that requires dedicated interconnects is not practical.
[0044] Unlike existing AI accelerator circuits, the examples disclosed herein do not rely on overlapping kernel dimensions and strides to achieve high utilization. Additionally, the examples disclosed herein advantageously utilize a common tensor format (e.g., Z-major format) for all layers in the network. To increase utilization, the examples disclosed herein reformat the input tensor so that activations of multiple points in the kernel are input simultaneously to an array of MAC circuits. Thus, the examples disclosed herein increase MAC circuit utilization of input tensors to the first layer of a NN. For example, the disclosed methods, apparatus, and articles of manufacture provide significant improvements in the performance of AI accelerator circuits that process input tensors to the first layer of a NN. Because processing input tensors to the first layer of a NN can take up a significant percentage of the overall network processing time, reducing the time to process such layers reduces overall network latency.
[0045] A tensor may be a 3D structure in XYZ space. Each XY plane of the tensor corresponds to a channel, and each step along the Z axis corresponds to a different channel. In the exemplary memory disclosed herein, the tensor is stored in a ZXY format, also referred to as a Z major format. In the memory, the ZXY format data is stored in the Z dimension, followed by the X dimension, followed by the Y dimension. That is, the exemplary tensor is divided into ZX planes that are stored consecutively in the memory. Thus, the MAC circuit can simultaneously read data for each XY position across multiple channels.
[0046] Exemplary methods, apparatus, and articles of manufacture disclosed herein include tensor data duplication, in which Z values of XY locations of an input tensor that overlap the width of a weight kernel are successively copied and loaded into a reformatted tensor to increase the depth of the input tensor. Additionally, exemplary methods, apparatus, and articles of manufacture disclosed herein include fractional striding, in which multiple weight sparsity bitmaps with different sparsity patterns are generated for the same weight kernel, and activation data of the input tensor is selectively processed to effectively deepen the input tensor.
[0047] 2 is a block diagram of an example system-on-chip (SoC) 200 including an example central processing unit (CPU) 202, an example system memory 204, an example direct memory access (DMA) circuit 206, and an example artificial intelligence (AI) accelerator circuit 208. In the example of FIG. 2, the CPU 202 includes an example compiler 210, an example data duplication pre-processing circuit 212, and an example fractional stride pre-processing circuit 214. Additionally, in the example of FIG. 2, the AI accelerator circuit 208 includes an example local memory 216, an example data read circuit 218, an example multiply and add (MAC) circuit 220, and an example data write circuit 222.
[0048] In the illustrated example of FIG. 2, CPU 202 is coupled to DMA circuit 206. In the example of FIG. 2, CPU 202 is programmed with instructions to perform certain operations and is implemented by one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). For example, CPU 202 is programmed with instructions to perform the operations of compiler 210, data duplication preprocessing circuit 212, and / or fractional stride preprocessing circuit 214. Additionally, CPU 202 may obtain data (e.g., input tensors and / or one or more weight kernels) that are stored or used in calculations to perform one or more AI or image processing related functions. For example, SoC 200 may include an interface circuit for accessing one or more input tensors representing an image to be processed, and CPU 202 may obtain the one or more input tensors from the interface circuit. Thus, CPU 202 may receive a multidimensional array (e.g., a tensor or rows of vectors) including data corresponding to one or more images. 2, the CPU 202 causes storage of data (e.g., one or more tensors and / or one or more weight kernels) to be processed by the AI accelerator circuit 208 in the system memory 204 via the DMA circuit 206. When the CPU 202 stores data to be processed by the AI accelerator circuit 208 in the system memory 204, the data is stored in a sparse format that includes one or more sparsity bitmaps (described further herein). In some examples, if the input tensor is shallow (e.g., has a depth of 3, 4, 5, etc.), the CPU 202 stores the input tensor in the system memory 204 in a dense format. Additionally, the CPU 202 offloads one or more AI workloads (e.g., compiled by the compiler 210) to the AI accelerator circuit 208 for processing.
[0049] In the illustrated example of FIG. 2, the CPU 202 includes an exemplary compiler 210. In the example of FIG. 2, the compiler 210 is implemented with one or more instructions (e.g., software) for performing specific operations on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 2, the compiler 210 compiles output from AI and / or other NN programs, such as TensorFlow, Keras, PyTorch, among others, for implementation on the AI accelerator circuit 208. The exemplary compiler 210 processes variables of the AI program to determine how to configure the AI accelerator circuit 208 to increase utilization of the MAC circuit 220 of a shallow layer of the NN by reformatting one or more tensors.
[0050] 2, the compiler 210 may configure the AI accelerator circuit 208 to operate according to at least two configurations. In one such example, the at least two configurations include a tensor data duplication configuration and a fractional striping configuration. The example compiler 210 sets the configurations by setting one or more configuration bits in one or more configuration registers of the AI accelerator circuit 208. In some examples, program manuals associated with the AI accelerator circuit 208 explain how to configure the AI accelerator circuit 208 to increase utilization of the MAC circuit 220 of shallow layers of the NN.
[0051] In the illustrated example of FIG. 2, system memory 204 is coupled to DMA circuitry 206. In the example of FIG. 2, system memory 204 stores input data for an AI workload (e.g., input tensors) and / or output data from an AI workload (e.g., output tensors). For example, the input data for an AI workload includes one or more activation tensors and one or more weight sets. The weight sets may additionally or alternatively be referred to as weight kernels. In the example of FIG. 2, system memory 204 is implemented with DRAM. In additional or alternative examples, system memory 204 is implemented with other volatile memory (e.g., synchronous dynamic random access memory (SDRAM), RAMBUS dynamic random access memory (RDRAM), etc.) and / or non-volatile memory (e.g., flash memory). Exemplary system memory 204 may additionally or alternatively be implemented with one or more double data rate (DDR) memories, such as, for example, DDR, DDR2, DDR3, DDR4, mobile DDR (mDDR), etc. In additional or alternative examples, the exemplary system memory 204 may be implemented by one or more mass storage devices external to the SoC 200, such as, for example, a hard disk drive, a compact disk drive, a digital versatile disk drive, a solid state disk drive, or the like.
[0052] In the illustrated example of FIG. 2, the data stored in the system memory 204 is stored as sparse data, such as a sparse tensor. As described above, in some examples (e.g., when the input tensor is shallow), the data stored in the system memory 204 is dense data. As defined herein, sparse data (e.g., a sparse tensor) is data that includes all of the non-zero elements of the dense data in the same order as the dense data, but excludes all of the zero elements of the dense data. As defined herein, dense data (e.g., a dense tensor) is data that includes both zero and non-zero elements. Thus, a dense vector [0,0,5,0,18,0,4,0] corresponds to a sparse vector [5,18,4]. In some examples, dense data may be referred to as unpacked data and / or uncompressed data. Additionally, in some examples, sparse data may be referred to as packed data and / or compressed data.
[0053] The dense data may be generated and / or determined based on the corresponding sparse data and the sparsity bitmap. As defined herein, the sparsity bitmap is a vector including a one-bit element that identifies whether each element of the dense data is zero or non-zero. Thus, the sparsity bitmap may map non-zero values of the dense data to "1" and zero values of the dense data to "0". For the dense vector [0,0,5,0,18,0,4,0] above, the sparsity bitmap may be [0,0,1,0,1,0,1,0] (e.g., since the third, fifth, and seventh elements of the dense vector are non-zero). The combination of the sparse data and the sparsity bitmap represents the corresponding dense data (e.g., the dense data may be generated and / or reconstructed based on the corresponding sparse data and the sparsity bitmap).
[0054] In the illustrated example of FIG. 2, the DMA circuit 206 is coupled to the CPU 202, the system memory 204, and the local memory 216. In the example of FIG. 2, the DMA circuit 206 is structured to perform specific operations and is implemented by one or more dedicated electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 2, the DMA circuit 206 operates as a controller for accessing the system memory 204 (e.g., for reading and / or writing data to and from the memory 204). In this manner, the CPU 202 and the AI accelerator circuit 208 may access the system memory 204 independently of one another. For example, the AI accelerator circuit 208 communicates directly with the local memory 216 to obtain input activation tensors and / or weight sets. The local memory 216 may obtain input tensors and / or weight sets from the system memory 204 as needed. Additionally, for example, the AI accelerator circuit 208 may communicate directly with the local memory 216 to store output tensors. The local memory 216 may store and transfer such output tensors to the system memory 204 as they become available, and / or may feed such output tensors back to the MAC circuit 220 as they become available.
[0055] In the illustrated example of Figure 2, AI accelerator circuitry 208 is coupled to DMA circuitry 206. In the example of Figure 2, AI accelerator circuitry 208 is structured to perform specific operations and is implemented by one or more dedicated electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of Figure 2, AI accelerator circuitry 208 processes reformatted input tensors to increase utilization of MAC circuitry 220.
[0056] In the illustrated example of FIG. 2, the CPU 202 includes a data duplication preprocessing circuit 212. In the example of FIG. 2, the data duplication preprocessing circuit 212 is implemented with one or more instructions (e.g., software) for performing a particular operation on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In some examples, the data duplication preprocessing circuit 212 is implemented with one or more special-purpose electrical circuits that are structured to perform a particular operation and include one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). For example, in some such examples, the AI accelerator circuit 208 implements the data duplication preprocessing circuit 212. In the example of FIG. 2, the data duplication preprocessing circuit 212 preprocesses the input tensor before the input tensor is read from the system memory 204 by the AI accelerator circuit 208. For example, the data duplication preprocessing circuit 212 reformats the input tensor to generate a reformatted input tensor that is deeper than the un-reformatted input tensor. The data duplication pre-processing circuit 212 is further described with reference to FIG.
[0057] In the illustrated example of FIG. 2, the CPU 202 includes a fractional stride pre-processing circuit 214. In the example of FIG. 2, the fractional stride pre-processing circuit 214 is implemented by one or more instructions (e.g., software) for performing a particular operation on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In some examples, the fractional stride pre-processing circuit 214 is implemented by one or more dedicated electrical circuits that are structured to perform a particular operation and include one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). For example, in some such examples, the AI accelerator circuit 208 implements the fractional stride pre-processing circuit 214. In the example of FIG. 2, the fractional stride pre-processing circuit 214 reformats the input tensor via fractional striding using storage element pointers and sparsity. The fractional stride pre-processing circuit 214 is further described in connection with FIG. 10.
[0058] In the illustrated example of FIG. 2, the AI accelerator circuitry 208 includes a local memory 216. The exemplary local memory 216 is coupled to the DMA circuitry 206 and the data reading circuitry 218. In the example of FIG. 2, the local memory 216 stores compressed input data (e.g., compressed input tensors, compressed activation tensors, compressed weight sets, etc.) and output data (e.g., output tensors) of the AI workload. The local memory 216 is comparatively much smaller than the system memory 204. For example, the local memory 216 is typically between 1 and 2 megabytes (MB). In the example of FIG. 2, the local memory 216 is implemented by SRAM. In additional or alternative examples, the local memory 216 is implemented by other volatile memory (e.g., DRAM, SDRAM, RDRAM, etc.) and / or non-volatile memory (e.g., flash memory). The exemplary local memory 216 may additionally or alternatively be implemented with one or more DDR memories, e.g., DDR, DDR2, DDR3, DDR4, mDDR, etc. In the illustrated example of Figure 2, the data stored in the local memory 216 is stored as compressed data including sparse data and a corresponding sparsity bitmap.
[0059] In the illustrated example of FIG. 2, the system memory 204 and / or the local memory 216 store data differently depending on the configuration of the AI accelerator circuit 208. For example, if the compiler 210 indicates that the tensor data replication configuration is active, the system memory 204 and / or the local memory 216 store the tensor data shown in FIG. 3 and FIG. 4. FIG. 3 illustrates an example tensor 300. In the illustrated example of FIG. 3, the tensor 300 is three-dimensional. The examples disclosed herein traverse the tensor 300 along an example X-axis 302, an example Y-axis 304, and an example Z-axis 306. In some examples, the tensor 300 is stored in a compressed (e.g., sparse) format. In other examples (e.g., when the tensor 300 is shallow), the tensor 300 is stored in an uncompressed (e.g., dense) format. In the example of FIG. 3, the tensor 300 is stored in the system memory 204 in a ZXY format.
[0060] In some examples, tensor 300 has dimensions X=4, Y=2, and Z=N. In some examples, the data width of each point in tensor 300 is 8 bits. In some examples, CPU 202 determines to store tensor 300 in system memory 204 in ZXY format and 16-byte aligned storage, as shown in exemplary Table 1. [Table 1] [Table 1]
[0061] That is, CPU 202 traverses tensor 300 along the ZX plane (e.g., 0, 1, 2, 3, etc.). The Z value of each XY location is dedicated 16 bytes of system memory 204. When DMA circuit 206 loads tensor 300 and / or a portion thereof into local memory 216, DMA circuit 206 similarly allocates 16 bytes of local memory 216 to the Z value of each XY location of tensor 300. In the illustrated example of Figure 3, the bolded data point indices correspond to data points in the XY plane with Z=0 (e.g., the front XY plane).
[0062] FIG. 4 illustrates exemplary tensor data stored in the system memory 204 of FIG. 2. For example, the system memory 204 stores the tensor 300 in ZXY format and 16-byte aligned storage. However, in additional or alternative examples, the system memory 204 may (e.g., is) at least one of 16-byte aligned or 32-byte aligned. That is, the tensor 300 is divided into ZX planes that are stored contiguously. For example, the system memory 204 stores an exemplary first ZX plane 402, an exemplary second ZX plane 404, and an exemplary third ZX plane 406. The exemplary first ZX plane 402 corresponds to the tensor data of the tensor 300 when Y=0, the exemplary second ZX plane 404 corresponds to the tensor data of the tensor 300 when Y=1, and the exemplary third ZX plane 406 corresponds to the tensor data of the tensor 300 when Y=2. Although the depicted example of FIG. 4 includes three ZX planes 402, 404, 406, examples disclosed herein may include a fewer or greater number of ZX planes (e.g., corresponding to the Y dimension of tensor 300).
[0063] In the illustrated example of FIG. 4, when CPU 202 stores data in system memory 204, CPU 202 traverses the Z-axis of tensor 300. For example, CPU 202 stores an exemplary first row 408 of data based on traversing the Z-axis of X=0, Y=0. When CPU 202 is finished traversing the Z-axis, CPU 202 increments X by 1 and traverses the Z-axis (e.g., X=1, Y=0) to generate an exemplary second row 410, and so on. Exemplary CPU 202 stores data of tensor 300 contiguously in system memory 204 of FIG. 2. Weight kernels are also stored contiguously in system memory 204 (not shown). For example, each weight kernel is stored as a 27×1 array of weight values.
[0064] Returning to Figure 2, as discussed above, the system memory 204 stores data differently depending on the configuration of the AI accelerator circuitry 208. For example, if the compiler 210 indicates that the fractional striping configuration is active, the system memory 204 stores the tensor data shown in Figure 5. Figure 5 illustrates an example memory 500 that includes an example pointer table 502 and corresponding tensor data 504. In some examples, the memory 500 corresponds to the system memory 204.
[0065] In the illustrated example of FIG. 5, the exemplary pointer table 502 includes an exemplary first storage element pointer 506 (SE_PTR_0), an exemplary second storage element pointer 508 (SE_PTR_1), an exemplary third storage element pointer 510 (SE_PTR_2), an exemplary fourth storage element pointer 512 (SE_PTR_3), and an exemplary Nth storage element pointer 514. In the example of FIG. 5, the CPU 202 has partitioned the tensor data 504 into an exemplary first storage element 516, an exemplary second storage element 518, an exemplary third storage element 520, an exemplary fourth storage element 522, and an exemplary Nth storage element 524. Each of the storage elements represents a Z value of a tensor at an XY position of the tensor. For example, the first storage element 516 corresponds to a Z value of a tensor at a first XY position of the tensor (X=0, Y=0).
[0066] In the illustrated example of FIG. 5 , the pointer table 502 stores the starting location of each of the storage elements in the memory 500. For example, the first storage element pointer 506 corresponds to the starting location of the first storage element 516, the second storage element pointer 508 corresponds to the starting location of the second storage element 518. Additionally, for example, the third storage element pointer 510 corresponds to the starting location of the third storage element 520, the fourth storage element pointer 512 corresponds to the starting location of the fourth storage element 522, and the Nth storage element pointer 514 corresponds to the starting location of the Nth storage element 524. Thus, each of the storage elements 516, 518, 520, 522, 524 may begin anywhere within the memory 500.
[0067] In the illustrated example of FIG. 5, the pointer table 502 is a dense structure stored in the memory 500 as a contiguous table, in which each storage element pointer occupies a portion of the memory word length of the memory 500. For example, if the memory word length of the memory 500 is 16 bytes, then there are four storage element pointers in each row of the pointer table 502, so that each storage element occupies four bytes (e.g., 32 bits) of the memory 500. However, in other examples, the memory word length of the memory 500 may be different (e.g., 32 bytes, 64 bytes, etc.). As described above, each storage element pointer in the pointer table 502 points to an XY location in the tensor data 504. Generally, the storage elements are sized to match the memory word length of the memory 500, even if the individual storage elements contain less data due to sparsity. Generally, the granularity of the storage element pointers is based on the memory word size. In some examples, CPU 202 stores an indication that the storage element is empty (eg, the storage element contains only zeros).
[0068] 6 is a graph diagram 600 illustrating a data layout in memory without storage element pointers. The graph diagram 600 includes an exemplary first static storage element 602 and an exemplary second static storage element 604. Without storage element pointers, a tensor composed of the first static storage element 602 and the second static storage element 604 is arranged as a continuous stream of data in memory. Thus, for a tensor with 2N channels (e.g., Z=2), the data layout in memory is arranged as shown in FIG.
[0069] FIG. 7 is a graph diagram 700 illustrating a data layout in memory with storage element pointers. The graph diagram 700 includes an exemplary first dynamic storage element 702, an exemplary second dynamic storage element 704, and an exemplary third dynamic storage element 706. Because the storage element pointers allow the first dynamic storage element 702, the second dynamic storage element 704, and the third dynamic storage element 706 to start anywhere in memory, if data in consecutive XY positions is repeated, the storage element pointers allow the exemplary tensor to be reformatted deeper without duplicating data. For example, as storage element pointers are added, the Z values of each XY position (e.g., each of the first dynamic storage element 702, the second dynamic storage element 704, and the third dynamic storage element 706) overlap with the previous XY position, so fractional striding may be applied to increase the depth of the tensor without duplicating data. The fractional stride length defines the overlap of consecutive XY positions of the tensor. In the example of FIG. 7, the fractional stride is 50%.
[0070] Implementing sparsity allows the MAC circuit 220 to reduce the number of MAC operations performed by skipping a MAC operation if either the input tensor or the weight kernel is zero. In general, the MAC circuit 220 performs a computation cycle if the input tensor sparsity bitmap and the weight sparsity bitmap indicate that both the corresponding activations of the input tensor and weight are non-zero. Because the sparsity bitmap contains one bit for every byte of activation or weight data, the sparsity bitmap has a 12.5% overhead when compared to dense data.
[0071] Returning to Figure 2, the AI accelerator circuit 208 includes a data read circuit 218. The exemplary data read circuit 218 is coupled to a local memory 216 and a MAC circuit 220. In the example of Figure 2, the data read circuit 218 is structured to perform specific operations and is implemented by one or more dedicated electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of Figure 2, the data read circuit 218 reads compressed data stored in the local memory 216.
[0072] In the illustrated example of FIG. 2, the AI accelerator circuit 208 includes a MAC circuit 220. The exemplary MAC circuit 220 is coupled to the data read circuit 218 and the data write circuit 222. In the example of FIG. 2, the MAC circuit 220 is structured to perform a particular operation and is implemented by one or more dedicated electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). For example, the MAC circuit 220 includes one or more buffers, a decompression circuit, one or more MAC circuits, and a control logic circuit. In the illustrated example of FIG. 2, the MAC circuit 220 reads one or more input tensors and one or more weight kernels, and processes the one or more input tensors and one or more weight sets to generate one or more output tensors. The MAC circuit 220 is further described in connection with FIG. 11.
[0073] In the illustrated example of FIG. 2, the AI accelerator circuitry 208 includes a data write circuitry 222. The exemplary data write circuitry 222 is coupled to the MAC circuitry 220 and the local memory 216. In the example of FIG. 2, the data write circuitry 222 is structured to perform specific operations and is implemented by one or more dedicated electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 2, the data write circuitry 222 writes results generated by the MAC circuitry 220 to the local memory 216. For example, the data write circuitry 222 writes a compressed output tensor and a corresponding sparsity bitmap to the local memory 216.
[0074] FIG. 8 is a block diagram illustrating an example implementation of the example data replication pre-processing circuit 212 of FIG. 2. As described above, the data replication pre-processing circuit 212 generates a reformatted input tensor that is deeper than the non-reformatted input tensor. In the illustrated example of FIG. 8, the data replication pre-processing circuit 212 includes an example parameter determination circuit 802, an example padding circuit 804, and an example storage control circuit 806. In the example of FIG. 8, any of the parameter determination circuit 802, the padding circuit 804, and / or the storage control circuit 806 can communicate via an example communication bus 808. In the examples disclosed herein, the communication bus 808 can be implemented using any suitable wired and / or wireless communication. In additional or alternative examples, the communication bus 808 includes software, machine-readable instructions, and / or communication protocols by which information is communicated between the parameter determination circuit 802, the padding circuit 804, and / or the storage control circuit 806.
[0075] In the illustrated example of FIG. 8, the parameter determination circuit 802 is implemented with one or more instructions (e.g., software) for performing specific operations on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 8, the parameter determination circuit 802 determines one or more parameters of an input tensor and a weight kernel. For example, the parameter determination circuit 802 selects a weight kernel to be processed and determines the width, height and stride of the weight kernel. The parameter determination circuit 802 additionally determines the width, height and depth of the input tensor to be convolved with the selected weight kernel.
[0076] In the illustrated example of FIG. 8, the padding circuit 804 is implemented with one or more instructions (e.g., software) for performing specific operations on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 8, the padding circuit 804 determines whether extrinsic padding is applied to the input tensor. For example, the padding circuit 804 determines whether extrinsic padding is applied to the input tensor based on the dimensions of the weight kernel and / or the desired dimensions of the output tensor. In such an example, if the weight kernel has a width greater than one and the desired dimensions of the output tensor are the same as those of the input tensor, the padding circuit 804 determines that extrinsic padding is applied to the input tensor.
[0077] In the illustrated example of FIG. 8, the external padding corresponds to the padding circuit 804 adding one or more pads to the left and right side of the input tensor. For example, in response to determining that padding is applied to the input tensor, the padding circuit 804 loads one or more pads (e.g., to the left of the input tensor based on the dimensions of the weight kernel) before the first X position (X=-1, Y=0) in the first Y position of the input tensor. Additionally, the padding circuit 804 loads one or more pads (e.g., to the right of the input tensor) after the last X position (e.g., the last point) (X=i+1, Y=0) in the first Y position of the input tensor. In the example of FIG. 8, the external pad applied to the input tensor is equal to the depth of the input tensor (e.g., 3 channels, 3 bytes, etc.). To load the external pads into the system memory 204, the padding circuit 804 instructs the DMA circuit 206 to implement one or more byte offsets when copying the data of the input tensor. In the examples disclosed herein, the external pad is data with null values inserted around the edges of a tensor. The external pad bytes disclosed herein are implemented as sparsity and do not occupy any space in memory when not loaded into memory. For example, while the padding circuitry 804 is inserting external pads to the right and left of the input tensor in memory, the CPU 202 instructs the AI accelerator circuitry 208 to implement external pads above and below the input tensor via sparsity. Thus, since the top and bottom external pads are implemented by the AI accelerator circuitry 208 via sparsity, the padding circuitry 804 does not consider the height of the weight kernel when determining whether external padding is applied to the input tensor.
[0078] In the depicted example of Figure 8, storage control circuitry 806 is implemented with one or more instructions (e.g., software) for performing specific operations on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of Figure 8, in response to padding circuitry 804 determining that padding is not applied, storage control circuitry 806 selects a first Y location of the input tensor to be reformatted. Additionally, storage control circuitry 806 selects a first X location of the input tensor at the selected Y location.
[0079] In the illustrated example of FIG. 8, the storage control circuitry 806 copies the Z value from the selected XY location to the depth of the input tensor of consecutive XY locations that overlap the width of the weight kernel to be convolved with the input tensor. In some examples disclosed herein, the XY location is referred to as the intersection of the first point along the first dimension of the first tensor and the first point along the second dimension of the first tensor. Additionally, in some examples disclosed herein, the one or more Z values are referred to as one or more values along the third dimension of the first tensor. Also, in some examples disclosed herein, the consecutive XY locations that overlap the width of the weight kernel are referred to as consecutive intersections of a plurality of points along the first and second dimensions that overlap the width of the weight kernel.
[0080] In the illustrated example of FIG. 8, the storage control circuit 806 successively loads the copied Z values into the next XY positions of the reformatted tensor. For example, in the first iteration, the storage control circuit 806 successively loads the copied Z values into the first XY positions (X=0, Y=0) of the reformatted tensor. In some examples disclosed herein, the successive loading of the copied Z values into the next XY positions of the reformatted tensor is referred to as successively loading one or more values along the third dimension of the first tensor into the first intersection of the first point along the first dimension of the second tensor and the first point along the second dimension of the second tensor. In subsequent iterations, the storage control circuit 806 loads the copied Z values into the next XY positions of the reformatted tensor equal to the number of iterations after the first iteration. For example, the storage control circuit 806 may implement a counter to track the number of iterations after the first iteration.
[0081] In the illustrated example of FIG. 8, the storage control circuitry 806 determines whether there is enough input tensor data outside the width of the weight kernel to generate another column of the reformatted input tensor. For example, depending on the stride of the weight kernel, more than one additional X position may be required to generate another column of the reformatted input tensor. If the stride of the weight kernel is one, the storage control circuitry 806 determines whether there is an additional X position (e.g., an additional point) of the input tensor outside the width of the weight kernel. In response to determining that there is enough input tensor data outside the width of the weight kernel, the storage control circuitry 806 selects the next X position of the input tensor at the selected Y position according to the stride of the weight kernel. In response to determining that there is not enough input tensor data outside the width of the weight kernel, the storage control circuitry 806 determines whether there is enough input tensor data outside the height of the weight kernel to generate another row of the reformatted input tensor. For example, depending on the stride of the weight kernel, more than one additional Y position may be required to generate another row of the reformatted input tensor.
[0082] In the illustrated example of Figure 8, if the stride of the weight kernel is 1, the storage control circuit 806 determines whether there are additional Y positions (e.g., additional points) of the input tensor outside the height of the weight kernel. In response to the storage control circuit 806 determining that there is enough input tensor data outside the height of the weight kernel, the storage control circuit 806 selects the next Y position of the input tensor according to the stride of the weight kernel. In response to the storage control circuit 806 determining that there is not enough input tensor data outside the height of the weight kernel, the process proceeds and the parameter determination circuit 802 determines whether there are additional weight kernels to be processed.
[0083] 9 is a dataflow diagram 900 illustrating an example reshaping of (a) an example input tensor 902 with an example weight set 904 to determine an example output tensor 906 to (b) an example reformatted input tensor 908 with an example reformatted weight set 910 to determine an example output tensor 906. In the example of FIG. 9, the input tensor 902 is a 224×224×3 tensor and the weight set includes 64 7×7×3 weight kernels with a stride of 2. The example output tensor 906 is a 112×112×64 tensor.
[0084] 9, in accordance with the tensor data replication configuration, the data replication pre-processing circuit 212 reformats an input tensor 902 and a weight set 904 to generate a reformatted input tensor 908 and a reformatted weight set 910. The reformatted input tensor 908 and the reformatted weight set 910 have different dimensions (i.e., depth) than the input tensor 902 and the weight set 904, but convolving the reformatted tensors results in an output tensor that is equivalent to the same constant (e.g., output tensor 906).
[0085] In the illustrated example of FIG. 9, the data replication pre-processing circuit 212 reformats the weight kernels of the weight set 904 such that the X dimension of each of the weight kernels is repacked along the Z dimension to reformat the individual weight kernels of the weight set 904 from a 7×7 filter with a depth of 3 to a 1×7 filter with a depth of 21 (e.g., reformatted weight set 910). The values of the weight set 904 are not changed. In the example of FIG. 9, the shape of the weight kernels of the weight set 904 is reformatted into the reformatted weight set 910, but the manner in which the weight set 904 is stored in memory does not change. Instead, to reformat the weight set 904, the MAC circuit 220 orders the weight set 904 through the MAC circuit of FIG. 11 to accommodate the new dimensions of the reformatted input tensor 908.
[0086] In the depicted example of Figure 9, the data replication pre-processing circuit 212 reformats the input tensor 902 to match the depth of the reformatted weight set 910. Such reformatting includes replicating some of the existing pixels and repacking such pixels along the Z dimension to match the depth of the reformatted weight set 910. As shown in Figure 9, convolving the reformatted input tensor 908 with the reformatted weight set 910 results in the same output tensor (e.g., output tensor 906) as convolving the input tensor 902 with the weight set 904, but the former convolution utilizes a deeper input tensor and therefore results in improved performance compared to the latter convolution.
[0087] FIG. 10 is a block diagram illustrating an example implementation of the example fractional stride pre-processing circuit 214 of FIG. 2. As described above, the fractional stride pre-processing circuit 214 reformats input tensors via fractional striding using storage element pointers and sparsity. In the illustrated example of FIG. 10, the fractional stride pre-processing circuit 214 includes an example tensor and weight control circuit 1002, an example padding control circuit 1004, an example sparsity generation circuit 1006, and an example pointer control circuit 1008. In the example of FIG. 10, any of the tensor and weight control circuit 1002, the padding control circuit 1004, the sparsity generation circuit 1006, and / or the pointer control circuit 1008 can communicate via an example communication bus 1010. In the examples disclosed herein, the communication bus 1010 can be implemented using any suitable wired and / or wireless communication. In additional or alternative examples, the communications bus 1010 includes software, machine-readable instructions and / or communications protocols by which information is communicated between the tensor and weight control circuitry 1002, the padding control circuitry 1004, the sparsity generation circuitry 1006 and / or the pointer control circuitry 1008.
[0088] As mentioned above, the storage element pointer has a granularity based on the memory word size, which is 16 bytes in the example of Figure 10. Because the input tensor to the first layer of the NN has fewer channels (e.g., 3<16) than the granularity of the storage element pointer, the fractional stride preprocessing circuit 214 increases the effective depth of the input tensor by taking advantage of sparsity and input tensor operations to refine the fractional striding.
[0089] In the illustrated example of FIG. 10, the tensor and weight control circuit 1002 is implemented with one or more instructions (e.g., software) for performing specific operations on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 10, the tensor and weight control circuit 1002 determines one or more parameters of the input tensor and weight kernels. For example, the tensor and weight control circuit 1002 selects a weight kernel to be processed and determines the width, height and stride of the weight kernel. The tensor and weight control circuit 1002 additionally determines the width, height and depth of the input tensor to be convolved with the selected weight kernel.
[0090] In the illustrated example of Figure 10, the tensor and weight control circuit 1002 also replicates the selected weight kernel to generate N weight kernels to match the number of points of the output tensor that can be generated per XY location of the reformatted input tensor. After the input tensor is reformatted via fractional striping with storage element pointers and sparsity, the tensor and weight control circuit 1002 offloads the input tensor, one or more weight kernels, and one or more weight sparsity bitmaps to be processed and / or stored in memory. In an example where the input tensor is shallow, the weight control circuit 1002 offloads the input tensor as dense data.
[0091] In the illustrated example of FIG. 10, padding control circuit 1004 is implemented with one or more instructions (e.g., software) for performing specific operations on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 10, padding control circuit 1004 determines whether external padding is applied to the input tensor. For example, padding control circuit 1004 determines whether external padding is applied to the input tensor based on the dimensions of the weight kernel and / or the desired dimensions of the output tensor. In such an example, if the weight kernel has a width greater than one and the desired dimensions of the output tensor are the same as those of the input tensor, padding control circuit 1004 determines that external padding is applied to the input tensor.
[0092] In the illustrated example of FIG. 10, the external padding corresponds to padding control circuit 1004 adding one or more pads to the left and right side of the input tensor. For example, in response to determining that padding is applied to the input tensor, padding control circuit 1004 loads one or more pads (e.g., to the left side of the input tensor based on the dimension of the weight kernel) before the first X position (X=-1, Y=0) in the first Y position of the input tensor. Additionally, padding control circuit 1004 loads one or more pads (e.g., to the right side of the input tensor) after the last X position (e.g., the last point) (X=i+1, Y=0) in the first Y position of the input tensor. For example, for a 3×3 weight kernel with a stride of 1, padding control circuit 1004 adds one external pad to the left of the XY plane and one external pad to the right of the XY plane. In the example of FIG. 10, the external pads applied to the input tensor are equal to the depth of the input tensor. Thus, in one such example, padding control circuitry 1004 adds an external pad having a depth of 3 bytes to the left of the input tensor and an external pad having a depth of 3 bytes to the right of the input tensor. In another example, for a 5×5 weight kernel with a stride of 1, padding control circuitry 1004 adds two external pads to the left of the XY plane and two external pads to the right of the XY plane. In one such example, padding control circuitry 1004 adds two external pads, each having a depth of 3 bytes, to the left of the input tensor and two external pads, each having a depth of 3 bytes to the right of the input tensor.
[0093] In the illustrated example of FIG. 10, to load the external pad into the system memory 204, the padding control circuit 1004 instructs the DMA circuit 206 to implement one or more byte offsets when copying the data of the input tensor. The external pad bytes disclosed herein are implemented as sparsity and do not occupy any space in memory when not loaded into memory. For example, while the padding control circuit 1004 inserts external pads to the right and left of the input tensor in memory, the CPU 202 instructs the AI accelerator circuit 208 to implement external pads above and below the input tensor via sparsity. Thus, since the top and bottom external pads are implemented by the AI accelerator circuit 208 via sparsity, the padding control circuit 1004 does not consider the height of the weight kernel when determining whether external padding is applied to the input tensor.
[0094] In the illustrated example of FIG. 10, the sparsity generator circuit 1006 is implemented with one or more instructions (e.g., software) for performing specific operations on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 10, the sparsity generator circuit 1006 determines whether inner padding is applied to the input tensor. For example, the sparsity generator circuit 1006 determines whether inner padding is applied to the input tensor by dividing the granularity of the storage elements by the depth of the input tensor. If the remainder of the division operation is not zero, the sparsity generator circuit 1006 determines that inner padding is applied, and vice versa.
[0095] In the illustrated example of FIG. 10, in response to determining that inner padding is applied to the input tensor, the sparsity generation circuit 1006 separates the Z values of each XY location of the input tensor by the number of pads. To determine the number of pads, the sparsity generation circuit 1006 first rounds the depth of the input tensor to the nearest multiple of 4 that returns a zero remainder when divided to the granularity of the storage element. For example, if the granularity of the storage element is 16 bytes and the depth of the input tensor is 3, the sparsity generation circuit 1006 rounds 3 to 4 because 4 divides evenly into 16. The sparsity generation circuit 1006 then finds the difference between the rounded value and the depth of the input tensor to determine the number of pads. For example, if the granularity of the storage element is 16 and the depth of the input tensor is 3, the sparsity generation circuit 1006 determines the number of pads to be 1 (e.g., 4-3=1). In the examples disclosed herein, the length of the internal padding of the input tensor is 1 byte.
[0096] In the illustrated example of FIG. 10, the sparsity generation circuit 1006 generates N weight sparsity bitmaps. Each weight sparsity bitmap includes a sparsity pattern that is offset from the start of the respective weight sparsity bitmap by the product of the number of strides of the selected weight kernel plus the depth of the input tensor plus the number of internal pads. In the example of FIG. 10, N is equal to the number of weight kernels that match the number of points of the output tensor that can be generated for each XY position of the reformatted input tensor. The offset of each sparsity pattern depends on the depth of the input tensor and the number of internal pads. For example, if the depth of the input tensor is 3 and the number of internal pads is 1, the offset is equal to the number of strides of the selected weight kernel plus 4. In the example of FIG. 10, the sparsity pattern of each weight sparsity bitmap includes d consecutive 1-bit w K Includes a set. K is the width of the weight kernel and d is the depth of the input tensor. If inner padding is applied to the input tensor, w KEach of the sets is appended with one or more zero bits equal to the number of internal pads. Thus, for a weight kernel with a width of 3, and an input tensor with a depth of 3 and internal padding of 1, the sparsity pattern of each weight sparsity bitmap includes three sets of three consecutive 1 bits. Each set is appended with one zero bit (e.g., [1,1,1,0,1,1,1,0,1,1,1,0]). The total number of 1 bits generated by the sparsity generation circuit 1006 for the N sparsity bitmaps is equal to the product of the width of the weight kernel, the height of the weight kernel, and the depth of the input tensor.
[0097] In the illustrated example of Figure 10, the pointer control circuitry 1008 is implemented with one or more instructions (e.g., software) for performing specific operations on one or more general-purpose semiconductor-based electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of Figure 10, the pointer control circuitry 1008 determines a fractional stride offset to apply to successive storage element pointers based on N, the depth of the input tensor, the stride of the weight kernel, and the internal pad length, if applicable. For example, the pointer control circuitry 1008 determines the fractional stride offset according to Equation 1 below: FS OFFSET =N+(NUM_CHANNELS+PAD)*STRIDE formula 1
[0098] In the illustrated example of FIG. 10, N is equal to the number of weight kernels that correspond to the number of points of the output tensor that can be generated per XY position of the reformatted input tensor. In one example, if a 3×3 kernel with a stride of 1 is being convolved with an input channel of depth 3, the internal pads will be of length 1. In such an example, the number of points of the output tensor that can be generated per XY position of the reformatted input tensor. Thus, the fractional stride offset is equal to 4×(3 bytes+1 pad byte)×1=16 bytes. In the illustrated example of FIG. 10, the pointer control circuit 1008 determines the fractional striding offset and then shifts the successive storage element pointers by this offset.
[0099] Figure 11 is a block diagram illustrating an example implementation of the example MAC circuit 220 of Figure 2. In the example of Figure 11, the MAC circuit 220 includes an example control logic circuit 1102, an example weight buffer 1104, an example weight decompression circuit 1106, an example input tensor buffer 1108, an example input tensor decompression circuit 1110, and a MAC circuit 1112. 1,1 From 1112 1,M , 1114 2,1 From 1114 2,M and 1116 N,1 From 1116 N,M 11, the control logic 1102 is structured to perform specific operations and is implemented by one or more dedicated electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). The exemplary control logic 1102 is coupled to a weight buffer 1104, a weight decompression circuit 1106, an input tensor buffer 1108, and an input tensor decompression circuit 1110.
[0100] In the illustrated example of FIG. 11, the control logic 1102 receives one or more weight kernels and a corresponding weight sparsity bitmap. Additionally, the exemplary control logic 1102 receives one or more input tensors and an input tensor sparsity bitmap. In an example where the input tensors are shallow, the control logic 1102 does not receive the input tensor sparsity bitmap because the input tensors are too shallow to take advantage of the sparsity. In the example of FIG. 11, the control logic 1102 transfers one or more weight kernels to the weight buffer 1104 after processing such data, and transfers the corresponding weight sparsity bitmap to the weight decompression circuit 1106 after processing such data. Additionally, the control logic 1102 transfers one or more input tensors to the input tensor buffer 1108 after processing such data. For later layers in the neural network (e.g., when the input tensor is deep), the control logic 1102 also forwards the corresponding input tensor sparsity bitmap to the input tensor decompression circuit 1110 after processing such data. In some examples, the control logic 1102 implements a data duplication preprocessing circuit 212 and / or a fractional stride preprocessing circuit 214.
[0101] In the illustrated example of Figure 11, each of the weight buffer 1104 and the input tensor buffer 1108 is implemented with SRAM. In additional or alternative examples, each of the weight buffer 1104 and the input tensor buffer 1108 is implemented with other volatile memory (e.g., DRAM, SDRAM, RDRAM, etc.) and / or non-volatile memory (e.g., flash memory). In the example of Figure 11, the weight buffer 1104 is coupled to the control logic circuit 1102 and the weight decompression circuit 1106.
[0102] In the illustrated example of FIG. 11, the weight decompression circuit 1106 includes a control logic circuit 1102, a weight buffer 1104, a MAC circuit 1112, and a 1、1 From 1112 1,M The first column, MAC circuit 11141,1 From 1114 1,M The second column and MAC circuit 1116 N,1 From 1116 N,M 11. In the example of FIG. 11, the weight decompression circuit 1106 is structured to perform specific operations and is implemented by one or more dedicated electrical circuits that include one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 11, the exemplary weight decompression circuit 1106 processes the compressed weight data (e.g., the sparse weight kernel and corresponding weight sparsity bitmap) and converts the sparse weight data into dense weight data. After the weight decompression circuit 1106 decompresses the compressed weight data, it transmits the dense weight data to the MAC circuit 1112. 1,1 From 1112 1,M The first column, MAC circuit 1114 1,1 From 1114 1,M The second column and MAC circuit 1116 N,1 From 1116 N,M The Nth column of the
[0103] In the illustrated example of Figure 11, the input tensor buffer 1108 is coupled to the control logic circuitry 1102 and the input tensor decompression circuitry 1110. In the example of Figure 11, the input tensor decompression circuitry 1110 includes the control logic circuitry 1102, the input tensor buffer 1108, the MAC circuitry 1112, and the 1,1 , 1114 2,1 and 1116 N,1 The first row of MAC circuit 1112 1,2 , 1114 2,2 and 1116 N,2 The second row of, and MAC circuit 1112 1,M , 1114 2,M and 1116 N,M11 , the input tensor decompression circuit 1110 is structured to perform specific operations and is implemented by one or more dedicated electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 11 , the exemplary input tensor decompression circuit 1110 processes the compressed input tensor data (e.g., sparse input tensor and corresponding input tensor sparsity bitmap) and converts the sparse input tensor data into dense input tensor data. After the input tensor decompression circuit 1110 decompresses the compressed input tensor data, it transmits the dense input tensor data to a MAC circuit 1112. 1,1 , 1114 2,1 and 1116 N,1 The first row of MAC circuit 1112 1,2 , 1114 2,2 and 1116 N,2 The second row of, and MAC circuit 1112 1,M , 1114 2,M and 1116 N,M If no input tensor sparsity bitmap is received, the input tensor decompression circuit 1110 transmits the input tensor data to the MAC circuit 1112 since the input tensor data is already dense. 1,1 , 1114 2,1 and 1116 N,1 The first row of MAC circuit 1112 1,2 , 1114 2,2 and 1116 N,2 The second row of, and MAC circuit 1112 1,M , 1114 2,M and 1116 N,M Then, the Mth row of the
[0104] In the illustrated example of FIG. 1,1 , 1112 1,2 , 1112 1,M , 1114 2,1 , 1114 2,2 , 1114 2,M , 1116 N,1, 1116 N,2 and 1116 N,M Each of the MAC circuits (collectively, the MAC circuits of FIG. 11 ) is structured to perform a particular operation and is implemented by one or more dedicated electrical circuits including one or more semiconductor-based logic devices (e.g., electrical hardware implemented by one or more transistors). In the example of FIG. 11 , each of the MAC circuits of FIG. 11 receives weight data from the weight decompression circuit 1106 and input tensor data from the input tensor decompression circuit 1110. Each of the MAC circuits of FIG. 11 performs multiple MAC operations per cycle. For example, each of the MAC circuits of FIG. 11 performs eight MAC operations per cycle. In the example of FIG. 11 , each MAC operation performed by each of the MAC circuits of FIG. 11 corresponds to each of the MAC circuits of FIG. 11 processing activation data for an XY position of the input tensor. The MAC circuits of FIG. 11 are configured to receive up to 32 channels of activation data per clock cycle, allowing for efficient utilization of the MAC circuit 220 when the channel depth of the input tensor is high (e.g., for input tensors having a depth greater than or equal to 16).
[0105] FIG. 12 is a dataflow diagram illustrating an example convolution 1200 of an example input tensor 1202 with no padding and an example set of 3×3×3 weight kernels 1204 with a stride of 1 to determine an example output tensor 1206. In the example of FIG. 12, the input tensor 1202 has dimensions X=4, Y=4, and Z=3. The input tensor 1202 is stored in memory in a Z-major format with three channels. In the example of FIG. 12, each XY location on the input tensor 1202 occupies a location in memory that is 16 byte aligned. Thus, the memory after the channels of the input tensor 1202 (e.g., Z>2) are unused bytes. In some examples, no data is stored in the unused bytes, but in additional or alternative examples, the unused bytes may contain data with a corresponding sparsity bitmap of zeros. In the example of FIG. 12, as a result of the 16 byte alignment (eg, 16-3=13), there are 13 unused bytes in memory per XY location.
[0106] In the illustrated example of Figure 12, the input tensor 1202 includes a first Z value 1208 at a first XY location of the input tensor 1202, a second Z value 1210 at a second XY location of the input tensor 1202, a third Z value 1212 at a third XY location of the input tensor 1202, and a fourth Z value 1214 at a fourth XY location of the input tensor 1202. In the example of Figure 12, the set of 3x3x3 weight kernels 1204 includes an exemplary first weight kernel 1216, an exemplary second weight kernel 1218, an exemplary third weight kernel 1220, and an exemplary fourth weight kernel 1222. Each of the first weight kernel 1216, the second weight kernel 1218, the third weight kernel 1220, and the fourth weight kernel 1222 has a depth of 3. Thus, each of the first weight kernel 1216, the second weight kernel 1218, the third weight kernel 1220, and the fourth weight kernel 1222 occupies 27 bytes in memory (e.g., X KERNEL *Y KERNEL*NUM_CHANNELS). Thus, the MAC circuit performs 27 MAC operations to generate each of the output points 1224, 1226 of the output tensor 1206. In the example of FIG. 12, each of the first weight kernel 1216, the second weight kernel 1218, the third weight kernel 1220 and the fourth weight kernel 1222 are used four times to generate a single channel (e.g., a step in K) in the output tensor 1206.
[0107] In the example of Figure 12, each of the first weight kernel 1216, the second weight kernel 1218, the third weight kernel 1220, and the fourth weight kernel 1222 are stored contiguously in memory. That is, each of the first weight kernel 1216, the second weight kernel 1218, the third weight kernel 1220, and the fourth weight kernel 1222 are stored in memory as a 27 x 1 array. In the example of Figure 12, the first weight kernel 1216, the second weight kernel 1218, the third weight kernel 1220, and the fourth weight kernel 1222 are shown as 3 x 3 x 3 tensors to show how the set of 3 x 3 x 3 weight kernels 1204 maps to the input tensor 1202.
[0108] FIG. 13 is a dataflow diagram illustrating an example convolution 1300 of an example reformatted input tensor 1302 without padding with an example set of reformatted 1×3×9 weight kernels 1304 with a stride of 1 to determine the example output tensor 1206 of FIG. 12. In the example of FIG. 13, the reformatted input tensor 1302 has dimensions X=2, Y=4 and Z=9. The Z dimension of the reformatted input tensor 1302 may be determined as the product of the width of the first weight kernel 1216 and the number of channels of the input tensor 1202 (e.g., Z REFORMATTED =X KERNEL*NUM_CHANNELS). In the example of FIG. 13, each XY location on the reformatted input tensor 1302 occupies a location in memory that is 16 byte aligned. Thus, the memory after the channels of the reformatted input tensor 1302 (e.g., Z>8) are unused bytes. In the example of FIG. 13, the data replication preprocessing circuit 212 reformats the input tensor 1202 according to the tensor data replication configuration to generate the reformatted input tensor 1302.
[0109] In the depicted example of Figure 13, the set of reformatted 1x3x9 weight kernels 1304 includes an exemplary first weight kernel 1306, an exemplary second weight kernel 1308, an exemplary third weight kernel 1310 and an exemplary fourth weight kernel 1312. In the example of Figure 13, the input tensor 1202 is a set of 1x3x9 weight kernels 1304 with each weight kernel having dimensions of x KERNEL *Y KERNEL From 1*Y KERNEL For example, each of the first weight kernel 1306, the second weight kernel 1308, the third weight kernel 1310 and the fourth weight kernel 1312 is a 1×3 kernel with a depth of 9.
[0110] 13, the shape of each of the set of 3×3×3 weight kernels 1204 is reformatted into a set of reformatted 1×3×9 weight kernels 1304, but the manner in which the set of 3×3×3 weight kernels 1204 is stored in memory does not change. Instead, to reformatting the set of 3×3×3 weight kernels 1204, the MAC circuitry 220 orders the set of 3×3×3 weight kernels 1204 through the MAC circuitry of FIG. 11 to accommodate the new dimensions of the reformatted input tensor 1302.
[0111] In the illustrated example of FIG. 13, the parameter determination circuit 802 determines a width (e.g., 3), height (e.g., 3) and stride (e.g., 1) of the first weight kernel 1216. The parameter determination circuit 802 additionally determines a width (e.g., 4), height (e.g., 4) and depth (e.g., 3) of the input tensor 1202. The storage control circuit 806 then selects a first Y position (e.g., Y=0) of the input tensor 1202. The storage control circuit 806 additionally selects a first X position (e.g., X=0, Y=0) of the input tensor 1202 at the selected Y position.
[0112] In the illustrated example of FIG. 13, the storage control circuit 806 copies one or more Z values from the selected XY position to the depth of the input tensor 1202 in consecutive XY positions that overlap the width of the first weight kernel 1216. For example, because the storage control circuit 806 starts at the first XY position (X=0, Y=0) of the input tensor 1202 and the width of the first weight kernel 1216 is 3, the storage control circuit 806 copies the first Z value 1208, the second Z value 1210, and the third Z value 1212. The storage control circuit 806 loads the copied one or more Z values into the next XY position of the reformatted input tensor 1302. If this is the first load operation, the storage control circuit 806 loads the copied one or more Z values into the first XY position (X=0, Y=0) of the reformatted input tensor 1302 and increments the X position for the subsequent iteration.
[0113] Thus, the storage control circuit 806 loads the first Z value 1208, followed by the second Z value 1210, and then the third Z value 1212 into the first XY position (X=0, Y=0) of the reformatted input tensor 1302. The storage control circuit 806 then determines whether there is enough data (e.g., additional X positions) of the input tensor 1202 outside the width of the first weight kernel 1216. Because the fourth XY position (X=3, Y=0) of the input tensor 1202 is outside the width of the first weight kernel 1216, the storage control circuit 806 selects the next X position of the input tensor 1202 at the selected Y position according to the stride of the first weight kernel 1216. Because the stride of the first weight kernel 1216 is 1, the storage control circuit 806 selects the second XY position (X=1, Y=0) of the input tensor 1202.
[0114] 13, the storage control circuit 806 copies one or more Z values from the selected XY location to the depth of the input tensor 1202 in consecutive XY locations that overlap the width of the first weight kernel 1216. For example, because the storage control circuit 806 is starting at the second XY location (X=1, Y=0) of the input tensor 1202 and the width of the first weight kernel 1216 is 3, the storage control circuit 806 copies the second Z value 1210, the third Z value 1212, and the fourth Z value 1214. The storage control circuit 806 loads the copied Z value or values into the next XY location of the reformatted input tensor 1302.
[0115] Thus, for example, since the previously loaded XY position was the first XY position of the reformatted input tensor 1302, the storage control circuit 806 loads the second Z value 1210, followed by the third Z value 1212, and then the fourth Z value 1214 into the second XY position (X=1, Y=0) of the reformatted input tensor 1302. The process continues in a similar manner for the vertical stride of the first weight kernel 1216.
[0116] As shown in the example of FIG. 13, for a set of 3×3×3 weight kernels 1204 with a stride of 1, the reformatted input tensor 1302 has a smaller memory footprint when compared to the input tensor 1202. For example, the memory footprint is reduced by a factor of X / (X+2). In some examples (e.g., for the input layer to the model), X is actually large, so a limited reduction in memory footprint is provided. Additionally, for a set of 3×3×3 weight kernels 1204 with a stride of 1, the reformatted input tensor 1302 provides a 33% reduction in the number of input tensor memory reads (e.g., convolution with a 3×1 kernel instead of a 3×3 kernel). The reduction in the number of memory reads results in less data movement and less memory bandwidth requirements, both of which result in lower power consumption and improved performance. Thus, the data duplication preprocessing circuit 212 improves the performance of the operation to generate the output tensor 1206. The data duplication pre-processing circuit 212 is applicable to all kernel sizes and can adjust the width of the weight kernel (e.g., X KERNEL ) is changed to 1, and the Z dimension of the reformatted input tensor is changed to the product of the width of the weight kernel and the number of channels in the input tensor (e.g., Z REFORMATTED =X KERNEL *NUM_CHANNELS).
[0117] FIG. 14 is a data flow diagram illustrating an example convolution 1400 of an example reformatted input tensor 1402 without padding with an example 3×3×3 weight kernel with a stride of 1 and one or more weight sparsity bitmaps 1404 to facilitate refined fractional striding. In the example of FIG. 14, the fractional stride pre-processing circuit 214 repurposes the weight sparsity to refine the fractional stride and allow input tensor activations selected at 4-byte granularity. The fractional stride pre-processing circuit 214 generates the reformatted input tensor 1402 from the example input tensor 1406 by combining the sparsity with storage element pointers. In the example of FIG. 14, the input tensor 1406 has dimensions X=12, Y=4, and Z=3.
[0118] 14, the input tensor 1406 includes a first Z value 1408 at a first XY location of the input tensor 1406, a second Z value 1410 at a second XY location of the input tensor 1406, a third Z value 1412 at a third XY location of the input tensor 1406, and a fourth Z value 1414 at a fourth XY location of the input tensor 1406. The input tensor 1406 also includes a fifth Z value 1416 at a fifth XY location of the input tensor 1406, a sixth Z value 1418 at a sixth XY location of the input tensor 1406, a seventh Z value 1420 at a seventh XY location of the input tensor 1406, and an eighth Z value 1422 at an eighth XY location of the input tensor 1406. Additionally, the input tensor 1406 includes a ninth Z value 1424 at a ninth XY position of the input tensor 1406, a tenth Z value 1426 at a tenth XY position of the input tensor 1406, an eleventh Z value 1428 at an eleventh XY position of the input tensor 1406, and a twelfth Z value 1430 at a twelfth XY position of the input tensor 1406.
[0119] 14, the sparsity generator circuit 1006 determines whether inner padding is applied to the input tensor 1406. For example, the sparsity generator circuit 1006 determines whether inner padding is applied to the input tensor 1406 by dividing the granularity of the storage elements by the depth of the input tensor 1406. If the remainder of the division operation is not zero, the sparsity generator circuit 1006 determines that inner padding is applied, and vice versa.
[0120] In the illustrated example of Figure 14, in response to determining that interior padding is applied to the input tensor 1406, the sparsity generation circuit 1006 separates the Z values for each XY location of the input tensor 1406 by the number of pads. To determine the number of pads, the sparsity generation circuit 1006 first rounds the depth of the input tensor 1406 to the nearest multiple of four that returns a remainder of zero when divided to the granularity of a storage element (e.g., 16). The sparsity generation circuit 1006 then finds the difference between the rounded value and the depth of the input tensor 1406 to determine the number of pads.
[0121] In the illustrated example of FIG. 14, the granularity of the storage element is 16 and the depth of the input tensor 1406 is 3. Thus, the sparsity generation circuit 1006 determines that the number of pads is 1 (e.g., 4-3=1). In the example disclosed herein, the length of the internal pad of the input tensor is 1 byte. Thus, the channels of the input tensor 1406 are padded internally to 4 bytes, and groups of three channels are aligned to the granularity of the storage element (e.g., 4×(3 channel bytes+1 pad byte)=16 bytes). Because the weight sparsity bitmap is zero for the internal pad bytes, the internal pad bytes are not processed.
[0122] In the illustrated example of Figure 14, the tensor and weight control circuit 1002 replicates each weight kernel to be convolved with the input tensor 1406 to generate N weight kernels for each weight kernel, where N corresponds to the number of points of the output tensor that can be generated for each XY location of the reformatted input tensor 1402. In the example of Figure 14, the MAC circuit 220 can generate four points of the output tensor for each XY location of the reformatted input tensor 1402. For example, the MAC circuit 220 generates a first point of the output tensor based on the first Z value 1408, the second Z value 1410, and the third Z value 1412; a second point of the output tensor based on the second Z value 1410, the third Z value 1412, and the fourth Z value 1414; a third point of the output tensor based on the third Z value 1412, the fourth Z value 1414, and the fifth Z value 1416; and a fourth point of the output tensor based on the fourth Z value 1414, the fifth Z value 1416, and the sixth Z value 1418. Thus, the tensor and weight control circuit 1002 replicates each weight kernel to generate four weight kernels for each weight kernel. Additionally, the sparsity generation circuit 1006 generates one or more weight sparsity bitmaps 1404. Each weight sparsity bitmap includes a different weight sparsity pattern (e.g., WEIGHT_SET0_A, WEIGHT_SET0_B, WEIGHT_SET0_C, WEIGHT_SET0_D).
[0123] In the illustrated example of FIG. 14, the one or more weight sparsity bitmaps 1404 include N weight sparsity bitmaps. In the example of FIG. 14, the sparsity generation circuit 1006 generates one or more weight sparsity bitmaps 1404. Each weight sparsity bitmap includes a sparsity pattern that is offset from the start of the respective weight sparsity bitmap by the product of the number of strides of the selected weight kernel and the sum of the depth and number of interior pads of the input tensor 1406. In the example of FIG. 14, the depth of the input tensor 1406 is 3 and the number of interior pads is 1. Thus, in the example of FIG. 14, each sparsity pattern is offset by the product of the number of strides of the selected weight kernel and 4.
[0124] In the example of FIG. 14, the sparsity pattern of each weight sparsity bitmap is d consecutive 1-bit w K Includes a set. K is the width of the weight kernel and d is the depth of the input tensor. Since inner padding is applied to the input tensor 1406, the sparsity generator 1006 KA zero bit is appended to each of the sets to match the number of internal pads. As mentioned above, the total number of 1 bits generated by the sparsity generator 1006 for the N sparsity bitmaps is equal to the product of the width of the weight kernel, the height of the weight kernel, and the depth of the input tensor. For the convolution of the 3×3×3 weight kernel with a stride of 1 in FIG. 14 with the input tensor 1406, the sparsity generator 1006 replicates the first of the one or more weight sparsity bitmaps 1404 (e.g., WEIGHT_SET0_A) a number of times equal to the height of the weight kernel. Thus, the sparsity generator 1006 replicates the first of the one or more weight sparsity bitmaps 1404 three times. Thus, the replicated weight sparsity bitmaps contain a total of 96 bits. Each weight sparsity bitmap contains 32 bits. Each weight sparsity bitmap contains 9 1 bits and 23 zero bits. Thus, the replicated weight sparsity bitmap contains a total of 27 one bits and a total of 69 zero bits.
[0125] In the illustrated example of Figure 14, the pointer control circuitry 1008 determines a fractional stride offset to apply to successive storage element pointers based on the depth of the input tensor 1406, the stride of the selected weight kernel, and the interior pad length, if applicable. For example, the pointer control circuitry 1008 determines the fractional stride offset according to Equation 1 above. In the example of Figure 14, after the pointer control circuitry 1008 determines the fractional stride offset, it shifts the successive storage element pointers by this offset.
[0126] With the channels of the input tensor 1406 aligned with the granularity of the storage elements and the applied fractional stride offset, the MAC circuit of FIG. 11 processes the activations of the input tensor 1406 with different weight sparsity bitmaps to select the desired input activations for each convolution. For example, the sparsity and storage element pointers of the fractional stride pre-processing circuit 214 cause the MAC circuit of FIG. 11 to process the input tensor 1406 as a 32-channel input tensor, effectively reformatting the input tensor 1406 into a reformatted input tensor 1402. Additionally, the sparsity and storage element pointers of the fractional stride pre-processing circuit 214 cause the MAC circuit of FIG. 11 to process a 3×3×3 weight kernel as a 1×3×9 weight kernel. For example, one or more weight sparsity bitmaps 1404 select the desired bytes of the input tensor 1406, and a 50% fractional stride is provided with overlapping storage elements. The depth of the reformatted input tensor 1402 may be determined via the following Equation 2, which is applicable to all kernel sizes. D REFORMATTED =ROUND_UPTO_NEAREST_16(3*[NUM_CHANNELS+PAD]*STRIDE+X KERNEL *[NUM_CHANNELS+PAD]) formula 2
[0127] FIG. 15 is a dataflow diagram illustrating an example convolution 1500 of an example input tensor 1502 with no padding and an example set of 3×3×3 weight kernels 1504 with a stride of 2 to determine an example output tensor 1506. In the example of FIG. 15, the input tensor 1502 has dimensions X=5, Y=5, and Z=3. The input tensor 1502 is stored in memory in a Z-major format with 3 channels. In the example of FIG. 15, each XY location on the input tensor 1502 occupies a location in memory that is 16 byte aligned. Thus, the memory after the channels of the input tensor 1502 (e.g., Z>2) are unused bytes. In some examples, no data is stored in the unused bytes, but in additional or alternative examples, the unused bytes may contain data with a corresponding sparsity bitmap of zeros. In the example of FIG. 15, as a result of the 16 byte alignment (eg, 16-3=13), there are 13 unused bytes in memory per XY location.
[0128] 15, the input tensor 1502 includes a first Z value 1508 at a first XY location of the input tensor 1502, a second Z value 1510 at a second XY location of the input tensor 1502, a third Z value 1512 at a third XY location of the input tensor 1502, a fourth Z value 1514 at a fourth XY location of the input tensor 1502, and a fifth Z value 1516 at a fifth XY location of the input tensor 1502. In the example of FIG. 15, the set of 3×3×3 weight kernels 1504 includes an exemplary first weight kernel 1518, an exemplary second weight kernel 1520, an exemplary third weight kernel 1522, and an exemplary fourth weight kernel 1524. Each of the first weight kernel 1518, the second weight kernel 1520, the third weight kernel 1522, and the fourth weight kernel 1524 has a depth of 3. Thus, each of the first weight kernel 1518, the second weight kernel 1520, the third weight kernel 1522, and the fourth weight kernel 1524 occupies 27 bytes in memory (e.g., X KERNEL *Y KERNEL*NUM_CHANNELS). Thus, the MAC circuit performs 27 MAC operations to generate each of the output points 1526, 1528, 1530 of the output tensor 1506. In the example of FIG. 15 , the first weight kernel 1518, the second weight kernel 1520, the third weight kernel 1522 and the fourth weight kernel 1524 are each used four times to generate a single channel (e.g., a step in K) in the output tensor 1506.
[0129] In the example of Figure 15, each of the first weight kernel 1518, the second weight kernel 1520, the third weight kernel 1522, and the fourth weight kernel 1524 are stored contiguously in memory. That is, each of the first weight kernel 1518, the second weight kernel 1520, the third weight kernel 1522, and the fourth weight kernel 1524 are stored in memory as a 27 x 1 array. In the example of Figure 15, the first weight kernel 1518, the second weight kernel 1520, the third weight kernel 1522, and the fourth weight kernel 1524 are shown as 3 x 3 x 3 tensors to show how the set of 3 x 3 x 3 weight kernels 1504 maps to the input tensor 1502.
[0130] FIG. 16 is a dataflow diagram illustrating an example convolution 1600 of an example reformatted input tensor 1602 without padding with an example set of reformatted 1×3×9 weight kernels 1604 with a stride of 2 to determine the example output tensor 1506 of FIG. 15. In the example of FIG. 16, the reformatted input tensor 1602 has dimensions X=2, Y=5, and Z=9. The Z dimension of the reformatted input tensor 1602 may be determined as the product of the width of the first weight kernel 1518 and the number of channels of the input tensor 1502 (e.g., Z = 1 / 2). REFORMATTED =X KERNEL*NUM_CHANNELS). In the example of FIG. 16, each XY location on the reformatted input tensor 1602 occupies a location in memory that is 16 byte aligned. Thus, the memory after the channels of the reformatted input tensor 1602 (e.g., Z>8) are unused bytes. In the example of FIG. 16, the data replication preprocessing circuit 212 reformats the input tensor 1502 according to the tensor data replication configuration to generate the reformatted input tensor 1602.
[0131] In the depicted example of Figure 16, the set of reformatted 1x3x9 weight kernels 1604 includes an exemplary first weight kernel 1606, an exemplary second weight kernel 1608, an exemplary third weight kernel 1610, and an exemplary fourth weight kernel 1612. In the example of Figure 16, the input tensor 1502 is a set of 1x3x9 weight kernels 1604 with each weight kernel having dimensions of x KERNEL *Y KERNEL From 1*Y KERNEL For example, each of the first weight kernel 1606, the second weight kernel 1608, the third weight kernel 1610 and the fourth weight kernel 1612 is a 1×3 kernel with a depth of 9.
[0132] 16, the shape of each of the set of 3×3×3 weight kernels 1504 is reformatted into a set of reformatted 1×3×9 weight kernels 1604, but the manner in which the set of 3×3×3 weight kernels 1504 is stored in memory does not change. Instead, to reformatting the set of 3×3×3 weight kernels 1504, the MAC circuitry 220 orders the set of 3×3×3 weight kernels 1504 through the MAC circuitry of FIG. 11 to accommodate the new dimensions of the reformatted input tensor 1602.
[0133] In the illustrated example of FIG. 16, the parameter determination circuit 802 determines a width (e.g., 3), height (e.g., 3) and stride (e.g., 2) of the first weight kernel 1518. The parameter determination circuit 802 additionally determines a width (e.g., 5), height (e.g., 5) and depth (e.g., 3) of the input tensor 1502. The storage control circuit 806 then selects a first Y position (e.g., Y=0) of the input tensor 1502. The storage control circuit 806 additionally selects a first X position (e.g., X=0, Y=0) of the input tensor 1502 at the selected Y position.
[0134] In the illustrated example of FIG. 16, the storage control circuit 806 copies one or more Z values from the selected XY position to the depth of the input tensor 1502 in consecutive XY positions that overlap the width of the first weight kernel 1518. For example, because the storage control circuit 806 is starting at the first XY position (X=0, Y=0) of the input tensor 1502 and the width of the first weight kernel 1518 is 3, the storage control circuit 806 copies the first Z value 1508, the second Z value 1510, and the third Z value 1512. The storage control circuit 806 loads the copied one or more Z values into the next XY position of the reformatted input tensor 1602. If this is the first load operation, the storage control circuit 806 loads the copied one or more Z values into the first XY position (X=0, Y=0) of the reformatted input tensor 1602 and increments the X position for the subsequent iteration.
[0135] Thus, the storage control circuit 806 loads the first Z value 1508, followed by the second Z value 1510, and then the third Z value 1512 into the first XY position (X=0,Y=0) of the reformatted input tensor 1602. The storage control circuit 806 then determines whether there is enough data (e.g., additional X positions) of the input tensor 1502 outside the width of the first weight kernel 1518. Because the fourth XY position (X=3,Y=0) of the input tensor 1502 and the fifth XY position (X=4,Y=0) of the input tensor 1502 are outside the width of the first weight kernel 1518, the storage control circuit 806 selects the next X position of the input tensor 1502 at the selected Y position according to the stride of the first weight kernel 1518. Because the stride of the first weight kernel 1518 is 2, the storage control circuit 806 selects the third XY position of the input tensor 1502 (X=2, Y=0).
[0136] 16, the storage control circuit 806 copies one or more Z values from the selected XY location to the depth of the input tensor 1502 in consecutive XY locations that overlap the width of the first weight kernel 1518. For example, because the storage control circuit 806 is starting at the third XY location (X=2, Y=0) of the input tensor 1502 and the width of the first weight kernel 1518 is 3, the storage control circuit 806 copies the third Z value 1512, the fourth Z value 1514, and the fifth Z value 1516. The storage control circuit 806 loads the copied Z value or values into the next XY location of the reformatted input tensor 1602.
[0137] Thus, for example, because the previously loaded XY position was the first XY position of the reformatted input tensor 1602, the storage control circuit 806 loads the third Z value 1512, followed by the fourth Z value 1514, and then the fifth Z value 1516 into the second XY position (X=1, Y=0) of the reformatted input tensor 1602. The storage control circuit 806 then determines whether there is enough data (e.g., additional X positions) of the input tensor 1502 outside the width of the first weight kernel 1518. Because there are no X positions outside the width of the first weight kernel 1518, the storage control circuit 806 determines whether there is enough data (e.g., additional Y positions) of the input tensor 1502 outside the height of the first weight kernel 1518. Because the 16th XY position (X=0,Y=4) of the input tensor 1502 and the 21st XY position (X=0,Y=5) of the input tensor 1502 are outside the height of the first weight kernel 1518, the storage control circuit 806 selects the next Y position of the input tensor 1502 according to the stride of the first weight kernel 1518. Because the stride of the first weight kernel 1518 is 2, the storage control circuit 806 selects the 16th XY position (X=0,Y=4) of the input tensor 1502. Next, the storage control circuit 806 selects the 1st X position (e.g., X=0,Y=0) of the input tensor 1502 at the selected Y position of the input tensor, and the process continues similarly as described above.
[0138] As shown in the example of FIG. 16, for a set of 3×3×3 weight kernels 1504 with a stride of 2, the reformatted input tensor 1602 has a smaller memory footprint when compared to the input tensor 1502. For example, the memory footprint is reduced by a factor of X / (2X+1). In the example of FIG. 16, the memory footprint is reduced by approximately 50%. Additionally, the memory footprint of the reformatted input tensor 1602 may be further reduced. For example, if the MAC circuit 220 is configured to perform a convolution with independent X strides and independent Y strides, the MAC circuit 220 may stride 1 over the reformatted input tensor 1602 and stride 2 under the reformatted input tensor 1602. Thus, the data duplication pre-processing circuit 212 improves the performance of the operation to generate the output tensor 1506. The data duplication pre-processing circuit 212 is applicable to all kernel sizes and reduces the width of the weight kernel (e.g., X KERNEL ) is changed to 1, and the Z dimension of the reformatted input tensor is changed to the product of the width of the weight kernel and the number of channels in the input tensor (e.g., Z REFORMATTED =X KERNEL *NUM_CHANNELS).
[0139] FIG. 17 is a data flow diagram illustrating an example convolution 1700 of an example reformatted input tensor 1702 without padding with an example 3×3×3 weight kernel with a stride of 2 and one or more weight sparsity bitmaps 1704 to facilitate refined fractional striding. In the example of FIG. 17, the fractional stride pre-processing circuit 214 repurposes the weight sparsity to refine the fractional stride and allow input tensor activations selected at 4-byte granularity. The fractional stride pre-processing circuit 214 generates the reformatted input tensor 1702 from the example input tensor 1706 by combining the sparsity with storage element pointers. In the example of FIG. 17, the input tensor 1706 has dimensions X=12, Y=4, and Z=3.
[0140] 17, the input tensor 1706 includes a first Z value 1708 at a first XY location of the input tensor 1706, a second Z value 1710 at a second XY location of the input tensor 1706, a third Z value 1712 at a third XY location of the input tensor 1706, and a fourth Z value 1714 at a fourth XY location of the input tensor 1706. The input tensor 1706 also includes a fifth Z value 1716 at a fifth XY location of the input tensor 1706, a sixth Z value 1718 at a sixth XY location of the input tensor 1706, a seventh Z value 1720 at a seventh XY location of the input tensor 1706, and an eighth Z value 1722 at an eighth XY location of the input tensor 1706. Additionally, the input tensor 1706 includes a ninth Z value 1724 at a ninth XY position of the input tensor 1706, a tenth Z value 1726 at a tenth XY position of the input tensor 1706, an eleventh Z value 1728 at an eleventh XY position of the input tensor 1706, and a twelfth Z value 1730 at a twelfth XY position of the input tensor 1706.
[0141] 17, the sparsity generator circuit 1006 determines whether inner padding is applied to the input tensor 1706. For example, the sparsity generator circuit 1006 determines whether inner padding is applied to the input tensor 1706 by dividing the granularity of the storage elements by the depth of the input tensor 1706. If the remainder of the division operation is not zero, the sparsity generator circuit 1006 determines that inner padding is applied, and vice versa.
[0142] In the illustrated example of Figure 17, in response to determining that interior padding is applied to the input tensor 1706, the sparsity generation circuit 1006 separates the Z values for each XY location of the input tensor 1706 by the number of pads. To determine the number of pads, the sparsity generation circuit 1006 first rounds the depth of the input tensor 1706 to the nearest multiple of four that returns a remainder of zero when divided to the granularity of a storage element (e.g., 16). The sparsity generation circuit 1006 then finds the difference between the rounded value and the depth of the input tensor 1706 to determine the number of pads.
[0143] In the illustrated example of FIG. 17, the granularity of the storage element is 16 and the depth of the input tensor 1706 is 3. Thus, the sparsity generation circuit 1006 determines that the number of pads is 1 (e.g., 4-3=1). In the example disclosed herein, the length of the internal pad of the input tensor is 1 byte. Thus, the channels of the input tensor 1706 are padded internally to 4 bytes, and groups of three channels are aligned to the granularity of the storage element (e.g., 4×(3 channel bytes+1 pad byte)=16 bytes). Because the weight sparsity bitmap is zero for the internal pad bytes, the internal pad bytes are not processed.
[0144] In the illustrated example of FIG. 17, the tensor and weight control circuit 1002 replicates each weight kernel to be convolved with the input tensor 1706 to generate N weight kernels for each weight kernel. N corresponds to the number of points of the output tensor that may be generated for each XY location of the reformatted input tensor 1402. In the example of FIG. 17, the MAC circuit 220 may generate four points of the output tensor for each XY location of the reformatted input tensor 1702. Thus, the tensor and weight control circuit 1002 replicates each weight kernel to generate four weight kernels for each weight kernel. Additionally, the sparsity generation circuit 1006 generates one or more weight sparsity bitmaps 1704. Each weight sparsity bitmap includes a different weight sparsity pattern (e.g., WEIGHT_SET0_A, WEIGHT_SET0_B, WEIGHT_SET0_C, WEIGHT_SET0_D). In the example of FIG. 17, the one or more weight sparsity bitmaps 1704 include N weight sparsity bitmaps. In the example of FIG. 17, the sparsity generation circuit 1006 generates one or more weight sparsity bitmaps 1704. Each weight sparsity bitmap includes a sparsity pattern that is offset from the start of the respective weight sparsity bitmap by the product of the number of strides of the selected weight kernel plus the depth and number of interior pads of the input tensor 1706. In the example of FIG. 17, the depth of the input tensor 1706 is 3 and the number of interior pads is 1. Thus, in the example of FIG. 17, each sparsity pattern is offset by the product of the number of strides of the selected weight kernel and 4. The sparsity pattern of each weight sparsity bitmap includes d consecutive 1-bit w K Includes a set. K is the width of the weight kernel and d is the depth of the input tensor. Since inner padding is applied to the input tensor 1706, the sparsity generator 1006 K A zero bit is appended to each set to match the number of internal pads.
[0145] In the illustrated example of Figure 17, the pointer control circuitry 1008 determines a fractional stride offset to apply to successive storage element pointers based on the depth of the input tensor 1706, the stride of the selected weight kernel, and the interior pad length, if applicable. For example, the pointer control circuitry 1008 determines the fractional stride offset according to Equation 1 above. In the example of Figure 17, after the pointer control circuitry 1008 determines the fractional stride offset, it shifts the successive storage element pointers by this offset.
[0146] With the channels of the input tensor 1706 aligned with the granularity of the storage elements and the applied fractional stride offset, the MAC circuit of FIG. 11 processes the activations of the input tensor 1706 with different weight sparsity bitmaps to select the desired input activations for each convolution. For example, the sparsity and storage element pointers of the fractional stride pre-processing circuit 214 cause the MAC circuit of FIG. 11 to process the input tensor 1706 as a 48-channel input tensor, effectively reformatting the input tensor 1706 into a reformatted input tensor 1702. Additionally, the sparsity and storage element pointers of the fractional stride pre-processing circuit 214 cause the MAC circuit of FIG. 11 to process a 3×3×3 weight kernel as a 1×3×9 weight kernel. For example, one or more weight sparsity bitmaps 1704 select the desired bytes of the input tensor 1706, and a 66% fractional stride is provided with overlapping storage elements. The depth of the reformatted input tensor 1702 may be determined via Equation 2 above.
[0147] FIG. 18 is a dataflow diagram illustrating an example convolution 1800 of an example input tensor 1802 with outer padding and an example set of 3×3×3 weight kernels 1804 with a stride of 1 to determine an example output tensor 1806. In the example of FIG. 18, the input tensor 1802 has dimensions X=4, Y=4, and Z=3. The input tensor 1802 is stored in memory in a Z-major format with three channels. In the example of FIG. 18, each XY location on the input tensor 1802 occupies a location in memory that is 16 byte aligned. Thus, the memory after the channels of the input tensor 1802 (e.g., Z>2) are unused bytes. In some examples, no data is stored in the unused bytes, but in additional or alternative examples, the unused bytes may contain data with a corresponding sparsity bitmap of zeros. In the example of FIG. 18, as a result of the 16 byte alignment (eg, 16-3=13), there are 13 unused bytes in memory per XY location.
[0148] In the illustrated example of FIG. 18, external padding is added to the input tensor 1802 to allow the input tensor 1802 and the output tensor 1806 to be the same size when a non-1×1 kernel is used. As described above, the external pad is null data. In the example of FIG. 18, one external pad byte is added to the top, bottom, right and left of the input tensor 1802. Additionally, as described above, the external pad bytes are implemented as activation sparsity and do not occupy space in memory if they are not loaded into memory.
[0149] In the depicted example of Figure 18, the input tensor 1802 includes a first Z value 1808 at a first XY location of the input tensor 1802, a second Z value 1810 at a second XY location of the input tensor 1802, a third Z value 1812 at a third XY location of the input tensor 1802, and a fourth Z value 1814 at a fourth XY location of the input tensor 1802. In the example of Figure 18, the set of 3x3x3 weight kernels 1804 includes an exemplary first weight kernel 1816, an exemplary second weight kernel 1818, an exemplary third weight kernel 1820, and an exemplary fourth weight kernel 1822. Each of the first weight kernel 1816, the second weight kernel 1818, the third weight kernel 1820, and the fourth weight kernel 1822 has a depth of 3. Thus, each of the first weight kernel 1816, the second weight kernel 1818, the third weight kernel 1820, and the fourth weight kernel 1822 may take up 27 bytes in memory (e.g., X KERNEL *Y KERNEL *NUM_CHANNELS). Thus, the MAC circuit performs 27 MAC operations to generate each of the output points 1824, 1826 of the output tensor 1806. In the example of FIG. 18 , the first weight kernel 1816, the second weight kernel 1818, the third weight kernel 1820 and the fourth weight kernel 1822 are each used four times to generate a single channel (e.g., a step in K) in the output tensor 1806.
[0150] In the example of Figure 18, each of the first weight kernel 1816, the second weight kernel 1818, the third weight kernel 1820, and the fourth weight kernel 1822 are stored contiguously in memory. That is, each of the first weight kernel 1816, the second weight kernel 1818, the third weight kernel 1820, and the fourth weight kernel 1822 are stored in memory as a 27 x 1 array. In the example of Figure 18, the first weight kernel 1816, the second weight kernel 1818, the third weight kernel 1820, and the fourth weight kernel 1822 are shown as 3 x 3 x 3 tensors to show how the set of 3 x 3 x 3 weight kernels 1804 maps to the input tensor 1802.
[0151] FIG. 19 is a dataflow diagram illustrating an example convolution 1900 of an example reformatted input tensor 1902 with outer padding and an example set of reformatted 1×3×9 weight kernels 1904 with a stride of 1 to determine the example output tensor 1806 of FIG. 18. In the example of FIG. 19, the reformatted input tensor 1902 has dimensions X=4, Y=4 and Z=9. The Z dimension of the reformatted input tensor 1902 may be determined as the product of the width of the first weight kernel 1816 and the number of channels of the input tensor 1802 (e.g., Z REFORMATTED =X KERNEL *NUM_CHANNELS). In the example of FIG. 19, each XY location on the reformatted input tensor 1902 occupies a location in memory that is 16 byte aligned. Thus, the memory after the channels of the reformatted input tensor 1902 (e.g., Z>8) are unused bytes. In the example of FIG. 19, the data replication preprocessing circuit 212 reformats the input tensor 1802 according to the tensor data replication configuration to generate the reformatted input tensor 1902.
[0152] In the depicted example of Figure 19, the set of reformatted 1x3x9 weight kernels 1904 includes an exemplary first weight kernel 1906, an exemplary second weight kernel 1908, an exemplary third weight kernel 1910, and an exemplary fourth weight kernel 1912. In the example of Figure 19, the input tensor 1802 is a set of 1x3x9 weight kernels 1904 with each weight kernel having dimensions of x KERNEL *Y KERNEL From 1*Y KERNEL For example, each of the first weight kernel 1906, the second weight kernel 1908, the third weight kernel 1910 and the fourth weight kernel 1912 is a 1×3 kernel with a depth of 9.
[0153] 19, the shape of each of the set of 3×3×3 weight kernels 1804 is reformatted into a set of reformatted 1×3×9 weight kernels 1904, but the manner in which the set of 3×3×3 weight kernels 1804 is stored in memory does not change. Instead, to reformatting the set of 3×3×3 weight kernels 1804, the MAC circuit 220 orders the set of 3×3×3 weight kernels 1804 through the MAC circuit of FIG. 11 to accommodate the new dimensions of the reformatted input tensor 1902.
[0154] In the illustrated example of FIG. 19, the parameter determination circuit 802 determines a width (e.g., 3), height (e.g., 3) and stride (e.g., 1) of the first weight kernel 1816. The parameter determination circuit 802 additionally determines a width (e.g., 4), height (e.g., 4) and depth (e.g., 3) of the input tensor 1802. In the example of FIG. 19, the padding circuit 804 determines whether external padding is applied to the input tensor 1802. In response to a determination that external padding is applied, the padding circuit 804 loads a first external pad 1914 before the first X position at the first Y position of the input tensor 1802 (e.g., to the left of the input tensor 1802). Additionally, the padding circuit 804 loads a second external pad 1916 after the last X position at the first Y position of the input tensor 1802 (e.g., to the right of the input tensor 1802). The storage control circuit 806 then selects the first Y position (e.g., Y=0) of the input tensor 1802. The storage control circuit 806 additionally selects the first X position of the input tensor 1802 at the selected Y position. The input tensor 1802 appears to have an X dimension of six because the padding circuit 804 adds the first external pad 1914 at the first X position after the last X position at the first Y position and before the second external pad 1916. Thus, when the storage control circuit 806 selects the first X position (e.g., X=1, Y=0) at the selected Y position, it selects the X position of the first external pad 1914.
[0155] In the illustrated example of FIG. 19, the storage control circuit 806 copies one or more Z values from the selected XY location to the depth of the input tensor 1802 in consecutive XY locations that overlap the width of the first weight kernel 1816. For example, because the storage control circuit 806 is starting at the first XY location (X=-1, Y=0) of the input tensor 1802 and the width of the first weight kernel 1816 is 3, the storage control circuit 806 copies the first outer pad 1914, the first Z value 1808 and the second Z value 1810. The storage control circuit 806 loads the copied one or more Z values into the next XY location of the reformatted input tensor 1902. If this is the first load operation, the storage control circuit 806 loads the copied one or more Z values into the first XY location (X=0, Y=0) of the reformatted input tensor 1902 and increments the X location for the subsequent iteration.
[0156] Thus, the storage control circuit 806 loads the first external pad 1914 into the first XY position (X=0, Y=0) of the reformatted input tensor 1902, followed by the first Z value 1808, and then the second Z value 1810. Thus, the data of the Y positions of the kernel to be convolved with the reformatted input tensor 1902 are in the same memory location. The storage control circuit 806 then determines whether there is enough data (e.g., additional X positions) of the input tensor 1802 outside the width of the first weight kernel 1216. Because the third XY position (X=2, Y=0) of the input tensor 1802, the fourth XY position of the input tensor 1802, and the second external pad 1916 are outside the width of the first weight kernel 1816, the storage control circuit 806 selects the next X position of the input tensor 1802 at the selected Y position according to the stride of the first weight kernel 1816. Because the stride of the first weight kernel 1816 is 1, the storage control circuit 806 selects the first XY position (X=0, Y=0) of the input tensor 1802.
[0157] 19, the storage control circuit 806 copies one or more Z values from the selected XY location to the depth of the input tensor 1802 in consecutive XY locations that overlap the width of the first weight kernel 1816. For example, because the storage control circuit 806 is starting at the first XY location (X=0, Y=0) of the input tensor 1802 and the width of the first weight kernel 1816 is 3, the storage control circuit 806 copies the first Z value 1808, the second Z value 1810, and the third Z value 1812. The storage control circuit 806 loads the copied Z value or values into the next XY location of the reformatted input tensor 1902.
[0158] Thus, for example, since the previously loaded XY location was the first XY location of the reformatted input tensor 1902, the storage control circuit 806 loads the first Z value 1808, followed by the second Z value 1810, and then the third Z value 1812 into the second XY location (X=1, Y=0) of the reformatted input tensor 1902. The process continues in a similar manner for the vertical stride of the first weight kernel 1816.
[0159] FIG. 20 is a data flow diagram illustrating an example convolution of an example reformatted input tensor 2002 with padding and an example 3×3×3 weight kernel with a stride of 1 and one or more weight sparsity bitmaps 2004 to facilitate refined fractional striding. In the example of FIG. 20, the fractional stride pre-processing circuit 214 repurposes the weight sparsity to refine the fractional stride and allow input tensor activations selected at 4-byte granularity. The fractional stride pre-processing circuit 214 generates the reformatted input tensor 2002 from the example input tensor 2006 by combining the sparsity with storage element pointers. In the example of FIG. 20, the input tensor 2006 has dimensions X=8, Y=1, and Z=3, but is padded to have dimensions X=10, Y=3, and Z=3.
[0160] In the illustrated example of FIG. 20, the padding control circuit 1004 determines whether external padding is applied to the input tensor 2006. In response to determining that external padding is applied to the input tensor 2006, the padding control circuit 1004 loads a first external pad 2008 before the first X position at the first Y position of the input tensor 2006 (e.g., to the left of the input tensor 2006). Thus, the data of the Y position of the kernel to be convolved with the input tensor 2006 is in the same memory location. Additionally, the padding control circuit 1004 loads a second external pad 2010 after the last X position at the first Y position of the input tensor 2006 (e.g., to the right of the input tensor 2006). Thus, the data of the Y position of the kernel to be convolved with the input tensor 2006 is in the same memory location. The pads above and below the input tensor 2006 are inserted as sparsity by the AI accelerator circuit 208 during execution.
[0161] 20, the input tensor 2006 includes a first external pad 2008, a first Z value 2012 at a first XY location of the input tensor 2006, a second Z value 2014 at a second XY location of the input tensor 2006, a third Z value 2016 at a third XY location of the input tensor 2006, and a fourth Z value 2018 at a fourth XY location of the input tensor 2006. The input tensor 2006 also includes a fifth Z value 2020 at a fifth XY location of the input tensor 2006, a sixth Z value 2022 at a sixth XY location of the input tensor 2006, a seventh Z value 2024 at a seventh XY location of the input tensor 2006, an eighth Z value 2026 at an eighth XY location of the input tensor 2006, and the second external pad 2010. 20, the sparsity generator circuit 1006 determines whether inner padding is applied to the input tensor 2006. For example, the sparsity generator circuit 1006 determines whether inner padding is applied to the input tensor 2006 by dividing the granularity of the storage elements by the depth of the input tensor 2006. If the remainder of the division operation is not zero, the sparsity generator circuit 1006 determines that inner padding is applied, and vice versa.
[0162] In the illustrated example of Figure 20, in response to determining that interior padding is applied to the input tensor 2006, the sparsity generation circuit 1006 separates the Z values for each XY location of the input tensor 2006 by the number of pads. To determine the number of pads, the sparsity generation circuit 1006 first rounds the depth of the input tensor 2006 to the nearest multiple of four that returns a remainder of zero when divided to the granularity of a storage element (e.g., 16). The sparsity generation circuit 1006 then finds the difference between the rounded value and the depth of the input tensor 2006 to determine the number of pads.
[0163] In the illustrated example of FIG. 20, the granularity of the storage element is 16 and the depth of the input tensor 2006 is 3. Thus, the sparsity generation circuit 1006 determines that the number of pads is 1 (e.g., 4-3=1). In the example disclosed herein, the length of the internal pad of the input tensor is 1 byte. Thus, the channels of the input tensor 2006 are padded internally to 4 bytes, and groups of 3 channels are aligned to the granularity of the storage element (e.g., 4×(3 channel bytes+1 pad byte)=16 bytes). Because the weight sparsity bitmap is zero for the internal pad bytes, the internal pad bytes are not processed.
[0164] In the illustrated example of FIG. 20, the tensor and weight control circuit 1002 replicates each weight kernel to be convolved with the input tensor 2006 to generate N weight kernels for each weight kernel. N corresponds to the number of points of the output tensor that can be generated for each XY location of the reformatted input tensor 2002. In the example of FIG. 20, the MAC circuit 220 can generate four points of the output tensor for each XY location of the reformatted input tensor 2002. Thus, the tensor and weight control circuit 1002 replicates each weight kernel to generate four weight kernels for each weight kernel. Additionally, the sparsity generation circuit 1006 generates one or more weight sparsity bitmaps 2004. Each weight sparsity bitmap includes a different weight sparsity pattern (e.g., WEIGHT_SET0_A, WEIGHT_SET0_B, WEIGHT_SET0_C, WEIGHT_SET0_D). In the example of FIG. 20, the one or more weight sparsity bitmaps 2004 include N weight sparsity bitmaps. In the example of FIG. 20, the sparsity generation circuit 1006 generates one or more weight sparsity bitmaps 2004. Each weight sparsity bitmap includes a sparsity pattern that is offset from the start of the respective weight sparsity bitmap by the product of the number of strides of the selected weight kernel plus the depth and number of interior pads of the input tensor 2006. In the example of FIG. 20, the depth of the input tensor 2006 is 3 and the number of interior pads is 1. Thus, in the example of FIG. 20, each sparsity pattern is offset by the product of the number of strides of the selected weight kernel and 4. The sparsity pattern of each weight sparsity bitmap includes d consecutive 1-bit w K Includes a set. K is the width of the weight kernel and d is the depth of the input tensor. Since inner padding is applied to the input tensor 2006, the sparsity generator 1006 K A zero bit is appended to each set to match the number of internal pads.
[0165] In the illustrated example of Figure 20, the pointer control circuitry 1008 determines a fractional stride offset to apply to successive storage element pointers based on the depth of the input tensor 2006, the stride of the selected weight kernel, and the internal pad length, if applicable. For example, the pointer control circuitry 1008 determines the fractional stride offset according to Equation 1 above. In the example of Figure 20, after the pointer control circuitry 1008 determines the fractional stride offset, it shifts the successive storage element pointers by this offset.
[0166] With the channels of the input tensor 2006 aligned with the granularity of the storage elements and the applied fractional stride offset, the MAC circuit of FIG. 11 processes the activations of the input tensor 2006 with different weight sparsity bitmaps to select the desired input activations for each convolution. For example, the sparsity and storage element pointers of the fractional stride pre-processing circuit 214 cause the MAC circuit of FIG. 11 to process the input tensor 2006 as a 32-channel input tensor, effectively reformatting the input tensor 2006 into a reformatted input tensor 2002. Additionally, the sparsity and storage element pointers of the fractional stride pre-processing circuit 214 cause the MAC circuit of FIG. 11 to process a 3×3×3 weight kernel as a 1×3×9 weight kernel. For example, one or more weight sparsity bitmaps 2004 select the desired bytes of the input tensor 2006, and a 50% fractional stride is provided with overlapping storage elements. The depth of the reformatted input tensor 2002 may be determined via Equation 2 above.
[0167] Table 2 shows the MAC utilization of ResNet-50 and MobileNet for the tensor data duplication and fractional striting configurations compared to normal processing. In the example of Table 1, ResNet-50 utilizes a 7×7 weight kernel with a stride of 2, and MobileNet utilizes a 3×3 weight kernel with a stride of 2. [Table 2] [Table 2]
[0168] For ResNet-50, Table 2 shows a 2.8x and 1.8x increase in utilization for tensor data replication and fractional striping, respectively. For MobileNet, Table 2 shows a 1.2x and 1.6x increase in MAC utilization for tensor data replication and fractional striping, respectively. In the examples in Table 2, the increase in MAC utilization translates into a reduction in the number of cycles to process a layer between 18% and 65%. This is a large improvement for the input layer compared to existing techniques.
[0169] As mentioned above, AI accelerator circuits are very efficient for deeper layers in a network, but shallow layers may reduce such efficiency. Additionally, increased sparsity in both activation and weight data of such layers may result in shallow layers (e.g., input layers) taking up a large proportion of the network's overall computation time. For example, the input layer to a ResNet-50 network takes 10.7% of the network's overall time to run without the benefit of the examples disclosed herein. Conversely, the examples disclosed herein increase MAC utilization by between 1.8x and 2.8x, thereby reducing the overall processing of the network by between 4.8% and 6.9%.
[0170] Table 2 shows that tensor data replication performs better than fractional striping for MobileNet, and that fractional striping performs better than tensor data replication for ResNet-50. These differences are due in part to how different configurations are handled by the AI accelerator circuitry. Such differences can be mitigated by a compiler (e.g., compiler 210) that implements a cost table associated with each configuration and chooses the optimal solution.
[0171] Table 3 shows the activation and weight footprints for tensor data duplication and fractional striping for ResNet-50 and MobileNet. For both MobileNet and ResNet-50, the memory footprint is about 50 of that of normal processing when implementing tensor data duplication. Additionally, the memory footprint is about 25 of that of normal processing when implementing fractional striping. For edge devices where memory is a limited resource, the reduction in memory footprint is a significant benefit realized by the examples disclosed herein. [Table 3] [Table 3]
[0172] In some examples, the data replication pre-processing circuit 212 includes a means for determining one or more parameters. For example, the means for determining one or more parameters may be implemented by the parameter determination circuit 802. In some examples, the parameter determination circuit 802 may be implemented by machine-executable instructions, such as those implemented by the last blocks 2102, 2104, 2106, 2130 and 2132 of FIG. 21 executed by a processor circuit that may be implemented by the example processor circuit 2312 of FIG. 23, the example processor circuit 2400 of FIG. 24 and / or the example field programmable gate array (FPGA) circuit 2500 of FIG. 25. In other examples, the parameter determination circuit 802 is implemented by other hardware logic circuits, hardware-implemented state machines, and / or any other combination of hardware, software and / or firmware. For example, the parameter determination circuit 802 may be implemented by at least one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, application specific integrated circuits (ASICs), comparators, operational amplifiers (opamps), logic circuits, etc.) structured to perform corresponding operations without executing software or firmware, although other structures are suitable as well.
[0173] In some examples, the data duplication pre-processing circuit 212 includes a means for padding. For example, the means for padding may be implemented by a padding circuit 804. In some examples, the padding circuit 804 may be implemented by machine-executable instructions, such as those implemented by the last blocks 2108, 2110, and 2112 of FIG. 21 executed by a processor circuit that may be implemented by the example processor circuit 2312 of FIG. 23, the example processor circuit 2400 of FIG. 24, and / or the example field programmable gate array (FPGA) circuit 2500 of FIG. 25. In other examples, the padding circuit 804 is implemented by other hardware logic circuits, hardware-implemented state machines, and / or any other combination of hardware, software, and / or firmware. For example, the padding circuit 804 may be implemented by at least one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, application specific integrated circuits (ASICs), comparators, operational amplifiers (opamps), logic circuits, etc.) structured to perform corresponding operations without executing software or firmware, although other structures are similarly suitable.
[0174] In some examples, the data replication pre-processing circuit 212 includes a means for controlling storage. For example, the means for controlling storage may be implemented by the storage control circuit 806. In some examples, the storage control circuit 806 may be implemented by machine-executable instructions, such as those implemented by the last blocks 2114, 2116, 2118, 2120, 2122, 2124, 2126, and 2128 of FIG. 21 executed by a processor circuit that may be implemented by the example processor circuit 2312 of FIG. 23, the example processor circuit 2400 of FIG. 24, and / or the example field programmable gate array (FPGA) circuit 2500 of FIG. 25. In other examples, the storage control circuit 806 is implemented by other hardware logic circuits, hardware-implemented state machines, and / or any other combination of hardware, software, and / or firmware. For example, the storage control circuitry 806 may be implemented by at least one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, application specific integrated circuits (ASICs), comparators, operational amplifiers (opamps), logic circuits, etc.) structured to perform corresponding operations without executing software or firmware, although other structures are suitable as well.
[0175] In some examples, the fractional stride pre-processing circuit 214 includes means for controlling one or more tensors. For example, the means for controlling one or more tensors may be implemented by the tensor and weight control circuit 1002. In some examples, the tensor and weight control circuit 1002 may be implemented by machine-executable instructions, such as those implemented by the last blocks 2202, 2204, 2206, 2218, 2226, 2228, and 2230 of FIG. 22 executed by a processor circuit that may be implemented by the example processor circuit 2312 of FIG. 23, the example processor circuit 2400 of FIG. 24, and / or the example field programmable gate array (FPGA) circuit 2500 of FIG. 25. In other examples, the tensor and weight control circuit 1002 is implemented by other hardware logic circuits, hardware-implemented state machines, and / or any other combination of hardware, software, and / or firmware. For example, the tensor and weight control circuit 1002 may be implemented by at least one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, application specific integrated circuits (ASICs), comparators, operational amplifiers (opamps), logic circuits, etc.) structured to perform corresponding operations without executing software or firmware, although other structures are similarly suitable.
[0176] In some examples, the fractional stride pre-processing circuit 214 includes means for padding. For example, the means for padding may be implemented by the padding control circuit 1004. In some examples, the padding control circuit 1004 may be implemented by machine-executable instructions, such as those implemented by the last blocks 2208, 2210, and 2212 of FIG. 22 executed by a processor circuit that may be implemented by the example processor circuit 2312 of FIG. 23, the example processor circuit 2400 of FIG. 24, and / or the example field programmable gate array (FPGA) circuit 2500 of FIG. 25. In other examples, the padding control circuit 1004 is implemented by other hardware logic circuits, hardware-implemented state machines, and / or any other combination of hardware, software, and / or firmware. For example, the padding control circuit 1004 may be implemented by at least one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, application specific integrated circuits (ASICs), comparators, operational amplifiers (opamps), logic circuits, etc.) structured to perform corresponding operations without executing software or firmware, although other structures are similarly suitable.
[0177] In some examples, the fractional stride pre-processing circuit 214 includes a means for generating sparsity. For example, the means for generating sparsity may be implemented by the sparsity generation circuit 1006. In some examples, the sparsity generation circuit 1006 may be implemented by machine-executable instructions, such as those implemented by the last blocks 2214 and 2216 of FIG. 22 executed by a processor circuit that may be implemented by the example processor circuit 2312 of FIG. 23, the example processor circuit 2400 of FIG. 24, and / or the example field programmable gate array (FPGA) circuit 2500 of FIG. 25. In other examples, the sparsity generation circuit 1006 is implemented by other hardware logic circuits, hardware-implemented state machines, and / or any other combination of hardware, software, and / or firmware. For example, the sparsity generation circuit 1006 may be implemented by at least one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, application specific integrated circuits (ASICs), comparators, operational amplifiers (opamps), logic circuits, etc.) structured to perform corresponding operations without executing software or firmware, although other structures are similarly suitable.
[0178] In some examples, the fractional stride pre-processing circuit 214 includes means for controlling one or more pointers. For example, the means for controlling one or more pointers may be implemented by the pointer control circuit 1008. In some examples, the pointer control circuit 1008 may be implemented by machine-executable instructions, such as those implemented by the last blocks 2220, 2222, and 2224 of FIG. 22 executed by a processor circuit that may be implemented by the example processor circuit 2312 of FIG. 23, the example processor circuit 2400 of FIG. 24, and / or the example field programmable gate array (FPGA) circuit 2500 of FIG. 25. In other examples, the pointer control circuit 1008 is implemented by other hardware logic circuits, hardware-implemented state machines, and / or any other combination of hardware, software, and / or firmware. For example, the pointer control circuitry 1008 may be implemented by at least one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, application specific integrated circuits (ASICs), comparators, operational amplifiers (opamps), logic circuits, etc.) structured to perform corresponding operations without executing software or firmware, although other structures are similarly suitable.
[0179] An exemplary manner of implementing the data replication pre-processing circuit 212 of Figure 2 is shown in Figure 8, although one or more of the elements, processes and / or devices shown in Figure 8 may be combined, divided, rearranged, omitted, eliminated, and / or implemented in any other manner. Additionally, an exemplary manner of implementing the fractional stride pre-processing circuit 214 of Figure 2 is shown in Figure 10, although one or more of the elements, processes and / or devices shown in Figure 10 may be combined, divided, rearranged, omitted, eliminated, and / or implemented in any other manner. Additionally, the example parameter determination circuit 802, the example padding circuit 804, the example storage control circuit 806 and / or more generally the example data replication pre-processing circuit 212 of FIG. 2 and / or FIG. 8 and / or the example tensor and weight control circuit 1002, the example padding control circuit 1004, the example sparsity generation circuit 1006, the example pointer control circuit 1008 and / or more generally the example fractional stride pre-processing circuit 214 of FIG. 2 and / or FIG. 10 may be implemented solely in hardware or in combination with software and / or firmware. Thus, for example, any of the example parameter determination circuit 802, the example padding circuit 804, the example storage control circuit 806, and / or more generally the example data replication pre-processing circuit 212 of FIG. 2 and / or FIG. 8, and / or the example tensor and weight control circuit 1002, the example padding control circuit 1004, the example sparsity generation circuit 1006, the example pointer control circuit 1008, and / or more generally the example fractional stride pre-processing circuit 214 of FIG. 2 and / or FIG. 10 may be implemented by a processor circuit, an analog circuit, a digital circuit, a logic circuit, a programmable processor, a programmable microcontroller, a graphics processor unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a programmable logic device (PLD), and / or a field programmable logic device (FPLD) such as a field programmable gate array (FPGA).Still further, the example data replication pre-processing circuit 212 of Figure 2 may include one or more elements, processes and / or devices in addition to or instead of those shown in Figure 8 and / or may include more than one of any or all of the shown elements, processes and devices. Additionally, the fractional stride pre-processing circuit 214 of Figure 2 may include one or more elements, processes and / or devices in addition to or instead of those shown in Figure 10 and / or may include more than one of any or all of the shown elements, processes and devices.
[0180] A flow chart representative diagram of example hardware logic circuits, machine readable instructions, hardware implemented state machines, and / or any combination thereof for implementing the data replication pre-processing circuit 212 of Figures 2 and / or 8 is shown in Figure 21. The machine readable instructions may be one or more executable and / or instantiable programs or portions of executable and / or instantiable programs for execution and / or instantiation by a processor circuit, such as the processor circuit 2312 shown in the example processor platform 2300 described below in connection with Figure 23 and / or the example processor circuit described below in connection with Figures 24 and / or 25. The program may be embodied in software stored on one or more non-transitory computer-readable storage media, such as a CD, floppy disk, hard disk drive (HDD), DVD, Blu-ray disk, volatile memory (e.g., any type of random access memory (RAM), etc.) or non-volatile memory (e.g., flash memory, HDD, etc.) associated with a processor circuit located in one or more hardware devices, although the entire program and / or parts thereof may alternatively be executed and / or instantiated by one or more hardware devices other than the processor circuit and / or embodied in firmware or dedicated hardware. The machine-readable instructions may be distributed across multiple hardware devices and / or executed by and / or instantiated by two or more hardware devices (e.g., a server and a client hardware device). For example, a client hardware device may be implemented by an end-point client hardware device (e.g., a hardware device associated with a user) or an intermediate client hardware device (e.g., a Radio Access Network (RAN) gateway that may facilitate communication between a server and an end-point client hardware device).Similarly, a non-transitory computer-readable storage medium may include one or more media located in one or more hardware devices. Additionally, although the exemplary program is described with reference to the flowchart shown in FIG. 21, many other ways of implementing the exemplary data replication pre-processing circuit 212 may alternatively be used. For example, the order of execution of the blocks may be changed, and / or some of the described blocks may be changed, eliminated, or combined. Additionally or alternatively, any or all of the blocks may be implemented by one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, ASICs, comparators, operational amplifiers (op-amps), logic circuits, etc.) structured to perform the corresponding operations without executing software or firmware. The processor circuitry may be distributed across different network locations and / or local to one or more hardware devices (e.g., a single core processor (e.g., a single core central processing unit (CPU))), a multi-core processor (e.g., a multi-core CPU, etc.) within a single machine, multiple processors distributed across multiple servers in a server rack, multiple processors distributed across one or more server racks, CPUs and / or FPGAs located within the same package (e.g., the same integrated circuit (IC) package, or two or more separate housings, etc.).
[0181] A flow chart representative diagram of example hardware logic circuits, machine readable instructions, hardware implemented state machines, and / or any combination thereof for implementing the fractional stride pre-processing circuit 214 of Figures 2 and / or 10 is shown in Figure 22. The machine readable instructions may be one or more executable and / or instantiable programs or portions of executable and / or instantiable programs for execution and / or instantiation by a processor circuit, such as the processor circuit 2312 shown in the example processor platform 2300 described below in connection with Figure 23 and / or the example processor circuit described below in connection with Figures 24 and / or 25. The program may be embodied in software stored on one or more non-transitory computer-readable storage media, such as a CD, floppy disk, hard disk drive (HDD), DVD, Blu-ray disk, volatile memory (e.g., any type of random access memory (RAM), etc.) or non-volatile memory (e.g., flash memory, HDD, etc.) associated with a processor circuit located in one or more hardware devices, although the entire program and / or parts thereof may alternatively be executed and / or instantiated by one or more hardware devices other than the processor circuit and / or embodied in firmware or dedicated hardware. The machine-readable instructions may be distributed across multiple hardware devices and / or executed by and / or instantiated by two or more hardware devices (e.g., a server and a client hardware device). For example, a client hardware device may be implemented by an end-point client hardware device (e.g., a hardware device associated with a user) or an intermediate client hardware device (e.g., a Radio Access Network (RAN) gateway that may facilitate communication between a server and an end-point client hardware device).Similarly, a non-transitory computer-readable storage medium may include one or more media located in one or more hardware devices. Furthermore, although the exemplary program is described with reference to the flowchart shown in FIG. 22, many other ways of implementing the exemplary fractional stride pre-processing circuit 214 may alternatively be used. For example, the order of execution of the blocks may be changed, and / or some of the described blocks may be changed, eliminated, or combined. Additionally or alternatively, any or all of the blocks may be implemented by one or more hardware circuits (e.g., processor circuits, discrete and / or integrated analog and / or digital circuits, FPGAs, ASICs, comparators, operational amplifiers (op-amps), logic circuits, etc.) structured to perform the corresponding operations without executing software or firmware. The processor circuitry may be distributed across different network locations and / or local to one or more hardware devices (e.g., a single core processor (e.g., a single core central processing unit (CPU))), a multi-core processor (e.g., a multi-core CPU, etc.) within a single machine, multiple processors distributed across multiple servers in a server rack, multiple processors distributed across one or more server racks, CPUs and / or FPGAs located within the same package (e.g., the same integrated circuit (IC) package, or two or more separate housings, etc.).
[0182] The machine-readable instructions described herein may be stored in one or more of a compressed, encrypted, fragmented, compiled, executable, packaged, etc. format. The machine-readable instructions as described herein may be stored as data or data structures (e.g., portions of instructions, code, representations of code, etc.) that can be utilized to create, manufacture, and / or generate machine-executable instructions. For example, the machine-readable instructions may be fragmented and stored in one or more storage devices and / or computing devices (e.g., servers) located in the same or different locations (e.g., in a cloud, in an edge device, etc.) of a network or collection of networks. The machine-readable instructions may require one or more of installation, modification, adaptation, update, combination, supplementation, configuration, decryption, decompression, unpacking, distribution, reallocation, compilation, etc. to make them directly readable, interpretable, and / or executable by the computing device and / or other machines. For example, the machine-readable instructions may be stored in multiple portions that are individually compressed, encrypted, and / or stored on separate computing devices. These portions, when decoded, decompressed, and / or combined, form a set of machine-executable instructions that implement one or more operations that may together form a program such as those described herein.
[0183] In another example, machine-readable instructions may be stored in a state that can be read by a processor circuit, but require the addition of a library (e.g., a dynamic link library (DLL)), a software development kit (SDK), an application programming interface (API), etc., to execute and / or instantiate the machine-readable instructions on a particular computing device or other device. In another example, the machine-readable instructions may need to be configured (e.g., storing settings, inputting data, recording network addresses, etc.) before the machine-readable instructions and / or corresponding programs can be executed and / or instantiated in whole or in part. Thus, as used herein, a machine-readable medium may include machine-readable instructions and / or programs, regardless of the particular format or state of the machine-readable instructions and / or programs, whether stored or otherwise at rest or in transmission.
[0184] The machine-readable instructions described herein may be expressed in any past, present, or future instruction language, scripting language, programming language, etc. For example, the machine-readable instructions may be expressed using any of the following languages: C, C++, Java, C#, Perl, Python, JavaScript, HyperText Markup Language (HTML), Structured Query Language (SQL), Swift, etc.
[0185] As mentioned above, the example operations of FIG. 21 and / or FIG. 22 may be implemented using executable instructions (e.g., computer and / or machine readable instructions) stored in one or more non-transitory computer and / or machine readable media, such as optical storage devices, magnetic storage devices, HDDs, flash memory, read-only memory (ROM), CDs, DVDs, caches, any type of RAM, registers, and / or any other storage devices or storage disks in which information is stored for any duration (e.g., for an extended period of time, permanently, for a short period of time, for temporary buffering and / or caching of information). As used herein, the terms non-transitory computer readable medium and non-transitory computer readable storage medium are expressly defined to include any type of computer readable storage device and / or storage disk, to exclude propagating signals, and to exclude transmission media. In some examples disclosed herein, the instructions stored in the non-transitory computer readable storage medium, when executed, cause a processor circuit to perform the operations disclosed herein.
[0186] "Including" and "comprising" (and all their forms and tenses) are used herein as open-ended terms. Thus, whenever a claim uses any form of "including" or "comprising" (e.g., comprises, includes, comprising, including, having, etc.) as a preamble or in any type of claim recitation, it is to be understood that additional elements, terms, etc. may be present without departing from the scope of the corresponding claim or recitation. As used herein, the term "at least" is open-ended in the same way that the terms "comprising" and "including" are open-ended when used as a transitional term, for example in the preamble of a claim. The term "and / or," when used in the form A, B, and / or C, for example, refers to any combination or subset of A, B, and C, such as (1) A only, (2) B only, (3) C only, (4) A and B, (5) A and C, (6) B and C, or (7) A, B, and C. When used herein in the context of describing a structure, component, item, object, and / or thing, the phrase "at least one of A and B" is intended to refer to an implementation that includes either (1) at least one A, (2) at least one B, or (3) at least one A and at least one B. Similarly, when used herein in the context of describing a structure, component, item, object, and / or thing, the phrase "at least one of A or B" is intended to refer to an implementation that includes either (1) at least one A, (2) at least one B, or (3) at least one A and at least one B.When used herein in the context of describing the performance or execution of a process, instruction, operation, activity, and / or step, the phrase "at least one of A and B" is intended to refer to an implementation that includes either (1) at least one A, (2) at least one B, or (3) at least one A and at least one B. Similarly, when used herein in the context of describing the performance or execution of a process, instruction, operation, activity, and / or step, the phrase "at least one of A and B" is intended to refer to an implementation that includes either (1) at least one A, (2) at least one B, or (3) at least one A and at least one B.
[0187] As used herein, singular references (e.g., "a", "an", "first", "second", etc.) do not exclude a plurality. As used herein, the term "a" or "an" object refers to one or more of that object. The terms "a" (or "an"), "one or more" and "at least one" are used interchangeably herein. Furthermore, although individually described, a plurality of means, elements or method actions may be implemented, for example, by the same entity or object. Additionally, although individual features may be included in different examples or claims, these may in some cases be combined, and inclusion in different examples or claims does not imply that a combination of a plurality of features is not feasible and / or advantageous.
[0188] 21 is a flowchart representative of example machine-readable instructions and / or example operations 2100 that may be executed and / or instantiated by a processor circuit to implement the data replication pre-processing circuit 212 of FIG. 2 and / or FIG. 8. The machine-readable instructions and / or example operations 2100 begin at block 2102, where the parameter determination circuit 802 selects a first weight kernel to be processed by the AI accelerator circuit. At block 2104, the parameter determination circuit 802 determines the width, height and stride of the selected weight kernel.
[0189] In the illustrated example of FIG. 21, in block 2106, the parameter determination circuit 802 determines the width, height, and depth of an input tensor to be processed by the AI accelerator circuit. In block 2108, the padding circuit 804 determines whether external padding is applied to the input tensor. For example, in block 2108, the padding circuit 804 determines whether external padding is applied to the input tensor based on the dimensions of the weight kernel and / or the desired dimensions of the output tensor. In response to the padding circuit 804 determining that padding is applied to the input tensor (block 2108: yes), the machine-readable instructions and / or operations 2100 proceed to block 2110. In block 2110, the padding circuit 804 loads a first external pad before the first X position at the first Y position of the input tensor (e.g., to the left of the input tensor). In block 2112, the padding circuit 804 loads a second pad after the last X position in the first Y position of the input tensor (e.g., to the right of the input tensor).
[0190] 21 , in response to the padding circuitry 804 determining that padding is not applied to the input tensor (block 2108: NO), the machine-readable instructions and / or operations 2100 proceed to block 2114. At block 2114, the storage control circuitry 806 selects a first Y location of the input tensor to be reformatted. At block 2116, the storage control circuitry 806 selects a first X location of the input tensor at the selected Y location.
[0191] In the illustrated example of FIG. 21, in block 2118, the storage control circuit 806 copies the Z value from the selected XY location to the depth of the input tensor to successive XY locations of the input tensor that overlap the width of the weight kernel to be convolved with the input tensor. In block 2120, the storage control circuit 806 successively loads the copied Z value into the next XY location of the reformatted tensor. For example, in the first iteration of block 2120, the storage control circuit 806 successively loads the copied Z value into the first XY location (X=0, Y=0) of the reformatted tensor. In subsequent iterations of block 2120, the storage control circuit 806 loads the copied Z value into the next XY location of the reformatted tensor equal to the number of iterations after the first iteration.
[0192] In the illustrated example of FIG. 21, in block 2122, the storage control circuitry 806 determines whether there is enough input tensor data outside the width of the weight kernel to generate another column of the reformatted tensor. For example, in block 2122, the storage control circuitry 806 determines whether there are additional X positions of the input tensor outside the width of the weight kernel. In response to the storage control circuitry 806 determining that there is enough input tensor data outside the width of the weight kernel to generate another column of the reformatted tensor (block 2122: yes), the machine-readable instructions and / or operations 2100 proceed to block 2124. In block 2124, the storage control circuitry 806 selects the next X position of the input tensor at the selected Y position according to the stride of the weight kernel. After block 2124, the machine-readable instructions and / or operations 2100 return to block 2118.
[0193] In the illustrated example of FIG. 21 , in response to the storage control circuitry 806 determining that there is not enough input tensor data outside the width of the weight kernel to generate another column of the reformatted tensor (block 2122: no), the machine-readable instructions and / or operations 2100 proceed to block 2126. In block 2126, the storage control circuitry 806 determines whether there is enough input tensor data outside the height of the weight kernel to generate another row of the reformatted tensor. For example, in block 2126, the storage control circuitry 806 determines whether there are additional Y positions of the input tensor outside the height of the weight kernel. In response to the storage control circuitry 806 determining that there is enough input tensor data outside the height of the weight kernel to generate another row of the reformatted tensor (block 2126: yes), the machine-readable instructions and / or operations 2100 proceed to block 2128. In block 2128, the storage control circuit 806 selects the next Y position of the input tensor according to the stride of the weight kernel. After block 2128, the machine-readable instructions and / or operations 2100 return to block 2116.
[0194] In the illustrated example of FIG. 21 , in response to the storage control circuitry 806 determining that there is not enough input tensor data outside the height of the weight kernel to generate another row of the reformatted tensor (block 2126: no), the machine-readable instructions and / or operations 2100 proceed to block 2130. In block 2130, the parameter determination circuitry 802 determines whether there are additional weight kernels to be processed. In response to the parameter determination circuitry 802 determining that there are additional weight kernels to be processed (block 2130: yes), the machine-readable instructions and / or operations 2100 proceed to block 2132 where the parameter determination circuitry 802 selects the next weight kernel to be processed. After block 2132, the machine-readable instructions and / or operations 2100 return to block 2104. In response to the parameter determination circuit 802 determining that there are no additional weight kernels to be processed (block 2130: no), the machine-readable instructions and / or operations 2100 end.
[0195] 22 is a flow chart representative of example machine readable instructions and / or example operations 2200 that may be executed and / or instantiated by a processor circuit to implement the fractional stride pre-processing circuit 214 of FIG. 2 and / or FIG. 10. The machine readable instructions and / or operations 2200 begin at block 2202 where the tensor and weight control circuit 1002 selects a first weight kernel to be processed. At block 2204, the tensor and weight control circuit 1002 determines the width, height and stride of the selected weight kernel. At block 2206, the tensor and weight control circuit 1002 determines the width, height and depth of the input tensor to be convolved with the selected weight kernel.
[0196] In the illustrated example of FIG. 22, in block 2208, the padding control circuit 1004 determines whether external padding is applied to the input tensor. In response to the padding control circuit 1004 determining that external padding is applied to the input tensor (block 2208: yes), the machine-readable instructions and / or operations 2200 proceed to block 2210. In block 2210, the padding control circuit 1004 loads an external pad before the first X position at the first Y position of the input tensor (e.g., to the left of the input tensor). In the example of FIG. 22, in block 2212, the padding control circuit 1004 loads an external pad after the last X position at the first Y position of the input tensor (e.g., to the right of the input tensor).
[0197] In the illustrated example of FIG. 22, in response to the padding control circuit 1004 determining that no external padding is applied to the input tensor (block 2208: no), the machine-readable instructions and / or operations 2200 proceed to block 2214. In block 2214, the sparsity generation circuit 1006 determines whether internal padding is applied to the input tensor. For example, in block 2214, the sparsity generation circuit 1006 determines whether internal padding is applied to the input tensor by dividing the granularity of the storage elements by the depth of the input tensor. In the illustrated example of FIG. 22, in response to the sparsity generation circuit 1006 determining that internal padding is applied to the input tensor (block 2214: yes), the machine-readable instructions and / or operations 2200 proceed to block 2216. In block 2216, the sparsity generation circuit 1006 separates the Z value of each XY position of the input tensor by the number of pads. In response to the sparsity generation circuit 1006 determining that inner padding is not applied to the input tensor (block 2214: no), the machine-readable instructions and / or operations 2200 proceed to block 2218.
[0198] In the illustrated example of Figure 22, in block 2218, the tensor and weight control circuit 1002 replicates the selected weight kernel to generate N weight kernels to match the number of points of the output tensor that can be generated per XY position of the reformatted input tensor. For example, in block 2218, the tensor and weight control circuit 1002 replicates the selected weight kernel to generate four weight kernels. In the example of Figure 22, the tensor and weight control circuit 1002 replicates the selected weight kernel prior to compression (e.g., the selected weight kernel is dense). In block 2220, the sparsity generation circuit 1006 generates N weight sparsity bitmaps. Each weight sparsity bitmap includes a sparsity pattern that is offset from the start of the respective weight sparsity bitmap by the product of the number of strides of the selected weight kernel plus the depth of the input tensor and the number of interior pads. For example, if the depth of the input tensor is 3 and the number of interior pads is 1, then the respective sparsity pattern is offset by the product of the number of strides of the weight kernel and 4. In the example of FIG. 22, the sparsity pattern of each weight sparsity bitmap includes d consecutive 1-bit w K Includes a set. K is the width of the weight kernel, and d is the depth of the input tensor. If inner padding is applied to the input tensor, the sparsity generation circuit 1006 K To each set, append one or more zero bits equal to the number of internal pads.
[0199] In the illustrated example of FIG. 22, in block 2222, the pointer control circuit 1008 determines to apply a fractional stride offset to successive storage element pointers based on N, the depth of the input tensor, the stride of the weight kernel, and the interior pad length, if applicable. For example, the pointer control circuit 1008 determines the fractional stride offset according to Equation 1. In the example of FIG. 22, in block 2224, the pointer control circuit 1008 shifts successive each of the storage element pointers by the fractional stride offset. In the example of FIG. 22, in block 2226, the tensor and weight control circuit 1002 offloads the input tensor, one or more weight kernels, and one or more weight sparsity bitmaps to be processed. In block 2228, the tensor and weight control circuit 1002 determines whether there are additional weight kernels to be processed. In response to the tensor and weight control circuit 1002 determining that there are additional weight kernels to be processed (block 2228: yes), the machine readable instructions and / or operations 2200 proceed to block 2230 where the tensor and weight control circuit 1002 selects the next weight kernel to be processed. In response to the tensor and weight control circuit 1002 determining that there are not additional weight kernels to be processed (block 2228: no), the machine readable instructions and / or operations 2200 end.
[0200] FIG. 23 is a block diagram of an exemplary processor platform 2300 configured to execute and / or instantiate the machine-readable instructions and / or operations 2100 of FIG. 21 for implementing the data replication pre-processing circuit 212 of FIG. 2 and / or FIG. 8 and / or the machine-readable instructions and / or operations 2200 of FIG. 22 for implementing the fractional stride pre-processing circuit 214 of FIG. 2 and / or FIG. 10. The processor platform 2300 may be, for example, a server, a personal computer, a workstation, a self-learning machine (e.g., neural network), a mobile device (e.g., a mobile phone, a smartphone, a tablet such as an iPad), a personal digital assistant (PDA), an Internet appliance, a DVD player, a CD player, a digital video recorder, a Blu-ray player, a gaming console, a personal video recorder, a set-top box, a headset (e.g., an augmented reality (AR) headset, a virtual reality (VR) headset, etc.), or other wearable device or any other type of computing device.
[0201] The processor platform 2300 of the illustrated example includes a processor circuit 2312. The processor circuit 2312 of the illustrated example is hardware. For example, the processor circuit 2312 may be implemented by one or more integrated circuits, logic circuits, FPGAs, microprocessors, CPUs, GPUs, DSPs, and / or microcontrollers of any desired family or manufacturer. The processor circuit 2312 may be implemented by one or more semiconductor-based (e.g., silicon-based) devices. In this example, the processor circuit 2312 implements the example parameter determination circuit 802, the example padding circuit 804, the example storage control circuit 806, and / or more generally the data duplication pre-processing circuit 212, and / or the example tensor and weight control circuit 1002, the example padding control circuit 1004, the example sparsity generation circuit 1006, the example pointer control circuit 1008, and / or more generally the fractional stride pre-processing circuit 214.
[0202] The processor circuitry 2312 of the illustrated example includes local memory 2313 (e.g., cache, registers, etc.). The processor circuitry 2312 of the illustrated example communicates with main memory, including volatile memory 2314 and non-volatile memory 2316, via bus 2318. The volatile memory 2314 may be implemented with synchronous dynamic random access memory (SDRAM), dynamic random access memory (DRAM), RAMBUS® Dynamic Random Access Memory (RDRAM®), and / or any other type of RAM device. The non-volatile memory 2316 may be implemented with flash memory and / or any other desired type of memory device. Access to the main memory 2314, 2316 of the illustrated example is controlled by a memory controller 2317.
[0203] The illustrated example processor platform 2300 also includes an AI accelerator circuit 208. The example AI accelerator circuit 208 includes an example local memory 216, an example data read circuit 218, an example MAC circuit 220, and an example data write circuit 222. In the example of FIG. 23, the example MAC circuit 220 includes an example control logic circuit 1102, an example weight buffer 1104, an example weight decompression circuit 1106, an example input tensor buffer 1108, an example input tensor decompression circuit 1110, a MAC circuit 1112, and an example data write circuit 222. 1,1 From 1112 1,M Illustrative first column of MAC circuit 1114 1,1 From 1114 1,M Illustrative second column and MAC circuit 1116 N,1 From 1116 N,M, and an exemplary Nth column of . In some examples, the control logic circuit 1102 implements the exemplary parameter determination circuit 802, the exemplary padding circuit 804, the exemplary storage control circuit 806, and / or more generally the data duplication preprocessing circuit 212, and / or the exemplary tensor and weight control circuit 1002, the exemplary padding control circuit 1004, the exemplary sparsity generation circuit 1006, the exemplary pointer control circuit 1008, and / or more generally the fractional stride preprocessing circuit 214. As mentioned above, the illustrated example AI accelerator circuit 208 includes a local memory 216. The illustrated example AI accelerator circuit 208 is in communication with a main memory, including a volatile memory 2314 and a non-volatile memory 2316, via a bus 2318.
[0204] The processor platform 2300 of the depicted example also includes an interface circuit 2320. The interface circuit 2320 may be implemented in hardware according to any type of interface standard, such as an Ethernet interface, a Universal Serial Bus (USB) interface, a Bluetooth interface, a Near Field Communication (NFC) interface, a PCI interface, and / or a PCIe interface.
[0205] In the illustrated example, one or more input devices 2322 are coupled to the interface circuit 2320. The input devices 2322 allow a user to input data and / or commands into the processor circuit 2312. The input devices 2322 may be implemented, for example, by audio sensors, a microphone, a camera (still or video), a keyboard, buttons, a mouse, a touch screen, a track pad, a track ball, an isopoint device, and / or a voice recognition system.
[0206] One or more output devices 2324 are also connected to the interface circuitry 2320 of the illustrated example. The output device(s) 2324 may be implemented by, for example, a display device (e.g., a light emitting diode (LED), an organic light emitting diode (OLED), a liquid crystal display (LCD), a cathode ray tube (CRT) display, an in-place switching (IPS) display, a touch screen, etc.), a tactile output device, a printer, and / or a speaker. Thus, the interface circuitry 2320 of the illustrated example typically includes a graphics driver card, a graphics driver chip, and / or a graphics processor circuit such as a GPU.
[0207] The interface circuitry 2320 of the depicted example also includes communications devices, such as transmitters, receivers, transceivers, modems, residential gateways, wireless access points, and / or network interfaces to facilitate data exchange with external machines (e.g., computing devices of any type) over a network 2326. Communications may be, for example, via an Ethernet connection, a digital subscriber line (DSL) connection, a telephone line connection, a coaxial cable system, a satellite system, a line-of-sight wireless system, a cellular telephone system, an optical connection, etc.
[0208] The processor platform 2300 of the depicted example also includes one or more mass storage devices 2328 for storing software and / or data. Examples of such mass storage devices 2328 include magnetic storage devices, optical storage devices, floppy disk drives, HDDs, CDs, Blu-ray disk drives, redundant array of independent disks (RAID) systems, solid-state storage devices such as flash memory devices, and DVD drives.
[0209] Machine-executable instructions 2332, which may be implemented by the machine-readable instructions of FIG. 21 and / or FIG. 23, may be stored in the mass storage device 2328, the volatile memory 2314, the non-volatile memory 2316, and / or a removable non-transitory computer-readable storage medium such as a CD or DVD.
[0210] FIG. 24 is a block diagram of an example implementation of the processor circuit 2312 of FIG. 23. In this example, the processor circuit 2312 of FIG. 23 is implemented by a microprocessor 2400. For example, the microprocessor 2400 may implement a multi-core hardware circuit, such as, for example, a CPU, a DSP, a GPU, an XPU, etc. While any number of example cores 2402 (e.g., one core) may be included, the microprocessor 2400 of this example is a multi-core semiconductor device including N cores. The cores 2402 of the microprocessor 2400 may operate independently or cooperate to execute machine-readable instructions. For example, a firmware program, an embedded software program, or a machine code corresponding to a software program may be executed by one of the cores 2402, or may be executed by multiple of the cores 2402 at the same time or at different times. In some examples, the firmware program, the embedded software program, or a machine code corresponding to a software program is divided into multiple threads and executed in parallel by two or more of the cores 2402. The software program may correspond to some or all of the machine-readable instructions and / or operations represented by the flowcharts of FIG. 21 and / or FIG.
[0211] The cores 2402 may communicate via an exemplary bus 2404. In some examples, the bus 2404 may implement a communication bus to facilitate communication associated with one of the cores 2402. For example, the bus 2404 may implement at least one of an Inter-Integrated Circuit (I2C) bus, a Serial Peripheral Interface (SPI) bus, a PCI bus, or a PCIe bus. Additionally or alternatively, the bus 2404 may implement any other type of computing or electrical bus. The cores 2402 may obtain data, instructions, and / or signals from one or more external devices via the exemplary interface circuitry 2406. The cores 2402 may output data, instructions, and / or signals to one or more external devices via the interface circuitry 2406. The cores 2402 in this example include an exemplary local memory 2420 (e.g., a level 1 (L1) cache, which may be divided into an L1 data cache and an L1 instruction cache), but the microprocessor 2400 also includes an exemplary shared memory 2410 that may be shared by the cores (e.g., a level 2 (L2) cache) for fast access to data and / or instructions. Data and / or instructions may be transferred (e.g., shared) by writing to and / or reading from the shared memory 2410. The local memory 2420 of each of the cores 2402 and the shared memory 2410 may be part of a hierarchy of storage devices that includes multiple levels of cache memories and main memories (e.g., main memories 2314, 2316 of FIG. 23). Typically, memories at higher levels in the hierarchy exhibit faster access times and have less storage capacity than memories at lower levels. Changes in the cache hierarchy at various levels are managed (e.g., coordinated) by cache coherency policies.
[0212] Each core 2402 may be referred to as a CPU, DSP, GPU, etc., or any other type of hardware circuit. Each core 2402 includes a control unit circuit 2414, an arithmetic and logic (AL) circuit (sometimes referred to as an ALU circuit) 2416, a number of registers 2418, an L1 cache 2420, and an example bus 2422. Other structures may exist. For example, each core 2402 may include a vector unit circuit, a single instruction multiple data (SIMD) unit circuit, a load / store unit (LSU) circuit, a branch / jump unit circuit, a floating point unit (FPU) circuit, etc. The control unit circuit 2414 includes semiconductor-based circuitry structured to control (e.g., coordinate data movement) data movement within the corresponding core 2402. The AL circuitry 2416 includes semiconductor-based circuitry structured to perform one or more mathematical and / or logical operations on data within the corresponding core 2402. Some example AL circuits 2416 perform integer-based operations. In another example, the AL circuitry 2416 also performs floating point operations. In yet another example, the AL circuitry 2416 may include a first AL circuit that performs integer-based operations and a second AL circuit that performs floating point operations. In some examples, the AL circuitry 2416 may be referred to as an arithmetic logic unit (ALU) and / or an arithmetic and logic circuit. The registers 2418 are semiconductor-based structures for storing data and / or instructions, such as results of one or more of the operations performed by the AL circuitry 2416 of the corresponding core 2402. For example, the registers 2418 may include vector registers, SIMD registers, general purpose registers, flag registers, segment registers, machine specific registers, instruction pointer registers, control registers, debug registers, memory management registers, machine check registers, etc. The registers 2418 may be arranged in banks as shown in FIG. 24. Alternatively, the registers 2418 may be organized in any other configuration, format, or structure, including distribution throughout the cores 2402 to reduce access times. The bus 2422 may implement at least one of an I2C bus, an SPI bus, a PCI bus, or a PCIe bus.
[0213] Each core 2402, and / or microprocessor 2400 more generally, may include additional and / or alternative structures to those illustrated above. For example, there may be one or more clock circuits, one or more power supplies, one or more power gates, one or more cache home agents (CHAs), one or more aggregate / common mesh stops (CMS), one or more shifters (e.g., barrel shifters), and / or other circuits. Microprocessor 2400 is a semiconductor device fabricated to include many transistor interconnects to implement the above-mentioned structures in one or more integrated circuits (ICs) contained in one or more packages. The processor circuitry may include and / or cooperate with one or more accelerators. In some examples, accelerators are implemented by logic circuits to perform certain tasks more quickly and / or efficiently than can be done by a general-purpose processor. Examples of accelerators include ASICs and FPGAs, such as those described herein. GPUs or other programmable devices may also be accelerators. The accelerator may be mounted on the processor circuit in the same chip package as the processor circuit and / or in one or more packages separate from the processor circuit.
[0214] Figure 25 is a block diagram of another example implementation of the processor circuit 2312 of Figure 23. In this example, the processor circuit 2312 is implemented by an FPGA circuit 2500. The FPGA circuit 2500 may be used, for example, to perform operations that might otherwise be performed by the example microprocessor 2400 of Figure 24 executing corresponding machine-readable instructions. However, once configured, the FPGA circuit 2500 instantiates the machine-readable instructions in hardware and is therefore often able to perform operations faster than could be performed by a general-purpose microprocessor executing corresponding software.
[0215] More specifically, in contrast to the microprocessor 2400 of FIG. 24 described above (which may be programmed to execute some or all of the machine-readable instructions represented by the flowcharts of FIG. 21 and / or FIG. 22, but is a general-purpose device in which the interconnects and logic are fixed once manufactured), the example FPGA circuit 2500 of FIG. 25 includes interconnects and logic that may be configured and / or interconnected in different ways after manufacture to instantiate some or all of the machine-readable instructions represented by the flowcharts of FIG. 21 and / or FIG. 22, for example. In particular, the FPGA circuit 2500 may be considered an array of logic gates, interconnects, and switches. The switches may be programmed to change how the logic gates are interconnected by the interconnects, effectively forming one or more dedicated logic circuits (until the FPGA circuit 2500 is reprogrammed). The configured logic circuits allow the logic gates to cooperate in different ways to perform different operations on data received by the input circuits. Those operations may correspond to some or all of the software represented by the flowcharts of Figures 21 and / or 22 (e.g., operations corresponding to instructions represented by the flowcharts of Figures 21 and / or 22). Thus, FPGA circuitry 2500 may be structured to effectively instantiate some or all of the machine-readable instructions of the flowcharts of Figures 21 and / or 22 as special-purpose logic circuitry for performing operations corresponding to those software instructions in a dedicated manner similar to an ASIC. Thus, FPGA circuitry 2500 may perform operations corresponding to some or all of the machine-readable instructions of Figures 21 and / or 22 faster than a general-purpose microprocessor can perform those operations.
[0216] In the example of FIG. 25, the FPGA circuit 2500 is structured to be programmed (and / or programmed one or more times) by an end user with a hardware description language (HDL) such as Verilog. The FPGA circuit 2500 of FIG. 25 includes an example input / output (I / O) circuit 2502 for obtaining data from and / or outputting data to an example configuration circuit 2504 and / or external hardware (e.g., external hardware circuit) 2506. For example, the configuration circuit 2504 may implement an interface circuit that may obtain machine-readable instructions for configuring the FPGA circuit 2500 or portions thereof. In some such examples, the configuration circuit 2504 may obtain machine-readable instructions from a user, a machine (e.g., a hardware circuit (e.g., a programmed or dedicated circuit) that may implement an artificial intelligence / machine learning (AI / ML) model to generate instructions), etc. In some examples, the external hardware 2506 may implement the microprocessor 2400 of FIG. 24. The FPGA circuit 2500 also includes an array of exemplary logic gate circuits 2508, a plurality of exemplary configurable interconnects 2510, and exemplary storage circuits 2512. The logic gate circuits 2508 and interconnects 2510 are configurable to instantiate one or more operations that may correspond to at least some of the machine-readable instructions of FIG. 21 and / or FIG. 22 and / or other desired operations. The logic gate circuits 2508 shown in FIG. 25 are fabricated in groups or blocks. Each block includes a semiconductor-based electrical structure that can be configured into a logic circuit. In some examples, the electrical structure includes logic gates (e.g., AND gates, OR gates, NOR gates, etc.) that provide the basic building blocks for the logic circuit. There are electrically controllable switches (e.g., transistors) within each of the logic gate circuits 2508 to enable configuration of the electrical structures and / or logic gates to form circuits to perform desired operations. The logic gate circuitry 2508 may include other electrical structures, such as, for example, a look-up table (LUT), a register (eg, a flip-flop or latch), a multiplexer, etc.
[0217] The interconnects 2510 in the illustrated example are conductive paths, traces, or vias, etc. that may include electrically controllable switches (e.g., transistors) whose state can be changed by programming (e.g., using an HDL instruction language) to activate or deactivate one or more connections between one or more of the logic gate circuits 2508 to program the desired logic circuit.
[0218] The storage circuits 2512 in the illustrated example are structured to store the results of one or more of the operations performed by the corresponding logic gates. The storage circuits 2512 may be implemented with registers, etc. In the illustrated example, the storage circuits 2512 are distributed among the logic gate circuits 2508 for ease of access and speed of execution.
[0219] The example FPGA circuit 2500 of FIG. 25 also includes an example dedicated operation circuit 2514. In this example, the dedicated operation circuit 2514 includes dedicated circuit 2516 that can be called to implement commonly used functions to avoid the need to program those functions in the art. Examples of such dedicated circuit 2516 include memory (e.g., DRAM) controller circuit, PCIe controller circuit, clock circuit, transceiver circuit, memory, and multiplier-accumulator circuit. Other types of dedicated circuitry may be present. In some examples, the FPGA circuit 2500 may also include an example general-purpose programmable circuit 2518, such as an example CPU 2520 and / or an example DSP 2522. There may additionally or alternatively be other general-purpose programmable circuits 2518, such as GPUs, XPUs, etc., that can be programmed to perform other operations.
[0220] 24 and 25 show two example implementations of the processor circuit 2312 of FIG. 23, many other approaches are possible. For example, as mentioned above, modern FPGA circuits may include an on-board CPU, such as one or more of the example CPUs 2520 of FIG. 25. Thus, the processor circuit 2312 of FIG. 23 may additionally be implemented by combining the example microprocessor 2400 of FIG. 24 and the example FPGA circuit 2500 of FIG. 25. In some such hybrid examples, a first portion of the machine-readable instructions represented by the flowcharts of FIG. 21 and / or FIG. 22 may be executed by one or more of the cores 2402 of FIG. 24, and a second portion of the machine-readable instructions represented by the flowcharts of FIG. 21 and / or FIG. 22 may be executed by the FPGA circuit 2500 of FIG. 25.
[0221] In some examples, the processor circuitry 2312 of Figure 23 may be in one or more packages. For example, the microprocessor 2400 of Figure 24 and / or the FPGA circuitry 2500 of Figure 25 may be in one or more packages. In some examples, an XPU may be implemented by the processor circuitry 2312 of Figure 23, which may be in one or more packages. For example, an XPU may include a CPU in one package, a DSP in another package, a GPU in yet another package, and an FPGA in yet yet another package.
[0222] A block diagram illustrating an example software distribution platform 2605 for distributing software, such as the example machine-readable instructions 2332 of FIG. 23, to hardware devices owned and / or operated by third parties is shown in FIG. 26. The example software distribution platform 2605 may be implemented by any computer server, data facility, cloud service, etc. capable of storing and transmitting software to other computing devices. The third parties may be customers of the entity that owns and / or operates the software distribution platform 2605. For example, the entity that owns and / or operates the software distribution platform 2605 may be a developer, seller, and / or licensor of software, such as the example machine-readable instructions 2332 of FIG. 23. The third parties may be consumers, users, retailers, OEMs, etc. that purchase and / or license the software for use and / or resale and / or sublicense. In the example shown, the software distribution platform 2605 includes one or more servers and one or more storage devices. The storage device stores machine-readable instructions 2332 that may correspond to the machine-readable instructions and / or operations 2100 of FIG. 21 and / or the machine-readable instructions and / or operations 2200 of FIG. 22 described above. One or more servers of the example software distribution platform 2605 are in communication with a network 2610 that may correspond to any one or more of the Internet and / or any of the example networks described above. In some examples, the one or more servers respond to requests to transmit the software to a requesting party as part of a commercial transaction. Payment for the distribution, sale and / or license of the software may be processed by one or more servers of the software distribution platform and / or by a third-party payment entity. The server allows purchasers and / or licensors to download the machine-readable instructions 2332 from the software distribution platform 2605.For example, software that may correspond to the machine readable instructions and / or operations 2100 of FIG. 21 may be downloaded to an exemplary processor platform 2300 that executes the machine readable instructions 2332 to implement the data replication pre-processing circuit 212 of FIG. 2 and / or FIG. 8. Additionally or alternatively, software that may correspond to the machine readable instructions and / or operations 2200 of FIG. 22 may be downloaded by an exemplary processor platform 2300 that executes the machine readable instructions 2332 to implement the fractional stride pre-processing circuit 214 of FIG. 2 and / or FIG. 10. In some examples, one or more servers of the software distribution platform 2605 periodically provide, transmit and / or force updates to the software (e.g., the exemplary machine readable instructions 2332 of FIG. 23) to ensure that improvements, patches, updates, etc. are distributed and applied to the software at end user devices.
[0223] From the above, it will be appreciated that exemplary systems, methods, apparatus, and articles of manufacture have been disclosed that increase the utilization of NN accelerator circuits for shallow layers of a NN by reformatting one or more tensors. The exemplary systems, methods, apparatus, and articles of manufacture disclosed herein reduce the time to transfer activation data to the MAC array of the AI accelerator circuit, allowing more MACs in the MAC array to operate in parallel. Thus, the examples disclosed herein increase MAC utilization and reduce the time required to process an input layer (e.g., an image) to a NN. Compared to existing technologies, the examples disclosed herein do not require custom hardware, provide better performance across all configurations, and greatly simplify the design from a physical perspective. Thus, the examples disclosed herein enable higher frequency operation and lower power consumption, for example, by eliminating the dedicated interconnects present in existing technologies.
[0224] Additionally, the disclosed systems, methods, apparatus, and articles of manufacture improve the processing performance of input tensors to the input layer of a NN. Examples disclosed herein include tensor data replication, which describes how tensor data is replicated to improve performance, and fractional striding, which describes how fractional striding is used to improve performance. Examples disclosed herein increase MAC utilization by using tensor operations, allowing the MAC to receive more activation data in parallel. In addition to the benefits provided by tensor data replication, fractional striding does not replicate activation data, which reduces the computational burden of pre-processing activation data for a NN. Reducing pre-processing reduces overall latency and increases frames per second (FPS).
[0225] The disclosed system, method, apparatus and article of manufacture improves the efficiency of use of computing devices by reducing power consumption and increasing frame rate. For example, the primary metric of image processing CNN is the number of FPS. The examples disclosed herein reduce the time to process the input layer of the CNN, which reduces the latency of the CNN and directly improves the FPS. Additionally, FPS per watt (FPS / W) is the primary metric of edge neural network accelerators such as vision processing units. The examples disclosed herein increase the FPS and reduce the power, resulting in a meaningful improvement of the primary metric. Thus, the disclosed system, method, apparatus and article of manufacture relate to one or more improvements in the operation of machines, such as computers or other electronic and / or mechanical devices.
[0226] Disclosed herein are exemplary methods, apparatus, systems, and articles of manufacture for increasing utilization of neural network (NN) accelerator circuitry for shallow layers of an NN by reformatting one or more tensors. Further examples and combinations thereof include the following:
[0227] Example 1 is an apparatus for increasing utilization of a neural network (NN) accelerator circuit for shallow layers of an NN, comprising: an interface circuit for accessing a first tensor; and a processor circuit, the processor circuit comprising at least one of a central processing unit, a graphics processor unit, or a digital signal processor, the at least one of the central processing unit, the graphics processor unit, or the digital signal processor including control circuitry for controlling data movement within the processor circuit, arithmetic and logic circuitry for performing one or more first operations corresponding to instructions, and one or more registers for storing results of the one or more first operations and the instructions in the apparatus; and a field programmable gate array (FPGA), the FPGA including logic gate circuits, a plurality of configurable interconnect and storage circuits, the the logic gate circuitry and the interconnection perform one or more second operations, and the storage circuitry includes logic gate circuitry for storing results of the one or more second operations or performing one or more third operations; the processor circuitry performs at least one of the first operation, the second operation, or the third operation to instantiate a parameter determination circuitry to determine a width of a weight kernel and to determine a depth of the first tensor; and instantiate a storage control circuitry to copy one or more Z values from a first XY position of the first tensor to the depth of the first tensor for successive XY positions overlapping the width of the weight kernel and to successively load the one or more Z values into a first XY position of a second tensor.
[0228] Example 2 includes the apparatus of Example 1, wherein the processor circuitry performs at least one of the first operation, the second operation, or the third operation to instantiate a padding circuit to determine whether external padding is applied to the first tensor based on the width of the weight kernel, and in response to determining that external padding is applied, load a first external pad before a first X position at a first Y position of the first tensor, and load a second external pad after a last X position at the first Y position of the first tensor.
[0229] Example 3 includes the apparatus of Example 1, wherein the processor circuitry performs at least one of the first operation, the second operation, or the third operation to instantiate the storage control circuitry to: select a first Y location of the first tensor; select a first X location of the first tensor at the first Y location to set the first XY location; and, in response to determining that sufficient data of the first tensor is outside the width of the weight kernel to generate another column of the second tensor, select a second X location at the first Y location in accordance with a stride of the weight kernel.
[0230] Example 4 includes the apparatus of Example 3, wherein the processor circuitry performs at least one of the first operation, the second operation, or the third operation to instantiate the storage control circuitry to select a second Y position of the first tensor in accordance with the stride of the weight kernel in response to determining that sufficient data of the first tensor is outside a height of the weight kernel to generate another row of the second tensor.
[0231] Example 5 includes the apparatus of example 1, wherein the first tensor is stored in a memory, the memory being at least one of 16-byte aligned or 32-byte aligned.
[0232] Example 6 includes the apparatus of example 1, wherein the first tensor corresponds to an input image to the NN.
[0233] Example 7 includes the apparatus of Example 1, wherein the weight kernel is a first weight kernel, and the processor circuitry performs at least one of the first operation, the second operation, or the third operation to instantiate the parameter determination circuitry to select a second weight kernel in response to determining that there are additional weight kernels to be processed.
[0234] Example 8 includes a non-transitory computer-readable storage medium comprising instructions that, when executed, cause a processor circuit to perform at least steps of determining a width of a weight kernel, determining a depth of a first tensor, copying one or more Z values from a first XY location of the first tensor to the depth of the first tensor of successive XY locations that overlap the width of the weight kernel, and loading the one or more Z values into a first XY location of a second tensor in succession.
[0235] Example 9 includes the non-transitory computer-readable storage medium of Example 8, wherein the instructions, when executed, cause the processor circuit to perform the steps of: determining whether external padding is applied to the first tensor based on the width of the weight kernel; in response to determining that external padding is applied, loading a first external pad before a first X position at a first Y position of the first tensor; and loading a second external pad after a last X position at the first Y position of the first tensor.
[0236] Example 10 includes the non-transitory computer-readable storage medium of example 8, wherein the instructions, when executed, cause the processor circuit to perform the steps of selecting a first Y position of the first tensor, selecting a first X position of the first tensor at the first Y position to set the first XY position, and, in response to determining that sufficient data of the first tensor exists outside the width of the weight kernel to generate another column of the second tensor, selecting a second X position at the first Y position in accordance with a stride of the weight kernel.
[0237] Example 11 includes the non-transitory computer-readable storage medium of example 10, wherein the instructions, when executed, cause the processor circuit to perform a procedure that, in response to determining that sufficient data of the first tensor exists outside a height of the weight kernel to generate another row of the second tensor, selects a second Y position of the first tensor in accordance with the stride of the weight kernel.
[0238] Example 12 includes the non-transitory computer-readable storage medium of example 8, wherein the first tensor is stored in a memory, the memory being at least one of 16-byte aligned or 32-byte aligned.
[0239] Example 13 includes the non-transitory computer-readable storage medium of example 8, wherein the first tensor corresponds to an input image to a neural network.
[0240] Example 14 includes the non-transitory computer-readable storage medium of example 8, wherein the weight kernel is a first weight kernel, and the instructions, when executed, cause the processor circuit to perform a procedure for selecting a second weight kernel in response to determining that there are additional weight kernels to be processed.
[0241] Example 15 includes an apparatus for increasing utilization of a neural network (NN) accelerator circuit for shallow layers of an NN, the apparatus comprising: means for determining one or more parameters that determine a width of a weight kernel and that determine a depth of a first tensor; and means for controlling storage that copies one or more Z values from a first XY position of the first tensor to the depth of the first tensor for successive XY positions that overlap the width of the weight kernel and successively loads the one or more Z values into a first XY position of a second tensor.
[0242] Example 16 includes the apparatus of Example 15, further comprising means for padding: determining whether external padding is applied to the first tensor based on the width of the weight kernel; and, in response to determining that external padding is applied, loading a first external pad before a first X position at a first Y position of the first tensor and loading a second external pad after a last X position at the first Y position of the first tensor.
[0243] Example 17 includes the apparatus of example 15, wherein the means for controlling storage is configured to: select a first Y location of the first tensor; select a first X location of the first tensor at the first Y location to set the first XY location; and, in response to determining that sufficient data of the first tensor is outside the width of the weight kernel to generate another column of the second tensor, select a second X location at the first Y location in accordance with a stride of the weight kernel.
[0244] Example 18 includes the apparatus of example 17, wherein the means for controlling storage is configured to, in response to determining that sufficient data of the first tensor to generate another row of the second tensor is outside a height of the weight kernel, select a second Y position of the first tensor in accordance with the stride of the weight kernel.
[0245] Example 19 includes the apparatus of example 15, wherein the first tensor is stored in a memory, the memory being at least one of 16-byte aligned or 32-byte aligned.
[0246] Example 20 includes the apparatus of example 15, wherein the first tensor corresponds to an input image to the NN.
[0247] Example 21 includes the apparatus of example 15, wherein the weight kernel is a first weight kernel, and the means for determining the one or more parameters is configured to select a second weight kernel in response to determining that there are additional weight kernels to be processed.
[0248] Example 22 includes a method for increasing utilization of neural network (NN) accelerator circuitry for shallow layers of an NN, comprising: determining a width of a weight kernel; determining a depth of a first tensor; copying one or more Z values from a first XY location of the first tensor to the depth of the first tensor for successive XY locations overlapping the width of the weight kernel; and successively loading the one or more Z values into a first XY location of a second tensor.
[0249] Example 23 includes the method of Example 22, further comprising determining whether external padding is applied to the first tensor based on the width of the weight kernel, and in response to determining that external padding is applied, loading a first external pad before a first X position at a first Y position of the first tensor, and loading a second external pad after a last X position at the first Y position of the first tensor.
[0250] Example 24 includes the method of Example 22, further comprising selecting a first Y location of the first tensor, selecting a first X location of the first tensor at the first Y location to set the first XY location, and, in response to determining that sufficient data of the first tensor exists outside the width of the weight kernel to generate another column of the second tensor, selecting a second X location at the first Y location according to a stride of the weight kernel.
[0251] Example 25 includes the method of Example 24, further comprising, in response to determining that sufficient data of the first tensor to generate another row of the second tensor exists outside a height of the weight kernel, selecting a second Y position of the first tensor according to the stride of the weight kernel.
[0252] Example 26 includes the method of example 22, wherein the first tensor is stored in a memory, the memory being at least one of 16-byte aligned or 32-byte aligned.
[0253] Example 27 includes the method of example 22, wherein the first tensor corresponds to an input image to the NN.
[0254] Example 28 includes the method of example 22, wherein the weight kernel is a first weight kernel, and the method further includes selecting a second weight kernel in response to determining that there are additional weight kernels to be processed.
[0255] Example 29 includes an apparatus for increasing utilization of a neural network (NN) accelerator circuit for shallow layers of an NN, the apparatus comprising: parameter determination circuitry for determining a width of a weight kernel and determining a depth of a first tensor; and storage control circuitry for copying one or more values along a third dimension of the first tensor from a first intersection of a first point along a first dimension of the first tensor and a first point along a second dimension of the first tensor to the depth of the first tensor of successive intersections of a plurality of points along the first and second dimensions that overlap the width of the weight kernel, and successively loading the one or more values along the third dimension of the first tensor to a first intersection of a first point along a first dimension of a second tensor and a first point along a second dimension of a second tensor.
[0256] Example 30 includes the apparatus of Example 29, further comprising padding circuitry: to determine whether external padding is applied to the first tensor based on the width of the weight kernel; and, in response to determining that external padding is applied, to load a first external pad before the first point along the first dimension of the first tensor at the first point along the second dimension of the first tensor; and to load a second external pad after a last point along the first dimension of the first tensor at the first point along the second dimension of the first tensor.
[0257] Example 31 includes the apparatus of example 29, wherein the storage control circuitry selects the first point along the second dimension of the first tensor, selects the first point along the first dimension of the first tensor at the first point along the second dimension of the first tensor to establish a first intersection of the first point along the first dimension of the first tensor and the first point along the second dimension of the first tensor, and, in response to determining that sufficient data of the first tensor to generate another column of the second tensor is outside the width of the weight kernel, selects a second point along the first dimension of the first tensor of the first point along the second dimension of the first tensor in accordance with a stride of the weight kernel.
[0258] Example 32 includes the apparatus of example 31, wherein the storage control circuitry is configured to, in response to determining that sufficient data of the first tensor to generate another row of the second tensor is outside a height of the weight kernel, select a second point along the second dimension of the first tensor in accordance with the stride of the weight kernel.
[0259] Example 33 includes the apparatus of example 29, wherein the first tensor is stored in a memory, the memory being at least one of 16-byte aligned or 32-byte aligned.
[0260] Example 34 includes the apparatus of example 29, wherein the first tensor corresponds to an input image to the NN.
[0261] Example 35 includes the apparatus of example 29, wherein the weight kernel is a first weight kernel, and the parameter determination circuit is configured to select a second weight kernel in response to determining that there are additional weight kernels to be processed.
[0262] Example 36 includes an apparatus for increasing utilization of neural network (NN) accelerator circuitry for shallow layers of an NN, the apparatus comprising: tensor and weight control circuitry for determining a stride of a weight kernel, determining a depth of a first tensor including one or more storage elements having one or more pointers, and replicating the weight kernel a first number of times to match a number of points of an output tensor that may be generated per XY position of a second tensor; sparsity generation circuitry for generating a second number of weight sparsity bitmaps equal to the first number, each weight sparsity bitmap including a sparsity pattern that is offset from a start of a respective weight sparsity bitmap by a product of a third number of the stride of the weight kernel and the depth of the first tensor; and pointer control circuitry for offsetting each successive of the pointers by a fractional stride offset to form the second tensor.
[0263] Example 37 includes the apparatus of example 36, wherein the sparsity generation circuitry, in response to determining that the interior padding is applied to the first tensor, separates Z values for each XY location of the first tensor by a number of interior pads.
[0264] Example 38 includes the apparatus of example 37, wherein each sparsity pattern is offset from the start of the respective weight sparsity bitmap by a product of the third number of strides of the weight kernel and the sum of the depth of the first tensor and the number of interior pads.
[0265] Example 39 includes the apparatus of example 37, wherein the pointer control circuitry determines the fractional stride offset based on the first number, the depth of the first tensor, the stride of the weight kernel, and the number of interior pads.
[0266] Example 40 includes the apparatus of example 37, wherein the sparsity generation circuit determines the number of interior pads by rounding a rounded value to a nearest multiple of four that returns a remainder zero when divided to a granularity of a storage element, and determines the number of interior pads by determining the number of interior pads as a difference between the rounded value and the depth of the first tensor.
[0267] Example 41 includes the apparatus of Example 36, further comprising padding control circuitry that determines whether external padding is applied to the first tensor based on a width of the weight kernel, and, in response to determining that external padding is applied, loads a first external pad before a first X position at a first Y position of the first tensor, and loads a second external pad after a last X position at the first Y position of the first tensor.
[0268] Example 42 includes the apparatus of example 36, wherein the weight kernel is a first weight kernel, and the tensor and weight control circuitry is configured to select a second weight kernel in response to determining that there are additional weight kernels to be processed.
[0269] Although certain exemplary systems, methods, apparatus and articles of manufacture have been disclosed herein, the scope of coverage of this patent is not limited thereto. On the contrary, this patent covers all systems, methods, apparatus and articles of manufacture fairly falling within the scope of the claims of this patent.
[0270] The following claims are hereby incorporated by reference into the Detailed Description, with each claim standing on its own as a separate embodiment of this disclosure.
Claims
1. 1. An apparatus for increasing utilization of a neural network (NN) accelerator circuit for shallow layers of a NN, comprising: an interface circuit for accessing the first tensor; and Processor Circuit Equipped with The processor circuit includes: at least one of a central processing unit, a graphics processor unit or a digital signal processor, said at least one of said central processing unit, said graphics processor unit or said digital signal processor including control circuitry for controlling data movement within said processor circuitry, arithmetic and logic circuitry for performing one or more first operations corresponding to instructions, and one or more registers for storing results of said one or more first operations and said instructions in said device; a field programmable gate array (FPGA), the FPGA including logic gate circuitry, a plurality of configurable interconnects, and a storage circuit, the logic gate circuitry and the interconnects performing one or more second operations, and the storage circuitry storing results of the one or more second operations; or an application specific integrated circuit (ASIC) including logic gate circuitry for performing one or more third operations; and The processor circuit performs at least one of the first operation, the second operation, or the third operation, A parameter determination circuit, determining the width of the weight kernel; and Determining the depth of the first tensor. and A memory control circuit, copying one or more Z values from a first XY location of the first tensor to the depth of the first tensor of successive XY locations that overlap the width of the weight kernel; and loading said one or more Z-values successively into a first XY location of a second tensor; Instantiate it to do Device.
2. The processor circuit of the apparatus performs at least one of the first operation, the second operation, or the third operation to configure a padding circuit: determining whether outer padding is applied to the first tensor based on the width of the weight kernel; In response to determining that outer padding is applied, loading a first external pad before a first X location at a first Y location of the first tensor; and loading a second external pad after the last X position at the first Y position of the first tensor; Instantiate it to do 2. The apparatus of claim 1.
3. The processor circuit executes at least one of the first operation, the second operation, or the third operation to configure the storage control circuit as: selecting a first Y position of the first tensor; selecting a first X position of the first tensor at the first Y position to set the first XY position; and selecting a second X location at the first Y location according to a stride of the weight kernel in response to determining that sufficient data of the first tensor exists outside the width of the weight kernel to generate another column of the second tensor. Instantiate it to do 2. The apparatus of claim 1.
4. the processor circuit performs at least one of the first operation, the second operation, or the third operation to instantiate the storage control circuitry to select a second Y position of the first tensor in accordance with the stride of the weight kernel in response to determining that sufficient data of the first tensor exists outside a height of the weight kernel to generate another row of the second tensor.
4. Apparatus according to any one of claims 1 to 3.
5. 2. The apparatus of claim 1, wherein the first tensor is stored in a memory, the memory being at least one of 16-byte aligned or 32-byte aligned.
6. The apparatus of claim 1 , wherein the first tensor corresponds to an input image to the NN.
7. 2. The apparatus of claim 1 , wherein the weight kernel is a first weight kernel, and the processor circuitry performs at least one of the first operation, the second operation, or the third operation to instantiate the parameter determination circuitry to select a second weight kernel in response to determining that there are additional weight kernels to be processed.
8. If executed, at least A procedure for determining the width of the weight kernel; determining a depth of a first tensor; copying one or more Z values from a first XY location of the first tensor to the depth of the first tensor of successive XY locations that overlap the width of the weight kernel; and loading said one or more Z-values successively into a first XY location of a second tensor. A computer-readable storage medium comprising instructions for causing a processor circuit to execute the following:
9. The instructions, when executed, determining whether external padding is applied to the first tensor based on the width of the weight kernel; In response to determining that outer padding is applied, loading a first external pad before a first X location at a first Y location of the first tensor; and loading a second external pad after the last X position at the first Y position of the first tensor; causing the processor circuit to execute The computer-readable storage medium of claim 8.
10. The instructions, when executed, selecting a first Y position of the first tensor; selecting a first X position of the first tensor at the first Y position to set the first XY position; and in response to determining that sufficient data of the first tensor exists outside the width of the weight kernel to generate another column of the second tensor, selecting a second X location at the first Y location according to a stride of the weight kernel. causing the processor circuit to execute The computer-readable storage medium of claim 8.
11. 11. The computer-readable storage medium of claim 8, wherein the instructions, when executed, cause the processor circuit to perform a procedure of: in response to determining that sufficient data of the first tensor exists outside a height of the weight kernel to generate another row of the second tensor, selecting a second Y position of the first tensor in accordance with the stride of the weight kernel.
12. 9. The computer-readable storage medium of claim 8, wherein the first tensor is stored in a memory, the memory being at least one of 16-byte aligned or 32-byte aligned.
13. The computer-readable storage medium of claim 8 , wherein the first tensor corresponds to an input image to a neural network.
14. 9. The computer-readable storage medium of claim 8, wherein the weight kernel is a first weight kernel, and the instructions, when executed, cause the processor circuit to perform a procedure of selecting a second weight kernel in response to a determination that there are additional weight kernels to be processed.
15. 1. An apparatus for increasing utilization of a neural network (NN) accelerator circuit for shallow layers of a NN, comprising: determining the width of the weight kernel; and Determining a depth of the first tensor; means for determining one or more parameters; copying one or more Z values from a first XY location of the first tensor to the depth of the first tensor of successive XY locations that overlap the width of the weight kernel; and loading said one or more Z-values successively into a first XY location of a second tensor; A method for controlling memory An apparatus comprising:
16. determining whether outer padding is applied to the first tensor based on the width of the weight kernel; In response to determining that outer padding is applied, loading a first external pad before a first X location at a first Y location of the first tensor; and loading a second external pad after the last X position at the first Y position of the first tensor; The apparatus of claim 15 , further comprising: means for padding the first bit of the first byte.
17. The means for controlling storage comprises: selecting a first Y position of the first tensor; selecting a first X position of the first tensor at the first Y position to set the first XY position; and selecting a second X location at the first Y location according to a stride of the weight kernel in response to determining that sufficient data of the first tensor exists outside the width of the weight kernel to generate another column of the second tensor. To carry out 16. The apparatus of claim 15.
18. 18. The apparatus of claim 15, wherein the means for controlling the storage is configured to, in response to determining that sufficient data of the first tensor to generate another row of the second tensor is outside a height of the weight kernel, select a second Y position of the first tensor in accordance with the stride of the weight kernel.
19. 16. The apparatus of claim 15, wherein the first tensor is stored in a memory, the memory being at least one of 16-byte aligned or 32-byte aligned.
20. The apparatus of claim 15 , wherein the first tensor corresponds to an input image to the NN.
21. 16. The apparatus of claim 15, wherein the weight kernel is a first weight kernel, and the means for determining the one or more parameters comprises selecting a second weight kernel in response to determining that there are additional weight kernels to be processed.
22. 1. A method for increasing utilization of a neural network (NN) accelerator circuit for shallow layers of a NN, comprising: determining a width of the weight kernel; determining a depth of the first tensor; copying one or more Z values from a first XY location of the first tensor to the depth of the first tensor of successive XY locations that overlap the width of the weight kernel; and loading said one or more Z values successively into a first XY location of a second tensor. A method comprising:
23. determining whether outer padding is applied to the first tensor based on the width of the weight kernel; In response to determining that outer padding is applied, loading a first external pad before a first X location at a first Y location of the first tensor; and loading a second external pad after the last X position at the first Y position of the first tensor; 23. The method of claim 22, further comprising:
24. selecting a first Y position of the first tensor; selecting a first X position of the first tensor at the first Y position to set the first XY position; and selecting a second X location at the first Y location according to a stride of the weight kernel in response to determining that sufficient data of the first tensor exists outside the width of the weight kernel to generate another column of the second tensor.
23. The method of claim 22, further comprising:
25. 25. The method of claim 22, further comprising: in response to determining that sufficient data of the first tensor to generate another row of the second tensor exists outside a height of the weight kernel, selecting a second Y position of the first tensor according to the stride of the weight kernel.
Citation Information
Patent Citations
Architecture for sparse neural network acceleration
US20180189056A1
