A network training method to avoid data overlap in forward computation of many-core architecture chips
In a multi-core and multi-chip system, in response to the data overlapping problem of convolutional operations, the over-part is set to zero by using the identification in the storage space, which solves the data overlapping problem and improves the computing efficiency.
Patent Information
- Application Number
- CN202110981665.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-25
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2041-08-25
AI Technical Summary
In multi-core and multi-chip systems, the problem of overlaying forward computing data is prone to occur during the convolutional operation of neural network models, resulting in waste of cache resources and increased communication complexity between functional cores, affecting computing efficiency.
By buffering the processing sub-data and weight data of the convolution process in the storage space of the target function core, and determining the identification of the operation data based on the size and step size of the convolution kernel. When the identification exceeds the identification, it is set to zero to avoid data overlap. Reduce communication between functional cores and improve computing efficiency.
It effectively avoids the problem of data overlap, saves cache resources, reduces communication between functional cores, and improves the computing efficiency of multi-core and multi-chip systems.
Smart Images

Figure CN113705785B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information processing technology, and in particular to a network training method, a processor, a chip and an electronic device that avoids the overlap of forward computing data of a multi-core architecture chip. Background Art
[0002] As the development focus of artificial intelligence (AI) gradually shifts from the cloud to the terminal, a new generation of computing chip industry has emerged. The theoretical framework, architecture system, mapping method, etc. of non-traditional AI computing dedicated chips have become a new research direction in the field of artificial intelligence and are considered to be the engine of the fourth industrial revolution.
[0003] In a multi-core multi-chip system (for example, including a chip system with many-core architecture), due to the limitations of functional core storage and computing power, the computing resources of a functional core or a chip cannot meet the needs of a large-scale neural network. If a large-scale neural network is divided and mapped on a single functional core or a single chip, the calculation time will be very long. Therefore, the neural network model can be split into different functional cores for multi-core parallel calculation. Taking the convolutional neural network as an example, when the convolution operation process needs to use neurons split into different functional cores, data overlap may occur, such as the overlap of forward calculation data. Summary of the invention
[0004] In view of this, the present disclosure proposes a network training method, a processor, a chip and an electronic device that avoids the overlap of forward computing data of a multi-core architecture chip.
[0005] According to one aspect of the present disclosure, a data processing method is provided, the method being applied to a processor, the processor comprising a plurality of functional cores, the plurality of functional cores comprising a target functional core for performing convolution processing, the storage space of the target functional core being cached with processing sub-data and weight data of the convolution processing, the processing sub-data being obtained by splitting the processing data of the convolution processing, each data in the processing sub-data having a first data identifier, and for any target functional core, the method comprising: for any convolution operation of the target functional core, determining a second data identifier of each data in the operation data corresponding to the convolution operation according to the convolution kernel size and the convolution step of the convolution processing; when there is a second data identifier exceeding the first data identifier, reading the operation data corresponding to the second data identifier that does not exceed the first data identifier from the storage space, and setting the operation data corresponding to the second data identifier that exceeds the first data identifier to zero; performing a convolution operation according to the operation data corresponding to the convolution operation and the weight data to obtain an operation result of the convolution operation.
[0006] In one possible implementation, for any target function core, the method also includes: when there is no second data identifier exceeding the first data identifier, reading the operation data corresponding to the second data identifier from the storage space; performing a convolution operation based on the operation data corresponding to the convolution operation and the weight data to obtain the operation result of the convolution operation; and determining the processing sub-result of the target function core based on the operation results of multiple convolution operations of the target function core.
[0007] In a possible implementation, the method further includes: determining a splitting scale of processing sub-data of the processing data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data, and determining a target functional core from the multiple functional cores; splitting the processing data according to the splitting scale to obtain multiple processing sub-data; and sending the processing sub-data and the weight data to each target functional core respectively, so that the target functional core caches the processing sub-data and the weight data.
[0008] In a possible implementation, the method further includes: when receiving processing sub-results from each target functional core, fusing each processing sub-result to obtain a processing result of the convolution processing.
[0009] In a possible implementation, the splitting scale of the processing sub-data of the processing data is determined according to the capacity of the storage space of the multiple functional cores and the scale of the weight data, including: determining the capacity of the storage subspace of the target functional core for the processing sub-data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data; determining the splitting scale of the processing sub-data according to the capacity of the storage subspace, the splitting scale including a first scale in the height direction and a second scale in the width direction.
[0010] In a possible implementation, the processed data includes four dimensions of height, width, channel, and batch, wherein the processed data is split according to the splitting scale to obtain a plurality of processed sub-data, including: splitting the processed data in height and width directions respectively according to the first scale and the second scale to obtain the plurality of processed sub-data, wherein the processed data is not split in the dimensions of channel and batch.
[0011] In a possible implementation, the processed data includes any one of image data, sound data, and text data.
[0012] According to another aspect of the present disclosure, a processor is provided, the processor comprising a plurality of functional cores, the plurality of functional cores comprising a target functional core for performing convolution processing, the storage space of the target functional core caches processing sub-data and weight data of the convolution processing, the processing sub-data being obtained by splitting the processing data of the convolution processing, each data in the processing sub-data having a first data identifier, and for any convolution operation of any target functional core, the target functional core is used to determine, according to the convolution kernel size and the convolution step of the convolution processing, a second data identifier of each data in the operation data corresponding to the convolution operation; when there is a second data identifier exceeding the first data identifier, read the operation data corresponding to the second data identifier that does not exceed the first data identifier from the storage space, and set the operation data corresponding to the second data identifier that exceeds the first data identifier to zero; perform a convolution operation according to the operation data corresponding to the convolution operation and the weight data to obtain an operation result of the convolution operation.
[0013] In one possible implementation, the processor is also used to, for any target function core, read the operation data corresponding to the second data identifier from the storage space when there is no second data identifier exceeding the first data identifier; perform a convolution operation based on the operation data corresponding to the convolution operation and the weight data to obtain the operation result of the convolution operation; and determine the processing sub-result of the target function core based on the operation results of multiple convolution operations of the target function core.
[0014] In a possible implementation, the processor is also used to: determine the splitting scale of the processing sub-data of the processing data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data, and determine the target functional core from the multiple functional cores; split the processing data according to the splitting scale to obtain multiple processing sub-data; and send the processing sub-data and the weight data to each target functional core respectively, so that the target functional core caches the processing sub-data and the weight data.
[0015] In a possible implementation, the processor is further configured to: upon receiving processing sub-results from each target functional core, fuse the processing sub-results to obtain a processing result of the convolution processing.
[0016] In a possible implementation, the splitting scale of the processing sub-data of the processing data is determined according to the capacity of the storage space of the multiple functional cores and the scale of the weight data, including: determining the capacity of the storage subspace of the target functional core for the processing sub-data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data; determining the splitting scale of the processing sub-data according to the capacity of the storage subspace, the splitting scale including a first scale in the height direction and a second scale in the width direction.
[0017] In a possible implementation, the processed data includes four dimensions of height, width, channel, and batch, wherein the processed data is split according to the splitting scale to obtain a plurality of processed sub-data, including: splitting the processed data in height and width directions respectively according to the first scale and the second scale to obtain the plurality of processed sub-data, wherein the processed data is not split in the dimensions of channel and batch.
[0018] In a possible implementation, the processed data includes any one of image data, sound data, and text data.
[0019] According to another aspect of the present disclosure, an artificial intelligence chip is provided, wherein the chip includes the processor as described above.
[0020] According to another aspect of the present disclosure, an electronic device is provided, comprising the artificial intelligence chip as described above.
[0021] In the disclosed embodiment, for any convolution operation of the target functional core, the second data identifier of each data in the operation data corresponding to the convolution operation can be determined according to the convolution kernel size and the convolution step size of the convolution processing; when there is a second data identifier that exceeds the first data identifier, the operation data corresponding to the second data identifier that does not exceed the first data identifier is read from the storage space, and the operation data corresponding to the second data identifier that exceeds the first data identifier is set to zero; according to the operation data corresponding to the convolution operation and the weight data, the convolution operation is performed to obtain the operation result of the convolution operation. In this way, by setting the operation data corresponding to the second data identifier that exceeds the first data identifier to zero, the data overlap problem can be avoided, cache resources can be saved, communication between functional cores can be reduced, and the computing efficiency of multi-core multi-chip systems can be improved.
[0022] 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
[0023] 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.
[0024] Figure 1 A schematic diagram showing a processor according to an embodiment of the present disclosure;
[0025] Figure 2 A schematic diagram showing deployment of a neural network in a multi-core multi-chip system according to an embodiment of the present disclosure;
[0026] Figure 3 A schematic diagram showing the data overlap problem;
[0027] Figure 4 A schematic diagram showing a direct data complement method for solving the data overlap problem;
[0028] Figure 5 A schematic diagram showing the method of inter-core communication data complementation to solve the data overlap problem;
[0029] Figure 6 A flowchart showing a data processing method according to an embodiment of the present disclosure;
[0030] Figure 7 A schematic diagram showing a data processing method according to an embodiment of the present disclosure;
[0031] Figure 8 A flowchart showing a data processing method according to an embodiment of the present disclosure;
[0032] Fig. 9 A schematic diagram showing the fusion of processing sub-results according to an embodiment of the present disclosure;
[0033] Fig.10 A block diagram showing an electronic device according to an embodiment of the present disclosure;
[0034] Fig.11 A block diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0035] 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.
[0036] 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.
[0037] 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 main purpose of the present disclosure.
[0038] Figure 1 A schematic diagram of a processor according to an embodiment of the present disclosure is shown. The data processing method according to the embodiment of the present disclosure is applied to the processor, and the processor includes multiple functional cores.
[0039] In one possible implementation, Figure 1 As shown, data can be transmitted between functional cores within each processor and between functional cores of different processors; wherein each functional core includes a storage component, and the storage component can be used to store data transmitted with other functional cores.
[0040] In one possible implementation, Figure 1 As shown, each functional core includes a processing component and a storage component. The processing component may include a dendrite unit, an axon unit, a cell body unit, and a routing unit. The storage component may include multiple storage units.
[0041] 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 functional cores, which can independently process different tasks or process the same task in parallel to improve processing efficiency. Functional cores can transmit information between cores through routing units within the functional cores.
[0042] A processing component and a storage component may be provided within the functional 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 functional cores. The processing component within the functional core may read and write to multiple storage units of the storage component to interact with data with the storage component within the functional core, and may respectively undertake respective data processing tasks and / or data transmission tasks to obtain data processing results, or communicate with other functional cores. Among them, communicating with other functional cores includes communicating with other functional cores within the processor, and communicating with functional cores within other processors.
[0043] In a possible implementation, the storage component includes a plurality of storage units, wherein 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 present disclosure does not limit the capacity and bit width of the storage unit.
[0044] In one possible implementation, a multi-core multi-chip system can be formed by cascading brain-like chips. The system can not only support multi-core parallelism and integrated storage and computing architecture, but also make full use of the advantages of distributed storage and computing, greatly increase the parallelism of computing from the hardware level, and reduce memory storage and reading costs, so as to support large-scale neural network applications, such as artificial neural networks (ANN), spiking neural networks (SNN), etc.
[0045] Assume that a multi-core multi-chip system may include N functional cores, i.e., functional core 1 to functional core N. In the process of deploying a large-scale neural network (including multi-layer convolution processing tasks) to a multi-core multi-chip system, M (M≤N) target functional cores may be selected from the N functional cores according to the size of the neural network, and the neural network may be split into M parts, which are mapped to the M target functional cores respectively. Among them, the present disclosure does not limit the number of functional cores N and the number of target functional cores M, and the specific values may be determined according to the size of the neural network and the actual application situation.
[0046] In this case, in the neural network, the convolution processing task is performed on the processing data and the weight data, and the M target function cores can perform the convolution processing task in parallel, and each target function core can perform a part of the convolution processing task. For example, the processing data to be convolution processed can be split into M processing sub-data, and the split processing sub-data and weight data are respectively sent to the corresponding target function core, and the storage space of each target function core can cache the processing sub-data and weight data to be convolution processed, and the processing sub-data and weight data cached in the storage space are convolution processed by the processing components of each target function core to obtain the processing sub-result.
[0047] Figure 2 FIG. 1 is a schematic diagram showing a neural network deployed in a multi-core multi-chip system according to an embodiment of the present disclosure. Figure 2 As shown, Figure 21 represents the neural network to be split, and Figure 23 represents a multi-core multi-chip system including 9 (N=9) functional cores. The neural network can be deployed in the multi-core multi-chip system through two steps: network splitting and network mapping.
[0048] like Figure 2As shown, in the network splitting step, the neural network ( Figure 2 The multiple neurons shown in 21 in FIG. 21 can be divided into 6 (M=6) parts according to the limitation of the physical resources of the functional cores (such as the functional core computing resources and storage resources) in the multi-core multi-chip system, and allocated to the following parts: Figure 2 Among the six different logic cores shown in FIG. 22 , the six logic cores can form a logic connection diagram according to the data transmission relationship between the logic cores.
[0049] In the network mapping step, the logical cores can be placed in Figure 2 In the physical core of the planar grid structure shown in Figure 23, the target functional cores labeled C1 to C6 are respectively used to place a part of the neural network, and the three unlabeled functional cores can be used to perform other tasks, which is not limited by the present disclosure.
[0050] In this case, in the neural network ( Figure 2 21) performs convolution processing tasks on the processing data and weight data, and the six target function cores (C1 to C6) can perform convolution processing tasks in parallel, and each target function core can perform a part of the convolution processing task.
[0051] For example, the processing data Data to be processed by convolution can be split into 6 processing sub-data Data1 to Data6, and the split processing sub-data Data1 to Data6 and weight data Weight are respectively sent to the corresponding target function cores C1 to C6. Therefore, the storage space of the target function core C1 can cache the processing sub-data Data1 and weight data Weight to be processed by convolution, the storage space of the target function core C2 can cache the processing sub-data Data2 and weight data Weight to be processed by convolution, and so on, the storage space of the target function core C6 can cache the processing sub-data Data6 and weight data Weight to be processed by convolution.
[0052] The processing sub-data Data1 to Data6 and the weight data Weight cached in the storage space are convolved by the processing components of the target function cores C1 to C6 to obtain the processing sub-results.
[0053] However, when multiple target function cores process the same convolution processing task in parallel, there will be a data overlap problem.
[0054] Figure 3 A schematic diagram showing the data overlap problem is shown in Figure 3 As shown, assuming that the processing data is 6×6 image data, the weight data includes a 2×2 convolution kernel, and the storage space of the target function kernel A is cached with Figure 3 The 3×3 processing sub-data shown in the upper left corner has a cache in the storage space of the target function core B. Figure 3 The 3×3 processing sub-data shown in the upper right corner has a cache in the storage space of the target function core C. Figure 3 The 3×3 processing sub-data shown in the lower left corner has a cache in the storage space of the target function core D. Figure 3 The 3×3 processing sub-data shown in the lower right corner, and the target function cores A~D can cache the same weight data.
[0055] When the convolution kernel slides to the edge of the split of the processing data, it needs to use the processing sub-data cached in the storage space of multiple target function kernels. For example, when the convolution kernel slides to Figure 3 In the case of the position shown, it is necessary to use the data cached in the storage space of the target function core A and the target function B at the same time. This is the data overlap problem, and the data that needs to be used at the same time is overlapping data.
[0056] In the related art, the data overlap problem can be solved by a direct data complement method or an inter-core communication data complement method.
[0057] Figure 4 The schematic diagram of the direct data complement method to solve the data overlap problem is shown in FIG. Figure 4 As shown, for a certain target functional core, the gray part is supplementary data, and the required data can be supplemented by advance calculation to solve the data overlap problem. However, this method will waste the cache resources of the target functional core. When the cache resources of each target functional core are limited, more functional cores need to be occupied.
[0058] Figure 5 The schematic diagram of the inter-core communication data complement method to solve the data overlap problem is shown in FIG. Figure 5 As shown in the figure, the target functional cores Core0 to Core3 cache the processed sub-data after splitting respectively. The inter-core communication data complementation method can solve the problem of data overlap by exchanging overlapping data (i.e., data at the split edge of 16×1×32 size) between adjacent functional cores. However, this method requires copying the overlapping data first, and then sending the overlapping data to the adjacent functional cores for data caching. In this case, it will not only consume the cache resources of the functional cores, but also increase the complexity of communication between the functional cores.
[0059] In response to the above problems, the present disclosure proposes a network training method to avoid overlap of forward computing data in a multi-core architecture chip, which can perform zero padding processing on places where overlapping data may be generated (for example, including processing data splitting edges) to avoid overlap problems between core data.
[0060] Figure 6A flow chart of a data processing method according to an embodiment of the present disclosure is shown. The method is applied to a processor, the processor comprising a plurality of functional cores, the plurality of functional cores comprising a target functional core for performing convolution processing, the storage space of the target functional core caches processing sub-data and weight data of the convolution processing, the processing sub-data is obtained by splitting the processing data of the convolution processing, and each data in the processing sub-data has a first data identifier.
[0061] For any target function core, such as Figure 6 As shown, the method includes steps S61 to S63:
[0062] In step S61, for any convolution operation of the target function kernel, a second data identifier of each data in the operation data corresponding to the convolution operation is determined according to the convolution kernel size and the convolution step size of the convolution processing;
[0063] In step S62, when there is a second data identifier that exceeds the first data identifier, the operation data corresponding to the second data identifier that does not exceed the first data identifier is read from the storage space, and the operation data corresponding to the second data identifier that exceeds the first data identifier is set to zero;
[0064] In step S63, a convolution operation is performed according to the operation data corresponding to the convolution operation and the weight data to obtain the operation result of the convolution operation.
[0065] In a possible implementation, the processed data includes any one of image data, sound data, and text data.
[0066] In a possible implementation, the processing data includes four dimensions: height, width, channel, and batch.
[0067] For example, assuming that the processed data is image data, the height dimension H represents the number of pixels of the processed data in the height direction, the width dimension W represents the number of pixels of the processed data in the width direction, the channel dimension C represents the number of channels of the processed data (for example, the number of channels of black and white images is C=1, and the number of channels of RGB color images is C=3), and the batch dimension N represents the number of images in a batch of processed data.
[0068] It should be understood that the present disclosure does not limit the dimension of the processed data. When the channel dimension C and the batch dimension N are 1, the processed data is processed data including two dimensions: the height dimension H and the width dimension W.
[0069] In a possible implementation, for any target function core, the processing component of the target function core may perform convolution processing on the processing sub-data and weight data cached in the storage space to obtain a processing sub-result. The convolution processing process of each target function core may include multiple convolution operations.
[0070] In one possible implementation, Figure 7 A schematic diagram of a data processing method according to an embodiment of the present disclosure is shown. Figure 7 As shown, the multiple functional cores of the processor may include a target functional core A and a target functional core B for performing convolution processing. The storage space of the target functional core A caches the processing sub-data Data1 and weight data Weight of the convolution processing. The storage space of the target functional core B caches the processing sub-data Data2 and weight data Weight of the convolution processing. The processing sub-data Data1 and the processing sub-data Data2 are obtained by splitting the processing data of the convolution processing, and each data in the processing sub-data has a first data identifier.
[0071] It should be understood that the present disclosure does not limit the number of target function cores, and for ease of explanation, only target function core A and target function core B are used as examples. The present disclosure can split the processing data into multiple processing sub-data, and different processing sub-data can be cached in the storage space of different target function cores.
[0072] like Figure 7 As shown, for the target functional core A, the processing sub-data Data1 cached in the functional core storage space is Each data in the processing sub-data Data1 has the first data identifier That is, D 11 The first data identifier representing the processing of A1 in the sub-data Data1 may indicate that the data A1 is located in the first row and the first case; 12 The first data identifier representing the processing of A2 in the sub-data Data1 can indicate that data A2 is located in the first row and the second case; and so on. 33 The first data identifier representing the processing of A9 in the sub-data Data1 may indicate that the data A9 is located in the third row and the third column.
[0073] The function core storage space also caches weight data for convolution processing, such as convolution kernels for convolution processing. Its size is 2×2, and the convolution step is 1. It should be understood that the present disclosure does not limit the size and step of the convolution kernel.
[0074] In step S61, the convolution processing process in the target function core A may include multiple convolution operations. For any convolution operation of the target function core A, the second data identifier of each data in the operation data corresponding to the convolution operation is determined according to the convolution kernel size and the convolution step size of the convolution processing, that is, the convolution kernel The sliding window of the position identifier corresponding to each data in the operation data to be obtained this time; for example, for the third convolution operation of the target function core A, the second data identifier of each data in the operation data corresponding to the convolution operation can be expressed as
[0075] In step S62, when there is a second data identifier that exceeds the first data identifier, for example, for the third convolution operation of the target function kernel A, at the second data identifier D 13 and D 23 If the first data identifier is not exceeded, the second data identifier D that does not exceed the first data identifier can be read from the storage space of the target functional core A. 13 and D 23 The corresponding operation data A3 and A6; in the second data mark D 14 and D 24 When the first data mark is exceeded, the second data mark D exceeding the first data mark can be 14 and D 24 The corresponding operation data is set to zero;
[0076] In step S63, according to the operation data corresponding to the convolution operation And the weight data The convolution operation is performed to obtain the operation result A3×K1+A6×K3 of the convolution operation.
[0077] It should be understood that, for the target functional core B, when the convolution operation has a second data identifier that exceeds the first data identifier, the above method for the target functional core A can be referred to, and will not be repeated here.
[0078] According to an embodiment of the present disclosure, when there is a second data identifier that exceeds the first data identifier, the calculation data corresponding to the second data identifier that exceeds the first data identifier can be set to zero, and the data exceeding the current block will be processed as zero in the program. This does not require additional cache resources, avoids communication between adjacent functional cores, solves the data overlap problem, and improves the computing efficiency of the multi-core multi-chip system.
[0079] The data processing method according to the embodiment of the present disclosure is described below.
[0080] Before each target functional core performs convolution processing on the processed sub-data and weight data cached in its respective storage space, the processed data may be split according to the functional core storage constraint, so that the target functional core caches the split processed sub-data and weight data. Specifically, the process may include steps S01 to S03: In step S01, the splitting scale of the processing sub-data of the processed data is determined according to the capacity of the storage space of the multiple functional cores and the scale of the weight data, and the target functional core is determined from the multiple functional cores.
[0081] In step S02, the processed data is split according to the splitting scale to obtain a plurality of processed sub-data.
[0082] In step S03, the processing sub-data and the weight data are sent to each target functional core respectively, so that the target functional core caches the processing sub-data and the weight data. In a possible implementation, in step S01, based on the capacity of the storage space of multiple functional cores and the scale of the weight data, that is, when the storage space to be occupied by the processing sub-data and the weight data after splitting is less than or equal to the storage space capacity of each functional core, the splitting scale that satisfies this situation can be determined as the splitting scale of the processing sub-data. According to the determined splitting scale, the number of splittable parts of the processing data, that is, the number of processing sub-data, can be determined, and a corresponding number of functional cores can be selected from multiple functional cores as target functional cores.
[0083] In a possible implementation, in step S02, the processed data is split according to the splitting scale of the processed data determined in step S01 to obtain a plurality of processed sub-data.
[0084] In a possible implementation, in step S03, the split processing sub-data and weight data are sent to each target functional core respectively, so that the target functional core can cache the corresponding processing sub-data and weight data.
[0085] Through steps S01 to S03, the splitting scale can be determined according to the storage constraints of the functional core, the target functional core can be determined from multiple functional cores, and the weight data and the split processing sub-data can be sent to the corresponding target functional core. Multiple target functional cores can be operated in parallel to improve the computational efficiency of convolution processing.
[0086] The following is a processing data of size N×H×W×C, and a size K h ×K w ×C×C out Taking weight data as an example, the data processing method for splitting according to the functional core storage constraints in steps S01 to S03 of the embodiment of the present disclosure is described in detail.
[0087] Among them, H represents the height dimension of the processed data, W represents the width dimension of the processed data, C represents the channel dimension of the processed data, N represents the batch dimension of the processed data, and K h Represents the height dimension of the convolution kernel in the weight data, K w represents the width dimension of the convolution kernel in the weight data, C represents the number of channels corresponding to the processed data in the weight data, and C out Indicates the number of channels of the convolution processing output.
[0088] In order to make full use of the data at the edge of the processed data, zero padding can be performed on the edge of the processed data. P can be filled in the height dimension H and width dimension W of the processed data respectively. h Line and P w After zero padding, the height dimension H and width dimension W of the processed data can be updated, that is, H = H + 2 × P h ,W=W+2×P w .
[0089] In one possible implementation, step S01 may include: determining the capacity of the storage subspace of the target functional core for the processing sub-data based on the capacity of the storage space of the multiple functional cores and the scale of the weight data; determining the splitting scale of the processing sub-data based on the capacity of the storage subspace, the splitting scale including a first scale in the height direction and a second scale in the width direction.
[0090] For example, in a multi-core multi-chip system, since the storage space inside a single functional core is limited, the processing data can be split to meet the storage space requirements inside each functional core.
[0091] In the case where the processing data and weight data of each functional core can be mixed and stored and share the storage space, assuming that the total storage space of each functional core is M, the storage space M occupied by the weight data can be determined according to the scale of the weight data. w , the storage space M occupied by the function core can be deducted from the storage space M occupied by the weight data w , get the capacity M of the storage subspace of the target function core for processing sub-data o , that is, M o =MM w .
[0092] Alternatively, when the processing sub-data and weight data of each functional core can be stored separately and each has an independent storage space, the capacity M1 of the storage space for storing the processing data can be determined as the capacity M1 of the storage sub-space for the processing sub-data of the target functional core. o , that is, M o =M1.
[0093] According to the capacity of the storage subspace M o , the splitting scale of the processed sub-data can be determined, and the splitting scale may include a first scale H in the height direction g and the second scale W in the width direction g For example, assuming that the data width of the processed data is D b , the storage space M required to process the sub-data a =N×H g ×W g ×C×D b , can satisfy M a ≤M o Situation H g and W g As the first and second scale.
[0094] The storage cost can be reduced by quantizing the processed data. For example, assuming that the processed data is a 32-bit floating point number, the value range of the processed data can be counted, and the maximum and minimum values can be found to perform data standardization (such as min-max standardization), and the processed data will be mapped to an 8-bit integer range (-127 to 128). b =8bit=1Byte.
[0095] It should be understood that when M is satisfied a ≤M o In the case of g and the second scale W g The size of is not limited, where the first scale H g and the second scale W g The larger the value of is, the fewer the number of target function cores required, and the lower the power consumption of convolution processing of multiple target function cores; the first scale H g and the second scale W g The smaller the value of is, the more target function cores are required, the greater the parallelism of multiple target function cores is, and the faster the calculation speed is.
[0096] In this way, the splitting scale of the processed sub-data can be determined, which is convenient for the subsequent splitting of the processed data, is conducive to the parallel processing of the multi-functional core, and can improve the computing efficiency.
[0097] The first scale H determined in step S01 g and the second scale W g , in step S02, according to the first scale H g and the second scale W g , split the processed data.
[0098] In a possible implementation, step S02 may include: splitting the processed data in a height direction and a width direction respectively according to the first scale and the second scale to obtain the multiple processed sub-data, wherein the processed data is not split in the dimensions of channels and batches.
[0099] For example, the first dimension H in the height direction may be g and the second scale W in the width direction g , the data is split in the height direction H and width direction W respectively, and the number of groups split in the height direction H is G h =ceil(H / H g ), the number of groups G split in the width direction W w =ceil(W / W g ), we can get G w ×G h Process sub-data, where ceil() is the upward rounding function.
[0100] It should be noted that since N represents the batch dimension of the processed data, for example, assuming that the processed data is image data, the batch dimension N can represent the number of images processed at one time, and the size of the batch N value can be easily preset according to the operation situation. Therefore, the processed data batch dimension can be kept unchanged. In addition, since the sum operation needs to be performed between the channels of the processed data, the processed data can be split in the channel direction only in the height H and width W directions.
[0101] In this way, the processing data can be split in the height direction and width direction respectively, which is conducive to the parallel operation of multiple target function cores on the split processing sub-data in the subsequent steps, thereby improving the computational efficiency of the convolution processing.
[0102] The plurality of processing sub-data determined in step S02 may be sent to each target functional core in step S03 .
[0103] In a possible implementation, according to step S01 and step S02, G has been determined from multiple functional cores. w ×G h target function cores, and the processing data has been split into G w ×G h The weight data and G w ×G h The processed sub-data are sent to G w ×G h target function cores, so that any target function core can cache weight data and G w ×G hAny processing sub-data among the processing sub-data, wherein the processing sub-data cached by each target functional core may be different.
[0104] The splitting of the processing data can be completed through steps S01 to S03, so that each target function core caches the split processing sub-data and weight data.
[0105] After completing steps S01 to S03, for any target function core, each target function core can perform convolution processing on the cached processing sub-data and weight data, and determine the processing sub-results of each target function core based on the results of multiple convolution operations during the convolution processing.
[0106] Figure 8 A flow chart showing a data processing method according to an embodiment of the present disclosure is shown as follows: Figure 8 As shown, the data processing method may also include:
[0107] In step S64, when there is no second data identifier exceeding the first data identifier, the operation data corresponding to the second data identifier is read from the storage space;
[0108] In step S65, a convolution operation is performed according to the operation data corresponding to the convolution operation and the weight data to obtain the operation result of the convolution operation;
[0109] In step S66, the processing sub-result of the target function core is determined according to the operation results of multiple convolution operations of the target function core.
[0110] It should be understood that the present disclosure does not limit the number of target function cores. For the sake of convenience, only target function core A and target function core B are used as examples to illustrate steps S61 to S66.
[0111] It is assumed that the processing sub-data cached by the target functional core A is The processing sub-data cached by the target functional core B is The weight data cached by target function core A and target function core B include the convolution kernel: The step length of the convolution kernel in the height dimension and the width dimension is 1. The present disclosure does not limit the size and step length of the convolution kernel, which can be determined according to the actual convolution operation situation.
[0112] In step S61, for the target function core A, the sub-data Each data has a first data identifier Among them, the first data identifier D 11 The data A1 is located in the first row and the first case, and the rest are marked D 12 ~D 33Similar, no further elaboration is given here.
[0113] For any convolution operation of the target function core A, the second data identifier of each data in the operation data corresponding to the convolution operation can be determined according to the convolution kernel size and the convolution step size of the convolution processing.
[0114] For example, the target function kernel A may include 9 convolution operations. According to the direction of the convolution kernel sliding, the second data identifier of the operation data corresponding to the first convolution operation is The second data identifier of the operation data corresponding to the second convolution operation is The second data identifier of the operation data corresponding to the third convolution operation is The second data identifier of the operation data corresponding to the subsequent six convolution operations can be determined in the same manner as the first three operations, which will not be repeated here.
[0115] Therefore, in step S61, the second data identifier of each data in the operation data corresponding to each convolution operation can be determined.
[0116] After determining the second data identifier of each convolution operation in step S61, it can be determined whether there is a second data identifier that exceeds the first data identifier in each convolution operation. If there is a second data identifier that exceeds the first data identifier in this convolution operation, steps 62 to S63 can be executed to perform zero padding; if there is no second data identifier that exceeds the first data identifier in this convolution operation, steps S64 to S65 can be executed without performing zero padding and directly executing the convolution operation task.
[0117] In step S62 to step S63, when there is a second data identifier that exceeds the first data identifier, for example, for the third convolution operation of the target function kernel A, at the second data identifier D 13 and D 23 If the first data identifier is not exceeded, the second data identifier D that does not exceed the first data identifier can be read from the storage space of the target functional core A. 13 and D 23 The corresponding operation data A3 and A6; in the second data mark D 14 and D 24 When the first data mark is exceeded, the second data mark D exceeding the first data mark can be 14 and D 24 The corresponding operation data is set to zero;
[0118] According to the operation data corresponding to this convolution operation And the weight data The convolution operation is performed to obtain the operation result A3×K1+A6×K3 of the convolution operation.
[0119] In steps S64 to S65, when there is no second data identifier beyond the first data identifier, for example, for the first convolution operation of the target function core A, the second data identifier of each data in the operation data corresponding to the convolution operation can be expressed as Second data identifier D 11 , D 12 , D 21 and D 22 Without exceeding the first data identifier, the second data identifier D can be read from the storage space of the target functional core A. 11 , D 12 , D 21 and D 22 The corresponding operation data A1, A2, A4 and A5;
[0120] According to the operation data corresponding to this convolution operation And the weight data The convolution operation is performed to obtain the convolution operation result A1×K1+A2×K2+A4×K3+A5×K4.
[0121] According to steps S61 to S65, the operation results of multiple convolution operations of the target function core A can be obtained, and the processing sub-results of the target function core A can be determined.
[0122] Among them, the calculation result of the first convolution operation is AO1=A1×K1+A2×K2+A4×K3+A5×K4;
[0123] The result of the second convolution operation is AO2 = A2 × K1 + A3 × K2 + A5 × K3 + A6 × K4;
[0124] The result of the third convolution operation is AO3=A3×K1+A6×K3;
[0125] The result of the fourth convolution operation is AO4=A4×K1+A5×K2+A7×K3+A8×K4;
[0126] The result of the fifth convolution operation is AO5=A5×K1+A6×K2+A8×K3+A9×K4;
[0127] The result of the sixth convolution operation is AO6=A6×K1+A9×K3;
[0128] The result of the seventh convolution operation is AO7=A7×K1+A7×K2;
[0129] The result of the eighth convolution operation is AO8=A8×K1+A9×K2;
[0130] The result of the ninth convolution operation is AO9=A9×K1.
[0131] It should be understood that, for the target function core B, the above method for the target function core A can be referred to to obtain the processing sub-result of the target function core B, which will not be elaborated here.
[0132] In steps S61 to S66, the total number of zero padding is related to the splitting method and the convolution kernel size and step size. Assume that the size of the convolution kernel is K h ×K w , the step lengths in height and width are S respectively h and S w , the size of the processed sub-data is H g ×W g , floor() is the rounding down function.
[0133] When S h ×floor((H g -1) / S h )+K h ≤H g There is no need to fill zero in the height direction.
[0134] When S w ×floor((W g -1) / S w )+K w ≤W g No zero padding is required in the width direction.
[0135] Otherwise, the processing sub-data H needs to be g ×W g By padding the right and bottom sides with zeros, it becomes max(H g ,S h ×floor((H g -1) / S h )+K h )×max(W g ,S w ×floor((W g -1) / S w )+K w );
[0136] The total number of zero padding is: max(H g , S h ×floor((H g -1) / S h )+K h )×max(W g , S w ×floor((Wg -1) / S w )+K w )-H g ×W g .
[0137] Through steps S61 to S66, when there is no second data identifier that exceeds the first data identifier, there is no need for zero padding, and only when there is a second data identifier that exceeds the first data identifier, the operation data corresponding to the second data identifier that exceeds the first data identifier is set to zero. Therefore, the method can avoid exchanging data between target function cores, reduce the additional occupation of cache resources of each target function core, and can obtain the processing sub-results of each target function core in parallel, thereby improving the computing efficiency of the multi-core multi-chip system.
[0138] In a possible implementation, after obtaining the processing sub-results of each target function core in steps S61 to S66, the method further includes:
[0139] When the processing sub-results from each target functional core are received, each processing sub-result is fused to obtain the processing result of the convolution processing.
[0140] For example, Fig. 9 A schematic diagram showing the fusion of processing sub-results in an embodiment of the present disclosure is shown. Fig. 9 As shown, it is assumed that the processing sub-data cached by the target functional core A is The processing sub-data of the target target function core B cache is The weight data cached by target function core A and target function core B include the convolution kernel:
[0141] From the previous steps S61 to S66, it can be seen that the processing sub-result obtained by the target function core A is The processing result obtained by the target function core B is The processing sub-results of the target function core A and the processing sub-results of the target function core B can be fused, and the overlapping data parts can be added together to obtain
[0142] Among them, when the convolution kernel slides to Fig. 9 In the case of the convolution kernel position shown, AO3+BO1=A3×K1+A6×K3+B1×K2+B4×K4. It can be seen that the processing result of the convolution processing after fusion is the same as the processing result of the convolution processing before splitting.
[0143] Alternatively, the processing sub-result of the target function core A and the processing sub-result of the target function core B are fused, or the processing sub-result of the target function core A and the processing sub-result of the target function core B are spliced to obtain
[0144] Among them, the neural network may include multiple convolutional layers, and the splicing processing is equivalent to distributing the output of neurons in different functional cores, which is beneficial for the input to the next convolutional layer to be sent to the functional cores used for the next layer input according to the functional core grouping situation.
[0145] It should be understood that the fusion method of each processing sub-result can be a fusion method of adding the edge overlapping data of each processing sub-result, or a fusion method of directly splicing. The present disclosure does not limit the specific fusion method of the processing sub-results.
[0146] In this way, the processing result of the convolution processing of the processing data and the weight data can be obtained, thereby improving the accuracy of the convolution operation.
[0147] Therefore, according to the data processing method of the embodiment of the present disclosure, for any convolution operation of the target functional core, the second data identifier of each data in the operation data corresponding to the convolution operation can be determined according to the convolution kernel size and convolution step of the convolution processing; when there is a second data identifier that exceeds the first data identifier, the operation data corresponding to the second data identifier that does not exceed the first data identifier is read from the storage space, and the operation data corresponding to the second data identifier that exceeds the first data identifier is set to zero; according to the operation data corresponding to the convolution operation and the weight data, the convolution operation is performed to obtain the operation result of the convolution operation. This method can save the cache resources of the functional core and reduce the data communication between the functional cores, thereby improving the computing efficiency of the multi-core multi-chip system.
[0148] Moreover, the disclosure is highly universal and can be applied to convolution processing in various neural network models. For example, the disclosed method can avoid data overlap generated during the deployment of neural network models in multi-core multi-chip systems. Moreover, the disclosed method can take advantage of the multi-core architecture of chips and better promote the hardware and software integration of multi-core multi-chip hardware systems and neural network algorithms.
[0149] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.
[0150] In one possible implementation, Figure 1As shown, a processor is provided, the processor includes multiple function cores, the multiple function cores include a target function core for performing convolution processing, the storage space of the target function core caches the processing sub-data and weight data of the convolution processing, the processing sub-data is obtained by splitting the processing data of the convolution processing, each data in the processing sub-data has a first data identifier, for any convolution operation of any target function core, the target function core is used to determine the second data identifier of each data in the operation data corresponding to the convolution operation according to the convolution kernel size and convolution step of the convolution processing; when there is a second data identifier exceeding the first data identifier, the operation data corresponding to the second data identifier that does not exceed the first data identifier is read from the storage space, and the operation data corresponding to the second data identifier that exceeds the first data identifier is set to zero; according to the operation data corresponding to the convolution operation and the weight data, a convolution operation is performed to obtain the operation result of the convolution operation.
[0151] In one possible implementation, the processor is also used to, for any target function core, read the operation data corresponding to the second data identifier from the storage space when there is no second data identifier exceeding the first data identifier; perform a convolution operation based on the operation data corresponding to the convolution operation and the weight data to obtain the operation result of the convolution operation; and determine the processing sub-result of the target function core based on the operation results of multiple convolution operations of the target function core.
[0152] In a possible implementation, the processor is also used to: determine the splitting scale of the processing sub-data of the processing data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data, and determine the target functional core from the multiple functional cores; split the processing data according to the splitting scale to obtain multiple processing sub-data; and send the processing sub-data and the weight data to each target functional core respectively, so that the target functional core caches the processing sub-data and the weight data.
[0153] In a possible implementation, the processor is further configured to: upon receiving processing sub-results from each target functional core, fuse the processing sub-results to obtain a processing result of the convolution processing.
[0154] In a possible implementation, the splitting scale of the processing sub-data of the processing data is determined according to the capacity of the storage space of the multiple functional cores and the scale of the weight data, including: determining the capacity of the storage subspace of the target functional core for the processing sub-data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data; determining the splitting scale of the processing sub-data according to the capacity of the storage subspace, the splitting scale including a first scale in the height direction and a second scale in the width direction.
[0155] In a possible implementation, the processed data includes four dimensions of height, width, channel, and batch, wherein the processed data is split according to the splitting scale to obtain a plurality of processed sub-data, including: splitting the processed data in height and width directions respectively according to the first scale and the second scale to obtain the plurality of processed sub-data, wherein the processed data is not split in the dimensions of channel and batch.
[0156] In a possible implementation, the processed data includes any one of image data, sound data, and text data.
[0157] In some embodiments, the processor or functional core provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation thereof can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0158] In a possible implementation, an artificial intelligence chip is provided, the chip including the above-mentioned processor. Figure 1 As shown, the chip may include one or more processors, and the processor may include multiple functional cores. The present disclosure does not limit the number of functional cores in the chip.
[0159] In one possible implementation, an electronic device is provided, which includes the above-mentioned artificial intelligence chip.
[0160] Fig.10 1 is a structural diagram showing a combined processing device 1200 according to an embodiment of the present disclosure. Fig.10 As shown in , the combined processing device 1200 includes a computing processing device 1202 (for example, the artificial intelligence processor including multiple functional 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, functional cores).
[0161] 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.
[0162] 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.
[0163] 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 a computing device related to artificial intelligence such as 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 the computing task.
[0164] In one or more embodiments, the interface device can be used to transmit 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 transmit it to other processing devices.
[0165] 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.
[0166] 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.
[0167] Fig.11 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.11 , the electronic device 1900 includes a processing component 1922 (e.g., an artificial intelligence processor including multiple functional cores), which further includes one or more functional 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.
[0168] 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.
[0169] In the present disclosure, the spaces described as separate components may or may not be physically separated, and the components shown as spaces may or may not be physical spaces. The aforementioned components or spaces may be located in the same location or distributed over multiple network spaces. In addition, according to actual needs, some or all of the spaces may be selected to achieve the purpose of the scheme described in the embodiments of the present disclosure. In addition, in some scenarios, multiple spaces in the embodiments of the present disclosure may be integrated into one space or each space may exist physically separately.
[0170] 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.
[0171] 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.
[0172] 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 processor, the processor includes a plurality of functional cores, the plurality of functional cores include a target functional core for performing convolution processing, the storage space of the target functional core caches processing sub-data and weight data of the convolution processing, the processing sub-data is obtained by splitting the processing data of the convolution processing, each data in the processing sub-data has a first data identifier, For any target functional core, the method includes: For any convolution operation of the target function kernel, determine the second data identifier of each data in the operation data corresponding to the convolution operation according to the convolution kernel size and the convolution step size of the convolution processing; When there is a second data identifier that exceeds the first data identifier, read the operation data corresponding to the second data identifier that does not exceed the first data identifier from the storage space, and set the operation data corresponding to the second data identifier that exceeds the first data identifier to zero; A convolution operation is performed according to the operation data corresponding to the convolution operation and the weight data to obtain the operation result of the convolution operation.
2. The method according to claim 1, characterized in that For any target functional core, the method further includes: When there is no second data identifier beyond the first data identifier, reading the operation data corresponding to the second data identifier from the storage space; Performing a convolution operation according to the operation data corresponding to the convolution operation and the weight data to obtain an operation result of the convolution operation; The processing sub-result of the target function core is determined according to the operation results of multiple convolution operations of the target function core.
3. The method according to claim 1, characterized in that The method further comprises: Determine the splitting scale of the processing sub-data of the processing data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data, and determine the target functional core from the multiple functional cores; Splitting the processed data according to the splitting scale to obtain a plurality of processed sub-data; The processing sub-data and the weight data are sent to each target functional core respectively, so that the target functional core caches the processing sub-data and the weight data.
4. The method according to claim 2, characterized in that: The method further comprises: When the processing sub-results from each target functional core are received, each processing sub-result is fused to obtain the processing result of the convolution processing.
5. The method according to claim 3, characterized in that: Determining the splitting scale of the processing sub-data of the processing data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data includes: Determining the capacity of the storage subspace of the target functional core for the processing sub-data according to the capacity of the storage space of the multiple functional cores and the scale of the weight data; The splitting scale of the processed sub-data is determined according to the capacity of the storage sub-space, and the splitting scale includes a first scale in a height direction and a second scale in a width direction.
6. The method according to claim 5, characterized in that The processing data includes four dimensions: height, width, channel, and batch. Wherein, the processed data is split according to the splitting scale to obtain a plurality of processed sub-data, including: According to the first scale and the second scale, the processed data is split in the height direction and the width direction respectively to obtain the plurality of processed sub-data, The processed data is not split in the dimensions of channels and batches.
7. The method according to any one of claims 1 to 6, characterized in that The processed data includes any one of image data, sound data, and text data.
8. A processor, characterized in that: The processor includes a plurality of functional cores, wherein the plurality of functional cores include a target functional core for performing convolution processing, wherein processing sub-data and weight data of the convolution processing are cached in a storage space of the target functional core, wherein the processing sub-data are obtained by splitting the processing data of the convolution processing, and each data in the processing sub-data has a first data identifier, For any convolution operation of any target function core, the target function core is used to determine the second data identifier of each data in the operation data corresponding to the convolution operation according to the convolution kernel size and the convolution step size of the convolution processing; When there is a second data identifier that exceeds the first data identifier, read the operation data corresponding to the second data identifier that does not exceed the first data identifier from the storage space, and set the operation data corresponding to the second data identifier that exceeds the first data identifier to zero; A convolution operation is performed according to the operation data corresponding to the convolution operation and the weight data to obtain the operation result of the convolution operation.
9. An artificial intelligence chip, characterized in that: The chip includes the processor of claim 8.
10. An electronic device, characterized in that: The electronic device comprises the artificial intelligence chip as claimed in claim 9.
Citation Information
Patent Citations
Information processing method, intelligent terminal and server
CN102082789A
Data processing method, processor, chip and electronic equipment
CN112801277A
