Data processing method, processor, chip and electronic device
By exchanging data and parallel computing between multiple computing cores, the problem of partial data incompleteness caused by depth-direction segmentation is solved, efficient data processing and computing resource utilization is achieved, and computing time and storage space are used.
Patent Information
- Application Number
- CN202110184423.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-08
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-02-08
AI Technical Summary
In the process of large-scale network data processing, the calculation results of multiple parts of the data caused by the segmentation of the depth direction are incomplete, and further addition is required to obtain the final summing result, resulting in waste of computing resources and increased data transmission delay.
Data exchange and parallel operations are performed between multiple computing cores, and convolutional operations are performed using the split weight data, processing data or part and data, ensuring that each computing core stores and processes complete data, thereby realizing parallel computing Exchange with data to reduce waste of computing resources and data transmission.
Effectively balance computing resources, give full play to the computing effectiveness of each computing core, improve data processing efficiency, reduce computing time and storage space usage, and reduce routing transmission delay.
Smart Images

Figure CN112801278B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information processing technology, and in particular to a data processing method, a processor, a chip, and an electronic device. Background Art
[0002] In the process of segmenting large-scale network data and mapping it to many cores, the input image data is split in the depth direction, resulting in multiple incomplete calculation results. These multiple partial data need to be further added to get the final sum result. The multiple partial data caused by depth segmentation are called partial sums. When the input image of a layer is not split, but the number of convolution kernels is grouped, the convolution calculation result output to the next layer is equivalent to segmentation in the depth direction, and partial sums will also be introduced in the calculation of the next layer. Summary of the invention
[0003] In view of this, the present disclosure proposes a data processing method, a processor, a chip, and an electronic device.
[0004] According to one aspect of the present disclosure, a data processing method is provided, the method is applied to a computing core of a processor, the processor includes multiple computing cores, the method implements a convolution operation of processing data and weight data; the method includes: data exchange between multiple computing cores; each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result; according to the parallel operation result of each computing core, the convolution operation result of the processing data and the weight data is determined; wherein the data for data exchange includes one of the segmented weight data, the segmented processing data and the partial sum data, and the partial sum data is the convolution operation result obtained based on the segmented processing data or the segmented weight data.
[0005] In a possible implementation, the data to be exchanged includes the weight data after segmentation, or the processed data after segmentation; the weight data or the processed data is segmented into n parts; the data exchange between the multiple computing cores includes: n-1 rounds of data exchange between the n computing cores, so that after the n-1 rounds of data exchange, each computing core has stored each of the n parts of weight data, or each of the n parts of processed data;
[0006] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in the current round of data exchange and the stored processing data, or performs a convolution operation based on one portion of processing data received in the current round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain a parallel operation result of the computing core;
[0007] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0008] In a possible implementation, the data to be exchanged includes the segmented weight data, the weight data is segmented into n parts in the depth direction, the multiple computing cores include n computing cores, each computing core stores processing data and one weight data of the n weight data in an initial state, and the weight data stored in each computing core in an initial state is different; wherein n is an integer;
[0009] The multiple computing cores exchange data, including: each computing core performs a convolution operation on the processed data and one weight data stored in the initial state, and then performs n-1 rounds of data exchange among the n computing cores, and in each round of data exchange, each computing core exchanges the one weight data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data;
[0010] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in the current round of data exchange and the stored processing data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the parallel operation result of the computing core;
[0011] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0012] In a possible implementation, the data to be exchanged includes segmented processed data, the processed data is segmented into n parts in a depth direction, the multiple computing cores include n computing cores, each computing core stores weighted data and one of the n processed data in an initial state, and each computing core stores different processed data in an initial state;
[0013] Data exchange is performed between multiple computing cores, including: each computing core performs a convolution operation on the weight data stored in the initial state and 1 processing data, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges the 1 processing data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n processing data; wherein n is an integer;
[0014] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one piece of processed data received in the current round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the parallel operation result of the computing core;
[0015] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0016] In a possible implementation, the data to be exchanged includes partial sum data, the multiple computing cores include n computing cores, each computing core stores n copies of the partial sum data, and the multiple computing cores perform data exchange, including: exchanging the partial sum data between the n computing cores, so that after the exchange, the partial sum data stored in each computing core corresponds to the same row segment or the same column segment of the processed data;
[0017] Each computing core performs parallel operations based on the exchanged data to obtain parallel operation results, including: each computing core adds the partial sum data obtained after the data exchange to obtain the convolution operation result of the partial processing data and the weight data, and the partial processing data is obtained after the processing data is divided into n parts in the row direction or the column direction.
[0018] According to another aspect of the present disclosure, a processor is provided, the processor comprising a plurality of computing cores, the processor implementing a convolution operation of processing data and weight data, including: data exchange between the plurality of computing cores; each computing core performing a parallel operation based on the exchanged data to obtain a parallel operation result; determining a convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core; wherein the data for data exchange comprises one of the segmented weight data, the segmented processing data and partial sum data, and the partial sum data is a convolution operation result obtained according to the segmented processing data or the segmented weight data.
[0019] In a possible implementation, the data to be exchanged includes the weight data after segmentation, or the processed data after segmentation; the weight data or the processed data is segmented into n parts;
[0020] The multiple computing cores exchange data, including: performing n-1 rounds of data exchange between the n computing cores, so that after the n-1 rounds of data exchange, each computing core has stored each of the n weight data or each of the n processing data;
[0021] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in the current round of data exchange and the stored processing data, or performs a convolution operation based on one portion of processing data received in the current round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain a parallel operation result of the computing core;
[0022] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0023] In a possible implementation, the data to be exchanged includes the segmented weight data, the weight data is segmented into n parts in the depth direction, the multiple computing cores include n computing cores, each computing core stores processing data and one weight data of the n weight data in an initial state, and the weight data stored in each computing core in an initial state is different; wherein n is an integer;
[0024] The multiple computing cores exchange data, including: each computing core performs a convolution operation on the processed data and one weight data stored in the initial state, and then performs n-1 rounds of data exchange among the n computing cores, and in each round of data exchange, each computing core exchanges the one weight data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data;
[0025] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in the current round of data exchange and the stored processing data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the parallel operation result of the computing core;
[0026] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0027] In a possible implementation, the data to be exchanged includes segmented processed data, the processed data is segmented into n parts in a depth direction, the multiple computing cores include n computing cores, each computing core stores weighted data and one of the n processed data in an initial state, and each computing core stores different processed data in an initial state;
[0028] Data exchange is performed between multiple computing cores, including: each computing core performs a convolution operation on the weight data stored in the initial state and 1 processing data, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges the 1 processing data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n processing data; wherein n is an integer;
[0029] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one piece of processed data received in the current round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the parallel operation result of the computing core;
[0030] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0031] In a possible implementation, the data to be exchanged includes partial sum data, the multiple computing cores include n computing cores, each computing core stores n copies of the partial sum data, and the multiple computing cores perform data exchange, including: exchanging the partial sum data between the n computing cores, so that after the exchange, the partial sum data stored in each computing core corresponds to the same row segment or the same column segment of the processed data;
[0032] Each computing core performs parallel operations based on the exchanged data to obtain parallel operation results, including: each computing core adds the partial sum data obtained after the data exchange to obtain the convolution operation result of the partial processing data and the weight data, and the partial processing data is obtained after the processing data is divided into n parts in the row direction or the column direction.
[0033] According to another aspect of the present disclosure, an artificial intelligence chip is provided, wherein the chip includes the processor as described above.
[0034] According to another aspect of the present disclosure, an electronic device is provided, comprising the artificial intelligence chip as described above.
[0035] By exchanging data between multiple computing cores, each computing core performs parallel operations based on the exchanged data to obtain parallel operation results, which can balance the computing resources of each computing core, give full play to the computing effectiveness of each computing core, and improve data processing efficiency. Among them, the data for data exchange can be the weight data after segmentation or the processing data after segmentation. By exchanging the weight data after segmentation or the processing data after segmentation, the data capacity of the weight data after segmentation or the processing data after segmentation can be flexibly selected to exchange the smaller one, thereby reducing the memory space occupied by the computing data cache on the chip and reducing the amount of data transmitted by routing. The data for data exchange can also be partial sum data. Multiple computing cores can calculate the partial sum in parallel and synchronously, which can improve the calculation speed and save calculation time.
[0036] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0038] Figure 1 A schematic diagram showing a processor structure according to an embodiment of the present disclosure;
[0039] Figure 2 A schematic diagram showing a partial sum operation in a convolution operation process using a step-by-step summation method in the related art;
[0040] Figure 3 A schematic diagram showing the calculation of convolution kernel grouping in weight data in the related art;
[0041] Figure 4 A flowchart showing a data processing method according to an embodiment of the present disclosure;
[0042] Figure 5 A schematic diagram showing a convolution operation performed by exchanging weight data according to an embodiment of the present disclosure;
[0043] Figure 6 A schematic diagram showing a weight data exchange method according to an embodiment of the present disclosure.
[0044] Figure 7 A schematic diagram showing part and data parallel operations according to an embodiment of the present disclosure;
[0045] Figure 8 A schematic diagram showing a portion and data parallel exchange according to an embodiment of the present disclosure;
[0046] Fig. 9 is a block diagram showing an electronic device according to an embodiment of the present disclosure;
[0047] Fig.10 is a block diagram illustrating an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0048] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0049] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0050] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0051] Figure 1 A schematic diagram of a processor according to an embodiment of the present disclosure is shown. The data processing method according to an embodiment of the present disclosure is used for a computing core of a processor, and the processor includes multiple computing cores.
[0052] In one possible implementation, Figure 1 As shown, the computing core includes a processing unit and a storage unit. The processing unit may include a dendrite unit, an axon unit, a cell body unit, and a routing unit. The storage unit may include multiple storage units.
[0053] In one possible implementation, multiple processors can be integrated into a brain-like computing chip, which is a neuromorphic circuit that integrates storage and computing. It uses the processing mode of the brain as a reference and simulates the transmission and processing of information by neurons in the brain to improve processing efficiency and reduce power consumption. Each processor may include multiple computing cores, which can independently process different tasks or process the same task in parallel to improve processing efficiency. Information between computing cores can be transmitted through routing units within the computing cores.
[0054] A processing component and a storage component may be provided within the computing core. The processing component may include a dendrite unit, an axon unit, a cell body unit, and a routing unit. The processing component may simulate the information processing mode of neurons in the brain, wherein the dendrite unit is used to receive signals, the axon unit is used to send spike signals, the cell body unit is used for integrated transformation of signals, and the routing unit is used to transmit information with other computing cores. The processing component within the computing core may read and write to multiple storage units of the storage component to interact with data with the storage component within the computing core, and may respectively undertake respective data processing tasks and / or data transmission tasks to obtain data processing results, or communicate with other computing cores. Among them, communicating with other computing cores includes communicating with other computing cores within the processor, and communicating with computing cores within other processors.
[0055] In one possible implementation, membrane potential is the potential difference between two solutions separated by a membrane. Membrane potential can be used to communicate between nerve cells. Each computing core in a brain-like computing chip can simulate the mode in which nerve cells in the brain use membrane potential to transmit and process information.
[0056] In a possible implementation, the storage unit may be a static random access memory (SRAM). For example, an SRAM with a read / write width of 16B and a capacity of 12KB may be included. The third storage unit MEM2 may receive a cell body unit to read an operation parameter for nonlinear operation, or may receive a routing unit to read a routing table for data communication. The present disclosure does not limit the read / write width and capacity of the storage unit.
[0057] In the process of mapping large-scale neural network data to the many-core cluster (multiple computing cores in the processor), it is necessary to split the processed data in the depth direction and send the split partial data to each computing core in the many-core cluster. Each computing core in the many-core cluster operates on the received partial data to obtain the operation result of the partial data, which is called partial sum. In this case, in order to obtain the operation result of the neural network, it is necessary to further add the operation results of the partial data, that is, to further process the partial sum data.
[0058] In the related technology, a step-by-step summation method can be used to implement partial sum operations in the process of multi-layer convolution operations. The partial sum data in the calculation core is sent one by one to the calculation core that stores the partial sum data in the adjacent next layer. After the addition operation is completed, the two are sent to the corresponding calculation core of the next layer, and the summation is performed layer by layer until the operation is completed.
[0059] For example, Figure 2FIG. 1 is a schematic diagram showing a partial sum operation in the process of convolution operation by a step-by-step summation method in the related art. Figure 2 As shown in the figure, during the convolution operation, it is assumed that the total depth of the processed data is 128. The processed data can be divided into 4 parts in the depth direction and sent to the calculation kernel Sm=0, the calculation kernel Sm=1, the calculation kernel Sm=2 and the calculation kernel Sm=3 for convolution operation, and the partial sum data of each calculation kernel are obtained respectively, that is, the convolution operation result of the divided processed data. Among them, the calculation kernel Sm=0 stores the partial sum data with a depth of 0 to 31, the calculation kernel Sm=1 stores the partial sum data with a depth of 32 to 63, the calculation kernel Sm=2 stores the partial sum data with a depth of 64 to 95, and the calculation kernel Sm=3 stores the partial sum data with a depth of 96 to 127.
[0060] The process of implementing partial sum operation in the convolution operation by step-by-step summation includes three calculation stages: Phase 1 to Phase 3:
[0061] In the first calculation phase Phase1, the calculation core Sm=0 sends the stored "partial sum data of depth 0 to 31" to the calculation core Sm=1. The calculation core Sm=1 adds the received "partial sum data of depth 0 to 31" and the "partial sum data of depth 32 to 63" stored in the calculation core to obtain the addition result data Result1, that is, the partial sum data of depth 0 to 63.
[0062] In the second calculation phase Phase1, the calculation core Sm=1 sends the data Result1 to the calculation core Sm=2. The calculation core Sm=2 adds the received data Result1 and the "partial sum data with a depth of 64 to 95" stored in the calculation core to obtain the addition result data Result2, that is, the partial sum data with a depth of 0 to 95.
[0063] In the third calculation phase Phase3, the calculation core Sm=2 sends the data Result2 to the calculation core Sm=3. The calculation core Sm=3 adds the received data Result2 and the "partial sum data with a depth of 96 to 127" stored in the calculation core to obtain the addition result data Result3, that is, the partial sum data with a depth of 0 to 127, that is, the result of the convolution operation.
[0064] In this way, the summation is performed step by step. It is not difficult to find that many computing cores are in an idle state during the step-by-step summation process. For example, when computing core Sm=1 performs calculations after receiving partial sum data sent by computing core Sm=0, computing cores Sm=2 and Sm=3 are in a waiting state, among which computing core Sm=3 is idle the longest.
[0065] The bit width occupied by the partial and data is relatively large, which can be 4 times or 16 times that of the processing data and weight data. In addition, the data capacity of the partial and data is also relatively large. Due to the large storage space occupied, the remaining data storage space may be insufficient, and the delay during routing transmission will also be relatively long.
[0066] The above-mentioned step-by-step summing method not only results in a large amount of data transmission and a long routing delay, but also in the entire calculation process, there are multiple computing cores waiting idle, resulting in a waste of computing resources.
[0067] In the process of multi-layer convolution operation, the convolution operation result of the current layer can be used as the processing data of the next layer, and the number of convolution kernels can determine the depth of the processing data of the next layer. Therefore, when the depth of the processing data is not divided and the number of convolution kernels is grouped, it is equivalent to dividing the processing data of the next layer in the depth direction. For the calculation of the next layer, the two parts of the calculation results need to be merged in the depth direction.
[0068] Figure 3 A schematic diagram showing the calculation of convolution kernel grouping in weight data in the related art is shown as follows: Figure 3 As shown in the figure, assuming that there are 64 convolution kernels in the weight data (convolution kernels 0 to 63), the number of convolution kernels can be grouped in the segmentation process, and every 32 convolution kernels are grouped into a group, for a total of 2 groups, that is, convolution kernels 0 to 31 are the first group, and convolution kernels 32 to 63 are the second group. The width and height directions of the processed data are 56, and the depth direction is 128.
[0069] The processed data and the first group of convolution kernels are sent to the computing core Core1, and the computing core Core1 performs convolution operation on the received data to obtain the partial sum of 0 to 31 in the depth direction; the processed data and the second group of convolution kernels are sent to the computing core Core2, and the computing core Core2 performs convolution operation on the received data to obtain the partial sum of 32 to 63 in the depth direction. Then, the computing core Core1 sends the partial sum data of 0 to 31 in the depth direction to the computing core Core2, and the computing core Core2 sends the partial sum data of 32 to 63 in the depth direction to the computing core Core1, so that the computing cores Core1 and Core2 complete the merging of the partial sum data in the depth direction. The routing transmission and data merging calculation clock are increased, which reduces the computing efficiency of the computing core.
[0070] Figure 4 1 is a flow chart showing a data processing method according to an embodiment of the present disclosure. Figure 4 As shown, the method implements the convolution operation of processing data and weight data, and the method includes step S1 and step S2:
[0071] In step S1, data is exchanged between multiple computing cores;
[0072] In step S2, each computing core performs parallel computing based on the exchanged data to obtain a parallel computing result;
[0073] In step S3, the convolution operation result of the processing data and the weight data is determined according to the parallel operation result of each computing core;
[0074] The data for data exchange includes one of the segmented weight data, segmented processed data and partial sum data, wherein the partial sum data is a convolution operation result obtained based on the segmented processed data or the segmented weight data.
[0075] In a possible implementation, in the process of mapping a large-scale convolution operation (e.g., multi-layer convolution, circular convolution) to multiple computing cores, the data stored in each computing core may include one or more of the segmented weight data, segmented processing data, and partial sum data. In order to implement the large-scale convolution operation, the multiple computing cores may exchange the segmented weight data, segmented processing data, or partial sum data, and then perform parallel operations on the exchanged data to obtain parallel operation results. The large-scale convolution operation result is then determined based on the parallel operation result.
[0076] Among them, the partial sum data can be the convolution operation result of the segmented processed data and the segmented weight data, can be the convolution operation result of the unsegmented processed data and the segmented weight data, or can be the convolution operation result of the segmented processed data and the unsegmented weight data.
[0077] In one possible implementation, in step S1, multiple processors may be integrated into a brain-like computing chip, and data can be exchanged between computing cores within each processor and between computing cores of different processors;
[0078] Each computing core among the plurality of computing cores may exchange one or more data to other computing cores.
[0079] For example, assume that there are four computing cores: computing core A, computing core B, computing core C, and computing core D.
[0080] The computing core A stores data DateA, wherein the data DateA may include data DateA1, data DateA2, data DateA3 and data DateA4;
[0081] The computing core B stores data DateB, wherein the data DateB may include data DateB1, data DateB2, data DateB3 and data DateB4;
[0082] The computing core B stores data DateC, wherein the data DateC may include data DateC1, data DateC2, data DateC3 and data DateC4;
[0083] The computing core B stores data DateD, where the data DateD may include data DateD1, data DateD2, data DateD3 and data DateD4.
[0084] Each of the four computing cores can exchange a stored data to other computing cores in parallel, that is: computing core A can exchange data DateA to computing core B, computing core B can exchange data DateB to computing core C, computing core C can exchange data DateC to computing core D, and computing core D can exchange data DateD to computing core A.
[0085] Alternatively, each of the four computing cores can exchange multiple stored data to other computing cores in parallel, where each data is exchanged to a different computing core, that is: computing core A can exchange data DateA2 to computing core B, exchange data DateA3 to computing core C, and exchange data DateA4 to computing core D; computing core B can exchange data DateB1 to computing core A, exchange data DateB3 to computing core C, and exchange data DateB4 to computing core D; computing core C can exchange data DateC1 to computing core A, exchange data DateC2 to computing core B, and exchange data DateC4 to computing core D; computing core D can exchange data DateD1 to computing core A, exchange data DateD2 to computing core B, and exchange data DateD3 to computing core C.
[0086] In one possible implementation, in step S1, data is exchanged between multiple computing cores, and a storage unit can be accessed through a routing unit inside each computing core to read exchange data and transmit it to a computing core to be received; each computing core to be received can access the storage unit through the routing unit to write the received exchange data into the storage unit; wherein, the routing unit of each computing core can read one or more exchange data and send them to one or more computing cores by accessing the storage unit; correspondingly, the routing unit of each computing core can receive the exchange data sent by one or more computing cores and write them into the storage unit of each computing core.
[0087] In one possible implementation, in step S2, each computing core performs parallel operations based on the exchanged data. For example, if the data exchanged by each computing core is the processed data after segmentation, the processed data after segmentation can be convolved with the weight data stored in each computing core; if the data exchanged by each computing core is the weight data after segmentation, the weight data after segmentation can be convolved with the processed data stored in each computing core; if the data exchanged by each computing core is the partial sum data after segmentation, the partial sum data can be summed with the partial sum data stored in each computing core, and the partial sum data can also be used as the processing data of the next layer (such as multi-layer convolution) for convolution with the weight data stored in each computing core.
[0088] In a possible implementation, in step S2, the processing unit of each computing core can read the exchanged data by accessing the storage unit, and perform multiplication and / or addition operations on the exchanged data. Therefore, multiple computing cores perform operations on the exchanged data in parallel to obtain parallel operation results.
[0089] In a possible implementation, in step S3, the convolution operation result of the processing data and the weight data is determined according to the parallel operation result of each computing core; for example, if each computing core obtains the parallel operation result by exchanging the segmented processing data or segmented weight data, the parallel operation result can be used as the convolution operation result of the processing data or weight data in the computing core. Alternatively, if each computing core obtains the parallel operation result by exchanging parts and data, the parallel operation results of each computing core can also be added to obtain the convolution operation result of the processing data and the weight data.
[0090] By exchanging data between multiple computing cores, each computing core performs parallel operations based on the exchanged data, which can balance the computing resources of each computing core, give full play to the computing effectiveness of each computing core, and improve data processing efficiency.
[0091] In a possible implementation, the data to be exchanged includes the weight data after segmentation, or the processed data after segmentation; the weight data or the processed data is segmented into n parts;
[0092] Data exchange between multiple computing cores includes:
[0093] n computing cores perform n-1 rounds of data exchange, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data or each of the n processing data;
[0094] Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including:
[0095] After each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in this round of data exchange and the stored processing data, or performs a convolution operation based on one portion of processing data received in this round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core;
[0096] According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including:
[0097] The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core.
[0098] For example, the weight data or the processed data can be divided into n parts (A1, A2, ..., An), and sent to n computing cores (computing core 1, computing core 2, ..., computing core n), respectively, where A1~An can represent the data after the division, which can be the weight data after the division or the processed data after the division. Each of the n computing cores can store one-nth of the weight data after the division or the processed data after the division. For example, computing core 1 stores the A1 data after the division, computing core 2 stores the A2 data after the division, and so on. Computing core n stores the An data after the division.
[0099] Each computing core (computing core 1, computing core 2, ..., computing core n) can perform a convolution operation on the stored segmented data (A1, A2, ..., An) and the stored processed data or weight data (B1, B2, ..., Bn) to obtain the result of the convolution operation (C1[0] = A1*B1, C2[0] = A2*B2, ..., Cn[0] = An*Bn). That is, when the data stored in each computing core is segmented weight data, the stored segmented weight data can be convolved with the stored processed data to obtain the result of the convolution operation; when the data stored in each computing core is segmented processed data, the stored segmented processed data can be convolved with the stored weight data to obtain the result of the convolution operation;
[0100] The segmented data (A1, A2, ..., An) stored in each computing core (computing core 1, computing core 2, ..., computing core n) are exchanged through multiple rounds of data. n computing cores can perform n-1 rounds of data exchange, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data. For example, computing core 1 can store the segmented weight data A2 in the first round, store the segmented weight data A3 in the second round, and so on, store the segmented weight data An in the n-1 round. The other computing cores (computing core 2 to computing core n) are similar and will not be repeated here.
[0101] After the i-th round (i=1~n-1) of data exchange, each computing core performs a convolution operation on the 1 weight data or processing data (A1, A2, ..., An) received in this round of data exchange and the stored processing data or weight data (B1, B2, ..., Bn), and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the parallel operation result of the processing data and weight data in the computing core, that is, the convolution operation result (C1[i], C2[i], ..., Cn[i]).
[0102] For example, after the first round of data exchange, computing core 1 can exchange the data A2 after segmentation, and perform convolution operation with the data B1 stored in computing core 1, and accumulate the convolution operation result A2*B1 with the convolution operation result C1[0] previously obtained by the computing core to obtain the parallel operation result of the processing data and the weight data in the computing core, that is, the convolution operation result C1[1]=C1[0]+A2*B1;
[0103] After the second round of data exchange, computing core 1 can exchange the data A3 after segmentation, and perform convolution operation with the data B1 stored in computing core 1, and accumulate the convolution operation result A3*B1 with the convolution operation result C1[1] previously obtained by the computing core to obtain the parallel operation result of the processing data and the weight data in the computing core, that is, the convolution operation result C1[2]=C1[1]+A3*B1;
[0104] By analogy, after the n-1th round of data exchange, computing core 1 can exchange to the segmented data An, and perform a convolution operation with the B1 data stored in computing core 1, and add the convolution operation result An*B1 and the convolution operation result C1[n-2] previously obtained by the computing core to obtain the parallel operation result of the processed data and the weight data in the computing core, that is, the convolution operation result C1[n-1]=C1[n-2]+An*B1; other computing cores (computing core 2 to computing core n) are similar, and each of the n computing cores can operate in parallel, which will not be repeated here.
[0105] It should be understood that the present disclosure does not limit the order of each round of data exchange between computing cores. After satisfying n-1 rounds of data exchange, each computing core has stored each of the n weight data, or each of the n processing data, and can exchange data with any computing core.
[0106] By exchanging the split weight data or split processing data among multiple computing cores, after n-1 rounds of data exchange, each computing core has stored each of the n weight data or processing data, and each computing core can perform parallel operations based on the exchanged data, which can not only reduce the amount of routing transmission data, so that each computing core can exchange 1 / n of the amount of processing data or weight data in each round, but also split the weight data or processing data according to computing needs, and flexibly choose to exchange the smaller data capacity of the split weight data or the split processing data.
[0107] In a possible implementation, the data to be exchanged includes the segmented weight data, the weight data is segmented into n parts in the depth direction, the multiple computing cores include n computing cores, each computing core stores processing data and one weight data of the n weight data in an initial state, and the weight data stored in each computing core in an initial state is different; wherein n is an integer;
[0108] Data exchange between multiple computing cores includes:
[0109] Each computing core performs a convolution operation on the processed data and one weight data stored in the initial state, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges one weight data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data;
[0110] Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including:
[0111] After each round of data exchange, each computing core performs a convolution operation on the stored processing data based on the 1 weight data received in the current round of data exchange, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core;
[0112] According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including:
[0113] The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core.
[0114] For example, each computing core receives corresponding processing data and segmented weight data, and performs a convolution operation on the received data to obtain an operation result.
[0115] The split weight data stored in the computing core is sent to other computing cores in rounds; wherein, each computing core synchronously sends and receives weight data in each round, performs convolution operation on the received split weight data and the processed data, and adds the data to the result of the previous round of operation to obtain the parallel operation result of each computing core in this round; wherein, the parallel operation result of each computing core in the last round can be used as the convolution operation result of the processed data and weight data in the computing core.
[0116] Figure 5 FIG. 1 is a schematic diagram showing a convolution operation performed by exchanging weight data according to an embodiment of the present disclosure. Figure 5 As shown, for processing data X n Instead of segmenting in the depth direction, the weight data W is segmented in the depth direction, that is, the depth direction of each convolution kernel in the weight data W is segmented. The weight data may include N convolution kernels.
[0117] The weight data W can be divided into 4 parts along the depth direction, namely weight data W0, weight data W1, weight data W2 and weight data W3. For example, assuming that the depth of weight data W is 128, the weight data can be divided into 4 parts along the depth direction, W0 represents weight data with a depth of 0 to 31, W1 represents weight data with a depth of 32 to 63, W2 represents weight data with a depth of 64 to 95, and W3 represents weight data with a depth of 96 to 127.
[0118] In the T0 calculation cycle, the data X will be processed n (n=1~4) and the split weight data W0~W3 are sent to the computing cores Core0~Core3 respectively. The computing core Core0 stores the processing data X0 and the weight data W0, the computing core Core1 stores the processing data X1 and the weight data W1, the computing core Core2 stores the processing data X2 and the weight data W2, and the computing core Core3 stores the processing data X3 and the weight data W3.
[0119] In this case, without segmenting the processed data in depth, the same processed data X n (n=1-4) are sent to the computing cores Core0-Core3, that is, the processing data X0, X1, X2 and X3 stored in each computing core are the same; different processing data X n The data are sent to computing cores Core0 to Core3, that is, the processing data X0, X1, X2 and X3 stored in each computing core are different.
[0120] Each computing core performs convolution operation on the received processed data and the weighted data after segmentation to obtain the convolution operation result (partial sum). For example, computing core Core0 performs convolution operation on the received processed data X0 and the weighted data W0 to obtain the operation result Vout_0, that is, Vout_0 = X0*W0. Among them, the operation result Vout_0 is the partial sum of the depth of the weighted data W0 after segmentation.
[0121] After the calculation cycle T0 is completed, the calculation cores Core0~Core3 send their stored weight data W0~W3 to other calculation cores in the next calculation cycle. In each subsequent calculation cycle, each calculation core synchronously sends and receives the corresponding weight data, and after the weight data is sent and received, the weight data and the processing data are convolved, and the calculation results of the previous round (calculation cycle) can be added while the convolution operation is performed. Among them, the calculation result (partial sum) of the previous round is called the initial membrane potential in this round of calculation.
[0122] In the T1 computing cycle (i.e. the first round), each computing core sends and receives data synchronously. For example, computing core Core0 sends weight data W0 to computing core Core2, computing core Core1 sends weight data W1 to computing core Core0, computing core Core2 sends weight data W2 to computing core Core3, and computing core Core3 sends weight data W3 to computing core Core1.
[0123] After the data is sent and received, each computing core performs a convolution operation on the received weight data and the processed data stored in the computing core, and adds the convolution operation result to the operation result of the previous round (T0 calculation cycle) to obtain the operation result of this round (T1 calculation cycle).
[0124] For example, the computing core Core0 can send the weight data W0 to the computing core Core2, and receive the weight data W1 sent by the computing core Core1. The received weight data W1 is convolved with the processed data X0 stored in the computing core Core0, and then the convolution operation result X0*W1 is added to the operation result Vout_0 of the previous round (T0 calculation cycle) to obtain the operation result Vout_1, that is, Vout_1 = X0*W1 + Vout_0. Among them, the operation result Vout_1 is the partial sum of the depth of the weight data W0 and the weight data W1 after the corresponding segmentation.
[0125] The computing core Core0 can perform convolution operations while adding the result Vout_0 of the previous round of operations. The result Vout_0 of the previous round of operations is called the initial membrane potential in this round of operations.
[0126] In the T2 computing cycle (i.e. the second round), each computing core sends and receives data synchronously. Computing core Core0 sends weight data W0 to computing core Core1, computing core Core1 sends weight data W1 to computing core Core3, computing core Core2 sends weight data W2 to computing core Core0, and computing core Core3 sends weight data W3 to computing core Core2.
[0127] After the data is sent and received, each computing core performs a convolution operation on the received weight data and the processed data stored in the computing core, and adds the convolution operation result to the operation result of the previous round (T1 calculation cycle) to obtain the operation result of this round (T2 calculation cycle).
[0128] For example, the computing core Core0 can send the weight data W0 to the computing core Core1, and receive the weight data W2 sent by the computing core Core2, and perform a convolution operation on the received weight data W2 and the processed data X0 stored in the computing core Core0, and then add the convolution operation result X0*W2 to the operation result Vout_1 of the previous round (T1 calculation cycle) to obtain the operation result Vout_2, that is, Vout_2 = X0*W2 + Vout_1. Among them, the operation result Vout_2 is the partial sum of the depth of the weight data W0, weight data W1 and weight data W2 after the segmentation. The operation result Vout_1 of the previous round is called the initial membrane potential in this round of operation.
[0129] In the T3 computing cycle (i.e. the third round), each computing core sends and receives data synchronously. Computing core Core0 sends weight data W0 to computing core Core3, computing core Core1 sends weight data W1 to computing core Core2, computing core Core2 sends weight data W2 to computing core Core1, and computing core Core3 sends weight data W3 to computing core Core0.
[0130] After the data is sent and received, each computing core performs a convolution operation on the received weight data and the processed data stored in the computing core, and adds the convolution operation result to the operation result of the previous round (T2 computing cycle) to obtain the parallel operation result of this round (T3 computing cycle). Among them, the parallel operation result of each computing core in this round (T3 computing cycle) is the last round, which can be used as the convolution operation result of the processed data and weight data in the computing core.
[0131] For example, the computing core Core0 can send the weight data W0 to the computing core Core3, and receive the weight data W3 sent by the computing core Core3, and perform a convolution operation on the received weight data W3 and the processed data X0 stored in the computing core Core0, and then add the convolution operation result X0*W3 to the operation result Vout_2 of the previous round (T1 calculation cycle) to obtain the operation result Vout_3, that is, Vout_3=X0*W3+Vout_3. Among them, the operation result Vout_3 is the partial sum of the depth of the corresponding weight data W0~W3 after segmentation. The operation result Vout_2 of the previous round is called the initial membrane potential in this round of operation.
[0132] It should be understood that if the processing data X stored in each computing core n The same, after T0 ~ T3 calculation cycle, the calculation results of each calculation core are the same; if the processing data X stored in each calculation core n Different, after T0~T3 calculation cycles, the calculation results of each calculation core are different.
[0133] By dividing the weight data W into n parts (W1, W2, ..., Wn) along the depth direction, and sending the weight data W1~Wn after the split into n computing cores respectively, the data storage capacity of the weight data in each computing core can be reduced, and the occupied storage capacity is 1 / n of the weight data before the split. The amount of weight data that each computing core needs to transmit in each round is also reduced to 1 / n of the weight data W before the split, which can reduce the routing transmission time. And the weight data of each computing core is sent through n-1 rounds (corresponding to T1~Tn-1 computing cycles) and traversed to other n-1 computing cores. The weight data stored in the data cache in each computing core can be reused, improving the utilization rate of data cache computing resources and saving storage space. By exchanging the weight data after the split between computing cores, the convolution operation can be performed while adding the initial membrane potential to complete the calculation of the partial sum. Each computing core can operate in parallel to improve the computing efficiency. It can also avoid the pressure of high bit width and large data volume on routing transmission by directly exchanging partial sum data, and increase the routing delay of data transmission.
[0134] In a possible implementation, the weight data exchange between the n computing cores may be performed in multiple rounds. In each round of sending, the weight data of each computing core among the n computing cores is sent to a target computing core among the n computing cores, wherein the target computing core corresponding to each computing core is different.
[0135] In the exchange of weight data between multiple computing cores, there are cases where multiple computing cores send data to one computing core or one computing core sends data to multiple computing cores. In this case, the weight data exchange between the computing cores can be performed in multiple rounds. Among them, in the case of weight data exchange between n computing cores, in each round of weight data exchange, each computing core that sends data only needs to send data to one computing core, and each computing core that receives data only needs to receive data from one computing core.
[0136] In a possible implementation, in the process of loading the membrane potential calculation part and exchanging weight data between n computing cores, the weight data of each computing core in the n computing cores needs to be transmitted to the target computing core group composed of the remaining n-1 computing cores, and the data exchange between the computing cores is performed in multiple rounds;
[0137] In each round of sending, the data of each computing core among the n computing cores is sent to a target computing core among the n computing cores, including: in each round of sending, a different computing core is selected from each target computing core group as the target computing core, and a total of n-1 rounds are sent.
[0138] For example, when data is exchanged between n computing cores, each computing core can correspond to a target computing core group consisting of other n-1 computing cores, and n computing cores correspond to n target computing core groups. Data exchange between n computing cores can be completed through n-1 rounds of transmission. In each round of transmission, a different computing core is selected from the n target computing core groups as the target computing core, and the weight data stored in the n computing cores is sent to the corresponding target computing cores.
[0139] For example, data is exchanged between four computing cores (n=1-4), Core0, Core1, Core2, and Core3 correspond to the four computing cores respectively, and the weight data stored in each computing core needs to be transmitted to the target computing core group composed of the remaining three computing cores.
[0140] The weight data stored in the computing core Core0 needs to be transmitted to the target computing core group: Core1, Core2, Core3;
[0141] The weight data stored in computing core Core1 needs to be transmitted to the target computing core group: Core0, Core2, and Core3;
[0142] The weight data stored in the computing core Core2 needs to be transmitted to the target computing core group: Core0, Core1, Core3;
[0143] The weight data stored in the computing core Core3 needs to be transmitted to the target computing core group: Core0, Core1, Core2;
[0144] In each round of sending, the computing cores Core0 to Core3 select a different computing core from their corresponding target computing core groups as the target computing core, that is, the computing cores selected from each computing core group are different from each other. The weight data stored in each computing core in the computing cores Core0 to Core3 are sent to the corresponding target computing cores respectively, and a total of 3 rounds are sent. In addition, each computing core in each group of computing cores needs to be traversed during the 3 rounds of sending.
[0145] For example, in the first round, Core3 can be selected as the target computing core from the target computing core group corresponding to computing core Core0, Core2 can be selected as the target computing core from the target computing core group corresponding to computing core Core1, Core1 can be selected as the target computing core from the target computing core group corresponding to computing core Core2, and Core0 can be selected as the target computing core from the target computing core group corresponding to computing core Core3. The computing cores Core0 to Core3 send their stored weight data to the corresponding target computing cores Core3, Core2, Core1, and Core0 respectively.
[0146] In the first round, Core1 can also be selected as the target computing core from the target computing core group corresponding to computing core Core0, Core2 can be selected as the target computing core from the target computing core group corresponding to computing core Core1, Core3 can be selected as the target computing core from the target computing core group corresponding to computing core Core2, and Core0 can be selected as the target computing core from the target computing core group corresponding to computing core Core3. Computing cores Core0 to Core3 will respectively send their stored weight data to the corresponding target computing cores Core1, Core2, Core3, and Core0. It should be understood that for the selection of target computing cores in each round, as long as the target computing cores selected by each group in each round are different, the present disclosure does not limit the selection method.
[0147] For the second and third rounds, the target computing cores need to be selected from computing cores in each group that have not received weight data before (ie, computing cores that are not used as target computing cores).
[0148] For example, suppose that in the first round, computing cores Core3, Core2, Core1, and Core0 are selected from the target computing core group corresponding to computing cores Core0 to Core3 as target computing cores.
[0149] In the second round, the computing cores Core1, Core3, Core0, and Core2 can be selected from the target computing core group corresponding to the computing cores Core0 to Core3 as the target computing cores; in the third round, the computing cores Core2, Core0, Core3, and Core1 can be selected from the target computing core group corresponding to the computing cores Core0 to Core3 as the target computing cores. Alternatively, in the second round, the computing cores Core2, Core0, Core3, and Core1 can be selected from the target computing core group corresponding to the computing cores Core0 to Core3 as the target computing cores; in the third round, the computing cores Core1, Core3, Core0, and Core2 can be selected from the target computing core group corresponding to the computing cores Core0 to Core3 as the target computing cores.
[0150] Through the above method of exchanging weight data between n computing cores, the weight data between computing cores can be shared with other computing cores through multiple rounds of exchange. The weight data of n different computing cores are sent through n-1 rounds, so that the weight data of each computing core can be traversed to other n-1 computing cores. In addition, data storage space can be reused, storage space can be saved, and the reuse rate of data space can be improved.
[0151] In one possible implementation, Figure 6 FIG. 1 is a schematic diagram showing a weight data exchange method according to an embodiment of the present disclosure. Figure 6 As shown, assuming that Core0, Core1, Core2, and Core3 correspond to 4 computing cores (n=4), they can be represented as computing core Core0, computing core Core1, computing core Core2, and computing core Core3. Computing core Core0 stores weight data W0 for convolution kernels 0 to 31, computing core Core1 stores weight data W1 for convolution kernels 32 to 63, computing core Core2 stores weight data W2 for convolution kernels 64 to 95, and computing core Core3 stores weight data W3 for convolution kernels 96 to 127.
[0152] In the T0 computing cycle, computing cores Core0, Core1, Core2, and Core3 perform convolution operations based on weight data stored in each computing core.
[0153] For example, the axon unit of the computing core Core0 performs a read operation on the storage unit within the computing core, and performs a convolution operation on the read processing data and weight data W0 to obtain the result of the convolution operation, and then writes the convolution operation result into the storage unit of the computing core Core0 according to the storage order set by the computing core (for example, from low address to high address, which is not limited in the present disclosure).
[0154] like Figure 6 As shown, the process of exchanging weight data between computing cores Core0 to Core3 may include three computing cycles T1 to T3, wherein the three cycles correspond to the number of rounds of exchanging weight data between computing cores (ie, the first to third rounds).
[0155] In the T1 computing cycle (i.e. the first round), computing core Core0 can send weight data W0 to computing core Core1, computing core Core1 can send weight data W1 to computing core Core2, computing core Core2 can send weight data W2 to computing core Core3, and computing core Core3 can send weight data W3 to computing core Core0.
[0156] For example, computing core Core0 can send weight data W0 to computing core Core1, including: the routing unit of computing core Core0 performs a read operation on the storage unit of the computing core, and sends the read weight data W0 to computing core Core1. The routing unit of computing core Core1 performs a write operation on the storage unit of the computing core, and writes the received weight data W0 sent by computing core Core0 into the storage unit of computing core Core1 according to the storage order set by computing core Core1 (for example, from low address to high address, which is not limited in the present disclosure). It should be understood that the process of each computing core sending the data to be sent to other computing cores can refer to the above process and will not be repeated.
[0157] In the T2 computing cycle (i.e. the second round), computing core Core0 can send weight data W0 to computing core Core2, computing core Core1 can send weight data W1 to computing core Core3, computing core Core2 can send weight data W2 to computing core Core0, and computing core Core3 can send weight data W3 to computing core Core1.
[0158] In the T3 computing cycle (i.e. the third round), computing core Core0 can send weight data W0 to computing core Core3, computing core Core1 can send weight data W1 to computing core Core0, computing core Core2 can send weight data W2 to computing core Core1, and computing core Core3 can send weight data W3 to computing core Core2.
[0159] The four different computing cores can complete the cyclic exchange process of the four computing cores through three computing cycles (T1 to T3 computing cycles), and in each computing cycle, each computing core can be traversed, and the amount of data sent and received by each computing core is the same.
[0160] In the above four computing cycles, the weight data W0 stored in the computing core Core0, the weight data W1 stored in the computing core Core1, the weight data W2 stored in the computing core Core2, and the weight data W3 stored in the computing core Core3 are non-erasable data, and the address space in the storage component in the computing core remains unchanged. For example, each weight data W0~W3 can be stored in the address space 1~4 of the storage component of each computing core.
[0161] In other computing cycles (T1 to T3) excluding the T0 computing cycle, the weight data received by each computing core can be erased, and after the convolution operation is performed on the weight data in the computing cycle, it can be overwritten by the weight data received in the next cycle. For example, in the T2 computing cycle, computing core Core0 receives the weight data W2 sent by computing core Core2, and the weight data W2 can be stored in the address space 5 to 8 in the computing core storage component, overwriting the weight data W3 sent by computing core Core3 and received by computing core Core0 in the T1 computing cycle. In the T3 computing cycle, the weight data W2 sent by computing core Core2 and received by computing core Core0 can be overwritten by the weight data W1 sent by computing core Core1.
[0162] It should be noted that although the weight data exchange between computing cores Core0 to Core3 is used as an example to introduce the data exchange method of cyclic traversal as above, those skilled in the art can understand that the present disclosure should not be limited to this, and the number of computing cores is not limited. The weight data of n different computing cores can be sent through n-1 rounds, so that the weight data traverses to all computing cores. Among them, n-1 rounds represent the number of rounds of the computing cycle of data exchange.
[0163] Through the above-mentioned data exchange method of cyclic traversal between multiple computing cores, the weight data between the computing cores can be shared with other computing cores through multiple rounds of exchanges.
[0164] In a possible implementation, the data to be exchanged includes segmented processed data, the processed data is segmented into n parts in a depth direction, the multiple computing cores include n computing cores, each computing core stores weighted data and one of the n processed data in an initial state, and each computing core stores different processed data in an initial state;
[0165] Data exchange between multiple computing cores includes:
[0166] Each computing core performs a convolution operation on the weight data stored in the initial state and one portion of the processed data, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges the one portion of the processed data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each portion of the n portions of the processed data; wherein n is an integer;
[0167] Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including:
[0168] After each round of data exchange, each computing core performs a convolution operation on the stored weight data based on the 1 processed data received in the current round of data exchange, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core;
[0169] According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including:
[0170] The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core.
[0171] For example, each computing core receives the corresponding segmented processing data and weight data, and performs a convolution operation on the received data to obtain an operation result.
[0172] The split processed data stored in the computing core is sent to other computing cores in rounds; wherein, each computing core synchronously sends and receives processed data in each round, performs convolution operation on the received split processed data and weight data, and adds the data to the operation result of the previous round to obtain the parallel operation result of each computing core in this round; wherein, the parallel operation result of each computing core in the last round can be used as the convolution operation result of the weight data and the processed data in the computing core.
[0173] For weight data W n No segmentation in the depth direction is performed, and the processed data X is segmented in the depth direction. Among them, each weight data W n Multiple convolution kernels may be included, and the specific number of convolution kernels is not limited in this disclosure.
[0174] The processed data X can be divided into four parts along the depth direction, namely, processed data X0, processed data X1, processed data X2, and processed data X3. For example, assuming that the depth of the processed data X is 128, the processed data can be divided into four parts along the depth direction, X0 represents the processed data with a depth of 0 to 31, X1 represents the processed data with a depth of 32 to 63, X2 represents the processed data with a depth of 64 to 95, and X3 represents the processed data with a depth of 96 to 127. It should be understood that the non-subscript forms of X, X0, X1, X2, and X3 here are the same as the subscript forms of X in the above text. n , X0, X1, X2 and X3 have different meanings. The non-subscript forms of X, X0, X1, X2 and X3 represent the processed data after segmentation. The subscript forms of X n , X0, X1, X2 and X3 represent undivided processed data.
[0175] In the T0 calculation cycle, the weight data W n (n=1~4) and the split processed data X0~X3 are sent to the computing cores Core0~Core3 respectively. The computing core Core0 stores the weight data W0 and the processed data X0, the computing core Core1 stores the weight data W1 and the processed data X1, the computing core Core2 stores the weight data W2 and the processed data X2, and the computing core Core3 stores the weight data W3 and the processed data X3.
[0176] In the case where the weight data is not segmented in the depth direction, the same weight data W can be n (n=1-4) are sent to the computing cores Core0-Core3, that is, the weight data W0, W1, W2 and W3 stored in each computing core are the same; different weight data W n The weight data W0, W1, W2 and W3 stored in each computing core are different. It should be understood that the subscript W n , W0, W1, W2 and W3 have different meanings from the non-subscript forms of W, W0, W1, W2 and W3 in the above text. n , W0, W1, W2 and W3 represent the unsegmented weight data, and W, W0, W1, W2 and W3 represent the segmented weight data.
[0177] Each computing core performs convolution operation on the received weight data and the processed data after segmentation to obtain the convolution operation result (partial sum). For example, computing core Core0 performs convolution operation on the received weight data W0 and the processed data X0 to obtain the operation result Vout_0, that is, Vout_0 = W0*X0. Among them, the operation result Vout_0 is the partial sum of the depth of the processed data X0 after segmentation.
[0178] After the calculation cycle T0 is completed, the calculation cores Core0~Core3 send their stored processing data X0~X3 to other calculation cores in the next calculation cycle. In each subsequent calculation cycle, each calculation core synchronously sends and receives the corresponding processing data, and after the processing data is sent and received, the convolution operation of the processing data and the weight data is performed, and the calculation results of the previous round (calculation cycle) can be added while the convolution operation is performed. Among them, the calculation result (partial sum) of the previous round is called the initial membrane potential in this round of calculation.
[0179] In the T1 computing cycle (i.e. the first round), each computing core sends and receives data synchronously. For example, computing core Core0 sends processed data X0 to computing core Core2, computing core Core1 sends processed data X1 to computing core Core0, computing core Core2 sends processed data X2 to computing core Core3, and computing core Core3 sends processed data X3 to computing core Core1.
[0180] After the data is sent and received, each computing core performs a convolution operation on the received processed data and the weight data stored in the computing core, and adds the convolution operation result to the operation result of the previous round (T0 calculation cycle) to obtain the operation result of this round (T1 calculation cycle).
[0181] For example, the computing core Core0 can send the processing data X0 to the computing core Core2, and receive the processing data X1 sent by the computing core Core1. The received processing data X1 is convolved with the weight data W0 stored in the computing core Core0, and then the convolution operation result W0*X1 is added to the operation result Vout_0 of the previous round (T0 calculation cycle) to obtain the operation result Vout_1, that is, Vout_1=W0*X1+Vout_0. Among them, the operation result Vout_1 is the partial sum of the depth of the corresponding split processing data X0 and the processing data X1.
[0182] The computing core Core0 can perform convolution operations while adding the result Vout_0 of the previous round of operations. The result Vout_0 of the previous round of operations is called the initial membrane potential in this round of operations.
[0183] In the T2 computing cycle (i.e. the second round), each computing core sends and receives data synchronously. Computing core Core0 sends processed data X0 to computing core Core1, computing core Core1 sends processed data X1 to computing core Core3, computing core Core2 sends processed data X2 to computing core Core0, and computing core Core3 sends processed data X3 to computing core Core2.
[0184] After the data is sent and received, each computing core performs a convolution operation on the received processed data and the weight data stored in the computing core, and adds the convolution operation result to the operation result of the previous round (T1 calculation cycle) to obtain the operation result of this round (T2 calculation cycle).
[0185] For example, the computing core Core0 can send the processing data X0 to the computing core Core1, and receive the processing data X2 sent by the computing core Core2, and perform a convolution operation on the received processing data X2 and the weight data W0 stored in the computing core Core0, and then add the convolution operation result W0*X2 to the operation result Vout_1 of the previous round (T1 calculation cycle) to obtain the operation result Vout_2, that is, Vout_2=W0*X2+Vout_1. Among them, the operation result Vout_2 is the partial sum of the depth of the corresponding segmented processing data X0, processing data X1 and processing data X2. The operation result Vout_1 of the previous round is called the initial membrane potential in this round of operation.
[0186] In the T3 computing cycle (i.e. the third round), each computing core sends and receives data synchronously. Computing core Core0 sends processed data X0 to computing core Core3, computing core Core1 sends processed data X1 to computing core Core2, computing core Core2 sends processed data X2 to computing core Core1, and computing core Core3 sends processed data X3 to computing core Core0.
[0187] After the data is sent and received, each computing core performs a convolution operation on the received processed data and the weight data stored in the computing core, and adds the convolution operation result to the operation result of the previous round (T2 computing cycle) to obtain the parallel operation result of this round (T3 computing cycle). Among them, the parallel operation result of each computing core in this round (T3 computing cycle) is the last round, which can be used as the convolution operation result of the weight data in the computing core and the processed data.
[0188] For example, the computing core Core0 can send the processing data X0 to the computing core Core3, and receive the processing data X3 sent by the computing core Core3, and perform a convolution operation on the received processing data X3 and the weight data W0 stored in the computing core Core0, and then add the convolution operation result W0*X3 to the operation result Vout_2 of the previous round (T1 calculation cycle) to obtain the operation result Vout_3, that is, Vout_3=W0*X3+Vout_3. Among them, the operation result Vout_3 is the partial sum of the depth of the corresponding segmented processing data X0~X3. The operation result Vout_2 of the previous round is called the initial membrane potential in this round of operation.
[0189] It should be understood that if the weight data W stored in each computing core nThe same, after T0~T3 calculation cycles, the calculation results of each calculation core are the same; if the weight data W stored in each calculation core n Different, after T0~T3 calculation cycles, the calculation results of each calculation core are different.
[0190] By dividing the processing data X into n parts (X1, X2, ..., Xn) along the depth direction, and sending the split processing data X1~Xn to n computing cores respectively, the data storage capacity of the processing data in each computing core can be reduced, and the occupied storage capacity is 1 / n of the processing data before splitting. The amount of processing data that each computing core needs to exchange in each round is also reduced to 1 / n of the processing data X before splitting, which can reduce the routing transmission time. And the processing data of each computing core is sent through n-1 rounds (corresponding to T1~Tn-1 computing cycles) and traversed to other n-1 computing cores. The processing data stored in the data cache in each computing core can be reused, improving the utilization rate of data cache computing resources and saving storage space. By exchanging the split processing data between computing cores, the convolution operation can be performed while adding the initial membrane potential to complete the calculation of the partial sum. Each computing core can operate in parallel to improve the computing efficiency. It can also avoid the pressure of high bit width and large data volume of routing transmission by directly exchanging partial sum data, and increase the routing delay of data transmission.
[0191] In a possible implementation, in the process of partial and calculation, the processing data exchange between the n computing cores can be performed in multiple rounds. In each round of sending, the processing data of each computing core in the n computing cores is sent to a target computing core in the n computing cores respectively, wherein the target computing core corresponding to each computing core is different;
[0192] In the case of processing data exchange between multiple computing cores, there are cases where multiple computing cores send data to one computing core or one computing core sends data to multiple computing cores. In this case, the processing data exchange between the computing cores can be performed in multiple rounds. Among them, in the case of processing data exchange between n computing cores, in each round of processing data exchange, each computing core that sends data only needs to send data to one computing core, and each computing core that receives data only needs to receive data from one computing core.
[0193] In a possible implementation, in the process of loading the membrane potential calculation part and exchanging processing data between n computing cores, the processing data of each computing core in the n computing cores needs to be transmitted to the target computing core group composed of the remaining n-1 computing cores, and the data exchange between the computing cores is performed in multiple rounds;
[0194] In each round of sending, the data of each computing core among the n computing cores is sent to a target computing core among the n computing cores, including: in each round of sending, a different computing core is selected from each target computing core group as the target computing core, and a total of n-1 rounds are sent.
[0195] For example, when data is exchanged between n computing cores, each computing core can correspond to a target computing core group consisting of other n-1 computing cores, and n computing cores correspond to n target computing core groups. Data exchange between n computing cores can be completed through n-1 rounds of transmission. In each round of transmission, a different computing core is selected from the n target computing core groups as the target computing core, and the processed data stored in the n computing cores is sent to the corresponding target computing cores.
[0196] For example, data is exchanged between four computing cores (n=1-4), Core0, Core1, Core2, and Core3 correspond to the four computing cores respectively, and the processed data stored in each computing core needs to be exchanged to the target computing core group composed of the remaining three computing cores.
[0197] The processed data stored in the computing core Core0 needs to be exchanged to the target computing core group: Core1, Core2, Core3;
[0198] The processed data stored in computing core Core1 needs to be exchanged to the target computing core group: Core0, Core2, and Core3;
[0199] The processed data stored in the computing core Core2 needs to be exchanged to the target computing core group: Core0, Core1, Core3;
[0200] The processed data stored in the computing core Core3 needs to be exchanged to the target computing core group: Core0, Core1, Core2;
[0201] In each round of sending, the computing cores Core0 to Core3 select a different computing core from their corresponding target computing core groups as the target computing core, that is, the computing cores selected from each computing core group are different from each other. The processing data stored in each computing core in the computing cores Core0 to Core3 are sent to the corresponding target computing cores respectively, and a total of 3 rounds are sent. In addition, each computing core in each group of computing cores needs to be traversed during the 3 rounds of sending.
[0202] For example, in the first round, Core3 may be selected as the target computing core from the target computing core group corresponding to computing core Core0, Core2 may be selected as the target computing core from the target computing core group corresponding to computing core Core1, Core1 may be selected as the target computing core from the target computing core group corresponding to computing core Core2, and Core0 may be selected as the target computing core from the target computing core group corresponding to computing core Core3. Computing cores Core0 to Core3 may send their stored processing data to the corresponding target computing cores Core3, Core2, Core1, and Core0 respectively.
[0203] In the first round, Core1 can also be selected as the target computing core from the target computing core group corresponding to computing core Core0, Core2 can be selected as the target computing core from the target computing core group corresponding to computing core Core1, Core3 can be selected as the target computing core from the target computing core group corresponding to computing core Core2, and Core0 can be selected as the target computing core from the target computing core group corresponding to computing core Core3. Computing cores Core0 to Core3 will respectively send their stored processing data to the corresponding target computing cores Core1, Core2, Core3, and Core0. It should be understood that for the selection of target computing cores in each round, as long as the target computing cores selected by each group in each round are different, the present disclosure does not limit the selection method.
[0204] For the second and third rounds, the target computing cores need to be selected from computing cores in each group that have not previously received processing data (ie, computing cores that are not the target computing cores).
[0205] For example, suppose that in the first round, computing cores Core3, Core2, Core1, and Core0 are selected from the target computing core group corresponding to computing cores Core0 to Core3 as target computing cores.
[0206] In the second round, the computing cores Core1, Core3, Core0, and Core2 can be selected from the target computing core group corresponding to the computing cores Core0 to Core3 as the target computing cores; in the third round, the computing cores Core2, Core0, Core3, and Core1 can be selected from the target computing core group corresponding to the computing cores Core0 to Core3 as the target computing cores. Alternatively, in the second round, the computing cores Core2, Core0, Core3, and Core1 can be selected from the target computing core group corresponding to the computing cores Core0 to Core3 as the target computing cores; in the third round, the computing cores Core1, Core3, Core0, and Core2 can be selected from the target computing core group corresponding to the computing cores Core0 to Core3 as the target computing cores.
[0207] Through the above method of exchanging processed data between n computing cores, the processed data between computing cores can be shared with other computing cores through multiple rounds of exchange. The processed data of n different computing cores are sent through n-1 rounds, so that the processed data of each computing core can be traversed to other n-1 computing cores. In addition, data storage space can be reused, storage space can be saved, and the reuse rate of data space can be improved.
[0208] In a possible implementation, the data to be exchanged includes parts and data, the multiple computing cores include n computing cores, each computing core stores n parts and data,
[0209] Data exchange between multiple computing cores includes:
[0210] The parts and data are exchanged between the n computing cores, so that the parts and data stored in each computing core after the exchange correspond to the same row segment or the same column segment of the processed data;
[0211] Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including:
[0212] Each calculation core adds the partial sum data obtained after data exchange to obtain the convolution operation result of the partial processing data and the weight data, wherein the partial processing data is obtained after the processing data is divided into n parts in the row direction or the column direction.
[0213] For example, Figure 7 FIG. 2 is a schematic diagram showing a partial and data parallel operation according to an embodiment of the present disclosure. Figure 7 As shown, the parts and data are exchanged between four (n=4) computing cores, so that the parts and data stored in each computing core after the exchange correspond to the same row segment of the processed data. Assuming that Sm=0, Sm=1, Sm=2, and Sm=3 correspond to four computing cores respectively, they can be represented as computing core Sm=0, computing core Sm=1, computing core Sm=2, and computing core Sm=3. Figure 7 As shown in the first row, the calculation core Sm=0 stores the parts and data of depth 0 to 31, the calculation core Sm=1 stores the parts and data of depth 32 to 63, the calculation core Sm=2 stores the parts and data of depth 64 to 95, and the calculation core Sm=3 stores the parts and data of depth 96 to 127. Among them, the parts and data corresponding to different depths also include data of different row segments, namely, data in the "0 to 13 rows" area, data in the "14 to 27 rows" area, data in the "28 to 41 rows" area, and data in the "42 to 55 rows" area. "Depth" can correspond to the depth of the segmented weight data and the depth of the segmented processing data.
[0214] Among them, the partial sum data can be image data. For example, for multi-layer convolution operations, the data in the "0-13 rows" area stored in the calculation kernel Sm=0 can correspond to the convolution operation results (partial sum) of the pixels of the "0-13 rows" (i.e., the row segment is 0-13 rows) of the processing data of the layer and the corresponding weight data (such as a part of the weight data after segmentation W0-W4). For example, the data in the "0-13 rows" area stored in Sm=0 can be the convolution operation results of the processing data of "0-13 rows" and a depth of 0-31 and the weight data of a depth of 0-31, and can be used as the pixels of "0-13 rows" of the next layer of processing data.
[0215] Figure 8 FIG. 2 is a schematic diagram showing a portion of an embodiment of the present disclosure and data parallel exchange. Figure 8 As shown, computing core Sm=0, computing core Sm=1, computing core Sm=2, and computing core Sm=3 need to send data in the "0-13 rows" area, data in the "14-27 rows" area, data in the "28-41 rows" area, and data in the "42-55 rows" area in parallel to the corresponding target computing cores.
[0216] During the exchange process, data in the same area (corresponding to the same row segment) is sent to the same computing core, so that the data received by each computing core is data in the same area.
[0217] For example, the computing cores Sm=1, Sm=2, and Sm=3 send the data of the "0-13 rows" area of different depth segments to the computing core Sm=0 in parallel, and the data of the "0-13 rows" area stored in the computing core Sm=0 itself remains unchanged;
[0218] The calculation core Sm=0, the calculation core Sm=2, and the calculation core Sm=3 send the data of the "0-27 rows" area of different depth segments to the calculation core Sm=1 in parallel, and the data of the "14-27 rows" area stored in the calculation core Sm=1 itself remains unchanged;
[0219] The calculation core Sm=0, the calculation core Sm=1, and the calculation core Sm=3 send the data of the "28-41 rows" area of different depth segments to the calculation core Sm=2 in parallel, and the data of the "28-41 rows" area stored in the calculation core Sm=2 itself remains unchanged;
[0220] The calculation core Sm=0, the calculation core Sm=1, and the calculation core Sm=2 send the data of the "42-55 rows" area of different depth segments to the calculation core Sm=3 in parallel, and the data of the "42-55 rows" area stored in the calculation core Sm=3 itself remains unchanged.
[0221] It should be understood that the operations of sending and receiving data by each computing core can be performed in parallel and synchronously. Each computing core will receive data from different depth segments and perform addition calculations on each computing core synchronously to obtain the convolution operation results of the partial processing data and the weight data. Figure 7 As shown in the second row, the calculation core Sm=0 stores the data of the "0-13 rows" area with a depth of 0-127, the calculation core Sm=1 stores the data of the "14-27 rows" area with a depth of 0-127, the calculation core Sm=2 stores the data of the "28-41 rows" area with a depth of 0-127, and the calculation core Sm=3 stores the data of the "42-55 rows" area with a depth of 0-127.
[0222] It should be understood that when the exchanged data is the partial sum data corresponding to the same column segment of the processed data, that is, the partial sum data is exchanged between n computing cores so that the partial sum data stored in each computing core after the exchange corresponds to the same column segment of the processed data. Each computing core adds the partial sum data obtained after the data exchange to obtain the convolution operation result of the partial processed data and the weight data, and the partial processed data is obtained after the processed data is split into n parts in the column direction. Please refer to the above and will not repeat it here.
[0223] By using multiple computing cores to synchronously calculate partial sums in parallel, the computing speed can be increased and the computing time can be saved.
[0224] In a possible implementation, an embodiment of the present disclosure further provides a processor, comprising a plurality of computing cores, which implements convolution operations on processing data and weight data, including: exchanging data between the plurality of computing cores; each computing core performs parallel operations based on the exchanged data to obtain parallel operation results; and determining the convolution operation results of the processing data and weight data based on the parallel operation results of each computing core; wherein the data for data exchange comprises one of the split weight data, the split processing data and partial sum data, and the partial sum data is the convolution operation result obtained based on the split processing data or the split weight data.
[0225] In a possible implementation, the data to be exchanged includes the weight data after segmentation, or the processed data after segmentation; the weight data or the processed data is segmented into n parts;
[0226] The multiple computing cores exchange data, including: performing n-1 rounds of data exchange between the n computing cores, so that after the n-1 rounds of data exchange, each computing core has stored each of the n weight data or each of the n processing data;
[0227] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in the current round of data exchange and the stored processing data, or performs a convolution operation based on one portion of processing data received in the current round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain a parallel operation result of the computing core;
[0228] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0229] In a possible implementation, the data to be exchanged includes the segmented weight data, the weight data is segmented into n parts in the depth direction, the multiple computing cores include n computing cores, each computing core stores processing data and one weight data of the n weight data in an initial state, and the weight data stored in each computing core in an initial state is different; wherein n is an integer;
[0230] The multiple computing cores exchange data, including: each computing core performs a convolution operation on the processed data and one weight data stored in the initial state, and then performs n-1 rounds of data exchange among the n computing cores, and in each round of data exchange, each computing core exchanges the one weight data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data;
[0231] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in the current round of data exchange and the stored processing data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the parallel operation result of the computing core;
[0232] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0233] In a possible implementation, the data to be exchanged includes segmented processed data, the processed data is segmented into n parts in a depth direction, the multiple computing cores include n computing cores, each computing core stores weighted data and one of the n processed data in an initial state, and each computing core stores different processed data in an initial state;
[0234] Data exchange is performed between multiple computing cores, including: each computing core performs a convolution operation on the weight data stored in the initial state and 1 processing data, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges the 1 processing data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n processing data; wherein n is an integer;
[0235] Each computing core performs parallel operation based on the exchanged data to obtain a parallel operation result, including: after each round of data exchange, each computing core performs a convolution operation based on one piece of processed data received in the current round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the parallel operation result of the computing core;
[0236] Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core, including: using the parallel operation result of each computing core as the convolution operation result of the processing data and the weight data in the computing core.
[0237] In a possible implementation, the data to be exchanged includes partial sum data, the multiple computing cores include n computing cores, each computing core stores n copies of the partial sum data, and the multiple computing cores perform data exchange, including: exchanging the partial sum data between the n computing cores, so that after the exchange, the partial sum data stored in each computing core corresponds to the same row segment or the same column segment of the processed data;
[0238] Each computing core performs parallel operations based on the exchanged data to obtain parallel operation results, including: each computing core adds the partial sum data obtained after the data exchange to obtain the convolution operation result of the partial processing data and the weight data, and the partial processing data is obtained after the processing data is divided into n parts in the row direction or the column direction.
[0239] In a possible implementation, the present disclosure also provides an artificial intelligence chip, which includes the processor described above. Figure 1 As shown, the chip may include one or more processors, and the processor may include multiple computing cores. The present disclosure does not limit the number of computing cores in the chip.
[0240] In one possible implementation, an embodiment of the present disclosure provides an electronic device, which includes the artificial intelligence chip described above.
[0241] Fig. 9 1 is a structural diagram showing a combined processing device 1200 according to an embodiment of the present disclosure. Fig. 9 As shown in , the combined processing device 1200 includes a computing processing device 1202 (for example, the artificial intelligence processor including multiple computing cores), an interface device 1204, other processing devices 1206, and a storage device 1208. According to different application scenarios, the computing processing device may include one or more computing devices 1210 (for example, computing cores).
[0242] In one possible implementation, the computing and processing device of the present disclosure may be configured to perform operations specified by a user. In an exemplary application, the computing and processing device may be implemented as a single-core artificial intelligence processor or a multi-core artificial intelligence processor. Similarly, one or more computing devices included in the computing and processing device may be implemented as an artificial intelligence processor core or a partial hardware structure of an artificial intelligence processor core. When multiple computing devices are implemented as an artificial intelligence processor core or a partial hardware structure of an artificial intelligence processor core, with respect to the computing and processing device of the present disclosure, it may be regarded as having a single-core structure or a homogeneous multi-core structure.
[0243] In an exemplary operation, the computing processing device of the present disclosure can interact with other processing devices through an interface device to jointly complete the operation specified by the user. Depending on the implementation, other processing devices of the present disclosure may include one or more types of processors in general and / or special processors such as a central processing unit (CPU), a graphics processing unit (GPU), an artificial intelligence processor, etc. These processors may include, but are not limited to, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., and their number can be determined according to actual needs. As mentioned above, only with respect to the computing processing device of the present disclosure, it can be regarded as having a single-core structure or a homogeneous multi-core structure. However, when the computing processing device and other processing devices are considered together, the two can be regarded as forming a heterogeneous multi-core structure.
[0244] In one or more embodiments, the other processing device can serve as an interface between the computing processing device of the present disclosure (which can be embodied as an artificial intelligence such as a related computing device for neural network computing) and external data and control, and perform basic controls including but not limited to data handling, starting and / or stopping the computing device, etc. In other embodiments, the other processing device can also cooperate with the computing processing device to jointly complete computing tasks.
[0245] In one or more embodiments, the interface device can be used to exchange data and control instructions between the computing and processing device and other processing devices. For example, the computing and processing device can obtain input data from other processing devices via the interface device and write it into a storage device (or memory) on the computing and processing device chip. Further, the computing and processing device can obtain control instructions from other processing devices via the interface device and write them into a control cache on the computing and processing device chip. Alternatively or optionally, the interface device can also read data from the storage device of the computing and processing device and exchange it with other processing devices.
[0246] Additionally or optionally, the combined processing device of the present disclosure may further include a storage device. As shown in the figure, the storage device is connected to the computing processing device and the other processing device, respectively. In one or more embodiments, the storage device may be used to store data of the computing processing device and / or the other processing device. For example, the data may be data that cannot be fully stored in the internal or on-chip storage device of the computing processing device or other processing device.
[0247] According to different application scenarios, the artificial intelligence chip disclosed in the present invention can be used for servers, cloud servers, server clusters, data processing devices, robots, computers, printers, scanners, tablet computers, smart terminals, PC devices, IoT terminals, mobile terminals, mobile phones, driving recorders, navigators, sensors, cameras, cameras, video cameras, projectors, watches, headphones, mobile storage, wearable devices, visual terminals, automatic driving terminals, transportation tools, household appliances, and / or medical equipment. The transportation tools include airplanes, ships, and / or vehicles; the household appliances include televisions, air conditioners, microwave ovens, refrigerators, rice cookers, humidifiers, washing machines, electric lights, gas stoves, and range hoods; the medical equipment includes magnetic resonance imaging, ultrasound, and / or electrocardiographs.
[0248] Fig.10 1 is a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server. Fig.10, the electronic device 1900 includes a processing component 1922 (e.g., an artificial intelligence processor including multiple computing cores), which further includes one or more computing cores, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0249] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0250] In the present disclosure, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units. The aforementioned components or units may be located at the same location or distributed to multiple network units. In addition, according to actual needs, some or all of the units may be selected to achieve the purpose of the scheme described in the embodiments of the present disclosure. In addition, in some scenarios, multiple units in the embodiments of the present disclosure may be integrated into one unit or each unit may exist physically separately.
[0251] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0252] The electronic device or processor disclosed in the present invention can also be applied to the fields of the Internet, Internet of Things, data centers, energy, transportation, public administration, manufacturing, education, power grids, telecommunications, finance, retail, construction sites, medical treatment, etc. Furthermore, the electronic device or processor disclosed in the present invention can also be used in application scenarios related to artificial intelligence, big data and / or cloud computing, such as the cloud, edge, and terminal. In one or more embodiments, an electronic device or processor with high computing power according to the disclosed solution can be applied to a cloud device (such as a cloud server), and an electronic device or processor with low power consumption can be applied to a terminal device and / or an edge device (such as a smart phone or a camera). In one or more embodiments, the hardware information of the cloud device and the hardware information of the terminal device and / or the edge device are compatible with each other, so that according to the hardware information of the terminal device and / or the edge device, suitable hardware resources can be matched from the hardware resources of the cloud device to simulate the hardware resources of the terminal device and / or the edge device, so as to complete the unified management, scheduling and collaborative work of the end-to-end or the cloud-edge-end integration.
[0253] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A data processing method, characterized in that: The method is applied to a computing core of a processor, the processor includes a plurality of computing cores, the method implements a convolution operation of processing data and weight data, the processing data includes image data; The method comprises: Data exchange between multiple computing cores; Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results; Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core; The data to be exchanged includes one of the weight data after segmentation, the processed data after segmentation, and the partial sum data, wherein the partial sum data is a convolution operation result obtained according to the processed data after segmentation or the weight data after segmentation; The data to be exchanged includes weight data after segmentation, or processed data after segmentation; the weight data or processed data is segmented into n parts; Data exchange between multiple computing cores includes: n computing cores perform n-1 rounds of data exchange, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data or each of the n processing data; Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including: After each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in this round of data exchange and the stored processing data, or performs a convolution operation based on one portion of processing data received in this round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core; According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including: The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core; The data to be exchanged includes partial and data, the multiple computing cores include n computing cores, each computing core stores n copies of the partial and data, and the multiple computing cores exchange data, including: exchanging the partial and data between the n computing cores, so that the partial and data stored in each computing core after the exchange corresponds to the same row segment or the same column segment of the processed data; Each computing core performs parallel operations based on the exchanged data to obtain parallel operation results, including: each computing core adds the partial sum data obtained after the data exchange to obtain the convolution operation result of the partial processing data and the weight data, and the partial processing data is obtained after the processing data is divided into n parts in the row direction or the column direction.
2. The method according to claim 1, characterized in that The data to be exchanged includes the segmented weight data, the weight data is segmented into n parts in the depth direction, the multiple computing cores include n computing cores, each computing core stores processing data and one weight data among the n weight data in an initial state, and the weight data stored in each computing core in an initial state is different; wherein n is an integer; Data exchange between multiple computing cores includes: Each computing core performs a convolution operation on the processed data and one weight data stored in the initial state, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges one weight data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data; Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including: After each round of data exchange, each computing core performs a convolution operation on the stored processing data based on the 1 weight data received in the current round of data exchange, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core; According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including: The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core.
3. The method according to claim 1, characterized in that The data to be exchanged includes the processed data after segmentation, the processed data is segmented into n parts in the depth direction, the multiple computing cores include n computing cores, each computing core stores weighted data and one of the n processed data in an initial state, and each computing core stores different processed data in an initial state; Data exchange between multiple computing cores includes: Each computing core performs a convolution operation on the weight data stored in the initial state and one portion of the processed data, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges the one portion of the processed data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each portion of the n portions of the processed data; wherein n is an integer; Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including: After each round of data exchange, each computing core performs a convolution operation on the stored weight data based on the 1 processed data received in the current round of data exchange, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core; According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including: The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core.
4. A processor, characterized in that: The processor includes a plurality of computing cores, and the processor implements a convolution operation of processing data and weight data, wherein the processing data includes image data, including: Data exchange between multiple computing cores; Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results; Determine the convolution operation result of the processing data and the weight data according to the parallel operation result of each computing core; The data to be exchanged includes one of the weight data after segmentation, the processed data after segmentation, and the partial sum data, wherein the partial sum data is a convolution operation result obtained according to the processed data after segmentation or the weight data after segmentation; The data to be exchanged includes weight data after segmentation, or processed data after segmentation; the weight data or processed data is segmented into n parts; Data exchange between multiple computing cores includes: n computing cores perform n-1 rounds of data exchange, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data or each of the n processing data; Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including: After each round of data exchange, each computing core performs a convolution operation based on one portion of weight data received in this round of data exchange and the stored processing data, or performs a convolution operation based on one portion of processing data received in this round of data exchange and the stored weight data, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core; According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including: The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core; The data to be exchanged includes partial and data, the multiple computing cores include n computing cores, each computing core stores n copies of the partial and data, and the multiple computing cores exchange data, including: exchanging the partial and data between the n computing cores, so that the partial and data stored in each computing core after the exchange corresponds to the same row segment or the same column segment of the processed data; Each computing core performs parallel operations based on the exchanged data to obtain parallel operation results, including: each computing core adds the partial sum data obtained after the data exchange to obtain the convolution operation result of the partial processing data and the weight data, and the partial processing data is obtained after the processing data is divided into n parts in the row direction or the column direction.
5. The processor according to claim 4, characterized in that The data to be exchanged includes the segmented weight data, the weight data is segmented into n parts in the depth direction, the multiple computing cores include n computing cores, each computing core stores processing data and one weight data among the n weight data in an initial state, and the weight data stored in each computing core in an initial state is different; wherein n is an integer; Data exchange between multiple computing cores includes: Each computing core performs a convolution operation on the processed data and one weight data stored in the initial state, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges one weight data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each of the n weight data; Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including: After each round of data exchange, each computing core performs a convolution operation on the stored processing data based on the 1 weight data received in the current round of data exchange, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core; According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including: The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core.
6. The processor according to claim 4, characterized in that The data to be exchanged includes the processed data after segmentation, the processed data is segmented into n parts in the depth direction, the multiple computing cores include n computing cores, each computing core stores weighted data and one of the n processed data in an initial state, and each computing core stores different processed data in an initial state; Data exchange between multiple computing cores includes: Each computing core performs a convolution operation on the weight data stored in the initial state and one portion of the processed data, and then performs n-1 rounds of data exchange among the n computing cores. In each round of data exchange, each computing core exchanges the one portion of the processed data initially stored to one of the other computing cores, so that after n-1 rounds of data exchange, each computing core has stored each portion of the n portions of the processed data; wherein n is an integer; Each computing core performs parallel computing based on the exchanged data to obtain parallel computing results, including: After each round of data exchange, each computing core performs a convolution operation on the stored weight data based on the 1 processed data received in the current round of data exchange, and accumulates the result of the convolution operation with the convolution operation result previously obtained by the computing core to obtain the result of the convolution operation of the computing core; According to the parallel operation results of each computing core, the convolution operation results of the processing data and the weight data are determined, including: The parallel operation result of each computing core is used as the convolution operation result of the processing data and the weight data in the computing core.
7. An artificial intelligence chip, characterized in that: The chip comprises a processor as claimed in any one of claims 4 to 6.
8. An electronic device, characterized in that: The electronic device comprises the artificial intelligence chip as claimed in claim 7.
