In-network and in-memory dual sparsity computing accelerator

The NoC-based accelerator addresses the inefficiencies in tensor computations by employing in-network and in-memory processing to optimize sparse tensor operations, achieving reduced latency and power consumption through parallel processing.

WO2026129275A1PCT designated stage Publication Date: 2026-06-25MOFFETT TECH CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
MOFFETT TECH CO LTD
Filing Date
2024-12-20
Publication Date
2026-06-25

Smart Images

  • Figure CN2024140848_25062026_PF_FP_ABST
    Figure CN2024140848_25062026_PF_FP_ABST
Patent Text Reader

Abstract

A Network-On-Chip (NoC) -based accelerator is disclosed for performing in-network and in-memory sparse tensor computations between an activation tensor and a weight tensor. The accelerator comprises a plurality of NoC nodes organized in a first two-dimensional (2D) network. Each NoC node includes a plurality of kernels organized in a second 2D network, and each kernel contains a plurality of cores organized in a third 2D network. The weight tensor is evenly distributed among the NoC nodes in the first 2D network. Within each NoC node, the kernels are configured to perform output-channel gathering on the weight tensor, while the cores within each kernel perform input-channel gathering. These gathering processes generate a condensed weight tensor that is evenly distributed among the NoC nodes. The activation tensor is broadcasted to the NoC nodes, enabling parallel sparse tensor computation using the evenly distributed and condensed weight tensor.
Need to check novelty before this filing date? Find Prior Art

Description

In-Network and In-Memory Dual Sparsity Computing AcceleratorTECHNICAL FIELD

[0001] The present invention pertains to the field of computer processors and machine learning, and more specifically to a network-on-chip (NoC) -based accelerator designed for performing dual-sparsity tensor computations.BACKGROUND

[0002] The rapid advancements in artificial intelligence (AI) and machine learning have led to an increasing reliance on tensor computations, particularly tensor multiplication, which serves as a cornerstone of neural network operations. These computations, central to deep learning models, demand a significant amount of computational power and memory bandwidth.

[0003] Tensor multiplication typically involves a multi-stage computational pipeline, where data must be transferred extensively between various stages. These data movements require a high number of interconnections within the hardware, leading to increased design complexity, latency, and power consumption. As AI accelerators grow in computational power, the magnitude of these challenges has intensified, creating bottlenecks that impede overall system performance.

[0004] To address the computational and memory demands of neural network processing, tensor sparsification has emerged as a common optimization technique. By reducing the number of non-zero elements or “effective” elements (i.e., the tensor data offering higher contribution during the computation) in tensors, sparsification significantly lowers both the volume of data and the number of required computations, thereby conserving memory and processing resources. Despite these advantages, sparse tensors require distinct computational patterns compared to dense tensors, posing unique challenges in hardware design.

[0005] Sparse computing routines, such as gather and matrix multiplication operations, are particularly data-intensive. In gather operations, data movement is necessary to extract the inputs for computation based on sparsity bit-masks. Similarly, matrix multiplication requires the broadcasting of input activations or weights and the reduction of output products using adder trees. These data movements contribute significantly to power consumption and performance latency.

[0006] To address these challenges, the present invention introduces a NoC-based circuit designed to accelerate sparse tensor computations by performing in-network and in-memory processing where both the activation tensor and the weight tensor exhibit sparsity. This approach minimizes the hardware footprint, reduces data movement during computations, and simplifies the wiring architecture while shortening wiring distances within the NoC-based circuit.SUMMARY

[0007] A system composed of one or more computers can be configured to perform specific operations or actions by installing software, firmware, hardware, or a combination of these elements. This configuration enables the system to carry out the designated actions. Similarly, computer programs can be designed to perform particular operations by including instructions that, when executed by data processing apparatus, prompt the apparatus to execute these actions.

[0008] In one general aspect, a network-on-chip (NoC) -based accelerator includes a plurality of NoC nodes organized in a first 2D network. Each NoC node contains a plurality of kernels arranged in a second 2D network, and each kernel further includes a plurality of cores organized in a third 2D network. The accelerator is designed to evenly distribute a weight tensor among the NoC nodes in the first 2D network. Within each NoC node, the kernels are configured to perform output-channel gathering on the weight tensor. Similarly, the cores within each kernel are configured to perform input-channel gathering on the weight tensor. The input-channel and output-channel gathering processes generate a condensed weight tensor, which is evenly distributed among the NoC nodes. The activation tensor is then broadcast to the NoC nodes to enable sparse tensor computation in parallel, using the evenly distributed and condensed weight tensor. Other embodiments of this aspect include corresponding computer systems, apparatus, and computer programs stored on one or more storage devices, each configured to perform the described methods.

[0009] Implementations may include one or more of the following features. A NoC-based accelerator may include kernels within each NoC node that consist of a single compute kernel and multiple data kernels. The compute kernel is equipped with both storage and computation resources, while the data kernels are configured with storage resources. A subset of cores within each kernel may serve as compute cores, located in the central region of the third 2D network, while the remaining cores function as data cores. The compute cores are configured with storage and computation resources, whereas the data cores have storage resources only.

[0010] The activation tensor may be sparse, represented as a condensed activation tensor and a bitmask. The condensed activation tensor stores only the effective activation features involved in the sparse tensor computation, and the bitmask provides positional information for these features. To evenly distribute the weight tensor among the NoC nodes, the weight tensor is divided along the output channel and evenly distributed across the kernels in the NoC nodes. The cores within each kernel perform input-channel gathering on the distributed weights based on a bitmask associated with the activation tensor, generating effective weights in the input channel for sparse tensor computation. These effective weights are stored in the compute cores located in the central region of the third 2D network.

[0011] The kernels also perform output-channel gathering using a bitmask associated with the activation tensor. This process generates effective weights in the output channel for sparse tensor computation, which are stored in the compute kernels. In some configurations, the kernels within each NoC node consist of a single compute kernel and multiple data kernels, while the cores within each kernel include compute cores and data cores. The condensed weight tensor is evenly distributed to the compute cores within the compute kernels, enabling the sparse tensor computation to be performed by the compute cores across the NoC nodes.

[0012] The NoC nodes may implement a flattened K-ary N-fly butterfly network for weight tensor gathering. Here, K and N are integers greater than one, where K represents the compression rate of the weight tensor gathering and N represents the number of stages in the butterfly network. Each NoC node may include a router, configured with different routing logic during the N stages. In the first stage of weight tensor gathering, the router functions as a K-to-K crossbar, while in the final stage, it operates as a K-to-1 multiplexer (MUX) . Each NoC node in the first 2D network may also include K-1 horizontal wires connecting nodes in the same row and K-1 vertical wires connecting nodes in the same column. The total number of horizontal wires in each row is a combination of C (K, 2) , e.g., C (4, 2) =6. The total number of vertical wires in each column is the same as the total number of horizontal wires in each row.

[0013] The NoC-based accelerator may consist of 16 NoC nodes arranged as a 4x4 first 2D network. Each NoC node may include four kernels arranged in a 2x2 second 2D network. Each kernel, in turn, may include 64 cores organized as an 8x8 third 2D network, with 16 compute cores located in a 4x4 central region of the network. To broadcast the activation tensor across the NoC nodes, the tensor is initially divided among the nodes, with each node receiving a portion. The nodes exchange their portions in multiple rounds until all nodes receive the complete activation tensor. These implementations may be realized as hardware, methods, processes, or computer tangible media.

[0014] In one general aspect, the method may include evenly distributing the weight tensor to the NoC-based accelerator, where the NoC-based accelerator may include: a plurality of NoC nodes organized in a first 2D network, each of the plurality of NoC nodes may include a plurality of kernels organized in a second 2D network, and each of the plurality of kernels may include a plurality of cores organized in a third 2D network. The method may also include performing, by the plurality of kernels in each NoC node, output-channel gathering on the weight tensor. The method may furthermore include performing, by the plurality of cores in each kernel, input-channel gathering on the weight tensor, where the input-channel gathering and the output-channel gathering generate a condensed weight tensor, and the condensed weight tensor is evenly distributed among the plurality of NoC nodes. The method may in addition include broadcasting the activation tensor to the plurality of NoC nodes to perform the sparse tensor computation in the plurality of NoC nodes with the evenly distributed and condensed weight tensor. Other embodiments of this aspect include corresponding computer systems, apparatus, and computer programs recorded on one or more computer storage devices, each configured to perform the actions of the methods.

[0015] These and other features of the systems, methods, and non-transitory computer-readable media disclosed herein, as well as the methods of operation and functions of the related elements of structure and the combination of parts and economies of manufacture, will become more apparent upon consideration of the following description and the appended claims with reference to the accompanying drawings, all of which form a part of this specification, wherein like reference numerals designate corresponding parts in the various figures. It is to be expressly understood, however, that the drawings are for purposes of illustration and description only and are not intended as a definition of the limits of the invention.BRIEF DESCRIPTION OF THE DRAWINGS

[0016] FIG. 1A illustrates an example dual-sparse tensor computation in neural networks.

[0017] FIG. 1B illustrates an example execution of a dual-sparse tensor computation on a sparse processing unit (SPU) , in accordance with various embodiments.

[0018] FIG. 2 illustrates an exemplary NoC-based accelerator for executing dual-sparse tensor computation in neural networks, in accordance with various embodiments.

[0019] FIG. 3 illustrates an exemplary butterfly network implemented as a gather circuit for tensor compression, in accordance with various embodiments.

[0020] FIG. 4 illustrates an exemplary routing scheme within the NoC-based accelerator by flattening the butterfly network, in accordance with various embodiments.

[0021] FIG. 5 illustrates an exemplary hardware routing scheme of the NoC-based accelerator, in accordance with various embodiments.

[0022] FIG. 6 illustrates an exemplary broadcasting process of the activation tensor in the NoC-based accelerator, in accordance with various embodiments.

[0023] FIG. 7 illustrate an example method performed by the NoC-based accelerator, in accordance with various embodiments. DETAIL DESCRIPTION OF THE EMBODIMENTS

[0024] Embodiments described herein provide an accelerator, an apparatus, and a method for accelerating dual-sparse tensor computation in neural networks using a multi-layer NoC-based accelerator.

[0025] A neural network computation involves the interaction between activation tensors and weight tensors to process and transform data through the network’s layers. Activation tensors represent the input data or the outputs from preceding layers, encapsulating multi-dimensional arrays of numerical values that carry essential information for tasks such as classification or prediction. Weight tensors contain the network’s learnable parameters, determining the strength and direction of connections between neurons. During computation, the weight tensor is applied to the activation tensor through operations like matrix multiplication or convolution, effectively aggregating and transforming the input data based on the learned weights. The continuous interplay between activation and weight tensors allows the neural network to learn from data, adjust its parameters during training, and make accurate predictions during inference.

[0026] These computations find practical applications across a broad range of fields. For instance, in computer vision, neural networks process images represented as activation tensors, using weight tensors to identify patterns, detect objects, and classify images with remarkable accuracy. In natural language processing, neural networks leverage these computations to analyze text, enabling tasks such as sentiment analysis, machine translation, and text generation. In recommendation systems, neural networks utilize the interaction of activation and weight tensors to predict user preferences and provide personalized suggestions based on past behaviors. Furthermore, these computations are integral to real-time applications such as autonomous vehicles, where neural networks process sensor data to make split-second decisions, and healthcare, where they assist in diagnosing medical conditions through image analysis or predictive modeling.

[0027] As mentioned in the background section, sparsification in neural networks involves reducing the number of elements in weight tensors or activation tensors, thereby lowering the computational burden and memory requirements. The sparsity of neural networks can be achieved through methods such as pruning, quantization, and regularization. For example, sparsification eliminates low-magnitude elements while retaining high-magnitude elements. These methods reduce the density of neural network tensors, leading to more efficient model execution.

[0028] The sparsity of neural networks can be achieved through techniques such as pruning, quantization, and regularization. These approaches reduce the density of neural network tensors, enabling more efficient model execution.

[0029] This disclosure uses distinct types of tensors to help describe the invention, such as dense tensors, sparse tensors, condensed tensors, and sparse uncondensed tensors.

[0030] A dense tensor refers to a tensor in its original size, characterized by the number of elements and the bit-depth (precision) of these elements as received from upstream or downstream processing engines. The dense tensor may include high-magnitude data and low-magnitude data. When a dense tensor contains a large number of zero-valued data, it is called a sparse tensor.

[0031] The sparse tensor may be represented and stored in different data formats using a combination of a condensed tensor, a bitmask, and optional quantization information. A condensed tensor represents a compressed version of a given tensor (containing only the “effective” tensor elements that will participate in and contribute to the tensor computation) , the bitmask maps the data in the condensed tensor with the original tensor (storing the position information of the “effective” tensor elements in the original sparse tensor) , and the optional quantization information includes quantization parameters used when generating the condensed tensor from the original tensor.

[0032] In a narrow-sense sparse representation, the sparse representation of a sparse tensor may include a condensed tensor and a bitmask. The condensed tensor only stores non-zero elements from a sparse tensor, and the bitmask uses binary values to indicate the original positions of the non-zero elements in the given tensor. The condensed tensor in combination of the bitmask can be used to restore the given tensor. The restoration may be necessary for certain tensor operations (e.g., max or average pooling) or hardware processing units.

[0033] In a more general-sense sparse representation, the sparse representation of a sparse tensor may include a condensed tensor and a bitmask. The condensed tensor stores high-magnitude elements in the original tensor (e.g., a dense tensor) . The bitmask uses multi-bits values to indicate not only the original positions of the high-magnitude elements in the original tensor, but also encoded value information of the low-magnitude elements in the original tensor. The “high-magnitude elements” refer to “effective” elements that exceed a value threshold, indicating significance of these elements for the tensor computation. The condensed tensor in combination of the multi-bit bitmask can be used to restore the given tensor.

[0034] In some embodiments, if quantization is performed when converting the given tensor into the corresponding condensed tensor, the quantization parameters (e.g., scale and bias) may be stored as part of the sparse representation in addition to the condensed tensor and the bitmask. While quantization reduces the data precision, the quantization parameters may be used to reverse (to some extent) the data precision when converting the condensed tensor back to its dense format.

[0035] In some scenarios, the dense tensor and the sparse uncondensed tensor share the same size and dimensions, while the condensed tensor has a smaller size. The bit-depth of the dense tensor is higher than that of the condensed tensor. The bit-depth of the sparse uncondensed tensor may remain the same as that of the dense tensor.

[0036] In today’s practical applications, the activation tensor in neural network computations is often sparsified (e.g., through pruning) and only a subset of the activation features (referred to as the “effective” activation features) will participate in the tensor computation (e.g., the convolution process in a Convolution Neural Network) . It means that, during the computation, the corresponding weight tensor, whether sparse or dense, needs to undergo a gather process to locate and collect the weights (referred to as the “effective” weights) that correspond to the “effective” activation features in the sparse activation tensor. Only these "effective" weights contribute to the tensor computation. This gathering process relies on the position information of the "effective" activation features, which is stored in bitmasks (e.g., as part of the sparse representation of the activation tensor) .

[0037] In practice, both the activation tensor and the weight tensor are typically divided into multiple 2D tensor slices for parallel processing. For simplicity, the following description focuses on individual 2D tensors, i.e., an "activation tensor" refers to a single 2D activation tensor slice, and a "weight tensor" refers to a single 2D weight tensor slice. A person skilled in the art would understand how to extend this 2D tensor process to multi-dimensional tensor computations by employing appropriate parallel processing schemes. For example, if the activation tensor consists of eight 2D slices, the process described for each 2D activation tensor slice can be replicated in parallel across all eight slices.

[0038] FIG. 1A illustrates an example dual-sparse tensor computation in neural networks.

[0039] In the 2D activation tensor of FIG. 1A, each row may be referred to as an activation token. It means that each activation token is a 1xC tensor with a width dimension of 1 (W=1) and the input-channel C (in the example of FIG. 1A, the input-channel is C=16) . Different activation tokens of the activation tensor may have different sparsity patterns. These sparsity patterns may be encoded in a bitmask of the activation tensor, and the gather process on the weight tensor will be based on the bitmask.

[0040] In the tensor computation, each activation token will multiply with the 2D weight tensor. As mentioned above, the activation token may be a condensed tensor, containing only the “effective” activation features for computation. Therefore, the 2D weight tensor may undergo a gather process to find and compress the corresponding “effective” weights into a condensed format. This gather process will occur at the input-channel C and the output-channel K of the weight tensor. Since the gather processes across the input-channel (in FIG. 1A, input-channel C is 16) are independent of each other, it creates an opportunity for parallel processing. Similarly, the gather processes across the output-channel (in FIG. 1A, output-channel K is 16) are independent, offering another opportunity for parallel processing.

[0041] After the gather process, the condensed weight tensor may have an input-channel C and an output-channel K. The input-channel C of the condensed weight tensor and the input-channel C of the activation token (also condensed) are the same. The product of the condensed weight tensor and activation token is the output activation, with a width W=1, and an output channel dimension the same as the output channel dimension of the condensed weight tensor.

[0042] In the specific example of FIG. 1A, the original weight tensor is a 64x64 2D tensor (denoted as C’=64, and K’=64) . After the gather process, it is compressed to a 16x16 (C=16, and K=16) tensor. The compression rate on both input-channel (C) and output-channel (K) is 4x. The output activation tensor is a 1x16 (W=1, and K=16) tensor token.

[0043] In this process, the 1x16 activation token (W=1, C=16) and each column of the condensed weight tensor (i.e., the 16x1 slice (C=16, K=1) ) will generate one tensor element in the output activation token. Since the computation on the columns of the condensed weight tensor are independent from each other, this provides yet another opportunity for parallel processing.

[0044] The goal of the hardware accelerator, described in subsequent sections, is to fully exploit these parallel processing opportunities. By maximizing hardware resource utilization and minimizing data movement, the accelerator aims to enhance performance while reducing energy consumption.

[0045] FIG. 1B illustrates an example execution of a dual-sparse tensor computation on a sparse processing unit (SPU) , in accordance with various embodiments. The SPU in FIG. 1B is an abstract representation of a hardware piece for fulfilling the parallel processing opportunities during the dual-sparse tensor computation explained in FIG. 1A.

[0046] Using the same example in FIG. 1A involving the computation between the 1x16 activation token (denoted as IA) and a 64x64 weight tensor (denoted as WGT) , the SPU is designed to perform (1) weight gathering on the input-channel (on C channels) and output-channel (on K channels) in parallel to generate the 16x16 condensed weight tensor, and (2) 16x16 Multiplication-Accumulation-Computation (MAC) operations per cycle, i.e., the computation between the 1x16 activation token and the 16x16 condensed weight tensor is complete in one cycle. To achieve this goal, the SPU may comprise a plurality of nodes (denoted as Network-on-Chip (NoC) nodes in FIG. 1B, more details in FIG. 2) to process each column of the “effective” weights in the condensed 16x16 weight tensor in parallel.

[0047] For instance, the SPU may include 16 of such NoC nodes to execute the computation in parallel, each NoC node generating one output tensor element (1x1, i.e., W=1, K=1) as a part of the output activation token (the final size is 1x16, i.e., W=1, K=16) . Within each NoC node, 16x1 MAC operations may be executed per cycle. In other words, each of the NoC node gathers 16x1 weight sub-tensor from the assigned weights and receives a copy of the 1x16 activation token, and generates the 1x1 output tensor element in one cycle.

[0048] FIG. 2 illustrates an exemplary NoC-based accelerator 200 for executing dual-sparse tensor computation in neural networks, in accordance with various embodiments. The hardware architecture of the NoC-based accelerator implements the functionalities of the abstract SPU illustrated in FIG. 1B.

[0049] As shown, the NoC-based accelerator 200 may include a plurality of NoC nodes 210 organized as a first 2D mesh network, each of the plurality of NoC nodes includes a plurality of kernels (e.g., K0, K16, K32, and K48 within the top-left NoC node in FIG. 1B) organized as a second 2D mesh network, and each of the plurality of kernel includes a plurality of cores (C0~C63 in FIG. 1B) organized as a third 2D mesh network.

[0050] Within each kernel, the cores are divided into two categories: compute cores 240 and data cores 250. The compute cores 240 are positioned in the central region of the third 2D mesh network, while the data cores 250 occupy the remaining locations. The compute cores 240 are equipped with both storage and computation resources, whereas the data cores 250 are configured solely with storage resources. This design enables all cores (both 240 and 250) to participate in the weight-gathering operation, which involves accessing memory, moving and storing the gathered weights into the compute cores 240. The compute cores 240 then exclusively perform the in-network and in-memory tensor computations using the weights gathered from the input channel.

[0051] Specifically, these computations involve MAC operations between the gathered weights from the input channel and the activation features. In the particular example depicted in FIG. 1B, the central 4x4 compute cores 240 (shaded cores) within the 8x8 2D mesh network yield a 4x compression rate, meaning that 16 "effective" weights are gathered from 64 weights in a given input channel.

[0052] While the compute cores 240 and data cores 250 handle the input-channel weight-gathering process, the output-channel weight-gathering process is performed at the second 2D mesh network level, managed by the kernels. Each NoC node 210 includes a single compute kernel 220 and multiple data kernels 230. The compute kernel 220 is equipped with both storage and computation resources, whereas the data kernels 230 are equipped only with storage resources. All data kernels 230 and compute kernels 220 can perform cache or memory access as part of the weight-gathering process, but only the compute kernels 220 are capable of performing MAC operations. At the end of the output-channel gathering process, all "effective" weights from the output channels are stored within the compute kernels 220, which subsequently execute the in-network and in-memory tensor computations.

[0053] For example, the weight tensor is divided along its output-channel (K dimension) into a plurality of weight subtensors, each weight subtensor includes a plurality of weights along the input-channel (C dimension) , and the plurality of weight subtensors are evenly distributed among the plurality of kernels in the plurality of NoC nodes 210. Each of the plurality of weight subtensors has its unique and independent weight sparsity pattern with respect to the activation tensor (according to the bitmask of the activation tensor) , and the gathering results (i.e., the “effective” weights gathered based on the bitmask of the activation tensor) from the weight subtensors are different.

[0054] In the example illustrated in FIG. 2, each NoC node 210 includes four kernels, and four weight subtensors may undergo the gather process in parallel using the four kernels. Among the total weight subtensors processed across all NoC nodes 210, one out of every four output-channel weight subtensors is identified as "effective" and incorporated into the condensed weight tensor. Thus, the ratio of compute kernels 220 within each NoC node 210 determines the compression rate of the output-channel weight gathering process.

[0055] In summary, after the weight tensor is evenly distributed across the NoC nodes 210 (e.g., each kernel receives a weight subtensor , which is further evenly distributed among the cores within the kernel) , the cores-including the compute cores 240 and the data cores 250-in each kernel are configured to perform input-channel weight gathering based on the bitmask of the activation tensor. On the other hands, the kernels-including the compute kernels 220 and the data kernels 230-in each NoC node 210 are configured to perform output-channel weight gathering based on the bitmask of the activation tensor. The gathered "effective" weights are evenly distributed among the compute cores 240 within the compute kernels 220. Meanwhile, the "effective" activation features from the activation tensor token are broadcast to these compute cores 240 within the compute kernels 220. These "effective" weights and activation features are then used to perform the in-network and in-memory computations in the accelerator 200 with maximum parallelism, completing the process in a single execution cycle.

[0056] FIG. 3 illustrates an exemplary butterfly network implemented as a gather circuit for tensor compression, in accordance with various embodiments. The butterfly network in FIG. 3 has a traditional butterfly topology, which is primarily used in the context of parallel computing and digital signal processing. Its name comes from the characteristic butterfly-like pattern of the connections between the nodes in the network. Each node here refers to a router or switch point where data is processed or routed. In some embodiments, it involves logic circuits, such as multiplexers (MUX) or demultiplexers (DEMUX) , that perform the selection and routing tasks. In the context of butterfly networks, the terms “K-ary” and “N-fly” describe specific architectural characteristics crucial for understanding how these networks are structured and perform in various computing environments.

[0057] The term “K-ary” refers to the arity, or radix, of the switches within the network, indicating the number of input and output ports each switch has. For example, in a 4-ary butterfly network, each switch is equipped with 4 input ports and 4 output ports. This configuration allows each switch to handle 4 separate data streams simultaneously, thereby enhancing the network’s capacity and parallelism. When using such a butterfly network for tensor gathering (compression) , the compression rate is K.

[0058] On the other hand, “N-fly” denotes the number of stages or levels in the butterfly network. Each stage consists of a set of switches that process and route data as it moves through the network. For instance, a 3-fly butterfly network features 3 stages, with data sequentially traversing each stage, where it is processed and forwarded by the corresponding switches.

[0059] In FIG. 3, the butterfly network is a 4-ary 3-fly butterfly network for weight gathering. The number of input nodes is 64 (receiving a sparse input with 64 weights) , and the number of output nodes is 16 (generating a dense output with 16 gathered weights) . Note that the actual number of nodes in the last output layer may be the same as the previous layers, but the “effective” or active output nodes are the 16 nodes.

[0060] The butterfly network in FIG. 3 shows the routing paths of weights during the gather process. For example, in the first two stages, each node in the first layer routes its output to four nodes in the second layer, reflecting the 4-ary structure. In the final stage, the outputs from four nodes in the second-to-last layer are combined and routed to a single output node in the last layer.

[0061] FIG. 4 illustrates an exemplary routing scheme within the NoC-based accelerator by flattening the butterfly network depict in FIG. 3, in accordance with various embodiments.

[0062] The routing of the NoC-based accelerator (e.g., the accelerator 200 in FIG. 2) implements the butterfly network of FIG. 3 to achieve the weight gathering functionalities. Instead of employing a brute-force, hardwired butterfly network with longer interconnects and higher power consumption, the NoC-based accelerator optimizes the design by flattening the network. Specifically, N neighboring nodes at each layer of the butterfly network are merged into a single node (represented as three layers of nodes 0–15 in FIG. 4) , and nodes on the same row are further merged into a single router (e.g., all three node 15s across the three layers are merged into one router) . This approach flattens a K-ary N-fly butterfly network with X nodes per layer into an array of X / K routers (the quotient of X and K) .

[0063] This configuration enables cross-node data movement to be internalized within each router, reducing interconnect length and power consumption. Since the data movements differ across the various stages of the butterfly network, the routers are equipped with stage-specific routing logic to handle the corresponding data movement patterns effectively.

[0064] As shown in FIG. 3, at all stages except the last, each node in a layer receives inputs from K nodes in the previous layer and distributes them to K nodes in the next layer. To implement this data movement, the routers in these stages are configured as K-to-K crossbars, supporting K inputs and K outputs.

[0065] In the final stage, each node receives inputs from K nodes in the previous layer, and these K nodes merge into a single node in the last layer, forming a K-to-1 gathering. Accordingly, the routers in the final stage are configured as K-to-1 multiplexers (MUX) , aligning with the butterfly network's last stage requirements.

[0066] Using the specific example of FIG. 4, the 4-ary 3-fly butterfly gather network comprises three stages of weight gathering, achieving a 4x compression rate (one out of every four weights is selected as an "effective" weight) . During the first two stages, the routers within the NoC nodes are configured as 4x4 crossbars. In the last stage, the routers are configured as 4: 1 MUX circuits to complete the weight-gathering process efficiently.

[0067] FIG. 5 illustrates an exemplary hardware routing scheme for the NoC-based accelerator, in accordance with various embodiments. The focus here is on the wiring architecture among the routers within the NoC nodes, designed to implement the cross-layer connections of the multi-stage butterfly network.

[0068] In some embodiments, the X / K routers of the NoC-based accelerate (X represents the number of input nodes, and K represents the K-ary of the butterfly network) are organized as a 2D mesh network. The network connections between the first and second layers in the butterfly network are configured as the horizontal connections among the X / K routers. The network connections between the second and third layers in the butterfly network are configured as the vertical connections among the X / K routers.

[0069] For instance, each of the plurality of NoC nodes in the accelerator has K-1 horizontal wires connecting to NoC nodes in a same row, and K-1 vertical wires connecting the NoC nodes in a same column. The “-1” is because one of the cross-layer connection becomes an internal wire within each router.

[0070] FIG. 6 illustrates an exemplary broadcasting process of the activation tensor in the NoC-based accelerator, in accordance with various embodiments. The figures above mainly focus on the gathering and distribution of the “effective” weights. As the other half of required data for tensor computation, the “effective” activations in each activation token need to be delivered to the NoC nodes of the accelerator as well. More specifically, these “effective” activations in the activation token need to be broadcasted to the NoC nodes such as each NoC node receives one complete copy of these “effective” activations, facilitating the parallel computation.

[0071] A straightforward approach would be to replicate the entire activation token multiple times and distribute the copies to the NoC nodes. However, this method is not memory efficient, as the replication before distribution typically occurs at a centralized location, such as a control circuit or master processor, imposing a significant memory burden on this single node.

[0072] A more efficient solution involves first distributing the activation token evenly across the NoC nodes, with each node receiving a unique subset of the "effective" activation features. The NoC nodes then perform in-network broadcasting of their respective subsets to other nodes. For instance, each NoC node broadcasts the received portion of the activation token and receives another portion of the activation token for multiple rounds, until each of the plurality of NoC nodes receives a full version of the activation token. As shown in FIG. 6, four rounds of in-network broadcasting will make each NoC node receive the complete copy of the activation token.

[0073] Since the replication of the “effective” activation features occur after the distribution, the memory burden is effectively distributed among the NoC nodes, avoiding overloading any single node. This decentralized approach not only optimizes memory usage but also reduces the latency and bottlenecks associated with centralized replication, resulting in a more balanced and efficient broadcasting process.

[0074] FIG. 7 illustrate an example method performed by the NoC-based accelerator, in accordance with various embodiments. In some implementations, one or more process blocks of FIG. 7 may be performed by a device.

[0075] As shown in FIG. 7, process 700 may include evenly distributing the weight tensor to the NoC-based accelerator, where the NoC-based accelerator may include: a plurality of NoC nodes organized in a first 2D network, each of the plurality of NoC nodes may include a plurality of kernels organized in a second 2D network, and each of the plurality of kernels may include a plurality of cores organized in a third 2D network (block 710) . For example, the device may evenly distribute the weight tensor to the NoC-based accelerator, where the NoC-based accelerator may include: a plurality of NoC nodes organized in a first 2D network, each of the plurality of NoC nodes may include a plurality of kernels organized in a second 2D network, and each of the plurality of kernels may include a plurality of cores organized in a third 2D network, as described above.

[0076] As also shown in FIG. 7, process 700 may include performing, by the plurality of kernels in each NoC node, output-channel gathering on the weight tensor (block 720) . For example, the device may perform, by the plurality of kernels in each NoC node, output-channel gathering on the weight tensor, as described above.

[0077] As further shown in FIG. 7, process 700 may include performing, by the plurality of cores in each kernel, input-channel gathering on the weight tensor, where the input-channel gathering and the output-channel gathering generate a condensed weight tensor, and the condensed weight tensor is evenly distributed among the plurality of NoC nodes (block 730) . For example, the device may perform, by the plurality of cores in each kernel, input-channel gathering on the weight tensor, where the input-channel gathering and the output-channel gathering generate a condensed weight tensor, and the condensed weight tensor is evenly distributed among the plurality of NoC nodes, as described above.

[0078] As also shown in FIG. 7, process 700 may include broadcasting the activation tensor to the plurality of NoC nodes to perform the sparse tensor computation in the plurality of NoC nodes with the evenly distributed and condensed weight tensor (block 740) . For example, the device may broadcast the activation tensor to the plurality of NoC nodes to perform the sparse tensor computation in the plurality of NoC nodes with the evenly distributed and condensed weight tensor, as described above.

[0079] Although FIG. 7 shows example blocks of process 700, in some implementations, process 700 may include additional blocks, fewer blocks, different blocks, or differently arranged blocks than those depicted in FIG. 7. Additionally, or alternatively, two or more of the blocks of process 700 may be performed in parallel.

[0080] Each of the processes, methods, and algorithms described in the preceding sections may be embodied in, and fully or partially automated by, code modules executed by one or more computer systems or computer processors comprising computer hardware. The processes and algorithms may be implemented partially or wholly in application-specific circuit.

[0081] When the functions disclosed herein are implemented in the form of software functional circuits and sold or used as independent products, they can be stored in a processor executable non-volatile computer-readable storage medium. Particular technical solutions disclosed herein (in whole or in part) or aspects that contributes to current technologies may be embodied in the form of a software product. The software product may be stored in a storage medium, comprising a number of instructions to cause a computing device (which may be a personal computer, a server, a network device, and the like) to execute all or some steps of the methods of the embodiments of the present application. The storage medium may comprise a flash drive, a portable hard drive, ROM, RAM, a magnetic disk, an optical disc, another medium operable to store program code, or any combination thereof.

[0082] Particular embodiments further provide a system comprising a processor and a non-transitory computer-readable storage medium storing instructions executable by the processor to cause the system to perform operations corresponding to steps in any method of the embodiments disclosed above. Particular embodiments further provide a non-transitory computer-readable storage medium configured with instructions executable by one or more processors to cause the one or more processors to perform operations corresponding to steps in any method of the embodiments disclosed above.

[0083] Embodiments disclosed herein may be implemented through a cloud platform, a server or a server group (hereinafter collectively the “service system” ) that interacts with a client. The client may be a terminal device, or a client registered by a user at a platform, wherein the terminal device may be a mobile terminal, a personal computer (PC) , and any device that may be installed with a platform application program.

[0084] The various features and processes described above may be used independently of one another or may be combined in various ways. All possible combinations and sub-combinations are intended to fall within the scope of this disclosure. In addition, certain method or process blocks may be omitted in some implementations. The methods and processes described herein are also not limited to any particular sequence, and the blocks or states relating thereto can be performed in other sequences that are appropriate. For example, described blocks or states may be performed in an order other than that specifically disclosed, or multiple blocks or states may be combined in a single block or state. The example blocks or states may be performed in serial, in parallel, or in some other manner. Blocks or states may be added to or removed from the disclosed example embodiments. The exemplary systems and components described herein may be configured differently than described. For example, elements may be added to, removed from, or rearranged compared to the disclosed example embodiments.

[0085] The various operations of exemplary methods described herein may be performed, at least partially, by an algorithm. The algorithm may be comprised in program codes or instructions stored in a memory (e.g., a non-transitory computer-readable storage medium described above) . Such algorithm may comprise a machine learning algorithm. In some embodiments, a machine learning algorithm may not explicitly program computers to perform a function but can learn from training samples to make a prediction model that performs the function.

[0086] The various operations of exemplary methods described herein may be performed, at least partially, by one or more processors that are temporarily configured (e.g., by software) or permanently configured to perform the relevant operations. Whether temporarily or permanently configured, such processors may constitute processor-implemented engines that operate to perform one or more operations or functions described herein.

[0087] Similarly, the methods described herein may be at least partially processor-implemented, with a particular processor or processors being an example of hardware. For example, at least some of the operations of a method may be performed by one or more processors or processor-implemented engines. Moreover, the one or more processors may also operate to support performance of the relevant operations in a “cloud computing” environment or as a “software as a service” (SaaS) . For example, at least some of the operations may be performed by a group of computers (as examples of machines including processors) , with these operations being accessible via a network (e.g., the Internet) and via one or more appropriate interfaces (e.g., an Application Program Interface (API) ) .

[0088] The performance of certain of the operations may be distributed among the processors, not only residing within a single machine, but deployed across a number of machines. In some example embodiments, the processors or processor-implemented engines may be located in a single geographic location (e.g., within a home environment, an office environment, or a server farm) . In other example embodiments, the processors or processor-implemented engines may be distributed across a number of geographic locations.

[0089] Throughout this specification, plural instances may implement components, operations, or structures described as a single instance. Although individual operations of one or more methods are illustrated and described as separate operations, one or more of the individual operations may be performed concurrently, and nothing requires that the operations be performed in the order illustrated. Structures and functionality presented as separate components in example configurations may be implemented as a combined structure or component. Similarly, structures and functionality presented as a single component may be implemented as separate components. These and other variations, modifications, additions, and improvements fall within the scope of the subject matter herein.

[0090] As used herein, “or” is inclusive and not exclusive, unless expressly indicated otherwise or indicated otherwise by context. Therefore, herein, “A, B, or C” means “A, B, A and B, A and C, B and C, or A, B, and C, ” unless expressly indicated otherwise or indicated otherwise by context. Moreover, “and” is both joint and several, unless expressly indicated otherwise or indicated otherwise by context. Therefore, herein, “A and B” means “A and B, jointly or severally, ” unless expressly indicated otherwise or indicated otherwise by context. Moreover, plural instances may be provided for resources, operations, or structures described herein as a single instance. Additionally, boundaries between various resources, operations, engines, and data stores are somewhat arbitrary, and particular operations are illustrated in a context of specific illustrative configurations. Other allocations of functionality are envisioned and may fall within a scope of various embodiments of the present disclosure. In general, structures and functionality presented as separate resources in the example configurations may be implemented as a combined structure or resource. Similarly, structures and functionality presented as a single resource may be implemented as separate resources. These and other variations, modifications, additions, and improvements fall within a scope of embodiments of the present disclosure as represented by the appended claims. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.

[0091] The term “include” or “comprise” is used to indicate the existence of the subsequently declared features, but it does not exclude the addition of other features. Conditional language, such as, among others, “can, ” “could, ” “might, ” or “may, ” unless specifically stated otherwise, or otherwise understood within the context as used, is generally intended to convey that certain embodiments include, while other embodiments do not include, certain features, elements and / or steps. Thus, such conditional language is not generally intended to imply that features, elements and / or steps are in any way required for one or more embodiments or that one or more embodiments necessarily include logic for deciding, with or without user input or prompting, whether these features, elements and / or steps are included or are to be performed in any particular embodiment.

[0092] Although an overview of the subject matter has been described with reference to specific example embodiments, various modifications and changes may be made to these embodiments without departing from the broader scope of embodiments of the present disclosure. Such embodiments of the subject matter may be referred to herein, individually or collectively, by the term “invention” merely for convenience and without intending to voluntarily limit the scope of this application to any single disclosure or concept if more than one is, in fact, disclosed.

[0093] The embodiments illustrated herein are described in sufficient detail to enable those skilled in the art to practice the teachings disclosed. Other embodiments may be used and derived therefrom, such that structural and logical substitutions and changes may be made without departing from the scope of this disclosure. The Detailed Description, therefore, is not to be taken in a limiting sense, and the scope of various embodiments is defined only by the appended claims, along with the full range of equivalents to which such claims are entitled.

Claims

1.A Network-On-Chip (NoC) -based accelerator for in-network and in-memory sparse tensor computation between an activation tensor and a weight tensor, comprising:a plurality of NoC nodes organized in a first 2D network,each of the plurality of NoC nodes comprising a plurality of kernels organized in a second 2D network,each of the plurality of kernels comprising a plurality of cores organized in a third 2D network,wherein:the weight tensor is evenly distributed among the plurality of NoC nodes in the first2D network,the plurality of kernels in each NoC node are configured to perform output-channel gathering on the weight tensor,the plurality of cores in each kernel are configured to perform input-channel gathering on the weight tensor,the input-channel gathering and the output-channel gathering generate a condensed weight tensor, and the condensed weight tensor is evenly distributed among the plurality of NoC nodes, andthe activation tensor is broadcasted to the plurality of NoC nodes to perform the sparse tensor computation in parallel with the evenly distributed and condensed weight tensor.2.The NoC-based accelerator of claim 1, wherein the plurality of kernels within each NoC node comprises a single compute kernel and a plurality of data kernels, and wherein the single compute kernel is configured with storage and computation resources, and the plurality of data kernels are configured with storage resources.3.The NoC-based accelerator of claim 1, wherein a subset of the plurality of cores within each kernel comprise compute cores, and remaining cores of the plurality of cores within the kernel comprise data cores, and wherein the compute cores are located in a central region of the third 2D network and configured with storage and computation resources, and the data cores are configured with storage resources.4.The NoC-based accelerator of claim 1, wherein the activation tensor is sparse and represented as a condensed activation tensor and a bitmask, and wherein the condensed activation tensor only stores effective activation features that participate in the sparse tensor computation, and the bitmask comprises position information of the effective activation features.5.The NoC-based accelerator of claim 1, wherein to evenly distribute the weight tensor among the plurality of NoC nodes, the weight tensor is divided along the output-channel into a plurality of weight subtensors, and the plurality of weight subtensors are evenly distributed among the plurality of kernels in the plurality of NoC nodes.6.The NoC-based accelerator of claim 5, wherein the plurality of cores within each kernel are configured to perform the input-channel gathering on the distributed weight subtensors based on a bitmask associated with activation tensor, the input-channel gathering generates effective weights in the input-channel that will participate in the sparse tensor computation with corresponding activation features.7.The NoC-based accelerator of claim 6, wherein the effective weights in the input-channel are stored in the compute cores located in a central region of the third 2D network.8.The NoC-based accelerator of claim 5, wherein the plurality of kernels are configured to perform the output-channel gathering based on a bitmask associated with activation tensor, the output-channel gathering generates effective weights in the output-channel that will participate in the sparse tensor computation with corresponding activation features.9.The NoC-based accelerator of claim 8, wherein the plurality of kernels within each NoC node comprises a single compute kernel and a plurality of data kernels, and the effective weights in the output-channel are stored in the compute kernels.10.The NoC-based accelerator of claim 1, wherein:the plurality of kernels within each NoC node comprises a single compute kernel, and remaining kernels within the NoC node are data kernels,the plurality of cores within each kernel comprise a group of compute cores, and remaining cores within the kernel are data cores,the condensed weight tensor is evenly distributed to the compute cores within the compute kernels of the plurality of NoC nodes, andthe sparse tensor computation is performed by the compute cores within the compute kernels of the plurality of NoC nodes.11.The NoC-based accelerator of claim 1, wherein the plurality of NoC nodes is configured to implement a flattened K-ary N-fly butterfly network to perform weight tensor gathering, and wherein K and N are integers greater than one, K represents a compression rate of the weight tensor gathering using the butterfly network, and N represents a number of stages in the butterfly network for the weight tensor gathering.12.The NoC-based accelerator of claim 11, wherein each of the plurality of NoC nodes comprises a router, and the router is configured with different routing logics during the N stages of the butterfly network.13.The NoC-based accelerator of claim 12, wherein the router in each of the plurality of NoC nodes is configured as a K-to-K crossbar during a first stage of the weight tensor gathering.14.The NoC-based accelerator of claim 12, wherein the router in each of the plurality of NoC nodes is configured as a K-to-1 Multiplexer (MUX) during a last stage of the weight tensor gathering.15.The NoC-based accelerator of claim 11, wherein each of the plurality of NoC nodes in the first 2D network comprises K-1 horizontal wires connecting to NoC nodes in a same row, and K-1 vertical wires connecting the NoC nodes in a same column.16.The NoC-based accelerator of claim 1, wherein the plurality of NoC nodes comprise 16 NoC nodes organized as a 4x4 first 2D network.17.The NoC-based accelerator of claim 1, wherein each of the plurality of NoC nodes comprises 4 kernels organized as a 2x2 second 2D network.18.The NoC-based accelerator of claim 1, wherein each of the plurality of kernels comprises 64 cores organized as an 8x8 third 2D network, and the 64 cores comprise 16 compute cores at a 4x4 central region of the 8x8 third 2D network.19.The NoC-based accelerator of claim 1, wherein to broadcast the activation tensor to the plurality of NoC nodes, the activation tensor is evenly distributed to the plurality of NoC nodes and each NoC node receives a portion of the activation tensor, and each NoC node broadcasts the received portion of the activation tensor and receives another portion of the activation tensor for multiple rounds, until each of the plurality of NoC nodes receives a full version of the activation tensor.20.A method performed by a Network-On-Chip (NoC) -based accelerator for in-network and in-memory sparse tensor computation between an activation tensor and a weight tensor, comprising:evenly distributing the weigh tensor to the NoC-based accelerator, wherein the NoC-based accelerator comprises:a plurality of NoC nodes organized in a first 2D network,each of the plurality of NoC nodes comprises a plurality of kernels organized in a second 2D network, andeach of the plurality of kernels comprises a plurality of cores organized in a third 2D network;performing, by the plurality of kernels in each NoC node, output-channel gathering on the weight tensor;performing, by the plurality of cores in each kernel, input-channel gathering on the weight tensor, wherein the input-channel gathering and the output-channel gathering generate a condensed weight tensor, and the condensed weight tensor is evenly distributed among the plurality of NoC nodes; andbroadcasting the activation tensor to the plurality of NoC nodes to perform the sparse tensor computation in the plurality of NoC nodes with the evenly distributed and condensed weight tensor.