Data calculation method and device based on neural network, and multi-core architecture chip

By dividing the computing kernel groups in the neural network and reassigning the computing amount, the problem of unbalanced computing kernel load is solved, the acceleration of neural network computing and efficient utilization of resources are achieved, and power consumption and bandwidth use are reduced.

CN113495866BActive Publication Date: 2024-12-20STREAM COMPUTING INC
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202010195190.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-19
Publication Date
2024-12-20
Estimated Expiration
2040-03-19

AI Technical Summary

Technical Problem

In neural networks, due to the difference in the calculation amount of each layer, the load of the computing core is unbalanced, resulting in wasted computing power and extended computing time.

Method used

By determining the calculation amount of each computing layer, dividing the calculation core groups, and reallocating the calculation amount, the calculation amount between multiple computing cores is equalized, ensuring that the calculation time of each computing core is equal.

Benefits of technology

Effectively balance the computing load of each computing core of multi-core chip, accelerate the calculation of neural network tasks, rationally utilize storage intervals, reduce external storage access, save bandwidth, improve performance and reduce power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113495866B_ABST
    Figure CN113495866B_ABST
Patent Text Reader

Abstract

The present invention provides a data calculation method and device based on a neural network, and a multi-core architecture chip. The method includes: determining the calculation amount of each calculation layer; dividing into at least one calculation core group according to the calculation amount of each calculation layer, the calculation core group includes multiple calculation cores of at least two calculation layers; reallocating the calculation amount of at least two calculation layers so that the calculation amount of the multiple calculation cores of the at least two calculation layers is balanced; and the calculation of the corresponding calculation layer is performed by the calculation core group. Thus, the calculation load of each calculation core of the multi-core chip is effectively balanced, the computing power of the entire chip is fully utilized, the calculation of the neural network calculation task is accelerated, and the storage interval of each calculation core can be effectively and reasonably utilized, the number of calculation cores used is reduced without reducing the computing power of the task, the chip access to external storage is reduced, bandwidth is saved, and performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data computing technology, and specifically relates to a data computing method based on a neural network, a data computing device based on a neural network, and a multi-core architecture chip. Background Art

[0002] Traditionally, such as Figure 1 As shown in Figure 1, in a neural network, such as a convolutional neural network (CNN), it generally includes multiple layers, such as an input layer, a convolutional layer, an activation function, a pooling layer, a fully connected layer, etc. In a convolutional neural network, data flows unidirectionally between layers, that is, Figure 1 As shown in the figure, the input data input passes through the first layer Layer1, the second layer Layer1 and finally the Nth layer LayerN, and finally the data is fully connected through the fully connected layer FC to obtain the output data Output. Each layer can contain multiple neural network operations, such as convolution, pooling, etc. For CNN, as the number of layers increases, the size of the feature map usually changes, the data and parameters of each layer also change, and the requirements for computing power are also different.

[0003] In order to realize the data calculation of each layer of the neural network, a chip with a multi-core architecture is generally used to perform data calculation. In a chip with a multi-core architecture, each core has a certain computing power and a relatively large in-core storage space, which is generally >128kB. These storage spaces are used to store their own programs, data, and weights. In order to maximize the computing power of the chip, accelerate computing, and save power consumption, chips with a multi-core architecture usually use on-chip storage intervals or in-core storage intervals to store programs, data, and weights of some or all layers, reducing data interaction between the chip and external memory (such as double data rate synchronous dynamic random access memory (DDRSDRAM)). Due to the limitation of the in-core storage space, one core usually cannot store the weights and data of a certain layer. To complete the operation of this layer of the network, multiple cores need to be used together to complete the operation of the entire layer.

[0004] In related technologies, the number of cores is generally allocated according to the current layer weight and the size of all data. Figure 2 As shown in Figure 1, each layer is calculated by multiple cores, and data is transmitted in one direction between layers. In this way, the calculation process of the entire neural network is divided into multiple layers, and then calculated layer by layer in a pipelined manner, such as Figure 3 shown.

[0005] exist Figure 3 In the figure, t1, t2, ... represent time periods allocated by pipeline levels. In each time period, input data is input to multiple cores Core_L1 in the first layer. In each time period, each layer completes related calculations and sends the calculation results to the next layer. Arrows represent the flow of data between layers. When data passes through all layers, it is output by multiple cores Core_LM in the last layer to obtain the final result (output1, output2).

[0006] However, in the above scheme, due to the difference in the amount of calculation required to be completed by each layer, some layers calculate very slowly and take a long time to complete the calculation, while some layers calculate quickly and take a short time to complete the calculation. In this way, due to the data dependency between layers, the cores of the layers that calculate quickly must stop and wait for the cores that calculate slowly after completing the calculation, resulting in a waste of the computing power of the cores of the layers that calculate quickly. Summary of the invention

[0007] The present invention aims to provide a data calculation method based on a neural network, a data calculation device based on a neural network and a multi-core architecture chip, which can effectively balance the calculation load of each calculation core of the multi-core chip and accelerate the calculation of neural network tasks.

[0008] In one aspect of the present invention, a data calculation method based on a neural network is provided, wherein the neural network includes a plurality of calculation layers, each of the calculation layers corresponds to at least one calculation core, and the method includes:

[0009] Determining the computational effort of each of the computational layers;

[0010] According to the computing amount of each computing layer, at least one computing core group is divided, wherein the computing core group includes a plurality of computing cores located in at least two computing layers;

[0011] reallocating the computing loads of the at least two computing layers so that the computing loads of the plurality of computing cores in the at least two computing layers are balanced;

[0012] The computing core group performs the calculation of the corresponding computing layer.

[0013] In some optional implementations, the reallocating the computational load of the at least two computing layers includes:

[0014] Splitting the computation amount of one of the at least two computation layers into sub-computation amounts equal in number to the number of layers of the at least two computation layers;

[0015] According to the computation amounts of the at least two computation layers, the sub-computation amounts are respectively distributed to the computation cores of the computation layers other than the one of the computation layers in the at least two computation layers.

[0016] In some optional implementations, the reallocating the computational load of the at least two computing layers includes:

[0017] The computation amount of each computing layer in the at least two computing layers is evenly divided into sub-computation amounts having a number equal to the number of layers of the at least two computing layers;

[0018] The sub-computation amounts are respectively distributed to the computing cores of the at least two computing layers.

[0019] In some optional implementations, the computation amount includes a computation data amount and a computation parameter amount, and the reallocation of the computation amounts of the at least two computation layers includes:

[0020] Reallocate the computing data amount and / or computing parameter amount of the multiple computing cores in the at least two computing layers.

[0021] In some optional implementations, different computing core groups correspond to different computing layers.

[0022] Another aspect of the present invention provides a data computing device based on a neural network, wherein the neural network includes a plurality of computing layers, each of the computing layers corresponds to at least one computing core, and the device includes:

[0023] A calculation module, used to determine the calculation amount of each calculation layer;

[0024] A partitioning module, used to partition at least one computing core group according to the computing amount of each computing layer, wherein the computing core group includes a plurality of computing cores located in at least two computing layers;

[0025] An allocation module, configured to reallocate the computing loads of the at least two computing layers so that the computing loads of the plurality of computing cores in the at least two computing layers are balanced;

[0026] The computing module is also used for the computing core group to execute the calculation of the corresponding computing layer.

[0027] In some optional implementations, the reallocating the computational load of the at least two computing layers includes:

[0028] The allocation module is specifically used for:

[0029] Splitting the computation amount of one of the at least two computation layers into sub-computation amounts equal in number to the number of layers of the at least two computation layers;

[0030] According to the computation amounts of the at least two computation layers, the sub-computation amounts are respectively distributed to the computation cores of the computation layers other than the one of the computation layers in the at least two computation layers.

[0031] In some optional implementations, the reallocating the computational load of the at least two computing layers includes:

[0032] The allocation module is specifically used for:

[0033] The computation amount of each computing layer in the at least two computing layers is evenly divided into sub-computation amounts having a number equal to the number of layers of the at least two computing layers;

[0034] The sub-computation amounts are respectively distributed to the computing cores of the at least two computing layers.

[0035] In some optional implementations, the computation amount includes a computation data amount and a computation parameter amount, and the reallocation of the computation amounts of the at least two computation layers includes:

[0036] The allocation module is used to reallocate the computing data volume and / or computing parameter volume of the multiple computing cores in the at least two computing layers.

[0037] In some optional implementations, different computing core groups correspond to different computing layers.

[0038] Another aspect of the present invention provides a multi-core architecture chip, including multiple computing cores, and the chip is used to execute the method described above.

[0039] Another aspect of the present invention provides an electronic device, comprising:

[0040] one or more calculators;

[0041] The storage unit is used to store one or more programs, and when the one or more programs are executed by the one or more computers, the one or more computers can implement the method described above.

[0042] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program can implement the method described above when executed by a computer.

[0043] Another aspect of the present invention provides a computer program, which can implement the method described above when executed by a computer.

[0044] The neural network-based data calculation method and device of the present invention first determine the calculation amount of each of the calculation layers, and then divide at least one calculation core group according to the calculation amount of each of the calculation layers, and the calculation core group includes multiple calculation cores of at least two calculation layers. After that, the calculation amount of the at least two calculation layers is redistributed so that the calculation amount of the multiple calculation cores in the at least two calculation layers is balanced. The present invention can effectively balance the calculation load of each calculation core of a multi-core chip, give full play to the computing power of the entire chip, and accelerate the calculation of neural network computing tasks. In addition, the storage interval of each calculation core can be effectively and reasonably utilized, effectively reducing the number of calculation cores used without reducing the computing power of the task, and can also effectively reduce the chip's access to external storage, save bandwidth, improve performance, and reduce power consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a structural diagram of the one-way flow of data in a neural network in the related technology;

[0046] Figure 2 A schematic diagram of the distribution of computing kernels in a neural network in the related art;

[0047] Figure 3 A schematic diagram of the computational pipeline of a computational kernel in a neural network in the related art;

[0048] Figure 4 A schematic diagram of the structure of an electronic device provided by the present invention;

[0049] Figure 5 A flowchart of a data calculation method based on a neural network provided by the present invention;

[0050] Figure 6 A schematic diagram of a computing core group provided by the present invention;

[0051] Figure 7a Schematic diagram of the distribution of kernels for related technologies;

[0052] Figure 7b A schematic diagram of the distribution of the computing cores provided by the present invention;

[0053] Figure 8a for Figure 7a The schematic diagram of the computing pipeline of the computing core shown;

[0054] Figure 8b for Figure 7b The schematic diagram of the computing pipeline of the computing core shown;

[0055] Fig. 9 A schematic diagram of the structure of a data computing device based on a neural network provided by the present invention. DETAILED DESCRIPTION

[0056] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0057] First, refer to Figure 4 An exemplary electronic device for implementing the apparatus and method of the embodiments of the present invention is described below.

[0058] like Figure 4 As shown, the electronic device 200 includes one or more processors 210, one or more storage devices 220, one or more input devices 230, one or more output devices 240, etc. These components are interconnected through a bus system 250 and / or other forms of connection mechanisms. It should be noted that Figure 4 The components and structures of the electronic device shown are merely exemplary and non-limiting. The electronic device may also have other components and structures as required.

[0059] The processor 210 can be a neural network processor composed of chips with a multi-core architecture, or it can be a separate central processing unit (CPU), or it can be a central processing unit + a multi-core neural network processor array or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and can control other components in the electronic device 200 to perform desired functions.

[0060] The storage device 220 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor may run the program instructions to implement the client functions (implemented by the processor) and / or other desired functions in the embodiments of the present invention described below. Various applications and various data may also be stored in the computer-readable storage medium, such as various data used and / or generated by the application.

[0061] The input device 230 may be a device used by a user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like.

[0062] The output device 240 may output various information (eg, images or sounds) to the outside (eg, a user), and may include one or more of a display, a speaker, and the like.

[0063] Next, we will refer to Figure 5 The data calculation method based on a neural network according to an embodiment of the present invention is described. The neural network includes multiple computing layers, such as a convolutional neural network, which generally includes an input layer, a convolution layer, an activation function, a pooling layer, a fully connected layer, etc. Each computing layer corresponds to at least one computing core. As described in the background technology section, due to the limitation of the storage space in the computing core, one computing core usually cannot store the weights and data of a certain layer. To complete the operation of this layer of the network, multiple computing cores need to be used together to complete the operation of the entire layer.

[0064] For example, Figure 5 As shown, a data calculation method S100 based on a neural network includes:

[0065] S110: Determine the computational effort of each computational layer.

[0066] Specifically, in this step, the amount of calculation of each calculation layer generally depends on the input data, intermediate data, output data, parameters (such as weight parameters and some other parameters), operation type and number of operations of the calculation layer, so the amount of calculation of each calculation layer can be determined by these data. Of course, in addition to this, those skilled in the art can also determine the amount of calculation of each calculation layer by other methods, and this embodiment does not specifically limit this.

[0067] S120. Divide at least one computing core group according to the computing amount of each computing layer, wherein the computing core group includes a plurality of computing cores located in at least two computing layers.

[0068] For example, Figure 6 As shown, according to the computation amount of each computing layer, it is divided into the following computing core groups:

[0069] Calculation core group (G_L1_L3), calculation core group (G_L2_L4) ... calculation core group (G_LI_LJ), calculation core group (G_LK_L(J-1)) ... calculation core group (G_LO_LP).

[0070] Among them, in each of the above computing core groups, the computing cores in each computing core group are from two computing layers, such as the computing cores in the computing core group (G_L1_L3) are from the computing cores of the first computing layer and the third computing layer.

[0071] It should be noted that the computing cores in the computing core group may include three or more computing layers. For example, the first computing core group may include computing cores of the first computing layer, the third computing layer, and the fifth computing layer, and so on. This embodiment does not limit this.

[0072] S130. Reallocate the computing load of the at least two computing layers so that the computing load of the multiple computing cores in the at least two computing layers is balanced.

[0073] Specifically, in this step, there is no specific limitation on how to redistribute the computing amount of the at least two computing layers, as long as the computing amount of the multiple computing cores in the at least two computing layers can be balanced. The balance of computing amount can be characterized, for example, as equal computing time, that is, in the at least two computing layers, the time consumed by one computing layer to complete the calculation is equal to the time consumed by another computing layer to complete the calculation. At this time, for example, the computing time of each computing core in the multiple computing cores in the at least two computing layers can be made equal. Of course, different processing times can also be set for the processing cores in the same layer. As long as the computing time of each layer is equal, the computing amount is balanced.

[0074] For example, assuming that the computational load of one computing layer is greater than that of another computing layer, a portion of the computational load of one computing layer can be allocated to the computing cores of the other computing layer, so that the computational loads of the computing cores in the two computing layers can be balanced. Of course, those skilled in the art can also adopt other allocation methods, and this embodiment does not limit this.

[0075] S140. The computing core group executes the calculation of the corresponding computing layer.

[0076] For example, Figure 6As shown, each computing core group will mix and calculate certain computing layers in the entire neural network corresponding to the computing core group, such as computing core group (G_L1_L3), which will calculate the data of the first computing layer and the third computing layer, and computing core group (G_L2_L4), which will calculate the data of the second computing layer and the fourth computing layer. When performing specific calculations, the computing core group (G_L1_L3) first performs calculations on the first computing layer, and sends the calculation results of the first computing layer to the computing core group (G_L2_L4). The computing core group (G_L2_L4) performs calculations on the second computing layer based on the calculation results of the first computing layer, and then resends the calculation results of the second computing layer to the computing core group (G_L1_L3). The computing core group (G_L1_L3) performs calculations on the third computing layer based on the calculation results of the second computing layer, and then resends the calculation results of the third computing layer to the computing core group (G_L2_L4). The computing core group (G_L2_L4) performs calculations on the fourth computing layer based on the calculation results of the third computing layer, and sends the calculation results of the fourth computing layer to the computing core group containing the fifth computing layer for subsequent calculations; and so on, the subsequent fusion adopts similar rules, but it is not necessarily only two layers of fusion, it may also be three layers or more layers of fusion. The data flow will pass through all the computing core groups, thereby completing the calculations of each layer of the entire neural network until the final result is obtained.

[0077] The neural network-based data calculation method of this embodiment first determines the calculation amount of each of the calculation layers, and then divides at least one calculation core group according to the calculation amount of each of the calculation layers, and the calculation core group includes multiple calculation cores of at least two calculation layers. After that, the calculation amount of the at least two calculation layers is redistributed so that the calculation amount of the multiple calculation cores in the at least two calculation layers is balanced. Therefore, the method of this embodiment can effectively balance the calculation load of each calculation core of a multi-core chip, give full play to the computing power of the entire chip, and accelerate the calculation of neural network computing tasks. In addition, the storage interval of each calculation core can be effectively and reasonably utilized, effectively reducing the number of calculation cores used without reducing the computing power of the task, and can also effectively reduce the chip's access to external storage, save bandwidth, improve performance, and reduce power consumption.

[0078] In some optional implementations, the reallocating the computational load of the at least two computing layers includes:

[0079] Splitting the computation amount of one of the at least two computation layers into sub-computation amounts equal in number to the number of layers of the at least two computation layers;

[0080] According to the computation amounts of the at least two computation layers, the sub-computation amounts are respectively distributed to the computation cores of the computation layers other than the one of the computation layers in the at least two computation layers.

[0081] Exemplarily, a computing core group includes multiple computing cores in two computing layers, such as a computing core group (G_L1_L3):

[0082] Combination Figure 6 In the computing core group (G_L1_L3), assuming that the computing amount of the first computing layer is 1M and the computing amount of the third computing layer is 500K, it is obvious that the computing amount of the first computing layer is greater than that of the third computing layer. In order to balance the computing amount of the computing cores in the two computing layers, the computing amount of the first computing layer is split into two sub-computation amounts, namely, the first sub-computation amount is 750K and the second sub-computation amount is 250K. At this time, the second sub-computation amount is allocated to the computing cores of the third computing layer, so that the computing amount of the third computing layer is 750K, that is, the computing cores in the third computing layer not only perform the original calculations, but also perform the calculations of the first computing layer. In this way, the computing amounts of the first and third computing layers are both 750K, so that the computing amounts of the computing cores of the first and third computing layers can be balanced, so that the computing time is also balanced, and there is no need to wait more for the calculations between each layer.

[0083] Exemplarily, a computing core group includes multiple computing cores in three computing layers, such as a computing core group (G_L1_L3 L5):

[0084] In the computing core group (G_L1_L3 L5), assuming that the computing amount of the first computing layer is still 1M, the computing amount of the third computing layer is 500K, and the computing amount of the fifth computing layer is 300K, it is obvious that the computing amount of the first computing layer is greater than that of the third and fifth computing layers. In order to balance the computing amount of the computing cores in the three computing layers, the computing amount of the first computing layer is split into three sub-computing amounts, namely, the first sub-computing amount is 600K, the second sub-computing amount is 100K, and the third sub-computing amount is 300K. At this time, the second sub-computing amount is allocated to the computing cores of the third computing layer, and the third sub-computing amount is allocated to the fifth computing layer, so that the computing amount of the computing cores in the first computing layer, the third computing layer, and the fifth computing layer can be balanced.

[0085] In some optional implementations, the reallocating the computational load of the at least two computing layers includes:

[0086] The computing task amount of each computing layer in the at least two computing layers is evenly divided into sub-computing amounts having a number equal to the number of layers of the at least two computing layers;

[0087] The sub-computation amounts are respectively distributed to the computing cores of the at least two computing layers.

[0088] Exemplarily, a computing core group includes multiple computing cores in two computing layers, such as a computing core group (G_L1_L3):

[0089] Combination Figure 6 , in the computing core group (G_L1_L3), assuming that the computing amount of the first computing layer is 1M and the computing amount of the third computing layer is 500K, the computing amount of the first computing layer is evenly divided into two sub-computation amounts, namely the first sub-computation amount of 500K and the second sub-computation amount of 500K. The computing amount of the third computing layer is evenly divided into two sub-computation amounts, namely the third sub-computation amount of 250K and the fourth sub-computation amount of 250K. At this time, the first sub-computation amount and the third sub-computation amount are allocated to the computing core of the first computing layer, and the second sub-computation amount and the fourth sub-computation amount are allocated to the computing core of the third computing layer. In this way, since the computing amount of the third computing layer increases, there is no need to wait for the calculation of the first computing layer because the calculation amount is small and the calculation is completed in advance, so the processing time of the first computing layer and the third computing layer is balanced, and the computing power is also balanced.

[0090] In some optional embodiments, the computing amount includes computing data amount and computing parameter amount, and the reallocation of the computing amount of the at least two computing layers includes reallocating the computing parameter amounts of the multiple computing cores in the at least two computing layers.

[0091] Exemplarily, a computing core group includes multiple computing cores in two computing layers, such as a computing core group (G_L1_L3):

[0092] like Figure 6 As shown in the figure, in the computing core group (G_L1_L3), the parameters of the first computing layer and the third computing layer (such as weight parameters and other parameters) are evenly split, and the computing data does not need to be split. In other words, in this distribution method, each computing core needs to receive the complete input data and the split parameters. At this time, the output of each computing core is part of the total output, and the complete output can be obtained by merging the partial outputs together.

[0093] In addition, in some optional implementations, the reallocation of the computing amount of the at least two computing layers further includes reallocating the computing data amount and computing parameter amount of the multiple computing cores in the at least two computing layers.

[0094] Exemplarily, the description is still made by taking the computing core group including multiple computing cores in two computing layers as an example, such as the computing core group (G_L1_L3):

[0095] like Figure 6As shown in the figure, in the computing core group (G_L1_L3), the input data and parameters (such as weight parameters and other parameters) of the first computing layer and the third computing layer are evenly split. That is to say, in this distribution method, each computing core needs to receive the split input data and split parameters. At this time, the output of each computing core is part of the total output, and the complete output can be obtained by merging the partial outputs together.

[0096] In some optional implementations, different computing core groups correspond to different computing layers.

[0097] For example, Figure 6 As shown, the computing layers corresponding to the computing core group (G_L1_L3) are the first computing layer and the third computing layer. The computing layers corresponding to the computing core group (G_L2_L4) are the second computing layer and the fourth computing layer. The computing layers corresponding to the computing core group (G_LI_LJ) are the I computing layer and the J computing layer. The computing layers corresponding to the computing core group (G_LK_L(J-1) are the K computing layer and the J-1 computing layer. The computing layers corresponding to the computing core group (G_LO_LP) are the O computing layer and the P computing layer.

[0098] The following will take a simple two-layer network running on a multi-core chip consisting of two cores as an example.

[0099] like Figure 7a and 7b As shown in the figure, if each computing core has an internal storage area of ​​512KB, all the data (including input data, intermediate data and output data of the first layer) and parameters (including weight parameters and other parameters) of the first computing layer of the neural network are 128KB, and the time required to complete the calculation of this computing layer is 1M clocks; all the data and parameters of the second computing layer are 512KB, and the time required to complete the calculation of this computing layer is 500K clocks.

[0100] exist Figure 7a In the traditional data computing method, each computing layer is in a separate computing core. Figure 7b In the data calculation method of the present invention, the two layers are fused together, and the storage and calculation are evenly distributed in the two computing cores. There may be data interaction between the two fused computing cores, because in some operations of the neural network, part or all of the results of the calculation of the previous layer may be used by the part of the latter layer in the two computing cores. Figure 7b The dotted line between the two cores in represents the path of data.

[0101] In the present invention, before the fusion of the computing layer is performed, the fusion scheme needs to be determined. Different fusion schemes may have different parameters assigned to the two computing cores, and the input data and intermediate data may also be different. For example, some fusion schemes only need to divide the parameters equally, and each computing core needs to accept the complete input data. The output of each computing core is part of the total output. Only by combining the two partial outputs together can the complete output be obtained; some fusion schemes need to divide both data and parameters equally, and each computing core only accepts part of the input, and the output of each computing core is also only part of the total output. Only by summing the two partial outputs can the complete output be obtained.

[0102] Regardless of the fusion solution, the utilization rate of all computing cores can be improved in the end. The calculation flow of the new and old solutions is compared as follows: Figure 8a and Figure 8b As shown:

[0103] like Figure 8a As described above, in the traditional solution, the computing core Core_2 will have a long period of idle time waiting for the work of the computing core Core_1 to be completed, so the number of clocks in each stage of the pipeline is 1M, that is, when the task pipeline is started, it is equivalent to 1M clks to get one output.

[0104] like Figure 8b As shown, in the present invention, computing core Core_1 and computing core Core_2 are divided into a computing core group, in which the storage and computing of computing core Core_1 and computing core Core_2 are rearranged, and both computing cores have a relatively average computing amount, which is equivalent to evenly distributing the total computing amount to each computing core, and no computing core will have idle waiting time, so the number of clocks clk in each level of pipeline is 750K, that is, when the task is pipelined, it is equivalent to 750K clks to get one output, which greatly speeds up the completion of the task.

[0105] Another aspect of the present invention, as Fig. 9 As shown, a data computing device 100 based on a neural network is provided, wherein the neural network includes multiple computing layers, and each computing layer corresponds to at least one computing core. The device 100 can be applied to the method described above. For specific contents not mentioned in the following device, reference can be made to the relevant records described above, and no further description is given here. The device 100 includes:

[0106] A calculation module 110, used to determine the calculation amount of each of the calculation layers;

[0107] A division module 120, configured to divide at least one computing core group according to the computing amount of each computing layer, wherein the computing core group includes a plurality of computing cores of at least two computing layers;

[0108] An allocating module 130, configured to reallocate the computing loads of the at least two computing layers so that the computing loads of the plurality of computing cores in the at least two computing layers are balanced;

[0109] The computing module 110 is also used for the computing core group to perform the calculation of the corresponding computing layer.

[0110] The data computing device based on a neural network of this embodiment first determines the computing amount of each of the computing layers, and then divides at least one computing core group according to the computing amount of each of the computing layers, and the computing core group includes multiple computing cores of at least two computing layers. After that, the computing amount of the at least two computing layers is redistributed so that the computing amount of the multiple computing cores in the at least two computing layers is balanced. Therefore, the device of this embodiment can effectively balance the computing load of each computing core of a multi-core chip, give full play to the computing power of the entire chip, and accelerate the calculation of neural network computing tasks. In addition, the storage interval of each computing core can be effectively and reasonably utilized, effectively reducing the number of computing cores used without reducing the computing power of the task, and can also effectively reduce the chip's access to external storage, save bandwidth, improve performance, and reduce power consumption.

[0111] In some optional implementations, the reallocating the computational load of the at least two computing layers includes:

[0112] The allocation module 130 is specifically used for:

[0113] Splitting the computation amount of one of the at least two computation layers into sub-computation amounts equal in number to the number of layers of the at least two computation layers;

[0114] According to the computation amounts of the at least two computation layers, the sub-computation amounts are respectively distributed to the computation cores of the computation layers other than the one of the computation layers in the at least two computation layers.

[0115] In some optional implementations, the reallocating the computational load of the at least two computing layers includes:

[0116] The allocation module 130 is specifically used for:

[0117] The computation amount of each computing layer in the at least two computing layers is evenly divided into sub-computation amounts having a number equal to the number of layers of the at least two computing layers;

[0118] The sub-computation amounts are respectively distributed to the computing cores of the at least two computing layers.

[0119] In some optional implementations, the computation amount includes a computation data amount and a computation parameter amount, and the reallocation of the computation amounts of the at least two computation layers includes:

[0120] The allocation module 130 is used to reallocate the computing data volume and / or computing parameter volume of the multiple computing cores in the at least two computing layers.

[0121] In some optional implementations, different computing core groups correspond to different computing layers.

[0122] Another aspect of the present invention provides a multi-core architecture chip, including multiple computing cores, and the chip is used to execute the method described above.

[0123] The multi-core architecture chip of this embodiment can be used to execute the method described above, and can effectively balance the computing load of each computing core of the multi-core chip, give full play to the computing power of the entire chip, and accelerate the calculation of neural network computing tasks. In addition, the storage interval of each computing core can be effectively and reasonably utilized, effectively reducing the number of computing cores used without reducing the computing power of the task, and can also effectively reduce the chip access to external storage, save bandwidth, improve performance, and reduce power consumption.

[0124] Another aspect of the present invention provides an electronic device, comprising:

[0125] one or more processors;

[0126] A storage unit is used to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors can implement the method described above.

[0127] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program can implement the method described above when executed by a processor.

[0128] The computer-readable medium may be included in the apparatus, device, or system of the present invention, or may exist independently.

[0129] Among them, computer readable storage media can be any tangible media that contains or stores a program, which can be an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment. More specific examples include, but are not limited to: a portable computer disk, hard disk, optical fiber, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.

[0130] The computer-readable storage medium may also include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code, specific examples of which include but are not limited to electromagnetic signals, optical signals, or any suitable combination thereof.

[0131] Another aspect of the present invention provides a computer program, which can implement the method described above when executed by a processor.

[0132] It is understandable that a computer program can be stored in a computer storage medium, such as the random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), etc. mentioned above.

[0133] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.

Claims

1. A data calculation method based on a neural network, wherein the neural network comprises a plurality of calculation layers, each of the calculation layers corresponds to at least one calculation core, It is characterized in that The method comprises: Determining the computational effort of each of the computational layers; According to the computing amount of each computing layer, at least one computing core group is divided, wherein the computing core group includes a plurality of computing cores located in at least two computing layers; reallocating the computing loads of the at least two computing layers so that the computing loads of the plurality of computing cores in the at least two computing layers are balanced; The computing core group performs the calculation of the corresponding computing layer; The reallocating the computational load of the at least two computing layers comprises: Splitting the computation amount of one of the at least two computation layers into sub-computation amounts equal in number to the number of layers of the at least two computation layers; According to the computational load of the at least two computational layers, the sub-computational loads are respectively distributed to the computational cores of the at least two computational layers, so as to balance the computational loads of the multiple computational cores in the at least two computational layers.

2. A data calculation method based on a neural network, wherein the neural network comprises a plurality of calculation layers, each of the calculation layers corresponds to at least one calculation core, It is characterized in that The method comprises: Determining the computational effort of each of the computational layers; According to the computing amount of each computing layer, at least one computing core group is divided, wherein the computing core group includes a plurality of computing cores located in at least two computing layers; reallocating the computing loads of the at least two computing layers so that the computing loads of the plurality of computing cores in the at least two computing layers are balanced; The computing core group performs the calculation of the corresponding computing layer; The reallocating the computational load of the at least two computing layers comprises: The computation amount of each computing layer in the at least two computing layers is evenly divided into sub-computation amounts having a number equal to the number of layers of the at least two computing layers; The sub-computation amounts are respectively distributed to the computing cores of the at least two computing layers, so that the computing amounts of the multiple computing cores in the at least two computing layers are balanced.

3. The method according to claim 1 or 2, It is characterized in that The amount of calculation includes an amount of calculation data and an amount of calculation parameters, and the reallocation of the amount of calculation of the at least two calculation layers includes: Reallocate the computing data amount and / or computing parameter amount of the multiple computing cores in the at least two computing layers.

4. The method according to claim 1 or 2, It is characterized in that Different computing core groups correspond to different computing layers.

5. A data computing device based on a neural network, wherein the neural network comprises a plurality of computing layers, each of the computing layers corresponds to at least one computing core, It is characterized in that The device comprises: A calculation module, used to determine the calculation amount of each calculation layer; A partitioning module, used to partition at least one computing core group according to the computing amount of each computing layer, wherein the computing core group includes a plurality of computing cores located in at least two computing layers; An allocation module, configured to reallocate the computing loads of the at least two computing layers so that the computing loads of the plurality of computing cores in the at least two computing layers are balanced; The computing module is further configured to execute the computing of the corresponding computing layer by the computing core group; The reallocating the computational load of the at least two computing layers comprises: The allocation module is specifically used for: Splitting the computation amount of one of the at least two computation layers into sub-computation amounts equal in number to the number of layers of the at least two computation layers; According to the computational load of the at least two computational layers, the sub-computational loads are respectively distributed to the computational cores of the at least two computational layers, so as to balance the computational loads of the multiple computational cores in the at least two computational layers.

6. A data computing device based on a neural network, wherein the neural network comprises a plurality of computing layers, each of the computing layers corresponds to at least one computing core, It is characterized in that The device comprises: A calculation module, used to determine the calculation amount of each calculation layer; A partitioning module, used to partition at least one computing core group according to the computing amount of each computing layer, wherein the computing core group includes a plurality of computing cores located in at least two computing layers; An allocation module, configured to reallocate the computing loads of the at least two computing layers so that the computing loads of the plurality of computing cores in the at least two computing layers are balanced; The computing module is further configured to execute the computing of the corresponding computing layer by the computing core group; The reallocating the computational load of the at least two computing layers comprises: The allocation module is specifically used for: The computation amount of each computing layer in the at least two computing layers is evenly divided into sub-computation amounts having a number equal to the number of layers of the at least two computing layers; The sub-computation amounts are respectively distributed to the computing cores of the at least two computing layers, so that the computing amounts of the multiple computing cores in the at least two computing layers are balanced.

7. A multi-core architecture chip, comprising a plurality of computing cores, It is characterized in that The chip is used to execute the method according to any one of claims 1 to 4.

8. An electronic device, It is characterized in that include: one or more processors; A storage unit, used to store one or more programs, which, when executed by the one or more processors, enable the one or more processors to implement the method according to any one of claims 1 to 4.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 4 can be implemented.

Citation Information

Patent Citations

  • BP neural network parallelization method for multi-core computing environment

    CN106909971A

  • Data processing method, apparatus and device

    CN108958938A

  • Task splitting device and method, task processing device and method, and multi-core processor

    CN109426553A

  • Methods and apparatus for deep learning network execution pipeline on multi-processor platform

    CN110462602A

  • Method for realizing neural network model splitting by using multi-core processor and related product

    CN110633153A