A data processing method and related device based on data preloading

By segmenting the target data in the AI ​​accelerator and preloading the data into the cache while performing the first operation, the problem of increased computational latency in deep learning models is solved, achieving more efficient data processing.

CN123178301APending Publication Date: 2026-11-27HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510696113.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

The computational latency of deep learning models increases with the size of the model, and how to reduce computational latency has become an urgent problem to be solved.

Method used

By executing a data preloading method in the AI ​​accelerator, the target data is segmented, and the segmented data is preloaded into the target cache while the first operation is performed. The time of the second operation is used to mask the preloading time, thereby improving the data loading efficiency.

Benefits of technology

This reduces the overall latency of AI accelerators in executing model calculations and improves data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178301A_ABST
    Figure CN123178301A_ABST
Patent Text Reader

Abstract

A data processing method based on data preloading, applied to the field of artificial intelligence (AI) technology. In the process of using an AI accelerator to perform model operation, the target data to be processed is divided, and after one of the divided data is input into the AI accelerator to perform a first operation, the AI accelerator continues to perform a second operation on the operation result without performing the second operation after the first operation on the entire target data is completed. Moreover, while performing the second operation inside the AI accelerator, the next data after division is preloaded onto the target cache used by the AI accelerator, so as to mask the preloading time by using the time of the second operation, so that after the AI accelerator completes the second operation, the next data requiring the first operation can be quickly loaded from the target cache, improving the data loading efficiency in the process of the AI accelerator processing data, and further reducing the overall latency of the AI accelerator performing model operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence (AI) technology, and in particular to a data processing method and related apparatus based on data preloading. Background Technology

[0002] Currently, deep learning models have become a hot topic in the field of artificial intelligence. Among them, model architectures represented by large language models are considered a potential way to achieve general artificial intelligence, and have been widely used in natural language generation, speech translation, intelligent customer service, and intelligent assistants.

[0003] During the operation of a deep learning model, the input data needs to undergo a series of sequential operator calculations to obtain the model's prediction result. For the sequentially connected operators in a deep learning model, different operators are often responsible for performing different operations, and the input data of the subsequent operator is the output data of the previous operator. Therefore, the subsequent operator often needs to wait for the previous operator to complete its calculation before it can begin its own calculation.

[0004] Since deep learning models are primarily composed of a series of sequential operators, their computational latency is often closely related to their scale. As the scale of deep learning models increases, while model performance improves, computational latency also increases. Therefore, reducing the computational latency of deep learning models based on existing architectures has become an urgent problem to be solved. Summary of the Invention

[0005] This application provides a data processing method and related apparatus based on data preloading, which can reduce the overall latency of AI accelerators in performing model calculations.

[0006] Firstly, a data processing method based on data preloading is provided, applied to the process of AI accelerators processing data based on models. The data processing method based on data preloading includes: an execution device inputting first data into a first AI accelerator, and the first AI accelerator performing a first operation on the first data to obtain a first operation result stored in the first AI accelerator. Here, the first data is obtained by segmenting target data, and the target data is the data that the first AI accelerator needs to process.

[0007] Then, while the first AI accelerator is performing the second operation on the first operation result, the execution device simultaneously loads the second data into the target cache, which is the cache used by the first AI accelerator, and the second data is obtained by splitting the target data. That is, while the second operation is being performed inside the first AI accelerator, the execution device pre-loads the second data required later into the target cache, which has a higher read speed.

[0008] Secondly, after the first AI accelerator completes the second operation on the first operation result, the execution device inputs the second data from the target cache into the first AI accelerator, and the first AI accelerator performs the first operation on the second data. That is, for multiple data obtained based on the target data, after the first AI accelerator completes the first and second operations on the previous data, it continues to perform the first and second operations on the next data.

[0009] In this solution, during the model computation using an AI accelerator, the target data to be processed is segmented. After the segmented data is input into the AI ​​accelerator for the first computation, a second computation is performed on the result within the AI ​​accelerator, eliminating the need to complete the first computation on the entire target data before performing the second. Furthermore, while the second computation is being performed within the AI ​​accelerator, the next segmented data is preloaded into the target cache used by the AI ​​accelerator. This utilizes the time of the second computation to mask the preloading time, allowing the AI ​​accelerator to quickly load the next data requiring the first computation from the target cache after completing the second computation. This improves the data loading efficiency during AI accelerator data processing and reduces the overall latency of model computation.

[0010] In one possible implementation, the input data for the second operation includes only the result of the first operation. That is, the first AI accelerator can complete the second operation relying solely on the result of the first operation, without needing to depend on any other input data. Therefore, while the first AI accelerator performs the second operation on the result of the first operation, the execution device can load the second data into the target cache in parallel, thereby achieving preloading of the second data.

[0011] In one possible implementation, the target data includes the weight matrix of a Mixture of Experts (MoE) model. The first operation includes grouped matrix multiplication, and the second operation includes de-sorting, which reorders the data in the result of the first operation. Furthermore, in addition to de-sorting, the second operation may also include other operations, such as summation.

[0012] Among them, grouped matrix multiplication optimizes the matrix multiplication process by grouping and aggregating calculations. By grouping the input data according to expert networks, the input data corresponding to the same expert network are arranged continuously in the batch dimension, thereby achieving batch calculation.

[0013] In one possible implementation, the first and second data are obtained by splitting the weight matrix, and both include different contents from the weight matrix. The reverse rearrangement involves rearranging the output data according to the original order of the corresponding input data, thus ensuring that the order of the output data corresponds to the original order of the input data.

[0014] In one possible implementation, during the execution of the first operation on the second data via the first AI accelerator, the execution device simultaneously transmits a first portion of the second operation result to the second AI accelerator. The second operation result is obtained by performing a second operation on the first operation result. The first and second AI accelerators are used to deploy different parts of the same AI model, and they cooperate to complete data processing based on the AI ​​model.

[0015] In other words, after the first AI accelerator completes the processing of the first data (i.e., executes the first and second operations), while the first AI accelerator continues to process the next data (i.e., the second data), the processing result of the first data is synchronously transmitted to other AI accelerators (i.e., the second AI accelerator), without having to complete the processing of the entire target data before transmitting the processing result. This allows the computation time to mask the communication time, thereby improving the overall data processing efficiency.

[0016] In one possible implementation, during the processing of target data using the first AI accelerator, the execution device receives a third computation result transmitted by the second AI accelerator. Furthermore, the execution device stores the third computation result in a location adjacent to the second portion of data in the second computation result. Thus, after the first AI accelerator completes the processing of the target data, the execution device then performs the target operation on the second portion of data and the third computation result using the first AI accelerator. The target operation can be an operation set according to actual computational needs, such as a summation operation, a maximum value operation, a minimum value operation, or a mean value operation.

[0017] In this solution, by storing the received third operation result in a location adjacent to the second part of the data in the second operation result, the third operation result that the first AI accelerator needs to read and the second part of the data in the second operation result can be stored in consecutive storage addresses. This allows the first AI accelerator to read the third operation result and the second part of the data in the second operation result at once, thereby improving the efficiency of the first AI accelerator in accessing the third operation result and the second part of the data in the second operation result, and ultimately improving the efficiency of data processing.

[0018] In one possible implementation, to ensure that the third computation result subsequently obtained from the second AI accelerator can be stored in an adjacent location to the second part of the second computation result, after obtaining the second computation result, the execution device moves the first part of the data from the first AI accelerator to a first location in memory, and moves the second part of the data from the first AI accelerator to a second location in memory. The first and second locations are not adjacent in memory.

[0019] In one possible implementation, the result of the third operation is stored in a third location in memory, and the third location is located between the first and second locations.

[0020] In other words, the first AI accelerator essentially reserves the third position between the first and second positions in advance, so that the first part of the data and the second part of the data in the second operation result are not stored continuously, thus ensuring that the second part of the data in the second operation result can be continuous with the subsequently received third operation result in a continuous memory address.

[0021] In one possible implementation, the time taken to transmit the first portion of the data to the second AI accelerator is less than the total time taken to perform the first and second operations on the second data.

[0022] In other words, for a single piece of data derived from the target data, the processing time required by the first AI accelerator to process this data is actually longer than the time required to transmit the processed result to other AI accelerators. Therefore, by simultaneously preloading the next piece of data while the first AI accelerator is processing a piece of data derived from the target data, the processing time of each piece of data by the first AI accelerator can be effectively shortened, thereby improving the overall efficiency of the first AI accelerator in processing the target data.

[0023] In one possible implementation, the execution device loads the second data from the memory used by the first AI accelerator into the target cache. The memory read speed is lower than the target cache read speed, and the memory is used to store the target data.

[0024] In a second aspect, a data processing apparatus is provided, comprising: a data processing module, configured to input first data into a first artificial intelligence (AI) accelerator, and perform a first operation on the first data through the first AI accelerator to obtain a first operation result stored in the first AI accelerator, wherein the first data is obtained by segmenting target data, and the target data is the data to be processed by the first AI accelerator; a data loading module, configured to load second data into a target cache during the second operation performed by the first AI accelerator on the first operation result, wherein the target cache is a cache used by the first AI accelerator, and the second data is obtained by segmenting the target data; the data processing module is further configured to input the second data from the target cache into the first AI accelerator after the first AI accelerator has completed the second operation on the first operation result, and perform the first operation on the second data through the first AI accelerator.

[0025] In one possible implementation, the input data for the second operation includes only the result of the first operation.

[0026] In one possible implementation, the target data includes the weight matrix of the MoE model, the first operation includes grouped matrix multiplication, and the second operation includes unordering, which is used to reorder the data in the result of the first operation.

[0027] In one possible implementation, the first data and the second data are obtained by splitting the weight matrix, and the first data and the second data include different contents in the weight matrix.

[0028] In one possible implementation, the data processing device further includes: a communication module, used to transmit a first portion of the second operation result to a second AI accelerator during the first operation performed on the second data by the first AI accelerator; wherein the second operation result is obtained after performing a second operation on the first operation result, the first AI accelerator and the second AI accelerator are respectively used to deploy different parts of the same AI model, and the first AI accelerator and the second AI accelerator are used to cooperate to complete data processing based on the AI ​​model.

[0029] In one possible implementation, the communication module is further configured to receive the third computation result transmitted by the second AI accelerator; the data processing module is further configured to store the third computation result in a position adjacent to the second part of the data in the second computation result; and the data processing module is further configured to perform a target operation on the second part of the data and the third computation result through the first AI accelerator.

[0030] In one possible implementation, after obtaining the second calculation result, the data processing module is further configured to: move the first part of the data from the first AI accelerator to a first location in memory, and move the second part of the data from the first AI accelerator to a second location in memory; wherein the first location and the second location are not adjacent in memory.

[0031] In one possible implementation, the result of the third operation is stored in a third location in memory, and the third location is located between the first and second locations.

[0032] In one possible implementation, the time taken to transmit the first portion of the data to the second AI accelerator is less than the total time taken to perform the first and second operations on the second data.

[0033] In one possible implementation, a data loading module is specifically used to load second data from the memory used by the first AI accelerator into a target cache; wherein the memory read speed is lower than the target cache read speed, and the memory is used to store the target data.

[0034] Thirdly, a chip system is provided, the chip system including an AI accelerator and a communication interface for communicating with a module outside the chip, the AI ​​accelerator for running computer programs or instructions, such that a device on which the chip system is installed can perform the methods of any of the above aspects.

[0035] Fourthly, a computing device is provided, the computing device including the AI ​​accelerator of the second aspect, the AI ​​accelerator in the computing device being used to implement the operational steps of the method of any of the above aspects.

[0036] Fifthly, a computing device cluster is provided, comprising at least one computing device, wherein any one computing device is used to run a computer program or instructions, such that the computing device cluster can perform the methods described in any of the above aspects. Alternatively, some or all of the computing devices are used together to run a computer program or instructions, such that the computing device cluster can perform the methods described in any of the above aspects.

[0037] In a sixth aspect, a computer-readable storage medium is provided, which stores instructions that, when executed on a computer, cause the computer to perform the methods of any of the above aspects.

[0038] In a seventh aspect, a computer program product containing instructions is provided, which, when executed on a computer, enable the computer to perform the methods of any of the above aspects.

[0039] Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Attached Figure Description

[0040] Figure 1 A schematic diagram of the structure of an execution device provided in this application;

[0041] Figure 2 A flowchart illustrating a data processing method based on data preloading provided in this application;

[0042] Figure 3 A schematic diagram of a first AI accelerator processing first data and second data provided in this application;

[0043] Figure 4 A schematic diagram illustrating the process of segmenting data and performing a first and second operation, as provided in this application;

[0044] Figure 5 A schematic diagram illustrating the segmentation of target data provided in this application;

[0045] Figure 6 This application provides a schematic diagram of performing operations after segmenting a weight matrix.

[0046] Figure 7 A schematic diagram illustrating parallel computation and communication after data segmentation, as provided in this application;

[0047] Figure 8 A comparative diagram illustrating one method of storing computation results provided in this application;

[0048] Figure 9 This application provides a schematic diagram of storing the unrearrangement results in memory in a MoE model scenario;

[0049] Figure 10 A schematic diagram of the structure of a data processing device provided in this application;

[0050] Figure 11 A schematic diagram of the structure of a computing device provided in this application;

[0051] Figure 12 This is a schematic diagram of the structure of a computer-readable storage medium provided in this application. Detailed Implementation

[0052] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application are described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some, and not all, of the embodiments of this application. Those skilled in the art will recognize that, with the emergence of new application scenarios, the technical solutions provided by this application are also applicable to similar technical problems.

[0053] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such descriptions can be used interchangeably where appropriate to allow embodiments to be implemented in a sequence other than that illustrated or described in this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products, or devices. The naming or numbering of steps appearing in this application does not imply that the steps in the method flow must be performed in the chronological / logical order indicated by the naming or numbering. The execution order of named or numbered process steps can be changed according to the desired technical purpose, as long as the same or similar technical effect is achieved. The division of units in this application is a logical division. In practical applications, there may be other division methods. For example, multiple units may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the shown or discussed mutual coupling, direct coupling, or communication connection may be through some interface, and the indirect coupling or communication connection between units may be electrical or other similar forms, none of which are limited in this application. Furthermore, the units or sub-units described as separate components may or may not be physically separated, may or may not be physical units, or may be distributed among multiple circuit units. Some or all of the units can be selected to achieve the purpose of the solution in this application according to actual needs.

[0054] To facilitate understanding, some technical terms used in this application will be introduced below.

[0055] (1) Deep learning model

[0056] Deep learning models refer to neural network models based on deep learning methods, typically including convolutional neural network models, autoencoder neural network models, and large language models.

[0057] (2) Large Language Model (LLM)

[0058] Large language models are deep learning models trained on massive amounts of text data that can generate natural language text or understand the meaning of language text. Large language models can handle various natural language tasks, such as text classification, question answering, and dialogue, and are an important pathway to artificial intelligence.

[0059] (3) Mixture of experts (MoE) model

[0060] MoE (Modal of Experts) models are AI models that consist of multiple independent expert networks (also called subnetworks), each specializing in a subset of the input data to collectively perform a task. Specifically, the core idea of ​​MoE models is that different parts of the model focus on different tasks or different aspects of the data. In MoE models, multiple expert networks are connected through a gating network (or router), and the gating network's role is to select and activate the specific expert network best suited to the input data. For example, in a Transformer-based large language model, each network layer typically consists of a gating network and N expert networks. The gating network is generally a linear network using the softmax activation function, used to guide the input data to the appropriate expert network.

[0061] During the operation of a deep learning model, the input data undergoes a series of sequential operator calculations to ultimately obtain the model's prediction result. For the sequentially connected operators in a deep learning model, different operators often perform different operations, and the input data of a subsequent operator is usually the output data of the previous operator. Therefore, when running a deep learning model using an AI accelerator, the AI ​​accelerator executes each operator sequentially to process the input data. For example, the AI ​​accelerator continuously loads input data from memory and executes the operation indicated by operator 1 on the loaded data, inputting the result into memory. Then, after the AI ​​accelerator completes the operation indicated by operator 1 on all the input data, it loads the result corresponding to operator 1 from memory into the AI ​​accelerator, which then continues to execute the operation indicated by operator 1 on the loaded result.

[0062] Since AI accelerators continuously load data from memory to perform calculations, the speed at which they load data actually affects their efficiency in executing model calculations. In other words, the faster an AI accelerator loads data, the more efficient it tends to be at executing model calculations.

[0063] In view of this, this application provides a data processing method based on data preloading. During model computation using an AI accelerator, the target data to be processed is segmented. After one segmented data point is input into the AI ​​accelerator for a first computation, a second computation is performed on the result within the AI ​​accelerator, without needing to complete the first computation on the entire target data before performing the second computation. Furthermore, while the second computation is being performed within the AI ​​accelerator, the next segmented data point is preloaded into the target cache used by the AI ​​accelerator. This utilizes the time of the second computation to mask the preloading time, allowing the AI ​​accelerator to quickly load the next data point requiring the first computation from the target cache after completing the second computation. This improves the data loading efficiency of the AI ​​accelerator and reduces the overall latency of model computation.

[0064] Please see Figure 1 , Figure 1 This application provides a schematic diagram of the structure of an execution device. The data processing method based on data preloading provided in this application can be applied to… Figure 1 On the execution device shown. For example... Figure 1 As shown, the execution device includes an AI accelerator, a target cache, and memory. The AI ​​accelerator includes computing units and local memory. The number of computing units and local memory units can be one or more. Furthermore, the read / write speed of the local memory in the AI ​​accelerator is typically higher than that of the target cache, but its storage space is smaller. The read / write speed of the target cache is typically higher than that of the memory used by the AI ​​accelerator, but its storage space is smaller. The local memory in the AI ​​accelerator can be, for example, registers or other types of storage devices. The target cache can include, for example, a level 1 cache and / or a level 2 cache. The memory can be, for example, high-bandwidth memory (HBM), but this application does not specifically limit its usage.

[0065] Specifically, AI accelerators can be hardware specifically designed for AI computing, such as graphics processing units (GPUs), neural processing units (NPUs), or tensor processing units (TPUs), which can be used to accelerate the training or inference of AI models.

[0066] In an AI accelerator, computing units may include one or more physical components for performing computations. For example, in the case of a GPU, computing units may include tensor cores and / or CUDA cores. In the case of a TPU, computing units may include matrix multiply units (MXUs) and / or vector units. In the case of an NPU, computing units may include cube cores and / or vector cores.

[0067] Please see Figure 2 , Figure 2 This is a flowchart illustrating a data processing method based on data preloading, as provided in this application. Figure 2 The data processing method based on data preloading shown can be applied to... Figure 1 On the AI ​​accelerator shown. And, Figure 2 The data processing method based on data preloading shown includes the following steps 201-203.

[0068] Step 201: Input the first data into the first AI accelerator, and perform the first operation on the first data through the first AI accelerator to obtain the first operation result stored in the first AI accelerator. The first data is obtained by splitting the target data, and the target data is the data that the first AI accelerator needs to process.

[0069] In this application, the first AI accelerator is used to run AI models (such as deep learning models) to achieve AI model training or inference. During the operation of the first AI accelerator, it needs to process the target data. The target data can specifically be the input data of the AI ​​model (such as text data, image data, video data, or audio data), or it can include the input data of a certain neural network layer in the AI ​​model (such as features of text, images, videos, or audio), or it can include the parameters of a certain neural network layer in the AI ​​model (such as a weight matrix). Of course, the target data may also simultaneously include the input data of a certain neural network layer in the AI ​​model and the parameters of that neural network layer.

[0070] In a typical data processing flow, the first AI accelerator needs to perform a first operation on the target data. In this step, the execution device may divide the target data into multiple data segments, and then perform the first operation on each of these segments. The first data segment is a subset of the target data. After performing the first operation on the first data segment, the first AI accelerator obtains the first operation result, which can be completely stored within the first AI accelerator. In other words, the local memory within the first AI accelerator can store the complete first operation result, eliminating the need to store it externally.

[0071] It should be noted that when the target data only includes the parameters of a certain neural network layer in the AI ​​model, or only includes the input data of a certain neural network layer in the AI ​​model, in the process of inputting the first data into the first AI accelerator, other data also needs to be input into the first AI accelerator and executed together with the first data to perform the first operation.

[0072] Taking the weight matrix of a neural network layer in an AI model as an example, the first AI accelerator actually needs to perform a first operation on the input data of the neural network layer and the weight matrix. At this time, the execution device can perform a partitioning of the weight matrix to obtain a sub-matrix (i.e., the first data mentioned above), and input the input data of the neural network layer and the sub-matrix together into the first AI accelerator to perform the first operation (e.g., matrix multiplication) to obtain the first operation result.

[0073] For example, taking the target data as the input data of a certain neural network layer in an AI model, the first AI accelerator actually needs to perform a first operation on the input data and weight matrix of that neural network layer. At this time, the execution device can perform segmentation on the input data of the neural network layer to obtain a sub-data (i.e., the first data mentioned above), and input the sub-data and the weight matrix of the neural network layer into the first AI accelerator to perform the first operation (e.g., matrix multiplication) to obtain the first operation result.

[0074] Step 202: During the second operation performed by the first AI accelerator on the first operation result, the second data is loaded into the target cache, which is the cache used by the first AI accelerator. The second data is obtained by splitting the target data.

[0075] After the first AI accelerator performs a first operation on the first data and obtains a first operation result, the first AI accelerator continues to perform a second operation on the obtained first operation result. The input data for the first AI accelerator performing the second operation includes only the first operation result. That is, the first AI accelerator can complete the second operation relying solely on the first operation result, without needing to rely on any other input data. Therefore, while the first AI accelerator performs the second operation on the first operation result, the execution device can load the second data into the target cache in parallel, thereby achieving preloading of the second data. The target cache may include, for example, a first-level cache and / or a second-level cache, etc., and this application does not specifically limit the type of the target cache.

[0076] The second data is also obtained by segmenting the target data. That is, both the first and second data are parts of the target data. Furthermore, the first and second data can be non-overlapping content; that is, the first and second data each include different parts of the target data. For example, when the target data is the weight matrix of a neural network layer, the first data can be submatrix 1 of the weight matrix, and the second data can be submatrix 2 of the weight matrix, where submatrix 1 and submatrix 2 can include different rows of the weight matrix.

[0077] Of course, the first and second data may also have overlapping content, meaning that both the first and second data include parts of the target data. For example, if the target data includes the input data and weight matrix of a certain neural network layer, then the first data includes the input data of that neural network layer and a submatrix of the weight matrix, and the second data includes the input data of that neural network layer and another submatrix of the weight matrix. In other words, both the first and second data include the input data of the neural network layer.

[0078] Understandably, during the execution of the first operation by the first AI accelerator, it continuously loads first data from external storage media (i.e., memory or target cache) and performs the first operation on the loaded data. Generally, when loading data, the first AI accelerator first checks whether the target cache with high read / write speed has the required data; if the target cache has the required data, the first AI accelerator reads the data directly from the target cache; if the target cache does not have the required data, the first AI accelerator searches for and reads the data from memory with lower read / write speed. Therefore, during the execution of the first operation by the first AI accelerator, the first data continuously flows from the external storage media into the first AI accelerator, resulting in the continuous occupation of bandwidth from the external storage media to the internal storage of the first AI accelerator.

[0079] However, during the second operation performed by the first AI accelerator on the first operation result, the first AI accelerator can complete the second operation solely relying on the first operation result stored internally within the first AI accelerator, without needing to retrieve other data from external storage media. That is, during the second operation performed by the first AI accelerator on the first operation result, the bandwidth from external storage media to the internal storage of the first AI accelerator is no longer occupied. Therefore, while the first AI accelerator is performing the second operation, the execution device can simultaneously preload the second data that the first AI accelerator will subsequently need to process into a target cache with a faster read / write speed, thereby ensuring that the first AI accelerator can always read the second data from the target cache, without needing to read the second data from memory.

[0080] For example, please refer to Figure 3 , Figure 3 This application provides a schematic diagram of a first AI accelerator processing first and second data. (See diagram below.) Figure 3 As shown, the first AI accelerator first loads first data from external storage media (such as memory and / or target cache) and performs a first operation on the first data through a computing unit. After performing the first operation on the first data, the computing unit in the first AI accelerator obtains the first operation result and stores the first operation result in the local memory of the first AI accelerator. Then, the computing unit in the first AI accelerator continues to perform a second operation on the first operation result stored in the local memory. At this time, since the computing unit does not need to obtain data from outside the first AI accelerator when performing the second operation, the second data in memory can be synchronously loaded into the target cache.

[0081] Specifically, the execution device loads the second data from the memory used by the first AI accelerator into the target cache. The memory read speed is lower than the target cache read speed, but the memory capacity is greater than the target cache capacity, and the memory is used to store the target data.

[0082] Step 203: After the first AI accelerator completes the second operation on the first operation result, the second data is input from the target cache into the first AI accelerator, and the first operation is performed on the second data through the first AI accelerator.

[0083] After the first AI accelerator completes the second operation on the first operation result, it needs to continue performing the first operation on the second data. Therefore, at this time, the second data, which has been pre-loaded into the target cache, can be input from the target cache into the first AI accelerator. This eliminates the need for the first AI accelerator to retrieve the second data from memory, thereby improving the efficiency of the first AI accelerator in processing the second data. Figure 3As shown, after the computing unit in the first AI accelerator performs a second operation on the first operation result, the first AI accelerator can load second data from the target cache and perform the first operation on the second data.

[0084] As is understandable, the above example, using the first and second data points, illustrates the process where, after the first AI accelerator performs the first operation on the first data point, it continues to perform the second operation while preloading the next data point into the target cache. In practical applications, the target data can be divided into two or more data points. When the target data is divided into two or more data points, the first AI accelerator can still preload the next data point into the target cache while performing the second operation on the second data point.

[0085] For example, please refer to Figure 4 , Figure 4 This is a schematic diagram illustrating how data is segmented and a first and second operation is performed, as provided in this application. Figure 4 As shown, for the target data mentioned above, assume that the target data is divided into N data points, where N is an integer greater than or equal to 2. In this case, after the first AI accelerator performs the first operation on the i-th data point, it obtains the i-th operation result, and then the first AI accelerator continues to perform the second operation on the i-th operation result. Furthermore, while the first AI accelerator performs the second operation on the i-th operation result, the execution device preloads the (i+1)-th data point into the target cache. Thus, after the first AI accelerator completes the second operation on the i-th operation result, it can retrieve the (i+1)-th data point from the target cache and perform the first operation on it. Similarly, while the first AI accelerator performs the second operation on the (i+1)-th operation result, the execution device preloads the (i+2)-th data point into the target cache, and so on, until the first AI accelerator completes the processing of all data obtained from the segmentation of the target data.

[0086] To facilitate understanding, the following specific examples will illustrate the types of the first and second operations performed after splitting the target data.

[0087] In one possible example, the target data mentioned above includes the weight matrix of the MoE model. The first operation includes grouped matrix multiplication, and the second operation includes unordering, which is used to re-sort the data in the result of the first operation. In addition to unordering, the second operation may also include other operations, such as summation, which is not specifically limited in this application.

[0088] Specifically, the core idea of ​​the MoE model is to route the model's input data to different expert networks for processing, with each expert responsible for a portion of the input samples. For each input data point, the MoE model can use a gating network to select and activate one or more expert networks that best suit that input data, thus adaptively activating expert networks for each input data point. After the input data is assigned to an expert network, the input data needs to undergo matrix multiplication with the weight matrix of each corresponding expert network. Since the expert networks assigned to each input data point may be different, directly performing matrix multiplication with each expert network one by one would lead to a large amount of discrete computation. Therefore, the MoE model often uses grouped matrix multiplication to optimize the computation process. Grouped matrix multiplication optimizes the matrix multiplication process by grouping and aggregating computations. By grouping the input data according to the expert network, the input data corresponding to the same expert network are arranged continuously in the batch dimension, thereby achieving batch computation. In summary, grouped matrix multiplication is essentially performing matrix multiplication with the weight matrix of the corresponding expert network after grouping and rearranging the input data. After performing grouped matrix multiplication, the first AI accelerator often needs to reverse the output of the grouped matrix multiplication, that is, rearrange the output data according to the original order of the corresponding input data, so as to ensure that the order of the output data corresponds to the original order of the input data. For example, if the output of the grouped matrix multiplication is a single output matrix, the first AI accelerator can rearrange the order of multiple rows in the output matrix to achieve reverse rearrangement.

[0089] Furthermore, when a single input data point activates multiple expert networks, that input data may require matrix multiplication with the weight matrices of multiple expert networks, and the results of these matrix multiplications need to be superimposed. Therefore, after unsorting the output of the grouped matrix multiplication, some data in the unsorted result (corresponding to different output data of the same input data) may also require summation. That is, the second operation described above may simultaneously include multiple operations such as unsorting and summation.

[0090] Optionally, the first and second data can be obtained by splitting the weight matrix, and the first and second data include different contents of the weight matrix. That is, both the first and second data are submatrices of the weight matrix, and there is no overlap between the first and second data.

[0091] For example, please refer to Figure 5 , Figure 5 This is a schematic diagram illustrating the segmentation of target data provided in this application. For example... Figure 5As shown, when the input data is the left matrix in a grouped matrix multiplication and the target data (i.e., the weight matrix) is the right matrix in the same multiplication, the target data can be segmented column-wise to obtain the first and second data. Figure 5 In the example shown, the first data can be the first two columns of the target data, and the second data can be the third and fourth columns of the target data. Furthermore, the target data can also be divided into other data segments; for example, after the second data segment, the target data could be further divided into a third segment containing columns 5 and 6.

[0092] Please see Figure 6 , Figure 6 This is a schematic diagram illustrating the operation performed after segmenting the weight matrix, as provided in this application. Figure 6 As shown, after the execution device divides the weight matrix of the MoE model (corresponding to the target data mentioned above) into blocks, multiple matrix blocks (such as the first and second data mentioned above) can be obtained, each matrix block including a portion of the columns in the weight matrix. Therefore, when it is necessary to perform grouped matrix multiplication and de-sorting on the weight matrix sequentially, the first AI accelerator can perform grouped matrix multiplication and de-sorting on each matrix block in the order of the matrix blocks. For example, the first AI accelerator first performs grouped matrix multiplication on the i-th matrix block obtained by dividing the weight matrix, and then performs de-sorting on the i-th result (i.e., the result obtained after performing grouped matrix multiplication on the i-th matrix block). Furthermore, while the first AI accelerator performs de-sorting on the i-th result, the execution device preloads the (i+1)-th matrix block into the target cache. In this way, after the first AI accelerator completes de-sorting on the i-th result, it can quickly retrieve the (i+1)-th matrix block from the target cache and continue performing grouped matrix multiplication on the (i+1)-th matrix block. Similarly, while the first AI accelerator performs unordering on the (i+1)th operation result, the execution device preloads the (i+2)th matrix block into the target cache.

[0093] It should be noted that, Figure 5The example shown illustrates the process of partitioning target data column-wise to obtain multiple sub-matrices, each sub-matrix including a subset of columns from the target data. In some cases, where the target data serves as the left matrix of a grouped matrix multiplication, the first AI accelerator can partition the target data row-wise, ensuring that each of the resulting sub-matrices includes a subset of rows from the target data. Furthermore, in other cases, where the target data comprises both the left and right matrices of a grouped matrix multiplication, the first AI accelerator can simultaneously partition both the left and right matrices of the target data. In general, this application does not limit the method of partitioning the target data; the specific method can be determined based on the types of the first and second operations, as long as it ensures that partitioning the target data and then sequentially performing the first and second operations does not affect the final result.

[0094] The examples above illustrate that the first and second operations are grouped matrix multiplication and de-rearrangement under the MoE model, respectively. Of course, in other examples, the first and second operations can be other operations, as long as the input data for the second operation only includes the output of the first operation. For example, the first operation can be a matrix operation, and the second operation can be a quantization operation (e.g., converting the result of a matrix operation from 8-bit integer (int8) format to 16-bit floating-point number (float16) format), a dequantization operation, or an activation function operation (e.g., a softmax activation function operation). This application does not specifically limit the types of the first and second operations.

[0095] Optionally, in some scenarios, the execution device needs to combine with multiple AI accelerators to jointly complete model training or inference, thereby improving the efficiency of model training or inference. Therefore, the first AI accelerator often needs to cooperate with other AI accelerators to complete the model-based data processing. During the process where the first AI accelerator needs to communicate with other AI accelerators to cooperate in data processing, it can transmit the results of its operations on the segmented data to other AI accelerators, and simultaneously continue to perform operations on the next segmented data, thus achieving synchronous execution of computation and communication and improving overall data processing efficiency.

[0096] For example, after the first AI accelerator performs a second operation on the first operation result and obtains the second operation result, during the period when the first operation is performed on the second data by the first AI accelerator, the execution device simultaneously transmits a first portion of the second operation result to the second AI accelerator.

[0097] The second computation result is obtained by performing a second computation on the first computation result. The first and second AI accelerators are used to deploy different parts of the same AI model, and they cooperate to complete data processing based on the AI ​​model. For example, the first AI accelerator deploys part of the expert network in the MoE model, while the second AI accelerator deploys another part of the expert network in the MoE model. In this case, the first and second AI accelerators need to process the same input data and summarize the processing results of each AI accelerator to obtain the final output result. Of course, in some examples, the first AI accelerator may cooperate with other AI accelerators in addition to cooperating with the second AI accelerator to complete data processing. That is, the first AI accelerator may cooperate with one or more AI accelerators (the second AI accelerator is just one of them) to complete data processing based on the AI ​​model. In this case, the first AI accelerator needs to transmit the first part of the data from the second computation result to all other AI accelerators.

[0098] Furthermore, to reduce data communication overhead, the second computation result obtained by the first AI accelerator does not need to be transmitted entirely to the second AI accelerator. Instead, only a portion of the second computation result (i.e., the aforementioned first portion of data) is transmitted to the second AI accelerator, allowing the second AI accelerator to complete data aggregation processing based on the aforementioned first portion of data and its own portion of data. Finally, after all AI accelerators have completed the aggregation processing of a portion of the data, the aggregated data obtained by each AI accelerator is distributed and transmitted to the other AI accelerators, ensuring that each AI accelerator can obtain the aggregated processing result of all the data.

[0099] In other words, after the first AI accelerator completes the processing of the first data (i.e., executes the first and second operations), while the first AI accelerator continues to process the next data (i.e., the second data), the processing result of the first data is synchronously transmitted to other AI accelerators (i.e., the second AI accelerator), without having to complete the processing of the entire target data before transmitting the processing result. This allows the computation time to mask the communication time, thereby improving the overall data processing efficiency.

[0100] Optionally, in some examples, the time taken to transmit the first portion of the second computation result to the second AI accelerator is less than the total time taken to perform the first and second computations on the second data. In other words, for a single piece of data segmented from the target data, the time required for the first AI accelerator to process this data is actually greater than the time required to transmit the processed result to other AI accelerators. That is, in scenarios where communication and computation are parallel, the communication time is actually hidden within the computation time; the bottleneck for the first AI accelerator in processing the target data lies primarily in the process by which the first AI accelerator performs the first and second computations on each piece of data segmented from the target data.

[0101] In this way, by simultaneously preloading the next data while the first AI accelerator is processing one piece of data obtained from the segmentation of the target data, the processing time of each piece of data by the first AI accelerator can be effectively shortened, thereby improving the overall efficiency of the first AI accelerator in processing the target data.

[0102] For example, please refer to Figure 7 , Figure 7 This is a schematic diagram illustrating parallel computation and communication after data partitioning, as provided in this application. Figure 7 As shown, in Figure 6 Based on the example shown, the first AI accelerator can sequentially perform grouped matrix multiplication and de-rearrangement on each matrix block according to the order of the matrix blocks, and begin transmitting the de-rearrangement result after obtaining the de-rearrangement result for each matrix block. For example, the first AI accelerator first performs grouped matrix multiplication on the i-th matrix block obtained by partitioning based on the weight matrix, and then performs de-rearrangement on the i-th operation result. While performing de-rearrangement on the i-th operation result, the execution device preloads the (i+1)-th matrix block into the target cache used by the first AI accelerator. After performing de-rearrangement on the i-th operation result to obtain the i-th de-rearrangement result, the execution device begins transmitting the i-th de-rearrangement result (e.g., transmitting the i-th de-rearrangement result to the second AI accelerator). Furthermore, while transmitting a portion of the data in the i-th de-rearrangement result, the first AI accelerator continues to retrieve the (i+1)-th matrix block from the target cache and performs grouped matrix multiplication on the (i+1)-th matrix block.

[0103] It should be noted that during the process of the first AI accelerator transmitting data to other AI accelerators, the first AI accelerator will also continuously receive data transmitted by other AI accelerators (such as the unrearranged results generated by other AI accelerators). At this time, since other AI accelerators will also process the data by segmenting it and continuously transmit the unrearranged results corresponding to each data block to the first AI accelerator, the first AI accelerator can splice the communication results continuously received from other AI accelerators to obtain complete data.

[0104] Depend on Figure 7 As can be seen, the preloading of the (i+1)th matrix block is hidden within the process of reordering the result of the i-th operation, thereby maximizing the efficiency of the first AI accelerator in processing the (i+1)th matrix block without incurring additional time costs. The process of transmitting the result of the i-th reordering is hidden within the processing of the (i+1)th matrix block, allowing the communication and computation processes to be executed in parallel, thus shortening the overall data processing time.

[0105] Understandably, during the data processing process where the first AI accelerator and the second AI accelerator work together, the first AI accelerator often needs to obtain data from the second AI accelerator and then summarize and process the data it obtains from its own calculations as well as the data obtained from the second AI accelerator.

[0106] For example, during the processing of target data using the first AI accelerator, the execution device can receive the third calculation result transmitted by the second AI accelerator. Then, the execution device can store the third calculation result in a location adjacent to the second part of the data in the second calculation result. Next, after the first AI accelerator completes the processing of the target data, the execution device performs the target operation on the second part of the data and the third calculation result using the first AI accelerator. The target operation can be an operation set according to actual computational needs, such as a summation operation, a maximum value operation, a minimum value operation, or an average value operation, etc., and this application does not specifically limit it.

[0107] Specifically, regarding memory access, for two parts of data that need to be read, if these two parts of data are stored in non-contiguous locations, then the first AI accelerator needs to access these two parts of data twice (equivalent to generating two access requests to read these two parts of data), resulting in low memory access efficiency (the memory access time is the completion time of two access requests). However, if these two parts of data are stored in contiguous locations, then the first AI accelerator only needs to access memory once (i.e., read these two parts of data based on one access request) to complete the reading of these two parts of data, thereby significantly improving the memory access efficiency of the first AI accelerator.

[0108] Based on this, regarding the second operation result corresponding to the first data, the first part of the data in the second operation result needs to be transmitted from the first AI accelerator to the second AI accelerator, and then aggregated by the second AI accelerator. The second part of the data in the second operation result needs to be aggregated by the first AI accelerator in conjunction with the third operation result obtained from the second AI accelerator. Thus, by storing the received third operation result adjacent to the second part of the data in the second operation result, the third operation result that the first AI accelerator needs to read and the second part of the data in the second operation result can be stored on contiguous storage addresses. This allows the first AI accelerator to read both the third operation result and the second part of the data in the second operation result at once, thereby improving the efficiency of the first AI accelerator in accessing the third operation result and the second part of the data in the second operation result. In other words, it improves the memory access efficiency of the first AI accelerator when aggregating and processing its own data and the data obtained through communication, ultimately improving the overall data processing efficiency.

[0109] Optionally, to ensure that the third computation result obtained from the second AI accelerator can be stored in an adjacent location to the second part of the computation result, after obtaining the second computation result, the first AI accelerator may move the first part of the data from the first AI accelerator to a first location in memory, and move the second part of the data from the first AI accelerator to a second location in memory. The first and second locations are not adjacent in memory.

[0110] Specifically, after the first AI accelerator performs the second operation, the result of the second operation is often stored as a whole within the first AI accelerator. Due to insufficient storage space within the first AI accelerator, the second operation result often needs to be migrated to external memory for storage. Considering that the second part of the second operation result needs to be combined with the data received from the second AI accelerator (i.e., the aforementioned third operation result) for further processing, the first AI accelerator can pre-plan the storage location of each part of the second operation result when migrating it to memory. This allows the first part of the second operation result (the data to be transferred to the second AI accelerator) and the second part (the data to be combined with the data obtained from the second AI accelerator for further processing) to be stored in different locations, thus reserving storage space in advance for the data received from the second AI accelerator.

[0111] Optionally, the third computation result received from the second AI accelerator can be stored in a third memory location, with the third location situated between the first and second locations. Specifically, the first AI accelerator essentially reserves the third location between the first and second locations in advance, ensuring that the first and second parts of the data in the second computation result are not stored contiguously. This guarantees that the second part of the data in the second computation result can be stored contiguously in consecutive memory addresses with the subsequently received third computation result.

[0112] For example, please refer to Figure 8 , Figure 8 A comparative diagram illustrating one method for storing computation results provided in this application. For example... Figure 8 As shown in (a), when the result of the second operation is a matrix, the first and second parts of the result can each be a submatrix of the matrix. For example, the first and second parts of the result can each include a subset of rows in the matrix. In traditional storage methods, each row of data in the result of the second operation is stored contiguously, causing the first and second parts of the data to be stored at contiguous memory addresses. This can easily lead to the third result being stored at non-contiguous memory addresses compared to the second part of the data. Figure 8 As shown in (b) of the present solution, by reserving a free storage location for the third operation result in advance (for example, by requesting a large storage space in advance when moving the second operation result to memory), the storage location is located between the first part of the data and the second part of the data in the second operation result, and the storage location is continuous with the storage location of the second part of the data. This ensures that the third operation result received later can be stored in the reserved storage location, thereby ensuring that the third operation result and the second part of the data are stored in a continuous location in memory.

[0113] Please see Figure 9 , Figure 9 This illustration shows how to store the unrearrangement results in memory within a MoE model scenario, as provided in this application. Figure 9As shown, assume that the first AI accelerator and the second AI accelerator each deploy a portion of the expert networks in the MoE model (for example, the first AI accelerator deploys expert networks 1-3, and the second AI accelerator deploys expert networks 4-6), and the first AI accelerator and the second AI accelerator cooperate to complete the inference of the MoE model. At this time, after the first AI accelerator performs the first and second operations on the segmented first data, it obtains the inverse rearrangement result of the first AI accelerator (i.e., the second operation result mentioned above). Furthermore, the inverse rearrangement result of the first AI accelerator includes two parts of data: one part is the data obtained by the first AI accelerator after processing input data 1 based on expert networks 1-3 (corresponding to the first part of data mentioned above), and the other part is the data obtained by the first AI accelerator after processing input data 2 based on expert networks 1-3 (corresponding to the second part of data mentioned above).

[0114] Similarly, the reverse rearrangement result of the second AI accelerator after processing input data 1 and input data 2 also includes two parts of data. One part of the data is the data obtained by the second AI accelerator after processing input data 1 based on expert networks 4-6 respectively (corresponding to the third operation result mentioned above), and the other part of the data is the data obtained by the second AI accelerator after processing input data 2 based on expert networks 4-6 respectively.

[0115] In this scenario, the first AI accelerator can divide its de-rearrangement result into two parts of data, storing these two parts in different memory locations, thus reserving storage space for data to be received from the second AI accelerator. Specifically, the first AI accelerator can store the data obtained after processing input data 1 using expert networks 1-3 in memory location 1, and store the data obtained after processing input data 2 using expert networks 1-3 in memory location 2, with a spare location 3 reserved between locations 1 and 2. Then, the data obtained from processing input data 1 using expert networks 4-6, received from the second AI accelerator, can be stored in location 3. In this way, when performing data aggregation processing, the first AI accelerator can read the data processed by expert networks 1-6 corresponding to input data 1 from consecutive locations in memory, achieving continuous memory access and improving data processing efficiency.

[0116] Similarly, when the second AI accelerator moves the de-rearrangement result it has processed to memory, it can also store the two parts of the de-rearrangement result in different locations in memory, so that the data received by the second AI accelerator from the first AI accelerator can be stored in a contiguous location with the part of the data that needs to be aggregated.

[0117] The method provided in this application has been described in detail above. Next, the device provided in this application for performing the above method will be described.

[0118] Please see Figure 10 , Figure 10 This is a schematic diagram of the structure of a data processing device provided in this application. Figure 10 As shown, the data processing device includes: a data processing module 1001, used to input first data into a first artificial intelligence (AI) accelerator, and perform a first operation on the first data through the first AI accelerator to obtain a first operation result stored in the first AI accelerator, wherein the first data is obtained by segmenting target data, and the target data is the data to be processed by the first AI accelerator; a data loading module 1002, used to load second data into a target cache during the second operation performed by the first AI accelerator on the first operation result, wherein the target cache is a cache used by the first AI accelerator, and the second data is obtained by segmenting the target data; the data processing module 1001 is also used to input the second data from the target cache into the first AI accelerator after the first AI accelerator has completed the second operation on the first operation result, and perform the first operation on the second data through the first AI accelerator.

[0119] In one possible implementation, the input data for the second operation includes only the result of the first operation.

[0120] In one possible implementation, the target data includes the weight matrix of the MoE model, the first operation includes grouped matrix multiplication, and the second operation includes unordering, which is used to reorder the data in the result of the first operation.

[0121] In one possible implementation, the first data and the second data are obtained by splitting the weight matrix, and the first data and the second data include different contents in the weight matrix.

[0122] In one possible implementation, the data processing device further includes: a communication module 1003, used to transmit a first portion of the second operation result to a second AI accelerator during the first operation performed on the second data by the first AI accelerator; wherein the second operation result is obtained after performing a second operation on the first operation result, the first AI accelerator and the second AI accelerator are used to deploy different parts of the same AI model, and the first AI accelerator and the second AI accelerator are used to cooperate to complete data processing based on the AI ​​model.

[0123] In one possible implementation, the communication module 1003 is further configured to receive the third computation result transmitted by the second AI accelerator; the data processing module 1001 is further configured to store the third computation result in a position adjacent to the second part of the data in the second computation result; and the data processing module 1001 is further configured to perform a target operation on the second part of the data and the third computation result through the first AI accelerator.

[0124] In one possible implementation, after obtaining the second calculation result, the data processing module 1001 is further configured to: move the first part of the data from the first AI accelerator to a first location in memory, and move the second part of the data from the first AI accelerator to a second location in memory; wherein the first location and the second location are not adjacent in memory.

[0125] In one possible implementation, the result of the third operation is stored in a third location in memory, and the third location is located between the first and second locations.

[0126] In one possible implementation, the time taken to transmit the first portion of the data to the second AI accelerator is less than the total time taken to perform the first and second operations on the second data.

[0127] In one possible implementation, the data loading module 1002 is specifically used to load the second data from the memory used by the first AI accelerator into the target cache; wherein the memory read speed is lower than the target cache read speed, and the memory is used to store the target data.

[0128] Please see Figure 11 , Figure 11 This is a schematic diagram of the structure of a computing device provided in this application. Figure 11 The computing device 1100 shown can be used to execute the data processing method based on data preloading provided in this embodiment. For example... Figure 11As shown, computing device 1100 includes: bus 1102, processor 1104, AI accelerator 1105, memory 1106, and communication interface 1108. Processor 1104, memory 1106, and communication interface 1108 communicate with each other via bus 1102. Computing device 1100 can be a server or a terminal device. It should be understood that this application does not limit the number of processors, AI accelerators, and memories in computing device 1100.

[0129] Bus 1102 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, Figure 11 The bus 1102 may be represented by a single line, but this does not mean that there is only one bus or one type of bus. The bus 1102 may include a path for transmitting information between various components of the computing device 1100 (e.g., memory 1106, processor 1104, communication interface 1108).

[0130] The processor 1104 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0131] The memory 1106 may include volatile memory, such as random access memory (RAM). The processor 1104 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).

[0132] The memory 1106 stores executable program code, which the AI ​​accelerator 1105 executes to implement the aforementioned data processing method based on data preloading. That is, the memory 1106 stores instructions for executing the data processing method based on data preloading.

[0133] The communication interface 1108 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 1100 and other devices or communication networks.

[0134] This application also provides a chip system comprising a processing unit and a communication unit. The processing unit may be, for example, an AI accelerator, and the communication unit may be, for example, an input / output interface, pins, or circuits. The processing unit can execute computer execution instructions stored in a storage unit to cause the chip system to perform the methods described in the above embodiments. Optionally, the storage unit may be an in-chip storage unit, such as a register or cache. Alternatively, the storage unit may be an external storage unit located within a wireless access device, such as a read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, such as random access memory (RAM).

[0135] Please refer to Figure 12 , Figure 12 This is a schematic diagram of a computer-readable storage medium provided in this application. This application also provides a computer-readable storage medium in some embodiments, wherein the above-described... Figure 2 The disclosed method can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of art.

[0136] Figure 12 A conceptual partial view of an example computer-readable storage medium arranged according to at least some of the embodiments shown herein is illustrated schematically. The example computer-readable storage medium includes a computer program for executing computer processes on a computing device.

[0137] In one embodiment, the computer-readable storage medium 1200 is provided using a signal bearer medium 1201. The signal bearer medium 1201 may include one or more program instructions 1202, which, when executed by one or more processors, can provide the above-mentioned... Figure 2 The described function or part of the function.

[0138] In some examples, signal carrying medium 1201 may include computer-readable medium 1203, such as, but not limited to, hard disk drive, compact disc (CD), digital video disc (DVD), digital magnetic tape, memory, ROM or RAM, etc.

[0139] In some embodiments, the signal-bearing medium 1201 may comprise a computer-recordable medium 1204, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, etc. In some embodiments, the signal-bearing medium 1201 may comprise a communication medium 1205, such as, but not limited to, digital and / or analog communication media (e.g., fiber optic cables, waveguides, wired communication links, wireless communication links, etc.). Therefore, for example, the signal-bearing medium 1201 may be transmitted by a wireless communication medium 1205 (e.g., a wireless communication medium conforming to the IEEE 1102.X standard or other transmission protocols).

[0140] One or more program instructions 1202 may be, for example, computer-executable instructions or logical implementation instructions. In some examples, the computing device may be configured to provide various operations, functions, or actions in response to one or more program instructions 1202 conveyed to the computing device via a computer-readable medium 1203, a computer-recordable medium 1204, and / or a communication medium 1205.

[0141] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the accompanying drawings of the device embodiments provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.

[0142] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods of the various embodiments of this application.

[0143] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.

[0144] A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, computer instructions can be transferred from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).

Claims

1. A data processing method based on data preloading, characterized in that, The method includes: First data is input into a first artificial intelligence (AI) accelerator, and a first operation is performed on the first data by the first AI accelerator to obtain a first operation result stored in the first AI accelerator. The first data is obtained by segmenting the target data, and the target data is the data that the first AI accelerator needs to process. During the second operation performed by the first AI accelerator on the first operation result, the second data is loaded into the target cache, which is the cache used by the first AI accelerator, and the second data is obtained by splitting the target data; After the first AI accelerator completes the second operation on the first operation result, the second data is input from the target cache into the first AI accelerator, and the first operation is performed on the second data by the first AI accelerator.

2. The method according to claim 1, characterized in that, The input data for the second operation includes only the result of the first operation.

3. The method according to claim 2, characterized in that, The target data includes the weight matrix of the hybrid expert MoE model. The first operation includes grouped matrix multiplication, and the second operation includes inverse rearrangement, which is used to reorder the data in the result of the first operation.

4. The method according to claim 3, characterized in that, The first data and the second data are obtained by splitting the weight matrix, and the first data and the second data include different contents in the weight matrix.

5. The method according to any one of claims 1-4, characterized in that, The method further includes: During the execution of the first operation on the second data through the first AI accelerator, a first portion of the second operation result is transmitted to the second AI accelerator; The second calculation result is obtained by performing the second calculation on the first calculation result. The first AI accelerator and the second AI accelerator are used to deploy different parts of the same AI model, and the first AI accelerator and the second AI accelerator are used to cooperate to complete data processing based on the AI ​​model.

6. The method according to claim 5, characterized in that, The method further includes: Receive the third calculation result transmitted by the second AI accelerator; The third calculation result is stored in a position adjacent to the second part of the data in the second calculation result; The first AI accelerator performs the target operation on the second part of the data and the third calculation result.

7. The method according to claim 6, characterized in that, After obtaining the second calculation result, the method further includes: The first portion of data is moved from the first AI accelerator to a first location in memory, and the second portion of data is moved from the first AI accelerator to a second location in memory; The first position and the second position are not adjacent in the memory.

8. The method according to claim 7, characterized in that, The third operation result is stored in a third location in the memory, and the third location is located between the first location and the second location.

9. The method according to any one of claims 5-8, characterized in that, The time taken to transmit the first portion of data to the second AI accelerator is less than the total time taken to perform the first and second operations on the second data.

10. The method according to any one of claims 1-9, characterized in that, The step of loading the second data into the target cache includes: The second data is loaded from the memory used by the first AI accelerator into the target cache; The memory has a lower read speed than the target cache, and the memory is used to store the target data.

11. A data processing apparatus, characterized in that, The device includes: The data processing module is used to input the first data into the first artificial intelligence (AI) accelerator, and perform a first operation on the first data through the first AI accelerator to obtain a first operation result stored in the first AI accelerator, wherein the first data is obtained by segmenting the target data, and the target data is the data that the first AI accelerator needs to process. The data loading module is used to load second data into a target cache during the second operation performed by the first AI accelerator on the first operation result. The target cache is a cache used by the first AI accelerator, and the second data is obtained by splitting the target data. The data processing module is further configured to, after the first AI accelerator has completed the second operation on the first operation result, input the second data from the target cache into the first AI accelerator, and perform the first operation on the second data through the first AI accelerator.

12. The apparatus according to claim 11, characterized in that, The input data for the second operation includes only the result of the first operation.

13. The apparatus according to claim 12, characterized in that, The target data includes the weight matrix of the MoE model. The first operation includes grouped matrix multiplication, and the second operation includes unordering, which is used to reorder the data in the result of the first operation.

14. The apparatus according to claim 13, characterized in that, The first data and the second data are obtained by splitting the weight matrix, and the first data and the second data include different contents in the weight matrix.

15. The apparatus according to any one of claims 11-14, characterized in that, The device further includes: A communication module is used to transmit a first portion of the second operation result to a second AI accelerator during the execution of the first operation on the second data via the first AI accelerator. The second calculation result is obtained by performing the second calculation on the first calculation result. The first AI accelerator and the second AI accelerator are used to deploy different parts of the same AI model, and the first AI accelerator and the second AI accelerator are used to cooperate to complete data processing based on the AI ​​model.

16. The apparatus according to claim 15, characterized in that, The communication module is also used to receive the third calculation result transmitted by the second AI accelerator; The data processing module is further configured to store the third calculation result in a position adjacent to the second part of the data in the second calculation result; The data processing module is further configured to perform target operations on the second part of the data and the third calculation result through the first AI accelerator.

17. The apparatus according to claim 16, characterized in that, After obtaining the second calculation result, the data processing module is further configured to: The first portion of data is moved from the first AI accelerator to a first location in memory, and the second portion of data is moved from the first AI accelerator to a second location in memory; The first position and the second position are not adjacent in the memory.

18. The apparatus according to claim 17, characterized in that, The third operation result is stored in a third location in the memory, and the third location is located between the first location and the second location.

19. The apparatus according to any one of claims 15-18, characterized in that, The time taken to transmit the first portion of data to the second AI accelerator is less than the total time taken to perform the first and second operations on the second data.

20. The apparatus according to any one of claims 11-19, characterized in that, The data loading module is specifically used to load the second data from the memory used by the first AI accelerator into the target cache; The memory has a lower read speed than the target cache, and the memory is used to store the target data.

21. A chip system, characterized in that, The chip system includes an AI accelerator; the AI ​​accelerator is used to implement the method as described in any one of claims 1 to 10.

22. A computing device, characterized in that, The device includes a memory, an AI accelerator, and a target cache; the memory stores code, the AI ​​accelerator is configured to execute the code, and when the code is executed, the computing device performs the method as described in any one of claims 1 to 10.

23. A computer storage medium, characterized in that, The computer storage medium stores instructions that, when executed by the computer, cause the computer to perform the method according to any one of claims 1 to 10.

24. A computer program product, characterized in that, The computer program product stores instructions that, when executed by a computer, cause the computer to perform the method described in any one of claims 1 to 10.