Data processing method and device, equipment and storage medium
Through the serial cyclic progressive data processing method, the operator operation of the deep learning network is directly performed locally, which solves the problem of bus bandwidth occupation and performance reduction caused by frequent data transfer in the deep learning network, and achieves more efficient computing performance.
Patent Information
- Application Number
- CN202411070033.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-10-25
AI Technical Summary
In deep learning networks, a single operator operation requires frequent data transfers, causing bus data interaction to occupy a large amount of bandwidth and reduce hardware performance.
Using the serial loop progressive data processing method, the operator directly reads the input data from the local for operation, skips the data exchange of the external memory, and runs the operators on the loop chain synchronously through the local cache, making full use of the storage space and computing power. .
It reduces the amount of bus transmission data and power consumption in network operation, improves network computing performance, avoids data exchange between the bus and external memory, and improves overall performance.
Smart Images

Figure CN118839738A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a data processing method, device, equipment and storage medium. Background Art
[0002] At present, when performing deep learning network splitting operations based on hardware devices, two data transfers are usually required for a single operator operation, that is, transferring the input data required for the current operator operation from the external memory DDR (Double Data Rate Synchronous Dynamic Random Access Memory) to the internal memory, and transferring the output data obtained from the operation from the internal memory to the external memory DDR. Since the hardware device transfers data from the external memory DDR, the bus needs to be frequently used for data exchange during the data transfer process.
[0003] However, in scenarios where large amounts of data are interacted, such as deep learning networks, frequent bus data interactions will occupy a large amount of bus bandwidth, and the delay caused by bus data interactions will reduce hardware performance. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a data processing method, device, equipment and storage medium, which realize network computing through serial loop progression, and the operator directly reads the data to be processed locally without reading from an external memory. Therefore, there is no data exchange between the bus and the external memory storage in the loop calculation, which reduces the amount of bus transmission data in network operation, and improves the performance of network computing due to the significant savings in bus data interaction.
[0005] The specific plan is as follows:
[0006] In a first aspect, the present application provides a data processing method, comprising:
[0007] Read the input data of the first-level operator in the serial N-level operators from the external memory;
[0008] Starting with the first-level operator, performing cyclic progressive operations on the serial N-level operators according to the input data of the N-level operators until the operation result of the N-th-level operator is obtained, and writing the operation result of the N-th-level operator into the external memory;
[0009] The input data of the nth level operator includes at least part of the operation result of the n-1th level operator read locally, and n is an integer greater than 1 and less than or equal to N.
[0010] Optionally, starting with the first-level operator, performing cyclic progressive operations on the serial N-level operators according to input data of the N-level operators until the operation result of the N-th-level operator is obtained, includes:
[0011] Using the first-level operator as a first target operator, and operating the first target operator according to at least part of input data of the first target operator;
[0012] In the process of operating the first target operator, selecting a subsequent level operator of the first target operator from the serial N level operators as a second target operator, and operating the second target operator using a calculation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator;
[0013] The second target operator is set as a new first target operator, and in the process of operating the new first target operator, the next-level operator of the new first target operator is continuously selected from the serial N-level operators as the new second target operator, so as to operate the new second target operator by using the operation result corresponding to at least part of the input data of the new first target operator as at least part of the input data of the new second target operator;
[0014] This is done until the N-th level operator is used as the second target operator to obtain all the calculation results of the N-th level operator.
[0015] Optionally, after selecting the next-level operator of the first target operator from the serial N-level operators as the second target operator, the method further includes:
[0016] Determining whether a calculation result corresponding to at least part of the input data of the first target operator meets a calculation condition of the second target operator;
[0017] If so, use the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator to operate on the second target operator;
[0018] If not, continue to operate on the first target operator.
[0019] Optionally, after operating the first target operator according to at least part of the input data of the first target operator, the method further includes:
[0020] Storing the operation result of the first target operator in a local cache;
[0021] Before using the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator to operate the second target operator, the method includes:
[0022] The operation result corresponding to at least part of the input data of the first target operator is read from the local cache.
[0023] Optionally, in the data processing method, local caches storing input data of different operators are different.
[0024] Optionally, the step of reading the input data of the first-level operator in the serial N-level operators from the external memory includes:
[0025] Selecting a target operator group in sequence from the multiple operator groups obtained by splitting the target network, wherein the target operator group includes a series of M-level operators, and the sum of the operators in the multiple operator groups is equal to N;
[0026] Whenever the target operator group is selected, the input data of the first-level operator in the serial M-level operators in the target operator group is read from the external memory;
[0027] The method of starting with the first-level operator and performing cyclic progressive operations on the serial N-level operators according to the input data of the N-level operators until the operation result of the N-th-level operator is obtained, and writing the operation result of the N-th-level operator into the external memory comprises:
[0028] Starting with the first-level operator in the target operator group, performing cyclic progressive operations on the serial M-level operators according to the input data of the M-level operators until the operation result of the M-th-level operator is obtained, and writing the operation result of the M-th-level operator into the external memory;
[0029] Continue to select the next target operator group from the multiple operator groups until the operation result of the Mth level operator in the last operator group is written into the external memory.
[0030] Optionally, before continuing to select a next target operator group from the multiple operator groups, the step further includes:
[0031] Determine whether the operation result of the M-th level operator currently obtained includes all output results in the splitting direction of the M-th level operator;
[0032] If yes, then execute: continue to select the next target operator group from multiple operator groups;
[0033] If not, continue to operate the Mth-level operator according to the input data of the Mth-level operator.
[0034] In a second aspect, the present application provides a data processing device, comprising:
[0035] A data reading module is used to read the input data of the first-level operator in the serial N-level operators from an external memory;
[0036] A data operation module, used to start with the first-level operator, perform cyclic progressive operations on the serial N-level operators according to the input data of the N-level operators, until the operation result of the N-th-level operator is obtained, and write the operation result of the N-th-level operator into the external memory;
[0037] The input data of the nth level operator includes at least part of the operation result of the n-1th level operator read locally, and n is an integer greater than 1 and less than or equal to N.
[0038] In a third aspect, the present application provides an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the aforementioned data processing method.
[0039] In a fourth aspect, the present application provides a computer storage medium for storing a computer program, which implements the aforementioned data processing method when executed by a processor.
[0040] The present application can read the input data of the first-level operator in a serial N-level operator from an external memory, and starting with the first-level operator, perform cyclic and progressive operations on the serial N-level operators according to the input data of the N-level operators until the operation result of the N-th level operator is obtained, and then write the operation result of the N-th level operator into the external memory; wherein the input data of the n-th level operator includes at least part of the operation result of the n-1-th level operator read from the local, and n is an integer greater than 1 and less than or equal to N.
[0041] Through the above scheme, the present application can realize the calculation of the network in a serial cyclic progressive manner, and can synchronously run at least one operator in the serial of the cyclic chain progressively, thereby making full use of the storage space and computing power, so that the partial output of the Nth level operator can be maximized under the premise of satisfying the on-chip computing power and on-chip storage resources. In this process, the calculation result of the operator is directly applied to the subsequent serial operator as its input data, without the need to transfer the calculation result to the external memory, nor to read the required input data from the external memory, thus skipping the process of data transfer through external memory storage when implementing the calculation of different operators. In this way, there is no data exchange between the bus and the external memory storage in the cyclic progressive calculation, thus reducing the amount of bus transmission data for network operation, thereby reducing the network transmission bandwidth resources required for the entire network operation, and because the data interaction of the bus is greatly saved, the power consumption and delay generated by the bus transmission are reduced, thereby improving the performance of network calculation. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0043] Figure 1 A flow chart of a data processing method provided for this application;
[0044] Figure 2 A schematic diagram of a data processing device module provided by the present application;
[0045] Figure 3 A flow chart of an optional data processing method provided for this application;
[0046] Figure 4 A data processing flow chart based on several large cycles provided for this application;
[0047] Figure 5 A single large cycle data processing flow chart provided for this application;
[0048] Figure 6 A schematic diagram of the structure of a data processing device provided for this application;
[0049] Figure 7 A structural diagram of an electronic device provided in this application. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] Currently, when performing deep learning network splitting operations based on hardware devices, a single operator operation usually requires frequent data transfer with the external memory DDR, which means that the bus needs to be frequently used for data interaction. However, in scenarios such as deep learning networks where large amounts of data are interacted with, frequent bus data interaction will occupy a large amount of bus bandwidth, and the delay caused by this process will also reduce the performance of the hardware.
[0052] The present application provides a data processing method, apparatus, device and storage medium, which implement network calculation in a serial loop progressive manner, and can progressively and synchronously run at least one operator in series on the loop chain, thereby making full use of storage space and computing power, so that the partial output of the Nth level operator can be maximized while satisfying the on-chip computing power and on-chip storage resources.
[0053] In this process, the calculation results of the operators are directly applied to the subsequent serial operators as their input data, without the need to transfer the calculation results to the external memory or read the required input data from the external memory. Therefore, the process of transferring data through the external memory when implementing the calculations of different operators is skipped. In this way, there is no data exchange between the bus and the external memory storage in the cyclic recursive calculation, thereby reducing the amount of bus transmission data for network operation, thereby reducing the network transmission bandwidth resources required for the entire network operation, and because the bus data interaction is greatly saved, the power consumption and delay generated by the bus transmission are reduced, thereby improving the performance of network computing.
[0054] The following first introduces a data processing method provided by this application.
[0055] See also Figure 1 As shown, an embodiment of the present invention discloses a data processing method, including:
[0056] Step S11, reading the input data of the first-level operator in the serial N-level operators from the external memory.
[0057] First of all, it should be pointed out that the technical solutions described in this embodiment can be based on Figure 2 The data processing device shown in the figure is implemented, and the data processing device can be set in a processor such as a CPU, an NPU, or the above technical solution may not be based on Figure 2 The data processing device shown in the figure can be used as long as the electronic device executing it has the corresponding functions or functional modules and can realize the operations of operators and the reading of data. Figure 2 The above data processing method is executed for example.
[0058] Based on the above device, in this embodiment, the input data of the first-level operator in the serial N-level operators first needs to be read from the external memory. It can be understood that the above-mentioned external memory is an external storage module set relative to the hardware for performing computing network operations, and the external storage module is used for collaborative data processing, which may include but is not limited to external memories such as DDR for large-capacity data storage; and the computing network in this embodiment is an N-level operator network formed by a cascade of several operators that are mutually input and output.
[0059] The computing network may be a deep learning network, in which N levels of operators are serially cascaded to form a chain structure, which may include one or more chains, that is, the input of each level of operator may be the output of the previous level of operator or the output of multiple chains of the previous level combined.
[0060] Continue with Figure 2 This solution is executed for example. In this embodiment, the network master control module first obtains the (network) configuration data and (network) input data of the computing network. The network master control module can input these data to the external storage module through the bus for data storage.
[0061] The network master control module is also responsible for splitting the computing network. It should be noted that the computing network requires different computing power and storage space at each level, but the computing power and storage space required at each level of the general network are very large. Therefore, it is difficult to implement the network at one time with limited hardware computing power and hardware memory. Therefore, it is necessary to split the computing network, and even split the first-level operator.
[0062] When network computing starts, the network master control module sends a network computing start signal to the process control module. The process control module sends the start signal of the first large loop and the storage space configuration of this large loop to the large loop control module according to the control flow. The large loop control module controls the operator computing module to read the input data required for the calculation of the first-level operator from the external storage module, and saves the input data to the local operator cache module.
[0063] Step S12, starting with the first level operator, perform cyclic progressive operations on the serial N level operators according to the input data of the N level operators until the operation result of the N level operator is obtained, and write the operation result of the N level operator into the external memory.
[0064] The input data of the nth level operator includes at least part of the operation result of the n-1th level operator read locally, and n is an integer greater than 1 and less than or equal to N.
[0065] The operator calculation module can read the input data of the first-level operator from the local operator cache module, and then obtain the calculation results of operators at each level through serial loop progressive fusion calculation, and then write the calculation results of each level into the operator cache module for reading.
[0066] In the operation of each level of operators, at least part of the operation results of the previous level operator can be read from the operator cache module as input data for the subsequent lower level operator, so that at least one operator in series on the loop chain can be run progressively and synchronously, thereby making full use of storage space and computing power, so that the partial output of the Nth level operator can be maximized while satisfying the on-chip computing power and on-chip storage resources.
[0067] In addition, it should be noted that the general way to implement deep learning network operations based on hardware is to implement each level of operators step by step, where each level of operators is split multiple times to implement a part of the operator operations each time. That is, the input data required for a part of the first-level operator is moved from external storage to memory, and the calculation of this part of the operator is performed. After the calculation is completed, the output data is moved to external storage, and then the rest of the operator is processed according to the above process until all the calculation results of the first-level operator are obtained, and then these result data are used as input data for the next-level operator to process the next-level operator.
[0068] In contrast, the present application can adopt a cyclic progressive fusion operation, and can use the operation results of operators at all levels stored in the local operator cache module to synchronously implement the operation of two to three operators, and there is no need to interact with the external storage module through the bus during the process. Therefore, data interaction with the bus / external memory is reduced, the network bus bandwidth and bus latency are reduced, and the data transmission capacity is indirectly improved. While maximizing the synchronous operation of operators, the performance of the overall deep learning network operation is improved.
[0069] That is, through the above scheme, the present application can implement network calculation in a serial loop progressive manner, and can progressively and synchronously run at least one operator in series on the loop chain, thereby making full use of storage space and computing power, so that the partial output of the Nth level operator can be maximized while satisfying the on-chip computing power and on-chip storage resources.
[0070] In this process, the calculation results of the operators are directly applied to the subsequent serial operators as their input data, without the need to transfer the calculation results to the external memory or read the required input data from the external memory. Therefore, the process of transferring data through the external storage when implementing the calculations of different operators is skipped. In this way, there is no data exchange between the bus and the external storage in the cyclic progressive calculation, thereby reducing the amount of bus transmission data for network operation, thereby reducing the network transmission bandwidth resources required for the entire network operation, and because the bus data interaction is greatly saved, the power consumption and delay generated by the bus transmission are reduced, thereby improving the performance of network computing.
[0071] In some examples, the process of starting with the first-level operator in step S12 and performing cyclic progressive operations on the serial N-level operators according to the input data of the N-level operators until the operation result of the N-th-level operator is obtained may include:
[0072] S121, using the first-level operator as a first target operator, and performing an operation on the first target operator according to at least part of input data of the first target operator;
[0073] S122, in the process of operating the first target operator, selecting a subsequent level operator of the first target operator from the serial N level operators as a second target operator, and operating the second target operator using the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator;
[0074] S123, setting the second target operator as the new first target operator, and in the process of operating the new first target operator, continuing to select the next-level operator of the new first target operator from the serial N-level operators as the new second target operator, so as to operate the new second target operator using the operation result corresponding to at least part of the input data of the new first target operator as at least part of the input data of the new second target operator;
[0075] S124, until all operation results of the Nth-level operator are obtained when the Nth-level operator is used as the second target operator.
[0076] When performing an operation, the first-level operator may be first used as the first target operator, and the first target operator may be operated according to at least part of the input data of the first target operator.
[0077] It can be understood that the at least part of the input data may be all the input data or part of the input data, as long as the calculation requirements of the first target operator are met.
[0078] At this time, the operator calculation module can implement the operation of the first target operator based on at least part of the input data stored in the local operator cache module read from the external memory combined with the first target operator's own parameters or the network input data pre-stored in the corresponding operator cache module.
[0079] It should also be noted that when the subsequent-level operator acts as the first target operator or the second target operator, at least part of the calculation results of the previous-level operator have been stored in the local operator cache module. Therefore, there is no need to read the input data from the external storage module at this time, and no bus is required. At this time, the data transmission can be limited to the local operator cache module and the operator calculation module.
[0080] For example, during the process of operating the first target operator, the operator calculation module may select the next-level operator of the first target operator from the serial N-level operators as the second target operator, so as to operate the second target operator using the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator.
[0081] Correspondingly, similar to the calculation process of the first target operator, after the operator calculation module determines the partial data required for the calculation of the second target operator from the calculation result of the first target operator in the operator cache module, it can calculate the second target operator in combination with the parameters of the second target operator itself or the partial data in the network input data pre-stored in the corresponding operator cache module.
[0082] That is, it can be understood that when performing operations using the operation results or input data stored in the local operator cache module, the operation of part of the data in the second target operator can be synchronously implemented while implementing the operation of the first target operator, thereby forming a cyclic progressive operator operation.
[0083] Based on the above process, the N-level operators can be serially looped, the second target operator can be set as the new first target operator, and in the process of operating the new first target operator, the next-level operator of the new first target operator can continue to be selected from the serial N-level operators as the new second target operator, so as to use the operation result corresponding to at least part of the input data of the new first target operator as at least part of the input data of the new second target operator to operate the new second target operator; the operation is stopped until all the operation results of the N-level operator are obtained when the N-level operator is used as the second target operator, and all the operation results of the N-level operator can be stored in the external storage module later.
[0084] It should also be noted that for a deep learning network composed of multiple chains, if any second target operator includes multiple first target operators, that is, the calculation results output by multiple first target operators must be merged to form all the input data of the second target operator, then the calculation results of multiple first target operators corresponding to the first target operator can be read from the local operator cache module, and the multiple first target operators correspond to multiple chains respectively.
[0085] After at least part of the operation results of the above-mentioned multiple first target operators are combined, they can be used as part of the input data of the second target operator to support the second target operator to perform operations. At this time, the operation process of the above-mentioned single target operator can be referred to for execution.
[0086] Based on the above embodiments, Figure 2 An example of an optional operator operation scheme is given.
[0087] In this embodiment, the network structure is: A->B->C. First, A, B, and C can be split in the row direction through the network master control module. In other examples, the output images of each operator in the network structure can also be split in other dimensions, such as according to the width of the image output by the operator.
[0088] In addition, the configuration data and input data corresponding to each level of operators after splitting can be obtained according to the network configuration data and the network input data in a splitting manner.
[0089] Afterwards, the process control module initiates the start signal of the first large loop and the storage space configuration of this large loop to the large loop control module according to the control process. After receiving the start signal, the large loop control module controls the operator calculation module to read the input data required for the partial row direction calculation of operator A from the external storage module, and saves the input data to the operator cache module.
[0090] After the input data is saved in the operator cache module, the large loop control module sends a calculation start signal to the operator calculation module. The operator calculation module reads the input data of some rows of A from the operator cache module and performs calculations. After the calculation is completed, the calculation results are stored in the operator cache module.
[0091] Afterwards, the operator calculation module will continue to read input data in other row directions of A from the operator cache module to calculate operator A. During this process, the operator calculation module will use at least part of the calculation results of A stored in the operator cache module as the input data of operator B to synchronously perform calculations on some rows of operator B.
[0092] After the calculation is completed, the operator calculation module can store the calculation results of some rows of operator B into the operator cache module. At this time, the operator calculation module will continue to read the input data of other rows of operator A from the operator cache module to calculate operator A until all the calculations of operator A are completed according to all the input data of operator A, and all the calculation results of operator A are obtained.
[0093] At the same time, the operator calculation module will also use the other partial operation results of operator A stored in the operator cache module as the input data of operator B to continue to synchronously perform operations on other partial rows of operator B, and use the partial operation results of operator B stored in the operator cache module as the input data of operator C to synchronously perform operations on some rows of operator C. The operation results can be stored in the external storage module until all the operation results of operator C are obtained. The external storage module obtains and stores all the operation results of the last-level operator C in the first large cycle process.
[0094] This embodiment provides an optional solution for realizing synchronous operation of serial operators in a cyclic and progressive manner, which can fully utilize storage space and computing power, so that the partial output of the last-level operator can be maximized.
[0095] On this basis, the above S122, in the process of operating the first target operator, selecting the next-level operator of the first target operator from the serial N-level operators as the second target operator, and using the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator to operate the second target operator may include:
[0096] S131, in the process of operating the first target operator, selecting the next-level operator of the first target operator from the serial N-level operators as the second target operator.
[0097] S132, determine whether the operation result corresponding to at least part of the input data of the first target operator meets the operation condition of the second target operator; if so, execute step S133; if not, execute step S134.
[0098] S133: Continue to operate the first target operator, and use the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator to operate the second target operator.
[0099] S134: Continue to operate on the first target operator.
[0100] It should be noted that the aforementioned embodiment utilizes the relationship that a part of the row direction of the N+1-level operator can be obtained from a part of the row direction of the N-level operator, and performs detailed decomposition calculations of the multi-level operators through multiple cycles. There is no need to carry out data transfer of the intermediate operators (i.e., reading and writing data between the on-chip operator cache module and the external storage module). It is only necessary to read the input data of the first-level operator and write the output data of the last-level operator.
[0101] On this basis, this embodiment takes into account the computing requirements of on-chip computing power (operator computing module) and on-chip storage resources (local operator cache module). When implementing cyclic progressive operator operations, before the operator computing module starts the operation on the operator, it is determined whether the operation result corresponding to at least part of the input data of the first target operator meets the operation condition of the second target operator, and thus the start-up operation conditions of operators at all levels as the second target operator are formed, so that the partial output of the last-level operator can be maximized while satisfying the on-chip computing power (operator computing module) and on-chip storage resources (local operator cache module).
[0102] In addition, the above embodiment also combines Figure 2It illustrates that the input data and operation results of operators at each level are not transmitted through the bus, but are stored in a local operator cache module. That is, after the first target operator is operated according to at least part of the input data of the first target operator, the operation result of the first target operator can be stored in the local cache.
[0103] Correspondingly, before using the calculation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator to perform an operation on the second target operator, the calculation result corresponding to at least part of the input data of the first target operator can be read from the local cache, that is, the local operator cache module.
[0104] On this basis, different local caches can be allocated for input data of different operators, which can also be understood as storing different local caches for operation results or input data of different operators. This can avoid data writing stampede during the loop progression.
[0105] In addition, this setting can facilitate the flexible configuration of the size of each independent local cache / operator cache module when switching between different large loops, helping to meet the storage space requirements of different input data during different loop progressive operations.
[0106] Based on the previous embodiment, it can be seen that the present application can solve the problem of reduced bus performance due to multiple bus occupation in the deep learning network by serial loop progressive fusion of multiple operators. Next, this embodiment will elaborate on the data processing operation process between different operator groups obtained by splitting the deep learning network.
[0107] See also Figure 3 As shown, the embodiment of the present application discloses a specific data processing method, including:
[0108] Step S21: Select a target operator group in sequence from multiple operator groups obtained by splitting the target network.
[0109] The target operator group is any one of the multiple operator groups, each of which may include M-level operators in series, and the sum of operators in the multiple operator groups is equal to N. The number of levels of the serial operators in each operator group may be different, that is, M may be different.
[0110] The target network mentioned above can be the computing network / deep learning network stated above. The computing power and storage space required for each level of calculation in a deep learning network vary depending on the network. However, the computing power and storage space required for each level of a general network are very large. Therefore, with limited hardware computing power and hardware memory, it is difficult to implement the network at one time. The network needs to be split, and even the first-level operator needs to be split.
[0111] Therefore, in this embodiment Figure 4 As shown, first, the image needs to be split according to the selected dimension of the operator output image. In this embodiment, the image is mainly split based on the row direction of the image height.
[0112] It can also be understood that, based on the technical solution in this embodiment, the network splitting method can also be split according to the number of columns or picture groups or picture channels of the picture. If split in the above manner, the pictures can be calculated in the corresponding order, and the specific process will not be described in detail here, and the technical effect of this embodiment can be achieved.
[0113] Based on the above splitting method, an operator group including N-level operators can be split into several target operator groups including serial M-level operators, wherein the sum of operators in multiple operator groups is equal to N. It can be understood that the number of large cycles after different network splitting can be any number.
[0114] Step S22: Whenever the target operator group is selected, the input data of the first-level operators in the serial M-level operators in the target operator group are read from the external memory.
[0115] In this embodiment, after determining the target operator group currently being operated, Figure 4 As shown, the input data required by the first operator corresponding to the current large cycle is read from the external storage, and the weight corresponding to the cache space configured for the operator can also be read to configure the corresponding storage space for each operator.
[0116] Step S23, starting with the first-level operator in the target operator group, perform cyclic progressive operations on the serial M-level operators according to the input data of the M-level operators until the operation result of the M-th-level operator is obtained, and write the operation result of the M-th-level operator into the external memory.
[0117] Combination Figure 4 and Figure 5 As shown, firstly, the input data of the first-level operator in the serial M-level operators in the target operator group is read from the external memory, and based on Figure 5 The operation process in the target operator group starts with the first-level operator, and performs cyclic and progressive operations on the serial M-level operators according to the input data of the M-level operators until the operation result of the M-th-level operator is obtained, and the operation result of the M-th-level operator is written into the external memory.
[0118] Step S24, continue to select the next target operator group from the multiple operator groups until the operation result of the Mth level operator in the last operator group is written into the external memory.
[0119] In this embodiment, after the operation of the current operator group is completed, the next target operator group is selected from multiple operator groups, and the current storage space is configured with reference to the above, and then the next large cycle is performed until the operation result of the Mth level operator in the last operator group is written into the external memory.
[0120] Through multiple cycles of multiple operator groups, the multi-level operators are broken down and calculated in detail. There is no need to move data between intermediate operators (i.e., read and write data between on-chip cache and external storage). It is only necessary to read the input data of the first-level operators in each operator group from the external storage module and write the output data of the last-level operators in each operator group to the external storage module.
[0121] In this way, the split network operators are operated in multiple cycles, and in each cycle, data interaction with the bus is avoided, thereby reducing the bus bandwidth of the network and improving the overall performance.
[0122] It should also be noted that when splitting the target network, this embodiment needs to meet the following conditions: the on-chip cache (operator cache module) can store the data required to calculate the split operators of a large cycle; the computing power (operator computing module) can respectively realize the calculation of each split operator in a large cycle. Specifically, according to the size of the network, the input and output data size of the operator is different, and the computing power required by the operator is different. This embodiment is adapted to different sizes of on-chip cache and different sizes of on-chip computing power, the number of large cycles after the network is split, and the number of operators in each large cycle is different.
[0123] That is, through the above technical solution, in this embodiment, the split network operators are subjected to multiple loop operations, and data interaction with the bus is avoided in each loop, thereby reducing the bus bandwidth of the network and improving the overall performance of the computing network. At the same time, in this embodiment, when switching between different operator groups in a large loop, the size of each independent storage space can be switched according to the configuration of the next large loop, so as to realize the reconfiguration of the operator cache module to meet different large loop storage space requirements.
[0124] In some examples, before continuing to select the next target operator group from multiple operator groups, it can also be determined whether the operation result of the currently obtained M-th level operator includes all output results in the splitting direction of the M-th level operator.
[0125] If included, continue to select the next target operator group from multiple operator groups;
[0126] If not included, continue to operate the Mth-level operator according to the input data of the Mth-level operator until the operation result of the Mth-level operator currently obtained includes all output results in the splitting direction of the Mth-level operator.
[0127] This embodiment sets an end condition for the target operator group and the complete target network operation, that is, by judging whether all the output results in the direction of the last operator splitting are stored in the external storage module, the accuracy of the input data of the first-level operators in the subsequent operator group can be guaranteed when the large loop switches, thereby improving the completeness of the operator operation in the entire target network.
[0128] The following combination Figure 4 and Figure 5 The selection of the target operator group, the operation of the operators in the target operator group, and the switching process of the large loop in the above example are illustrated.
[0129] The target network includes A->B->C->D->E, and two large loops are formed by splitting the network master control module, namely A->B->C and D->E. A->B->C as the operation process in the first large loop has been illustrated above and will not be repeated here.
[0130] After the first large loop ends, the large loop control module writes the row output of operator C from the operator cache module to the external storage module through the bus, and determines whether the partial row of operator C currently obtained is the row output required by all operators C, that is, whether all calculations of operator C are completed. If not, jump to the calculation process of operators A, B and C to continue execution; if so, end this large loop.
[0131] Then, the processing process of the second large loop is executed. The process control module sends the start signal of the second large loop and the storage space configuration of this large loop to the large loop control module according to the control process. Then, the large loop control module controls the operator calculation module to read the data required for the partial row direction calculation of operator D from the external storage module, including the configuration data and the output data of operator C, and saves the data to the operator cache module.
[0132] After the data required for the second large loop is saved, the large loop control module sends a calculation start signal to the operator calculation module. The operator calculation module reads the input data in the partial row direction of D from the operator cache module and performs calculations. After the calculation is completed, the result is stored in the operator cache module, and it is determined whether the number of partial rows obtained in the previous step can be used to calculate the partial rows of E. If not, the partial calculation of operator D is repeated; if so, the operator calculation module reads the output data in the partial row direction of D from the operator cache module, and performs the calculation of the partial rows of operator E. After the calculation is completed, the result is stored in the operator cache module.
[0133] Then the large loop control module writes the partial row output of operator E from the operator cache module to the external storage module through the bus, and determines whether the partial row of operator E currently obtained is the row output required by all operators E, that is, determines whether all calculations of operator E are completed. If not, the calculation process of operator D and operator E is repeated; if so, the current large loop is terminated, and a network calculation end signal is sent to the network master control module through the process control module, and the overall process ends.
[0134] See also Figure 6 As shown, the embodiment of the present application also discloses a data processing device, including:
[0135] A data reading module 11 is used to read the input data of the first-level operator in the serial N-level operators from an external memory;
[0136] The data operation module 12 is used to perform cyclic progressive operation on the serial N-level operators starting with the first-level operator and according to the input data of the N-level operators until the operation result of the N-level operator is obtained, and write the operation result of the N-level operator into the external memory;
[0137] The input data of the nth level operator includes at least part of the operation result of the n-1th level operator read locally, and n is an integer greater than 1 and less than or equal to N.
[0138] In some specific embodiments, the data operation module 12 specifically includes:
[0139] An operator operation unit, configured to use the first-level operator as a first target operator and operate the first target operator according to at least part of the input data of the first target operator;
[0140] an operator determination unit, configured to select, during operation on the first target operator, a subsequent level operator of the first target operator from the serial N level operators as a second target operator, so as to operate on the second target operator using an operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator;
[0141] An operator setting unit is used to set the second target operator as a new first target operator, and in the process of operating the new first target operator, continue to select the next-level operator of the new first target operator from the serial N-level operators as the new second target operator, so as to use the operation result corresponding to at least part of the input data of the new first target operator as at least part of the input data of the new second target operator to operate the new second target operator; until all the operation results of the N-level operator are obtained when the N-level operator is used as the second target operator.
[0142] In some specific embodiments, the data operation module 12 further includes:
[0143] a condition judgment unit, configured to judge whether a calculation result corresponding to at least part of the input data of the first target operator meets a calculation condition of the second target operator;
[0144] If so, use the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator to operate on the second target operator;
[0145] If not, continue to operate on the first target operator.
[0146] In some specific embodiments, the data operation module 12 further includes:
[0147] A result storage unit, used for storing the operation result of the first target operator into a local cache;
[0148] A result reading unit is used to read the operation result corresponding to at least part of the input data of the first target operator from the local cache.
[0149] In some specific embodiments, the local caches storing input data of different operators are different.
[0150] In some specific embodiments, the data reading module 11 specifically includes:
[0151] A first operator group selection unit, configured to sequentially select a target operator group from a plurality of operator groups obtained by splitting a target network, wherein the target operator group includes a series of M-level operators, and the sum of the operators in the plurality of operator groups is equal to N;
[0152] A data reading unit, configured to read input data of a first-level operator in the serial M-level operators in the target operator group from an external memory each time the target operator group is selected;
[0153] Accordingly, the data operation module 12 specifically includes:
[0154] A result writing unit is used to perform cyclic progressive operations on the serial M-level operators starting with the first-level operator in the target operator group according to the input data of the M-level operators until the operation result of the M-th-level operator is obtained, and write the operation result of the M-th-level operator into the external memory;
[0155] The second operator group selection unit is used to continue selecting the next target operator group from the multiple operator groups until the operation result of the Mth level operator in the last operator group is written into the external memory.
[0156] In some specific embodiments, the data operation module 12 further includes:
[0157] A result judgment unit, used to judge whether the operation result of the M-th level operator currently obtained includes all output results in the splitting direction of the M-th level operator;
[0158] If yes, then execute: continue to select the next target operator group from multiple operator groups;
[0159] If not, continue to operate the Mth-level operator according to the input data of the Mth-level operator.
[0160] The implementation process and technical effects of the above-mentioned device can refer to the embodiments of the above-mentioned method, and will not be elaborated here.
[0161] Furthermore, the present application also discloses an electronic device. Figure 7 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0162] Figure 7 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the data processing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0163] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0164] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0165] The operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, and may be Windows Server, Netware, Unix, Linux, etc. In addition to computer programs that can be used to complete the data processing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.
[0166] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed data processing method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.
[0167] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0168] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0169] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0170] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0171] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data processing method, characterized in that: include: Read the input data of the first-level operator in the serial N-level operators from the external memory; Starting with the first-level operator, performing cyclic progressive operations on the serial N-level operators according to the input data of the N-level operators until the operation result of the N-th-level operator is obtained, and writing the operation result of the N-th-level operator into the external memory; The input data of the nth level operator includes at least part of the operation result of the n-1th level operator read locally, and n is an integer greater than 1 and less than or equal to N.
2. The data processing method according to claim 1, characterized in that: Starting with the first-level operator, performing cyclic progressive operations on the serial N-level operators according to the input data of the N-level operators until the operation result of the N-th-level operator is obtained, including: Using the first-level operator as a first target operator, and operating the first target operator according to at least part of input data of the first target operator; In the process of operating the first target operator, selecting a subsequent level operator of the first target operator from the serial N level operators as a second target operator, and operating the second target operator using a calculation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator; The second target operator is set as a new first target operator, and in the process of operating the new first target operator, the next-level operator of the new first target operator is continuously selected from the serial N-level operators as the new second target operator, so as to operate the new second target operator by using the operation result corresponding to at least part of the input data of the new first target operator as at least part of the input data of the new second target operator; This is done until the N-th level operator is used as the second target operator to obtain all the calculation results of the N-th level operator.
3. The method according to claim 2, characterized in that After selecting the next-level operator of the first target operator from the serial N-level operators as the second target operator, the method further includes: Determining whether a calculation result corresponding to at least part of the input data of the first target operator meets a calculation condition of the second target operator; If so, use the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator to operate on the second target operator; If not, continue to operate on the first target operator.
4. The data processing method according to claim 2, characterized in that: After operating the first target operator according to at least part of the input data of the first target operator, the method further includes: Storing the operation result of the first target operator in a local cache; Before using the operation result corresponding to at least part of the input data of the first target operator as at least part of the input data of the second target operator to operate the second target operator, the method includes: The operation result corresponding to at least part of the input data of the first target operator is read from the local cache.
5. The data processing method according to claim 4, characterized in that: The local caches storing input data of different operators are different.
6. The data processing method according to any one of claims 1 to 5, characterized in that: The step of reading the input data of the first-level operator in the serial N-level operators from the external memory includes: Selecting a target operator group in sequence from the multiple operator groups obtained by splitting the target network, wherein the target operator group includes a series of M-level operators, and the sum of the operators in the multiple operator groups is equal to N; Whenever the target operator group is selected, the input data of the first-level operator in the serial M-level operators in the target operator group is read from the external memory; The method of starting with the first-level operator and performing cyclic progressive operations on the serial N-level operators according to the input data of the N-level operators until the operation result of the N-th-level operator is obtained, and writing the operation result of the N-th-level operator into the external memory comprises: Starting with the first-level operator in the target operator group, performing cyclic progressive operations on the serial M-level operators according to the input data of the M-level operators until the operation result of the M-th-level operator is obtained, and writing the operation result of the M-th-level operator into the external memory; Continue to select the next target operator group from the multiple operator groups until the operation result of the Mth level operator in the last operator group is written into the external memory.
7. The data processing method according to claim 6, characterized in that: Before continuing to select the next target operator group from the multiple operator groups, the method further includes: Determine whether the operation result of the M-th level operator currently obtained includes all output results in the splitting direction of the M-th level operator; If yes, then execute: continue to select the next target operator group from multiple operator groups; If not, continue to operate the Mth-level operator according to the input data of the Mth-level operator.
8. A data processing device, characterized in that: include: A data reading module is used to read the input data of the first-level operator in the serial N-level operators from an external memory; A data operation module, used to start with the first-level operator, perform cyclic progressive operations on the serial N-level operators according to the input data of the N-level operators, until the operation result of the N-th-level operator is obtained, and write the operation result of the N-th-level operator into the external memory; The input data of the nth level operator includes at least part of the operation result of the n-1th level operator read locally, and n is an integer greater than 1 and less than or equal to N.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the data processing method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the data processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Multi-operator operation method and device for neural network model
CN116134446A
Two-dimensional convolution operation processing method, system and device, and computer storage medium
WO2020143235A1
Cited By
Large-scale coherent signal generation system and method
CN121193643A
