Flattened 2d network for neural network sparsification
The 2D flattened butterfly network addresses the inefficiencies of traditional butterfly networks by simplifying wiring and reducing hardware complexity, enhancing flexibility and efficiency in neural network sparsification.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2026-04-02
AI Technical Summary
Traditional butterfly network circuits for neural network sparsification face challenges due to their complex wiring and hardwiring, which increase hardware complexity, power consumption, and maintenance costs while limiting flexibility in handling unstructured sparse patterns.
A 2D flattened butterfly network-based sparse codec is introduced, comprising a 2D flattened array of routers with simplified wiring, supporting both sparse encoding and decoding, which reduces hardware complexity and power requirements while maintaining efficient data routing.
The 2D flattened butterfly network design efficiently manages sparse data patterns, lowering power consumption and manufacturing costs while ensuring high throughput and flexibility for neural network operations.
Smart Images

Figure CN2024122216_02042026_PF_FP_ABST
Abstract
Description
FLATTENED 2D NETWORK FOR NEURAL NETWORK SPARSIFICATIONTECHNICAL FIELD
[0001] The present invention pertains to the field of neural networks and, more specifically, to a circuit design for implementing an efficient gather scatter network for neural network sparsification using a 2D flattened butterfly network.BACKGROUND
[0002] Neural networks are a fundamental part of modern Artificial Intelligence (AI) systems, driving progress in areas like computer vision, natural language processing, and autonomous systems. These networks involve numerous parameters (e.g., weights) and intermediate states (e.g., activations) , which demand significant computational and memory resources.
[0003] To tackle the challenges posed by the scale of neural networks, various sparsification techniques have been developed. Sparsification reduces the number of non-zero elements in weight and activation tensors, thereby decreasing computational and memory demands.
[0004] Sparse encoding and decoding are crucial for efficient neural network computation. Sparse encoding minimizes unnecessary computations and data transfers, enhancing execution efficiency. Sparse decoding, on the other hand, restores tensors to their dense format when needed for operations that require it, ensuring compatibility with standard neural network tasks and hardware that may not support sparse data. Together, these processes enable the benefits of sparsity while maintaining the necessary flexibility and accuracy.
[0005] In practice, the sparse encoding and sparse decoding logic may be implemented using multi-stage cascade butterfly networks. These networks are designed to extract non-zero or high-magnitude elements and route them based on associated bit masks. However, the inherent complexities of butterfly network circuits, which involve MUX (Multiplexer) and DEMUX (Demultiplexer) -based routing arrays, global and local wires spanning various distances, and varying directions, present significant challenges. These complexities scale with butterfly network parameters, such as stage number, radix value, and data path bit width, making it increasingly difficult to handle unstructured sparse patterns effectively while maintaining high throughput.
[0006] To address these challenges, there is a growing need for a new circuit design that can efficiently support both directions of sparsification with a simpler wiring design than traditional butterfly networks.SUMMARY
[0007] Various embodiments of the present specification may include processors and systems implementing a 2D flattened butterfly network-based sparse codec that supports both sparse encoding and sparse decoding. 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 circuit is introduced for implementing the SPU in neural network computation. The circuit may include a plurality of routers arranged as a 2D flattened array, each router in the 2D flattened array comprises: a routing network configured to route data between the router and other routers in the 2D flattened array, an input interface configured to receive data from a memory, and an output interface configured to output data to the memory wherein the 2D flattened array implements a logical butterfly network, and is configurable as: a gather circuit, operable to gather high-magnitude tensor data from a dense tensor into a condensed tensor, or a scatter circuit, operable to scatter tensor data from the condensed tensor into a sparse uncondensed tensor based on a given mask..
[0009] In some embodiments, the circuit is configured as a gather circuit to gather X high-magnitude tensor data from a given tensor comprising Y elements into a condensed tensor based on a given tensor mask, wherein X and Y are both integers, and X is a smaller than Y.
[0010] In some embodiments, the plurality of routers in the 2D flattened array comprises Y routers that are used to receive input data, and X routers out of the Y routers are used to output data, wherein: the input interfaces of the Y routers are configured to receive the Y elements of the dense tensor from the memory, and the output interfaces of the X routers are configured to output the selected X high-magnitude tensor data as the condensed tensor..
[0011] In some embodiments, the circuit is configured as scatter circuit that scatters a given condensed tensor with X high-magnitude tensor data into a dense tensor with Y positions, based on a given tensor mask. X and Y are both integers, and X is a smaller than Y.
[0012] In some embodiments, the plurality of routers in the 2D flattened array comprises Y routers that are used to output data, and X routers out of the Y routers are also used to receive input data, wherein: the input interfaces of the X routers are configured to receive the X high-magnitude tensor data of the condensed tensor from the memory; and the output interfaces of the Y routers are configured to distribute the X high-magnitude tensor data to a part of the Y positions of the sparse uncondensed tensor according to the given tensor mask, and fill remaining positions of the sparse uncondensed tensor with zeros.
[0013] In some embodiments, the logical butterfly network comprises K stages, each row of the logical butterfly network comprises K logical routers across the K stages, and the 2D flattened array flattens the K logical routers in each row of the logical butterfly network into a single router, wherein K is an integer greater than 1.
[0014] In some embodiments, the logical butterfly network comprises K stages, and the 2D flattened array is implemented as a circuit switch network, wherein K is an integer greater than 1.
[0015] In some embodiments, within a router in the 2D flattened array, the routing network comprises K bidirectional wired connections connecting the router to K other routers in the 2D flattened array.
[0016] In some embodiments, the K bidirectional wired connections comprise horizontal wired connections and vertical wired connections.
[0017] In some embodiments, the horizontal wired connections comprise bidirectional connections with lengths increasing in powers of 2, where the length of the nth connection is 2n hops, starting with a first connection having a length of 1 hop.
[0018] In some embodiments, the vertical wired connections comprise a series of bidirectional wired connections with lengths following a pattern of 2n, where n is an integer starting from 0, and a starting lengths is 1 hop.
[0019] In some embodiments, the horizontal wired connections correspond to a first stages of the K stages, and the vertical wired connections correspond to a second stages of the K stages.
[0020] In some embodiments, the routing network within the router comprises a plurality of Multiplexers (MUXs) .
[0021] In some embodiments, the 2D flattened array is implemented as a packet switch network with all single-hop directional wired connections.
[0022] In some embodiments, within a router in the 2D flattened array, the routing network comprises a plurality of single-hop bidirectional wired connections connecting to nearest neighboring routers in the 2D flattened array.
[0023] In some embodiments, the plurality of bidirectional wired connections have non-uniform bandwidths.
[0024] In some embodiments, within each router of the packet switch network, the routing network comprises a package buffer, and a plurality of Multiplexers (MUXs) .
[0025] In some embodiments, the plurality of Multiplexers (MUXs) , the input interface, and the output interface are connected to the package buffer.
[0026] In some embodiments, the memory is implemented as a first die, and the 2D flattened array is implemented as a second die.
[0027] In some embodiments, the first die is directly coupled to the second die forming a 3D architecture.
[0028] Other embodiments of this method may include corresponding computer systems, apparatus, and computer programs recorded on one or more storage devices, each configured to perform these methods.
[0029] 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
[0030] FIG. 1A illustrates an exemplary system diagram of a neural network processing unit.
[0031] FIG. 1B illustrates an example Processing Entity (PE) in the neural network processing unit.
[0032] FIG. 2A illustrates an example logic view of a sparse codec with a gather circuit and a scatter circuit, in accordance with various embodiments.
[0033] FIG. 2B illustrates an example system diagram of the sparse codec in a PE, in accordance with various embodiments.
[0034] FIG. 2C illustrates an example system diagram of an SPU in a PE that with gather circuits and scatter circuits, in accordance with various embodiments.
[0035] FIG. 3 illustrates a butterfly network, in accordance with various embodiments.
[0036] FIG. 4 illustrates a butterfly network as a gather circuit for sparse encoding, in accordance with various embodiments.
[0037] FIG. 5 illustrates a butterfly network as a scatter circuit for sparse decoding, in accordance with various embodiments.
[0038] FIGs. 6A-6D illustrate a first embodiment of a 2D flattened butterfly network for implementing the gather and scatter circuits, in accordance with various embodiments.
[0039] FIGs. 7A-7B illustrate a second embodiment of a 2D flattened butterfly network for implementing the gather and scatter circuits, in accordance with various embodiments.
[0040] FIG. 8 illustrate an example 3D hybrid architecture incorporating the 2D flattened butterfly network with memory dies, in accordance with various embodiments.
[0041] DETAIL DESCRIPTION OF THE EMBODIMENTS
[0042] Embodiments described herein provide methods, systems, apparatus for implementing a 2D flattened butterfly network-based tensor sparsification that supports both sparse encoding and sparse decoding in neural networks.
[0043] As mentioned in the background section, sparsification in neural networks involves reducing the number of non-zero 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. These methods reduce the density of neural network tensors, leading to more efficient model execution.
[0044] In certain applications, sparsification eliminates zero-valued elements while retaining non-zero elements. In other applications, sparsification removes low-magnitude elements and preserves high-magnitude elements (e.g., by applying a value threshold to differentiate between low-and high-magnitude elements) . For simplicity, the following description uses the zero / non-zero example. A person skilled in the art would be able to apply the described process to high-magnitude / low-magnitude scenarios.
[0045] This disclosure uses distinct types of tensors to help describe the invention, such as dense tensors, sparse tensors, condensed tensors, and sparse uncondensed tensors.
[0046] 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.
[0047] 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, the bitmask maps the data in the condensed tensor with the original tensor, and the quantization information includes quantization parameters used when generating the condensed tensor from the original tensor.
[0048] 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.
[0049] 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 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.
[0050] 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.
[0051] The sparse uncondensed tensor is an expanded version of the condensed tensor. Elements from the condensed tensor are scattered and distributed into this larger tensor, which contains more positions or “spots” than the condensed tensor. Since the elements from the condensed tensor occupy only a subset of these spots, the remaining positions are filled with zero-valued elements, rendering the uncondensed tensor sparse.
[0052] 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.
[0053] Additionally, the term “sparse representation” of a dense tensor used in this disclosure refers to a group of data generated through the sparsification of the dense tensor.
[0054] In neural networks sparsification, sparse encoding is a process to convert a dense tensor (either a weight tensor or an activation tensor) into a sparse representation. The sparse representation of the dense tensor may include a condensed tensor, a low-bit bitmask, and optional quantization parameters. This condensed tensor captures only the non-zero elements, significantly reducing the amount of data that needs to be processed or transmitted. The low-bit bitmask uses low bit-depth to represent the low magnitude elements. The optional quantization parameters include the parameters used during the quantization (if any) of the dense tensor, and will be used to restore the sparse representation back to the dense format (i.e., as a result of the sparse decoding) . Sparse encoding is particularly beneficial for improving computational efficiency and reducing memory usage in scenarios where the majority of the tensor elements are zeros.
[0055] However, the sparsification process introduces new challenges that must be addressed to fully exploit the benefits of sparse computing. Not all neural network operations or upstream hardware / accelerators are designed to handle sparse data natively. Many standard operations, such as max pooling and average pooling, as well as interactions with dense layers, require tensors in their original dense format. To address this need, sparse decoding is required. Sparse decoding is the reverse of sparse encoding; it reconstructs the dense tensor from its sparse representation by reintroducing the low-magnitude elements (e.g., zeros) at their appropriate positions. This step is crucial for ensuring compatibility with operations that expect dense input tensors and for maintaining the integrity of the computational process within the network.
[0056] Moreover, many existing hardware accelerators and software frameworks may lack native support for sparse operations, necessitating the use of sparse decoding to convert sparse tensors back to their dense forms. This ensures that the neural network can function correctly on a wide range of computing platforms. Additionally, the ability to restore the original dense structure of tensors is important for tasks such as model inspection, analysis, and further processing.
[0057] In the sparse encoding process, it is common practice to prune low-magnitude tensor data by marking those below a certain threshold as zeros. Traditional sparse encoders typically retain only the positions of the non-zero tensor data after pruning, completely discarding the information related to the pruned low-magnitude values in order to save spaces. However, this approach is insufficient when sparse decoding is required later in the pipeline. The goal of sparse decoding is to reconstruct the dense tensor as accurately as possible to its original form, making it crucial that the sparse encoding process does not simply abandon the pruned values. Instead, the sparse encoding process needs to not only retain a minimal memory footprint for these pruned values but also store enough information to allow the sparse decoding process to approximate the original dense tensor without significant loss of accuracy. This balance between reducing memory usage and preserving data integrity is essential for ensuring that the sparsification and subsequent de-sparsification processes do not degrade the performance of the neural network.
[0058] In practice, the key components in sparse encoding and decoding are implemented using a gather circuit (for sparse encoding) and a scatter circuit (for sparse decoding) , respectively. These circuits can be implemented using a butterfly network topology, which is particularly suitable for implementing sparse encoding and sparse decoding due to its inherent ability to efficiently manage data flows across multiple stages. The gather and scatter circuits may be deployed at different components within a PE. One of the main strengths of the butterfly network is its ability to handle irregularly distributed sparse patterns in a systematic manner. Sparse neural networks often contain irregular distributions of zero weights or activations, and a challenge arises in efficiently separating and processing the non-zero elements without wasting computational resources on the zeros.
[0059] The multi-stage design of the butterfly network enables it to progressively reduce and consolidate data as it passes through each stage. This is especially useful for sparse encoding, where non-zero elements must be gathered from a large, dense tensor to form a compact, i.e., a condensed representation. The butterfly network’s structured connectivity reduces the need for long-range data transfers by performing localized routing at each stage, leading to increased processing efficiency.
[0060] Moreover, in applications such as sparse transformers, where attention mechanisms often involve varied local attention spans across different heads, the butterfly network’s ability to adapt its routing dynamically becomes valuable. Different attention heads may require distinct data flows based on the sparsity pattern of the inputs, and the butterfly network’s flexible, multi-stage design can extract and route these non-uniform attention spans efficiently. This is critical in the context of sparse decoding, where non-zero elements must be distributed back into their original positions within a larger sparse matrix. The butterfly network can effectively handle this redistribution process by mapping condensed data back into its appropriate positions, guided by the bit masks that track the original sparse structure.
[0061] Generally speaking, butterfly network topology is used primarily 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 “x-nary” and “y-fly” describe specific architectural characteristics crucial for understanding how these networks are structured and perform in various computing environments.
[0062] The term “x-nary” 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.
[0063] On the other hand, “y-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.
[0064] The implications of these terms are significant for the network’s scalability, performance, and complexity. A higher arity (x) increases the number of concurrent data paths, enhancing the network’s ability to handle more traffic without congestion. Additionally, more stages (y) allow the network to connect a larger number of nodes, as each stage can exponentially increase the number of possible routes.
[0065] However, these advantages come with trade-offs. More stages can introduce additional latency, as data must pass through more switches. Conversely, higher arity can mitigate this latency by enabling more parallel data paths, thus increasing the overall bandwidth of the network. Nonetheless, higher arity requires more complex and potentially more expensive switches due to the increased number of ports. Similarly, more stages add to the physical and architectural complexity of the network, potentially increasing costs related to hardware and maintenance.
[0066] Strictly imprinting the butterfly network onto hardware to implement the gather and scatter circuits is inefficient due to the large number of nodes, complex wiring, and extensive interconnects required. In a typical butterfly network, each node is hardwired with multiple connections to adjacent nodes across several stages, leading to a significant increase in hardware complexity as the network grows. For instance, the number of wired connections scales rapidly, as does the total length of these connections, particularly for non-horizontal links that span increasingly larger distances (hops) between nodes. This complexity not only drives up material costs but also increases power consumption due to the longer interconnects and higher capacitance. Moreover, maintaining strict hardwiring limits the network’s flexibility, making it harder to optimize for different use cases, such as sparse encoding or decoding in neural network accelerators.
[0067] Accordingly, this disclosure further introduces an efficient alternative way to implement the gather and scatter circuits using a flattened butterfly network, which reduces the number of components and interconnect lengths, thereby lowering power requirements and manufacturing costs while maintaining the necessary network functionality.
[0068] FIG. 1A illustrates an exemplary system diagram of a neural network (NN) processing unit 100. The neural network processing unit 100 in FIG. 1A may refer to a neural network accelerator or an NPU, e.g., a specialized microprocessor designed to accelerate machine learning and artificial intelligence (AI) tasks. Unlike traditional CPUs (Central Processing Units) and GPUs (Graphics Processing Units) , accelerators or NPUs are optimized specifically for the neural network operations such as convolution computations and vector operations..
[0069] The NN processing unit 100 illustrated in FIG. 1A includes a plurality of Processing Entities (PEs) that are designed to provide maximum parallelism to accelerate neural network operations. These PEs are organized in a 2D mesh network and interconnected via a network of routers (denoted as “R” in FIG. 1A) . Additionally, the NN processing unit 100 incorporates double data rate (DDR) memory modules and caches, such as the last-level cache (LLC) , to support efficient data storage and retrieval. The NN processing unit 100 in FIG. 1A is merely illustrative, and may comprise more, fewer, or alternative components. The accelerator 100 may be designed as a reconfigurable device such as a field-programmable gate array (FPGA) , or an application-specific integrated circuit (ASIC) . The sparse codec introduced in this disclosure may be implemented in a PE.
[0070] In some embodiments, to optimize resource utilization and enhance the parallel processing capabilities of the NN processing unit 100, the PEs within the 2D mesh network may be divided into multiple sections, with each section referred to as a core. As illustrated in FIG. 1, every group of 16 PEs (arranged in a 4x4 grid) constitutes a core, resulting in a total of four cores across the 64 PEs in the NN processing unit 100. Each core is equipped with dedicated DDR memory, LLC, and control circuits, including a RISC-V Vector Unit (RVV) , responsible for vector processing, Core-Level Scheduler (CoLS) , which manages the execution and synchronization of multiple PEs, and an Instruction Dispatch Unit (IDU) , which allocates instructions to various execution units within the accelerator. This architecture enables all four cores 110 (i.e., the four PE groups) to operate concurrently, ensuring efficient parallel processing.
[0071] In some embodiments, these cores 110 are further organized into a Network-on-Chip (NoC) for inter-core communication. For instance, in FIG. 1A, the four groups of PEs are arranged as a ring NoC, facilitating seamless communication between cores and enhancing overall computational throughput. The ring NoC architecture includes a circular arrangement of cores 110, where data packets travel along a unidirectional or bidirectional ring, passing through each core 110 until they reach their destination. The ring NoC may be used for data communication between DDRs and PCIe or for PEs to read data from DDR belonging to other cores. In addition to the ring NoC, the PEs may be arranged as a 2D mesh NoC, managing the data communication between PEs.
[0072] Furthermore, the ring NoC architecture in FIG. 1A is scalable, allowing additional cores or PEs to be easily added to the ring without significantly increasing the complexity of the network. This flexibility supports the expansion of the NN processing unit to accommodate larger neural network models or additional computational tasks as needed.
[0073] The NN processing unit 100 illustrated in FIG. 1A may interact with an external (host) CPU through a peripheral component interconnect express (PCIe) . The NN processing unit 100 illustrated in FIG. 1A may further include an internal CPU to orchestra the cores with instructions, and a chip-level scheduler (ChLS) .
[0074] FIG. 1B illustrates an example Processing Entity (PE) 140 in the neural network processing unit. The PE 140 is an example of a PE within core 110 from FIG. 1A. The internal components of PE 140 depicted in FIG. 1B are for illustrative purposes, and the actual implementation may include additional, fewer, or alternative components depending on the specific design requirements.
[0075] In some embodiments, the PE 140 includes two NoC switches: a Data NoC Switch and a Cfg NoC Switch, both used to facilitate communication with other cores on the NoC. The Data NoC Switch is responsible for transmitting high-bandwidth data and instructions, ensuring efficient communication of tensor data and processing commands across the network. The Cfg NoC Switch is dedicated to handling configuration data, including parameters and setup information for the core and its functional modules. The wired connections to the Data NoC Switch are typically of higher bandwidth compared to those of the Cfg NoC Switch, reflecting the heavier data traffic load on the data path.
[0076] Additionally, PE 140 may include a scheduler that manages instruction issuance through an instruction interface, triggering various functional modules. These modules include the DMA (Direct Memory Access) module, which facilitates high-speed data transfer between memory and processing units without burdening the central processing core. The Sparse Processing Unit (SPU) performs tensor multiplication. The Vector Processing Unit (VPU) handles vectorized operations. The Activation Engine (AE) applies activation functions, including ReLU, sigmoid, or softmax, introducing non-linearity into the neural networks. The Transpose Engine (TE) performs tensor transposition, often required in matrix multiplications and other tasks that involve reordering data dimensions. Finally, the Sorting Engine (SE) is responsible for sorting tensor elements, particularly useful in identifying and isolating high-magnitude values for optimization and pruning in sparse computations. These functional modules efficiently access shared memory, allowing seamless data transfer and interaction between them to ensure smooth operation.
[0077] Furthermore, PE 140 incorporates a local RISC-V Vector (RVV) processing unit, such as a single-core RVV, which is optimized for executing vectorized instructions for neural network tasks. The RVV is coupled with TCM (Tightly Coupled Memory) , a high-speed, low-latency memory directly connected to the PE. This TCM allows the PE to store critical data and intermediate results for rapid access, minimizing latency and ensuring efficient execution of compute-intensive tasks such as matrix operations, convolutions, and tensor manipulations.
[0078] FIGs. 2A-2C illustrates the specific hardware components in the PE 140 that may involve the gather and scatter circuits, which may be implemented using the novel 2D flattened butterfly networks described later in this disclosure (e.g., FIGs. 6A-7B) .
[0079] FIG. 2A illustrates an example sparse codec 140 with a gather circuit and a scatter circuit, in accordance with various embodiments.
[0080] In some embodiments, the sparse codec 140 may be implemented inside the PE 140 illustrated in FIGs. 1A and 1B. More particularly, the sparse codec 140 may be implemented in the Sorting Engine (SE) in the PE 140 in FIG. 1B.
[0081] The sparse codec 140 may support both sparse encoding and sparse decoding, which are both essential in practice because they work together to optimize the efficiency of data storage, transmission, and processing, especially in large-scale applications like neural networks. Sparse encoding reduces the memory footprint and computational load by representing only the most significant data elements with high-precision, while compressing less critical data into a more efficient, low-precision format. This not only saves storage space but also speeds up data processing and reduces transmission latency. In practice, the sparsified tensor often needs to be restored to its dense format for several reasons. First, many neural network operations and algorithms are designed to work on dense tensors, requiring the full data structure to be present for correct functioning. Second, many hardware processing units or accelerators require the input tensor to be dense, thus the sparse representation needs to be restored (sparse decoded) to its original dense form to be compatible with these hardware apparatuses. Lastly, certain downstream tasks, such as visualization, analysis, or further processing, may require the dense format to ensure the full integrity and interpretability of the data.
[0082] In some embodiments, during the sparse encoding process 150 (denoted as Sparse Encode in FIG. 2A) , dense data 152, such as a dense weight tensor or an activation tensor (where “dense” refers to a tensor containing a mix of both high-magnitude values with greater absolute values and low-magnitude values with smaller absolute values) , is input into the sparse codec 140. The sparse codec 140 then generates a sparse representation 151 of the dense data 152. The sparse encoding process 150 prioritizes the retention of high-magnitude values due to their greater contribution to the computation accuracy of the neural network, while pruning less critical low-magnitude values to reduce memory footprint and computational cost.
[0083] In some embodiments, the sparse representation 151 of the dense data 152 may include condensed data 154 (e.g., a condensed sub-tensor) that gathers (aggregates) and compresses (e.g., through quantization) the high-magnitude values into a condensed tensor form. Quantizing the high-magnitude values in the condensed data 154 offers technical benefits by reducing the memory footprint and accelerating computation, as fewer bits are used to represent each value. The number of bits used to represent one tensor data is called bit-depth. For instance, each piece of tensor data in the original dense data 152 may use 32 bits, whereas each quantized tensor data in the condensed data 154 may use 8 bits. This way, the gathering operation may compress an original data of 64 bytes (assuming the dimension size of the tensor is 16, i.e., 16*32 bits is 64 bytes) to 16 bytes (16*8bits=16 bytes) , saving the memory footprint by 4 times. This leads to faster processing and lower power consumption, which are particularly advantageous in energy-constrained environments like mobile devices or embedded systems. Additionally, quantization decreases the bandwidth needed for data transfer, improving the efficiency of hardware utilization, especially in systems optimized for lower-precision operations.
[0084] In some embodiments, the sparse representation 151 of the dense data 152 may further include a sparse bitmask 155 that represents the positions of the high-magnitude tensor data within the original dense data 152, as well as quantized low-magnitude tensor data from the original dense data 152. This sparse bitmask 155 is necessary for restoring the sparse representation 151 of the original tensor 152 to its original dense format, as it specifies where to place the high-magnitude tensor data from the condensed data 154 and what the low-precision values should be reintroduced.
[0085] Traditional bitmasks typically use a single bit per entry to indicate a binary choice: whether a position contains a pruned or non-pruned value. However, to facilitate the subsequent sparse decoding process, the bitmask needs to convey more than just the binary information. In some embodiments, each entry in the sparse bitmask 155 may utilize two or more bits, with the first bit serving as a sign bit. This design allows each entry in the sparse bitmask 155 to not only differentiate between pruned and non-pruned values but also to specify a range of quantized tensor data. For example, using two bits per entry in the sparse bitmask 155 provides four possible states, with one state representing the presence of a high-magnitude tensor data, and each of the other three states representing a different value range for a low-magnitude tensor data. This design allows to use the same data format, i.e., the sparse bitmask 155, to assist in reconstructing a more accurate dense tensor.
[0086] Furthermore, the sparse representation 151 of the dense data 152 may include quantization parameters 156 (denoted as Quant Params in FIG. 2A) . These quantization parameters 156 are determined during the sparse encoding process 150 to quantize both the high-magnitude and low-magnitude tensor data in the dense data 152. Since the value ranges of high-magnitude and low-magnitude tensor data differ, two distinct sets of quantization parameters 156 may be generated respectively for each category. If the tensor data in the dense data 152 have been quantized (resulting in the condensed data 154 and the sparse bitmask 155) , these quantization parameters 156 may be included as part of the sparse representation 151 of the dense data 152 and subsequently utilized during the sparse decoding process. For instance, the quantization parameters 156 may be applied to a quantized high-magnitude value in the condensed data 154 to generate a dequantized value close to its original high-magnitude value in the dense data 152. As another example, the quantization parameters 156 may be applied to a multi-bit entry in the sparse bitmask 155 (representing a quantized low-magnitude value) to dequantize the value into a corresponding low-magnitude value range. The dequantized values may be scattered into a dense tensor according to the sparse bitmask 155 to conclude the sparse decoding process. More details about the multi-bits bitmasks 155 are described in FIG. 5C.
[0087] In summary, the sparse encoding process 150 transforms the dense data 152 into a sparse representation 151, including one or more of the condensed data 154 representing the high-magnitude tensor data in the dense data 152, the sparse bitmask 155 representing the low-magnitude tensor data in the dense data 152, and quant params 156 preparing for sparse decoding process. This sparse representation 151 significantly reduces the memory footprint required for storage and minimizes the latency associated with transmitting the data from one PE to another, compared to handling the dense data 152 directly.
[0088] The sparse decoding process serves as the reverse operation of the sparse encoding process 150. During sparse decoding, the inputs may include one or more of the condensed data 154, the sparse bitmask 155, and the optional quantization parameters 156 if quantization occurred (or collectively, the sparse representation 151) . At a high level, the sparse bitmask 155 is utilized to map the quantized high-magnitude values from the condensed data 154 back to their original positions within the dense data 152. If the sparse encoding process involves data quantization, the quantization parameters 156 play a crucial role in this decoding process by being used to dequantize the high-magnitude values in the condensed data 154 and the low-magnitude values in the sparse bitmask 155, thereby restoring these values as closely as possible to their original forms (e.g., precision and value) in the dense tensor. For instance, the multi-bit entries within the sparse bitmask 155, which represent the quantized low-precision values, are decoded back into their corresponding original high-precision values (with precision loss) . Although the quantization process inherently reduces the precision of the original tensor data, the use of quantization parameters 156 allows the tensor data in the sparse representation 151 of the dense data 152 to be restored with an acceptable level of precision loss compared to the original values. This bidirectional sparsification process supported by the sparse codec 140 ensures that the sparse representation 151, while more efficient, still maintains a high degree of accuracy relative to the original dense data. The number of bits in the sparse bitmask 155 is inversely related to the loss of precision of the sparse encoding and decoding process, i.e., a higher bit-depth in the sparse bitmask 155 reduces the precision loss of the sparse encoding and decoding process.
[0089] During the sparse encoding process 150, the high-magnitude tensor data from the dense data 152 may be gathered into a condensed tensor. This gathering process may be implemented as a gather circuit, which is configured to transform a tensor (either sparse or dense) into a condensed tensor based on the given tensor mask (e.g., by gathering the high-magnitude tensor data into the condensed tensor) . During the sparse decoding process, the high-magnitude tensor data in the condensed tensor need to be scatter back to their original positions in the dense data. This scattering process may be implemented as a scatter circuit, which is configured to transform the condensed tensor into a sparse uncondensed tensor based on a given bitmask by redistributing the high-magnitude tensor data to their original positions as indicated by the given bitmask, and filling the remaining positions with zero-valued elements. To complete the sparse decoding, the data in sparse uncondensed tensor may go through dequantization to restore the bit-depth of the dense tensor. The resultant tensor may be referred to as a restored dense tensor.
[0090] The presence of the gather circuit and the scatter circuit allows the sparse codec to perform sparse gather 160 and sparse scatter 170. During sparse gather 160, the uncondensed data 162 (e.g., a tensor with high-magnitude tensor data scattered at different positions) and a bitmask 163 (indicating the positions of the high-magnitude tensor data) may be received as input. The gather circuit in the sparse codec 140 may gather the high-magnitude tensor data in the uncondensed data 162 based on the bitmask 163 to generate the condensed data 164, which only contains the high-magnitude tensor data stored sequentially. In some embodiments, the bitmask 163 may be carried over as part of the output of the sparse gather 160, denoted as the bit mask 165. FIG. 5A illustrates an example sparse gather process in details.
[0091] During the sparse scatter 170 process, condensed data 164 and a bitmask 165 are received as inputs. The condensed data 164 contains only the high-magnitude tensor data that were retained after pruning the original dense tensor, while the bitmask 165 indicates the original positions of these high-magnitude values within the original dense tensor. The scatter circuit within the sparse codec 140 then redistributes the high-magnitude tensor data from the condensed data 164 back to their original positions in the tensor, guided by the bitmask 165. As a result, the scatter circuit generates an uncondensed data 162, which includes the high-magnitude tensor data restored to their original positions, with all other positions filled with zero tensor data. FIG. 5B illustrates an example sparse scatter process in details.
[0092] FIG. 2B illustrates an example system diagram of a PE incorporating a sparse codec module 250, in accordance with various embodiments.
[0093] For clarity, the PE in FIG. 2B is depicted using two primary modules: a control module 200 and a sparse codec module 250. In essence, the control module 200 is responsible for initializing, configuring, and managing data flow within the sparse codec module 250, while the sparse codec module 250 executes data processing tasks as directed by the control module 200.
[0094] In some embodiments, the control module 200 includes various components designed to manage and direct neural network computations. These components may include an instruction queue configured to receive computation instructions, such as memory addresses for input tensors, the type of computation to be performed, and the destination memory address for storing the output tensor. The control module 200 also comprises local (engine) registers, which serve as the interface for configuring the sparse codec module 250, and an instruction parser for interpreting the instructions within the instruction queue. Additionally, the control module 200 includes a read / write controller that is used to get necessary data flow read / write control information from control / status registers (CSR) or instructions, a pipeline instruction buffer that acts as a staging area for buffering instructions, local registers that materialize the configurations specified by the engine, and pipeline controller responsible for executing the instructions fetched from the pipeline instruction buffer.
[0095] In some embodiments, the sparse codec module 250 includes a plurality of hardware components and circuits to implement both the sparse encoding data path and the sparse decoding data path. These hardware components and circuits may include a shared memory 240, an input value buffer 252, a quant param (quantization parameter) circuit 251, an input mask buffer 253, a mask generation circuit 254 (denoted as Mask Gen in FIG. 2B) , an output mask buffer 256, an input quant buffer 255, an output quant buffer 257, a gather circuit 260, a scatter circuit 270, an output value buffer 258, and other circuits and multiplexers for implementing supporting functionalities.
[0096] The input value buffer 252 is configured to receive the input tensor from the shared memory 240 as the input for the sparse codec module 250. The input tensor may be in different formats for sparse encoding and sparse decoding.
[0097] For instance, the input tensor received by the input value buffer 252 for sparse encoding may include a dense tensor, which contains any combination of high-magnitude and low-magnitude tensor data. The goal of the sparse encoding is to generate (1) a condensed tensor that gathers the high-magnitude tensor data (with quantization) and (2) a lightweight bitmask representing the low-magnitude tensor data (with quantization) and the position information of the high-magnitude tensor data in the original dense tensor. In some embodiments, quantization is performed during the sparse encoding process, and the quantization parameters may be part of the output of the sparse encoding. The condensed tensor, the lightweight bitmask, and the quantization parameters may be collectively called the sparse representation of the input dense tensor.
[0098] The quant param circuit 251 is used in the sparse encode data path of the sparse codec to quantize the tensor data in the input tensor. In some embodiments, the quant param circuit 251 may include a sorting circuit (e.g., the odd-even merge sort in FIG. 2B, or another type of circuit for sorting the tensor data) to determine the quantization ranges, e.g., the max and min values for the low-magnitude tensor data and for the high-magnitude tensor data.
[0099] The quantization ranges are then used to determine the quantization bias and scale parameters. These quantization parameters are stored in the output quant buffer 257 as part of the sparse representation of the input tensor. These quantization parameters may be used to perform the quantization on the high-magnitude tensor data and the low-magnitude tensor data in the input tensor.
[0100] The mask generation circuit 254 may work with the quantization parameter circuit (specifically, the sorting circuit of the quantization parameter circuit) to generate a temporary bitmask indicating the positions of the high-magnitude tensor data in the input tensor. The temporary bitmask generated by the mask generation circuit 254 may be used by the gather circuit 260 to gather the quantized high-magnitude tensor data into a condensed tensor. The condensed tensor is a compact tensor containing only the quantized high-magnitude tensor data, which are stored in the output value buffer 258. The temporary bitmask may also be combined with the quantized low-magnitude tensor data to generate the sparse bitmask stored in the output mask buffer 256. The sparse bitmask includes (1) position information of the high-magnitude tensor data and (2) the quantized low-magnitude tensor data, each represented by two or more bits.
[0101] The sparse representation has a significantly smaller memory footprint than the dense tensor for several reasons. First, the condensed tensor contains quantized high-magnitude tensor data, which are represented with a reduced bit-depth (e.g., an original tensor data using 32 bits is compressed to 8 bits with a 4x compression rate) . Second, the lightweight bitmask may use only a few bits (two or more) to encode the position information of both the quantized high-magnitude tensor data and the quantized low-magnitude tensor data, further reducing the bit-depth required for each entry in the bitmask. In some embodiments, the bit-depth of the condensed tensor is greater than the bit-depth of the bitmask but smaller than the bit-depth of the original dense tensor. This approach balances the need to maintain a certain level of precision for high-magnitude data in the condensed tensor-ensuring accurate computation by using high-precision storage-while allowing the precision of low-magnitude data in the bitmask to be reduced, thereby saving additional memory (trading off precision for increased memory efficiency) . Consequently, the condensed tensor may be referred to as a high-precision (HP) tensor, while the bitmask may be referred to as a low-precision (LP) bitmask, reflecting their respective data precision levels.
[0102] For sparse decoding, the input to the sparse codec module 250 may include a condensed tensor, a lightweight bitmask, and quantization parameters from the shared memory 240. The output of the sparse decoding may include an approximation of the original dense tensor (e.g., the original dense tensor before passing through the sparse encoding process) . The condensed tensor may be received by the input value buffer 252, the lightweight bitmask (also called the sparse bitmask) may be received by the input mask buffer 253, and the quantization parameters may be received by the input quant buffer 255. The quantized high-magnitude tensor data in the condensed tensor may be dequantized using the quantization parameters to approximate their original values with controlled precision loss. The quantized low-magnitude tensor data in the lightweight bitmask may also be dequantized using the quantization parameters to approximate their original values with controlled precision loss. The dequantization of the tensor data may increase the bit-depth to represent each value. For instance, the dequantized high-magnitude tensor data and the dequantized low-magnitude tensor data may have the same bit-depth as that of the original dense tensor. Then, the scatter circuit 270 may redistribute the dequantized high-magnitude and low-magnitude values to their original positions as an uncondensed tensor based on the lightweight bitmask. The uncondensed tensor is the approximation of the original dense tensor. The uncondensed tensor may be stored in the output value buffer 258.
[0103] In some embodiments, the PE may further include a transmitter to transmit the sparse representation of the dense data (i.e., the output of the sparse encoding of the dense data) to another PE in the same PE array for neural network computation or sparse decoding, or to a Sparse Processing Unit (SPU) for neural network computation. Since the sparse representation of the dense data consumes data transmission bandwidth and uses smaller memory space, the data transmission and computation using the sparse representation of the dense data is less costly than directly use the dense data.
[0104] FIG. 2C illustrates an example system diagram of an SPU 271 in a PE with gather circuits and scatter circuits, in accordance with various embodiments. Similar to the sparse codec illustrated in FIGs. 2A and 2B, the SPU in the PE may also require gather and scatter circuits to perform sparse encoding and decoding.
[0105] Similar to the sparse codec in FIG. 2B, the SPU in FIG. 2C also includes a control module 260. The control module 260 may be implemented in the same manner as control module 200 in FIG. 2B, and therefore will not be repeated here.
[0106] The SPU 271 in FIG. 2C is configured to perform tensor computations for neural network tasks. In some embodiments, the SPU 271 includes a plurality of components implementing distinct functionalities. As shown in FIG. 2C, a shared memory 272 may be configured to store tensors, including the input tensors (also called source tensors) entering the computation workflow and output tensors resulted from the computation workflow.
[0107] In some embodiments, multiple source tensor L1 caches are configured to fetch source tensors from the shared memory 272 for computation. As depicted in FIG. 2C, the source tensor 0 L1 cache 273 (denoted as SRC Tensor 0 L1 Cache) and the SRC Tensor 1 L1 cache are designed to cache the activation tensor (e.g., input feature maps (IFMs) ) and the filters (weight tensors) , respectively. These source tensor caches are complemented by corresponding source tensor mask caches, such as the source mask 0 L1 cache 274 and the source mask 1 L1 cache, which are configured to store the tensor masks for dense input tensors.
[0108] In practice, source tensors may be stored in either dense or sparse formats. When a source tensor is in a dense format, the data-whether activations or weights-is stored contiguously in the shared memory 272 for easy access.
[0109] Conversely, when a source tensor is in a sparse format, its storage scheme in the shared memory 272 differs. For example, the non-zero (or high-magnitude) data values may be stored contiguously in shared memory 272 as a single data structure (i.e., as a condensed tensor) , while the location information of these non-zero values is stored separately as a corresponding tensor mask. In some embodiments, this tensor mask is implemented as a bitmask, using 0s and 1s to indicate the locations of the non-zero data. For instance, an 4x4 tensor containing 64-bit values would typically require 4096 bits of memory, while the bitmask would only need 64 bits to represent the location of the non-zero values in the tensor.
[0110] In some embodiments, the computation module 270 may further include a scatter circuit 275 and a gather circuit 276. The scatter circuit 275 is configured to receive a tensor in its condensed format and a tensor mask from the first tensor mask cache or the second tensor mask cache, and transform the condensed tensor to its sparse uncondensed format based on the tensor mask. In some embodiments, the sparse uncondensed tensor may be deemed as the restored dense tensor. In some embodiments, the sparse uncondensed tensor may go through a dequantization process (if quantization occurred during the gathering process) to form the restored dense tensor.
[0111] The gather circuit 276 is configured to receive a tensor and transform the tensor into a condensed tensor. Specifically, the gather circuit 276 identifies the “effective non-zero data” in the tensor based on a tensor mask in either an input dimension (e.g., by rows in a 2D tensor) or an output dimension (e.g., by columns in a 2D tensor) , and construct the condensed tensor containing these “effective non-zero data” in the tensor.
[0112] In some embodiments, the computation module 270 may further include a dual-scatter circuit 277 and a dual-gather circuit 278. The difference between the scatter circuit 275 and the dual-scatter circuit 277 is that the scatter circuit 275 performs the scattering operation based on a single tensor mask, whereas the dual-scatter circuit 277 works with two tensor masks at the same time. The same analogy applies to the gather circuit 276 and the dual-gather circuit 278.
[0113] The two tensor masks used in the dual-scatter circuit 277 and the dual-gather circuit 278 may include one native tensor mask (e.g., the mask comes with the condensed tensor) and a predicted tensor mask (also called destination vector mask) . In some cases, the predicted tensor mask represents the locations of non-zero data values in the expected output tensor. In some cases, the predicted tensor mask is determined based on the sparsity pattern in the output channel of the input tensors.
[0114] In FIG. 2C, the computation module 270 may include an additional scatter circuit 280 such that the two input tensors may have their dedicate scatter circuit 280, allowing the scattering operations to be carried out in parallel. In some embodiments, the scatter circuit 275 and the scatter circuit 280 may refer to the same circuit.
[0115] In some embodiments, the computation module 270 may further include the hardware circuits for carrying out the actual computation, including the multiplier array 279, an adder tree 282 (corresponding to the Adder Tree 230 as shown in FIG. 2) , a scaling multiplier, a scaling factor L1 cache, and an accumulation L1 cache 284 for caching the intermediate tensors generated during the computation as well as the final output tensor.
[0116] The inclusion of the scatter circuit 275 and gather circuit 276, along with the potential dual-scatter circuit 277 and dual-gather circuit 278, enables the computation module 270 to handle input tensors with varying levels of sparsity and storage formats. These circuits also facilitate the generation of output tensors in specific formats tailored to subsequent operations, such as computations in the next layer of a neural network or as input tensors for another computation engine that requires a particular format.
[0117] By applying various combinations of these gather and scatter circuits to both the input and output tensors, the SPU depicted in FIG. 2C is capable of interfacing seamlessly with any upstream and downstream engines, effectively managing dense and sparse representations of tensors. This capability is further illustrated in FIG. 3B, where the tensor computation processor 360 is shown to accept any combination of input tensors from upstream engines 350 and generate output specified by downstream engines 380. This compatibility is made possible by the inclusion of these essential circuits, such as the scatter circuit 275, gather circuit 276, and potentially the dual-scatter circuit 277 and dual-gather circuit 278.
[0118] FIG. 3 illustrates an example butterfly network 300 for implementing the gather and scatter circuits in a sparse neural network computing accelerator, in accordance with various embodiments.
[0119] The example butterfly network 300 in FIG. 3 is a 2-nary 6-fly butterfly network with 64-point. It has 64 nodes in each of the 7 layers, and the 64 nodes in the first layer are the input nodes to the network 300, and the 64 nodes in the last layer are the output nodes of the network 300.
[0120] There are several noticeable characteristics of the 2-nary 6-fly butterfly network 300 illustrated in FIG 3: (1) each node (switch or router) is equipped with 2 input ports and 2 output ports, (2) the nodes in the same row across the plurality (six) of stages have horizontal wired connections, (3) the non-horizontal wired connection in the ithstage (i.e., from one node at ith layer to another node at i+1thlayer) has an increasing wire distance.
[0121] For instance, the highlighted non-horizontal wired connections in FIG. 3 starts from 1-hop at stage 1, 2-hop at stage 2, 4-hop at stage 3, 8-hop at stage 4, 16-hop at stage 5, to 32- hop at stage 6. This pattern can be generalized as: the wired connection at stage k is 2k-hop, where k is an integer starting from 0, 1, 2, …The number of hops of the wired connection represents the length of the wire between two nodes (switches) at the corresponding stage.
[0122] If the topology of the butterfly network 300 is strictly hardwired or hardcoded in a hardware, there will be multiple layers of nodes, and each node has multiple wired connections to nodes in the adjacent layer. For a x-nary y-fly butterfly network with 64 nodes in each layer, such strict hardwired architecture will have 64*x nodes in total, and each node will have x ports, and the total number of hops of all the connections may be calculated using the following information:
[0123] Stage 1: 64 nodes, each node has x number of 1-hop connections, thus the total number of hops is 64*x;
[0124] …
[0125] Stage k: 64 nodes, each node has x number of 2k-hop connections, thus the total number of hops is 64*x*2k, where k is an integer between 1 and y (e.g., 1<k<y) .
[0126] Therefore, the total number of hops of all the connections in the strict hardwired architecture is 64*x* which is 64*x* (2y-1) , where y is the number of stages in the butterfly network.
[0127] FIG. 4 illustrates an example butterfly network implemented as a gather circuit 400, in accordance with various embodiments.
[0128] The gather circuit 400 is designed to gather high-magnitude tensor data from a given tensor, and write into a condensed tensor as an output. The gathering of the high-magnitude tensor data may be based on a bitmask. The bitmask indicates the positions of the high-magnitude or non-zero elements in the tensor. The bitmask may be received from another engine or computed using a sorting circuit. For instance, the sorting circuit sorts the elements, and a processor is configured to identify the elements greater than a value threshold.
[0129] The gather circuit 400 may be implemented using the butterfly network 300 illustrated in FIG. 3. Since the number of output values of the gather circuit 400 is smaller than the number of input values, only part of the last few layers of the butterfly network 300 will be used as the output nodes.
[0130] For instance, FIG. 4 illustrates the gather circuit 400 using the 2-nary 6-fly butterfly network. The gather circuit is designed to achieve 4x compression rate, e.g., compressing a given tensor with 64 elements into a condensed tensor with 16 elements. In this network, all the 64 nodes in the first layer are used as the input nodes, and only 16 nodes of the last layer are used the output nodes.
[0131] FIG. 5 illustrates a butterfly network as a scatter circuit, in accordance with various embodiments.
[0132] The scatter circuit 500 is designed to scatter high-magnitude tensor data from a given condensed tensor, and write into a sparse uncondensed tensor as an output. The scattering of the high-magnitude tensor data may be based on a bitmask.
[0133] The scatter circuit 500 may be implemented using the butterfly network 300 illustrated in FIG. 3. Since the number of input values of the scatter circuit 500 is smaller than the number of output values, only part of the first few layers of the butterfly network 300 will be used as the input nodes.
[0134] For instance, FIG. 5 illustrates the scatter circuit 500 using the 2-nary 6-fly butterfly network. The scatter circuit 500 is designed to achieve 4x sparsification rate, e.g., scattering a given tensor with 16 high-magnitude elements into a sparse uncondensed tensor with 64 elements. Among the 64 elements in the sparse uncondensed tensor, only 16 elements are from the input condensed tensor, the remaining elements may be filled with zero-valued elements. In this network, only 16 nodes of the first layer are used the input nodes, and all the 64 nodes in the last layer are used as the output nodes.
[0135] Both the gather circuit 400 and the scatter circuit 500 illustrated in FIG. 4 and FIG. 5 utilize overlapping but distinct portions of the butterfly network 300. In practice, the gather circuit 400 and the scatter circuit 500 are typically implemented on the same hardware to minimize costs. A straightforward approach is to use the full butterfly network 300 to implement both the gather circuit 400 and the scatter circuit 500, with an instruction decoder or switch dynamically configuring the butterfly network 300 to function as either the gather circuit 400 or the scatter circuit 500, depending on the specific use case.
[0136] However, as illustrated in FIG. 3, hardwiring the entire butterfly network 300 involves a large number of nodes and complex, costly wiring. The following description introduces an improved hardware implementation of the butterfly network 300, aimed at reducing the overall number of hardware components and associated costs.
[0137] FIGs. 6A-6D illustrate a first embodiment of a 2D flattened butterfly network for implementing the gather and scatter circuits, in accordance with various embodiments.
[0138] FIG. 6A illustrates a 2D flattened butterfly network 600 that corresponds to the 2-nary 6-fly butterfly network 300 with 64 nodes in each layer, as shown in FIG. 3. The 2D flattened butterfly network is implemented as a circuit-switched network, where a dedicated communication path is established between two nodes for the duration of their connection. In this context, each node can represent either a router or a switch.
[0139] The 2D flattened butterfly network 600 simplifies the multi-stage butterfly network 300 by “flattening” its stages into a single one. In the original multi-stage butterfly network 300, multiple routers are arranged in rows across different stages. The 2D flattened butterfly network combines all routers in the same row across these stages into a single router.
[0140] Another improvement in the 2D flattened butterfly network 600 is that its wired connections are bidirectional, unlike the unidirectional connections used in the original butterfly network 300. This bidirectional nature enhances communication flexibility between nodes.
[0141] Each node in the 2D flattened butterfly network 600 is equipped with 6 ports, which are used to implement the 6 non-horizontal wired connections corresponding to the 6 stages of the original butterfly network 300. This allows the network to maintain the same connectivity as the original multi-stage design while reducing complexity.
[0142] For illustrative purposes, the last node in the 2D flattened butterfly network 600 is taken out as an example to show the 6 wired connections. Among the 6 wired connections, 3 of them are horizontal connections in the 2D flattened butterfly network 600, and the other 3 of them are vertical connections in the 2D flattened butterfly network 600. Note that the horizontal connections in the 2D flattened butterfly network 600 are not the logical “horizontal connections” in each row of the butterfly network 300. The lengths (number of hops) of the horizontal connections and the vertical connections are in the pattern of 20,21, 22.
[0143] For clarity, FIG. 6B uses a smaller butterfly network 610 to illustrates how the 2D flattened butterfly network 620 is wired. The butterfly network 610 is 2-nary 3-fly with 12 nodes. The connections in the 3 stages of the butterfly network 610 are unidirectional links (i.e., data can only be transmitted in one direction) .
[0144] The nodes (routers) in each row of the butterfly network 610 are then combined or flattened into one router in the 2D flattened butterfly network 620. As shown, the routers R0, R1, R2 in the first row of the butterfly network 610 are flattened into the single node R0’ in the 2D flattened butterfly network 620. Following the same pattern, the three stages of the butterfly network 610 are flattened into one layer, and the number of nodes are reduced from 12 into 4.
[0145] Comparison between the butterfly network 610 and the 2D flattened butterfly network 620 reveals the technical improvements of the flattened design.
[0146] Number of wired connections:
[0147] In the butterfly network 610, the total number of horizontal connections in each row across the multiple stages is 4*2=8 (referring to the logical horizontal connections in each row of the network) , and the total number of non-horizontal connections is 4*2=8. The total number of connections is 16.
[0148] In the 2D flattened butterfly network 620, the horizontal connections across the multiple stages are eliminated and become each router’s internal connections. The total number of non-horizontal connections is 2 connections for each of the 4 nodes, which results in 8 connections.
[0149] Therefore, the 2D flattened butterfly network 620 uses 8 bidirectional wires, whereas the butterfly network 610 needs 16 unidirectional connections.
[0150] Length of wired connections:
[0151] For simplicity, the length of a wired connection is calculated in hops. A single-hop or 1-hop connection means a connection between neighboring nodes, a 2-hop connection means a connection skipping one node.
[0152] In the butterfly network 610, each of the horizontal connections is 1-hop connection, so the total number of hops is 4*2*1=8 hops. The non-horizontal connections in the first stage each has a length of 20, which results in 4*20=4 hops. The non-horizontal connections in the second stage each has a length of 21, which results in 4*21=8 hops. The total number of hops of the connections in the butterfly network 610 is 8+4+8=20 hops.
[0153] In the 2D flattened butterfly network 620, the non-horizontal connections in the first stage from the butterfly network 610 are consolidated into two 1-hop connections, and the non-horizontal connections in the second stage from the butterfly network 610 are consolidated into two 2-hop connections. Therefore, the total number of hops of the connections in the 2D flattened butterfly network 620 is 6 hops.
[0154] As shown, the 2D flattened butterfly network 620 simplifies the overall architecture and reduces the wiring complexity.
[0155] Based on the specific examples in FIGs. 6A and 6B, the technical improvement of 2D flattened butterfly network can be generalized for a given x-nary y-fly butterfly network with K nodes.
[0156] First, the number of nodes in the 2D flattened butterfly network is K, instead of K*y in the original butterfly network.
[0157] Second, the number of wired connections is K*y in the 2D flattened butterfly network, instead of K*y*x in the original butterfly network.
[0158] Third, the total length (in terms of number of hops) of the wired connections in the 2D flattened butterfly network may be determined from the following analysis. Each of the K nodes in the 2D flattened butterfly network will have horizontal connections (here, the “horizontal” refers to the connection direction in the 2D array of routers in the flattened butterfly network) and vertical connections.
[0159] The horizontal wired connections of each node in the 2D flattened butterfly network includes bidirectional connections with lengths increasing in powers of 2 (with the basic unit of hops) , where the length of the nth connection is 2n hops, starting with a first connection having a length of 1 hop. The total number of hops of all horizontal connections for each node in the 2D flattened butterfly network follows the pattern of where y is the number of stages of the pre-flattened butterfly network.
[0160] Therefore, the total number of hops of the horizontal connections of all K nodes in the 2D flattened butterfly network follows the pattern of K where K is the number of nodes in the 2D flattened butterfly network, and y is the number of stages of the pre-flattened butterfly network. The formula K may be simplied as K* (2y / 2-1) .
[0161] In comparison, the total number of hops of all the non-horizontal connections in the pre-flattened butterfly network (see example in FIG. 3 and the corresponding analysis) is K*x* (2y-1) . It means the total length of the bidirectional connections in the 2D flattened butterfly network is of the total length of the unidirectional connections in the pre-flattened butterfly network, which can be simplied to Since in butterfly networks, x and y are both integers that are likely greater than 2, the total length of the bidirectional connections in the 2D flattened butterfly network is significantly smaller than the total length of the unidirectional connections in the pre-flattened butterfly network.
[0162] The reduced interconnect length in the 2D flattened butterfly network decreases the power required for data transfers, as shorter pathways result in lower capacitance and resistance. This leads to lower energy dissipation during memory access, making the system more power efficient. In contrast, a brutal-force hardwired butterfly network (without flattening) with longer interconnects would require more power to drive signals across the chip, especially at high data rates.
[0163] FIG. 6C illustrates an example internal structure of an example node in the 2D flattened butterfly network from FIG. 6A. The node may refer to a router or a switch, which includes at least a routing network configured to route data between the router and other routers in the 2D flattened butterfly network, an input interface configured to receive data from a shared memory, and an output interface configured to output data to the shared memory.
[0164] The example node illustrated in FIG. 6C corresponds to node 10 from the 2D flattened butterfly network 600 in FIG. 6A, which is obtained by flattening the 10th row of nodes (6 nodes) in the pre-flattened butterfly network. In the 2D flattened butterfly network 600 in FIG. 6A, node 10 is horizontally connected to nodes 8, 11, and 14, and vertically connected to nodes 2, 26, and 42.
[0165] Internally, node 10 may include six multiplexers (MUXs) respectively connected to nodes 8, 11, 14 (horizontally) , and 2, 26, and 42 (vertically) . In some embodiments, the six MUXs are sequentially connected, and each MUX includes two input ports and one output port. Each MUX is used to select input data from either its neighboring node or its previous butterfly stage (using the two input ports) and sends output its next butterfly stage (using the output port) . The output of each MUX (i.e., the selection from the two inputs) may be deemed as an internal state of the node 10. There are seven states in node 10, in which the first state corresponds to the receipt of the input tensor data from the shared memory, and the last state corresponds to the output tensor data to the shared memory.
[0166] The example illustrated in FIG. 6C may be generalized to a 2D flattened butterfly network representing a x-nary y-fly butterfly network. Each node in this 2D flattened butterfly network includes y MUXs (corresponding to the y-fly parameter) , with half MUXs corresponding to the horizontal connections between the node and other nodes in the same row of the 2D flattened butterfly network, and the other half MUXs corresponding to the vertical connections between the node and other nodes in the same column of the 2D flattened butterfly network. Each MUX in the node includes x input ports (corresponding to the x-nary parameter) .
[0167] FIG. 6D illustrates using the 2D flattened butterfly network 600 from FIG. 6A as a gather circuit for sparse encoding an input tensor in neural network computations. The gather circuit is configured to transform the input tensor into a condensed tensor, by gathering high-magnitude tensor data (which may have been quantized) from the input tensor into the condensed tensor according to a given bitmask. The sparse encoding process using the gather circuit is illustrated in FIGs. 2A and 2B.
[0168] In particular, the gather circuit in FIG. 6D uses all 64 nodes of the 2D flattened butterfly network to receive the input tensor (e.g., a tensor with 64 tensor data) , and uses 16 nodes of the 2D flattened butterfly network to output the gathered high-magnitude tensor data. As shown in FIG. 6D, the lines entering from the bottom of FIG. 6D represent the 64 input lines to the 64 nodes, respectively. The lines leaving FIG. 6D from the top represent the 16 output lines from the 16 nodes. The sparse encoding rate (also called compression rate) in this case is 4x (from 64 inputs to 16 outputs) .
[0169] In comparison of the gather circuit 400 illustrated in FIG. 4 using a butterfly network (without flattening) , the gather circuit in FIG. 6D saves the number of inter-nodes connections, the number of nodes (routers) , and the overall lengths of the wired connections. The detailed analysis is provided in FIG. 6B.
[0170] When generalized from the example shown in FIG. 6D, the circuit, when configured as a gather circuit, collects X high-magnitude tensor data from Y tensor data of a given tensor. The input interfaces of the Y routers in the 2D flattened array are configured to receive the Y tensor data from shared memory. Simultaneously, the output interfaces of the X routers in the array are programmed to select the X high-magnitude tensor data based on the provided tensor mask and return this data to shared memory as the condensed tensor. In this configuration, both X and Y are integers, with X being smaller than Y.
[0171] The same analysis applies to scatter circuit. In response to the circuit being configured as a scatter circuit for distributing X high-magnitude tensor data from the given condensed tensor into a sparse uncondensed tensor with Y tensor data, the input interfaces of X routers in the 2D flattened array are set to receive the X high-magnitude tensor data from the shared memory. The output interfaces of Y routers in the 2D flattened array then distribute this X high-magnitude tensor data to specific positions in the uncondensed tensor based on a given tensor mask, and the remaining positions may be filled with zero-valued elements, forming the sparse uncondensed tensor. The sparse uncondensed tensor is output back to the shared memory. Here, both X and Y are integers, with X being smaller than Y.
[0172] FIGs. 7A-7B depict a second embodiment of a 2D flattened butterfly network designed for implementing the gather and scatter circuits, according to various embodiments. This second embodiment, shown in FIGs. 7A-7B, features a distinct design compared to the embodiment in FIGs. 6A-6D. While the 2D flattened butterfly network in FIGs. 6A-6D operates as a circuit-switched network, the embodiment in FIGs. 7A-7B functions as a packet-switched network. In this packet-switched network, data is divided into smaller packets and transmitted independently over multiple routes.
[0173] The circuit-switched network in FIGs. 6A-6D uses dedicated path (afixed path is established for the duration of the communication, ensuring consistent data transmission) and fixed bandwidth (resources are reserved for the connection, even if the channel is not actively transmitting data) , and low delay variability.
[0174] In comparison, the packet-switched network in FIGs. 7A-7B may allow packages to take different paths to reach the destination, improving resilience. In this design, the communication resources in the 2D flattened butterfly network are shared dynamically, allowing multiple nodes to send data over the same bandwidth. However, since packets take different routes, there can be variability in delivery time.
[0175] As illustrated in FIG. 7A, the 2D flattened butterfly network is a mesh network with shared packet links between neighboring nodes, rather than direct multi-hop node-to-node links. This implies that when a packet needs to be delivered to a remote node (i.e., a node that is not a direct neighbor) , it may be routed through one or more intermediate nodes before reaching its destination.
[0176] In some embodiments, due to the structured data transmission patterns in a gather-scatter circuit, it is possible to predict which paths in the 2D flattened butterfly network will experience heavier traffic. Consequently, non-uniform bandwidths may be allocated to different connections based on traffic demand. Connections with higher traffic can be assigned greater bandwidth, while connections with lighter traffic can use smaller bandwidth.
[0177] For example, the direct connections among nodes 18, 19, 26, and 27 in FIG. 7A may utilize higher bandwidth (e.g., 5x the base bandwidth) , while the direct connections among nodes 54, 56, 62, and 63 may use lower bandwidth (e.g., 3x the base bandwidth) . In some embodiments, the lowest bandwidth in FIG. 7A may be set at of the base bandwidth, ensuring that at least packets can be transmitted simultaneously, where y represents the y-fly parameter (i.e., the number of stages) of the pre-flattened butterfly network. In FIG. 7A, the pre-flattened butterfly network has 6 stages, so the lowest bandwidth is 3x of the base bandwidth.
[0178] The “base bandwidth” in this context may be determined by several factors, including the physical capacity of the communication medium, the requirements of the applications using the network, and the anticipated traffic load.
[0179] FIG. 7B illustrates the internal structure of an example node within the 2D flattened butterfly network shown in FIG. 7A. This example node corresponds to node 10 in the network, which is connected to its four neighboring nodes in the top, left, right, and bottom directions (or, alternatively, the east, south, west, and north directions) . In the particular example in FIG. 7B, these neighboring nodes are identified as nodes 2, 9, 11, and 18, respectively.
[0180] Note that node 10 in the packet-switched network (FIG. 7B) has a different internal structure compared to the node 10 in the circuit-switched network (FIG. 6C) . In the packet-switched network, node 10 includes a packet buffer that serves as a staging area for routing tensor data (i.e., the packets) . Additionally, the node is equipped with four pairs of multiplexers (MUXs) , each corresponding to one of the four neighboring nodes. Each MUX pair consists of one MUX that functions as an incoming data selection gate (receiving data from a neighboring node) and another that acts as an outgoing data selection gate (sending data to a neighboring node) . The packet buffer operates as a central hub, connecting all four MUX pairs. Moreover, the packet buffer features an input port and an output port, enabling the node to receive and transmit tensor data to and from shared memory for sparse encoding and decoding.
[0181] FIG. 8 illustrate an example 3D hybrid architecture incorporating the 2D flattened butterfly network with memory dies, in accordance with various embodiments.
[0182] As previously described, the 2D flattened butterfly network may be configured as a gather-scatter circuit, supporting neural network sparsification (encoding) and de-sparsification (decoding) . The network can be dynamically adjusted to function as either a gather circuit for sparse encoding or a scatter circuit for sparse decoding. The gather or scatter circuit can receive input tensors from shared memory and return the processed tensor back to the shared memory.
[0183] In some embodiments, the shared memory may be implemented as a memory die, while the 2D flattened butterfly network may be implemented as a logic die. These two dies can be stacked directly, forming a 3D architecture by coupling the memory die to the logic die.
[0184] To further enhance the efficiency of sparse encoding and decoding, the memory die can be subdivided into multiple memory dies, each corresponding to a different group of nodes in the 2D flattened butterfly network.
[0185] For example, in a 2D flattened butterfly network with 64 nodes, designed to perform sparse encoding at a 4x compression rate (64 inputs, 16 outputs) or sparse decoding at a 4x sparsification rate (16 inputs, 64 outputs) , four memory dies may be created within the same physical layer, each corresponding to one of four groups of nodes.
[0186] When the 2D flattened butterfly network operates as a gather circuit, all 64 nodes receive inputs, and 16 of the nodes gather the high-magnitude tensor data to generate the condensed tensor. In this case, the 64 nodes are divided into four groups: three groups serve as input-only nodes, while one group functions as both input and output nodes. The four memory dies are connected to their respective node groups.
[0187] When the network functions as a scatter circuit, 16 nodes receive the input (the condensed tensor) , while all 64 nodes generate the output tensor. Similarly, the nodes are divided into four groups: one group serves as input-output nodes, while the other three groups act as output-only nodes. The four memory dies are coupled to their respective node groups accordingly.
[0188] The technical benefits of using the above-descripted 3D architecture, where memory dies are stacked directly on top (or bottom) of the logic die of the 2D flattened butterfly network, provide technical advantages over a traditional 2D architecture. One key benefit is the increase in memory bandwidth and the reduction of latency. By stacking memory vertically over the logic die, the interconnects between memory and logic are significantly shorter. This reduced physical distance improves the speed at which data can be transferred between the memory and processing units, which is critical in high-performance applications such as sparse encoding and decoding in neural networks. The shorter interconnects minimize latency and increase memory bandwidth, allowing faster communication between memory and logic. In contrast, a 2D architecture, where both memory and logic reside on the same die, would require longer horizontal interconnects, leading to slower data transfer and higher latency.
[0189] Another significant advantage of 3D architecture is the improvement in parallelism and scalability. The vertical stacking of memory and logic enables multiple memory dies to be accessed in parallel, with each die connected to different groups of nodes in the 2D flattened butterfly network. This results in higher data throughput, as multiple memory dies can simultaneously provide data to different processing units. In a 2D architecture, where memory and logic share the same die, parallel access to memory would be more limited, restricting the scalability and parallelism of the system.
[0190] The 3D architecture also provides a higher density and a smaller footprint compared to 2D configurations. By stacking memory and logic dies in a vertical layout, the overall chip size is reduced, allowing for more processing power and memory to be integrated into a smaller physical space. This is particularly beneficial in applications that require compact, high-performance systems. In a 2D design, combining memory and logic on the same die would increase the die size, limiting how densely components can be packed and potentially affecting overall performance.
[0191] Power efficiency is another important advantage of the 3D architecture. The reduced interconnect length between memory and logic decreases the power required for data transfers, as shorter pathways result in lower capacitance and resistance. This leads to lower energy dissipation during memory access, making the system more power efficient. In a 2D system, longer interconnects would require more power to drive signals across the chip, especially at high data rates. Moreover, the 3D architecture allows for more effective thermal management, as heat can be distributed more evenly across different layers, improving overall power efficiency.
[0192] Lastly, the modular nature of the 3D architecture provides significant flexibility in customization. The memory and logic dies can be designed and optimized independently, then stacked together to form a system tailored to specific application needs. Memory configurations can be altered without requiring changes to the logic die, which increases the adaptability of the system. This level of modularity is difficult to achieve in a 2D design, where integrating memory and logic into the same die would necessitate more complex re-engineering to accommodate changes.
[0193] In the specific case of sparse encoding and decoding in neural networks, the 3D architecture enhances performance by allowing memory dies to be subdivided and mapped to distinct groups of nodes within the 2D flattened butterfly network. This enables faster and more efficient data processing, especially for handling tensor data in different formats where memory access patterns can vary dynamically. A 2D architecture would be less suited to such tasks, as its ability to dynamically handle parallel memory access is limited, leading to potential bottlenecks in sparse computation tasks.
[0194] 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.
[0195] 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.
[0196] When the functions disclosed herein are implemented in the form of software functional units 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.
[0197] 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.
[0198] 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.
[0199] 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.
[0200] 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.
[0201] 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.
[0202] 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) ) .
[0203] 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.
[0204] 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.
[0205] 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, “Aand B” means “Aand 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.
[0206] 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.
[0207] 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.
[0208] 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 circuit, comprising:a plurality of routers arranged as a 2D flattened array, each router in the 2D flattened array comprises:a routing network configured to route data between the router and other routers in the 2D flattened array,an input interface configured to receive data from a memory, andan output interface configured to output data to the memorywherein the 2D flattened array implements a logical butterfly network, and is configurable as:a gather circuit, operable to gather high-magnitude tensor data from a dense tensor into a condensed tensor, ora scatter circuit, operable to scatter tensor data from the condensed tensor into a sparse uncondensed tensor based on a given mask.2.The circuit of claim 1, wherein the gather circuit gathers X high-magnitude tensor data from the dense tensor comprising Y elements into the condensed tensor, wherein X and Y are both integers, and X is a smaller than Y.3.The circuit of claim 2, wherein:the plurality of routers in the 2D flattened array comprises Y routers that are used to receive input data, and X routers out of the Y routers are used to output data,wherein:the input interfaces of the Y routers are configured to receive the Y elements of the dense tensor from the memory, andthe output interfaces of the X routers are configured to output the selected X high-magnitude tensor data as the condensed tensor.4.The circuit of claim 1, wherein the scatter circuit scatters the condensed tensor with X high-magnitude tensor data into a sparse uncondensed tensor with Y positions, based on the given mask, wherein X and Y are both integers, and X is a smaller than Y.5.The circuit of claim 4, wherein:the plurality of routers in the 2D flattened array comprises Y routers that are used to output data, and X routers out of the Y routers are also used to receive input data,wherein:the input interfaces of the X routers are configured to receive the X high-magnitude tensor data of the condensed tensor from the memory; andthe output interfaces of the Y routers are configured to distribute the X high-magnitude tensor data to a part of the Y positions of the sparse uncondensed tensor according to the given tensor mask, and fill remaining positions of the sparse uncondensed tensor with zeros.6.The circuit of claim 1, wherein the logical butterfly network comprises K stages, each row of the logical butterfly network comprises K logical routers across the K stages, and the 2D flattened array flattens the K logical routers in each row of the logical butterfly network into a single router, wherein K is an integer greater than 1.7.The circuit of claim 1, wherein the logical butterfly network comprises K stages, and the 2D flattened array is implemented as a circuit switch network, wherein K is an integer greater than 1.8.The circuit of claim 7, wherein:within a router in the 2D flattened array, the routing network comprises K bidirectional wired connections connecting the router to K other routers in the 2D flattened array.9.The circuit of claim 8, wherein:the K bidirectional wired connections comprisehorizontal wired connections andvertical wired connections.10.The circuit of claim 9, wherein:thehorizontal wired connections comprise bidirectional connections with lengths increasing in powers of 2, where the length of the nth connection is 2n hops, starting with a first connection having a length of 1 hop, where n is an integer starting from 0.11.The circuit of claim 9, wherein:thevertical wired connections comprise bidirectional connections with lengths increasing in powers of 2, where the length of the nth connection is 2n hops, starting with a first connection having a length of 1 hop.12.The circuit of claim 9, wherein:thehorizontal wired connections correspond to a firststages of the K stages of the logical butterfly network, and thevertical wired connections correspond to a secondstages of the K stages of the logical butterfly network.13.The circuit of claim 1, wherein:the routing network within the router comprises a plurality of Multiplexers (MUXs) .14.The circuit of claim 1, wherein the 2D flattened array is implemented as a packet switch network with all single-hop directional wired connections.15.The circuit of claim 1, wherein:within a router in the 2D flattened array, the routing network comprises a plurality of single-hop bidirectional wired connections connecting to nearest neighboring routers in the 2D flattened array.16.The circuit of claim 15, wherein:the plurality of bidirectional wired connections have non-uniform bandwidths.17.The circuit of claim 14, wherein:within each router of the packet switch network, the routing network comprises a package buffer, and a plurality of Multiplexers (MUXs) .18.The circuit of claim 17, wherein:the plurality of Multiplexers (MUXs) , the input interface, and the output interface are connected to the package buffer.19.The circuit of claim 1, wherein:the memory is implemented as a first die, and the 2D flattened array is implemented as a second die.20.The circuit of claim 19, wherein:the first die is directly coupled to the second die forming a 3D architecture.
Citation Information
Patent Citations
Structured light three-dimensional rapid reconstruction method based on depth compressed sensing
CN116883597A
Method and system for dual-sparse convolution processing and parallelization
US20230111362A1
Electronic device and method for accelerating neural network computations
US20230359497A1
Cited By
Data processing method and device based on butterfly network and computer equipment
CN122088578A
Data processing method and apparatus for neural network
CN122174900A