Data processing method and device and data processing chip

The data processing method and chip optimize neural network operations by compressing and processing only valid data in weight and feature maps, addressing low performance and resource inefficiencies in Transformer networks, thereby enhancing computing efficiency and resource utilization.

WO2025251897A1PCT designated stage Publication Date: 2025-12-11SMARTER SILICON (SHANGHAI) TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/095955
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-06-07
Filing Date
2025-05-20
Publication Date
2025-12-11

AI Technical Summary

Technical Problem

Current data processing in neural networks, particularly in Transformer networks, suffers from low computing performance, high resource demands, and inefficient resource utilization due to the presence of zero-valued weights and feature values, which do not contribute to calculations but consume resources.

Method used

A data processing method and chip that utilizes sparse matrix multiplication by compressing valid data within weight and feature maps, retaining only non-zero values and optimizing matrix operations through an efficient inner product structure, reducing the number of data sub-objects and improving resource utilization.

Benefits of technology

Enhances computing performance, reduces storage and transmission bandwidth, and improves resource utilization by eliminating zero-valued data, ensuring accurate processing results while minimizing resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025095955_11122025_PF_FP_ABST
    Figure CN2025095955_11122025_PF_FP_ABST
Patent Text Reader

Abstract

A data processing chip includes a plurality of available hardware processing channels and second computing components. Each available hardware processing channel includes a first computing component configured to: obtain first target data in at least one first target data sub-object, each first target data having corresponding position information indicating an original position of the first target data in the first data object; obtain second target data corresponding to the first target data from a second data object based on the position information; and perform a first computing processing on the obtained first target data and second target data to obtain a first computing result. The second computing component is configured to perform a second computing processing on the first computing result to obtain a second computing result, the number of the first target data sub-objects being smaller than the number of the first data sub-objects in the first data object.
Need to check novelty before this filing date? Find Prior Art

Description

DATA PROCESSING METHOD AND DEVICE AND DATA PROCESSING CHIPCROSS-REFERENCE TO RELATED APPLICATION

[0001] This application claims priority to Chinese Patent Application No. 202410742115.1, filed on June 7, 2024, the entire content of which is incorporated herein by reference. FIELD OF TECHNOLOGY

[0002] The present disclosure relates to the field of artificial intelligence technology and, more specifically, to a data processing method and device, and a data processing chip.BACKGROUND

[0003] Neural networks (NN) are complex network systems formed by a large number of simple processing units (that is, neurons) that are widely interconnected. The Transformer network is a neural network based on the self-attention mechanism. At present, in data processing based on neural networks such as Transformer networks, the computing performance is low, demands for resources such as storage and transmission are high, and resource utilization is low. There is a need to improve the current data processing approach.SUMMARY

[0004] One aspect of this disclosure provides a data processing chip. The data processing chip includes a plurality of available hardware processing channels and a plurality of second computing components. Each of the available hardware processing channels includes a first computing component configured to obtain corresponding first target data in at least one first target data sub-object. The first target data in the at least one first target data sub-object includes all valid data of each first data sub-object in a first data object corresponding to a target data processing channel, and each first target data corresponds to corresponding position information. The position information indicates an original position of the first target data in the first data object. The first computing component is further configured to obtain second target data corresponding to the corresponding first target data from a second data object corresponding to the target data processing channel based on the position information corresponding to the corresponding first target data. The available first computing component is further configured to perform a first computing processing on the obtained first target data and second target data to obtain a first computing result. The second computing component is configured to perform a second computing processing on the first computing result output by the corresponding available hardware processing channel to obtain a second computing result. The number of the first target data sub-objects is smaller than the number of the first data sub-objects in the first data object.

[0005] Another aspect of this disclosure provides a data processing method. The data processing method includes obtaining at least one first target data sub-object including first target data; obtaining second target data corresponding to each of the first target data from a second data object corresponding to a target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object; and performing data processing on each of the first target data and the corresponding second target data. The first target data in the at least one first target data sub-object at least includes all valid data of each first data sub-object in a first data object corresponding to a target data processing channel. Each first target data corresponds to the corresponding position information. The corresponding position information indicates an original position of the first target data in the first data object. The number of the first target data sub-object is smaller than the number of the first data sub-objects in the first data object.

[0006] Another aspect of this disclosure provides a data processing device. The data processing device includes a first acquisition module, a second acquisition module, and a data processing module. The first acquisition module is configured to obtain at least one first target data sub-object including first target data, the first target data in the at least one first target data sub-object at least including all valid data of each first data sub-object in a first data object corresponding to a target data processing channel, each first target data having corresponding position information, the corresponding position information indicating an original position of the first target data in the first data object The second acquisition module is configured to obtain second target data corresponding to each of the first target data from a second data object corresponding to the target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object. The data processing module is configured to perform data processing on each of the first target data and the corresponding second target data. The number of the first target data sub-object is smaller than the number of the first data sub-objects in the first data object.BRIEF DESCRIPTION OF THE DRAWINGS

[0007] In order to provide a clearer illustration of various embodiments of the present disclosure or technical solutions in conventional technology, the drawings used in the description of the disclosed embodiments or the conventional technology are briefly described below. The following drawings are merely embodiments of the present disclosure. Other drawings may be obtained based on the disclosed drawings by those skilled in the art without creative efforts.

[0008] FIG. 1 is an example of a sparse weight matrix and a sparse feature map.

[0009] FIG. 2 is a flowchart of a data processing method according to some embodiments of the present disclosure.

[0010] FIG. 3 is an example of a matrix multiplication operation.

[0011] FIG. 4 is a flowchart of a method for forming a first target data sub-object according to some embodiments of the present disclosure.

[0012] FIG. 5 is an example of compressing a first data object from a row direction according to some embodiments of the present disclosure.

[0013] FIG. 6 is an example of compressing the first data object from a column direction according to some embodiments of the present disclosure.

[0014] FIG. 7 is an example of a first target column obtained after compressing the first data object in the row and column directions according to some embodiments of the present disclosure.

[0015] FIG. 8 is another flowchart of the data processing method according to some embodiments of the present disclosure.

[0016] FIG. 9 is a schematic diagram of the internal structure of a PE according to some embodiments of the present disclosure.

[0017] FIG. 10 is a flowchart of a data processing of each first target data and the corresponding second target data according to some embodiments of the present disclosure.

[0018] FIG. 11 is a schematic diagram of associating valid second target data with each group based on an index according to some embodiments of the present disclosure.

[0019] FIG. 12 is a mapping connection diagram between a PE array and an accumulator according to some embodiments of the present disclosure.

[0020] FIG. 13 is a schematic structural diagram of a data processing device according to some embodiments of the present disclosure.

[0021] FIG. 14 is a schematic structural diagram of a data processing chip according to some embodiments of the present disclosure.

[0022] FIG. 15 is a schematic structural diagram of an electronic device according to some embodiments of the present disclosure.DETAILED DESCRIPTION

[0023] Technical solution according to various disclosed embodiments is described below with reference to the drawings. The described embodiments are merely some of embodiments of the present disclosure, but not all embodiments of the present disclosure. Other embodiments obtained based on the disclosed embodiments by those skilled in the art without creative efforts are within the scope of the present disclosure.

[0024] At present, in data processing based on neural network models, the computing performance is low, demands for resources such as storage and transmission are high, and resource utilization is low.

[0025] More specifically, in neural network models, the network layer weights are generally quantized and pruned, resulting in a large number of 0 values in the weight matrix. At the same time, due of the ReLU (activation) operation, the feature map will also produce a large number of 0 values. For example, in the weight matrix and feature map shown in FIG 1, there are a large number of zero values (where gray blocks represent non-zero values and white blocks represent zero values) . This phenomenon of a large number of zero values in the network is called sparsification. More specifically, in the transformer network, due to the local correlation of tokens (atoken is a smallest unit with independent semantics, each token represents an independent unit, has a certain semantic meaning, and can be processed by the model) , the 0 value (sparse) is more common.

[0026] The operations in neural networks mainly include multiplication and addition (for example, the matrix multiplication of weight matrices in the transformer network involves multiplication and addition operations) , and the value of zero does not contribute to the final calculation result. If only valid values are transmitted and stored during data transmission and storage, the bandwidth required for transmission and storage can be greatly reduced. If 0 values are skipped during data calculation, the computing performance of the system can be greatly improved, and the resource utilization of the system can be improved.

[0027] However, the current data processing hardware for neural network models, such as related commercial chips, does not support weight sparse processing, and zero-valued weights are still involved in processing and take up computing time. There is a need to improve the computing performance when processing the model network based on the sparse characteristics of the weights, reduce the demand for data storage and bandwidth, and improve resource utilization and computing efficiency.

[0028] Based on this, embodiments of the present disclosure provide a data processing method and device, and a data processing chip, which are directed to the matrix multiplication operation of weight matrices in neural networks such as the transformer network. By taking advantage of the fact that the weight matrix is fixed and known, an efficient inner product multiplication structure can be used to optimize the multiplication operation of sparse matrices.

[0029] The data processing method and device and data processing chip provided in the embodiments of the present disclosure can be applied to, but not limited to electronic devices such as personal computers or servers.

[0030] FIG. 2 is a flowchart of a data processing method according to some embodiments of the present disclosure. The method will be described in detail below.

[0031] 201, obtaining at least one first target data sub-object including the first target data, the first target data in the at least one first target data sub-object at least including all valid data of each first data sub-object in the first data object corresponding to a target data processing channel, each first target data having corresponding position information, the corresponding position information indicating an original position of the first target data in the first data object.

[0032] In some embodiments, the number of the first target data sub-objects may be less than the number of the first data sub-objects in the first data object.

[0033] The method provided in this application can be applied to, but is not limited to, various fields such as natural language processing, image processing, video processing, speech recognition, industrial detection (e.g., equipment defect detection) , etc.

[0034] The embodiments of the present disclosure mainly use data processing of a neural network model (such as a transformer-based neural network model) as an example to illustrate the technical solutions.

[0035] The target data processing channel may be, but is not limited to, the input channel of the network layer of the neural network model. For example, for image processing based on a neural network model, the target data processing channel may include any one or more input channels of the R, G, and B primary color input channels of the model network layer and the texture input channel and the semantic input channel.

[0036] The valid data in the first data object may indicate that the data included in the first data object that contributes to the data processing of the first data object. The data included in the first data object that has no contribution to its data processing may be regarded as non-valid data or invalid data of the first data object.

[0037] In some embodiments, the first data object may be a data matrix including a plurality of data to be processed, and each first data sub-object included in the first data object may be each column in the data matrix. For the data processing scenario of the neural network model, the first data object may be the weight matrix corresponding to the corresponding input channel of the network layer of the neural network model. Each first data sub-object in the first data object may be each column included in the weight matrix. The valid data in the first data sub-object included in the first data object may be the non-zero value in the column included in the weight matrix. Since non-zero values contribute to the operation of the model network, non-zero weights can be regarded as valid data in the first data sub-object included in the first data object. Correspondingly, since the zero values do not contribute to the operation of the model network, the zero-value weight in the weight matrix can be regarded as invalid data.

[0038] To improve the computing performance of the system, reduce the storage and transmission bandwidth required by the system, and improve the resource utilization of the system, in the embodiments of the present disclosure, in view of the sparse characteristics of the first data object (such as the weight matrix of the network layer of the neural network model) , the data in the first data object can be compressed to reduce the number of first data sub-objects included in the first data object. In this way, a technical idea of optimizing data processing of the first data object (such as optimizing the matrix multiplication operation of the sparse matrices) can be realized.

[0039] In some embodiments, when the first data object is a data matrix including a plurality of data to be processed, and each first data sub-object included in the first data object is a column in the data matrix, the data in the first data object may be compressed. At least the data matrix of the first data object in the row direction can be compressed. By compressing the data matrix of the first data object from the row direction, all valid data in each original column of the data matrix of the first data object can be gathered into a part of the number of columns in the original columns. In this way, the effect of reducing the number of first data sub-objects included in the first data object can be realized, thereby optimizing the data processing of the first data object.

[0040] More specifically, all valid data of the data matrix may be aggregated into some columns of the data matrix by making the valid data in the corresponding original column of the data matrix of the first data object occupy the position of invalid data such as 0-value weight in other original columns of the data matrix (one or more columns other than the corresponding original column) , such that the corresponding part of the columns of the data matrix include at least valid data, while the other corresponding part of the columns do not include any valid data (that is, all are invalid data) . In this way, the columns that do not include any valid data can be directly eliminated, thereby realizing the compression of the data matrix of the first data object and reduce the number of the first data sub-objects (columns) included therein.

[0041] The at least one first target data sub-object may be a first data sub-object including at least valid data obtained by compressing the data in each first data sub-object included in the first data object based on the above process. For example, after all valid data in the original columns of the data matrix are aggregated, the columns including at least valid data can be obtained, while the first data sub-object (column) that does not include any valid data can be discarded and no longer participates in the subsequent data processing of the first data object.

[0042] It should be noted that in order to achieve effective compression, it is required that after compressing the data in the first data object, the number of the first target data sub-objects obtained is less than the number of the first data sub-objects in the first data object. In addition, the first target data in the at least one first target data sub-object obtained after compression may include at least all valid data of each first data sub-object in the first data object. For example, based on the above compression processing process, the number of columns including at least valid data after effective data aggregation of the data matrix may be less than the number of original columns included in the data matrix. Further, each data in the column including at least valid data after compression may include at least all valid data in each original column of the data matrix. In addition to including all the valid data described above, a certain amount of invalid data may also be included, and of course it may not include any invalid data, which depends on the actual situation.

[0043] That is, by eliminating at least part of the invalid data in the first data object based on the compression processing, all the valid data can be retained, thereby reducing the data processing amount of the first data object while avoiding the impact on the data processing result of the first data object, thereby ensuring the accuracy of the data processing result.

[0044] In the case where the first data object is the weight matrix of the network layer of the neural network model, in practical applications, when the model training is completed, the weight matrix of the model network layer can be compressed based on the above process, and the at least one first target data sub-object (such as at least each column including valid data) obtained based on the compression process can be stored. When the model is needed to process data later, the data of the at least one first target data sub-object stored can be directly read to perform the required processing on the data, however, the present disclosure is not limited thereto. In other embodiments, when the model needs to be used for data processing, the weight matrices of each network layer of the model may also be compressed in real time, and the required processing may be performed on the at least one first target data sub-object obtained after compression, which can be set depending on the actual application requirements.

[0045] Each first target data may correspond to the corresponding position information, which can be used to indicate the original position of the first target data in the first data object. The position information corresponding to the first target data may include a row index and a column index, which may be respectively used to indicate the original row and the original column where the first target data is located in the first data object.

[0046] 202, obtaining second target data corresponding to each of the first target data from a second data object corresponding to the target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object.

[0047] In some embodiments, the second data object may also be a data matrix including a plurality of data to be processed. For the data processing scenario of the neural network model, the second data object may be the feature map corresponding to the corresponding input channel of the network layer of the neural network model, and the second target data may be the corresponding feature value in the feature map.

[0048] The second data object may also include valid data and invalid data. The valid data of the second data object may refer to the data included in the second data object that contributes to the data processing of the second data object. Data included in the second data object that does not contribute to its data processing may be considered as non-valid data or invalid data of the second data object. Take the second data object as a feature map as an example, based on whether the feature value contributes to the data operation of the feature map, the non-zero feature value in the feature map may be determined as the valid data of the feature map, and the zero feature value may be regarded as invalid data.

[0049] In some embodiments, the feature map may be, but is not limited to, various types of to-be-processed data such as images and voices, depending on the specific application scenario.

[0050] Each to-be-processed data in the first data object may have a corresponding to-be-processed data in the second data object for matching of a to-be-processed data pair between the first data object and the second data object, thereby performing the required data processing on the to-be-processed data pair. For example, two to-be-processed data included in the to-be-processed data pair can be multiplied, and the multiplication results of the corresponding different to-be-processed data pairs can be accumulated, etc.

[0051] Whether a certain to-be-processed data in the first data object matches a certain to-be-processed data in the second data object (i.e., whether they should be matched into a corresponding to-be-processed data pair) may depend on the positions of the two to-be-processed data in their respective data objects. The data at the matching position between the first data object and the second data object may be the matching to-be-processed data. Further, the matching position between the first data object and the second data object may depend on the data processing rules for the first data object and the second data object.

[0052] Based on this, for each first target data in the at least one first target data sub-object (essentially the corresponding to-be-processed data in the first data object) , the second target data corresponding to the first target data may be obtained from the second data object corresponding to the target data processing channel based on the position information corresponding to the first target data.

[0053] In some embodiments, based on the data processing rules for the first data object and the second data object, the position information corresponding to the first target data that matches the position information in the second data object may be determined, and the to-be-processed data at the position indicated by the matched position information in the second data object may be obtained as the second target data corresponding to the first target data. More specifically, when the first and second data objects are data matrices, the row index and column index corresponding to the first target data in the second data object that match the row index and column index may be determined based on the data processing rules for the first data object and the second data object, and the to-be-processed data at the row and column positions indicated by the matched row index and column index in the second data object may be obtained as the second target data corresponding to the first target data.

[0054] The data processing of the first data object and the second data object in the embodiments of the present application mainly refers to the matrix multiplication operation of the first data object and the second data object, such as the matrix multiplication operation of the weight matrix and the feature map. In addition, the present disclosure provides an efficient inner product multiplication structure to optimize the multiplication operation of sparse matrices by taking advantage of the fact that the weight matrix is fixed and known. That is, the data processing rules of the present disclosure for the first data object and the second data object are based on the matrix multiplication operation rules of the inner product.

[0055] The matrix multiplication operation based on the inner product can be applied to, but not limited to, the matrix multiplication processing of the weight matrix and the feature map in the network layer of the large language model (LLM) , for example, the matrix multiplication processing of the weight matrix and the feature map in the network layer of a LLM based on the transformer network, etc.

[0056] For inner product-based matrix multiplication, the rows of the data matrix of the first data object need to be multiplied by the columns of the data matrix of the second data object. More specifically, the data in each row of the data matrix of the first data object and the data in each column of the data matrix of the second data object need to correspond one by one in sequence. Then, a multiplication operation is performed on a data pair formed by data at the corresponding positions, and each multiplication operation result obtained by performing the multiplication operation on data in the same row of the first data object and data in the same column of the second data object is accumulated.

[0057] In some embodiments, for the rows in the first data object, the order may be from left to right, and for the columns in the second data object, the order may be from top to bottom.

[0058] For ease of understanding, the essence of the above matrix multiplication operation based on the inner product is to match the data with the same column index in the row currently involved in the operation of the first data object (i.e., the to-be-processed row) and the row index in the column currently involved in the operation of the second data object (i.e., the to-be-processed column) into a pair of to-be-processed data. In the example shown in FIG. 3, assume that the first data object is matrix A and the second data object is matrix B, the row currently involved in the operation in matrix A is the first row of matrix A, and the column currently involved in the operation in matrix B is the first column of matrix B. In this case, in the inner product operation for the first row of matrix A and the first column of matrix B, it is required to match the data with the same column index in the first row of matrix A and the same row index in the first column of matrix B into a to-be-processed data pair, such as the to-be-processed data pairs (11, 1) , (41, 4) and (71, 7) in this example. In Matrix A and Matrix B, white boxes represent invalid data and gray boxes represent valid data.

[0059] Based on this, for matrix multiplication operations based on the inner product, based on the column index corresponding to the first target data in the first data object, the data at the row position corresponding to the column index may be obtained from the corresponding column currently involved in the operation of the second data object as the second target data corresponding to the first target data. The second target data may be the to-be-processed data that matches the first target data, which can be used to match the first target data to form a to-be-processed data pair to participate in the subsequent data processing.

[0060] It should be noted that there are two main types of data processing for weight matrices and feature maps in neural networks, namely, the convolution operation and matrix multiplication operation (such as the matrix multiplication operation based on the inner product in the present disclosure) . The popular large language models at the moment, such as those based on the transformer networks, use matrix multiplication operation to calculate weight matrices and feature maps. In practical applications, the convolution operation can also be converted into a matrix multiplication operation form through corresponding conversion rules, and the data processing method provided in the embodiments of the present application can be used to implement it accordingly.

[0061] In some embodiments, the neural network model may perform one-dimensional convolution, two-dimensional convolution or three-dimensional convolution on the feature map, which is not limited in the embodiments of the present disclosure, and can be set based on actual needs. For example, for a one-dimensional convolution kernel of size 1x3, a one-dimensional convolution can be performed on a 1x3 feature map based on a 1x3 weight matrix. For a two-dimensional convolution kernel of size 3x3, a two-dimensional convolution can be performed on a 3x3 feature map based on a 3x3 weight matrix.

[0062] 203, performing data processing on each of the first target data and the corresponding second target data.

[0063] In some embodiments, the data processing performed on each of the first target data and the corresponding second target data may include a multiplication-accumulation process. First, the to-be-processed first target data can be multiplied by its corresponding second data object, and then the corresponding multiplication results can be accumulated, however, the present disclosure is not limited thereto. When applying the technical solutions in the present disclosure, the data processing performed may depend on the actual application requirements.

[0064] For the above matrix multiplication operation based on the inner product, after performing the multiplication operation on each first target data and its corresponding second target data, for the corresponding column currently involved in the processing of the second data object, the multiplication results corresponding to the first target data of the same row in the first data object can be accumulated, and the accumulated result can be used as a result data of the data processing results of the first data object and the second data object.

[0065] Consistent with the present disclosure, based on the sparse characteristics of the data in the first data object, the data included in the first data object can be compressed. By compressing each first data sub-object in the first data object into at least one first target data sub-object, and making the number of the first target data sub-objects smaller than the number of the first data sub-objects, the data processing volume of the first data object is effectively reduced, thereby improving the computing performance of the system, reducing the demand for storage, transmission and computing resources, and improving system resource utilization and computing efficiency. For application scenarios such as natural language processing, image processing, video processing, speech recognition, and industrial inspection, the processing efficiency of various applications such as natural language processing, image processing, and speech recognition can be improved, and the utilization rate of system resources can be improved.

[0066] At the same time, since the first target data in the at least one first target data sub-object obtained after compression includes all valid data of each first data sub-object in the first data object, therefore, the compression process performed only removes at least part of the invalid data in the first data object, retains all the valid data, and will not affect the data processing result of the first data object, thereby ensuring the accuracy of the data processing result. In addition, since at least part of the invalid data in the first data object is removed based on the soft processing, that is, before the first data object is sent to the hardware for processing, at least part of the invalid data has been removed, the data processing method provided in the present disclosure is still applicable to related hardware, such as related commercial chips, that currently does not support weight sparse processing (zero-value weights are still involved in the processing and take up computing time) .

[0067] FIG. 4 is a flowchart of a method for forming a first target data sub-object according to some embodiments of the present disclosure. Based on the technical solution of compression above, the method of compressing the data in the first data object to form the first target data sub-object forming may include the following processes.

[0068] 401, obtaining the first data object corresponding to the target data processing channel in the model.

[0069] The model may be a neural network model, which can be, but is not limited to, a large language model based on a transformer network. The target data processing channel may be, but is not limited to, an input channel of a network layer of a neural network model.

[0070] In some embodiments, the first data object may be a first data matrix having a plurality of data to be processed, and the first data sub-object in the first data object may be a column in the first data matrix. For the data processing scenario of the neural network model, the first data object may be the weight matrix corresponding to the input channel of the model network layer.

[0071] In the process at 401, when the training of the neural network model is completed, the weight matrix corresponding to the input channel of the network layer of the neural network model may be obtained as the first data object to realize the compression processing of the data in the first data object in combination with the subsequent steps, but the present disclosure is not limited thereto. In some embodiments, after completing the training of the neural network model, when there is a need to use the model to perform data processing, the weight matrix corresponding to the input channel of the network layer of the neural network model may be obtained in real time as the first data object to perform the required data compression processing on it.

[0072] 402, moving the valid data of the corresponding first data sub-object in the first data object to the position where the invalid data of other first data sub-objects are located to reduce the number of first data sub-objects included in the first data object.

[0073] By moving valid data of the corresponding first data sub-object in the first data object to the position of invalid data of other first data sub-objects, the aggregation of valid data in the first data object can be realized. The aggregation of valid data from each original first data sub-object into a portion of the first data sub-objects can reduce the number of first data sub-objects included in the first data object.

[0074] In some embodiments, the at least one first target data sub-object may include a first data sub-object obtained after the move and including at least the valid data; the other first data sub-objects may include first data sub-objects other than the corresponding first data sub-object in the first data object.

[0075] When the first data object is a first data matrix such as a weight matrix, at least the data in the first data matrix can be compressed in the row direction. That is, the valid data of the corresponding column in the first data matrix may be moved to the position where the invalid data of another column in the first data matrix is located to reduce the number of columns included in the first data matrix. In this case, the at least one first target data sub-object may include a first target column obtained after the move at least containing valid data;

[0076] When the valid data of a corresponding column in the first data matrix is moved to a position where invalid data of a column other than the corresponding column in the first data matrix is located, in some embodiments, based on the leftward compression method, the valid data of the corresponding column in the first data matrix may be moved to the position where the invalid data of a column on the left side of the corresponding column in the first data matrix is located such that the valid data of the corresponding column occupies the position of the invalid data of the other columns, such as the zero-value weight, on the left side of the corresponding column. However, the present disclosure is not limited thereto. In other embodiments, based on the rightward compression method, the valid data of the corresponding column in the first data matrix may be moved to the position where the invalid data of a column on the right side of the corresponding column in the first data matrix are located such that the valid data of the corresponding column occupies the position of the invalid data of the other columns, such as the zero-value weight, on the right side of the corresponding column. Based on the leftward compression or rightward compression method described above, the valid data can be gathered into a part of the columns of the first data matrix such that the part of the columns at least includes the valid data, and other columns outside the part of the columns do not include the valid data.

[0077] In some embodiments, the data in the same column in the first data matrix may be located in the same first target column after the movement is completed, and the data in the same row may be located in different first target columns after the movement is completed.

[0078] The following is an example.

[0079] Refer to FIG. 5. Assume that the first data object is the sparse matrix A (Matrix A) in FIG. 5, and the first data sub-object in the first data object is the column in matrix A. Matrix A includes 8 columns of data. The column indexes are 1, 2, 3, . . . 8 from left to right. Blank squares represent zero-value data in matrix A, that is, the invalid data. Non-blank squares, that is, gray boxes, represent non-zero-value data in matrix A, that is, the valid data. When compressing the matrix A, for example, as shown in FIG. 5, based on the left compression method in the row direction, the valid data “25” in the second column and the valid data “38” in the third column are moved to the invalid data position in the first column, the valid data "52" and "55" in the 5th column and the valid data "69" in the 6th column are moved to the invalid data position in the 4th column, and the valid data "86" and "89" in the 8th column are moved to the invalid data position in the 7th column. After the movement is completed, the first data sub-object including at least the valid data is shown in FIG. 5. More specifically, the first data sub-object including at least the valid data is the first data sub-object obtained by adding the valid data from other columns to the original 1st, 4th, and 7th columns. In the embodiments of the present disclosure, the first data sub-object obtained after the move and including at least the valid data may be referred to as the first target data sub-object, and the number of the first target data sub-object may be less than the number of the original first data sub-objects included in the first data object. In this example, the number is 3, which is less than the number of original columns contained in matrix A, which is 8.

[0080] In practical applications, this example can also use the right compression method to compress the data of matrix A from the row direction, which is not limited in the embodiments of the present disclosure. Different compression methods to the left and right generally lead to different compression results. For example, if matrix A is compressed to the right, the valid data "52" and "55" in the 5th column may be compressed to the last column, that is, the 8th column. It should be noted that although different compression methods to the left and right will lead to different compression results for matrix A, since the subsequent data processing of matrix A is performed on the first target data based on the position information corresponding to each first target data after compression (used to indicate the original position of the first target data in matrix A) , and the position information corresponding to each first target data is fixed, therefore, the data processing results of matrix A will not be affected, and both methods can ensure the accuracy of the data processing results of matrix A.

[0081] The first target data sub-object in this example may also be the first target column described above. After the move is completed, the data in the same column of matrix A may be in the same first target column, and the data in the same row of matrix A may be in different first target columns. For example, the original data "52" and "55" in the 5th column are in the same target column after the move is completed, the original data "86" and "89" in the 8th column are also in the same target column after the move is completed, and the original data "11" , "41" , and "71" in the first row are in different first target columns after the move is completed.

[0082] Consistent with the present disclosure, by compressing the data in the first data object, the data in the first data object can be aggregated from the original first data sub-objects into a part of the first data sub-objects, thereby reducing the number of first data sub-objects included in the first data object. In this way, the amount of to-be-processed data of the first data object is correspondingly reduced, thereby improving the computing performance of the system, reducing the demand for resources such as storage, transmission and calculation, and improving the utilization rate of system resources.

[0083] In addition, for the case where the first data object is the first data matrix, by controlling the data in the same column in the first data matrix to be in the same first target column after the movement is completed, and controlling the data in the same row to be in different first target columns after the movement is completed, it is convenient to reduce the data selection logic and hardware wiring complexity when the hardware is used to perform data processing on the compressed data (the at least one first target data sub-object / the first target data in the first target column) in the future.

[0084] In some embodiments, the method for forming the first target data sub-object may include performing data sequence adjustment processing on data in each of the first target columns to cause the valid data originally belonging to the same column in the first data matrix to be arranged consecutively in the first target column after being moved.

[0085] In view of the compression result obtained by compressing the first data matrix from the row direction in the foregoing embodiment, this embodiment provides a technical solution of further compression from the column direction.

[0086] In some embodiments, first, invalid data in each first target column may be removed, and then the data in each first target column may be adjusted based on the position movement based on the corresponding column index. By removing the invalid data and adjusting the sequence, the valid data originally belonging to the same column in the first data matrix can be arranged consecutively in the first target column after the movement, thereby further compressing the first data matrix from the column direction.

[0087] As shown in FIG. 6, for the three first target columns obtained by compressing matrix A from the row direction, the zero-value data therein are first removed to obtain three first target columns that do not include any zero-value data. Based on this, the data is further adjusted in order based on the position movement based on the column index of each data in the first target column. In this way, the first target columns where the valid data originally belonging to the same column are consecutively arranged. For example, the data "11" , "14" , and "17" in the first target column are the data of the original first column in matrix A. After completing the movement-based sequence adjustment, the three data are arranged consecutively in the first target column.

[0088] In practical applications, the method for forming the first target data sub-object may not be limited to the column-wise compression method of first removing invalid data and then adjusting the sequence described above. In other embodiments, based on the above consecutive arrangement target (the valid data in the same column in the first data matrix is consecutively arranged in the first target column after the movement) , the data in each first target column may be first adjusted in order based on the position movement according to the corresponding column index. Then, invalid data such as zero-values existing in the first target column after the sequence adjustment may be removed. Combined with data order adjustment and invalid data removal, the goal of consecutive arrangement described above can be realized. In this way, the valid data originally in the same column in the first data matrix can be arranged consecutively in the first target column after the movement.

[0089] Consistent with the present disclosure, by further compressing the row-direction compression result of the first data matrix from the column direction, the invalid data in the first target column obtained after compressing the first data matrix from the row direction can be eliminated, which further reduces the data processing amount of the first data object. Correspondingly, the computing performance of the system can be further improved, the demand for resources such as storage, transmission and computing can be reduced, and the utilization rate of system resources and computing efficiency can be improved.

[0090] In addition, when performing the column-wise data compression, by arranging the valid data originally belonging to the same column in the first data matrix consecutively in the first target column after the movement, it is convenient to facilitate the subsequent use of hardware to perform data processing on the compressed data (the first target data in each first target column that only includes valid data after compression in the row and column directions) , thereby reducing the data selection logic and the hardware wiring complexity. In addition, the amount of indexing in the first target column can be reduced. For example, for multiple valid data that are consecutively arranged in the first target column and originally belong to the same column, only the full position information (such as column index and row index) of the first valid data among the multiple valid data and the number of data of the multiple valid data may be recorded. The other data except the first valid data among the multiple valid data do not need to record the column index, only the row index needs to be recorded, thereby reducing the index amount of the data in the first target column and saving storage space. In view of the above characteristics, for multiple valid data that are consecutively arranged in the first target column and originally belong to the same column, the multiple valid data of the entire column (originally the same column) can be read at one time in a continuous shot based on the number and input into the corresponding channel and number at the same time to complete the calculation of one column (originally one column) of data in one shot.

[0091] In some embodiments, the first data object may be matched with a first data matrix including a plurality of data to be processed (such as a weight matrix in a neural network) . The second data object corresponding to the target data processing channel may be a second data matrix including a plurality of data to be processed, for example, a feature map corresponding to the neural network input channel.

[0092] In the process at 202, that is, obtaining second target data corresponding to each of the first target data from a second data object corresponding to the target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object may include obtaining the second target data corresponding to each first target data from the second target column of the second data matrix based on the position information of each first target data in each first target column, the second target column being a to-be-processed column currently in the second data matrix.

[0093] In some embodiments, for the matrix multiplication operation based on the inner product in the embodiments of the present application, since it is essentially requiring the data with the same column index in the row currently involved in the operation in the first data object / first data matrix to match to the same row index in the column currently involved in the operation in the second data object / second data matrix into a to-be-processed data pair. Based on this, obtaining second target data corresponding to each first target data from the second target column of the second data matrix based on the position information of each first target data in each first target column may include, based on the column index corresponding to the first target data in the first data matrix, the data at the row position corresponding to the column index may be obtained from the second target column currently to be processed in the second data matrix as the second target data corresponding to the first target data. The second target data may be the to-be-processed data that matches the first target data, which can be used to match the first target data to form a to-be-processed data pair to participate in the subsequent data processing.

[0094] Using the matrix A and matrix B in the example in FIG. 3, the three first target columns in FIG. 7 can be obtained by compressing the matrix A in the row and column directions. Assume that the second target column currently to be processed in matrix B is the first column of matrix B. Take the first target column in FIG. 7 as an example. For the data "11" , "14" , and "17" in the first target column, the data with row index "1" (that is, the data represented by "1" in the second target column) can be taken from the second target column based on its corresponding column index "1" as the second target data corresponding to "11" , "14" , and "17" . Similarly, for the data "25" in the first target column, the data with row index "2" (that is, the data represented by "2" in the second target column) can be taken from the second target column based on its corresponding column index "2" as the second target data corresponding to "25" . For the data "38" in the first target column, the data with row index "3" (that is, the data represented by "3" in the second target column) can be taken from the second target column based on its corresponding column index "3" as the second target data corresponding to "38" .

[0095] Consistent with the present disclosure, by obtaining the second target data corresponding to each of the first target data from the second target column of the second data matrix based on the position information of each of the first target data in each of the first target columns, the second target data that matches the first target data from the second data object can be accurately and located and obtained. In this way, the to-be-processed data can be formed with the first target data to participate in subsequent data processing, thereby ensuring the efficiency and accuracy of data processing of the first data object and the second data object.

[0096] FIG. 8 is another flowchart of the data processing method according to some embodiments of the present disclosure. In the process at 202, that is, performing data processing on each of the first target data and the corresponding second target data may include the following process.

[0097] 801, based on the number of available hardware processing channels that can be processed in parallel, allocating the corresponding amount of first target data to each available hardware processing channel, and using the available hardware processing channel to perform data processing on the allocated first target data and the corresponding second target data.

[0098] The available hardware processing channels may be currently unused hardware computing channels in the system of electronic devices such as personal computers or servers that can be scheduled to perform required operations on data, such as computing channels based on arithmetic units and registers. Each channel may include a required number of operators and / or registers, and may also include other required hardware.

[0099] In some embodiments, the available hardware processing channel may include at least a first computing component, which may be a multiplier that can be used to perform multiplication operations on data. In addition, the first computing component may also include a register for storing data.

[0100] Further, each available hardware processing channel may be a process element (PE) . Refer to the schematic diagram of the internal structure of a PE shown in FIG. 9, each PE includes a register (Reg) and a multiplier (Mul) , which are used to store data and perform multiplication operations on the data respectively.

[0101] For the case where the first data object is the first data matrix and the second data object is the second data matrix, in the process at 801, based on the number of available hardware processing channels that can be processed in parallel, the first target data corresponding to the number of first target columns obtained by compressing the first data matrix (compression in the row direction, or compression in both the row and column directions) may be distributed to each available hardware processing channel in a one-to-one manner. For example, for the three first target columns obtained by compressing matrix A from the row and column directions, assume that the current number of available PEs is 5, then the five first target data included in the first first target column of the three first target columns may be distributed to the five PEs in order in a one-to-one manner, and stored in the registers of the allocated PEs.

[0102] In practical applications, if the neural network model is known, the appropriate hardware resource configuration can be performed for the neural network model. For example, the number of hardware channels to be used for model data processing may be configured as the number of rows of the weight matrix corresponding to the input channel of the network layer of the neural network model, or as the number of valid data included in the column with the largest amount of valid data in each column of the weight matrix, etc.

[0103] The first target data may correspond to corresponding position information, such as a row index and a column index, which are used to indicate the original row, original column, etc. of the first target data in the first data object (first data matrix) . After the corresponding number of first target data are allocated to each available PE, the second target column currently to be processed in the second data object (second data matrix) may be further selected based on the column index of the first target data allocated to each PE. The data on the row corresponding to the column index may be obtained and sent to the PE as the second target data corresponding to the first target object, and the PE may perform a multiplication operation on the obtained first target data and the second target data based on its multiplier.

[0104] The hardware used for data processing of the first target data and the corresponding second target data may include, in addition to the available hardware processing channels such as PE, a plurality of second computing assemblies and at least one routing component. The second computing component may be an accumulator that can be used to perform accumulation processing (and operation) on data, and the routing component may be used to transmit the multiplication result of the first computing component in the available hardware processing channel to the corresponding second computing component based on the row index of the corresponding first target data. In this way, in each second computing component, for the second target column currently involved in the processing of the second data matrix, the multiplication results of the corresponding first target data with the same row index can be accumulated, thereby realizing the accumulation multiplication results corresponding to each data (first target data) in the same row of the first data matrix for the second target column currently involved in the processing of the second data matrix.

[0105] The number of the second computing components may not be less than the number of rows of the first data matrix. For example, for the example in which the first data matrix is matrix A, a total of 9 accumulators may be set, and each accumulator may correspond to the original 9 rows of data of the first data matrix in a one-to-one manner. After the multiplier of each PE performs a multiplication operation on the first target data obtained and the corresponding second target data, the multiplication result and the row index of the first target data can be sent to the routing component. The routing component routes the received multiplication result to the corresponding accumulator based on the row index of the first target data. In this way, the multiplication result obtained by each accumulator can be the multiplication result of the first target data in the same row of the first data matrix for the second target column currently involved in the processing of the second data matrix. The corresponding implementation accumulates the multiplication results corresponding to each data (first target data) in the same row of the first data matrix in the accumulator, which is consistent with the matrix multiplication operation rules based on the inner product and meets the requirements of the matrix multiplication operation based on the inner product.

[0106] In some embodiments, since each of the first target data involved in the data processing is the data in the at least one first target data sub-object obtained after data compression of the first data object, compared with the first data object, at least part of the invalid data in the first data object is removed such that the removed invalid data can be avoided from participating in the calculation, and the data processing amount of the first data object can be reduced. Based on this, for the number of available hardware processing channels required to process each of the first target data being less than the number of available hardware processing channels required to process each of the to-be-processed data in the first data object can correspondingly improve the system's computing performance, reduce the demand for resources such as storage, transmission and computing, and improve system resource utilization and computing efficiency. At the same time, the designed hardware structure and the way of using the hardware are consistent with the rules of matrix multiplication based on the inner product, meet the requirements of matrix multiplication based on inner product, and can ensure the accuracy of the matrix multiplication results based on inner product in the present disclosure.

[0107] In some embodiments, the valid data originally in the same column in the first data matrix / first data object may be arranged continuously in the first target column after the movement. That is, the first target column may be a column obtained by compressing the first data matrix / first data object in the row direction and the column direction and performing the sequence adjustment (adjusting the valid data in the same column to be arranged consecutively) .

[0108] In some embodiments, the data processing of the first target data and the corresponding second target data may also include a multiplication-accumulation process. The multiplication operation in the multiplication-accumulation process may include a multiplication operation involving matrix multiplication of the first data matrix and the second data matrix.

[0109] FIG. 10 is a flowchart of a data processing of each first target data and the corresponding second target data according to some embodiments of the present disclosure. In the process at 203, that is, performing data processing on each first target data and the corresponding second target data may include the following processes.

[0110] 1001, assigning the first target data of the same group in each first target column to consecutive available hardware processing channels in the channel array, the first target data of the same group including the first target data in the first target column that originally belong to the same column in the first data matrix.

[0111] In some embodiments, the channel array may be an array formed by various available hardware processing channels, such as a PE array formed by various PEs.

[0112] In some embodiments, based on the characteristic that the valid data originally in the same column in the first data matrix / first data object are consecutively arranged in the first target column after being moved, the data in the first target column may be grouped. More specifically, the first target data in the first target column that originally belong to the same column in the first data matrix may be grouped into a group, and the first target data in the first target column that originally belong to different columns in the first data matrix may be correspondingly divided into different groups.

[0113] In some embodiments, the data included in each group may be arranged continuously in the first target column. Based on this characteristic, when allocating the first target data to the available hardware processing channels, the first target data of the same group in each first target column may be allocated to the consecutive available hardware processing channels in the channel array. For example, the first target data of the same group may be respectively allocated to consecutive PEs in the PE array, and stored in registers included in the allocated PEs.

[0114] 1002, determining the second target data corresponding to the first target data in the same group based on the position information corresponding to the first target data in the same group.

[0115] In some embodiments, the column indexes corresponding to the first target data in the same group may be the same. Combined with the characteristics of matrix multiplication based on the inner product, the first target data of the same group may correspond to the same second target data in the second data matrix.

[0116] More specifically, in the process at 1002, the data at the row position corresponding to the column index of the first target data of the same group may be determined from the second target column to be processed in the second data matrix as the second target data corresponding to the first target data of the group.

[0117] For example, for the first target column of the three first target columns obtained by compressing the matrix A from the row and column directions, take its first group as an example. For the data "11" , "14" , "17" included in the first group in the column, the data on the row indicated by the index "1" can be determined from the second target column to be processed in the second data matrix based on the column index "1" of "11" , "14" and "17" as the second target data corresponding to "11" , "14" , "17" . For example, the data on row 1 may be determined from the first column to be processed currently in matrix B as the second target data corresponding to "11" , "14" and "17" .

[0118] 1003, allocating the determined second target data to the available hardware processing channels where the first target data of the corresponding group is respectively located, and using the first computing component provided by an available hardware processing channel to perform a multiplication operation on the allocated first target data and the second target data to obtain a multiplication operation result.

[0119] In some embodiments, the first computing component may be a multiplier included in the PE, such as the multiplier Mul in FIG. 9.

[0120] In some embodiments, after the first target data in each first target column are grouped and the same second target data corresponding to each first target data in each group is determined, the same second target data may be obtained, and the obtained same second target data may be allocated to the available hardware processing channels where the first target data of the corresponding group are respectively located. Based on this, the available hardware processing channel can perform a multiplication operation on the obtained first target data and second target data based on its first computing component.

[0121] For example, the same second target data corresponding to the first target data "11" , "14" , and "17" contained in the first group in the first target column can be read. The read second target data can be allocated to the PEs where "11" , "14" and "17" included in the group are located respectively, and the multipliers in the PEs where "11" , "14" and "17" are located respectively perform multiplication operations on the obtained first target data and second target data.

[0122] In some embodiments, if the second target data is an invalid data (such as a zero-value feature value) , the reading of the second target data can be directly skipped. Correspondingly, there is no need to input the second target data of the invalid data into the corresponding PE, and thus there is no need to operate the first target data currently allocated in the PE. That is, multiplication result corresponding to the first target data currently allocated by the PE can be directly regarded as an empty result, which is consistent with the characteristic that invalid data in the matrix multiplication operation does not contribute to the operation result and will not affect the overall matrix multiplication operation result.

[0123] 1004, based on the position information corresponding to each first target data, sending the multiplication result corresponding to the first target data originally in the same row in the first data matrix to the same second computing component for accumulation processing to obtain an accumulation operation result.

[0124] In some embodiments, the position information corresponding to the second target data may be used to indicate the position of the second target data in the second data object.

[0125] In some embodiments, the second computing component may be an accumulator that can be used to perform accumulation processing (and operation) on the data, and the number of the second computing components may not be less than the number of rows of the first data matrix. For example, in the case where the first data matrix is the matrix A, a total of 9 accumulators may be set, each accumulator corresponding to the original 9 rows of data of the matrix A in a one-to-one manner. Of course, the present disclosure is not limited to the above example, and more than 9 accumulators may be set.

[0126] After completing the multiplication operation of the allocated first target data and the second target data in the corresponding available hardware processing channel, such as PE, each PE may send its multiplication operation result and the row index of the corresponding first target data to the routing component. The routing component routes the received multiplication result to the corresponding accumulator based on the row index of the first target data. In this way, the multiplication result obtained by each accumulator can be the multiplication result of the first target data in the same row of the first data matrix for the second target column currently involved in the processing of the second data matrix. The corresponding implementation accumulates the multiplication results corresponding to each data (first target data) in the same row of the first data matrix in the accumulator, which is consistent with the matrix multiplication operation rules based on the inner product and meets the requirements of the matrix multiplication operation based on the inner product.

[0127] The following is an example.

[0128] Following the example of FIG. 3, the three first target columns obtained after compressing the matrix A in the row direction and the column direction are shown in FIG. 11. Assume that the number of currently available PEs in the PE array is not less than the total number of first target data in the three first target columns, each first target data in the three first target columns can be directly allocated one-to-one to different PEs. More specifically, the first target data in each first target column belonging to the same original column of the first data matrix may be allocated to the consecutive PEs of the PE array in a grouped manner, and the data of the second target column currently to be processed in the matrix B may be simplified (such as the first column data shown for the matrix B in FIG. 3) . The invalid data can be removed and the valid second target data can be associated with each group by index. For details, reference can be made to FIG. 11.

[0129] Subsequently, the second target data corresponding to each group can be read based on the established association, and the read second target data can be directly allocated to the PE where each first target data in the corresponding group is located. Each PE may use its multiplier to perform a multiplication operation on the allocated first target data and second target data. For this example, the multiplication operation of each first target data and its corresponding second target data in the three first target columns can be completed in each PE in a parallel processing manner in one beat. For matrix B, one column of matrix B can be sent to the corresponding PE in one beat such that all operations on one column of matrix B can be processed in one beat. The first target data (such as the compressed weight data) obtained after matrix A can be compressed is stored in PE in advance, and the matrix B data can be directly connected to the PE array. All Pes can calculate the results in one beat. More specifically, the data of the columns of matrix B currently involved in the operation can be divided into multiple groups. Each group of data can only be multiplied with the data of the same first target column obtained after compression of matrix A, and will not cross to different columns, thereby reducing the data selection logic, reducing the complexity of hardware wiring, and discarding invalid data in matrix B.

[0130] In the embodiments of the present disclosure, one beat may refer to the PE performing a multiplication operation on the obtained to-be-processed data pair.

[0131] Refer to FIG. 12. Each PE is connected to 9 accumulators adder1-adder9 through the routing component crossbar. The multiplication results of PEs in the same column will be sent to different accumulators through the routing component crossbar, and there will be no conflict. If the PE array has x columns (the number of PE columns in the PE array, that is, the number of columns of the first target column) operating simultaneously, then each accumulator may have at most x inputs.

[0132] Assume that the second target column to be processed in the second data matrix is the nth column of the matrix, the first target data obtained in PE is Wij, and the second target data is Bmn (i.e., the corresponding data in the nth column of the second data matrix) , where i and j represent the row index and column index of the first target data respectively, m and n represent the row index and column index of the second target data respectively, and i, j and m, n are integers not less than 1 respectively. If the number of accumulators set is 9, numbered 1 to 9, the result of the multiplication of Wij and Bmn in PE can be sent to the accumulator numbered i based on the row index i of the first target data Wij. Similarly, for the second target column currently to be processed in the second data matrix, the multiplication results corresponding to all the first target data with row index i can be sent to the accumulator numbered i based on the row index i. In this way, the multiplication results of the same row in the first data matrix, namely the ith row and the nth column data in the second data matrix can be accumulated in the accumulator.

[0133] In the embodiments of the present disclosure, the matrix multiplication operation based on the inner product is essentially to correspond the data of each row in the first data matrix with the data of each column in the second data matrix in sequence, multiply them one by one, and then accumulate the multiplication results to obtain the multiplication-accumulation result. The result of the inner product-based matrix multiplication operation is still a matrix. The multiplication and accumulation of the data in the same row of the first data matrix and the same column of the second data matrix is a value in the final matrix multiplication operation result (also a matrix) . Based on this, in practical applications, an accumulator can also be set for each row in the first data matrix and each column in the second data matrix. In this way, after PE multiplies the first target data Wij and the second target data Bmn, the PE can send the row index i corresponding to the first target data Wij and the column index n corresponding to the second target data Bmn into the accumulator at position Rin. The accumulator at position Rin may be the accumulator corresponding to the row-column combination formed by row i in the first data matrix and column n in the second data matrix. Based on this routing method, the multiplication results corresponding to the same row of data in the first data matrix can be accumulated in the corresponding accumulator for the second target column currently to be processed in the second data matrix, thereby meeting the requirements of the matrix multiplication operation.

[0134] Consistent with the present disclosure, the data in the first target column can be grouped based on the fact that the valid data in the same column of the first data matrix / first data object are arranged consecutively in the first target column after being compressed. In this way, it is convenient to determine the same second target data corresponding to each first target data of the same group in the first target column in a grouped manner, and the determined second target data can be sent to the available hardware processing channels such as the PE where the first target data is located in the same group based on a read operation. This further simplifies the data selection logic, reduces the amount of data to be read and bandwidth requirements, reduces the complexity of hardware wiring, and improves data computing efficiency. Compared with the outer product method, the access to memory by partial sum (multiplication and accumulation results) is reduced.

[0135] Correspondingly to the above data processing method, embodiments of the present disclosure further provide a data processing device. FIG. 13 is a schematic structural diagram of a data processing device according to some embodiments of the present disclosure. As shown in FIG. 13, the data processing device includes a first acquisition module 1301, a second acquisition module 1302, and a data processing module 1303.

[0136] In some embodiments, the first acquisition module 1301 may be configured to obtain at least one first target data sub-object including the first target data, the first target data in the at least one first target data sub-object at least including all valid data of each first data sub-object in the first data object corresponding to a target data processing channel, each first target data having corresponding position information, the corresponding position information indicating an original position of the first target data in the first data object.

[0137] In some embodiments, the second acquisition module 1302 may be configured to obtain second target data corresponding to each of the first target data from a second data object corresponding to the target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object.

[0138] In some embodiments, the data processing module 1303 may be configured to perform data processing on each of the first target data and the corresponding second target data.

[0139] In some embodiments, the number of the first target data sub-objects may be less than the number of the first data sub-objects in the first data object.

[0140] In some embodiments, the device may also include a preprocessing device for forming the first target data sub-object based on preprocessing. The process of forming the first target data sub-object by the preprocessing device may include obtaining the first data object corresponding to the target data processing channel in the model, and moving the valid data of the corresponding first data sub-object in the first data object to the position where the invalid data of other first data sub-objects are located to reduce the number of first data sub-objects included in the first data object.

[0141] In some embodiments, the at least one first target data sub-object may include the first data sub-object obtained after the move that includes at least the valid data, and the other first sub-objects may include the first data sub-objects other than the corresponding first data sub-object in the first data object.

[0142] In some embodiments, the first data object may include a first data matrix having a plurality of data to be processed, and the first data sub-object may be a column in the first data matrix.

[0143] In some embodiments, the preprocessing device moving the valid data of the corresponding first data sub-object in the first data object to the position where the invalid data of other first data sub-objects are located may include moving the valid data of the corresponding column in the first data matrix to the position where the invalid data of a column other than the corresponding column in the first data matrix is located to reduce the number of columns included in the first data matrix.

[0144] In some embodiments, the at least one first target data sub-object may include a first target column obtained after the move and including at least the valid data. The data in the same column of the first data matrix may be located in the same first target column after the movement is completed, and the data in the same row may be located in different first target columns after the movement is completed.

[0145] In some embodiments, the process of the preprocessing device forming the first target data sub-object may also include performing data sequence adjustment processing on the data in each of the first target columns to cause the valid data originally belonging to the same column in the first data matrix to be arranged consecutively in the first target column after being moved.

[0146] In some embodiments, the second data object may include a second data matrix having a plurality of data to be processed.

[0147] In some embodiments, the second acquisition module 1302 may be configured to obtain the second target data corresponding to each first target data from the second target column of the second data matrix based on the position information of each first target data in each first target column, the second target column being a column to be processed currently in the second data matrix.

[0148] In some embodiments, the data processing module 1303 may be configured to, based on the number of available hardware processing channels that can be processed in parallel, allocate the corresponding amount of first target data to each available hardware processing channel, and use the available hardware processing channel to perform data processing on the allocated first target data and the corresponding second target data.

[0149] In some embodiments, the number of available hardware processing channels required to process each of the first target data may be less than the number of available hardware processing channels required to process each of the to-be-processed data in the first data object.

[0150] In some embodiments, the valid data originally belonging to the same column in the first data matrix may be arranged consecutively in the first target column after the movement. The data processing may include a multiplication-accumulation process. The multiplication operation in the multiplication-accumulation process may include a multiplication operation involving matrix multiplication of the first data matrix and the second data matrix.

[0151] In some embodiments, the data processing module 1303 may be configured to assign the first target data of the same group in each first target column to consecutive available hardware processing channels in the channel array, the first target data of the same group including the first target data in the first target column that originally belong to the same column in the first data matrix; determine the second target data corresponding to the first target data in the same group based on the position information corresponding to the first target data in the same group, the first target data of the same group corresponding to the same second target data; allocate the determined second target data to the available hardware processing channels where the first target data of the corresponding group is respectively located, and using the first computing component provided by an available hardware processing channel to perform a multiplication operation on the allocated first target data and the second target data to obtain a multiplication operation result; based on the position information corresponding to each first target data, send the multiplication result corresponding to the first target data originally in the same row in the first data matrix to the same second computing component for accumulation processing to obtain an accumulation operation result.

[0152] In some embodiments, the position information corresponding to the second target data may be used to indicate the position of the second target data in the second data object.

[0153] Embodiment of the present disclosure also provide a data processing chip. FIG. 14 is a schematic structural diagram of a data processing chip according to some embodiments of the present disclosure. As shown in FIG. 14, the data processing chip includes a plurality of available hardware processing channels 401 and a plurality of second computing components 1402.

[0154] Each of the available hardware processing channels 1401 includes a first computing component 1403 for obtaining the corresponding first target data in at least one first target data sub-object. The first target data in the at least one first target data sub-object may include all valid data of each first data sub-object in the first data object corresponding to the target data processing channel. Each first target data may correspond to the corresponding position information, which can be used to indicate the original position of the first target data in the first data object. The available hardware processing channel 1401 may be further configured to obtain the second target data corresponding to the corresponding first target data from the second data object corresponding to the target data processing channel based on the position information corresponding to the corresponding first target data, and perform a first computing processing on the obtained first target data and the second target data to obtain a first computing result.

[0155] In some embodiments, each second computing component 1402 may be configured to perform a second computing processing on the first computing result output by the corresponding available hardware processing channel to obtain a second computing result.

[0156] In some embodiments, the number of the first target data sub-objects may be less than the number of the first data sub-objects in the first data object.

[0157] In some embodiments, the first data object may include a first data matrix having a plurality of data to be processed, and the first data sub-object may be a column in the first data matrix.

[0158] In some embodiments, the at least one first target data sub-object may include a first target column including at least the valid data obtained by moving the valid data of a corresponding column in the first data matrix to a position where the invalid data of other columns other than the corresponding column in the first data matrix are located. The data in the same column of the first data matrix may be located in the same first target column after the movement is completed, the data in the same row may be located in different first target columns after the movement is completed, and the number of the first target columns may be less than the number of columns contained in the first data matrix. The second data object may include a second data matrix having a plurality of data to be processed.

[0159] In some embodiments, the first computation processing may include a multiplication operation, and the multiplication operation may include a multiplication operation involving matrix multiplication of the first data matrix and the second data matrix; the second computing processing may include an accumulation operation.

[0160] In some embodiments, when performing a first computing processing on the obtained first target data and the second target data, the first computing component 1403 may be configured to perform multiplication operation on the first target data in the corresponding first target column and the corresponding second target data to obtain a multiplication result.

[0161] In some embodiments, when performing a second computing processing on the first computing result output by the corresponding available hardware processing channel, the second computing component 1402 may be configured to accumulate the multiplication operation results output by the corresponding available hardware processing channels to obtain an accumulation operation result.

[0162] In some embodiments, the data processing chip may also include a routing component. Each of the available hardware processing channels 1401 may further include an independent storage component for storing the first target data allocated to the available hardware processing channel. The routing component may be configured to send the multiplication result output by the available hardware processing channel to the corresponding second operation component for accumulation processing based on the position information corresponding to the first target data and the second target data in the available hardware processing channel.

[0163] In some embodiments, the position information corresponding to the second target data may be used to indicate the position of the second target data in the second data object. The multiplication results corresponding to the first target data belonging to the same original row in the first data matrix may be sent to the same second operation component for accumulation processing.

[0164] In some embodiments, the available hardware processing channel 1401 may be a PE, the second operation component 1402 may be an accumulator, the first computing component 1403 may be a multiplier in the PE, and the storage component may be a register.

[0165] The data processing chip provided in this embodiment corresponds to the data processing method described in the above method embodiments, and can be used to implement the data processing method disclosed in the above method embodiments based on the hardware structure of the data processing chip and the functions of each component. For more detailed functions of each component in the data processing chip and the process of implementing data processing based on each component of the data processing chip, reference can be made to the description of each method embodiment above, which will not be repeated here.

[0166] Embodiments of the present disclosure also provide an electronic device. FIG. 15 is a schematic structural diagram of an electronic device according to some embodiments of the present disclosure. As shown in FIG. 15, the electronic device includes a memory 10 and a processor 20. The memory can be used for storing a computer instruction set, the computer instruction set can be implemented in the form of a computer program. The processor 20 may be configured to implement the data processing method described in any of the above method embodiments by executing a computer instruction set.

[0167] The processor 20 may be a central processing unit (CPU) , an application-specific integrated circuit (ASIC) , a digital signal processor (DSP) , a field-programmable gate array (FPGA) , a neural network processor (NPU) , a deep learning processor (DPU) or other programmable logic devices.

[0168] In some embodiments, the electronic device may include a display device and / or include a display interface and can be connected to an external display device.

[0169] In some embodiments, the electronic device may also include a camera assembly, and / or may be connected to an external camera assembly.

[0170] In addition, the electronic device may also include components such as communication interfaces and communication buses. The memory, processor, and communication interface communicate with each other through a communication bus.

[0171] The communication interface may be used for communication between electronic devices and other devices. The communication bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.

[0172] In addition, embodiments of the present disclosure further provide a non-transitory readable storage medium on which a computer instruction set is stored, and the computer instruction set is used to be called and executed by a processor to implement a data processing method provided in any of the method embodiments above.

[0173] Further, embodiments of the present disclosure further provide a computer program product is provided. The computer program product includes a computer program / instruction, which, when executed by a processor, implements the data processing method provided in any of the above method embodiments.

[0174] It should be noted that the various embodiments in the present specification are described in a progressive manner, and each embodiment focuses on differences from other embodiments, and the same similar parts between the various embodiments can be referred to each other.

[0175] For the working principle of the data processing device of this embodiment, reference can be made to the relevant steps of the data processing method of the above embodiment, which will not be described in detail here.

[0176] For the convenience of description, when describing the above system or device, the function is divided into various modules or units and described separately. Of course, when implementing the embodiments of the present disclosure, the function of each unit may be implemented in the same or multiple software and / or hardware.

[0177] A method according to the embodiments of the disclosure can be realized by means of software plus a hardware platform, or can be realized by a hardware platform. Embodiments of the present disclosure can be implemented in the form of a software product stored in a storage medium (such as ROM, RAM, magnetic disc, or optical disc) , which may include a number of instructions for enabling an electronic device, e.g., a mobile phone, a computer, a server, an air conditioner, or a network device, or the like, to perform a method consistent with the disclosure, such as one of the methods described above.

[0178] The terms “first, ” “second, ” “third, ” “fourth, ” or the like in the specification are merely used to distinguish an entity or an operation from another entity or operation, and are not intended to require or indicate that there is any such physical relationship or sequence between these entities or operations. In addition, the terms “including, ” “comprising, ” and variants thereof herein are open, non-limiting terminologies, which are meant to encompass a series of elements of processes, methods, items, or devices. Not only those elements, but also other elements that are not explicitly listed, or elements that are inherent to such processes, methods, items, or devices. In the absence of more restrictions, the elements defined by the statement “include a / an . . . ” not preclude that other identical elements are included in the processes, methods, items, or devices that include the elements.

[0179] The embodiments disclosed herein are merely examples. Other applications, advantages, alternations, or modifications of, or equivalents to the disclosed embodiments are obvious to a person skilled in the art and are intended to be encompassed within the scope of the present disclosure.

Claims

1.A data processing chip comprising;a plurality of available hardware processing channels, each of the available hardware processing channels including a first computing component configured to:obtain corresponding first target data in at least one first target data sub-object, the first target data in the at least one first target data sub-object including all valid data of each first data sub-object in a first data object corresponding to a target data processing channel, each first target data having corresponding position information, the position information indicating an original position of the first target data in the first data object;obtain second target data corresponding to the corresponding first target data from a second data object corresponding to the target data processing channel based on the position information corresponding to the corresponding first target data; andperform a first computing processing on the obtained first target data and second target data to obtain a first computing result; anda plurality of second computing components, the second computing component being configured to perform a second computing processing on the first computing result output by the corresponding available hardware processing channel to obtain a second computing result, wherein:a number of the first target data sub-objects is smaller than a number of the first data sub-objects in the first data object.2.The data processing chip of claim 1, wherein:the first data object includes a first data matrix having a plurality of data to be processed, the first data sub-object being a column in the first data matrix;the at least one first target data sub-object includes: a first target column obtained by moving valid data of a corresponding column in the first data matrix to a position where invalid data of a column other than the corresponding column in the first data matrix is located, the data in the same column of the first data matrix being located in the same first target column after the moving is completed, the data in the same row being located in different first target columns after the moving is completed, a number of the first target columns being less than a number of columns included in the first data matrix; andthe second data object includes a second data matrix having a plurality of data to be processed.3.The data processing chip of claim 2, wherein:the first computing processing includes a multiplication operation, the multiplication operation including a multiplication operation involving matrix multiplication of the first data matrix and the second data matrix;the second computing processing includes an accumulation operation;when performing the first computing processing on the obtained first target data and the second target data, the first computing component is configured to perform the multiplication operation on the first target data and the corresponding second target data in the obtained corresponding first target column to obtain a multiplication operation result; andwhen performing the second computing processing on the first computing result output by the corresponding available hardware processing channel, the second computing component is configured to perform an accumulation processing on the multiplication operation result output by the corresponding available hardware processing channel to obtain an accumulation operation result.4.The data processing chip of claim 3 further comprising:a routing component, wherein:each of the available hardware processing channels further includes an independent storage component configured to store the first target data allocated to the available hardware processing channel; andthe routing component is configured to send the multiplication operation result output by the available hardware processing channel to the corresponding second computing component for accumulation processing based on the position information corresponding to the first target data and the second target data in the available hardware processing channel,wherein the position information corresponding to the second target data indicates the position of the second target data in the second data object, the multiplication operation result corresponding to the first target data belonging to the same original row in the first data matrix is sent to the same second computing component for accumulation processing.5.A data processing method comprising:obtaining at least one first target data sub-object including first target data, the first target data in the at least one first target data sub-object at least including all valid data of each first data sub-object in a first data object corresponding to a target data processing channel, each first target data having corresponding position information, the corresponding position information indicating an original position of the first target data in the first data object;obtaining second target data corresponding to each of the first target data from a second data object corresponding to the target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object; andperforming data processing on each of the first target data and the corresponding second target data, wherein:a number of the first target data sub-object is smaller than a number of the first data sub-objects in the first data object.6.The method of claim 5, wherein a method for forming the first target data sub-object includes:obtaining the first data object corresponding to the target data processing channel in a model; andmoving the valid data of the corresponding first data sub-object in the first data object to a position location where the invalid data of other first data sub-objects are located to reduce the number of first data sub-objects included in the first data object, wherein:the at least one first target data sub-object includes a first data sub-object obtained after the move and including at least the valid data, the other first data sub-objects include the first data sub-objects other than the corresponding first data sub-object in the first data object.7.The method of claim 6, wherein:the first data object includes a first data matrix having a plurality of data to be processed, the first data sub-object being a column in the first data matrix; andmoving the valid data of the corresponding first data sub-object in the first data object to the position of the invalid data of other first data sub-objects includes:moving the valid data of the corresponding column in the first data matrix to the position where the invalid data of the column other than the corresponding column in the first data matrix is located to reduce the number of columns included in the first data matrix, wherein the at least one first target data sub-object includes a first target column including at least valid data after the moving is completed; data in the same column of the first data matrix is in the same first target column after the moving is completed, data in the same row is in different first target columns after the moving is completed.8.The method of claim 7, wherein the method for forming the first target data sub-object further includes:performing data sequence adjustment processing on the data in each of the first target columns to cause the valid data originally belonging to the same column in the first data matrix to be arranged consecutively in the first target column after being moved.9.The method of claim 7, wherein:the second data object includes a second data matrix having a plurality of data to be processed; andobtaining the second target data corresponding to each of the first target data from the second data object corresponding to the target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object includes:obtaining the second target data corresponding to each of the first target data from the second target column of the second data matrix based on the position information of each first target data in each first target column, the second target column being the column currently to be processed in the second data matrix.10.The method of claim 5, wherein performing data processing on each of the first target data and the corresponding second target data includes:based on a number of available hardware processing channels configured to perform processing in parallel, allocating the corresponding amount of first target data to each available hardware processing channel, and using the available hardware processing channel to perform data processing on the allocated first target data and the corresponding second target data, the number of available hardware processing channels required to process each of the first target data being less than the number of available hardware processing channels required to process each of the to-be-processed data in the first data object.11.The method of claim 9, wherein:the valid data originally belonging to the same column in the first data matrix are arranged consecutively in the first target column after the movement;the data processing includes a multiplication-accumulation process, a multiplication operation in the multiplication-accumulation process including a multiplication operation involving matrix multiplication of the first data matrix and the second data matrix;performing data processing on each of the first target data and the corresponding second target data includes:assigning the first target data of the same group in each first target column to consecutive available hardware processing channels in the channel array, the first target data of the same group including the first target data in the first target column that originally belong to the same column in the first data matrix;determining the second target data corresponding to the first target data in a same group based on the position information corresponding to the first target data in the same group, the first target data of the same group corresponding to the same second target data;allocating the determined second target data to the available hardware processing channels where the first target data of the corresponding group is respectively located, and using the first computing component provided by an available hardware processing channel to perform the multiplication operation on the allocated first target data and the second target data to obtain the multiplication operation result; andbased on the position information corresponding to each first target data, sending the multiplication result corresponding to the first target data originally in the same row in the first data matrix to the same second computing component for accumulation processing to obtain an accumulation operation result, the position information corresponding to the second target data indicating the position of the second target data in the second data object.12.A non-transitory readable storage medium, storing a computer instruction set, the computer instruction set, when being called and executed by a processor, causing the processor to:obtain at least one first target data sub-object including first target data, the first target data in the at least one first target data sub-object at least including all valid data of each first data sub-object in a first data object corresponding to a target data processing channel, each first target data having corresponding position information, the corresponding position information indicating an original position of the first target data in the first data object;obtain second target data corresponding to each of the first target data from a second data object corresponding to the target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object; andperform data processing on each of the first target data and the corresponding second target data, wherein:a number of the first target data sub-object is smaller than a number of the first data sub-objects in the first data object.13.The storage medium of claim 12, wherein the first target data sub-object is formed by:obtaining the first data object corresponding to the target data processing channel in a model; andmoving the valid data of the corresponding first data sub-object in the first data object to a position location where the invalid data of other first data sub-objects are located to reduce the number of first data sub-objects included in the first data object, wherein:the at least one first target data sub-object includes a first data sub-object obtained after the move and including at least the valid data, the other first data sub-objects include the first data sub-objects other than the corresponding first data sub-object in the first data object.14.The storage medium of claim 13, wherein:the first data object includes a first data matrix having a plurality of data to be processed, the first data sub-object being a column in the first data matrix; andmoving the valid data of the corresponding first data sub-object in the first data object to the position of the invalid data of other first data sub-objects includes:moving the valid data of the corresponding column in the first data matrix to the position where the invalid data of the column other than the corresponding column in the first data matrix is located to reduce the number of columns included in the first data matrix, wherein the at least one first target data sub-object includes a first target column including at least valid data after the moving is completed; data in the same column of the first data matrix is in the same first target column after the moving is completed, data in the same row is in different first target columns after the moving is completed.15.The storage medium of claim 14, wherein the first target data sub-object is further formed by:performing data sequence adjustment processing on the data in each of the first target columns to cause the valid data originally belonging to the same column in the first data matrix to be arranged consecutively in the first target column after being moved.16.The storage medium of claim 14, wherein:the second data object includes a second data matrix having a plurality of data to be processed; andobtaining the second target data corresponding to each of the first target data from the second data object corresponding to the target data processing channel based on the position information respectively corresponding to each first target data in the at least one first target data sub-object includes:obtaining the second target data corresponding to each of the first target data from the second target column of the second data matrix based on the position information of each first target data in each first target column, the second target column being the column currently to be processed in the second data matrix.17.The storage medium of claim 12, wherein performing data processing on each of the first target data and the corresponding second target data includes:based on a number of available hardware processing channels configured to perform processing in parallel, allocating the corresponding amount of first target data to each available hardware processing channel, and using the available hardware processing channel to perform data processing on the allocated first target data and the corresponding second target data, the number of available hardware processing channels required to process each of the first target data being less than the number of available hardware processing channels required to process each of the to-be-processed data in the first data object.18.The storage medium of claim 16, wherein:the valid data originally belonging to the same column in the first data matrix are arranged consecutively in the first target column after the movement;the data processing includes a multiplication-accumulation process, a multiplication operation in the multiplication-accumulation process including a multiplication operation involving matrix multiplication of the first data matrix and the second data matrix;performing data processing on each of the first target data and the corresponding second target data includes:assigning the first target data of the same group in each first target column to consecutive available hardware processing channels in the channel array, the first target data of the same group including the first target data in the first target column that originally belong to the same column in the first data matrix;determining the second target data corresponding to the first target data in a same group based on the position information corresponding to the first target data in the same group, the first target data of the same group corresponding to the same second target data;allocating the determined second target data to the available hardware processing channels where the first target data of the corresponding group is respectively located, and using the first computing component provided by an available hardware processing channel to perform the multiplication operation on the allocated first target data and the second target data to obtain the multiplication operation result; andbased on the position information corresponding to each first target data, sending the multiplication result corresponding to the first target data originally in the same row in the first data matrix to the same second computing component for accumulation processing to obtain an accumulation operation result, the position information corresponding to the second target data indicating the position of the second target data in the second data object.