Data processing method and structure of multi-core AI acceleration processor

CN115796233BActive Publication Date: 2024-10-18TAICHU (HANGZHOU) INTEGRATED CIRCUIT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111061730.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-10
Publication Date
2024-10-18
Estimated Expiration
2041-09-10

AI Technical Summary

Technical Problem

In the multi-core design of existing AI acceleration processors, due to the small cache, input feature maps and input weights need to be frequently read from the main memory, resulting in memory access bottlenecks and bandwidth competition, which reduces computing efficiency.

Method used

By setting up a core bus between multi-core AI acceleration processors and using the RMA broadcast communication method, the shared data of different cores are distributed and stored in their own caches. The shared data is only read once from the main memory, and is operated and calculated through asynchronous broadcast. Overlap to reduce memory access latency.

Benefits of technology

It greatly reduces the impact of main memory bottlenecks, reduces data access and bandwidth competition, and improves computing efficiency. The advantage of on-chip RMA communication bandwidth hides memory access delays and accelerates the overall computing process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115796233B_ABST
    Figure CN115796233B_ABST
Patent Text Reader

Abstract

The data processing method and structure of the multi-core AI acceleration processor of the present invention, wherein the multi-core AI acceleration processor has multiple cores, each core has an on-chip high-speed cache; a core bus is provided between the cores, and each core is connected to the core bus respectively; the data transmission mode between the cores is RMA broadcast communication, and when obtaining data, the input data is first obtained, including input features and input weights; a shared mark is set for the input features or input weights as shared data; the shared data is split into multiple shared data blocks according to the number of cores, and the shared data is distributed to multiple cores of the AI ​​processor, and each core obtains the shared data block from the main memory and broadcasts it to all cores. The method of the present invention sets a communication device between multiple cores, and through the inter-core communication mode of RMA broadcast, the data shared by different cores can be distributed and stored in the high-speed caches of different cores, and when calculating, the shared data is obtained from each core.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a data processing method of a processor, and in particular to a data processing method and structure of a multi-core AI acceleration processor. Background Art

[0002] In recent years, deep learning has developed rapidly, the models have gradually increased, and the requirements for computing performance have become higher and higher. Therefore, the development of high-performance and high-efficiency computing operators has become a hot spot for technological innovation. Deep learning operator optimization requires specific hardware architecture design, combined with software optimization methods, to match the operator's computing requirements with the hardware in order to achieve higher computing efficiency.

[0003] In order to reduce power consumption while achieving high computing performance, current AI acceleration processors mostly use multi-core designs. Multiple computing cores process data in parallel, and the design methods of their operators are divided into two categories according to the data division. Taking convolution calculation as an example, Figure 1 shows the following two methods:

[0004] 1. Divide the input feature map into data, such as Figure 1a As shown. This type of method divides the input feature image evenly to multiple cores for processing, and each core needs to read the entire input weight. This type of method is suitable for situations where the input weight is relatively small and the input feature image is relatively large.

[0005] 2. Divide the input weights into data, such as Figure 1b This method divides the input weights evenly among multiple cores for processing, and each core needs to read the entire input feature map. This method is suitable for situations where the input weights are large and the input feature map is small.

[0006] In the above two optimization design methods, multiple cores process independently and in parallel, respectively calculating a part of the output result and jointly completing the final calculation task.

[0007] In the above two operator optimization designs, different computing cores need to repeatedly read a large amount of data from the memory. The first method needs to repeatedly read the input weight data, while the second method needs to repeatedly read the input feature map data. These two methods have the following two main shortcomings:

[0008] 1. The existing AI acceleration processor has multiple computing cores. The cache of each core is relatively small and cannot accommodate the entire input feature map or input weight to be processed. Therefore, the input feature map and input weight are stored in the main memory. During the calculation process, a large amount of data needs to be continuously read from the main memory. The latency of the main memory is relatively high, which limits the overall computing efficiency.

[0009] 2. Regardless of the method, there are cases where multiple cores repeatedly read the same data. Repeated reading exacerbates the memory access bottleneck problem, which causes multiple cores to compete for limited main memory bandwidth resources, resulting in some cores being unable to obtain the required data in a timely manner, reducing computing efficiency. Summary of the invention

[0010] The present invention provides a data processing method for a multi-core AI acceleration processor, wherein a communication device is set between multiple cores, and the inter-core communication method of RMA broadcasting is used to enable data shared by different cores to be distributed and stored in the cache of different cores, and then the shared data is obtained from each core during calculation. Since the shared data only needs to be read from the main memory once, the data access amount of the main memory is reduced, and bandwidth competition is avoided, which greatly reduces the impact of the main memory bottleneck; since the on-chip RMA broadcast communication bandwidth of the chip is much higher than the memory bandwidth, and the broadcast operation can be performed asynchronously, overlapping with the calculation of the core, the memory access delay is greatly reduced, and the overall calculation process is accelerated.

[0011] The data processing method of the multi-core AI acceleration processor of the present invention comprises: the multi-core AI acceleration processor has multiple cores, each core has an on-chip cache; a core bus is provided between the cores, and each core is connected to the core bus respectively; the data transmission mode between the cores is RMA broadcast communication, and the data processing comprises the following steps in sequence:

[0012] S1. Obtain input data, where the input data includes: input features and input weights;

[0013] S2. Set a sharing mark for either the input feature or the input weight as shared data;

[0014] S3. Split the input features / input weights into multiple input feature blocks / input weight blocks, split the shared data into multiple shared data blocks, and sequence the shared data blocks according to the number of cores of the multi-core AI acceleration processor;

[0015] S4, distributing the shared data to multiple cores of the AI ​​processor according to the numbers, and each core obtains the corresponding shared data block according to the assigned data block number and stores it in the cache;

[0016] S5. At the beginning of each round of calculation, each core obtains the input feature block / input weight block required for calculation from the main memory. The core holding the shared data block number required for this round of calculation broadcasts the shared data block to all cores through RMA, and then performs calculation. After the calculation is completed, another core broadcasts the shared data block to all cores. After obtaining the shared data block, all cores perform calculation again. This continues until all shared data blocks have completed broadcasting and calculation, and partial calculation results are output.

[0017] S6. Each core calculates the input feature blocks / input weight blocks required for the next round of calculations, as well as the shared data block number, and repeats the S5 process until all input feature blocks / input weight blocks are traversed.

[0018] Preferably, in step S2, if the input feature is greater than the input weight, a sharing mark is set for the input weight; if the input feature is less than the input weight, a sharing mark is set for the input feature. The smaller of the two input data is selected as the shared data, which is conducive to the rapid broadcasting of the shared data block.

[0019] Preferably, in step S3, the shared data is evenly split into multiple shared data blocks. This splitting method has two main advantages: on the one hand, the shared data needs to be stored in the cache, and the cache space is limited, so it is necessary to minimize the size of the space occupied by the shared data in each core. Evenly splitting the shared data can minimize the impact of the shared data occupation on other data storage; on the other hand, in the subsequent broadcasting of shared data, the core that initiates the operation needs to perform relatively more additional operations, increasing the calculation delay of the core. Average splitting can make the subsequent data broadcast polling initiated, rather than concentrating on one or several cores, so as to evenly share the additional overhead.

[0020] More preferably, in step S3, the division of shared data blocks follows two optimization principles. First, the size of the shared data block is as much as possible an integer multiple of the size required for each round of calculation, so that each calculation only requires one RMA broadcast operation. If the block size is not appropriate, multiple RMA broadcast operations will be required, increasing additional time overhead. Second, the number of shared data blocks is as much as possible an integer multiple of the number of cores of the AI ​​acceleration processor, so that the RMA broadcast operation is evenly distributed to different cores, reducing the impact of the RMA broadcast operation on the computing tasks of a single core.

[0021] The data processing method of the multi-core AI acceleration processor of the present invention comprises: the multi-core AI acceleration processor has multiple cores, each core has an on-chip cache; a core bus is provided between the cores, and each core is connected to the core bus respectively; the data transmission mode between the cores is RMA broadcast communication, and the data processing comprises the following steps in sequence:

[0022] S1. Obtain input data, where the input data includes: input features and input weights;

[0023] S2. According to the calculation order, the input features are evenly divided into multiple input feature blocks, and the input feature blocks are sequenced; according to the calculation order, the input weights are evenly divided into multiple input weight blocks, and the input weight blocks are sequenced; the number of input feature blocks and input weight blocks is equal to the number of cores of the multi-core AI acceleration processor;

[0024] S3, each core of the multi-core AI acceleration processor obtains one input feature block and one input weight block respectively; the input feature block and the input weight block are stored in the on-chip cache of the core;

[0025] S4. Distribute the shared data equally to multiple cores of the AI ​​processor according to the numbers. Each core obtains the corresponding shared data block according to the assigned data block number and stores it in the cache.

[0026] S5. At the beginning of each round of calculation, each core obtains the input feature block / input weight block required for calculation from the main memory. The core holding the shared data block number required for this round of calculation broadcasts the shared data block to all cores through RMA, and then performs calculation. After the calculation is completed, another core broadcasts the shared data block to all cores. After obtaining the shared data block, all cores perform calculation again. This continues until all shared data blocks have completed broadcasting and calculation, and partial calculation results are output.

[0027] S6. Each core calculates the input feature blocks / input weight blocks required for the next round of calculations, as well as the shared data block number, and repeats the S5 process until all input feature blocks / input weight blocks are traversed.

[0028] Preferably, in step S4, if the input feature block numbered 1 is larger than the input weight block numbered 1, a sharing mark is set for the input weight block numbered 1; if the input feature block numbered 1 is smaller than the input weight block numbered 1, a sharing mark is set for the input feature block numbered 1. Selecting the smaller of the two input data blocks as the shared data block is conducive to the rapid broadcast of the shared data block and can also reduce the space occupied by the cache.

[0029] The data processing device of the multi-core AI acceleration processor of the present invention comprises a plurality of cores, each core is connected to a memory bus, the core obtains input data through the memory bus, and the core also outputs calculation results through the memory bus;

[0030] Each core has an on-chip high-speed cache; there is a core bus between the cores, and each core is connected to the core bus separately; the data transmission method between the cores is RMA broadcast communication. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1a An embodiment of a data processing method for an existing multi-core AI acceleration processor for processing convolution calculations

[0032] Figure 1b Another embodiment of the data processing method for the existing multi-core AI acceleration processor for processing convolution calculation

[0033] Figure 2An embodiment of the data processing method of the multi-core AI acceleration processor of the present invention for processing convolution calculation

[0034] Figure 3 Another embodiment of the data processing method of the multi-core AI acceleration processor of the present invention for processing convolution calculation

[0035] Figure 4 Schematic diagram of the data processing structure of the multi-core AI acceleration processor of the present invention DETAILED DESCRIPTION

[0036] In order to more clearly describe the data processing method and structure of the multi-core AI acceleration processor described in the present invention, further explanation is now provided in conjunction with the accompanying drawings.

[0037] like Figure 2 The figure shows a data processing method of a multi-core AI acceleration processor of the present invention, which is used to process convolution calculations in one embodiment.

[0038] The data processing method of the multi-core AI acceleration processor of the present invention, wherein the multi-core AI acceleration processor has 4 cores, each core has an on-chip high-speed cache; a core bus is provided between the cores, and each core is connected to the core bus respectively; the data transmission mode between the cores is RMA broadcast communication, and the data processing sequentially includes the following steps:

[0039] S1. Obtain input data, where the input data includes: input features and input weights;

[0040] S2. Compare the input feature and the input weight to obtain a result that the input feature is greater than the input weight. In order to facilitate the rapid broadcast of subsequent shared data blocks, select a smaller input weight as the shared data and set a shared mark for the input weight.

[0041] S3. The number of cores of the multi-core AI acceleration processor is obtained as 4, and the input features are evenly split into 4 input feature blocks. At the same time, the shared data is evenly split into 4 shared data blocks, and the shared data blocks are sequenced;

[0042] S4. Distribute the shared data to multiple cores of the AI ​​processor according to the numbers. Each core obtains the corresponding shared data block according to the assigned data block number and stores it in the cache. The four cores of the multi-core AI acceleration processor are core 1, core 2, core 3, and core 4. Core 1 obtains shared data block 1; core 2 obtains shared data block 2; core 3 obtains shared data block 3; core 4 obtains shared data block 4. The shared data obtained by the core is stored in the core's own cache.

[0043] S5. At the beginning of the first round, cores 1, 2, 3, and 4 obtain the input feature blocks 1, 2, 3, and 4 required for calculation from the main memory respectively. Core 1 broadcasts the shared data block 1 required for this round of calculation to all cores (including the core that initiates the broadcast) through RMA for calculation;

[0044] After the calculation is completed, core 2 broadcasts shared data block 2 to all cores. After obtaining the shared data block, all cores perform calculations again...;

[0045] Until core 4 broadcasts shared data block 4 to all cores, all cores perform calculations again after obtaining the shared data block.

[0046] At this point, all shared data blocks have completed the broadcast and calculation of this round; each core outputs part of the final result obtained by calculation.

[0047] S6: In this example, one round of calculation completes the entire task. If there are unfinished input feature blocks, each core calculates the input feature blocks required for the next round of calculation, as well as the shared input weight data block number, and repeats the S5 process until all input feature blocks are traversed.

[0048] like Figure 3 The figure shows another embodiment of the data processing method of the multi-core AI acceleration processor of the present invention, which is used to process convolution calculations.

[0049] The data processing method of the multi-core AI acceleration processor of the present invention, wherein the multi-core AI acceleration processor has four cores: core 1, core 2, core 3, and core 4, each core having an on-chip cache; a core bus is provided between the cores, and each core is connected to the core bus respectively; the data transmission mode between the cores is RMA broadcast communication, and the data processing sequentially includes the following steps:

[0050] S1. Obtain input data, where the input data includes: input features and input weights;

[0051] S2. Compare the input feature and the input weight, and obtain the result that the input feature is smaller than the input weight. In order to facilitate the rapid broadcast of the subsequent shared data block, select the smaller input feature as the shared data, and set a shared mark for the input feature;

[0052] S3. The number of cores of the multi-core AI acceleration processor is obtained as 4, and the input weight is evenly split into 4 input feature blocks. At the same time, the shared data is evenly split into 4 shared data blocks, and the shared data blocks are sequenced;

[0053] S4. Distribute the shared data to multiple cores of the AI ​​processor according to the numbers. Each core obtains the corresponding shared data block according to the assigned data block number and stores it in the cache. The four cores of the multi-core AI acceleration processor are core 1, core 2, core 3, and core 4. Core 1 obtains shared data block 1; core 2 obtains shared data block 2; core 3 obtains shared data block 3; core 4 obtains shared data block 4; the shared data obtained by the core is stored in the core's own cache.

[0054] S5. At the beginning of the first round, cores 1, 2, 3, and 4 obtain the input feature blocks 1, 2, 3, and 4 required for calculation from the main memory respectively. Core 1 broadcasts the shared data block 1 required for this round of calculation to all cores (including the core that initiates the broadcast) through RMA for calculation;

[0055] After the calculation is completed, core 2 broadcasts shared data block 2 to all cores. After obtaining the shared data block, all cores perform calculations again...;

[0056] Until core 4 broadcasts shared data block 4 to all cores, all cores perform calculations again after obtaining the shared data block.

[0057] At this point, all shared data blocks have completed the broadcast and calculation of this round; each core outputs part of the final result obtained by calculation.

[0058] S6: In this example, one round of calculation completes the entire task. If there are still unfinished input weight blocks, each core calculates the input weight blocks required for the next round of calculation, as well as the shared input feature data block number, and repeats the S5 process until all input weight blocks are traversed.

[0059] In the above step S5, the shared data block broadcast received by any core does not replace the shared data block originally stored in the on-chip cache of the core, and the core only performs calculations based on the received shared data block.

[0060] In the method described in the present invention, when the shared data (input features or input weights) are divided, they are distributed as evenly as possible in the caches of different cores. For example, the Taichu AI chip is a group of 32 cores, so the shared data can be distributed in the caches of 32 different cores. The amount of data stored in the cache of each core is relatively small, which does not affect the calculation process. The distribution process can be completed by the DMA (Direct Memory Access) engine provided by the Taichu AI chip.

[0061] like Figure 4As shown, the data processing device of the multi-core AI acceleration processor of the present invention includes multiple cores, each core is connected to a memory bus, the core obtains input data through the memory bus, and the core also outputs calculation results through the memory bus;

[0062] Each core has an on-chip high-speed cache; there is a core bus between the cores, and each core is connected to the core bus separately; the data transmission method between the cores is RMA broadcast communication.

[0063] The structure of the present invention utilizes the characteristics that different computing cores need to share the same data in the same computing stage, and uses RMA data broadcast between cores to fully utilize the high-speed RMA communication method provided by the AI ​​chip. Figure 4 As shown in the figure, initially, the four cores hold blocks 0, 1, 2, and 3 of the shared data respectively. During the calculation process, when shared data is needed, all slave cores will calculate the shared data block currently needed, and the core holding the shared data block will broadcast the data to all cores, including the core that initiated the broadcast. All cores continue to calculate after obtaining the shared data.

[0064] The present invention provides high-speed on-chip inter-core communication based on a multi-core design, and can complete data exchange between any cores in parallel through the RMA (Remote Memory Access) method. By setting a core bus between multiple cores and adopting the inter-core communication method of RMA broadcast, the data shared by different cores can be distributed and stored in the high-speed cache of different cores, and the shared data is obtained from each core during calculation. Since the shared data only needs to be read from the main memory once, the data access amount of the main memory is reduced, and the bandwidth competition is avoided, which greatly reduces the impact of the main memory bottleneck; since the on-chip RMA broadcast communication bandwidth of the chip is much higher than the memory bandwidth, and the broadcast operation can be performed asynchronously and overlapped with the calculation of the core, the memory access delay is greatly reduced, and the overall calculation process is accelerated.

[0065] Compared with the existing design methods, the present invention has the following advantages:

[0066] 1. Shared weights or input feature data are distributed in the cache, and shared data is read from the main memory only once before the first calculation. Each core reads different parts of the shared data only at the beginning of the calculation. Overall, shared data only needs to be read from the main memory once, while the original design method requires each core to read it once. Therefore, this design method greatly reduces the amount of data access to the memory, avoids memory bandwidth competition, and greatly reduces the impact of memory bottlenecks.

[0067] 2. The core holding the data broadcasts the data to all cores through RMA before each round of calculation, and can overlap with the calculation to achieve communication hiding. The on-chip RMA broadcast communication bandwidth of the AI ​​chip is much higher than the memory bandwidth, and the broadcast operation can be performed asynchronously, overlapping with the core calculation, further hiding the delay. Compared with reading data from the main memory, RMA broadcast greatly reduces the memory access delay and speeds up the overall calculation process.

[0068] The present invention makes full use of the high-speed on-chip inter-core communication characteristics to distribute the core-shared data in all core caches, and broadcasts the data through RMA when needed, which not only solves the problem of high data reading latency, but also greatly alleviates the memory access bottleneck problem and improves the overall computing efficiency.

Claims

1. A data processing method for a multi-core AI acceleration processor, It is characterized in that The multi-core AI acceleration processor has multiple cores, each of which has an on-chip cache controlled by user manual code. There is a core bus between the cores, and each core is connected to the core bus separately. The data transmission method between the cores is RMA broadcast communication. The data processing includes the following steps in sequence: S1. Obtain input data, where the input data includes: input features and input weights; S2. Set a sharing mark for either the input feature or the input weight as shared data; S3. Split the input features or input weights into multiple input feature blocks or input weight blocks, split the shared data into multiple shared data blocks, and sequence the shared data blocks according to the number of cores of the multi-core AI acceleration processor; S4, distributing the shared data to multiple cores of the AI ​​processor according to the numbers, and each core obtains the corresponding shared data block according to the assigned data block number and stores it in the cache; S5. At the beginning of each round of calculation, each core obtains the input feature block or input weight block required for calculation from the main memory. The core holding the shared data block number required for this round of calculation broadcasts the shared data block to all cores through RMA, and then performs calculation. After the calculation is completed, another core broadcasts the shared data block to all cores. After obtaining the shared data block, all cores perform calculation again. This continues until all shared data blocks have completed broadcasting and calculation, and partial calculation results are output. S6. Each core calculates the input feature blocks or input weight blocks required for the next round of calculation, as well as the shared data block number, and repeats the S5 process until all input feature blocks or input weight blocks are traversed.

2. The data processing method of the multi-core AI acceleration processor according to claim 1, It is characterized in that In step S2, if the input feature is greater than the input weight, a sharing flag is set for the input weight; if the input feature is less than the input weight, a sharing flag is set for the input feature.

3. The data processing method of the multi-core AI acceleration processor according to claim 1, It is characterized in that In step S3, the shared data is evenly divided into a plurality of shared data blocks.

4. The data processing method of the multi-core AI acceleration processor according to claim 3, It is characterized in that In step S3, the number of shared data splits is equal to the number of cores of the multi-core AI acceleration processor.

5. A data processing method for a multi-core AI acceleration processor, It is characterized in that The multi-core AI acceleration processor has multiple cores, each of which has an on-chip cache controlled by user manual code. There is a core bus between the cores, and each core is connected to the core bus separately. The data transmission method between the cores is RMA broadcast communication. The data processing includes the following steps in sequence: S1. Obtain input data, where the input data includes: input features and input weights; S2. According to the calculation order, the input features are evenly divided into multiple input feature blocks, and the input feature blocks are sequenced; according to the calculation order, the input weights are evenly divided into multiple input weight blocks, and the input weight blocks are sequenced; the number of input feature blocks and input weight blocks is equal to the number of cores of the multi-core AI acceleration processor; S3, each core of the multi-core AI acceleration processor obtains one input feature block and one input weight block respectively; the input feature block and the input weight block are stored in the on-chip cache of the core; S4, distributing the shared data to multiple cores of the AI ​​processor according to the numbers, and each core obtains the corresponding shared data block according to the assigned data block number and stores it in the cache; S5. At the beginning of each round of calculation, each core obtains the input feature block or input weight block required for calculation from the main memory. The core holding the shared data block number required for this round of calculation broadcasts the shared data block to all cores through RMA, and then performs calculation. After the calculation is completed, another core broadcasts the shared data block to all cores. After obtaining the shared data block, all cores perform calculation again. This continues until all shared data blocks have completed broadcasting and calculation, and partial calculation results are output. S6. Each core calculates the input feature blocks or input weight blocks required for the next round of calculation, as well as the shared data block number, and repeats the S5 process until all input feature blocks or input weight blocks are traversed.

6. The data processing method of the multi-core AI acceleration processor according to claim 5, It is characterized in that In step S4, if the input feature block numbered 1 is larger than the input weight block numbered 1, a shared mark is set for the input weight block numbered 1; if the input feature block numbered 1 is smaller than the input weight block numbered 1, a shared mark is set for the input feature block numbered 1.

7. A data processing device of a multi-core AI acceleration processor, an acceleration processor implementing the data processing method according to claim 1 or 5, comprising a plurality of cores, each core being connected to a memory bus, the core obtaining input data through the memory bus, and the core also outputting calculation results through the memory bus; It is characterized in that Each core has an on-chip cache controlled by user manual code; there is a core bus between the cores, and each core is connected to the core bus separately; the data transmission method between the cores is RMA broadcast communication.

Citation Information

Patent Citations

  • Complete mutual access method and system for multiple processors

    CN102110072A

  • Shared memory interface used for multi-core parallel video coding and decoding

    CN105323586A