Accelerator architecture and AI acceleration system for near-IO pipeline computing
The near-IO pipeline computing architecture solves the data reading delay problem caused by the multi-level cache architecture of the computing core and storage in the AI accelerator through multi-channel direct access modules and pipeline synchronization loops, achieves efficient data transmission and processing, and improves AI computing performance.
Patent Information
- Application Number
- CN202410634746.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-05-22
AI Technical Summary
The multi-level cache architecture of computing cores and storage in existing AI accelerators results in prolonged data reading. Especially in large-model AI calculations, insufficient cache capacity leads to low cache hit rates, which in turn exacerbates the storage access bottleneck problem.
Adopting a near-IO pipeline computing architecture, through multi-channel direct access modules and pipeline synchronization loops, direct and high-speed data transmission between computing core groups and DRAM is realized. Multi-layer cache design is abandoned, and the Switch arbiter is used to realize cross-core group and cross-core group. DRAM data cross-connection.
It significantly reduces the data transmission delay, increases the data processing speed of the accelerator, reduces the overall cost, and achieves high concurrent data input and output, improving AI computing performance.
Smart Images

Figure CN118227535B
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of accelerators, and in particular to an accelerator architecture and an AI acceleration system for near-IO pipeline computing. Background Art
[0002] In the current AI acceleration GPU, SOC, and ASIC designs, the relationship between computing cores and storage is centered around Figure 1 The typical architecture implementation shown in the figure. There will be some fine-tuning in the specific design, and the number of cache layers may be different. For example, in the Ampere architecture of the A100 high-end graphics card, the original L0 layer is merged into the L1 layer. The L1 cache in this architecture is at the KB level, and its cache capacity can be as high as hundreds of KB, such as 192KB for the A100 graphics card and 256KB for the H100 graphics card. The L2 cache is at the MB level, and its cache capacity can reach tens of MB, such as 50MB for the A100 graphics card and H100. For DRAM, its cache capacity is usually at the GB level. Due to the speed requirements, there are many solutions using HBM and GDDR, and the capacity ranges from more than ten GB to tens of GB. For example, NVDIA's latest B200 has a capacity of 192GB (HBM).
[0003] In the related art, the weights of AI calculation parameters are usually initialized and stored in DRAM in the computer, and need to be imported into the computing core for calculation. Figure 1 From the architecture disclosed in, it can be seen that the computing core imports parameters through multiple layers of cache, and the access order is to query the nearest level of cache first. If it misses, the next level of cache is queried until it hits and returns the data. When the data is returned, some designs can be returned directly to the computing core, while others need to be synchronized to the next level of cache first, and can only be obtained by the computing core after being synchronized to L0 / L1. Therefore, if the L0 / L1 cache does not hit, the parameter reading delay will be very long. The above are the problems caused by one-time reading of parameters. In large-model AI calculations, it will be executed continuously, resulting in cumulative delays, and insufficient cache capacity will cause the cache to be unable to accommodate, which will lead to repeated reading of higher-level caches and even DRAM, which will amplify the storage access bottleneck problem. Summary of the invention
[0004] The embodiments of the present application provide an accelerator architecture and an AI acceleration system for near-IO pipeline computing to solve the latency problem caused by the computing core group in the accelerator and the acceleration system reading data based on multi-level cache.
[0005] The present application discloses an accelerator architecture for near-IO pipeline computing, the accelerator comprising a multi-channel direct access module, M computing core groups and a pipeline synchronization ring; wherein the M computing core groups are divided into N core group groups containing the same or different numbers of core groups;
[0006] The multi-channel direct access module includes N DRAM controllers, and the N DRAM controllers are connected to the external DRAMs in a one-to-one correspondence; each of the DRAM controllers is connected to at least K direct access storage DMA controllers, and is connected to the corresponding core group through the DMA controller, so that the data in the i-th DRAM is directly read to the i-th computing core group, and the result data output by the i-th computing core group is directly cached to the i-th DRAM;
[0007] The pipeline synchronization ring is connected to N core groups, including M cascaded forward transmission blocks and M cascaded backward transmission blocks, and the output of the tail end forward transmission block is cascaded to the first backward transmission block;
[0008] The i-th forward transmission block and the M-i+1-th backward transmission block correspond to each other, and are jointly connected to at least one computing core group, and the data is sent to the target computing core group in a pipeline form for calculation, and the data output by the computing core group is sent to the pipeline synchronization ring; wherein M, N, K, i, j are positive integers.
[0009] Specifically, the multi-channel direct access module also includes a Switch arbiter, and the N DRAM controllers and the N core groups are respectively connected to the ports of the Switch arbiter through ports, and the data in the i-th DRAM is cross-read to the j-th core group, and the result data output by the j-th core group is cross-cached to the i-th DRAM; wherein i and j are different positive integers.
[0010] Specifically, the K DMA controllers and the computing core groups in the computing core group are connected in a one-to-one, one-to-many, or many-to-one relationship.
[0011] Specifically, it also includes a data sending module and a data receiving module connected to the pipeline synchronization ring; the data sending module receives data output from the pipeline synchronization ring and sends the data out of the accelerator, and the data receiving module receives data sent from the outside, sends the data into the pipeline synchronization ring, and pushes it to the target computing core group in the core group group.
[0012] Specifically, the backward transmission block includes a backward register and P backward writing units cascaded forward and backward; P is a positive integer;
[0013] The backward register is connected to the output end of the previous cascade transmission block to receive and store intermediate data; one output of the backward register is connected to the first backward write unit, and the data is pushed to the target backward write unit in a pipeline manner through the cascade structure, and the other output is directly connected to the next cascade transmission block to push the intermediate data to the target transmission block in a pipeline manner.
[0014] Specifically, the first write registers in each backward write unit in the same backward transmission block are cascaded front and back, data is input through the backward registers, and the data is pushed to different forward write units in a pipeline manner;
[0015] The backward writing unit includes at least Q write registers cascaded forward and backward, each write register is connected to a computing core group, and pushes data to the target computing core group in the forward writing unit in a pipeline form.
[0016] Specifically, the forward transmission block includes a forward FIFO buffer, a forward register, P groups of forward receiving units and a forward writing unit; P is a positive integer;
[0017] P forward receiving units are cascaded front to back, and P forward writing units are cascaded front to back, and the forward writing units and forward receiving units in the same group are connected to the same computing core group;
[0018] One input end of the forward FIFO buffer is connected to the output of the previous cascade transmission block to receive and store intermediate data, and the other input end is connected to the output of the tail-end forward receiving unit to receive data output from the tail-end forward receiving unit;
[0019] The output of the forward FIFO buffer is connected to the forward register, and the output of the forward register is connected to the first forward write unit, so that the pipeline data is pushed to the target forward write unit through a cascade structure.
[0020] Specifically, the forward writing unit includes at least Q forward and backward cascaded writing registers, each writing register is connected to a computing core group, and the data is pushed to the target computing core group in the forward writing unit in a pipeline manner;
[0021] The forward receiving unit includes at least Q receiving FIFO buffers cascaded forward and backward, each receiving FIFO buffer is connected to a computing core group, caches the intermediate data input by the computing core group, and sends the intermediate data to the pipeline synchronization ring layer by layer in a pipeline form.
[0022] Specifically, the first write registers in each forward write unit in the same forward transmission block are cascaded front and back, data is input through the forward registers, and the data is pushed to different forward write units in a pipeline form;
[0023] The tail end receiving FIFO buffers in each forward receiving unit in the same forward transmission block are cascaded front and back, and the intermediate data input by different computing core groups are sent to the forward FIFO buffer layer by layer in a pipeline manner.
[0024] Specifically, in the i-th forward transmission block and the (M-i+1)-th backward transmission block, the forward writing unit and the backward writing unit in the same group have the same structure;
[0025] In the same group of forward receiving units and forward writing units of the same forward transmission block, the numbers of registers and FIFO buffers are the same.
[0026] Specifically, the data pushed into the pipeline synchronization ring is provided with a bit identifier, and the forward transmission block and the backward transmission block determine the state and flow direction of the data based on the corresponding flag bit of the bit identifier;
[0027] When the flag bit of the bit identifier indicates that the data is exhausted, the data is directly discarded;
[0028] When the flag bit of the bit identifier indicates that the data is not exhausted, the data is sent to the write register layer by layer until it is pushed into the target computing core group.
[0029] On the other hand, the present application provides an AI acceleration system, the system comprising at least two accelerators and a data exchange circuit as described in the above aspects, at least two accelerators are respectively connected to a plurality of DRAMs, and a data sending module and a data receiving module connected to a pipeline synchronization ring are provided inside the accelerator, and the data sending module and the data receiving module are respectively connected to the data exchange circuit;
[0030] The computing core group in the accelerator is used to perform at least one of matrix operations and vector operations. The sending-end accelerator performs data acceleration tasks and sends matrix data and / or vector data to the data exchange circuit through a data sending module. The receiving-end accelerator receives matrix data and / or vector data through a data receiving module and performs data acceleration tasks.
[0031] The beneficial effects brought about by the technical solution provided in the embodiment of the present application include at least: a pipeline transmission structure is formed by cascading forward transmission blocks and cascaded backward transmission blocks, and the forward transmission block is divided into cascaded forward receiving units and forward writing units according to input and output; each forward receiving unit adopts multi-stage FIFO cascading and access to the computing core group, and each forward writing unit adopts multi-stage register cascading and access to the computing core group to achieve high-concurrency data input and output; adjacent writing units in each transmission block cascade the first register, and adjacent receiving units cascade the tail FIFO, so that the input and output data can be pushed in pipeline between the writing units and the receiving units, as well as the pipeline jump push inside the writing unit and the receiving unit, thereby achieving fast data transmission.
[0032] Inside the accelerator, the computing core groups can directly access the external storage media through multi-channel DMA control, accelerate data extraction and transmission efficiency, read the data in DRAM to the computing core group, or receive the data output by the computing core group and write it back to DRAM; for cross-core group and cross-DRAM data interaction, the switch arbitrator is set to achieve cross-connection of global DRAM and core group data. The accelerator abandons the multi-layer cache design mode, reduces the overall cost, transmits data to the specified computing core with minimal delay, and speeds up the data processing speed of the accelerator. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a multi-level cache computing core group storage acceleration architecture disclosed in the related art;
[0034] Figure 2 It is a schematic diagram of hardware deployment based on the flash attention solution in related technologies;
[0035] Figure 3 A schematic diagram of synchronous data flow based on current AI accelerator chips is shown;
[0036] Figure 4 It is a structural diagram of an accelerator architecture for near-IO pipeline computing provided in an embodiment of the present application;
[0037] Figure 5 It is a structural diagram of a water flow synchronization ring;
[0038] Figure 6 It is a schematic diagram of the structure of the backward transmission block in the pipeline synchronization ring;
[0039] Figure 7 It is a schematic diagram of the structure of the forward transmission block in the pipeline synchronization ring;
[0040] Figure 8 It is a structural diagram of the AI acceleration system provided by this application;
[0041] Fig. 9 It is a schematic diagram of the structure of the AI acceleration system for long-sequence linear calculations;
[0042] Fig.10 It is an AI accelerator designed based on the flash attention computing principle. DETAILED DESCRIPTION
[0043] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0044] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0045] Figure 1 It is a computing core group storage acceleration architecture with multi-level cache disclosed in the related art; for the computing core group part in this architecture, different products produced and designed by different companies have different designs, usually containing one computing core or multiple parallel computing cores. The computing core usually supports pipeline computing, and when multiple computing cores are included, the computing functions of different computing cores may be different, such as including computing cores of different precisions at the same time, and including matrix computing cores (often MAC arrays), vector computing cores, etc. Taking the A100 and H100 architectures as an example, one L1 cache corresponds to a streaming multiprocessor SM (streaming multiprocessor), which contains four computing core groups, each computing core group contains multiple streaming processors SP (streaming processors), these SPs include different numbers of FP32 pipeline computing cores, INT32 pipeline computing cores, FP64 pipeline computing cores and NVDIA customized tensor cores. The Tensor core in A100 is the third generation, and that in H100 is the fourth generation. Figure 1 Taking the architecture disclosed in as an example, in some designs, the L0 layer cache is merged into the core group as a shared memory, while the L1 and upper layers are located outside the core group. Several core groups share one L1 cache to perform parameter access, while multiple L1 caches and the upper layer L2 cache perform parameter access. Multiple L2 caches are finally connected to the storage medium for storage models and data parameters, which can be HBM, DDR, LPDDR or GDDR DRAM, etc.
[0046] From the above architecture, we can see that the current AI computing chips are often designed with the needs of convolutional neural networks (CNN) in mind. The parameters are composed of convolution kernels at most. After a convolution kernel is imported, it will slide on the data to be calculated and perform convolution operations. One convolution operation can be understood as a multiplication and addition operation (MAC operation) for one parameter. In CNN, a convolution kernel will participate in multiple operations, and the calculation density of unit parameters is relatively high. Taking resnet50 as an example, in the first layer of convolution, a convolution kernel convolves 224*224 input into a size of 112*112, the convolution kernel is 7*7, the step size is 2, and the number of convolution calculations is 112*112=12544 times. It can be considered that each parameter has been read 12544 times (MAC calculation) from the time it was read to the current result. After the CNN parameters are read, more calculations will occur. If the next set of parameters is imported during the calculation delay, the delay caused by multiple caches can be hidden, while ensuring that the next calculation starts as soon as possible.
[0047] However, as the success of GPT has led to more and more applications of large models based on the Transformer architecture, computing requirements have changed. For Transformer, the parameters are mainly large matrices, and the calculations that most parameters participate in can be abstracted as vector multiplication by matrix equals vector:
[0048]
[0049] Where x is an m-dimensional vector, w is an m*n matrix, and y is an n-dimensional vector, then for the elements of y (k∈[1,n]) has:
[0050]
[0051] As can be seen from the formula, each parameter data only participates in one multiplication and addition operation, and the computing density is low, so the computing core can easily meet this performance requirement. At the same time, the model parameters under the Transformer architecture are large. Taking the current LLaMa2 as an example, the smallest model is 7B, that is, the number of parameters is about 7 billion, and the FP32 parameters require a storage capacity of about 28GB, even if quantized to int8, it still requires 7GB. The above causes the running performance of the Transformer architecture model on the AI accelerator to be directly related to the DRAM capacity and the speed (throughput) and latency (latency) of DRAM parameters directly to the computing core. However, the cache of the current architecture AI accelerator is far from providing sufficient capacity. The computing core needs to read DRAM directly to obtain parameters. At this time, the latency caused by the multi-layer cache architecture seriously affects the computing performance. Although multi-batch computing (multi-task parallelism) has brought certain improvements in computing resource utilization, the performance loss caused by insufficient physical bandwidth utilization has not been alleviated.
[0052] Insufficient cache capacity will also bring more problems. Take the optimization of softmax in GPU as an example. The pseudo code written to prevent overflow of softmax needs to contain at least 3 loops. The use of loops requires caching intermediate results, which takes up a small amount of cache, especially in long-dimensional models such as Transformer (softmax may reach tens of K levels according to the supported token length, and the minimum is also K level). At the same time, for multi-core parallel computing such as GPU, data synchronization between cores will also increase the delay overhead outside the algorithm. In response to the above defects, many optimization codes in the CNN era are optimized and implemented using the online softmax algorithm. Combined with the calculation formula of the attention layer, the exp splittable feature is also used to form a flash attention solution to further reduce loops.
[0053] Figure 2 This is a schematic diagram of the hardware deployment based on the flash attention solution in the related technology. Figure 2 The shaded part is the data that needs to be stored in the L0 / L1 cache closest to the computing core group. The additional boxed part of the shaded part indicates valid data (for example, in A, the maximum cache amount generated by the intermediate result is the shaded part, and the final accumulated result is the boxed part). D is the dimension of the head (usually small, such as 128 for LLaMa2), and B corresponds to the parallelism b, which can be set manually. L is the sequence length, which may be very long (such as 16K), but according to the current calculation method, there is no need to put the entire L sequence length matrix in the L0 / L1 cache, only the D*B size needs to be considered. Each tile is pipelined and the cache is small. This method greatly solves the problem of parameter amplification. This calculation method has certain limitations:
[0054] First, we assume that D is relatively small. This method is for better operation. The original attention calculation D, which is equal to L, is divided into the current D (D=L / n_haeds, n_haeds is the number of heads in the multi-head attention) through the multi-head attention calculation method. Moreover, as the model evolves, it is impossible to confirm whether D will continue to grow. This may become a restriction on the direction of algorithm evolution. The controlling factor of parallelism B is the size of the cache, but usually this parameter should consider the parallelism of the computing core. For example, if a hardware is given, the cache size is fixed, and the B*D value is fixed. If D is different in different models, the B that can be set is different. However, the parallelism of the given hardware computing core is fixed. In this case, the parallelism will not match and the computing resource utilization will be seriously reduced.
[0055] In the generation stage of Inference, the essence of single batch calculation is vector multiplication by matrix, where Q is a vector. In the design of AI computing cores, pulsation arrays are often used, which is matrix multiplication by matrix, and multiple batch operations are performed to improve resource utilization. During the operation, KT and V slide with the sequence, so Q needs to be stored completely. In multiple batches, batches of Q need to be stored. At this time, due to the cache size limitation, the number of batches is also subject to corresponding limitations, further limiting the utilization of computing resources. Both of the above problems lead to serious limitations on the performance of computing cores with high computing density. At the same time, flash attention only alleviates the amplification of the multi-layer cache access delay problem, and does not improve the problem itself. The above KT and V still need to access DRAM through a multi-layer cache mechanism as the sequence slides.
[0056] The AI acceleration device built based on the above architecture also has device latency between multiple devices, because before Transformer, most AI calculations were only performed by multiple devices during training, and inference was mostly run on a single device. In the Transformer model, it is common to use multiple devices to perform inference calculations together. For example, the llama2-70B model requires two or four A100 / H100s to obtain better performance.
[0057] Figure 3 The figure shows a schematic diagram of synchronous data flow based on the current AI accelerator chip. When the computing core groups in the two devices synchronize data, the data in device 1 must first pass through a multi-layer cache mechanism ( Figure 3 The data in the target device DRAM must also pass through a multi-layer cache mechanism to reach the target computing core group. In this way, without considering the inter-chip transmission and DRAM delay, the multi-layer delay between the computing core group and DRAM is usually 100 clock cycles or more, which has a great impact on efficiency. At the same time, if global data exchange is performed inside the device, similar delays will also occur, affecting computing efficiency.
[0058] Figure 4This is a schematic diagram of the structure of the accelerator architecture for near-IO pipeline computing provided by an embodiment of the present application. The AI accelerator (AI acceleration device) under this architecture is internally provided with a multi-channel direct access module, M computing core groups and a pipeline synchronization ring; the M computing core groups are divided into N core group groups containing the same or different numbers of core groups. The design of the core group group is mainly to concentrate several computing core groups, which can specifically achieve greater integration and higher-scale acceleration tasks.
[0059] The multi-channel direct access module includes N DRAM controllers, and the N DRAM controllers are connected to the external DRAM one by one. The N DRAM controllers here are set according to actual needs and connected to a certain number of storage devices to realize the data reading and writing operations on the DRAM. In order to speed up the data transmission efficiency and reduce the control dependence on the computing core group, at least K direct access storage DMA controllers can be connected to each DRAM controller, and connected to the corresponding core group through the DMA controller. Thereby, the data in the i-th DRAM is directly read to the i-th computing core group, and the result data output by the i-th computing core group is directly cached to the i-th DRAM.
[0060] Each DRAM controller corresponds to multiple DMA access channels, which are directly connected to the corresponding core group, and can achieve fast and direct access. In addition to eliminating the delay caused by the multi-layer cache mechanism, it can also eliminate the delay of switch arbitration and bus forwarding, and maximize the physical performance of DRAM. This is because the call of the ordinary access port needs to continuously call the resources of the computing core group for control.
[0061] It should be noted that the type of controller in the multi-channel direct access module can be determined according to the design of the AI acceleration chip. The current mainstream preferred HBM, but it does not rule out the use of GDDR, DDR, LPDDR and other controllers due to process, available procurement lines, historical technology and other reasons. In addition, in this application, the core group as a whole is directly connected to the DMA channel, and the number and scale of computing core groups in the core groups corresponding to different DRAMs can be designed according to different designer design ideas and target scenarios. The relationship between the DMA channel and these computing core groups can be defined as one-to-one, one-to-many, many-to-one, etc. according to demand. In principle, it is not encouraged to support many-to-many, which will reduce access efficiency.
[0062] In a possible implementation, a one-to-one design can be adopted, that is, the number of DMAs is consistent with the number of computing core groups in the core group, and the DMA controller also needs to set the same number of common access ports to connect to all computing core groups, which is mainly for data exchange and acceleration tasks across core groups and across DRAM devices. To this end, the present application also sets a Switch arbitrator in the multi-channel direct access module.
[0063] The switch arbiter is connected to N DRAM controllers and N core groups through common access ports. Its purpose is to cross-read the data in the i-th DRAM to the j-th core group, and cross-cache the result data output by the j-th core group to the i-th DRAM. i and j are different positive integers. Each DRAM controller corresponds to a common access channel. The common channels between controllers are uniformly accessed through a switch, and an access port is provided for each computing core group. This design provides a global access channel for the computing core group. The speed of this channel is slower than that of the DMA channel, but the delay for global data exchange is still better than that of exchange through a multi-layer cache mechanism.
[0064] In addition, in some embodiments, if the accelerator wants to effectively exchange data with other peripheral devices, a data sending module and a data receiving module can also be set up. The data sending module and the data receiving module are respectively connected to the pipeline synchronization ring. After the data calculated by the acceleration computing core is pushed through the pipeline synchronization ring, the result can be sent from the data sending module to the outside of the accelerator. Similarly, the external data can be received by the data receiving module and sent to the pipeline synchronization ring, and then pushed to the target computing core group in the core group group.
[0065] Figure 5 It is a structural diagram of a pipeline synchronization ring. The pipeline synchronization ring is connected to N core groups, and contains M cascaded forward transmission blocks Forward step and M cascaded backward transmission blocks Backward step. The forward transmission block is for forward data transmission, while the backward transmission block is for reverse data transmission. In particular, the forward transmission block at the head end and the forward transmission block at the tail end are respectively connected to the data receiving module Receiver and the data sending module Sender. Of course, the Receiver and Sender can be swapped, or the data sending and receiving modules can be set at the head and tail ends of the cascaded backward transmission blocks, which does not affect the overall structure. The forward and backward transmission blocks are a cascade structure as a whole, that is, the output of the forward transmission block at the tail end is cascaded to the first backward transmission block. As shown Figure 5 In the figure, Forward step 1 is connected to Receiver, which is then connected to Forward step M in turn, and Forward step M is connected to Sender and output. At the same time, Forward step M is further cascaded to Backward step 1, and then connected to Backward step M in turn. Note that the forward and backward transmission blocks do not form a complete ring; M, N, K, i, j are positive integers.
[0066] The i-th forward transmission block and the M-i+1-th backward transmission block of the pipeline synchronization ring correspond to each other and are connected to at least one computing core group. Figure 5 In the example, Forward step 1 corresponds to Backward step M, and Forward step M corresponds to Backward step 1, and so on. Each Forward step i and Backward step M-i+1 is a group, and they should be connected to the same computing core group. The number of computing core groups connected to each group can be freely set. For example, if N computing core groups are evenly divided into M groups, each group will have N / M.
[0067] The purpose of this design structure is to send data to the target computing core group in a pipeline form for calculation, and to send the data output by the computing core group into the pipeline synchronization ring. Under the action of the forward and backward transmission blocks, the data sent from any computing core group can be pushed to any other computing core group in a pipeline manner through the transmission block, and the special structure of the forward and backward cascade folding reciprocating can realize the step-by-step push of computing core group 1 to computing core group N, and then continue to push back from computing core group N to computing core group 1. Similarly, Receiver and Sender can realize data exchange between accelerators, push calculations after receiving external data, and send out the result data or intermediate data of pipeline calculations, which is also the core embodiment of the "synchronization ring" in this application.
[0068] Figure 6 1 is a schematic diagram of the structure of a backward transmission block in a pipeline synchronization ring, wherein the backward step includes a backward register and P backward write units write steps cascaded forward and backward; wherein P is a positive integer. Figure 6 For the convenience of description, three backward writing units are illustrated.
[0069] The Backward register is connected to the output of the previous cascade transmission block to receive and store intermediate data. One output of the Backward register is connected to the first backward write unit write step 1, and the data is pushed to the target backward write unit in a pipeline through the cascade structure. The other output is directly connected to the next cascade transmission block to push the intermediate data to the target transmission block in a pipeline. Assuming that the intermediate data needs to be sent to the computing core group 4 in write step 2, it needs to be sent to write step 1 first, and then passed to write step 2.
[0070] The first write registers in each Backward write in the same Backward step are cascaded forward and backward, and data is input through the Backward register, and the data is pushed to different Backwardwrite steps in a pipeline manner. The Backwardwrite step contains at least Q write registers writeregister cascaded forward and backward, each write register is connected to a computing core group, and the data is pushed to the target computing core group in the forward write unit in a pipeline form. The special feature of this structure is that the continuous storage of registers will occupy clock cycles and cause delays, so the first write register 1 in each Backward write step is cascaded. Assuming that the intermediate data is to be pushed to the computing core group 8 in write step 3, the data is pushed in a pipeline jump manner, that is, Backward register→(Backward write step 1)write register 1→(Backward write step 2)writeregister 1→(Backward write step 3)write register 1, and then writeregister 1→write register 2→computing core group 8 in this layer. It should be noted that the number of registers (computing core groups) cascaded in each write step can be the same or different, which is set according to actual needs.
[0071] Figure 7 It is a structural diagram of a forward transmission block in a pipeline synchronization ring, wherein the Forward step includes a forward FIFO buffer Forward fifo, a forward register Forward register, P groups of forward receiving units Forward receive step and a forward write unit Forward write step; P is a positive integer.
[0072] P Forward receive steps are cascaded back and forth, and P Forward write steps are cascaded back and forth. The Forward write step and Forward receive step in the same group are connected to the same computing core group. Because one is used for sending and the other is used for receiving data, the data flow direction is opposite. For the convenience of description, the pipeline timing is used for numbering description, that is, Forward write step i and Forward receive step P-i+1 are grouped together, corresponding to Figure 7In the figure, Forward write step 1 and Forward receive step 3 are in the same group, and so on.
[0073] One input end of the forward fifo is connected to the output of the previous cascade transmission block to receive and register intermediate data, and the other input end is connected to the output of the forward receive step P at the tail end to receive data output from the Pth forward receive unit. The output of the forward fifo is connected to the forward register, and the output of the forward register is connected to the first forward write unit, forward write step 1, to push the pipeline data to the target forward write unit through the cascade structure.
[0074] The forward write step contains at least Q write registers cascaded forward and backward. Each write register is connected to a computing core group. The purpose is to push the (intermediate) data to the target computing core group in the forward write unit in a pipeline manner.
[0075] The forward receive step includes at least Q forward and backward cascaded receive FIFO cache Switch fifos. Each Switch fifo is connected to a computing core group, caches the intermediate data input by the computing core group, and sends the intermediate data to the pipeline synchronization ring layer by layer in the form of pipeline.
[0076] In some embodiments, the Forward step and the Backward step may include multiple layers of Backward write step and Forward receive step. Figure 7 In the figure, write register 1 in Forward write step 1 is not directly connected to computing core group 1, but is connected to Forward write step 11. Then Forward writestep 11 continues to include Q write registers, each of which is connected to a computing core group, thus forming a multi-layer nested structure. The last layer is connected to the computing core group, and the same is true for the other parts.
[0077] In the pipeline synchronization loop provided by the present application, the first write register write register 1 in each Forward write step in the same Forward step is cascaded front and back, and data is input through the Forward register, and the data is pushed to different forward write units in a pipeline form. This method can advance forward according to the final destination of the flow to achieve pipeline jump, reduce the data transmission process, quickly push the (intermediate) data to the target forward write unit, and then pass it in sequence inside the unit to the target computing core group.
[0078] Similarly, for the structure of input data, the tail Forward receive step Q in each Forward receive step in the same Forward step is cascaded, and the intermediate data input by different computing core groups is sent to the Forward fifo layer by layer in a pipeline manner. This method allows the data to be pushed forward in a pipeline jump manner, reducing the FIFO cache transmission process.
[0079] In particular, because Backward step i and Forward step M-i+1 are in the same group of transmission blocks and jointly maintain the same computing core group, the forward write unit and the backward write unit in the i-th forward transmission block and the M-i+1-th backward transmission block, which are in the same group, have the same structure. That is, they contain the same number and structure of write registers, and the number of registers and FIFO buffers in the same group of forward receiving units and forward write units in the same forward transmission block is also the same.
[0080] In the above transmission block structure, the forward and backward write units only store one data, so it is a full pipeline situation, and the register can be used to complete the layer-by-layer transmission. However, there is QoS control in the forward receiving unit, and an uncertain number of multiple data may be cached. For this reason, when transmitting write data in each clock cycle, registers + judgment logic are used to implement it. When receiving the data of the computing core group to the main transmission stream in each cycle, the fifo structure is used for buffering, mainly to solve the conflict between the two data sources. In the specific design, it should be noted that the closer to the main stream, the higher the data bandwidth upper limit should be designed. At the same time, for the data sent by the computing core group, multiple receives in the pipeline synchronization ring may arrive at the same time, so fifo is used for caching. In some applications, if the data is expected to have serious data flow conflicts, QoS restrictions can be added where necessary.
[0081] Assume that the pipeline synchronization loop is considered in layers, the top layer is the structure of Forward step 1- Forwardstep M, and Backward step 1- Backward step M. When the Forward step and Backwardstep contain only a single register structure (and FIFO cache), the second layer is a single Forward step and Backwardstep structure, and the third layer is the computing core group. Figure 5-7 Take three layers as an example. When the forward step and the backward step contain multiple layers of register structures, the pipeline level of the overall synchronization loop increases accordingly. Assume that the number of pipeline layers is sync_layers and the number of pipelines per layer is sync_steps (i.e., the Q value in the above embodiment. The number in different units can be different. Figure 6-7 (description with sync_layers=3, sync_steps=3) The maximum number of supported computing core groups is:
[0082]
[0083] The minimum and maximum delays in the device are:
[0084]
[0085]
[0086] Taking the A100 graphics card as an example, there are 108 computing core groups SM. At this time, a 3-layer 5-level pipeline is used to support up to 125 computing core groups, with a minimum synchronization delay of 3 cycles and a maximum of 15 cycles. Compared with the multi-level cache mechanism with a minimum synchronization delay of 100 cycles, it is close to the 10 cycles of hitting the L1 cache, or even faster.
[0087] According to the pipeline data push rules of the above-mentioned pipeline synchronization loop, the bit identifier is used to determine whether to send it to the next accelerator device and to determine which computing core group receives it internally during the data push process. Specifically, a bit identifier is set for the data pushed into the pipeline synchronization loop, and the forward transmission block and the backward transmission block determine the state and direction of the data based on the corresponding flag bit of the bit identifier. Before each forward and backward step is pushed, the data direction and whether it is exhausted are determined according to the flag bit of the bit identifier. If exhausted, the data is discarded; if not exhausted, the transmission direction is determined and pushed. Each step is divided into multiple layers of pipelines in order to cope with the large number of computing core groups on some chips, to push data with the shortest delay, and to shorten the length of the bit identifier of the computing core group.
[0088] To summarize, the present application forms a pipeline transmission structure with cascaded forward transmission blocks and cascaded backward transmission blocks. The forward transmission block is divided into cascaded forward receiving units and forward writing units according to input and output; each forward receiving unit adopts multi-stage FIFO cascading and access computing core group, and each forward writing unit adopts multi-stage register cascading and access computing core group to achieve high-concurrency data input and output; adjacent writing units in each transmission block cascade the first register, and adjacent receiving units cascade the tail FIFO, so that the input and output data can be pushed in pipeline between the writing units and the receiving units, as well as the pipeline jump push inside the writing unit and the receiving unit, thereby achieving fast data transmission.
[0089] Inside the accelerator, the computing core groups can directly access the external storage media through multi-channel DMA control, accelerate data extraction and transmission efficiency, read the data in DRAM to the computing core group, or receive the data output by the computing core group and write it back to DRAM; for cross-core group and cross-DRAM data interaction, the switch arbitrator is set to achieve cross-connection of global DRAM and core group data. The accelerator abandons the multi-layer cache design mode, reduces the overall cost, transmits data to the specified computing core with minimal delay, and speeds up the data processing speed of the accelerator.
[0090] Figure 8 It is a structural schematic diagram of the AI acceleration system provided in the present application, which includes at least two accelerators and a data exchange circuit disclosed above, at least two accelerators are respectively connected to a number of DRAMs, and the data sending module and the data receiving module of the accelerator are respectively connected to the data exchange circuit.
[0091] The computing core group in the accelerator is used to perform at least one of matrix operations and vector operations. The sending-end accelerator performs data acceleration tasks and sends matrix data and / or vector data to the data exchange circuit through the data sending module. The receiving-end accelerator receives matrix data and / or vector data through the data receiving module and performs data acceleration tasks.
[0092] Take Transformer (GPT, LLaMa, Gemini, etc. are all transformer architecture models) as an example to illustrate the working principle of the architecture and system. The main calculations of Transformer are concentrated on attention calculations (attention) and linear layer calculations (linear).
[0093] 1. For long sequence linear calculation
[0094] For a sequence calculation O(k)=A(n)W(n,k), there are different parallel computing methods depending on the external topology, the number of AI acceleration devices (hereinafter referred to as devices) in the system, and the size of vectors and matrices.
[0095] It is convenient to perform parallel segmentation according to A. Assuming that the system has 4 devices and each device has a computing core group, there is (linear parallel acceleration 1):
[0096]
[0097]
[0098]
[0099]
[0100]
[0101] In this design, matrix multiplication is generally calculated by the MAC array, that is, the computing core group in the core group performs matrix operations for the MAC array. The four devices extract data through the DMA channel respectively, and then send and receive data after the pipeline operation is performed through the pipeline synchronization ring. The four devices are connected to the external switching circuit or switch at the same time, the purpose is to package and send data. This system is mainly used for multi-device collaborative execution of model acceleration tasks.
[0102] Of course, for pipeline topology or A sequence with a long segmentation, assuming the system has 2 devices, each with two computing core groups, then there is (linear parallel acceleration 2):
[0103]
[0104]
[0105]
[0106]
[0107]
[0108] The system structure corresponding to this solution is as follows Fig. 9 As shown in the figure, because the vector addition operation is completed by the (computing core group) vector computing core, and because there are two devices, the switch or switching circuit can be directly omitted, and the Sender of one device is directly connected to the Receiver of another device to achieve fast data interaction between devices.
[0109] 2. For attention calculation
[0110] for The algorithm can adopt the calculation principle of flash attention. When deployed based on this architecture, further optimization can be done on the data flow. Fig.10 It is an AI accelerator designed based on the flash attention computing principle. The core group is divided into two computing core groups. Each computing core group contains both matrix operations and vector operations. One of the computing core groups contains a MAC array execution The Vector computing core performs the calculation of m and d, while the other computing core group contains a MAC array to perform the multiplication matrix V calculation, and the Vector computing core performs the calculation of o. The algorithm only needs two computing core groups. In order to better simplify the system structure, other structures are omitted. Only the input and output of the two computing core groups are simultaneously connected to the pipeline synchronization ring to implement attention calculation. The main features of this structure are as follows:
[0111] The parameters are calculated directly on the MAC array without going through the multi-layer cache mechanism;
[0112] Data between computing core groups is transmitted through the pipeline synchronization system (composed of a single device or multiple devices with multiple layers of pipeline synchronization rings, senders, receivers, etc.), which can be transmitted without cache;
[0113] It can support larger computing core groups (with higher computing density), and the number of computing core groups that need to interact synchronously is reduced overall;
[0114] The setting of parallelism is based on computing core group resources, without considering cache size, to achieve optimal performance.
[0115] In summary, this system architecture has the following beneficial effects in AI model computing scenarios:
[0116] 1) In AI computing scenarios with large model parameters, especially when multiple devices need to collaborate and exchange data globally within the device, it can effectively reduce data synchronization delay and thus improve overall performance;
[0117] 2) This architecture has low cache requirements and can effectively reduce device area while maintaining computing power and DRAM storage capacity, thereby improving yield or increasing computing power density, both of which achieve the goal of cost savings;
[0118] 3) This architecture is scalable and has a nearly linear performance expansion as the number of devices in the system increases. Cluster deployment has a strong cost-effectiveness advantage, especially when the demand for large models becomes more and more widespread, which can reduce the TCO of data centers.
[0119] 4) This architecture has strong adaptability and has fewer restrictions on computing core group design and external connection method design, and can better bring into play the existing technical advantages of different designers.
[0120] The preferred embodiments of the present invention are described above; it should be understood that the present invention is not limited to the above-mentioned specific embodiments, and the devices and structures not described in detail should be understood to be implemented in a common manner in the art; any technician familiar with the art can make many possible changes and modifications without departing from the technical solution of the present invention, or modify them into equivalent embodiments with equivalent changes, which does not affect the essential content of the present invention; therefore, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of protection of the technical solution of the present invention.
Claims
1. An accelerator architecture for near IO pipeline computing, characterized in that: The accelerator includes a multi-channel direct access module, M computing core groups and a pipeline synchronization ring; wherein the M computing core groups are divided into N core group groups including the same or different numbers of core groups; The multi-channel direct access module includes N DRAM controllers, and the N DRAM controllers are connected to the external DRAMs in a one-to-one correspondence; each of the DRAM controllers is connected to at least K direct access storage DMA controllers, and is connected to the corresponding core group through the DMA controller, so that the data in the i-th DRAM is directly read to the i-th computing core group, and the result data output by the i-th computing core group is directly cached to the i-th DRAM; The pipeline synchronization ring is connected to N core groups, including M cascaded forward transmission blocks and M cascaded backward transmission blocks, and the output of the tail end forward transmission block is cascaded to the first backward transmission block; The i-th forward transmission block and the M-i+1-th backward transmission block correspond to each other and are connected to at least one computing core group; The forward transmission block includes a forward register, a forward receiving unit and a forward writing unit, and the backward transmission block includes a backward register and a backward writing receiving unit; the forward receiving unit receives the data input by the computing core group and sends it to the pipeline synchronization ring in a pipeline form, and the forward writing unit and the backward writing unit push the data to the target computing core group in a pipeline form; wherein M, N, K, i are positive integers.
2. The accelerator architecture for near IO pipeline computing according to claim 1, characterized in that: The multi-channel direct access module also includes a Switch arbiter, and the N DRAM controllers and the N core groups are respectively connected to the ports of the Switch arbiter through ports, and the data in the i-th DRAM is cross-read to the j-th core group, and the result data output by the j-th core group is cross-cached to the i-th DRAM; wherein i and j are different positive integers.
3. The accelerator architecture for near IO pipeline computing according to claim 2, characterized in that: The K DMA controllers and the computing core groups in the computing core group group are connected in a one-to-one, one-to-many, or many-to-one relationship.
4. The accelerator architecture for near IO pipeline computing according to claim 3, characterized in that: It also includes a data sending module and a data receiving module connected to the pipeline synchronization ring; the data sending module receives data output from the pipeline synchronization ring and sends the data out of the accelerator, and the data receiving module receives data sent from the outside, sends the data into the pipeline synchronization ring, and pushes it to the target computing core group in the core group group.
5. The accelerator architecture for near IO pipeline computing according to claim 1, characterized in that: The backward transmission block includes a backward register and P backward writing units cascaded forward and backward; P is a positive integer; The backward register is connected to the output end of the previous cascade transmission block to receive and store intermediate data; One output of the backward register is connected to the first backward write unit, and the data is pushed to the target backward write unit in a pipeline manner through the cascade structure. Another output is directly connected to the next cascade transmission block, and the intermediate data is pushed to the target transmission block in a pipeline manner.
6. The accelerator architecture for near IO pipeline computing according to claim 5, characterized in that: The first write registers in each backward write unit in the same backward transmission block are cascaded forward and backward, data is input through the backward registers, and the data is pushed to different forward write units in a pipeline manner; The backward writing unit includes at least Q write registers cascaded forward and backward, each write register is connected to a computing core group, and pushes data to the target computing core group in the forward writing unit in a pipeline form.
7. The accelerator architecture for near IO pipeline computing according to claim 1, characterized in that: The forward transmission block includes a forward FIFO buffer, a forward register, a P group of forward receiving units and a forward writing unit; P is a positive integer; P forward receiving units are cascaded front to back, and P forward writing units are cascaded front to back, and the forward writing units and forward receiving units in the same group are connected to the same computing core group; One input end of the forward FIFO buffer is connected to the output of the previous cascade transmission block to receive and store intermediate data, and the other input end is connected to the output of the tail-end forward receiving unit to receive data output from the tail-end forward receiving unit; The output of the forward FIFO buffer is connected to the forward register, and the output of the forward register is connected to the first forward write unit, so that the pipeline data is pushed to the target forward write unit through a cascade structure.
8. The accelerator architecture for near IO pipeline computing according to claim 7, characterized in that: The forward writing unit includes at least Q forward and backward cascaded writing registers, each writing register is connected to a computing core group, and the data is pushed to the target computing core group in the forward writing unit in a pipeline manner; The forward receiving unit includes at least Q receiving FIFO buffers cascaded forward and backward, each receiving FIFO buffer is connected to a computing core group, caches the intermediate data input by the computing core group, and sends the intermediate data to the pipeline synchronization ring layer by layer in a pipeline form.
9. The accelerator architecture for near IO pipeline computing according to claim 8, characterized in that: The first write registers in each forward write unit in the same forward transmission block are cascaded front and back, data is input through the forward registers, and the data is pushed to different forward write units in a pipeline form; The tail end receiving FIFO buffers in each forward receiving unit in the same forward transmission block are cascaded front and back, and the intermediate data input by different computing core groups are sent to the forward FIFO buffer layer by layer in a pipeline manner.
10. The accelerator architecture for near IO pipeline computing according to claim 8, characterized in that: In the i-th forward transmission block and the (M-i+1)-th backward transmission block, the forward writing unit and the backward writing unit in the same group have the same structure; In the same group of forward receiving units and forward writing units of the same forward transmission block, the numbers of registers and FIFO buffers are the same.
11. The accelerator architecture for near IO pipeline computing according to claim 8, characterized in that: The data pushed into the pipeline synchronization ring is provided with a bit identifier, and the forward transmission block and the backward transmission block determine the state and flow direction of the data based on the corresponding flag bit of the bit identifier; When the flag bit of the bit identifier indicates that the data is exhausted, the data is directly discarded; When the flag bit of the bit identifier indicates that the data is not exhausted, the data is sent to the write register layer by layer until it is pushed into the target computing core group.
12. An AI acceleration system, characterized in that: The system comprises at least two accelerators and a data exchange circuit as described in claim 1, at least two accelerators are respectively connected to a plurality of DRAMs, and a data sending module and a data receiving module connected to a pipeline synchronization ring are arranged inside the accelerator, and the data sending module and the data receiving module are respectively connected to the data exchange circuit; The computing core group in the accelerator is used to perform at least one of matrix operations and vector operations. The sending-end accelerator performs data acceleration tasks and sends matrix data and / or vector data to the data exchange circuit through a data sending module. The receiving-end accelerator receives matrix data and / or vector data through a data receiving module and performs data acceleration tasks.
Citation Information
Patent Citations
Hardware structure for realizing forward calculation of convolutional neural network
CN107066239A
Vector database-oriented hybrid acceleration architecture
CN117951346A
Control of sorting accelerator
JP1991129520A
Quasi-volatile memory device with a back-channel usage
US20200326889A1
Configuring and dynamically reconfiguring chains of accelerators
US20240126555A1
