A multi-core parallel computing method for neural network processors
Through the automatic allocation of neural network algorithms and data by hardware, multi-core parallel computing without software participation is realized, which solves the problem of high software scheduling overhead in multi-core processor systems in the existing technology, and improves the efficiency and ease of use of neural network accelerated calculations.
Patent Information
- Application Number
- CN202210649907.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-10
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-06-10
AI Technical Summary
When implementing neural network accelerated calculations in existing multi-core processor systems, the software scheduling overhead is high and the design is difficult. It lacks an efficient automatic hardware allocation mechanism, resulting in low computing efficiency and poor versatility.
Use hardware to implement multi-core parallel computing. By loading neural network algorithm binary data and data to be calculated into the memory, the calculation graph operations are automatically assigned to the processor cores to achieve parallel computing without software participation. Random matching strategies are used to ensure that all core task assignments are completed. .
Efficient and fast multi-core parallel computing is achieved, with high computing efficiency and low overhead, and the method is simple and easy to use, without the need to develop a dedicated software system.
Smart Images

Figure CN115034365B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a multi-core parallel computing method for a neural network processor, which can be used to implement accelerated computing of multiple identical or different neural network algorithms. Background Art
[0002] Neural network is one of the hot topics in the field of artificial intelligence. Neural network has undergone an important transformation from shallow neural network to deep neural network. Deep neural network improves its feature extraction and data fitting capabilities by increasing the depth of the model. Compared with shallow models, it has significant advantages in natural language processing, autonomous driving, image analysis and other problems. With the increase in the scale of training data and the increasing complexity of the model, the training cost of deep neural network is getting higher and higher. Parallelization has become an important technical means to enhance the timeliness of its application.
[0003] Existing neural network acceleration computing can be divided into two major types. One is to accelerate specific models, that is, the hardwareization of algorithms. This type can achieve higher performance and lower power consumption for specific algorithms, but it has poor versatility. Once the algorithm needs to be replaced, whether it is a performance upgrade or a functional improvement at the algorithm level, the hardware acceleration solution needs to be redesigned. Another type of neural network acceleration computing is software-defined neural network acceleration computing, that is, a general-purpose neural network processor. By decomposing the computing requirements of the neural network model, designing the instruction set, and then designing the neural network processor, neural network acceleration is achieved. This method has good versatility. Different neural network models are called by the application program, and different neural network models can be accelerated without changing the hardware design.
[0004] For general-purpose neural network processors, a multi-core system can be formed by calling multiple processor cores in the same system. Traditional multi-core processor systems implement multi-core parallel computing through software scheduling. This multi-core scheduling has a large software overhead and usually requires software personnel to develop multi-core parallel software systems, which is also difficult to design. Summary of the invention
[0005] The present invention proposes a multi-core parallel computing method for a multi-core neural network processor, which is used to realize the accelerated computing of multiple identical or different neural network algorithms. The multi-core parallel computing method is completely implemented in hardware, and the multi-core parallel computing process does not require software participation, nor does it require the development of dedicated parallel software. It has high computing efficiency, low computing overhead, fast computing speed, and the computing method is simple and easy to use.
[0006] To achieve the above object, the technical solution adopted by the present invention is:
[0007] A multi-core parallel computing method for a neural network processor comprises the following steps:
[0008] (1) loading binary data of N neural network algorithms into memory for use by N neural network processor cores, where N≥2; the binary data of the N neural network algorithms comes from the output results of the compiler supporting the neural network processor;
[0009] (2) Load N data to be calculated into the memory, each data to be calculated corresponds to a neural network processor core;
[0010] (3) Allocate the binary data of the N neural network algorithms stored in the memory to the N neural network processor cores. The strategy adopted in the allocation stage is as follows:
[0011] (3a) If all neural network algorithms have unfinished computations, each neural network algorithm takes one computation graph operation, a total of N computation graph operations are taken, and are respectively assigned to N neural network processor cores;
[0012] (3b) If K neural network algorithms have completed calculations, and N>K, then the remaining NK unfinished neural network algorithms each take a calculation graph operation and assign it to NK neural network processor cores; then determine whether there are any remaining neural network algorithms that have not completed calculations, and randomly take the calculation graphs of the remaining unfinished neural network algorithms and assign them to the unassigned neural network processor cores until all neural network processor cores are assigned to calculation tasks, or all calculation tasks are assigned;
[0013] Among them, the matching of computation graph operations and neural network processor cores is done in a random manner;
[0014] (4) After each assignment, the calculation phase is started. After all the calculations of the neural network processor cores are completed, new assignment tasks are performed;
[0015] (5) After all calculations are completed, release the resources, exit and return to the ok state.
[0016] Furthermore, in the allocation phase of step (3), each neural network processor core is allocated 1 to N neural network algorithms. After the allocation is completed, the relevant information of all neural network algorithms is stored in the designated memory space of each neural network processor core.
[0017] Furthermore, in the calculation phase of step (4), each neural network processor core automatically starts the calculation of the neural network algorithm. After the calculation of one neural network algorithm is completed, the neural network processor core automatically starts the calculation of the next assigned neural network algorithm.
[0018] Compared with the prior art, the present invention has the following advantages:
[0019] 1. The present invention has high calculation efficiency, low calculation cost, fast calculation speed and simple and easy-to-use calculation method.
[0020] 2. The multi-core parallel computing method of the present invention is completely implemented in hardware. The multi-core parallel computing process does not require software participation, nor does it require the development of dedicated parallel software. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A computational graph model of a neural network algorithm in an embodiment of the present invention;
[0022] Figure 2 A structure diagram of a neural network algorithm for multiple parallel calculations in an embodiment of the present invention;
[0023] Figure 3 This is a flowchart of multi-core parallel computing of a neural network algorithm in an embodiment of the present invention. DETAILED DESCRIPTION
[0024] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0025] A multi-core parallel computing method for neural network processors, in which the neural network model is processed by the compiler supporting the neural network processor to generate the corresponding neural network algorithm binary data; then, N neural network algorithm binary data are loaded into the memory. The neural network algorithm binary data contains all the information of the complete neural network algorithm; the N neural network algorithms are used by N neural network processor cores; the allocation of computing tasks is completely completed automatically by hardware without the participation of external software.
[0026] The neural network algorithm refers to the neural network calculation process described by the computational graph model. Figure 1 The figure shows a computational graph model of a neural network algorithm, where the input / output of the computational graph is tensor data, and the type of the computational graph represents the type of operation. The accelerated computing of the neural network algorithm refers to the neural network processor obtaining the input tensor in the computational graph model, implementing the computing function of the computational type corresponding to the computational graph, and calculating to obtain the output tensor result.
[0027] The above method can be implemented by a compiler module, a processor module, a controller module, and a memory module, wherein:
[0028] Compiler module, used to compile the neural network algorithm model into algorithm binary data;
[0029] Processor module, used to implement neural network algorithm calculation tasks;
[0030] A controller module, used to implement the allocation function of computing resources;
[0031] The memory module is used to store the binary data files of the neural network algorithm and the data to be calculated.
[0032] Reference Figure 2 The above method uses multiple neural network processor cores to complete the parallel calculation of multiple neural network algorithms at the same time.
[0033] Reference Figure 3 During the implementation, the processor module only processes binary data files, so the N neural network algorithms need to be sent to the compilation module for processing to generate corresponding N algorithm binary data. Each algorithm binary data contains all the information of a neural network algorithm (including configuration and parameters). Load the N data to be calculated and the N algorithm binary data into the memory module, where each neural network processor core corresponds to one data to be calculated. The distributor module distributes the N algorithms stored in the memory to the N neural network processor cores. The distribution strategy adopted is as follows:
[0034] a) If all algorithms have unfinished computations, each algorithm takes one computation graph operation, a total of N computation graph operations are taken and assigned to N neural network processor cores respectively;
[0035] b) If K algorithms have completed the calculation, the remaining NK unfinished algorithms each take a calculation graph operation and assign it to NK neural network processor cores. Then determine whether there are algorithms that have not completed the calculation, and randomly take the calculation graphs of the remaining unfinished algorithms and assign them to the unassigned neural network processor cores until all neural network processor cores are assigned calculation tasks or all calculation tasks are assigned;
[0036] Among them, the matching of computational graph operations and neural network processor cores is carried out in a random manner.
[0037] After the distributor module completes a distribution calculation, the processor module calls the corresponding algorithm binary data and the data to be calculated to start the calculation process based on the distribution result. After the calculation of all neural network processor cores is completed, a new calculation allocation task is performed. After all calculations are completed, the resources are released, the calculation is exited and the ok state is returned.
[0038] In this method, since the computation allocation can continuously write the information of the algorithm to be calculated into the designated memory space of each neural network processor core, each core can continuously calculate the algorithm without synchronization or external software intervention, with high computation efficiency, low computation overhead, fast computation speed and ease of use.
[0039] In summary, the present invention allocates multiple computing operations of multiple algorithms to multiple neural network processor cores through hardware automatic scheduling and allocation, and maximizes the use of multiple neural network processor core computing resources in each computing process, thereby improving computing performance. The allocation of computing tasks in the present invention is completely completed automatically by hardware without the participation of external software, so it has great ease of use.
Claims
1. A multi-core parallel computing method for a neural network processor, characterized in that: The steps include: (1) loading binary data of N neural network algorithms into memory for use by N neural network processor cores, where N≥2; the binary data of the N neural network algorithms comes from the output results of the compiler supporting the neural network processor; (2) Load N data to be calculated into the memory, each data to be calculated corresponds to a neural network processor core; (3) Allocate the binary data of the N neural network algorithms stored in the memory to the N neural network processor cores. The strategy adopted in the allocation stage is as follows: (3a) If all neural network algorithms have unfinished computations, each neural network algorithm takes one computation graph operation, a total of N computation graph operations are taken, and are respectively assigned to N neural network processor cores; (3b) If K neural network algorithms have completed calculations, and N>K, then the remaining NK unfinished neural network algorithms each take a calculation graph operation and assign it to NK neural network processor cores; then determine whether there are any remaining neural network algorithms that have not completed calculations, and randomly take the calculation graphs of the remaining unfinished neural network algorithms and assign them to the unassigned neural network processor cores until all neural network processor cores are assigned to calculation tasks, or all calculation tasks are assigned; Among them, the matching of computation graph operations and neural network processor cores is done in a random manner; (4) After each assignment, the calculation phase is started. After all the calculations of the neural network processor cores are completed, new assignment tasks are performed; (5) After all calculations are completed, release the resources, exit and return to the ok state.
2. The multi-core parallel computing method for a neural network processor according to claim 1, characterized in that: In the allocation phase of step (3), after the allocation is completed, all relevant information of the neural network algorithm is stored in the designated memory space of each neural network processor core.
3. The multi-core parallel computing method for a neural network processor according to claim 1, characterized in that: In the calculation phase of step (4), each neural network processor core automatically starts the calculation of the neural network algorithm. After the calculation of one neural network algorithm is completed, the neural network processor core automatically starts the calculation of the next assigned neural network algorithm.
Citation Information
Patent Citations
Method and device for reducing memory occupation, electronic equipment and readable storage medium
CN109491784A
Optimization method and device for deep learning network
CN112116081A
Multi-chip interconnection system and neural network acceleration processing method
CN113902111A
Generation of executable files corresponding to neural network models
US20200242189A1
Parallelization method and apparatus with processing of neural network model for manycore system
US20220129325A1
