Data processing system and method, and related device

By converting the scalar feature values ​​of graph data into vector data and performing graph nearest neighbor aggregation operations on the accelerator, the problem of low utilization of accelerator vector computing power is solved, achieving efficient graph nearest neighbor aggregation computation and expanding the hardware running scenarios of AI models.

WO2026081446A1PCT designated stage Publication Date: 2026-04-23HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2025-04-18
Publication Date
2026-04-23

AI Technical Summary

Technical Problem

In existing technologies, when graph nearest neighbor aggregation operations are performed on accelerators, the utilization rate of vector computing power is low, resulting in a waste of accelerator resources. This is especially true when using CPUs or accelerators for sparse computation, where the computational efficiency is low.

Method used

By converting the scalar feature values ​​of graph data into vector data and performing graph nearest neighbor aggregation operations on an accelerator, vector computation can be achieved by utilizing the vector computing power of the accelerator, such as the NPU, thereby improving the utilization rate of computing power.

Benefits of technology

It improves the computing power utilization of the accelerator, reduces data transmission between the processor and the accelerator, reduces the computing power consumption of the processor, and expands the hardware operation scenarios of AI models on the accelerator.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025089748_23042026_PF_FP_ABST
    Figure CN2025089748_23042026_PF_FP_ABST
Patent Text Reader

Abstract

A data processing system and method, and a related device, which relate to the technical field of artificial intelligence. The data processing system comprises a processor and an accelerator, wherein the processor is used for acquiring graph data, and sending, to the accelerator, feature values of a plurality of edges in the graph data, the feature values of the plurality of edges being scalar data; and the accelerator is used for converting the feature values of the plurality of edges into vector data, so as to obtain a plurality of feature value vectors. Moreover, the accelerator further performs computation on the plurality of feature value vectors on the basis of computation logic corresponding to a graph neighbor aggregation operation, so as to obtain a computation result corresponding to the graph neighbor aggregation operation. Thus, the accelerator converts the feature values of the plurality of edges into feature value vectors, and performs computation on the plurality of feature value vectors to obtain the computation result corresponding to the graph neighbor aggregation operation, such that scalar computation corresponding to the graph neighbor aggregation operation can be converted into vector computation, and thus vector computing power on the accelerator can be fully used, thereby increasing the utilization rate of the computing power of the accelerator.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing systems, methods and related equipment

[0001] This application claims priority to Chinese Patent Application No. 202411451408.0, filed on October 16, 2024, entitled “Data Processing System, Method and Related Equipment”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This application relates to the field of artificial intelligence technology, and in particular to a data processing system, method and related equipment. Background Technology

[0003] With the development of artificial intelligence (AI) technology, AI models are widely used in fields such as social networks, recommender systems, and bioinformatics. For example, an AI model can be a graph neural network (GNN) model, specifically a neural network model for processing graph data. This graph data includes multiple nodes, multiple directed edges connecting these nodes, and feature values ​​for each directed edge. In practical applications, the GNN model can learn and infer the relevant attributes of nodes based on the relationships between nodes in the graph data (including edge directions and feature values). For instance, in a product recommendation scenario, the GNN model can analyze the interaction relationships between users (nodes) and products (nodes) indicated by the graph data, and recommend products to users, such as recommending similar products to those previously purchased.

[0004] During the training or inference of AI models, graph neighbor aggregation (GNA) is typically performed. This aims to update the representation of a target node by aggregating information from its neighbors to capture complex dependencies in graph data. Essentially, GNA is a sparse computation operation, meaning the number of non-zero elements in the dataset is relatively small. In training GNN models, GNA is a core computational operation, accounting for up to 70% or more of the total computation.

[0005] Currently, the computing power on CPUs or accelerators used for scalar computation (or sparse computation) is typically used to perform graph nearest neighbor aggregation operations in AI models. This results in the vector computing power on accelerators remaining idle for extended periods when running AI models on accelerators with significant vector computing power, leading to low accelerator utilization. Vector computing power refers to the computing power on an accelerator used to perform vector computation operations. Summary of the Invention

[0006] This application provides a data processing system that improves the utilization of vector computing power on an accelerator while performing graph nearest neighbor aggregation operations. Furthermore, this application also provides a corresponding data processing method, a computer-readable storage medium, and a computer program product.

[0007] Firstly, this application provides a data processing system comprising a processor (such as a CPU) and an accelerator (such as an NPU). The processor acquires graph data, which includes feature values ​​of multiple edges, such as feature values ​​of directed edges connecting multiple nodes. These feature values ​​are scalar data, where each edge's feature value can be a numerical value. In practical applications, the graph data may include a graph topology and the feature values ​​of directed edges within that topology, or feature values ​​in CSR (Compressed Sparse Lines) format. The processor also sends the feature values ​​of the multiple edges to the accelerator. The accelerator converts the feature values ​​of each edge received from the multiple edges into vector data, resulting in multiple feature value vectors. Each of these feature value vectors can be obtained by converting the feature value of one edge from the multiple edges. Furthermore, the accelerator performs calculations on the multiple feature value vectors according to the computational logic corresponding to the graph nearest neighbor aggregation operation, obtaining a first calculation result corresponding to the graph nearest neighbor aggregation operation.

[0008] Thus, for the required graph nearest neighbor aggregation operation, the accelerator transforms the feature values ​​of multiple edges in the graph data into feature value vectors, and performs corresponding calculations on multiple feature value vectors according to the computational logic of the graph nearest neighbor aggregation operation to obtain the calculation result corresponding to the required graph nearest neighbor aggregation operation. This enables the accelerator to transform the computation required by the accelerator from scalar computation corresponding to the graph nearest neighbor aggregation operation into vector computation, thereby making full use of the vector computing power on the accelerator and improving the accelerator's computing power utilization. Furthermore, for accelerators such as NPUs that include a large amount of vector computing power, when running AI (artificial intelligence) models on the accelerator, by transforming the graph nearest neighbor aggregation operation in the AI ​​model into a vector computation process, the AI ​​model can run efficiently on the NPU (and other types of accelerators), thereby helping to expand the hardware running scenarios of AI models and build the hardware ecosystem of NPUs. For example, the AI ​​model can be a GNN (graph neural network) model, or it can be other models.

[0009] In one possible implementation, when the accelerator converts the feature values ​​of multiple edges into vector data, it can specifically expand the feature value of each of the received edges to obtain multiple feature value vectors. For example, the feature value 7 can be expanded into the feature vector [7,7,7,7,7,7,7,7,7], etc. Each of these multiple feature value vectors is obtained by expanding the feature value of one edge from the multiple edges. In this way, by expanding the feature values ​​of scalar data into vectors, the accelerator can convert the scalar calculations corresponding to the graph nearest neighbor aggregation operation into vector calculations, thereby making full use of the vector computing power on the accelerator and improving the accelerator's computing power utilization rate.

[0010] In one possible implementation, an eigenvector contains identical elements, and the number of elements in each eigenvector is consistent with the number of elements in the vectors that the accelerator supports processing. Thus, when the accelerator performs vector computation, the number of elements in the processed vectors does not exceed the number of elements in the vectors that the accelerator supports processing. This ensures that the accelerator can successfully execute the vector computation process and improves the stability of the accelerator's graph nearest neighbor aggregation operation.

[0011] In one possible implementation, the processor is further configured to send positional information of the eigenvalues ​​of multiple edges to the accelerator. This positional information describes the positions of the eigenvalues ​​of the multiple edges within the sparse matrix corresponding to the graph data. In this case, when the accelerator calculates multiple eigenvalue vectors, it can specifically calculate the multiple eigenvalue vectors based on the computational logic corresponding to the graph nearest neighbor aggregation operation and the positional information of the eigenvalues ​​of the multiple edges. Thus, the accelerator can combine the positional information of the eigenvalues ​​to achieve correct calculation of the eigenvalue vectors, thereby improving the stability of the accelerator in performing the graph nearest neighbor aggregation operation.

[0012] In one possible implementation, when performing vector computation, the accelerator may first calculate the eigenvalue vector of each edge in the multiple edges by combining it with the first target vector at the corresponding position in the first target matrix, based on the computation logic corresponding to the graph nearest neighbor aggregation operation and the position information. This yields the first vector calculation result for each edge. The first target matrix indicates the features of the multiple nodes connected by the multiple edges; for example, a row of values ​​in the first target matrix can represent the values ​​of each node in multiple dimensions. Then, the accelerator calculates the first calculation result corresponding to the graph nearest neighbor aggregation operation based on the first vector calculation result for each edge. In this way, by calculating the target vector formed by each eigenvalue vector and the corresponding element in the first target matrix, the accelerator can calculate the calculation result corresponding to the graph nearest neighbor aggregation operation and improve the utilization rate of vector computing power by utilizing the vector computing power on the accelerator.

[0013] In one possible implementation, the accelerator runs an AI model, such as a GNN model, which includes a first network layer and a second network layer. A first target matrix indicates the features of multiple nodes connected by multiple edges in the first network layer. For example, the values ​​of the elements in the first target matrix can be the values ​​of parameters in the first network layer. Correspondingly, the first calculation result corresponding to the graph nearest neighbor aggregation operation can be the calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer. The accelerator is further configured to perform vector calculations on the eigenvalue vectors of the feature values ​​of each edge in the multiple edges and the second target vectors at corresponding positions in the second target matrix, based on the calculation logic and position information corresponding to the graph nearest neighbor aggregation operation, to obtain the second vector calculation result corresponding to each edge. This second target matrix indicates the features of multiple nodes connected by multiple edges in the second network layer. For example, a row of values ​​in the second target matrix can be the values ​​of multiple dimensions of each node in the second network layer. Furthermore, the accelerator is also configured to calculate the second calculation result corresponding to the graph nearest neighbor aggregation operation in the second network layer based on the second vector calculation result corresponding to each edge. Thus, when the AI ​​model needs to perform graph nearest neighbor aggregation operations in multiple network layers during operation, the processor only needs to send the feature value and position to the accelerator once. This effectively avoids frequent data transfers between the processor and the accelerator, reducing bandwidth consumption. Furthermore, the processor only needs to process the graph data once, which also effectively reduces the processor's computational power consumption.

[0014] In one possible implementation, the second target matrix is ​​the first calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer.

[0015] In one possible implementation, when the accelerator obtains multiple feature value vectors, it can first generate multiple tasks, each of which includes feature values ​​of some edges from multiple edges and the positional information of those feature values. Furthermore, the accelerator converts the feature values ​​of the edges included in each task into vector data, obtaining at least one feature value vector corresponding to each task. Accordingly, when performing vector computation, the accelerator can calculate the at least one feature value vector corresponding to each task based on the computation logic corresponding to the graph nearest neighbor aggregation operation and the positional information of the feature values ​​included in each task, obtaining the first computation result corresponding to the graph nearest neighbor aggregation operation. Thus, by dividing multiple feature values ​​into tasks, the computational power required by the accelerator to perform vector computation for each task does not exceed the available computational power provided by the accelerator, thereby ensuring the normal execution of vector computation. Alternatively, if the accelerator has sufficient vector computational power, by dividing multiple feature values ​​into tasks, the accelerator can execute these multiple tasks in parallel, thereby improving the efficiency of subsequent vector computation based on the multiple feature values ​​and the position of each feature value.

[0016] In one possible implementation, when the accelerator generates multiple tasks, it can do so based on task identifiers corresponding to the tasks. The task identifiers indicate the feature values ​​and location information included in each task. Correspondingly, the processor is also configured to add task identifiers to the feature values ​​and location information of multiple edges and send these task identifiers to the accelerator. In this way, the accelerator can generate multiple tasks based on the task identifiers added by the processor, so that corresponding vector calculations can be performed on each task subsequently.

[0017] In one possible implementation, when adding task identifiers, the processor may specifically add task identifiers to the feature values ​​of multiple edges and their positional information based on the accelerator's available computing power. In this way, by dividing multiple feature values ​​into tasks, the processor can ensure that the computing power required by the accelerator to perform vector computation for each task does not exceed the available computing power provided by the accelerator, thereby guaranteeing the normal execution of vector computation.

[0018] In one possible implementation, when the processor sends data to the accelerator, it may specifically send to the accelerator a task identifier, an array of index pointers, an index array, and a data array corresponding to each of the multiple tasks. Elements in the index pointer array indicate the rows of feature values ​​in a task within the sparse matrix, elements in the index array indicate the columns of feature values ​​in a task within the sparse matrix, and the elements in the data array represent the feature values ​​included in a task. Optionally, the format of the data sent by the processor may be GAP (Graph-Aware Packaging) format.

[0019] In one possible implementation, the accelerator is an NPU (Neural Processing Unit). This allows AI models to run efficiently on the NPU and perform graph nearest neighbor aggregation operations, which helps expand the hardware operating scenarios for AI models and build a hardware ecosystem for the NPU.

[0020] Secondly, this application provides a data processing system, including a processor and an accelerator. The processor is used to acquire graph data, which includes feature values ​​of multiple edges connecting multiple nodes, where the feature values ​​are scalar data. Furthermore, the processor is also used to send to the accelerator a task identifier corresponding to each of the multiple tasks, the feature values ​​included in each task, and the position information of the feature values ​​included in each task. This position information indicates the position of the feature values ​​in the sparse matrix corresponding to the image data, such as the row and column numbers of the feature values ​​in the sparse matrix. The accelerator is used to calculate the calculation result corresponding to the graph nearest neighbor aggregation operation based on the task identifier corresponding to each task, the feature values ​​included in each task, and the position information of the feature values ​​included in each task.

[0021] Thus, for the required graph nearest neighbor aggregation operation, the processor pre-divides the tasks and provides the data for each task to the accelerator. This allows the accelerator to execute multiple tasks in parallel, thereby improving task execution efficiency, and consequently, improving the accelerator's efficiency in performing graph nearest neighbor aggregation operations. Alternatively, the accelerator can execute each task sequentially based on its available computing power, thus avoiding exceeding the accelerator's available computing power and improving the stability of the accelerator's graph nearest neighbor aggregation operation.

[0022] In one possible implementation, when the processor sends data to the accelerator, it may specifically send to the accelerator a task identifier, an index pointer array, an index array, and a data array corresponding to each of the multiple tasks. The elements in the index pointer array are used to indicate the rows of the feature values ​​included in a task in the sparse matrix, the elements in the index array are used to indicate the columns of the feature values ​​included in a task in the sparse matrix, and the elements in the data array are the feature values ​​included in a task.

[0023] In one possible implementation, when performing vector computation, the accelerator may first generate multiple tasks based on the task identifier, index pointer array, index array, and data array corresponding to each task. Each task includes the eigenvalues ​​of some edges from multiple edges, the rows of the eigenvalues ​​in the sparse matrix corresponding to the graph data, and the columns of the eigenvalues ​​in the sparse matrix. The accelerator then executes these multiple tasks to obtain the computation results corresponding to the graph nearest neighbor aggregation operation. In this way, the accelerator can convert the scalar computation corresponding to the graph nearest neighbor aggregation operation into vector computation, thereby fully utilizing the vector computing power on the accelerator and improving its computational efficiency.

[0024] In one possible implementation, when performing vector computation, the accelerator may first convert the feature values ​​of the edges included in each of the multiple tasks into vector data, obtaining a feature value vector corresponding to each task. Furthermore, the accelerator is used to calculate the feature value vector corresponding to each task based on the rows and columns of the feature values ​​included in each task in the sparse matrix, obtaining the computation result corresponding to the graph nearest neighbor aggregation operation. In this way, the accelerator performs vector transformation based on the feature values ​​and performs corresponding calculations based on the transformed vectors, which can improve the utilization rate of vector computing power on the accelerator.

[0025] Thirdly, this application provides a data processing system comprising a processor and an accelerator. The processor acquires graph data and sends the graph data to the accelerator. The graph data includes feature values ​​of multiple edges; for example, the graph data may include a graph topology and feature values ​​of the edges within that topology. The feature values ​​of the multiple edges are scalar data. The accelerator determines the feature values ​​of the multiple edges based on the received graph data and converts the feature value of each edge into vector data, obtaining multiple feature value vectors. Each feature value vector can be obtained by converting the feature value of one edge among the multiple edges. Furthermore, the accelerator performs vector computation on the multiple feature value vectors according to the computational logic corresponding to the graph nearest neighbor aggregation operation, obtaining a first computational result corresponding to the graph nearest neighbor aggregation operation.

[0026] Thus, for the required graph nearest neighbor aggregation operation, the accelerator converts the feature values ​​of multiple edges into feature vectors and performs corresponding calculations on these feature vectors according to the computational logic of the graph nearest neighbor aggregation operation to obtain the computational result corresponding to the required graph nearest neighbor aggregation operation. This enables the accelerator to convert the scalar computation corresponding to the graph nearest neighbor aggregation operation into vector computation, thereby fully utilizing the vector computing power on the accelerator and improving its computing power utilization rate. Furthermore, for accelerators such as NPUs that include a large amount of vector computing power, when running AI (artificial intelligence) models on these accelerators, by converting the graph nearest neighbor aggregation operation in the AI ​​model into a vector computation process, the AI ​​model can run efficiently on the NPU (and other types of accelerators), thereby helping to expand the hardware running scenarios of AI models and build the hardware ecosystem of NPUs.

[0027] In one possible implementation, when the accelerator converts the feature values ​​of multiple edges into vector data, it can specifically expand the feature value of each of the received edges to obtain multiple feature value vectors. Each of these multiple feature value vectors is obtained by expanding the feature value of one edge from the multiple edges. In this way, by expanding the feature values ​​of scalar data into vectors, the accelerator can convert the scalar computation corresponding to the graph nearest neighbor aggregation operation into vector computation, thereby making full use of the vector computing power on the accelerator and improving the accelerator's computing power utilization rate.

[0028] In one possible implementation, an eigenvector contains identical elements, and the number of elements in each eigenvector is consistent with the number of elements in the vectors that the accelerator supports processing. Thus, when the accelerator performs vector computation, the number of elements in the processed vectors does not exceed the number of elements in the vectors that the accelerator supports processing. This ensures that the accelerator can successfully execute the vector computation process and improves the stability of the accelerator's graph nearest neighbor aggregation operation.

[0029] In one possible implementation, the processor is further configured to send positional information of the eigenvalues ​​of multiple edges to the accelerator. This positional information describes the positions of the eigenvalues ​​of the multiple edges within the sparse matrix corresponding to the graph data. In this case, when the accelerator calculates multiple eigenvalue vectors, it can specifically calculate the multiple eigenvalue vectors based on the computational logic corresponding to the graph nearest neighbor aggregation operation and the positional information of the eigenvalues ​​of the multiple edges. Thus, the accelerator can combine the positional information of the eigenvalues ​​to achieve correct calculation of the eigenvalue vectors, thereby improving the stability of the accelerator in performing the graph nearest neighbor aggregation operation.

[0030] In one possible implementation, when performing vector computation, the accelerator may first calculate the eigenvalue vector of each edge in the multiple edges by combining it with the first target vector at the corresponding position in the first target matrix, based on the computation logic corresponding to the graph nearest neighbor aggregation operation and the position information. This yields the first vector calculation result for each edge. The first target matrix indicates the features of the multiple nodes connected by the multiple edges; for example, a row of values ​​in the first target matrix can represent the values ​​of each node in multiple dimensions. Then, the accelerator calculates the first calculation result corresponding to the graph nearest neighbor aggregation operation based on the first vector calculation result for each edge. In this way, by calculating the target vector formed by each eigenvalue vector and the corresponding element in the first target matrix, the accelerator can calculate the calculation result corresponding to the graph nearest neighbor aggregation operation and improve the utilization rate of vector computing power by utilizing the vector computing power on the accelerator.

[0031] In one possible implementation, the accelerator runs an AI model, such as a GNN model, which includes a first network layer and a second network layer. A first target matrix indicates the features of multiple nodes connected by multiple edges in the first network layer. For example, the values ​​of the elements in the first target matrix can be the values ​​of parameters in the first network layer. Correspondingly, the first calculation result corresponding to the graph nearest neighbor aggregation operation can be the calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer. The accelerator is further configured to perform vector calculations on the eigenvalue vectors of the feature values ​​of each edge in the multiple edges and the second target vectors at corresponding positions in the second target matrix, based on the calculation logic and position information corresponding to the graph nearest neighbor aggregation operation, to obtain the second vector calculation result corresponding to each edge. This second target matrix indicates the features of multiple nodes connected by multiple edges in the second network layer. For example, a row of values ​​in the second target matrix can be the values ​​of multiple dimensions of each node in the second network layer. Furthermore, the accelerator is also configured to calculate the second calculation result corresponding to the graph nearest neighbor aggregation operation in the second network layer based on the second vector calculation result corresponding to each edge. Thus, when the AI ​​model needs to perform graph nearest neighbor aggregation operations in multiple network layers during operation, the processor only needs to send the feature value and position to the accelerator once. This effectively avoids frequent data transfers between the processor and the accelerator, reducing bandwidth consumption. Furthermore, the processor only needs to process the graph data once, which also effectively reduces the processor's computational power consumption.

[0032] In one possible implementation, the second target matrix is ​​the first calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer.

[0033] In one possible implementation, when the accelerator obtains multiple feature value vectors, it can first generate multiple tasks, each task including feature values ​​of some edges from multiple edges and the positional information of those feature values. Then, the accelerator converts the feature values ​​of the edges included in each task into vector data, obtaining at least one feature value vector corresponding to each task. Accordingly, when performing vector computation, the accelerator can calculate at least one feature value vector corresponding to each task based on the computation logic corresponding to the graph nearest neighbor aggregation operation and the positional information of the feature values ​​included in each task, obtaining the first computation result corresponding to the graph nearest neighbor aggregation operation. Thus, by dividing multiple feature values ​​into tasks, the computational power required by the accelerator to perform vector computation for each task does not exceed the available computational power provided by the accelerator, thereby ensuring the normal execution of vector computation. Alternatively, if the accelerator has sufficient vector computational power, by dividing multiple feature values ​​into tasks, the accelerator can execute these multiple tasks in parallel, thereby improving the efficiency of subsequent vector computation based on these multiple feature values ​​and the position of each feature value.

[0034] In one possible implementation, the accelerator is an NPU. This allows AI models to run efficiently on the NPU and perform graph nearest neighbor aggregation operations, which helps expand the hardware operating scenarios for AI models and build a hardware ecosystem for the NPU.

[0035] Fourthly, this application provides a data processing method. This data processing system can be applied to a data processing system including a processor and an accelerator, on which an AI model runs. The method includes: the processor acquiring graph data, which includes feature values ​​of multiple edges, where the feature values ​​are scalar data; sending the feature values ​​of the multiple edges to the accelerator; the accelerator converting the received feature values ​​of the multiple edges into vector data to obtain multiple feature value vectors; and calculating the multiple feature value vectors according to the computational logic corresponding to the graph nearest neighbor aggregation operation to obtain a first calculation result corresponding to the graph nearest neighbor aggregation operation.

[0036] In one possible implementation, the accelerator converts the feature values ​​of the received multiple edges into vector data to obtain multiple feature value vectors, including: the accelerator expands the feature value of each edge in the received multiple edges to obtain multiple feature value vectors, and each feature value vector is obtained by expanding the feature value of one edge in the multiple edges.

[0037] In one possible implementation, an eigenvector contains the same number of elements; the number of elements in each eigenvector is consistent with the number of elements in the vectors that the accelerator supports processing.

[0038] In one possible implementation, the method further includes: the processor sending position information of the feature values ​​of multiple edges to the accelerator, the position information being used to describe the position of the feature values ​​of the multiple edges in the sparse matrix corresponding to the graph data; the accelerator calculating multiple feature value vectors according to the computation logic corresponding to the graph nearest neighbor aggregation operation, including: the accelerator calculating multiple feature value vectors according to the computation logic corresponding to the graph nearest neighbor aggregation operation and the position information.

[0039] In one possible implementation, the accelerator calculates multiple feature vectors based on the computational logic corresponding to the graph nearest neighbor aggregation operation and the position information, including: calculating the feature vector of the feature value of each edge in the multiple edges with the first target vector at the corresponding position in the first target matrix according to the computational logic corresponding to the graph nearest neighbor aggregation operation and the position information, to obtain the first vector calculation result corresponding to each edge; the first target matrix is ​​used to indicate the features of the multiple nodes connected by the multiple edges; and the first calculation result corresponding to the graph nearest neighbor aggregation operation is calculated based on the first vector calculation result corresponding to each edge.

[0040] In one possible implementation, an AI (artificial intelligence) model runs on the accelerator. The AI ​​model includes a first network layer and a second network layer. A first target matrix is ​​used to indicate the features of multiple nodes connected by multiple edges in the first network layer. The first calculation result is the calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer. The method further includes: the accelerator calculates the eigenvalue vector of the feature value of each edge in the multiple edges and the second target vector at the corresponding position in the second target matrix according to the calculation logic corresponding to the graph nearest neighbor aggregation operation and the position information, to obtain the second vector calculation result corresponding to each edge; the second target matrix is ​​used to indicate the features of multiple nodes connected by multiple edges in the second network layer; and the accelerator calculates the second calculation result corresponding to the graph nearest neighbor aggregation operation in the second network layer according to the second vector calculation result corresponding to each edge.

[0041] In one possible implementation, the second target matrix is ​​the first calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer.

[0042] In one possible implementation, the accelerator converts the received feature values ​​of multiple edges into vector data to obtain multiple feature value vectors. This includes: the accelerator generating multiple tasks, each task including feature values ​​of some edges among the multiple edges and position information of the feature values ​​of some edges; the accelerator converting the feature values ​​of the edges included in each task into vector data to obtain at least one feature value vector corresponding to each task; and the accelerator calculating the multiple feature value vectors according to the calculation logic corresponding to the graph nearest neighbor aggregation operation, including: the accelerator calculating at least one feature value vector corresponding to each task according to the calculation logic corresponding to the graph nearest neighbor aggregation operation and the position information of the feature values ​​included in each task to obtain a first calculation result corresponding to the graph nearest neighbor aggregation operation.

[0043] In one possible implementation, the accelerator generates multiple tasks, including: the accelerator generates multiple tasks based on task identifiers corresponding to the multiple tasks, the task identifiers being used to indicate the feature values ​​and location information included in the task; the method further includes: the processor adding task identifiers to the feature values ​​and location information of the multiple edges; and the accelerator sending the task identifiers to the accelerator.

[0044] In one possible implementation, the processor adds task identifiers to the feature values ​​and position information of multiple edges, including: the processor adding task identifiers to the feature values ​​and position information of multiple edges based on the available computing power of the accelerator.

[0045] In one possible implementation, the processor sends feature values ​​of multiple edges to the accelerator, including: the processor sending to the accelerator a task identifier, an index pointer array, an index array, and a data array corresponding to each of the multiple tasks, wherein the elements in the index pointer array are used to indicate the rows of feature values ​​in a task in the sparse matrix, the elements in the index array are used to indicate the columns of feature values ​​in a task in the sparse matrix, and the elements in the data array are the feature values ​​included in a task.

[0046] In one possible implementation, the accelerator is an NPU.

[0047] The data processing method provided in the fourth aspect corresponds to the data processing system provided in the first aspect. Therefore, the technical effects of any implementation method in the fourth aspect can be found in the relevant descriptions of the technical effects of the corresponding implementation methods in the first aspect, and will not be repeated here.

[0048] Fifthly, this application provides a data processing method. The data processing system is applied to a data processing system including a processor and an accelerator. The method includes: the processor acquiring graph data, the graph data including feature values ​​of multiple edges connecting multiple nodes, the feature values ​​of the multiple edges being scalar data; the processor sending to the accelerator a task identifier corresponding to each of the multiple tasks, the feature values ​​included in each task, and the position information of the feature values ​​included in each task, the position information being used to indicate the position of the feature values ​​in a sparse matrix corresponding to the image data, such as indicating the row number and column number of the feature values ​​in the sparse matrix; and the accelerator calculating the calculation result corresponding to the graph nearest neighbor aggregation operation based on the task identifier corresponding to each task, the feature values ​​included in each task, and the position information of the feature values ​​included in each task.

[0049] In one possible implementation, the processor sends to the accelerator a task identifier corresponding to each of the multiple tasks, a feature value included in each task, and the location information of the feature value included in each task, including: the processor sending to the accelerator a task identifier corresponding to each of the multiple tasks, an index pointer array, an index array, and a data array, wherein the elements in the index pointer array are used to indicate the row of the feature value included in a task in the sparse matrix, the elements in the index array are used to indicate the column of the feature value included in a task in the sparse matrix, and the elements in the data array are the feature values ​​included in a task.

[0050] In one possible implementation, the accelerator calculates the computation result corresponding to the graph nearest neighbor aggregation operation based on the task identifier corresponding to each task, the feature values ​​included in each task, and the position information of the feature values ​​included in each task. This includes: the accelerator generates multiple tasks based on the task identifier, index pointer array, index array, and data array corresponding to each task. Each of the multiple tasks includes the feature values ​​of some edges in multiple edges, the row of the feature values ​​of the partial edges in the sparse matrix corresponding to the graph data, and the column of the feature values ​​of the partial edges in the sparse matrix; the accelerator executes the multiple tasks to obtain the computation result corresponding to the graph nearest neighbor aggregation operation.

[0051] In one possible implementation, the accelerator performs the multiple tasks, including: the accelerator converts the feature values ​​of the edges included in each of the multiple tasks into vector data to obtain the feature value vector corresponding to each task; the accelerator calculates the feature value vector corresponding to each task based on the rows and columns of the feature values ​​included in each task in the sparse matrix to obtain the calculation result corresponding to the graph nearest neighbor aggregation operation.

[0052] The data processing method provided in the fifth aspect corresponds to the data processing system provided in the second aspect. Therefore, the technical effects of any implementation method in the fifth aspect can be found in the relevant descriptions of the technical effects of the corresponding implementation methods in the second aspect above, and will not be repeated here.

[0053] Sixthly, this application provides a data processing method. The data processing system is applied to a data processing system including a processor and an accelerator. The method includes: the processor acquiring graph data, wherein the graph data includes feature values ​​of multiple edges. For example, the graph data may include a graph topology and feature values ​​of edges in the topology, and the feature values ​​of the multiple edges are scalar data; the processor sending the graph data to the accelerator; the accelerator determining the feature values ​​of the multiple edges based on the received graph data; the accelerator converting the feature value of each edge in the multiple edges into vector data to obtain multiple feature value vectors, each of the multiple feature value vectors being obtained by converting the feature value of one edge in the multiple edges; and the accelerator performing vector calculations on the multiple feature value vectors according to the computational logic corresponding to the graph nearest neighbor aggregation operation to obtain a first calculation result corresponding to the graph nearest neighbor aggregation operation.

[0054] In one possible implementation, the accelerator converts the feature values ​​of each edge in the multiple edges into vector data to obtain multiple feature value vectors. This includes: the accelerator expands the feature values ​​of each edge in the received multiple edges to obtain multiple feature value vectors, and each of the multiple feature value vectors is obtained by expanding the feature values ​​of one edge in the multiple edges.

[0055] In one possible implementation, an eigenvector contains the same elements, and the number of elements in each eigenvector is consistent with the number of elements in the vectors that the accelerator supports processing.

[0056] In one possible implementation, the method further includes: the processor sending position information of the feature values ​​of multiple edges to the accelerator, the position information being used to describe the position of the feature values ​​of the multiple edges in the sparse matrix corresponding to the graph data.

[0057] In one possible implementation, the accelerator performs vector computation on multiple feature vectors according to the computation logic corresponding to the graph nearest neighbor aggregation operation to obtain a first computation result corresponding to the graph nearest neighbor aggregation operation. This includes: the accelerator calculates the feature vector of the feature value of each edge in the multiple edges with the first target vector at the corresponding position in the first target matrix according to the computation logic corresponding to the graph nearest neighbor aggregation operation and the position information, to obtain a first vector computation result corresponding to each edge. The first target matrix is ​​used to indicate the features of the multiple nodes connected by the multiple edges; the accelerator calculates the first computation result corresponding to the graph nearest neighbor aggregation operation based on the first vector computation result corresponding to each edge.

[0058] In one possible implementation, an AI model runs on the accelerator, such as a GNN model, and includes a first network layer and a second network layer. A first target matrix indicates the features of multiple nodes connected by multiple edges in the first network layer, and the first calculation result corresponding to the graph nearest neighbor aggregation operation can be the calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer. The method further includes: the accelerator performs vector calculations on the eigenvalue vectors of the feature values ​​of each edge in the multiple edges and the corresponding second target vectors in the second target matrix, based on the calculation logic and position information corresponding to the graph nearest neighbor aggregation operation, to obtain a second vector calculation result for each edge. This second target matrix indicates the features of multiple nodes connected by multiple edges in the second network layer; the accelerator calculates the second calculation result corresponding to the graph nearest neighbor aggregation operation in the second network layer based on the second vector calculation result corresponding to each edge.

[0059] In one possible implementation, the second target matrix is ​​the first calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer.

[0060] In one possible implementation, the accelerator converts the received feature values ​​of multiple edges into vector data to obtain multiple feature value vectors. This includes: the accelerator generating multiple tasks, each task including feature values ​​of some edges among the multiple edges and position information of the feature values ​​of some edges; the accelerator converting the feature values ​​of the edges included in each task into vector data to obtain at least one feature value vector corresponding to each task; and the accelerator calculating the multiple feature value vectors according to the calculation logic corresponding to the graph nearest neighbor aggregation operation, including: the accelerator calculating at least one feature value vector corresponding to each task according to the calculation logic corresponding to the graph nearest neighbor aggregation operation and the position information of the feature values ​​included in each task to obtain a first calculation result corresponding to the graph nearest neighbor aggregation operation.

[0061] In one possible implementation, the accelerator is an NPU.

[0062] The data processing method provided in the sixth aspect corresponds to the data processing system provided in the third aspect. Therefore, the technical effects of any implementation method in the sixth aspect can be found in the relevant descriptions of the technical effects of the corresponding implementation method in the third aspect above, and will not be repeated here.

[0063] In a seventh aspect, this application provides a computer-readable storage medium storing instructions that, when executed on at least one computing device, cause the at least one computing device to perform the operational steps of the data processing method of any one of the implementations of the fourth to sixth aspects described above.

[0064] Eighthly, this application provides a computer program product containing instructions that, when run on at least one computing device, causes the at least one computing device to perform the operational steps of the data processing method described in any of the implementations of the fourth to sixth aspects above.

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

[0066] Figure 1 is a schematic diagram of the structure of an exemplary data processing system provided in this application;

[0067] Figure 2 is a flowchart illustrating a data processing method provided in this application;

[0068] Figure 3 shows the generation of a sparse matrix from graph data and the CSR format array used to represent the sparse matrix;

[0069] Figure 4 is a schematic diagram showing that multiple feature values ​​and positions in the graph data have been labeled with task identifiers;

[0070] Figure 5 is a schematic diagram of the GAP-formatted array sent by the processor 100 to the accelerator 201;

[0071] Figure 6 is a schematic diagram of the calculation logic of SPMM operation;

[0072] Figure 7 is a schematic diagram of converting matrix multiplication calculations in SPMM operations into vector multiplication calculations;

[0073] Figure 8 is a flowchart illustrating another data processing method provided in this application. Detailed Implementation

[0074] 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 terms can be used interchangeably where appropriate; this is merely a method of distinction used in describing objects with the same attributes in the embodiments of this application.

[0075] The technical solutions in this application will now be described with reference to the accompanying drawings.

[0076] Referring to Figure 1, a schematic diagram of an exemplary data processing system 10 is shown. As shown in Figure 1, the data processing system 10 includes a processor 100 and at least one accelerator. Figure 1 illustrates this example using accelerators 201 and 202. The processor 100 and the multiple accelerators can be connected via a bus, which may be, for example, a peripheral component interconnect express (PCIe) bus or a unified bus (UB or Ubus).

[0077] For example, the processor 100 may be a central processing unit (CPU), or a processor implemented using an application-specific integrated circuit (ASIC), or a programmable logic device (PLD). The PLD may be implemented using a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), generic array logic (GAL), a digital processing unit (DPU), an electronic processing unit (NPU), a system-on-a-chip (SoC), or any combination thereof, or may be implemented using other types of processors.

[0078] Each accelerator can be a processor that provides data processing services to processor 100, such as a neural network processing unit (NPU), graphics processing unit (GPU), tensor processing unit (TPU), or other types of accelerators. Furthermore, each accelerator can include at least one acceleration unit, which can be a scalar computation unit, a vector computation unit, or a matrix computation unit. A scalar computation unit refers to a computation unit primarily used to perform scalar computation operations; a vector computation unit refers to a computation unit primarily used to perform vector computation operations; and a matrix computation unit refers to a computation unit primarily used to perform matrix computation operations. Each acceleration unit can be a hardware unit on the accelerator with data computation capabilities. Additionally, each accelerator can also include a cache, which can be used to cache data generated or input data required by the acceleration unit during operation. For example, as shown in Figure 1, the accelerator 201 may include four acceleration units, namely a scalar calculation unit 2011, a vector calculation unit 2012, a vector calculation unit 2013, and a vector calculation unit 2014, etc., and the accelerator 201 may also include a cache 2015, etc.

[0079] In practical applications, the data processing system 10 can be deployed on one or more computing devices. For example, the processor 100, accelerator 201, and accelerator 202 can all be deployed on the same server. Alternatively, the data processing system 10 can be deployed on multiple computing devices. For example, the processor 100 and accelerator 201 can be deployed on server A, and the accelerator 202 can be deployed on server B, and server A and server B can be connected via a bus.

[0080] Typically, the AI ​​model can be deployed in the data processing system 10 and can run via processor 100 and at least one accelerator, or it can run via only at least one accelerator. For example, the AI ​​model can specifically be a model that includes graph nearest neighbor aggregation operations, such as a GNN model. The GNN model can be, for example, a graph attention network (GAT), a graph convolutional network (GCN), and a graph sample and aggregate (GraphSage) model, or it can be a model of a certain type.

[0081] When an AI model needs to perform graph nearest neighbor aggregation (e.g., a GNN model), this operation requires computation on a sparse matrix. Since sparse matrix computation is typically scalar computation, it's unsuitable for the vector computation units in an accelerator. Therefore, if the processor 100 or the accelerator's scalar computation unit were to perform the graph nearest neighbor aggregation operation, the accelerator's vector computation unit would remain idle for an extended period. Furthermore, when the processor 100 performs the graph nearest neighbor aggregation operation, the accelerator sends the necessary data to the processor, and then the processor 100 sends the computation result back to the accelerator (for further computation on the accelerator). This results in significant communication overhead between the processor 100 and the accelerator. Furthermore, if a sparse matrix is ​​padded with zeros to become a dense matrix and then computed using the vector or matrix computation units in the accelerator, this not only consumes a significant amount of the accelerator's storage resources (such as cache resources), but the zeros padded in the dense matrix also participate in data computation, resulting in a large number of invalid computation processes. This would severely waste the accelerator's storage and computational resources. At the same time, the increased amount of data involved in the computation would also affect the data computation efficiency.

[0082] Based on this, in the data processing system 10 provided in this application, during the running of the AI ​​model, the processor 100 acquires graph data. For example, this graph data can be the input data of the AI ​​model, and it includes feature values ​​of multiple edges. These edges can be directed edges connecting multiple nodes, or edges that do not include direction information. Then, the processor 100 sends the feature values ​​of these edges to the accelerator 201 (taking the use of the accelerator 201 to run the AI ​​model as an example). The accelerator 201 converts the received feature values ​​of each edge into vector data, obtaining multiple feature value vectors. Each feature value vector can be obtained by converting the feature value of one edge among the multiple edges. For example, when the feature value of an edge is 7, the accelerator can convert the feature value 7 into a vector containing 8 identical elements [7,7,7,7,7,7,7,7,7]. Furthermore, the accelerator 201 also calculates the multiple feature value vectors according to the computational logic corresponding to the graph nearest neighbor aggregation operation in the AI ​​model, obtaining the computational result corresponding to the graph nearest neighbor aggregation operation in the AI ​​model.

[0083] Thus, during the AI ​​model's operation, for the graph nearest neighbor aggregation operation required by the AI ​​model, accelerator 201 expands the feature values ​​of multiple edges into vectors and performs corresponding calculations on multiple feature value vectors according to the computational logic of the graph nearest neighbor aggregation operation to obtain the computational result corresponding to the required graph nearest neighbor aggregation operation. This enables the accelerator 201 to transform the computation required by the accelerator 201 from scalar computation corresponding to the graph nearest neighbor aggregation operation into vector computation. In this way, accelerator 201 can utilize vector computation units 2012 and 2013 to perform the computation process for these multiple vectors, thereby fully utilizing the vector computing power on accelerator 201 and improving the computing power utilization rate of accelerator 201.

[0084] In this process, since the graph aggregation operation is performed by the accelerator 201, the processor 100 and the accelerator 201 can perform the computational results of the graph nearest neighbor aggregation operation without interaction, which reduces the communication overhead between the accelerator 201 and the processor 100. Furthermore, vector computation based on the eigenvalues ​​of multiple edges (without needing to pad the sparse matrix with zeros to form a dense matrix for computation) consumes relatively less storage and computational resources from the accelerator 201, thus reducing the consumption of these resources. Simultaneously, the amount of data involved in the computation is also smaller, which improves the data computation efficiency of the accelerator 201 in performing the graph nearest neighbor aggregation operation.

[0085] Furthermore, when accelerator 201 is specifically an accelerator such as an NPU that includes a large amount of vector computing power, accelerator 201 can realize the efficient operation of AI models on NPU (and other types of accelerators) by converting graph nearest neighbor aggregation operations into vector computing processes, thereby helping to expand the hardware operation scenarios of AI models and create a hardware ecosystem for NPU.

[0086] It is worth noting that the above implementation method of performing graph nearest neighbor aggregation calculation using the vector computing power on accelerator 201 is only one example. In other implementation methods, after the processor 100 obtains the graph data, it can directly send the graph data to accelerator 201. Accelerator 201 parses the received graph data, determines the feature values ​​of multiple edges in the graph data, and then converts the feature values ​​of each directed edge into vector data, obtaining multiple feature value vectors. According to the calculation logic corresponding to the graph nearest neighbor aggregation operation in the AI ​​model, it calculates the multiple feature value vectors to realize the transformation of the scalar calculation process of the graph nearest neighbor operation into a vector calculation process and obtain the calculation result corresponding to the graph nearest neighbor operation. In addition, when the AI ​​model runs on accelerator 202, accelerator 202 can also refer to the above-described implementation methods to use its vector computing power to perform the graph nearest neighbor aggregation operation in the AI ​​model; or, the AI ​​model can be run through multiple accelerators, and these multiple accelerators can collaboratively execute the graph nearest neighbor aggregation operation in the AI ​​model in the above-described manner, etc., which will not be elaborated further.

[0087] Furthermore, the data processing system 10 shown in Figure 1 is merely an illustrative example and is not intended to be limiting. For instance, in other possible data processing systems, the number of accelerators can be arbitrary. Also, in other possible data processing systems, other types of hardware may be included, such as memory used to store data generated by the processor 100 or computational results generated by each accelerator; or, each accelerator in the data processing system may also include other hardware, such as memory, registers, etc., without limitation. Furthermore, in other possible data processing systems, a client may be included, which can be used to interact with the user to obtain information provided by the user, such as obtaining the graph topology provided by the user.

[0088] The embodiments of the data processing method provided in this application will now be described with reference to the accompanying drawings.

[0089] Referring to Figure 2, which is a flowchart illustrating a data processing method provided in an embodiment of this application, this method can be applied to the data processing system 10 shown in Figure 1, or to other applicable data processing systems. For ease of explanation, this embodiment uses the vector calculation process corresponding to the graph nearest neighbor aggregation operation performed by the accelerator 201 in the data processing system 10 shown in Figure 1 as an example for illustrative purposes.

[0090] The data processing method shown in Figure 2 may specifically include:

[0091] S201: Processor 100 acquires graph data, which includes the feature values ​​of multiple directed edges.

[0092] In AI model training or inference scenarios, graph data can be used as input data for AI models, and AI models can perform forward computation based on the graph data to realize the training or inference process of AI models.

[0093] For example, graph data may include a graph topology and the feature values ​​of directed edges. The graph topology refers to the network topology formed by nodes and edges. In a graph topology, different nodes are connected by directed edges (which may include directed edges from some nodes to themselves, such as the directed edge from node 0 to node 2 in Figure 3, which will not be described separately below). Furthermore, each directed edge may have a feature value; for example, the directed edge between node 0 and node 2 in Figure 3 may have a feature value of 2. The feature value of a directed edge, for example, can be a weight, which can be used to measure the degree of association between two nodes. For instance, in a product recommendation scenario, the feature value of the directed edge between a user node and a product node can be used to measure the probability that the user will purchase the product. Alternatively, the feature value of a directed edge may also be a value with other meanings, which is not limited.

[0094] Alternatively, the graph data can be in compressed sparse row (CSR) format or other compressed formats, which can be used to indicate the feature values ​​of edges between different nodes and the position of those feature values ​​in the corresponding sparse matrix of the graph data, such as indicating which row and column the feature value is in. In this embodiment, the specific representation of the graph data acquired by the processor 100 is not limited.

[0095] In one possible implementation, the data processing system 10 may provide a client, which may be, for example, an application on a user's terminal device or a web browser. The client may present an interactive interface to the user, allowing the user to input graph data. The client may then send the graph data to the data processing system 10, enabling the processor 100 within the data processing system 10 to retrieve the graph data.

[0096] In practical applications, the processor 100 can also acquire graph data in other ways, such as by analyzing information provided by the user (such as the relationship between the user and the product) to generate graph data, and there is no limitation on this.

[0097] S202: Processor 100 sends the feature values ​​of multiple directed edges in the graph data to accelerator 201.

[0098] For example, after acquiring graph data, the processor 100 can parse the graph data to obtain information such as multiple nodes in the graph data, multiple directed edges connecting the multiple nodes, and the feature values ​​of each directed edge. Furthermore, the processor 100 can send the feature values ​​of the parsed multiple directed edges to the accelerator 201 so that the accelerator 201 can perform corresponding calculations using vector computing power based on the received feature values.

[0099] Furthermore, the processor 100 can determine the sparse matrix corresponding to the graph data based on multiple nodes and multiple directed edges, and determine the position of the eigenvalues ​​of the directed edges in the sparse matrix, thereby obtaining the position information of the eigenvalues ​​of each directed edge, and also send the position information of the eigenvalues ​​to the accelerator 201, so that the accelerator 201 can combine the received eigenvalues ​​and position information to perform corresponding calculations using vector computing power.

[0100] This embodiment provides the following non-limiting implementation examples.

[0101] As a first implementation example, processor 100 can generate a corresponding sparse matrix based on graph data. Specifically, it can determine the rows and columns of the sparse matrix based on multiple nodes. Each row and column of the sparse matrix corresponds to a node. Furthermore, processor 100 determines the position of a directed edge in the sparse matrix based on the directed edges between different nodes and adds the eigenvalue of that directed edge at that position to generate the sparse matrix. A sparse matrix is ​​defined as a matrix where the number of non-zero elements is much greater than the number of zero elements; for example, the number of zero elements in the matrix does not exceed 10%. Correspondingly, the computation performed based on this graph data is typically sparse computation. For example, assuming the graph data acquired by processor 100 is shown on the left side of Figure 3, processor 100 can generate the sparse matrix shown on the right side of Figure 3 based on the graph data.

[0102] Sparse matrices can be represented using compressed storage methods, such as based on the CSR format. For example, the sparse matrix shown on the right side of Figure 3 can be represented using the three arrays shown below Figure 3. The data array indicates the non-zero values ​​in the sparse matrix (recorded sequentially from left to right and top to bottom), which are the feature values ​​of directed edges in the graph data. The indices array indicates the column number of the non-zero value (matching the order in which the non-zero values ​​are recorded). The index pointers array indicates the row number of the non-zero value; the values ​​in the index pointers array can be used to indicate the number of non-zero values ​​preceding the current row in the sparse matrix. Typically, the correct sparse matrix can be recovered from the data array, index array, and index pointers array.

[0103] After generating the sparse matrix, the processor 100 can send the elements in the sparse matrix (i.e., the eigenvalues ​​of the directed edges) and the positions of the elements (i.e., the positions of the eigenvalues ​​in the sparse matrix corresponding to the graph data) to the accelerator 201. For example, it can send information in CSR format used to indicate the sparse matrix to the accelerator 201. The CSR format information includes the aforementioned data array, index array, and index pointer array.

[0104] As a second implementation example, when the number of directed edges in the graph data is large, the accelerator 201 performs vector computation based on the feature values ​​of multiple directed edges and the position of each feature value in the sparse matrix corresponding to the graph data. The required vector computation power may exceed the available computation power of the accelerator 201, easily leading to vector computation failure or low efficiency. Therefore, the processor 100 can add task identifiers to the feature values ​​of multiple directed edges in the graph data and the position of each feature value in the sparse matrix, based on the available computation power of the accelerator 201, that is, assign the feature values ​​of multiple directed edges to different tasks.

[0105] The available computing power of accelerator 201 can be measured by the available capacity of cache 2015, or by other means, without limitation. Taking the available capacity of cache 2015 as an example, processor 100 can estimate the maximum number of feature values ​​that the available capacity of cache 2015 can support processing, and then divide the feature values ​​of multiple directed edges into multiple tasks based on this maximum number. In this way, when accelerator 201 performs vector calculations based on the number and position of feature values ​​included in each task, the computing power requirement does not exceed the available computing power of accelerator 201.

[0106] In specific implementation, the processor 100 can first generate a corresponding sparse matrix based on the graph data and represent the sparse matrix using a format such as CSR. Then, the processor 100 can add task identifiers to the feature values ​​of multiple directed edges in the sparse matrix and the information indicating the position of the feature value in the sparse matrix (i.e., the aforementioned position information). For example, the processor 100 can add task identifiers to the feature values ​​and position information of multiple directed edges based on the available computing power of the accelerator 201, so that the computing power required by the accelerator 201 to perform vector calculations for each task does not exceed the available computing power of the accelerator 201.

[0107] For example, the task identifier added by processor 100 may include, for instance, the row number of the starting row in the sparse matrix, or it may include the row number of the starting row and padding information in the CSR format. The ID of the starting row indicates the smallest row number in the sparse matrix of the feature values ​​assigned to the same task. When assigning feature values ​​of multiple directed edges to different tasks, processor 100 can assign all feature values ​​of the current row to the same task, and then assign feature values ​​of subsequent consecutive rows to that task, until it reaches the row number indicated by the task identifier for the next task. Thus, processor 100 can send the CSR format information (including feature values ​​and positions) with the added task identifier to accelerator 201.

[0108] For example, given the graph data and sparse matrix shown in Figure 3, the processor 100 can determine, based on the available computing power of the accelerator 201, that the accelerator 201's available computing power can support vector computation based on the feature values ​​of up to four directed edges. Therefore, the processor 100 can divide the seven feature values ​​in the graph data into two parts. Specifically, it can add the ID of the starting row, as shown in Figure 4, to the CSR format information used to indicate the sparse matrix. That is, the processor 100 assigns the feature values ​​"8", "2", and "5" to one task and the feature values ​​"7", "1", "3", and "9" to another task. The ID of the starting row can be determined based on index pointers. For example, the ID of the starting row for the first task can be the value of the first element in the index pointer array, and the ID of the starting row for the second task can be the value of the fifth element in the index pointer array. At this time, the data sent by the processor 100 to the accelerator 201 includes four two-dimensional arrays as shown in Figure 4 (the information of each row is stored in a two-dimensional array).

[0109] Alternatively, the task identifier added by processor 100 to the CSR format information may include the ID of the starting line and the information to be filled in. For example, as shown in Figure 5, processor 100 assigns the feature values ​​"8", "2", and "5" to the first task and the feature values ​​"7", "1", "3", and "9" to the second task. Then, processor 100 can update the values ​​of the elements in the index pointer array, such as updating the values ​​of the elements in the index pointer array corresponding to the feature values ​​assigned to the second task from "3", "6", "6", and "7" to "4", "7", "7", and "8". Thus, processor 100 can determine the ID of the starting line of the first task as "0" based on the value of the first element in the index pointer array and determine the ID of the starting line of the second task as "4" based on the value of the second element in the index pointer array. Furthermore, processor 100 will also fill the index pointer array with a value for each task, and the filled value is greater than or equal to the value of the previous element in the index pointer array. As shown in Figure 5, processor 100 fills the index pointer array with the value "4" for the first task (i.e., the task with ID "0" in the starting line) and fills the index pointer array with the value "8" for the second task (i.e., the task with ID "4" in the starting line).

[0110] Furthermore, when some tasks contain fewer feature values ​​than other tasks, the processor 100 can fill the index array and data array with values ​​for those tasks. For example, for the first task (i.e., the task with ID "0" in the starting row), fill the index array with the value "-1" and the data array with the value "0", as shown in Figure 5. In practical applications, the values ​​filled in the index array and the data array can also be other values, and there is no limitation on this. At this time, the data sent by the processor 100 to the accelerator 201 includes four two-dimensional arrays as shown in Figure 5, with the information of each row stored in a two-dimensional array. Moreover, by filling the arrays in the tasks with values, the amount of data and the data structure of each task can remain uniform. This allows the accelerator 201 to process tasks with uniform data amounts and data formats, improving the stability of the accelerator 201 in executing tasks (avoiding different tasks containing different amounts or different data structures from affecting the successful execution of tasks by the accelerator 201). In practical applications, the format of the four two-dimensional arrays sent by processor 100 to accelerator 201 can be called graph-aware packing (GAP) format. In this GAP format, the elements in the index pointer array indicate the rows of a feature value in a sparse matrix, the elements in the index array indicate the columns of a feature value in a sparse matrix, and the elements in the data array represent the feature values ​​included in a task.

[0111] It should be noted that the above explanation uses the example of dividing multiple feature values ​​into multiple tasks based on the available computing power of accelerator 201. In other implementation examples, processor 100 can also divide multiple feature values ​​into multiple tasks in other ways, such as dividing multiple feature values ​​into multiple tasks based on a threshold, where the number of feature values ​​included in each task is equal to or less than the threshold; or, processor 100 can divide multiple feature values ​​into multiple tasks based on the parallel capability of accelerator 201, etc. In this way, by dividing multiple feature values ​​into tasks, processor 100 can enable subsequent accelerator 201 to execute these multiple tasks in parallel based on multiple vector computing units, thereby improving the efficiency of subsequent accelerator 201 in performing vector calculations based on the multiple feature values ​​and the position of each feature value.

[0112] In this embodiment, accelerator 201 can perform corresponding vector calculations based on the feature values ​​of multiple directed edges in the received graph data and the position of each feature value in the sparse matrix, to obtain the calculation results corresponding to the graph nearest neighbor aggregation operation in the AI ​​model. The following sections, in conjunction with steps S203 to S204, describe the implementation process of accelerator 201 generating the calculation results corresponding to the graph nearest neighbor aggregation operation by performing vector calculations.

[0113] S203: Accelerator 201 converts the feature values ​​of each directed edge in multiple directed edges into vector data, resulting in multiple feature value vectors.

[0114] Each of these multiple eigenvalue vectors can be obtained by transforming the eigenvalue of one of the directed edges from the multiple directed edges.

[0115] In one possible implementation, for each directed edge's feature value, the accelerator 201 can expand the feature value of the directed edge into a feature value vector containing the same elements, where each element in the feature value vector is the feature value. For example, assuming the feature value of a single directed edge is 2, the accelerator 201 can convert the feature value of the directed edge into a feature value vector [2,2,2,2,2,2,2,2].

[0116] As a first implementation example, accelerator 201 can determine the number of elements in the eigenvalue vector to be expanded based on the number of values ​​in each row of the dense matrix that participates in the graph nearest neighbor aggregation operation. For example, assuming that each row of the dense matrix contains 8 values, accelerator 201 can expand the eigenvalues ​​of each directed edge into an eigenvalue vector containing 8 elements (or fewer than 8 elements).

[0117] In the second implementation example, accelerator 201 can determine the number of elements in the eigenvalue vector to be expanded based on the number of elements in the vector it supports processing. For example, if accelerator 201 can support computation on vectors with 4 elements (each row of the dense matrix participating in the graph nearest neighbor aggregation operation contains 8 values), then accelerator 201 can expand the eigenvalues ​​of each directed edge into an eigenvalue vector containing 4 elements (or fewer than 8 elements).

[0118] In this way, the subsequent accelerator 201 can perform the corresponding vector calculation process for the eigenvalue vectors of the eigenvalues ​​of each directed edge.

[0119] S204: Accelerator 201 calculates the multiple feature vectors obtained by transformation according to the computation logic corresponding to the graph nearest neighbor aggregation operation, and obtains the first computation result corresponding to the graph nearest neighbor aggregation operation.

[0120] During the execution of an AI model, the accelerator 201 typically needs to perform graph nearest neighbor aggregation (PNN) operations, which usually involve multiplication between different matrices. For example, PNN operations can include sparse-dense matrix multiplication (SPMM) or sampled dense-dense matrix multiplication (SDDMM). SPMM is a multiplication between sparse and dense matrices; SDDMM is a multiplication between dense matrices. In this embodiment, the accelerator 201 can convert the matrix multiplication process into a corresponding vector computation process to obtain the computation result corresponding to the PNN operation.

[0121] As an implementation example, accelerator 201 can perform vector calculations based on the position of each eigenvalue in the sparse matrix corresponding to the graph data. The eigenvalue vector expanded based on each eigenvalue is compared with the corresponding first target vector (or vector segmentation) in the first target matrix (the dense matrix shown in Figure 7) to obtain the first vector calculation result for each directed edge (i.e., the first vector calculation result for each eigenvalue). The first target matrix indicates the features of multiple nodes connected by multiple edges in the graph data. For example, a row of values ​​in the first target matrix represents the value of one of the multiple nodes in the graph data within the first network layer. For instance, for a directed edge pointing from node 4 to node 2, if the eigenvalue of this directed edge is located in the 5th row and 3rd column of the sparse matrix (i.e., the position of element 7 in the sparse matrix), accelerator 201 can calculate the vector calculation result corresponding to this directed edge by comparing the eigenvalue vector expanded based on the eigenvalue of the directed edge with the first target vector formed by the data in the 3rd row of the first target matrix. Here, the first target vector is the vector formed by the data in the third row of the first target matrix. That is, the position of the eigenvalue of the directed edge in the sparse matrix matches the vector formed by the data in the third row of the first target matrix. The first target matrix can be a matrix composed of parameters from some network layers in the AI ​​model; that is, the values ​​of the elements in the first target matrix are the parameter values ​​included in some network layers of the AI ​​model.

[0122] Then, based on the computational logic indicated by the graph nearest neighbor aggregation operation, the accelerator 201 calculates the first vector calculation result corresponding to each directed edge to obtain the first calculation result corresponding to the graph nearest neighbor aggregation operation in the AI ​​model. This first calculation result may be, for example, the calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer included in the AI ​​model, and the parameters in the first network layer are the element values ​​in the first target matrix.

[0123] To facilitate understanding, the following explanation uses the Graph Nearest Neighbor (SPMM) operation as an example. First, the computational logic of the SPMM operation is introduced. As shown in Figure 6, for each row in the sparse matrix, the non-zero elements in that row are multiplied by the elements of the corresponding row in the dense matrix. The result of this multiplication determines the element value of the corresponding row in the new dense matrix. Specifically, for a row in the sparse matrix and the corresponding row in the dense matrix multiplied from that row, the value of the column containing the non-zero element in that row is equal to the value of the corresponding row in the dense matrix involved in the multiplication calculation. For example, as shown in Figure 6, for the second row of the sparse matrix, if its fourth column contains non-zero elements, these non-zero elements can be multiplied by the elements of the fourth row in the dense matrix, and the resulting product is used as the value of the element in the second row of the new matrix. Furthermore, when a row in a sparse matrix contains multiple non-zero elements, each non-zero element is calculated with the corresponding row in the dense matrix in the same manner as described above. The values ​​in the same column are then summed, and the sum of these values ​​is used as the value for that column in the new matrix. For example, as shown in Figure 6, for the 4th row of the sparse matrix, whose 2nd and 3rd columns contain non-zero elements A and B, non-zero element A can be multiplied by each element in the 2nd row of the dense matrix, and non-zero element B can be multiplied by each element in the 3rd row of the dense matrix. Since the 3rd column in the 2nd row and the 3rd column in the 3rd row of the dense matrix both contain non-zero values, the two results calculated by non-zero elements A and B with the two non-zero values ​​in the 3rd column of the dense matrix can be summed to obtain the value in the 4th row and 3rd column of the new matrix. The product of non-zero element B and the 3rd row and 1st column of the dense matrix is ​​then used as the value in the 4th row and 1st column of the new matrix, as shown in Figure 6.

[0124] Therefore, when performing SPMM operations on the graph data shown in Figure 3, since each element in the sparse matrix is ​​multiplied by each element in a row of the dense matrix, the accelerator 201 can expand each element in the sparse matrix (i.e., the eigenvalue of each directed edge) into an eigenvalue vector during the conversion of SPMM operations into vector computation. The number of elements in each eigenvalue vector is the same as the number of elements in a row of the dense matrix. For example, the eigenvalue "7" in the 5th row and 3rd column of the sparse matrix corresponding to the graph data is expanded into the eigenvalue vector [7,7,7,7], and the eigenvalue vector [7,7,7,7] is multiplied by the first target vector consisting of the 4 elements in the 3rd row of the dense matrix (i.e., the first target matrix mentioned above) to obtain the first vector computation result corresponding to the eigenvalue "7". For the eigenvalue "1" in the 5th row and 4th column and the eigenvalue "3" in the 6th column of the sparse matrix, the accelerator 201 can expand to obtain eigenvalue vectors [1,1,1,1] and [3,3,3,3] respectively. It can then perform vector multiplication on the eigenvalue vector [1,1,1,1] with the first target vector formed by the four elements in the 4th row of the dense matrix to obtain the first vector calculation result corresponding to eigenvalue "1". Similarly, it can perform vector multiplication on the eigenvalue vector [3,3,3,3] with the first target vector formed by the four elements in the 6th row of the dense matrix to obtain the first vector calculation result corresponding to eigenvalue "3". Then, the accelerator 201 can sum the first vector calculation results corresponding to each non-zero value in the 5th row of the sparse matrix column by column, and use the sum of each column as the value of the corresponding element in the 5th row of the new matrix, as shown in Figure 7. Therefore, for each non-zero element in the sparse matrix (i.e., the eigenvalue in the graph data), vector calculation can be performed in the manner described above. The final calculated result (i.e., the new matrix obtained) is the first calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer.

[0125] In practical applications, when the number of elements in the eigenvalue vector supported by the accelerator 201 is less than the number of columns in the dense matrix, the accelerator 201 can segment a row of data in the dense matrix for vector operations. For example, assuming the number of elements in the vector supported by the accelerator 201 is 2, and the number of columns in the dense matrix is ​​4, when the accelerator 201 calculates the product of the eigenvalue "7" in the sparse matrix and the values ​​in the third row of the dense matrix, it can expand the eigenvalue "7" into an eigenvalue vector [7,7]. This eigenvalue vector [7,7] is then multiplied by the vector formed by the first and second columns of the third row of the dense matrix (including two elements). Then, the eigenvalue vector [7,7] is multiplied by the vector formed by the third and fourth columns of the third row of the dense matrix. The results of these two multiplications are then concatenated to obtain the first vector calculation result corresponding to the eigenvalue "7".

[0126] It should be noted that the above description is based on the example of accelerator 201 performing vector calculations based on the feature values ​​and position information sent by processor 100. In other embodiments, when processor 100 only sends feature values ​​of multiple directed edges, accelerator 201 can obtain the position information of the feature value after receiving it. For example, it can obtain the position information of the feature value from other accelerators (such as multiple accelerators jointly executing an AI model), and perform corresponding vector calculations based on the feature value and position information.

[0127] Furthermore, when the processor 100 sends task identifiers to the accelerator 201, before performing vector calculations, the accelerator 201 can first generate multiple tasks based on the received task identifiers. Each task includes the feature values ​​of some directed edges and the positions of those feature values ​​in the sparse matrix corresponding to the graph data. Thus, the accelerator 201 can expand each feature value in each task in the manner described above, obtaining at least one feature value vector corresponding to each task, i.e., obtaining the feature value vectors expanded from each feature value in each task. Then, for each task, the accelerator 201 can calculate the feature value vectors corresponding to the feature values ​​included in the task based on the positions of the feature values ​​in the sparse matrix, obtaining the calculation result corresponding to the task. The accelerator 201 then concatenates the calculation results corresponding to multiple tasks to obtain the first calculation result corresponding to the graph nearest neighbor aggregation operation in the AI ​​model. The number of feature values ​​included in each task can be the maximum number of feature values ​​that the available capacity of the cache 2015 can support processing, or it can be a pre-set threshold, etc., and is not limited in this respect.

[0128] For example, for the graph data shown in Figure 3, accelerator 201 can receive a two-dimensional array in GAP format as shown in Figure 5, and can read the corresponding feature values ​​and their positions from the received two-dimensional array according to the identifiers of each task, generating multiple tasks as shown in Figure 7. Therefore, for the task with task ID "1", accelerator 201 can, in the manner described above, perform the corresponding vector calculation process based on the four feature values ​​included in the task and the positions of each feature value, as shown in Figure 7.

[0129] Thus, when the vector computing power of accelerator 201 is limited (e.g., the number of vector computing units included on accelerator 201 is small), accelerator 201 can reduce the vector computing power requirements of accelerator 201 for performing graph nearest neighbor aggregation operations by generating multiple tasks and executing them sequentially, achieving efficient pipelined computation, and improving the resource utilization of accelerator 201. Furthermore, each of the multiple tasks generated by accelerator 201 can include the same or similar number of feature values ​​and positions, which can achieve load balancing among multiple tasks and make reasonable use of the vector computing power on accelerator 201.

[0130] When the vector computing power of accelerator 201 is sufficient (e.g., accelerator 201 includes a large number of vector computing units), after generating multiple tasks, accelerator 201 can utilize multiple vector computing units to execute these multiple tasks in parallel. In this way, accelerator 201 can not only make full use of vector computing power for computation, but also improve the overall efficiency of accelerator 201 in performing graph nearest neighbor aggregation operations by having multiple vector computing units execute tasks in parallel.

[0131] In practical applications, AI models may have multiple network layers that all require graph nearest neighbor aggregation (PNN) operations. Furthermore, these PNN operations in different network layers are calculated based on the same graph data but different target matrices, such as different network layers having different parameter values ​​(the numerical values ​​used to construct the elements in the target matrix). Therefore, the accelerator 201 can locally store the feature values ​​of multiple directed edges sent by the processor 100 and the positions of each feature value in the sparse matrix corresponding to the graph data. It can then use the locally stored feature values ​​and positions to calculate the computation results corresponding to the PNN operations in each of these multiple network layers.

[0132] Taking an AI model comprising a first network layer and a second network layer as an example, during the execution of the graph nearest neighbor aggregation operation in the first network layer, the processor 100 can send the feature values ​​of multiple directed edges in the graph data, along with the position of each feature value in the corresponding sparse matrix of the graph data, to the accelerator 201. The accelerator 201 then calculates the first calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer according to the process described in steps S203 to S204. Furthermore, the accelerator 201 can locally store these multiple feature values ​​and their positions in the sparse matrix. Thus, when the second network layer in the AI ​​model is executed, the accelerator 201 can utilize the locally stored feature values ​​and positions to calculate the second calculation result corresponding to the graph nearest neighbor aggregation operation in the second network layer. Specifically, accelerator 201 can perform vector calculations on the feature value vector obtained by transforming the feature value based on the position of the feature value of each directed edge in the graph data, and the corresponding second target vector in the second target matrix, to obtain the second vector calculation result for each directed edge. This second target matrix is ​​used to indicate the features of multiple nodes connected by multiple directed edges in the second network layer. For example, the elements in the second target matrix are parameters in the second network layer, and a row of data in the second target matrix can be the values ​​of one node in multiple dimensions in the second network layer. The implementation method of accelerator 201 determining the second target vector from the second target matrix is ​​similar to the implementation method of determining the first target vector from the first target matrix, and will not be elaborated here. For example, the second target matrix can be the first calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer; that is, the new matrix calculated in the first network layer can be used as the second target matrix required for performing the graph nearest neighbor aggregation operation in the second network layer.

[0133] Then, based on the computational logic indicated by the graph nearest neighbor aggregation operation, accelerator 201 calculates the second vector calculation result corresponding to each directed edge to obtain the second calculation result corresponding to the graph nearest neighbor aggregation operation in the second network layer. The implementation method of accelerator 201 for performing the graph nearest neighbor aggregation operation in the second network layer is similar to the implementation method for performing the graph nearest neighbor aggregation operation in the first network layer described above; details can be found in the relevant descriptions above and will not be repeated here.

[0134] Thus, when the AI ​​model needs to perform multiple graph nearest neighbor aggregation operations during operation, the processor 100 only needs to send the multiple feature values ​​and positions to the accelerator 201 once. This effectively avoids frequent data transmission between the processor 100 and the accelerator 201, reducing bandwidth consumption. Furthermore, the processor 100 only needs to process the graph data once, which also effectively reduces the computing power consumption of the processor 100.

[0135] It should be noted that this embodiment uses graph data including the feature values ​​of multiple directed edges as an example. In other embodiments, the edges connecting multiple nodes may also be edges that do not include direction information. In this case, the graph data obtained by the processor 100 may be the feature values ​​of multiple edges that do not include direction information, so that the processor 100 and the accelerator 201 can generate the corresponding calculation results of the graph nearest neighbor aggregation operation based on the graph data.

[0136] The embodiment shown in Figure 2 above illustrates a graph nearest neighbor aggregation operation performed collaboratively by the processor 100 and the accelerator 201. In other embodiments, the process of the processor 100 processing graph data can also be offloaded to the accelerator 201, that is, the accelerator 201 performs the graph nearest neighbor aggregation operation based on the graph data. This will be illustrated below with reference to Figure 8.

[0137] Referring to Figure 8, a flowchart of another data processing method is shown. In the method embodiment shown in Figure 8, the edges in the graph data are directed edges, and the method may specifically include the following steps.

[0138] S801: Processor 100 acquires graph data, which includes feature values ​​of multiple directed edges used to connect multiple nodes.

[0139] The implementation of step S801 is similar to that of step S201 in the embodiment shown in Figure 2 above. For details, please refer to the relevant descriptions above, which will not be repeated here.

[0140] S802: Processor 100 sends graph data to accelerator 201.

[0141] S803: Accelerator 201 determines the eigenvalues ​​of multiple directed edges based on graph data.

[0142] The implementation of step S803 is similar to the implementation of the processor 100 parsing the feature values ​​of multiple directed edges from the graph data in the embodiment shown in Figure 2 above. For details, please refer to the relevant descriptions above, which will not be repeated here.

[0143] S804: Accelerator 201 converts the eigenvalues ​​of each directed edge in multiple directed edges into vector data, resulting in multiple eigenvalue vectors.

[0144] Each of these multiple eigenvalue vectors is obtained by transforming the eigenvalue of one of the directed edges from the multiple directed edges.

[0145] S805: Accelerator 201 calculates the multiple feature vectors obtained by transformation according to the computation logic corresponding to the graph nearest neighbor aggregation operation, and obtains the first calculation result corresponding to the graph nearest neighbor aggregation operation.

[0146] The implementation of steps S804 and S805 is similar to that of steps S203 and S204 in the embodiment shown in Figure 2 above. For details, please refer to the relevant descriptions above, which will not be repeated here.

[0147] In this way, the accelerator 201 can not only convert the scalar computation corresponding to the graph nearest neighbor aggregation operation into vector computation, thereby making full use of the vector computing power on the accelerator 201 and improving the computing power utilization of the accelerator 201, but also reduce the computing power consumption of the processor 100 during the running of the AI ​​model. This allows the processor 100 to perform other business based on more computing power, ensuring the overall performance of the data processing system 10.

[0148] It should be noted that in this embodiment, the edge in the graph data is a directed edge as an example. In other embodiments, the edge in the graph data may also be an edge that does not include direction information. In this case, the processor 100 and the accelerator 201 can still convert the feature values ​​of the edge that does not include direction information into feature value vectors based on the above-described similar method, and calculate the feature value vectors obtained by conversion.

[0149] Furthermore, the embodiments shown in Figures 2 and 8 above are exemplified by using accelerator 201 running an AI model. In actual application scenarios, the AI ​​model can also run on accelerator 202, or simultaneously on accelerator 201 and accelerator 202. In this case, the process of graph nearest neighbor aggregation operation performed by accelerator 202 when running the AI ​​model, or the process of graph nearest neighbor aggregation operation performed by accelerator 201 and accelerator 202 when running the AI ​​model collaboratively, is similar to the implementation method of graph nearest neighbor aggregation operation in the embodiments shown in Figures 2 or 8 above. For details, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.

[0150] It is worth noting that other reasonable combinations of steps that can be conceived by those skilled in the art based on the above description also fall within the scope of protection of this application. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to this application.

[0151] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to perform the aforementioned data processing method.

[0152] This application also provides a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this application are generated.

[0153] The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another website, computer, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.

[0154] The computer program product can be a software installation package. When any of the aforementioned data processing methods is required, the computer program product can be downloaded and executed on a computing device.

[0155] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of 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 transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.

[0156] The terminology used in the above embodiments is for the purpose of describing specific embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to also include expressions such as “one or more,” unless the context clearly indicates otherwise. It should also be understood that in the embodiments of this application, “one or more” refers to one, two, or more; the character “ / ” generally indicates that the preceding and following objects are in an “or” relationship. In the embodiments of this application, “simultaneously” means within the same time period, including situations where they are at the same moment.

[0157] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0158] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data processing system, characterized by The system comprises: a processor configured to obtain graph data, the graph data comprising feature values of a plurality of edges, the feature values of the plurality of edges being scalar data, and send the feature values of the plurality of edges to an accelerator; the accelerator configured to convert the received feature values of the plurality of edges into vector data to obtain a plurality of feature value vectors, and perform calculation on the plurality of feature value vectors according to calculation logic corresponding to a graph neighbor aggregation operation to obtain a first calculation result corresponding to the graph neighbor aggregation operation.

2. The system of claim 1, wherein, The accelerator is specifically configured to: extend the feature values of each edge in the received plurality of edges respectively to obtain a plurality of feature value vectors, each feature value vector in the plurality of feature value vectors being obtained by extending the feature values of an edge in the plurality of edges.

3. The system of claim 1, wherein: each feature value vector comprises the same elements; the number of elements included in each feature value vector is consistent with the number of elements in a vector supported by the accelerator.

4. The system according to any one of claims 1 to 3, characterized in that, The processor is further configured to send position information of the feature values of the plurality of edges to the accelerator, the position information being used to describe positions of the feature values of the plurality of edges in a sparse matrix corresponding to the graph data. The accelerator is specifically configured to perform calculation on the plurality of feature value vectors according to the calculation logic corresponding to the graph neighbor aggregation operation and the position information.

5. The system of claim 4, wherein, The accelerator is specifically configured to: perform calculation on the feature value vector of the feature values of each edge in the plurality of edges and a first target vector at a corresponding position in a first target matrix according to the calculation logic corresponding to the graph neighbor aggregation operation and the position information, to obtain a first vector calculation result corresponding to each edge; the first target matrix is used to indicate features of a plurality of nodes connected by the plurality of edges; and obtain the first calculation result corresponding to the graph neighbor aggregation operation according to the first vector calculation result corresponding to each edge.

6. The system of claim 5, wherein, An artificial intelligence (AI) model runs on the accelerator, the AI model comprising a first network layer and a second network layer, the first target matrix is used to indicate features of a plurality of nodes connected by the plurality of edges in the first network layer, and the first calculation result is a calculation result corresponding to a graph neighbor aggregation operation in the first network layer. The accelerator is further configured to: perform calculation on the feature value vector of the feature values of each edge in the plurality of edges and a second target vector at a corresponding position in a second target matrix according to the calculation logic corresponding to the graph neighbor aggregation operation and the position information, to obtain a second vector calculation result corresponding to each edge; the second target matrix is used to indicate features of the plurality of nodes connected by the plurality of edges in the second network layer; and obtain a second calculation result corresponding to a graph neighbor aggregation operation in the second network layer according to the second vector calculation result corresponding to each edge.

7. The system according to any one of claims 4 to 6, characterized in that, The accelerator is specifically configured to: generate a plurality of tasks, each task in the plurality of tasks comprising feature values of a part of the plurality of edges and position information of the feature values of the part of the plurality of edges. The feature values ​​of the edges included in each of the multiple tasks are converted into vector data to obtain at least one feature value vector corresponding to each task. Based on the computational logic corresponding to the graph nearest neighbor aggregation operation and the positional information of the feature values ​​included in each task, at least one feature value vector corresponding to each task is calculated to obtain the first computational result corresponding to the graph nearest neighbor aggregation operation.

8. The system of claim 7, wherein, The accelerator is specifically used for: The multiple tasks are generated based on the task identifiers corresponding to the multiple tasks, wherein the task identifiers are used to indicate the feature values ​​and location information included in the task; The processor is also used for: Add the task identifier to the feature values ​​and position information of the multiple edges; Send the task identifier to the accelerator.

9. The system of claim 8, wherein, The processor is specifically used for: Based on the available computing power of the accelerator, the task identifier is added to the feature values ​​and position information of the multiple edges.

10. The system of claim 8 or 9, characterized in that, The processor is specifically used for: The accelerator receives a task identifier, an index pointer array, an index array, and a data array corresponding to each of the plurality of tasks. The elements in the index pointer array are used to indicate the row of a feature value in a task in the sparse matrix, the elements in the index array are used to indicate the column of a feature value in a task in the sparse matrix, and the elements in the data array are the feature values ​​included in a task.

11. The system of any one of claims 1 to 10, wherein, The accelerator is a neural network processor (NPU).

12. A data processing system, characterized by include: The processor is configured to acquire graph data, which includes feature values ​​of multiple edges, the feature values ​​of the multiple edges being scalar data, and to send to the accelerator a task identifier corresponding to each of the multiple tasks, the feature values ​​included in each task, and the position information of the feature values ​​included in each task, the position information being used to indicate the position of the feature values ​​in the sparse matrix corresponding to the graph data. The accelerator is used to calculate the calculation result corresponding to the graph nearest neighbor aggregation operation based on the task identifier corresponding to each task, the feature value included in each task, and the position information of the feature value included in each task.

13. The system of claim 12, wherein, The processor is specifically used for: The accelerator receives a task identifier, an index pointer array, an index array, and a data array for each of the multiple tasks. The elements in the index pointer array indicate the rows of the feature values ​​included in a task in the sparse matrix, the elements in the index array indicate the columns of the feature values ​​included in a task in the sparse matrix, and the elements in the data array are the feature values ​​included in a task.

14. The system of claim 13, wherein, The accelerator is specifically used for: Based on the task identifier, index pointer array, index array, and data array corresponding to each task, multiple tasks are generated. Each of the multiple tasks includes the feature values ​​of some edges in the multiple edges, the row of the feature values ​​of the some edges in the sparse matrix corresponding to the graph data, and the column of the feature values ​​of the some edges in the sparse matrix. By performing the multiple tasks, the calculation results corresponding to the graph nearest neighbor aggregation operation are obtained.

15. The system of claim 14, wherein, The accelerator is specifically used for: The feature values ​​of the edges included in each of the multiple tasks are converted into vector data to obtain the feature value vector corresponding to each task. Based on the rows and columns of the sparse matrix containing the feature values ​​of each task, the feature value vector corresponding to each task is calculated to obtain the calculation result corresponding to the graph nearest neighbor aggregation operation.

16. A data processing method, characterized by, The method is applied to a data processing system, the data processing system including a processor and an accelerator; the method includes: The processor acquires graph data, which includes feature values ​​of multiple edges, and the feature values ​​of the multiple edges are scalar data. The processor sends the feature values ​​of the multiple edges to the accelerator; The accelerator converts the received feature values ​​of the multiple edges into vector data to obtain multiple feature value vectors; The accelerator calculates the multiple feature vectors according to the computation logic corresponding to the graph nearest neighbor aggregation operation, and obtains the first calculation result corresponding to the graph nearest neighbor aggregation operation.

17. The method of claim 16, wherein, The accelerator converts the received feature values ​​of the multiple edges into vector data, resulting in multiple feature value vectors, including: The accelerator expands the feature value of each of the received edges to obtain multiple feature value vectors. Each of the multiple feature value vectors is obtained by expanding the feature value of one of the edges.

18. The method according to claim 17, characterized in that: A single eigenvalue vector contains identical elements; The number of elements in each of the eigenvalue vectors is the same as the number of elements in the vectors that the accelerator supports processing.

19. The method according to any one of claims 16 to 18, characterized in that, The method further includes: The processor sends the position information of the feature values ​​of the multiple edges to the accelerator. The position information is used to describe the position of the feature values ​​of the multiple edges in the sparse matrix corresponding to the graph data. The accelerator calculates the multiple feature vectors according to the computation logic corresponding to the graph nearest neighbor aggregation operation, including: The accelerator calculates the multiple feature vectors based on the computational logic corresponding to the graph nearest neighbor aggregation operation and the location information.

20. The method of claim 19, wherein, The accelerator calculates the multiple feature vectors based on the computational logic corresponding to the graph nearest neighbor aggregation operation and the position information, including: The accelerator calculates the eigenvalue vector of each edge in the multiple edges and the corresponding first target vector in the first target matrix according to the calculation logic corresponding to the graph nearest neighbor aggregation operation and the position information, to obtain the first vector calculation result corresponding to each edge; the first target matrix is ​​used to indicate the features of the multiple nodes connected by the multiple edges; The accelerator calculates the first calculation result corresponding to the graph nearest neighbor aggregation operation based on the first vector calculation result corresponding to each edge.

21. The method of claim 20, wherein, The accelerator runs an artificial intelligence (AI) model, which includes a first network layer and a second network layer. The first target matrix is ​​used to indicate the characteristics of the multiple nodes connected by the multiple edges in the first network layer. The first calculation result is the calculation result corresponding to the graph nearest neighbor aggregation operation in the first network layer. The method further includes: The accelerator calculates the eigenvalue vector of each edge in the multiple edges and the corresponding second target vector in the second target matrix according to the calculation logic corresponding to the graph nearest neighbor aggregation operation and the position information, to obtain the second vector calculation result corresponding to each edge; the second target matrix is ​​used to indicate the features of the multiple nodes connected by the multiple edges in the second network layer; The accelerator calculates the second calculation result corresponding to the graph nearest neighbor aggregation operation in the second network layer based on the second vector calculation result corresponding to each edge.

22. The method according to any one of claims 19 to 21, characterized in that, The processor sends the feature values ​​of the multiple edges to the accelerator, including: The processor sends to the accelerator a task identifier, an index pointer array, an index array, and a data array corresponding to each of the multiple tasks. The elements in the index pointer array are used to indicate the row of a feature value in a task in the sparse matrix, the elements in the index array are used to indicate the column of a feature value in a task in the sparse matrix, and the elements in the data array are the feature values ​​included in a task.

23. A data processing method, characterized by, The method is applied to a data processing system, the data processing system including a processor and an accelerator; the method includes: The processor acquires graph data, which includes feature values ​​of multiple edges, and the feature values ​​of the multiple edges are scalar data. The processor sends to the accelerator the task identifier corresponding to each of the multiple tasks, the feature value included in each task, and the position information of the feature value included in each task. The position information is used to indicate the position of the feature value in the sparse matrix corresponding to the graph data. The accelerator calculates the calculation result corresponding to the graph nearest neighbor aggregation operation based on the task identifier corresponding to each task, the feature value included in each task, and the position information of the feature value included in each task.

24. The method of claim 23, wherein, The processor sends to the accelerator the task identifier corresponding to each of the multiple tasks, the feature values ​​included in each task, and the location information of the feature values ​​included in each task, including: The processor sends to the accelerator a task identifier, an index pointer array, an index array, and a data array corresponding to each of the multiple tasks. The elements in the index pointer array are used to indicate the rows of the feature values ​​included in a task in the sparse matrix, the elements in the index array are used to indicate the columns of the feature values ​​included in a task in the sparse matrix, and the elements in the data array are the feature values ​​included in a task.

25. The method of claim 24, wherein, The accelerator calculates the computation result corresponding to the graph nearest neighbor aggregation operation based on the task identifier corresponding to each task, the feature values ​​included in each task, and the position information of the feature values ​​included in each task, including: The accelerator converts the feature values ​​of the edges included in each of the multiple tasks into vector data to obtain the feature value vector corresponding to each task. The accelerator calculates the eigenvalue vector corresponding to each task based on the rows and columns of the sparse matrix containing the eigenvalues ​​included in each task, and obtains the calculation result corresponding to the graph nearest neighbor aggregation operation.

26. A computer program product comprising instructions, wherein: When it is run on at least one computing device, it causes the at least one computing device to perform the method as described in any one of claims 16 to 25.

Citation Information

Patent Citations

  • Graph neural network accelerator-based inference method of heterogeneous graph neural network

    CN117709463A

  • Heterogeneous graph data acceleration processing method based on heterogeneous graph neural network

    CN118536564A

  • Graph data processing method and device

    CN118736368A

  • Sparse matrix accelerated computing method and apparatus, device, and medium

    US20240211535A1