Relationship graph processing method, computing device and system

By transferring tensor calculation results between multiple processing units, the problem of low graph operation efficiency in relationship graph processing is solved, efficient relationship graph processing is achieved, and hardware costs are reduced.

CN118733243AActive Publication Date: 2024-10-01HUAWEI TECH CO LTD +1

Patent Information

Application Number
CN202310362942.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2024-10-01
Estimated Expiration
2043-03-29

AI Technical Summary

Technical Problem

Due to the characteristics of sparse matrices in relational graph processing, the storage locations of neighbor nodes of graph nodes in the memory are irregular, resulting in a low cache hit rate during graph operations, which in turn triggers a large number of random memory accesses and reduces computing efficiency.

Method used

By transferring tensor calculation results between multiple processing units, memory access is avoided, aggregation operations of graph node features are implemented, message passing is used instead of random memory access, processing efficiency is improved, and hardware costs are reduced.

Benefits of technology

It improves the efficiency of relationship graph processing, reduces random memory access, avoids the problem of low processing efficiency caused by random memory access, and realizes efficient graph operations without special hardware modules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733243A_ABST
    Figure CN118733243A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a relational graph processing method, a computing device and a system. The method comprises the following steps that: a processing unit executes a tensor calculation task of a first stage, wherein the tensor calculation task of the first stage comprises performing a first tensor operation on feature data of a graph node allocated to the processing unit; after the tensor calculation task of the first stage executed by the processing unit is finished, the processing unit sends a first tensor calculation result of the graph node obtained by executing the tensor calculation task of the first stage by the processing unit to the processing unit where the graph node taking the graph node as a neighbor node is located, and starts to execute the tensor calculation task of the second stage; and when the first processing unit allocated with the first graph node receives a first tensor calculation result of the second graph node sent by the second processing unit allocated with the second graph node, the first processing unit interrupts the tensor calculation task of the second stage and executes a feature aggregation operation. The method can efficiently process the relational graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a relationship graph processing method, a computing device and a system. Background Art

[0002] A relational graph is a data structure consisting of connected graph nodes (vertices) and edges, which can be used to represent information without a clear starting point or end point. The computational paradigm of relational graph processing presents mixed characteristics. The computational paradigm of relational graph processing can be divided into tensor operations (combination operations) and graph operations (aggregation operations) based on the regularity of the calculation. Among them, the graph operation is an aggregation operation of the features of two adjacent graph nodes in the calculation results generated by the tensor operation.

[0003] Currently, the calculation results generated by tensor operations are stored in memory. When performing graph operations, the calculation results are obtained from memory and aggregated. Since the adjacency matrix used to represent the relationship graph is a sparse matrix, the storage location of the neighbor nodes of the graph nodes in the relationship graph in the memory is irregular, which leads to a low cache hit rate of the graph node features during graph operations, resulting in a large number of random memory accesses, resulting in low computational efficiency of graph operations, and then low efficiency in graph processing. Summary of the invention

[0004] The embodiments of the present application provide a relationship graph processing method, a computing device, and a system, which have high relationship graph processing efficiency.

[0005] In a first aspect, a relationship graph processing method is provided, the method being applied to a computing device comprising a plurality of processing units, each of the plurality of processing units being assigned a graph node in a relationship graph, and different processing units being assigned different graph nodes; the method comprising: the processing unit executing a first-stage tensor computing task, the first-stage tensor computing task comprising performing a first tensor operation on feature data of a graph node assigned to the processing unit, to obtain a first tensor computing result of the graph node; after the processing unit completes the first-stage tensor computing task, the processing unit sends the first tensor computing result of the graph node obtained by executing the first-stage tensor computing task to a processing unit where the graph node having the graph node as a neighboring node is located. processing unit, and starts to execute the second stage of tensor calculation tasks; when the first processing unit assigned with the first graph node receives the first tensor calculation result of the second graph node sent by the second processing unit assigned with the second graph node, the first processing unit interrupts the second stage of tensor calculation tasks, and performs feature aggregation operations of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node to obtain the first aggregation result of the first graph node; wherein the second graph node is a neighbor node of the first graph node in the relationship graph; when the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node is completed, the first processing unit continues to execute the second stage of tensor calculation tasks.

[0006] A graph node (set as graph node B) having one or more graph nodes (set as graph node A) as a neighbor node means that the neighbor nodes of graph node B include graph node A, that is, graph node A is one or more neighbor nodes of graph node B. Among them, the first graph node is a graph node having the second graph node as a neighbor node, that is, the second graph node is one or more neighbor nodes of the first graph node.

[0007] In this method, after the tensor calculation task of a processing unit in a stage is completed, the tensor calculation results of the graph nodes generated by the tensor calculation tasks of this stage can be sent to the processing unit where the graph node with the graph node as a neighbor node is located, so that the processing unit can obtain the tensor calculation results of the neighbor nodes of the graph node without memory access, and then perform feature aggregation operations on the tensor calculation results of the graph node and the tensor calculation results of the graph nodes with the graph node as a neighbor node. In other words, this scheme realizes the graph operation in the relationship graph processing without memory access, avoiding the problems such as low processing efficiency caused by random memory access in the relationship graph processing. In other words, this scheme enables the processing unit to obtain the required tensor calculation results by passing the tensor calculation results through messages instead of random memory access, thereby improving the processing efficiency of the relationship graph.

[0008] Moreover, in this method, the tensor calculation results of the tensor calculation task of the previous stage can be transferred between processing units and the tensor calculation task of the current stage can be carried out simultaneously. When the processing unit is executing the tensor calculation task of the current node, if it receives the tensor calculation results of the neighboring nodes of its graph node in the previous stage, it can interrupt the tensor calculation task at any time and start to execute the graph operation (i.e., feature aggregation operation). After the graph operation is completed, the tensor calculation task can be resumed. In this way, the same hardware module can complete the tensor calculation task and the graph operation, without setting up two or more hardware modules, reducing the hardware cost.

[0009] In one possible implementation, the processing unit includes a computing module, a buffer, and a communication module, wherein a first tensor operation is performed on feature data of a graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node, including: the computing module of the processing unit performs a first tensor operation on the feature data of the graph node assigned to the processing unit, and outputs the obtained first tensor calculation result of the graph node to the buffer of the processing unit; the first tensor calculation result of the graph node obtained by the processing unit executing the first stage of the tensor calculation task is sent to the processing unit where the graph node with the graph node as a neighbor node is located, including: the communication module of the processing unit sends the first tensor calculation result of the graph node in the buffer of the processing unit to the processing unit where the graph node with the graph node as a neighbor node is located; performing a feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node includes: the computing module of the first processing unit receives the first tensor calculation result of the second graph node through the communication module of the first processing unit, obtains the first tensor calculation result of the first graph node from the buffer of the first processing unit, and performs a feature aggregation operation on the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node.

[0010] In this implementation, the tensor calculation results of the graph node calculated by the processing unit can be stored in the cache of the processing unit. After receiving the tensor calculation results of the graph node with the graph node as a neighbor node, the processing unit can obtain the tensor calculation results of the graph node from the cache, so that the tensor calculation results of the graph node and the tensor calculation results of the graph nodes with the graph node as a neighbor node can be obtained without accessing the memory, and feature aggregation operations can be performed on the tensor calculation results of the graph node and the tensor calculation results of the graph nodes with the graph node as a neighbor node.

[0011] In one possible implementation, before the processing unit executes the first stage of tensor computing tasks, the method also includes: dividing the tensor operations to be performed by the processing unit into N stages of tensor computing tasks, wherein the N stages of tensor computing tasks are executed sequentially by the processing unit, and the data volume of the output results of the tensor computing tasks of each stage is consistent with the space size of the buffer of the processing unit, and N is an integer greater than 1.

[0012] In this implementation, the tensor computing task can be divided into multiple stages for execution, thereby reducing the requirements on the computing performance and storage performance of the processing unit and saving hardware costs.

[0013] In one possible implementation, the tensor operation to be performed by the processing unit includes: using a weight matrix having M columns to update the feature data of the graph node assigned to the processing unit; M is an integer greater than 1; dividing the tensor operation to be performed by the processing unit into N stages of tensor calculation tasks includes: dividing the weight matrix into N sub-matrices having L columns, wherein the tensor calculation tasks of the N stages correspond one-to-one to the N sub-matrices, and M×L=N; performing a first tensor operation on the feature data of the graph node assigned to the processing unit includes: using the sub-matrix corresponding to the tensor calculation task of the first stage to update the feature data of the graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node.

[0014] In a possible implementation, the second processing unit is also assigned a third graph node in the relationship graph, and the third graph node is a neighbor node of the first graph node in the relationship graph; sending the first tensor calculation result of the graph node obtained by the processing unit executing the first stage of the tensor calculation task to the processing unit where the graph node with the graph node as a neighbor node is located includes: the second processing unit performs a feature aggregation operation on the first tensor calculation result of the second graph node and the first tensor calculation result of the third graph node to obtain pre-aggregation results of the second graph node and the third graph node; the second processing unit sends the pre-aggregation result to the first processing unit; performing a feature aggregation operation on the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node includes: performing a feature aggregation operation on the first tensor calculation result and the pre-aggregation result of the first graph node to obtain a first aggregation result of the first graph node.

[0015] In this implementation, if multiple graph nodes in a processing unit are neighbor nodes of graph nodes in other processing units, the tensor calculation results of the multiple graph nodes can be aggregated first, and then the aggregated results can be sent to other processing units, thereby saving the overhead of communication resources.

[0016] In one possible implementation, sending the first tensor calculation result of a graph node obtained by the processing unit executing the first-stage tensor calculation task to the processing unit where the graph node with the graph node as a neighbor node is located includes: the second processing unit confirms that the first tensor calculation result of the second graph node is the only information sent by the second processing unit to the first processing unit at the first moment; at the first moment, the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit.

[0017] Through this implementation, information transmission conflicts caused by sending multiple pieces of information to one processing unit through the same transmission path can be avoided, thereby improving the performance of information transmission between processing units.

[0018] In one possible implementation, each of the multiple processing units has P neighbor units, wherein the neighbor unit of each processing unit is a processing unit among the multiple processing units, a data path is provided between each processing unit and its neighbor unit, and P is an integer greater than 1; when the first processing unit is the neighbor unit of the second processing unit, the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit, including: the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit via the data path between the first processing unit and the second processing unit.

[0019] In one possible implementation, the computing device also includes a router; when the first processing unit is not a neighbor unit of the second processing unit, the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit, including: the second processing unit receives a forwarding unit indication from the router; the second processing unit sends the first tensor calculation result of the second graph node to the processing unit indicated by the forwarding unit indication, so as to send the first tensor calculation result of the second graph node to the first processing unit through the processing unit indicated by the forwarding unit indication.

[0020] In this implementation, the router may instruct the processing unit to send information to avoid transmission conflicts of the information.

[0021] In a possible implementation, the forwarding unit indication is generated by the router based on a routing table, wherein in the routing table, a next-hop processing unit of the forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit.

[0022] In this implementation, it is possible to avoid multiple processing units sending information to the same processing unit through the same forwarding unit, thereby avoiding information transmission conflicts during information forwarding and improving the performance of information transmission between processing units.

[0023] In a possible implementation, the method further includes: the router calculates the shortest path from each source processing unit to each destination processing unit and a single-step path set corresponding to the shortest path, to obtain multiple shortest paths and a single-step path set corresponding to each shortest path in the multiple shortest paths, wherein the source processing unit and the destination processing unit are different processing units in the multiple processing units, and the source processing unit is the transmission starting point of the tensor calculation result, and the destination processing unit is the transmission end point of the tensor calculation result; the router selects the single-step paths used to form the shortest path from the multiple single-step path sets in order of the path lengths of the multiple shortest paths from low to high and according to the principle that a next-hop processing unit of the forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit, so as to obtain a routing table.

[0024] In this implementation, the shortest path through the source processing unit and the target processing unit can be obtained, so that the information of the source processing unit can be transmitted to the target processing unit through the shortest path, thereby improving the transmission efficiency.

[0025] The shorter the path length of the shortest path, the fewer selectable processing units are used to constitute the shortest path. Therefore, the processing units that constitute the shortest path with a shorter path length are selected, and then the processing units that constitute the shortest path with a longer path length are selected, so that a routing table that can avoid information transmission conflicts can be efficiently obtained.

[0026] In a second aspect, a computing device is provided, comprising a plurality of processing units, wherein the plurality of processing units are assigned graph nodes in a relationship graph, and different processing units are assigned different graph nodes; the processing units are used to execute a first-stage tensor computing task, wherein the first-stage tensor computing task comprises performing a first tensor operation on feature data of the graph node assigned to the processing unit to obtain a first tensor computing result of the graph node; the processing unit is used to send the first tensor computing result of the graph node obtained by executing the first-stage tensor computing task of the processing unit to the processing unit where the graph node with the graph node as a neighbor node is located after the execution of the first-stage tensor computing task by the processing unit is completed, and start executing the second stage tensor calculation task; when the first processing unit assigned with the first graph node receives the first tensor calculation result of the second graph node sent by the second processing unit assigned with the second graph node, the first processing unit is used to interrupt the tensor calculation task of the second stage, and perform feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node to obtain the first aggregation result of the first graph node; wherein the second graph node is a neighbor node of the first graph node in the relationship graph; when the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node is completed, the first processing unit is used to continue to execute the tensor calculation task of the second stage.

[0027] In one possible implementation, the processing unit includes a computing module, a buffer, and a communication module, wherein the computing module of the processing unit is used to perform a first tensor operation on feature data of a graph node assigned to the processing unit, and output the obtained first tensor calculation result of the graph node to the buffer of the processing unit; the communication module of the processing unit is used to send the first tensor calculation result of the graph node in the buffer of the processing unit to the processing unit where the graph node with the graph node as a neighbor node is located; the computing module of the first processing unit is used to receive the first tensor calculation result of the second graph node through the communication module of the first processing unit, and obtain the first tensor calculation result of the first graph node from the buffer of the first processing unit, and perform feature aggregation operations on the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node.

[0028] In one possible implementation, the device also includes a division unit; the division unit is used to divide the tensor operation to be performed by the processing unit into N stages of tensor calculation tasks, wherein the N stages of tensor calculation tasks are executed in sequence by the processing unit, and the data volume of the output result of the tensor calculation task of each stage is consistent with the space size of the buffer of the processing unit, and N is an integer greater than 1.

[0029] In one possible implementation, the processing unit is used to use a weight matrix having M columns to perform feature update on feature data of a graph node assigned to the processing unit; M is an integer greater than 1; the partitioning unit is used to partition the weight matrix into N sub-matrices having L columns, wherein the tensor calculation tasks of the N stages correspond one-to-one to the N sub-matrices, and M×L=N; the processing unit is used to use the sub-matrix corresponding to the tensor calculation task of the first stage to perform feature update on the feature data of the graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node.

[0030] In a possible implementation, the second processing unit is also assigned a third graph node in the relationship graph, and the third graph node is a neighbor node of the first graph node in the relationship graph; the second processing unit is used to perform feature aggregation operations on the first tensor calculation result of the second graph node and the first tensor calculation result of the third graph node to obtain pre-aggregation results of the second graph node and the third graph node; the second processing unit is used to send the pre-aggregation results to the first processing unit; the first processing unit is used to perform feature aggregation operations on the first tensor calculation result and the pre-aggregation result of the first graph node to obtain the first aggregation result of the first graph node.

[0031] In one possible implementation, the second processing unit is used to confirm that the first tensor calculation result of the second graph node is the only information sent by the second processing unit to the first processing unit at the first moment; at the first moment, the second processing unit is used to send the first tensor calculation result of the second graph node to the first processing unit.

[0032] In one possible implementation, each of the multiple processing units has P neighbor units, wherein the neighbor unit of each processing unit is a processing unit among the multiple processing units, a data path is provided between each processing unit and its neighbor unit, and P is an integer greater than 1; when the first processing unit is the neighbor unit of the second processing unit, the second processing unit is used to send the first tensor calculation result of the second graph node to the first processing unit through the data path between the first processing unit and the second processing unit.

[0033] In one possible implementation, the computing device also includes a router; when the first processing unit is not a neighbor unit of the second processing unit, the second processing unit is used to receive a forwarding unit indication from the router; the second processing unit is used to send the first tensor calculation result of the second graph node to the processing unit indicated by the forwarding unit indication, so as to send the first tensor calculation result of the second graph node to the first processing unit through the processing unit indicated by the forwarding unit indication.

[0034] In a possible implementation, the forwarding unit indication is generated by the router based on a routing table, wherein in the routing table, a next-hop processing unit of the forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit.

[0035] In a possible implementation, the router is further used to: calculate the shortest path from each source processing unit to each destination processing unit and the single-step path set corresponding to the shortest path, obtain multiple shortest paths, and the single-step path set corresponding to each shortest path in the multiple shortest paths, wherein the source processing unit and the destination processing unit are different processing units in the multiple processing units, and the source processing unit is the transmission starting point of the tensor calculation result, and the destination processing unit is the transmission end point of the tensor calculation result; in accordance with the order of the path lengths of the multiple shortest paths from low to high, and in accordance with the principle that a next-hop processing unit of the forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit, select the single-step paths used to form the shortest path from the multiple single-step path sets in turn to obtain a routing table.

[0036] In a third aspect, a computing system is provided, comprising: a memory for storing feature data of graph nodes in a relationship graph; and the computing device provided in the second aspect.

[0037] In a fourth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device, the computing device performs the method provided in the first aspect.

[0038] According to a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device, the computing device executes the method provided in the first aspect.

[0039] The relationship graph processing method, computing device and system provided by the embodiment of the present application can enable the processing unit to obtain the tensor calculation results of the neighbor nodes of the graph node without memory access, and then perform feature aggregation operations on the tensor calculation results of the graph node and the tensor calculation results of the graph nodes with the graph node as the neighbor node. In other words, the scheme realizes the graph operation in the relationship graph processing without memory access, avoiding the problems such as low processing efficiency caused by random memory access in the relationship graph processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1A A schematic diagram of the time cost of related operations for processing a relationship graph;

[0041] Figure 1B A schematic diagram of cache hit rate for related operations processed by a relationship graph;

[0042] Figure 2 A schematic diagram of the execution time sequence of related operations processed by a relationship graph;

[0043] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0045] Figure 5 An execution time sequence of related operations of a relationship graph processing provided by an embodiment of the present application;

[0046] Figure 6 An execution flow of a relationship graph processing solution provided in an embodiment of the present application;

[0047] Fig. 7A A schematic diagram of a graph node allocation strategy provided in an embodiment of the present application;

[0048] Figure 7B A schematic diagram of a graph node allocation strategy provided in an embodiment of the present application;

[0049] Figure 7C A schematic diagram of a tensor computing task and a feature aggregation computing task provided in an embodiment of the present application;

[0050] Fig.7D A schematic diagram of a tensor computing task and a feature aggregation computing task provided in an embodiment of the present application;

[0051] Fig. 7E A schematic diagram of a tensor computing task and a feature aggregation computing task provided in an embodiment of the present application;

[0052] Figure 8 A schematic diagram of dividing tensor computing tasks provided in an embodiment of the present application;

[0053] Fig. 9 A schematic diagram of a network topology between processing units provided in an embodiment of the present application;

[0054] Fig.10 A schematic diagram of a network topology between processing units provided in an embodiment of the present application;

[0055] Fig.11 A schematic diagram of a routing table calculation provided in an embodiment of the present application;

[0056] Fig.12 A schematic diagram of a routing table calculation provided in an embodiment of the present application;

[0057] Fig.13 A schematic diagram of a routing table calculation provided in an embodiment of the present application;

[0058] Fig.14 A schematic diagram of a relationship graph processing solution provided in an embodiment of the present application;

[0059] Fig.15 A schematic diagram of a relationship graph processing solution provided in an embodiment of the present application;

[0060] Fig.16 A schematic diagram of the time cost of related operations of relationship graph processing in an embodiment of the present application;

[0061] Fig.17A Routing logic layout for a Cross-Bar topology FPGA chip;

[0062] Fig. 17B Routing logic layout for a 2-D Tours topology FPGA chip;

[0063] Fig. 17C Routing the logic layout for a 4-D hypercube topology FPGA chip;

[0064] Fig.18 A flowchart of a method for processing a relationship graph provided in an embodiment of the present application;

[0065] Fig.19 A schematic diagram of the structure of a computing device provided in an embodiment of the present application;

[0066] Fig. 20 A schematic diagram of the structure of a computing system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0067] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0068] In the description of this specification, "one embodiment" or "some embodiments" etc. means that one or more embodiments of the present application include a specific feature, structure or characteristic described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.

[0069] In addition, in the description of this specification, "plurality" means two or more than two.

[0070] Graph neural network (GNN) uses machine learning technology to learn the feature information of graph nodes and the relationship information between graph nodes on non-Euclidean graph structures. GNN combines the irregularity of traditional graph computing with the regularity of neural network computing. Therefore, the computing paradigm of GNN presents mixed characteristics, and can be divided into two stages: graph operation (aggregation) and tensor operation (combination) according to the regularity of calculation.

[0071] Among them, the graph operation is also called feature aggregation operation, which refers to the fusion of the feature data of the neighbor nodes of the graph node in the relationship graph into the feature data of the graph node. The feature data of the graph node can be referred to as the features of the graph node. The fusion of feature data of different graph nodes can be called feature aggregation. Exemplarily, feature data fusion can be achieved by feature addition. For example, the feature data of the graph node and the feature data of its neighbor nodes are added to obtain the aggregated feature data of the graph node.

[0072] Tensor operations include tensor calculations, which refers to multiplying the feature data of a graph node by a weight matrix to obtain updated feature data.

[0073] Table 1 lists the meanings of GNN related mathematical symbols. The vertices in Table 1 are the graph nodes in the relationship graph.

[0074] Table 1

[0075]

[0076]

[0077] Formula (1) shows the forward propagation process of the Ith layer of GNN:

[0078]

[0079] in, It is the output feature vector of vertex u at the lth layer and the input feature vector of vertex u at the (l+1)th layer. Aggregation(·) aggregates the neighbor features of target vertex u, and Combination(·) transforms the features of vertex u using a neural network.

[0080] Current computing devices used to process relational graphs, such as artificial intelligence (AI) accelerators, use a multi-core and multi-threaded parallel computing mode, which is suitable for calculating tensor operations of memory access rules in GNNs. However, in graph operations, the low cache hit rate of graph nodes causes a large number of random memory accesses, resulting in low overall efficiency of AI accelerators when performing GNN calculations.

[0081] Among them, Al accelerators are also called Al chips, which refer to chips specifically used for machine learning. Common Al accelerators include Chips, graphics processing unit (GPU), tensor processing unit (TPU), etc.

[0082] Figure 1A The figure shows the time required for combined computation and aggregate memory access when the same GPU processes different relationship graphs. Combined computation refers to tensor computation in tensor operations, aggregate computation refers to aggregate computation in graph operations, aggregate memory access refers to memory access in graph operations, and aggregate in aggregate memory access refers to aggregate computation of graph operations. CA, CT, PB, CS, FK, RD, YP, and AM represent different relationship graphs, respectively.

[0083] Figure 1B The figure shows the cache hit rates of tensor operations, preprocessing operations, and graph operations when the same GPU processes different graphs. Graph A1, graph A2, and graph A3 are different graphs.

[0084] In one solution, in order to solve the computational bottleneck caused by random memory access of graph operations, such as Figure 2As shown, a tensor computing processor and a graph aggregation processor are used to perform relationship graph processing tasks. The graph aggregation processor is used to perform graph operations, and the tensor computing processor is used to perform tensor operations. This solution requires a dedicated graph aggregation processor, which increases hardware costs. In addition, the tensor computing processor with fast computing speed needs to wait for the graph aggregation processor with slow computing speed. Therefore, this solution has limited improvement on the efficiency of relationship graph processing. Figure 2 In the figure, P(1), P(2), and P(3) represent tensor computation tasks at different stages, and P'(1) and P'(2) represent graph operation tasks at different stages.

[0085] In response to the above situation, an embodiment of the present application provides a relationship graph processing solution, which can eliminate random memory access of graph operations during the relationship graph processing process, thereby improving the processing efficiency of the relationship graph, and does not require a hardware module specifically for aggregation operations, thereby reducing hardware costs.

[0086] Among them, the relationship graph processing scheme is a scheme for fusing tensor operations and graph operations in GNN calculations. In this scheme, random memory access in graph operations is converted into message passing between processing units, that is, the range of memory access by processing units is replaced by communication between processing units. Exemplarily, a centralized router outside multiple processing units can convert the connection relationship of the relationship graph into non-blocking message passing information between processing units, so that the tensor calculation operations of each processing unit and the message passing of each processing unit can be synchronized during the relationship graph processing process.

[0087] Next, the relationship diagram processing solution provided in the embodiment of the present application is specifically introduced.

[0088] First, a computing device 100 that can be used to implement the relationship graph processing solution provided in the embodiment of the present application is introduced.

[0089] In some embodiments, the computing device 100 may be a dedicated accelerator system or a programmable hardware system for GNN reasoning, training, etc. The computing device may be implemented in the form of hardware.

[0090] In some embodiments, the computing device 100 may be implemented as a chip.

[0091] In some embodiments, Figure 3 FIG. 1 shows a possible structure of the computing device 100. Figure 3As shown, computing device 100 includes multiple processing units, such as processing unit 0, processing unit 1, processing unit 2, processing unit 3, processing unit 4, processing unit 5, processing unit 6, processing unit 7, processing unit 8, processing unit 9, processing unit 10, processing unit 11, processing unit 12, processing unit 13, processing unit 14, processing unit 15, etc.

[0092] In some embodiments, the computing device 100 may be implemented as a multi-core processor, and the processing unit on the computing device 100 may be a computing core in the multi-core processor. Figure 4 , the multi-core processor can be an AI chip, and accordingly, the processing unit can be an AI computing core.

[0093] In some embodiments, the processing unit may be a field programmable gate array (FPGA).

[0094] In some embodiments, the processing unit may be an application specific integrated circuit (ASIC).

[0095] In some embodiments, the system architecture of the computing device 100 adopts a distributed shared storage system (DSM) model with a memory access characteristic of non-uniform memory access (NUMA), that is, the off-chip memory corresponding to each processing unit is distributed in each processing unit, and the processing unit independently accesses the off-chip memory corresponding to the processing unit, and indirectly accesses the off-chip storage units corresponding to other processing units through the interconnection network between the processing units. In the embodiment of the present application, since the graph nodes in the relationship graph are assigned to multiple processing units, the off-chip memory of each processing unit is used to store the graph nodes assigned to the processing unit. Therefore, the benefits of using the DSM system are: (1) It can effectively reduce the computational coupling degree of graph node graph operations in each processing unit, better realize data parallelism, improve the local utilization of data, and allow the graph operations in each processing unit to proceed in an orderly manner; (2) The off-chip memory can provide higher bandwidth for each processing unit. If each processing unit can access the global memory in a symmetrical multiprocessing (SMP) architecture, although flexibility is increased, each processing unit will face heavy competition and long delays when accessing the shared memory during graph operations due to the shared access medium. The competition and delay faced by the shared memory are particularly obvious on graph nodes with more edges. This problem also exists in single-machine accelerators. For example, in memory (double data rate synchronous dynamic random access memory (DDR SDRAM) or high bandwidth memory (HBM)), each stack is divided into multiple independent memory channels, but the memory controller is allowed to globally address from any input port to any part of the memory through a crossbar switch. The overhead of this process is huge. The maximum throughput of the memory controller to access the address space of other channels is limited to 50% of the full bandwidth, which will cause serious performance loss to graph operations.

[0096] In some embodiments, the off-chip memory is used to store feature data of the graph nodes assigned to each processing unit, partial results of feature aggregation of the graph nodes, and a weight matrix used for updating the feature data.

[0097] In some embodiments, the off-chip memory may be a random access memory (DDR or HBM) or a non-volatile memory (eg, a solid state disk (SSD) or a hard disk disk (HHD)).

[0098] In some embodiments, Figure 3 As shown, each processing unit has a local buffer. The local buffer is used to temporarily store data that is about to start message transmission (such as tensor calculation results of the processing unit), and to receive tensor calculation results from other processing units for feature aggregation in the processing unit. Exemplarily, the local buffer can be an on-chip synchronous dynamic random access memory (SDRAM) or block random access memory (BRAM) on the processing unit.

[0099] In some embodiments, Figure 3 As shown, the computing device 100 further includes an edge data cache. The edge data cache is used to store feature data of edges in the relationship graph. Exemplarily, the edge data cache can be a random access memory (DDR or HBM) or a non-volatile memory (such as SSDHHD).

[0100] Each of the multiple processing units has P neighboring units, wherein the neighboring unit of each processing unit is a processing unit in the multiple processing units, and there is a data path between each processing unit and the neighboring unit of the processing unit, and P is an integer greater than 1. The data paths between the processing units constitute an interconnection network for connecting the processing units.

[0101] In some embodiments, the topology between the multiple processing units is an orthogonal topology, for example, the topology between the multiple processing units may be a butterfly topology, a cubic topology or an omega topology. Figure 3 Shown is a 4-dimensional hypercube topology.

[0102] like Figure 3 and Figure 4 As shown, there is a data path between each processing unit and four adjacent processing units, that is, each processing unit has four neighboring units.

[0103] In some embodiments, Figure 3 As shown, each processing unit has an off-chip memory exclusively used by the processing unit.

[0104] In some embodiments, Figure 3 As shown, computing device 100 also includes a centralized router for communication between processing units.

[0105] The local buffer of each processing unit can be accessed independently by the router. When the local buffer of the processing unit has a tensor calculation result to be sent, the router can send a message passing instruction to the processing unit. The message passing instruction indicates the data channel used for data transmission by the processing at the current moment. In one example, the message passing instruction includes two formats of instruction messages. Among them, the instruction message of one format includes: the identification of the processing unit where the target graph node is located (for example, the processing unit number), the storage address of the characteristic data of the target graph node in the local buffer of the processing unit, the edge coefficient, the identification of the processing unit where the source graph node is located, and the storage address of the characteristic data of the source graph node in the local buffer of the processing unit. Among them, the source graph node and the target graph node are graph nodes in the relationship graph, and the source graph node is the neighbor of the target graph node in the relationship graph. The instruction message of another format includes: the identification of the single-step path receiving unit and the identification of the single-step path sending unit. Among them, the single-step path refers to a one-step route, that is, one processing unit sends and another processing unit receives, and does not involve a third processing unit. The single-step path is the smallest component unit of the transmission path. A single-step path receiving unit refers to a processing unit that receives data in a single-step path, and a single-step path sending unit refers to a processing unit that sends data in a single-step path.

[0106] In some embodiments, the local buffer of the processing unit may be composed of an output data buffer, a neighbor data buffer, and an aggregate data buffer. That is, the local buffer may be divided into an output data buffer, a neighbor data buffer, and an aggregate data buffer. Among them, the output data buffer is used to store the tensor calculation results generated by the tensor calculation when the processing unit performs tensor calculations. When the output data buffer is filled, the processing unit may send the tensor calculation results to other processing units. Which processing units are specifically sent which tensor calculation results will be introduced below and will not be repeated here.

[0107] Among them, when the output data buffer is filled, the neighbor data buffer is used for the processing unit to store the tensor calculation results when executing the tensor calculation task of the next stage. That is, when the output data buffer is filled, the processing unit stores the generated tensor calculation results in the neighbor data buffer when executing the tensor calculation task of the next stage. Among them, when the neighbor data buffer is filled, and the tensor calculation results in the output data buffer (that is, the tensor calculation results generated by the tensor calculation task of the previous stage of the tensor calculation task that generates the tensor calculation results stored in the neighbor data buffer) are all sent to other processing units and the feature aggregation operation performed by this processing unit is completed, the output data buffer can be cleared. The cleared output data buffer can be used for the processing unit to store tensor calculation results when executing the tensor calculation task of the next stage.

[0108] For example, see Figure 5 , when the processing unit executes the tensor calculation task of the P(1) stage, it stores the tensor calculation results generated by the tensor calculation task of the P(1) stage in the output data buffer. Among them, the output data buffer is filled and the tensor calculation task of the P(1) stage is completed. If the neighbor data buffer has been cleared, the processing unit executes the tensor calculation task of the P(2) stage and stores the tensor calculation results generated by the tensor calculation task of the P(2) stage in the neighbor data buffer. If the neighbor data buffer is filled, the tensor calculation task of the P(2) stage is completed. If the tensor calculation results in the output data buffer (i.e., the tensor calculation results generated by the tensor calculation task of the P(1) stage) are all sent to other processing units and the feature aggregation operation performed by this processing unit is completed, the output data buffer can be cleared. The output data buffer is cleared, and the processing unit executes the tensor calculation task of the P(3) stage and stores the tensor calculation task of the P(3) stage in the output data buffer. And so on, and so on, the output data buffer and the neighbor data buffer are alternately used by the processing unit to store tensor calculation results. Among them, stage P(2) is the next stage of stage P(1), and stage P(3) is the next stage of stage P(2).

[0109] When the processing unit sends tensor calculation results to other processing units, the processing unit can also receive tensor calculation results from other processing units, and perform feature aggregation operations based on the tensor calculation results generated by the processing unit and the tensor calculation results received from other processing units. Specifically, the processing unit performs tensor calculations on the graph node C1 in the relationship graph to obtain the tensor calculation results of the graph node C1. The processing unit receives the tensor calculation results of the graph node C2 in the relationship graph from other processing units, where the graph node C2 is a neighbor node of the graph node C1 in the relationship graph. The processing unit then performs feature aggregation operations on the tensor calculation results of the graph node C1 and the tensor calculation results of the graph node C2 to obtain the feature aggregation results of the graph node C1. The processing unit can store the feature aggregation results of the graph node C1 in the aggregation data buffer. In other words, the aggregation data buffer of the processing unit is used to store the feature aggregation results generated by the processing unit performing feature aggregation operations.

[0110] More specifically, due to the limited computing and storage resources of the processing unit, the computing tasks assigned to the processing unit need to be tiled for processing. The execution of graph operations, that is, feature aggregation operations, needs to rely on the results of tensor computing tasks. Therefore, the tensor computing tasks assigned to the processing unit are divided into multiple independent tensor computing subtasks according to the space of the output data buffer. Among them, different tensor computing subtasks are executed at different stages. Therefore, the tensor computing subtasks are also called stage tensor computing tasks, and a tensor computing subtask is a tensor computing task at a certain stage. The size of the data volume of the tensor computing results obtained by the tensor computing tasks at each stage is equal to or less than the size of the space of the output data buffer. The space of the buffer refers to the storage capacity of the buffer, that is, the amount of data that the buffer can accommodate. The space sizes of the output data buffer, the neighbor data buffer, and the aggregation data buffer are equal.

[0111] The processing unit starts to execute the tensor calculation task of the first stage, and writes the calculated tensor calculation result into one of the output data buffer and the neighbor data buffer. Among them, each processing unit in the computing device 100 executes the tensor calculation task of the first graph node in parallel.

[0112] In some embodiments, while the processing unit starts to execute the tensor calculation task of the first phase, the router calculates the routing information and obtains the routing table. Among them, the graph nodes of the relationship graph can be assigned to multiple processing units according to the rows of the adjacency matrix of the relationship graph, and each processing unit is assigned to a graph node in one or more rows, and the graph nodes assigned to different processing units are different. The router can know which graph nodes are assigned to each processing unit by means of row modulus calculation, that is, obtain the processing unit where each graph node in the relationship graph is located. The processing unit where the graph node is located refers to the processing unit to which the graph node is assigned. The router can calculate the routing information according to the edge table. The edge table is used to indicate which graph nodes have connecting edges, that is, which graph nodes are the neighbor nodes of the graph node, and which graph node is the neighbor node of the graph node. Among them, the feature aggregation operation refers to aggregating the features of the neighbor nodes of the graph node and the features of the graph node. Therefore, the processing unit needs to send the tensor calculation results of the graph node calculated by it to the processing unit where the graph node with the graph node as the neighbor node is located. For example, if graph node C1 is a neighbor node of graph node C2, the processing unit where graph node C1 is located will send the tensor calculation result of graph node C1 to the processing unit where graph node C2 is located. Routing information is used to indicate to which processing unit the processing unit needs to send the tensor calculation result. In other words, routing information includes converting the tensor calculation results that satisfy the data dependency of graph aggregation operations (i.e., the features of some neighbor nodes that have been calculated) into the form of message passing between processing units through routing calculation for implicit communication in the later stage, so as to improve the data access efficiency and data reuse rate within the chip.

[0113] After the processing unit completes the first stage of tensor calculation tasks, one of the processing unit's output data buffer and neighbor data buffer is filled. That is, when the processing unit performs tensor calculation tasks, it stores the tensor calculation results in one of the output data buffer and neighbor data buffer, thereby eliminating the need to write the tensor calculation results to the off-chip memory, saving data writing time.

[0114] After the processing unit completes the tensor calculation task of the first stage, it can send the tensor calculation result of the graph node to the processing unit where the graph node with the graph node as a neighbor node is located. Each processing unit can send the tensor calculation results calculated by itself to the corresponding processing unit. In this way, after the tensor calculation task of the first stage is completed, the processing unit enters the first stage of tensor calculation result transmission and aggregation. Among them, the transmission and aggregation of tensor calculation results is also called the aggregation memory access stage, which consists of the tensor calculation result transmission process and the tensor calculation result aggregation operation. During the transmission of tensor calculation results, the processing unit sends or receives data, which does not affect the execution of the tensor calculation task. Therefore, if Figure 5 As shown, for each processing unit, the tensor calculation result transmission and the tensor calculation task can be executed in parallel. Among them, the tensor calculation result transmitted in parallel with the tensor calculation task is the tensor calculation result of the tensor calculation task in the previous stage of the tensor calculation task. Figure 5 , the tensor calculation result transmission process of stage P'(1) is parallel to the tensor calculation task execution process of stage P(2), and the tensor calculation result transmitted in P'(1) is the tensor calculation result obtained by the tensor calculation task of stage P(1). The tensor calculation result transmission process of stage P'(2) is parallel to the tensor calculation task execution of stage P(3), and the tensor calculation result transmitted in P'(2) is the tensor calculation result obtained by the tensor calculation task of stage P(2).

[0115] See also Figure 5 After the processing unit completes the tensor calculation task of the first stage (i.e., P(1)), it can continue to execute the tensor calculation task of the second stage (i.e., P(2)). When executing the tensor calculation task of the second stage, the calculated tensor calculation result can be output to the other one of the output data buffer and the neighbor data buffer, i.e., the unfilled buffer in the output data buffer and the neighbor data buffer.

[0116] like Figure 5As shown, during the execution of the second phase of the tensor calculation task, after receiving the tensor calculation results of the neighboring nodes of the graph node assigned to the processing unit, the processing unit can interrupt the tensor calculation task and perform the feature aggregation operation of the graph node. The feature aggregation operation can also be called aggregation calculation.

[0117] More specifically, during the execution of a tensor computation task in a stage (e.g., stage P(2)), the output data buffer or the neighbor data buffer stores the tensor computation results generated in the previous stage (e.g., stage P(1)). At this time, the router determines that message passing is required, so the router sends a message passing instruction to each processing unit, instructing each processing unit to send tensor computation results to other processing units. For example, graph node C1 is a neighbor node of graph node C2, the processing unit where graph node C1 is located is processing unit 1 (i.e., graph node C1 is assigned to processing unit 1), and the processing unit where graph node C2 is located is processing unit 2 (i.e., graph node C2 is assigned to processing unit 2). Then processing unit 1 sends the tensor computation result of graph node C1 to processing unit 2.

[0118] In some embodiments, the processing unit further has a transmission register group, a channel register group, and a routing information receiver. The transmission register group includes P transmission registers, and the channel register group includes P channel registers. As described above, the processing unit has P neighboring units, and there is a data channel between the processing unit and each neighboring unit, so that the processing unit has P data channels. The P transmission registers in the transmission register group of the processing unit correspond to the P data channels one by one, and the P channel registers in the channel register group of the processing unit correspond to the P data channels one by one.

[0119] The transmission register is used to store data to be sent and received through its corresponding transmission channel; the channel register is used to temporarily store messages sent to its corresponding data channel.

[0120] The routing information receiver is used to decode the message transmission instruction sent by the router to the processing unit so that the processing unit executes the message transmission instruction, for example, the processing unit should latch data from which data channel of the input and write the latched data to which channel for output. The data source of the message transmission indicated by the message transmission instruction is the local buffer of the processing unit, specifically the buffer (output data buffer or neighbor data buffer) storing the tensor calculation results generated by the tensor calculation task that has just ended.

[0121] The message sent by the router to the processing unit is a command queue, which may include command messages in two formats.

[0122] First, the router sends a command message in the first format of the two formats to the processing unit. As mentioned above, the command message in the first format includes: the identifier of the processing unit where the target graph node is located, the storage address of the characteristic data of the target graph node in the local buffer of the processing unit, the edge coefficient, the identifier of the processing unit where the source graph node is located, and the storage address of the characteristic data of the source graph node in the local buffer of the processing unit. The source graph node and the target graph node are graph nodes in the relationship graph, and the source graph node is a neighbor of the target graph node in the relationship graph.

[0123] Among them, before the processing unit sends the tensor calculation result to other processing units, the processing unit can perform feature pre-aggregation. For example, the nodes assigned to processing unit 1 include graph node C1 and graph node C3, and graph node C1 and graph node C3 are both neighbor nodes of graph node C2. Processing unit 1 can first aggregate the tensor calculation result of graph node C1 and the tensor calculation result of graph node C3 to obtain a pre-aggregation result. Then, the pre-aggregation result is used as a message to be transmitted to be sent to processing unit 2 where graph node C2 is located. In this way, communication resources can be received and data transmission efficiency can be improved.

[0124] The message to be sent is written into the transmission register of the processing unit, and the message is ready to be sent. The message carries the calculation result of the graph node tensor. After each transmission cycle, the routing receiver in each AI computing core will receive a message instruction in the second format of the above two formats sent by the router. Among them, the instruction message in the second format includes: the identifier of the single-step path receiving unit and the identifier of the single-step path sending unit. From then on, the processing unit determines the message message received from the channel register of the processing unit corresponding to the receiving unit identifier at the current moment based on the single-step routing receiving unit identifier, and the processing unit can store the received message message in the transmission register of this processing unit. Then, based on the single-step routing sending unit identifier, the message currently temporarily stored in the transmission register is written into the channel register of the processing unit corresponding to the single-step routing sending unit identifier for sending in the next transmission cycle.

[0125] While executing the tensor calculation task of the current stage (e.g., stage P(2)), the processing unit checks the message information of each message in the transmission register. The message information includes the identifier of the destination processing unit (i.e., the destination of the message information) and the storage address of the characteristic data of the target graph node in the local buffer of the processing unit. If the destination processing unit is the processing unit that currently receives the message message, it means that the message message has been delivered to the destination. The characteristic data of the target graph node is obtained from the buffer (output data buffer or neighbor data buffer) that stores the tensor calculation task of the previous stage (e.g., stage P(1)). The message message includes the storage address of the characteristic data of the target graph node in the local buffer of the processing unit. The processing unit can obtain the characteristic data of the target graph node from the buffer that stores the tensor calculation task of the previous stage according to the storage address of the characteristic data of the target graph node in the local buffer of the processing unit, that is, the tensor calculation result obtained by the tensor calculation task of the previous stage. In addition, the processing unit extracts the tensor calculation result of the source graph node from the message message. As described above, the target graph node is a neighbor node of the source graph node in the relationship graph. Then, an aggregation operation or aggregation calculation is performed on the tensor calculation results of the target graph nodes and the tensor calculation results of the source graph nodes to obtain the aggregation results of the feature data of the target graph nodes.

[0126] Exemplarily, if the graph nodes assigned by the processing unit include neighbor nodes of the target graph node, the processing unit may first perform an aggregation operation on the tensor calculation result of the target graph node and the tensor calculation results of the neighbor nodes of the target graph node assigned by the processing unit to obtain a pre-aggregated result of the tensor calculation result of the target graph node. In the buffer of the processing unit, the tensor calculation result of the target graph node is updated to the pre-aggregated result of the tensor calculation result of the target graph node, that is, the pre-aggregated result of the tensor calculation result of the target graph node is stored at the storage address where the tensor calculation result of the target graph node is located. In this example, when it is necessary to perform an aggregation operation with the tensor calculation result of the source graph node in the message, the processing unit obtains the pre-aggregated result of the tensor calculation result of the target graph node from the buffer, and performs an aggregation operation or aggregation calculation on the pre-aggregated result of the tensor calculation result of the target graph node and the tensor calculation result of the source graph node to obtain the aggregated result of the feature data of the target graph node.

[0127] If the tensor calculation result of the target graph node and the tensor calculation results of all the neighboring nodes of the target graph node have completed feature aggregation, the aggregation result of the feature data of the target graph node is written to the aggregation data buffer. If the tensor calculation result of the target graph node has not yet completed feature aggregation with the tensor calculation results of all the neighboring nodes of the target graph node, the aggregation result of the feature data of the target graph node currently obtained is stored in the storage address of the tensor calculation result of the target graph node, that is, the data stored at the storage address is updated from the tensor calculation result of the target graph node or the pre-aggregation result of the tensor calculation result of the target graph node to the aggregation result of the feature data of the target graph node, waiting for the aggregation operation with the tensor calculation results of other neighboring nodes of the target graph node. Among them, the other neighboring nodes here refer to the graph nodes that have not yet performed feature data aggregation (i.e., tensor calculation result aggregation) with the target graph node.

[0128] Among them, Figure 5 As shown, when the processing unit needs to perform an aggregation operation on the target graph node (for example, an aggregation operation of the tensor calculation result or pre-aggregation result of the target graph node and the tensor calculation result of the source graph node), the processing unit interrupts the currently executed tensor calculation task and starts to execute the aggregation operation of the target graph node. After the aggregation operation of the target graph node is completed, the execution of the tensor calculation task is resumed. When the processing unit receives the tensor calculation results of other neighboring nodes of the target graph node and needs to perform the aggregation operation on the target graph node again, the processing unit interrupts the currently executed tensor calculation task again and starts to execute the aggregation operation of the target graph node. After the aggregation operation of the target graph node is completed, the execution of the tensor calculation task is resumed. In this way, whenever a message message with the destination as the current processing unit is received, the aggregation operation of the graph node can be performed without storing the message information, so that there is no need for random access to the memory or cache when performing the aggregation operation of the graph node.

[0129] The processing unit determines whether the aggregation operation of all the graph nodes assigned to it is completed, wherein the completion of the aggregation of the graph nodes means that the tensor calculation results of the graph node and the tensor calculation results of all the neighboring nodes of the graph node have been aggregated. If the aggregation operation of all the graph nodes assigned to the processing unit has been completed, that is, the tensor calculation result transmission and aggregation of the current stage of the processing unit (for example, stage P'(1)) are completed, then the aggregation results of the graph nodes can be output to the off-chip memory. Then, the buffer (that is, the output data buffer or the neighbor data buffer) storing the tensor calculation results of the previous stage or the aggregation results corresponding to the tensor calculation results of the previous stage can be cleared, so that the cleared buffer can be used for the tensor calculation tasks of the next stage. The aggregation buffer can also be cleared, so that the cleared aggregation buffer can be used for the aggregation operation of the graph nodes in the transmission and aggregation of the tensor calculation results of the next stage.

[0130] If the aggregation operation of one or more graph nodes assigned to the processing unit has not been completed, that is, the transmission and aggregation of the tensor calculation results in the current stage have not been completed, then continue to wait for the message whose destination is the processing unit to execute the aggregation operation of the graph nodes where the aggregation operation has not been completed.

[0131] If the aggregation operations of all graph nodes assigned to each processing unit have been completed (that is, the transmission and aggregation of tensor calculation results of the current stage have not yet ended), and the tensor calculation tasks of the current stage executed by each processing unit have also been completed, then the processing unit can execute the tensor calculation tasks of the next stage and start the transmission and aggregation of tensor calculation results of the next stage. Figure 5 , assuming that the transmission and aggregation of the tensor calculation results of stage P'(1) is completed, and the tensor calculation task of stage P(2) is also completed, then the processing unit can start the transmission and aggregation of the tensor calculation results of stage P'(2), and start executing the tensor calculation task of stage P(3). Among them, the tensor calculation results transmitted in stage P'(2) are the tensor calculation results generated by the tensor calculation task of stage P(2).

[0132] Through the above scheme, for each processing unit, the local buffers in all processing units are implicitly accessed through message passing to meet the data dependencies of the local graph node feature aggregation calculation. The message passing process is synchronized with the tensor calculation operation of the processing unit memory. Therefore, when the routing efficiency of message passing is high enough, a sufficiently large bandwidth can be provided for message passing between processing units, so that the message passing speed is fast and the data dependencies of the graph node feature aggregation calculation of each processing node can be met in time. While eliminating the delay caused by random memory access, the execution efficiency of graph operations is improved. In particular, when the time required for message passing for graph operations is less than the time required for the execution of tensor calculation tasks, the message passing time of graph operations can be completely hidden by tensor calculation tasks.

[0133] In addition, when the topological structure between the processing units in the computing device 100 is an orthogonal topological structure, such as Figure 4 As shown, each processing unit can transmit messages (send or receive messages) with the four processing units connected to the processing unit through the switch. In the embodiment of the present application, the message interaction between the processing units complies with the following rules.

[0134] Receiving rules: At the same time, a processing unit can only receive one message sent from each processing unit connected to it. A processing unit is connected to 4 processing units, so it can receive four messages from different processing units at the same time).

[0135] Sending rules: At the same time, a processing unit can only send one message to each processing unit connected to it. If a processing unit is connected to four processing units, then at the same time, a processing unit can send four messages to four different processing units.

[0136] When the storage processing unit does not meet the above sending rule or receiving rule at a certain moment, it is considered that there is a routing conflict. The necessary condition for the conflict to exist is that there is a processing unit with the same destination in multiple messages to be sent within a single processing unit.

[0137] To avoid the above routing conflicts, the router can generate routing tables based on the following rules:

[0138] A next-hop processing unit of a forwarding unit for message transmission (i.e., a processing unit for message forwarding) corresponds to at most one previous-hop processing unit of the forwarding unit. That is, two or more processing units cannot send messages to the same processing unit through one processing unit.

[0139] In some embodiments, the router may calculate the routing table through the following scheme.

[0140] a) Swap the order of sending the tensor calculation results of the graph nodes in the processing unit until each processing unit sends a message to the interconnected processing unit at the same time when the message transmission is turned on, so as to avoid write conflicts on the channel register when the message starts to be sent. In other words, it is necessary to ensure that a processing unit only sends one message to a destination processing unit at a time.

[0141] b), calculate the shortest path and single-step path set from each source processing unit to each destination processing unit in the orthogonal topology through XOR operation. Wherein, the source processing unit refers to the processing unit in the data sender, and the destination processing unit is the processing unit as the data receiver. That is, the source processing unit is the transmission starting point of the message message carrying the tensor calculation result, and the destination processing unit is the transmission end point of the message message carrying the tensor calculation result. Wherein, the shortest path from a source processing unit to a destination processing unit refers to the path with the shortest length among all paths from the original processing unit to the destination processing unit. Wherein, the path length is positively correlated with the number of processing units through which the message passes, that is, the more the number of processing units through which the message flows, the longer the path. There are multiple source processing units and multiple destination processing units in the computing device 100, so there are multiple shortest paths. The single-step path set from a source processing unit to a destination processing unit refers to the set of selectable single-step paths that constitute the shortest path from the source processing unit to the destination processing unit, that is, the single-step path that constitutes the shortest path can be selected from the single-step path set. All the single-step paths in the single-step path set can be used as candidate single-step paths actually used for message transmission.

[0142] c) selecting the single-step paths constituting the shortest path from the path set corresponding to the shortest path in order of the path lengths of the multiple shortest paths from low to high, and after the selection of the current shortest path is completed, deleting the single-step paths having the above-mentioned routing conflict with the single-step path selected for the current shortest path from the path sets corresponding to other shortest paths.

[0143] d), determine whether the next hop of the single-step path selected for a certain shortest path is the destination processing unit. If it is the destination processing unit, terminate the selection of the shortest path, thereby obtaining the single-step path that ultimately constitutes the shortest path and obtaining the path actually used for message transmission. If it is not the destination processing unit, return to step c), and select the single-step path that constitutes the shortest path again.

[0144] In this way, a routing table is obtained for instructing a processing unit to send a message (i.e., a tensor calculation result) to other processing units. Based on the routing table, when a processing unit transmits a tensor calculation result, the router can send a message instruction in the second format to the processing unit to instruct the processing unit to send or forward the message.

[0145] The above examples introduce a computing device 100 that can be used to implement the relationship graph processing solution provided in the embodiment of the present application, as well as the implementation methods and functions of each component included in the computing device 100. Next, in conjunction with the computing device 100, the execution flow of the relationship graph processing solution provided in the embodiment of the present application is introduced.

[0146] See also Figure 6In step 601, the graph nodes in the relationship graph to be processed may be allocated to multiple processing units in the computing device 100. Each processing unit may be allocated to at least one processing unit, and different processing units may be allocated to different graph nodes, that is, a graph node in the relationship graph is allocated to only one processing unit. In some embodiments, step 601 may be performed by a general-purpose processor (e.g., a central processing unit (CPU)) of a computing device or computing system in which the computing device 100 is located.

[0147] In some embodiments, the graph nodes in the relationship graph can be allocated to multiple processing units according to the following graph node average distribution strategy. That is to say, the graph nodes in the relationship graph are evenly distributed to multiple processing units. In one example, it can be set that there are 3 processing units, namely processing unit B1, processing unit B2, and processing unit B3. There are 21 graph nodes in the relationship graph to be processed, namely graph node C0, graph node C1, graph node C2, graph node C3, graph node C4, graph node C5, graph node C6, graph node C7, graph node C8, graph node C9, graph node C10, graph node C11, graph node C12, graph node C13, graph node C14, graph node C15, graph node C16, graph node C17, graph node C18, graph node C19, and graph node C20. See. Fig. 7A , the 21 graph nodes can be evenly distributed to 3 processing units, and each processing unit is allocated to 7 of the 21 graph nodes. Fig. 7A In the figure, processing unit B1, processing unit B2, and processing unit B3 are represented by oblique line patterns, vertical line patterns, and horizontal line patterns, respectively. Accordingly, the graph nodes located in the area filled with oblique line patterns are graph nodes assigned to processing unit B1, the graph nodes located in the area filled with vertical line patterns are graph nodes assigned to processing unit B2, and the graph nodes located in the area filled with horizontal line patterns are graph nodes assigned to processing unit B3.

[0148] In some embodiments, the graph nodes in the relationship graph can be allocated to multiple processing units according to the graph node allocation strategy based on the adjacency matrix of the relationship graph. Specifically, if Q processing units are set, the adjacency matrix of the relationship graph can be divided into Q parts by column, and the Q parts are allocated to Q processing units, with each processing unit allocated one part. Among them, the graph nodes in the part allocated to the processing unit are the graph nodes allocated to the processing unit. In an example, it can be set that there are 3 processing units, namely processing unit B1, processing unit B2, and processing unit B3. Figure 7B As shown, the adjacency matrix of the relationship graph is divided into three parts by column, and the three parts are assigned to three processing units, with each processing unit assigned one part. Figure 7B In the figure, processing unit B1, processing unit B2, and processing unit B3 are represented by oblique line patterns, vertical line patterns, and horizontal line patterns, respectively. Accordingly, the graph nodes located in the area filled with oblique line patterns are graph nodes assigned to processing unit B1, the graph nodes located in the area filled with vertical line patterns are graph nodes assigned to processing unit B2, and the graph nodes located in the area filled with horizontal line patterns are graph nodes assigned to processing unit B3.

[0149] For the convenience of description, the graph node assigned to the processing unit can be referred to as the graph node of the processing unit. The feature data of the graph node of the processing unit can be stored in the off-chip memory of the processing unit. The processing unit is used to perform tensor calculation and feature aggregation on its graph node. That is, the processing unit performs the tensor calculation task and feature aggregation task corresponding to its graph node. Among them, feature aggregation refers to the fusion of the feature data of the adjacent nodes of the graph node into the features of the graph node.

[0150] Since the computing resources and storage resources of a single processing unit are limited, in step 601, the tensor computing task to be performed by each processing unit can also be divided into multiple tensor subtasks. As mentioned above, for the same processing unit, multiple tensor subtasks are tensor tasks performed at different time stages. In other words, each processing unit can divide the tensor computing task into multiple cycles for execution. Among them, the feature aggregation computing task (i.e., the graph operation task) is also divided into corresponding stage tasks.

[0151] In some embodiments, assuming there are three processing units, the tensor computing tasks to be performed by each processing unit are divided into tasks to be performed in three time phases. Figure 7B Taking the graph node allocation result shown in the figure as an example, the tensor calculation tasks and feature aggregation calculation tasks in the first stage are as follows Figure 7C As shown in Figure 1, processing unit B3 performs tensor calculation and aggregation calculation in the horizontal line area, processing unit B3 performs tensor calculation and aggregation calculation in the vertical line area, and processing unit B1 performs tensor calculation and aggregation calculation in the oblique line area. Each processing unit stores the aggregation calculation results of the first stage in the aggregation buffer. The tensor calculation tasks and feature aggregation calculation tasks of the second stage are shown in Figure 1. Fig.7DAs shown, the calculation window of processing unit B3 slides downward along the adjacency matrix in a loop, and uses the features stored locally in the processing unit to calculate the node aggregation of the next area of ​​the graph. After the calculation is completed, the aggregated result is sent to processing unit B2. Processing unit B2 reads its local aggregation data buffer and accumulates the features of the graph nodes sent by processing unit B3. When processing unit B3 performs the above operation, the calculation window of processing unit B2 slides downward along the adjacency matrix in a loop, and uses the features stored locally to calculate the node aggregation of the next area. After the calculation is completed, the aggregated part is sent to processing unit B1. Processing unit B1 reads the local aggregation buffer and accumulates the node aggregation features sent by processing unit B2. Processing unit B1 also performs similar operations as described above. The tensor calculation tasks and feature aggregation calculation tasks of the third stage are as follows. Fig. 7E As shown in the figure, similar to the second stage, each processing unit continues to slide the calculation window, processing unit B3 sends the aggregated result to processing unit B1, the calculation result of processing unit B2 is sent to processing unit B3, and processing unit B1 sends it to processing unit B2. At this point, all processing units have traversed all adjacency matrices and completed the graph aggregation operation. The aggregation buffer in each processing unit saves the aggregated node features.

[0152] As mentioned above, tensor calculation is specifically to multiply the feature data of the graph node by the weight matrix. The tensor calculation task can be divided into tensor calculation tasks executed in multiple time stages according to the columns of the weight matrix. Among them, the tensor calculation task executed in each time stage is specifically to multiply the feature data of the graph node by the column in the weight matrix corresponding to the time stage.

[0153] In an example, Figure 8 As shown, the weight matrix W used for tensor calculation has N columns, where N is an integer greater than 1. The tensor calculation task can be divided into tensor calculation tasks executed in N time stages, that is, divided into tensor calculation tasks in stages P(1), P(2), ..., P(N). Among them, the tensor calculation task to be executed in each time stage corresponds to 1 column in the weight matrix W.

[0154] As mentioned above, the tensor calculation results generated by the tensor calculation tasks of each stage need to be transmitted and aggregated (i.e., feature aggregation of graph nodes). Therefore, each stage of the tensor calculation task corresponds to a stage of tensor calculation result transmission and aggregation tasks. The tensor result transmission and aggregation tasks include transmitting the tensor calculation results generated by the corresponding tensor calculation tasks, and aggregating the tensor calculation results generated by the corresponding tensor calculation tasks.

[0155] Among them, when performing a stage of tensor calculation tasks, the calculated tensor calculation results can be input into one of the output data buffer and the adjacent data buffer. The other of the output data buffer and the adjacent data buffer stores the tensor calculation tasks of the previous stage, which can be used for data reuse, so there is no need to write the tensor calculation results to the off-chip memory. Among them, the data reuse operation includes: performing feature aggregation calculations on graph nodes for some tensor calculation results that meet the data requirements of the feature aggregation stage. After each tensor calculation stage P(x) is calculated, the corresponding P'(x) aggregation message transmission and calculation are required. The condition for the completion of P'(x) is that all processing units complete the message transmission for the entire graph or all processing units traverse and calculate the entire relationship graph. Here, P(x) is Figure 8 Any of P(1), P(2), ..., P(N) shown, correspondingly, P'(x) Figure 8 Any one of P'(1), P'(2), ..., P'(N) shown, and corresponds to P(x).

[0156] In a specific example, take the adjacency matrix A, tensor X, and weight matrix W of the relationship graph to be processed (i.e., the input relationship graph) as an example. Among them, the tensor is the feature matrix of the graph node. Assuming there are K processing units, the entire tensor calculation task divides the tensor X into K tensor calculation tasks by row (i.e., the graph node is divided into K parts) and assigned to each processing unit, and the weight matrix W is shared among the processing units. The tensor calculation task assigned to each processing unit is divided into N independent subtasks, that is, the tensor calculation task assigned to each processing unit is divided into N time stages for execution. Each subtask outputs M columns of Z (=XW), where M depends on the size of the buffer (e.g., output data buffer) of the processing unit. The router reads the adjacency matrix A and decodes the source and target index numbers into the number of the source processing unit and the number of the destination processing unit.

[0157] After completing the assignment of graph nodes and the division of tensor calculation tasks, step 602a can be performed, where each processing unit performs the tensor calculation task of the P(1) stage. The tensor calculation task of the P(1) stage includes performing tensor operations on the feature data of the graph nodes assigned to the processing unit to obtain the tensor calculation results of the graph nodes of the P(1) stage. The P(1) stage is the first stage.

[0158] While the processing unit executes step 602a, the router may execute step 602b to calculate routing information according to the adjacency matrix A. When the processing unit in the computing device 100 adopts an orthogonal topology structure, in step 602b, a conflict-free routing calculation based on the orthogonal topology is performed. The routing information may be recorded as a routing table. The specific implementation process of step 602b will be described below and will not be repeated here.

[0159] The processing unit can be set to output the tensor calculation results of the P(1) stage to the output data buffer when the tensor calculation task of the P(1) stage is completed. When the tensor calculation task of the P(1) stage is completed, the output data buffer is filled. The output data buffer can be used for data reuse. For example, the tensor calculation results of the graph nodes in the output data buffer are sent to the processing unit where the graph nodes with the graph nodes as neighbor nodes are located. Since the neighbor data buffer has no data storage, it is in an empty state. Therefore, if Figure 5 As shown, when the tensor calculation task of the P(1) stage is completed, the processing unit can then use the neighbor buffer to execute the tensor calculation task of the P(2) stage, that is, the tensor calculation results generated by the tensor calculation task of the P(2) stage are output to the neighbor data buffer.

[0160] Specifically, see Figure 6 After step 602a is completed, the processing unit can execute step 603 and start executing the transmission task in the transmission and aggregation task of the tensor calculation results of the P'(n) stage, that is, the processing unit where the graph node is located sends the tensor calculation result of the P(n) stage of the graph node to the processing unit where the graph node with the graph node as a neighbor node is located.

[0161] The processing unit may execute step 604 to determine whether a tensor calculation result of a neighboring node is received, wherein the neighboring node is a neighboring node of the graph node of the processing unit. The tensor calculation result here refers to the tensor calculation result of the P(n) stage.

[0162] If the tensor calculation results of the neighboring nodes are received in step 604, the processing unit can execute step 605a to perform feature aggregation operations. If the tensor calculation task of the P(n+1) stage is currently being executed, the processing unit interrupts the tensor calculation task of the P(n+1) stage being executed, and then executes step 605a. Exemplarily, the feature aggregation operation may refer to adding the features of the neighboring nodes of the graph node (i.e., the tensor calculation results) to the features of the graph node. The feature aggregation operation can also refer to the above introduction, which will not be repeated here.

[0163] After step 605a, if the tensor calculation task of the P(n+1) stage has not been completed, the tensor calculation task of the P(n+1) stage can continue to be executed.

[0164] If the tensor calculation result of the neighboring node is not received in step 604, the processing unit executes step 605b to perform the tensor calculation task of the P(n+1) stage.

[0165] The processing unit may further execute step 607 to determine whether the tensor calculation result transmission and aggregation task of the P'(n) stage and the tensor calculation task of the P(n+1) stage are both completed.

[0166] If the tensor calculation result transmission and aggregation task of the P'(n) stage and the tensor calculation task of the P(n+1) stage have not been completed, or if either of the tensor calculation result transmission and aggregation task of the P'(n) stage and the tensor calculation task of the P(n+1) stage has not been completed, then continue to execute step 604 and the subsequent steps of step 604.

[0167] If the tensor calculation result transmission and aggregation tasks of the P'(n) stage and the tensor calculation tasks of the P(n+1) stage are both completed, step 608 can be executed to output the feature aggregation results of the graph nodes, for example, write them to an off-chip memory. Then, step 609 can be executed to determine whether n is equal to N. If n is equal to N, it means that the tensor calculation tasks of the N stages have been completed and the tensor data transmission tasks of the N stages have been completed, and the process can be ended. If n is not equal to N, that is, n is less than N, then n=n+1 is set, and step 603 and subsequent steps are executed again.

[0168] So, through Figure 6 The scheme shown can implement graph operations without memory access, thereby improving the processing efficiency of the relationship graph.

[0169] Next, the routing strategy based on message passing is introduced in detail.

[0170] by Figure 3 The four-dimensional hypercube network with strict orthogonal topology shown in the figure is used as the interconnection medium between the processing units. It can be assumed that there are 16 processing units in total, each of which is connected to the other four processing units and can transmit in both directions at the same time. The specific network topology is as follows Fig. 9 As shown in Figure 1, the necessary and sufficient condition for the orthogonality of the network topology is that the processing units can be in an orthogonal n (where n is equal to Figure 6 Each link is organized in a (independent) dimensional space, and the arrangement of each link produces an offset in one dimension. For example, Fig.10The binary code 0000 of processing unit 0 shown in the figure is only 1 bit different from the interconnected processing units 1 (0001), 2 (0010), 4 (0100), and 8 (1000). The other computing cores also meet the same characteristics. The advantage of a strictly orthogonal topology is that routing is simple, so efficient routing algorithms can be implemented using hardware. In a four-dimensional hypercube network, the coordinates of the processing unit in the four-dimensional space can be used as the number of the processing unit. Since each link traverses one dimension, and each processing unit has at least one link in each dimension, the distance between two processing units can be calculated by the sum of the offsets in each dimension. Each processing unit is connected by an n-dimensional binary coordinate (x n-1 ,x n-2 ,...,x1,x0), the necessary and sufficient condition for two processing units to be adjacent is that there exists j such that y j =x j ±1, and for any i≠j and 0≤i≤n-1, there is y i =x i The four-dimensional hypercube network can be abstracted into an equivalent multi-level interconnected network (MIN) representation, such as Fig.10 As shown, the processing unit with 16 inputs and 16 outputs includes four levels in total, and each level has 16 line switching modules. The line switching modules can be equivalent to the following Figure 4 The switch shown is similar to a crossbar switch in that a new connection can be established at any time as long as the input and output ports that issue the request are idle, and the number of binary bits in the corresponding dimension changes by one level at a time.

[0171] Next, the calculation method of routing information is introduced in detail.

[0172] The embodiment of the present application provides an efficient neighbor parallel transceiver routing algorithm, which can realize deadlock-free transmission between each processing unit, and the utilization rate of the interconnection line is very high. After the calculation of the single-cycle combination stage inside the processing unit is completed, this part of the data can be stored in the output data buffer or the neighbor buffer inside the processing unit, and this part of the data is used as the source data for each processing unit to transmit neighbors to each other. The characteristics of communication are that the single data volume has a low bit width but a high communication frequency. In order to ensure the communication bandwidth, it is very important to reduce the length of the message header. Similarly, due to the high transmission frequency requirement, the network should avoid the transmission of deadlock situations as much as possible to cause link blocking and thus affect the efficiency of neighbor transmission. Therefore, the strategy of street sign routing can be adopted, that is, the message header is similar to giving a set of directions to the data. It only needs to give the target processing unit number of the data flow at the next moment and the corresponding switch direction to turn. The data flow only needs to compare the local processing unit number and the node address in the message, either turning or reaching its destination. The node message address of each cycle is calculated by the street sign router inside the processing unit according to the edge table, and the routing path must be deadlock-free.

[0173] The edge index in the relationship graph data is read in, where the neighbor nodes of the graph nodes can be obtained through the edge index. The calculation of the routing table is a three-step process. The row index of the adjacency matrix can be mapped from the router to the destination processing unit number, and the column index can be mapped from the router to the source processing unit number. Therefore, the adjacency matrix is ​​transformed into Fig.11 The source processing unit encoding and destination processing unit encoding matrix shown in FIG. Fig.11 The N in represents no neighbors. For example, in the first column, the neighbors of some graph nodes in processing unit 0 are located in the buffers corresponding to processing units 2, 3, 13, and 15. This part of data needs to be sent to the target processing unit, i.e., processing unit 0. Therefore, the row order of each column (the order in which the node neighbors arrive) can be changed.

[0174] The three steps of calculating the routing table are as follows.

[0175] Step 1: Find a non-conflicting starting processing unit. This requires that when the processing unit is initially sent, there will not be multiple requests for sending feature data of graph nodes in the same processing unit. First, find the repeated element numbers in the row elements in row order and record their column numbers. Then, send exchange requests to subsequent rows in turn and match elements. The condition for a successful match is that the row elements to be exchanged do not appear repeatedly in this row, and the row elements exchanged to other rows do not appear repeatedly in other rows. If all rows do not match, an empty cycle is added by default, and the element is exchanged with the column corresponding to the empty cycle.

[0176] Step 2: Calculate the routing set of the processing unit. According to the elements of each starting row and the elements of the target row in the first step, calculate the next path set of each processing unit through XOR operation (the set of binary coordinates of the processing unit where the target graph node is located that differs by 1 bit, until the difference is 1 bit).

[0177] Step 3: Group fill and delete the collection, such as Fig.12 As shown. The purpose of grouping is to improve the bandwidth utilization of the interconnected network, so that multiple routing tables can be sent in parallel without conflict in each sending cycle. It can be assumed that there are at least 4 transmission register groups in each processing unit, and there is only one interconnection line with other processing units (bidirectional and unidirectional), that is, it can receive data from 4 interconnections at the same time, and can send data to 4 interconnections at the same time. This requires that the four data arriving at the same time cannot come from repeated nodes, and after these data arrive, 2 or more data cannot be sent to the same processing unit at the same time. If the above rules are violated, conflicts and competitions will definitely occur in the transmission of each cycle. Therefore, it is necessary to screen out the appropriate intermediate processing unit from the next path set of the characteristic data transmission of each graph node. The routing tables that you want to send in parallel can be merged into one group (assuming routing table D0, routing table D1), and the next routing table is filled in descending order according to the offset (number of steps) of the source processing unit and the target processing unit. An intermediate processing unit for data forwarding is randomly selected from the set, and all processing unit single-step path sets are refreshed. The refresh rule is that if the processing unit number is in routing table D0, the number of the intermediate processing unit in other routing sets in routing table D0 is deleted. For routing tables with other numbers, the deletion condition is that the number of the intermediate processing unit exists and its previous processing unit number is the same as the previous node of routing table D0. In this way, although the processing unit will appear in other routing tables in the same group, they come from different senders. When the routing table is filled, the path refresh operation is performed on the processing unit to delete the conflicting intermediate processing units, which also avoids conflicts between their receivers (for example, Fig.12 Routing tables in different groups may not match).

[0178] like Fig.12 As shown, the routing tables that can be set include routing table D0, routing table D1, routing table D2, routing table D3, and routing table D4. The cycles include cycle E1, cycle E2, cycle E3, and cycle E4. The groups include group F0 and group F1.

[0179] If the path set of the processing unit is an empty set during the filling process, there are the following situations: (1) The step length of the processing unit from the target processing unit is 0; (2) The processing node is about to complete the transmission, and the step length from the target node is 1; (3) The data of the processing unit has not yet reached the target processing unit, and the intermediate path is occupied by other processing units. Fig.13 As shown, if an empty set appears, an × mark is made on the routing table. The symbol means inserting the virtual channel of the corresponding target processing unit. For example, if the first cycle is × and the second cycle is K, the data will be inserted into the virtual channel sent to K in the first cycle. The reason is that in this cycle, the channel may be occupied by other processing units with higher priorities, and in the next or future cycles, the channel will be idle. After the second sending cycle, it will be sent to the K processing unit through the virtual channel through the path until the distance step between the current node pointer of all nodes and the target node is 1, and the routing table calculation is completed.

[0180] The characteristic of being in the same group is that the data of these processing units can be sent and received in parallel without conflict in each cycle. This greatly improves the transmission efficiency of the processing unit neighbors and can transmit more data without increasing the interconnection line width (i.e. bandwidth), so that data transmission can use up the effective bandwidth of the interconnection network in each cycle as much as possible (when transmitting 64 nodes (4 routing tables) at the same time, the average bandwidth utilization rate of each cycle is 80%). These data can reach the target processing unit in the same cycle. And the number of groups can be flexibly adjusted according to the number of non-zero elements in each row. For example, in the aggregation process, most of the graph nodes have been aggregated, leaving only a few graph nodes with more neighbors. In this case, most of the data in the starting row is N (N here is the same as N with N). Figure 6 They may come from the same processing unit or different processing units, but the target processing unit number is the same. In this case, the number of groups can be increased to allow these processing units to complete the transmission and reception of neighbors on different paths, which can reduce the impact of the power-law distribution of the number of node neighbors on the transmission efficiency.

[0181] In summary, the relationship graph processing solution provided by the embodiment of the present application eliminates random memory access of graph operations during the relationship graph processing, thereby improving the processing efficiency of the relationship graph, and does not require a hardware module specifically for aggregation operations, thereby reducing hardware costs.

[0182] Specifically, Fig.14As shown, the embodiment of the present application provides a relationship graph processing solution using a set of hardware modules to perform tensor operations and graph aggregation operations in parallel. Specifically, the tensor X (i.e., graph node feature matrix), weight matrix W, and adjacency matrix A can be input. The router reads the adjacency matrix A for routing calculations. While the computing core (i.e., processing unit) executes the tensor operation XW, it transmits messages to part of the calculation results of XW. When the message arrives, the tensor operation is converted to graph aggregation calculation. Output the calculation results of part AXW.

[0183] like Fig.15 As shown, the execution of tensor computing tasks (i.e., combined computing tasks) and the tensor computing result transmission process in aggregate memory access (tensor computing result transmission and aggregation tasks) can be executed in parallel, thereby eliminating the process of accessing the memory to obtain the tensor computing results during aggregate computing and improving the efficiency of relationship graph processing.

[0184] That is to say, the improved solution of the embodiment of the present application achieves low-cost expansion of existing processing units without increasing computing resources, enabling them to efficiently perform memory-intensive graph operation tasks, converting random memory accesses into message passing of registers between AI computing cores, making full use of existing processing units, and having high data reuse rate and high resource utilization.

[0185] In some embodiments, the tensor computation and graph operation computation time can be expressed as:

[0186] t total =MAX(t 张量计算 +t 图聚合计算 , t 图通信 )

[0187] like Fig.16 As shown, the experiment shows that in a single-stage tensor calculation and graph aggregation calculation, the solution provided by the embodiment of the present application can make full use of computing resources, so that tensor operations and graph operations can be efficiently parallelized, satisfying:

[0188] t(P(n) tensor computation) ≥ t(P(n-1) graph communication)

[0189] At this time, the data sending time of the graph operation can be basically covered by the tensor calculation stage. Therefore, the solution provided in the embodiment of the present application can realize the parallel execution of calculation and memory access, while improving the efficiency of the existing processing unit in executing graph operations.

[0190] in, Fig.16 FK, RD, YP, and AM represent different relationship diagrams respectively.

[0191] It should be noted that the memory access in the embodiment of the present application is not the actual memory access, but refers to the transmission of tensor calculation results between processing units. That is to say, in the embodiment of the present application, the transmission tensor calculation between processing units replaces the memory access in the prior art to obtain the tensor calculation results.

[0192] In summary, in a possible implementation of the relationship graph processing solution provided in an embodiment of the present application, from the perspective of computational methods, a fusion computing solution for tensor operations and graph operations in GNN calculations is proposed. In terms of computational form, the random memory access in the graph operation is converted into the form of message passing between the internal registers of each AI computing core. The specific process includes, by a centralized router outside the AI ​​computing core, converting the connection relationship of the graph into non-blocking message passing information of each AI computing core through a routing algorithm, so that the tensor operations inside the AI ​​computing core and the message passing operations outside the computing core can be performed synchronously during execution.

[0193] From the perspective of computing devices, based on the strict orthogonal topology (butterfly, cubic, omega) expansion of existing AI tensor computing cores (Ascend AI Core, TPU systolic array, etc.), the router sends single-step routing information to each AI computing core during the "tensor-graph" operation fusion calculation process to complete the data dependency between each AI computing core. Without adding additional computing resources (number of DSPs) to the entire device, low-cost and efficient "tensor-graph" operations can be executed in parallel.

[0194] Table 2 shows the GNN computing performance comparison results of the experimental platform VCU128 FPGA, P100 GPU (PyG framework), and Intel Xeon Platinum8260CPU (PyG framework). It can be seen from Table 2 that in terms of computing performance, the solution provided by the embodiment of the present application improves the ability of traditional Al computing cores (Ascend Al Core, TPU systolic array, GPU CudaCore, etc.) to calculate graph operations.

[0195] Table 2

[0196]

[0197] Next, in terms of hardware deployment, the 4-dimensional (4-D) hypercube topology structure in the solution provided in the embodiment of the present application is compared with the performance of other mainstream non-orthogonal topologies (Cross-Bar, 2-D Tours) of the Internet.

[0198] Table 3 shows the comparison of FPGA layout and routing resources.

[0199] Table 3

[0200]

[0201] Fig.17A , Fig. 17B , Fig. 17C The FPGA chip wiring logic layouts of 4-D Hypercube, Cross-Bar, and 2-D Tours are shown in turn.

[0202] in, Fig.17A The figure shows the FPGA chip wiring logic layout of the Cross-Bar topology structure, in which the AI ​​computing core (i.e., processing unit) uses CrossBar as the interconnection, and the width of a single interconnection line is 32 bytes.

[0203] Fig. 17B The FPGA chip wiring logic layout of the 2-D Tours topology is shown, in which the AI ​​computing core uses 2-DTours as interconnection, and the width of a single interconnection line is 32 bytes.

[0204] Fig. 17C The FPGA chip wiring logic layout of the 4-D hypercube topology is shown, in which the AI ​​computing core uses the 4-D hypercube as the interconnection, and the width of a single interconnection line is 32 bytes.

[0205] By comparison, in terms of the layout and routing resources occupied by each AI computing core, Cross-Bar occupies the most resources, followed by 2-D Tours and 4-D Hypercube. Among the resources that have been successfully laid out, LUT occupies 1.47 times (×) of the latter, and FF occupies 1.1× of the latter. The power consumption and layout and routing time are both higher than the latter. As the number of AI computing cores increases, there will be problems with unsuccessful routing, such as the Conflict net (conflicting interconnection) shown in Table 3. About 27% of the logic units of the AI ​​computing core using Cross-Bar interconnection failed to be routed. Therefore, from the perspective of occupied resources, 2-DTours and orthogonal topology structures are relatively better.

[0206] In terms of routing calculation overhead, since Cross-Bar uses Al computing core direct connection, there is no need for routing calculation, but due to the long wiring, there will be very serious timing problems. Therefore, compared with 2-D Tours and 4-D hypercube, it is very difficult for Cross-Bar to achieve high-frequency transmission. In 2-D Tours and 4-D hypercube, the overhead is mainly reflected in the calculation of single-step routing. Since 4-D hypercube is an orthogonal topology, only one XOR gate is required to calculate single-step routing, while 2-D Tours needs to use addition and subtraction to determine the surrounding computing nodes. Therefore, in terms of computing speed and resource consumption, 4-D hypercube requires lower logic resources, so the orthogonal topology structure is a relatively better choice in the solution.

[0207] Based on the relationship graph processing scheme described above, the embodiment of the present application provides a relationship graph processing method. It can be understood that the method is another expression of the relationship graph processing scheme described above, and the two are combined. Part or all of the content of the method can refer to the description of the relationship graph processing scheme above.

[0208] The method can be applied to a computing device including multiple processing units, such as computing device 100. Each of the multiple processing units is assigned a graph node in the relationship graph, and different processing units are assigned different graph nodes. Fig.18 As shown, the method includes the following steps.

[0209] Step 1801, the processing unit executes the first stage of tensor calculation tasks, the first stage of tensor calculation tasks including performing a first tensor operation on the feature data of the graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node. Figure 5 In the P(1) stage or Figure 6 The introduction and implementation of step 602a will not be repeated here.

[0210] Step 1802: After the processing unit completes the tensor calculation task of the first stage, it sends the first tensor calculation result of the graph node obtained by the processing unit executing the tensor calculation task of the first stage to the processing unit where the graph node is located with the graph node as a neighbor node, and starts to execute the tensor calculation task of the second stage. Figure 5 In the P'(1) stage or Figure 6 The introduction of step 603 is implemented.

[0211] Step 1803, when the first processing unit assigned with the first graph node receives the first tensor calculation result of the second graph node sent by the second processing unit assigned with the second graph node, the first processing unit interrupts the second stage tensor calculation task and performs the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node to obtain the first aggregation result of the first graph node; wherein the second graph node is the neighbor node of the first graph node in the relationship graph. For example, reference can be made to the above description of Figure 5 The P(1) and P'(1) phases in the introduction and implementation, or refer to the above Figure 6 The introduction and implementation of step 604 and step 605a in FIG.

[0212] Step 1804: When the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node is completed, the first processing unit continues to perform the second stage of tensor calculation tasks. Figure 5 The P(1) and P'(1) phases in the introduction and implementation, or refer to the above Figure 6 The introduction and implementation of step 604 and step 605b in FIG.

[0213] In some embodiments, the processing unit includes a computing module, a buffer, and a communication module, wherein the performing a first tensor operation on the feature data of the graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node includes: the computing module of the processing unit performs a first tensor operation on the feature data of the graph node assigned to the processing unit, and outputs the obtained first tensor calculation result of the graph node to the buffer of the processing unit; the sending of the first tensor calculation result of the graph node obtained by the processing unit executing the first stage of the tensor calculation task to the processing unit where the graph node is a neighboring node includes: the communication module of the processing unit sends the first tensor calculation result of the graph node in the buffer of the processing unit to the processing unit where the graph node is a neighboring node; the performing of the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node includes: the computing module of the first processing unit receives the first tensor calculation result of the second graph node through the communication module of the first processing unit, obtains the first tensor calculation result of the first graph node from the buffer of the first processing unit, and performs a feature aggregation operation on the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node. For details, please refer to the above Figure 4 The illustrated embodiment introduces an implementation.

[0214] In an example of this embodiment, before the processing unit executes the first stage of tensor computing tasks, the method further includes: dividing the tensor operation to be executed by the processing unit into N stages of tensor computing tasks, wherein the N stages of tensor computing tasks are executed sequentially by the processing unit, and the data volume of the output result of the tensor computing task of each stage is consistent with the space size of the buffer of the processing unit, and N is an integer greater than 1. Figure 6 The introduction of step 601 is implemented.

[0215] In one example of this example, the tensor operation to be performed by the processing unit includes: using a weight matrix with M columns to update the feature data of the graph node assigned to the processing unit; M is an integer greater than 1; the tensor calculation task of dividing the tensor operation to be performed by the processing unit into N stages includes: dividing the weight matrix into N sub-matrices with L columns, wherein the tensor calculation tasks of the N stages correspond one-to-one to the N sub-matrices, and M×L=N; the first tensor operation on the feature data of the graph node assigned to the processing unit includes: using the sub-matrix corresponding to the tensor calculation task of the first stage to update the feature data of the graph node assigned to the processing unit to obtain the first tensor calculation result of the graph node. Please refer to the above description. Figure 8 The illustrated embodiment is described in detail.

[0216] In some embodiments, the second processing unit is also allocated a third graph node in the relationship graph, and the third graph node is a neighbor node of the first graph node in the relationship graph; the sending of the first tensor calculation result of the graph node obtained by the processing unit executing the first stage of the tensor calculation task to the processing unit where the graph node with the graph node as a neighbor node is located includes: the second processing unit performs a feature aggregation operation on the first tensor calculation result of the second graph node and the first tensor calculation result of the third graph node to obtain pre-aggregated results of the second graph node and the third graph node; the second processing unit sends the pre-aggregated result to the first processing unit; the execution of the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node includes: performing a feature aggregation operation on the first tensor calculation result of the first graph node and the pre-aggregated result to obtain the first aggregation result of the first graph node.

[0217] In some embodiments, sending the first tensor calculation result of the graph node obtained by the processing unit executing the first stage of the tensor calculation task to the processing unit where the graph node is located with the graph node as a neighbor node includes:

[0218] The second processing unit confirms that the first tensor calculation result of the second graph node is the only information sent by the second processing unit to the first processing unit at the first moment;

[0219] At the first moment, the second processing unit sends a first tensor calculation result of the second graph node to the first processing unit.

[0220] In an example of this embodiment, each of the multiple processing units has P neighbor units, wherein the neighbor unit of each processing unit is a processing unit in the multiple processing units, and there is a data path between each processing unit and the neighbor unit of the processing unit, and P is an integer greater than 1; when the first processing unit is a neighbor unit of the second processing unit, the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit, including: the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit through the data path between the first processing unit and the second processing unit.

[0221] In one example of this example, the computing device also includes a router; when the first processing unit is not a neighbor unit of the second processing unit, the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit, including: the second processing unit receives a forwarding unit indication from the router; the second processing unit sends the first tensor calculation result of the second graph node to the processing unit indicated by the forwarding unit indication, so as to send the first tensor calculation result of the second graph node to the first processing unit through the processing unit indicated by the forwarding unit indication.

[0222] In one example of this example, the forwarding unit indication is generated by the router based on a routing table, wherein in the routing table, a next-hop processing unit of the forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit.

[0223] In one example of this example, the method also includes: the router calculates the shortest path from each source processing unit to each destination processing unit and the single-step path set corresponding to the shortest path, to obtain multiple shortest paths and the single-step path set corresponding to each shortest path in the multiple shortest paths, wherein the source processing unit and the destination processing unit are different processing units in the multiple processing units, and the source processing unit is the starting point for transmission of the tensor calculation result, and the destination processing unit is the end point for transmission of the tensor calculation result; the router selects the single-step paths used to form the shortest path from the multiple single-step path sets in order of the path lengths of the multiple shortest paths from low to high and according to the principle that a next-hop processing unit of the forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit, so as to obtain the routing table.

[0224] The relationship graph processing method provided in the embodiment of the present application enables the processing unit to obtain the tensor calculation results of the neighbor nodes of the graph node without memory access, and then perform feature aggregation operations on the tensor calculation results of the graph node and the tensor calculation results of the graph nodes with the graph node as the neighbor nodes. In other words, the scheme realizes the graph operation in the relationship graph processing without memory access, avoiding the problems such as low processing efficiency caused by random memory access in the relationship graph processing.

[0225] The present application embodiment also provides a computing device 1900. Fig.19 As shown, the computing device 1900 includes a plurality of processing units such as a processing unit 1910 and a processing unit 1920. The plurality of processing units are allocated with graph nodes in the relationship graph, and different processing units are allocated with different graph nodes.

[0226] The processing unit is used to perform the tensor calculation task of the first stage, and the tensor calculation task of the first stage includes performing a first tensor operation on the feature data of the graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node;

[0227] The processing unit is used to send the first tensor calculation result of the graph node obtained by the processing unit executing the first phase of the tensor calculation task to the processing unit where the graph node is located with the graph node as a neighbor node after the tensor calculation task of the first phase of the processing unit is completed, and start to execute the tensor calculation task of the second phase;

[0228] When the processing unit 1910 assigned with the first graph node receives the first tensor calculation result of the second graph node sent by the processing unit 1920 assigned with the second graph node, the processing unit 1910 is used to interrupt the tensor calculation task of the second stage, and perform a feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node to obtain a first aggregation result of the first graph node; wherein the second graph node is a neighbor node of the first graph node in the relationship graph;

[0229] When the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node is completed, the processing unit 1910 is used to continue to execute the second stage of tensor calculation tasks.

[0230] The functions of each processing unit in the computing device 1900 can be implemented by referring to the description of each embodiment above, for example Fig.18 The method embodiment shown is implemented.

[0231] The present application embodiment also provides a computing system 2000. Fig. 20As shown, the computing system 2000 includes: a memory 2010 for storing feature data of graph nodes in a relationship graph, and a computing device 1900.

[0232] The present application also provides a computer program product including instructions. The computer program product may be a software or program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on a computing device, at least one computing device executes Fig.18 The method shown.

[0233] The present application also provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be stored by the computing device or a host migration device such as a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute Fig.18 The method shown.

[0234] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.

Claims

1. A relationship graph processing method, It is characterized in that Applied to a computing device including a plurality of processing units, each of the plurality of processing units is allocated a graph node in a relationship graph, and different processing units are allocated different graph nodes; the method comprises: The processing unit executes a first-stage tensor calculation task, where the first-stage tensor calculation task includes performing a first tensor operation on feature data of a graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node; After the processing unit completes the tensor calculation task of the first stage, it sends the first tensor calculation result of the graph node obtained by the processing unit executing the tensor calculation task of the first stage to the processing unit where the graph node with the graph node as a neighbor node is located, and starts to execute the tensor calculation task of the second stage; When a first processing unit assigned with a first graph node receives a first tensor calculation result of a second graph node sent by a second processing unit assigned with a second graph node, the first processing unit interrupts the second stage tensor calculation task and performs a feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node to obtain a first aggregation result of the first graph node; wherein the second graph node is a neighbor node of the first graph node in the relationship graph; When the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node is completed, the first processing unit continues to execute the tensor calculation task of the second stage.

2. The method according to claim 1, It is characterized in that The processing unit includes a computing module, a buffer, and a communication module, wherein: The step of performing a first tensor operation on the feature data of the graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node comprises: a calculation module of the processing unit performs a first tensor operation on the feature data of the graph node assigned to the processing unit, and outputs the obtained first tensor calculation result of the graph node to a buffer of the processing unit; The sending of the first tensor calculation result of the graph node obtained by the processing unit executing the first stage of the tensor calculation task to the processing unit where the graph node is located with the graph node as a neighbor node comprises: the communication module of the processing unit sends the first tensor calculation result of the graph node in the buffer of the processing unit to the processing unit where the graph node is located with the graph node as a neighbor node; The execution of the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node includes: the computing module of the first processing unit receives the first tensor calculation result of the second graph node through the communication module of the first processing unit, and obtains the first tensor calculation result of the first graph node from the buffer of the first processing unit, and performs a feature aggregation operation on the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node.

3. The method according to claim 2, It is characterized in that Before the processing unit executes the tensor calculation task of the first stage, the method further includes: The tensor operation to be performed by the processing unit is divided into N stages of tensor calculation tasks, wherein the N stages of tensor calculation tasks are executed sequentially by the processing unit, the data volume of the output result of the tensor calculation task of each stage is consistent with the space size of the buffer of the processing unit, and N is an integer greater than 1.

4. The method according to claim 3, It is characterized in that The tensor operation to be performed by the processing unit includes: using a weight matrix having M columns to perform feature updates on feature data of a graph node assigned to the processing unit; M is an integer greater than 1; The dividing the tensor operation to be performed by the processing unit into N stages of tensor calculation tasks includes: dividing the weight matrix into N sub-matrices with L columns, wherein the N stages of tensor calculation tasks correspond to the N sub-matrices one by one, and M×L=N; The first tensor operation on the feature data of the graph node assigned to the processing unit includes: using the submatrix corresponding to the tensor calculation task of the first stage to update the feature data of the graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node.

5. The method according to claim 1, It is characterized in that The second processing unit is further allocated with a third graph node in the relationship graph, where the third graph node is a neighbor node of the first graph node in the relationship graph; The step of sending the first tensor calculation result of the graph node obtained by the processing unit executing the first stage tensor calculation task to the processing unit where the graph node having the graph node as a neighboring node is located comprises: The second processing unit performs a feature aggregation operation on the first tensor calculation result of the second graph node and the first tensor calculation result of the third graph node to obtain pre-aggregation results of the second graph node and the third graph node; The second processing unit sends the pre-aggregation result to the first processing unit; The performing of the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node includes: performing a feature aggregation operation on the first tensor calculation result of the first graph node and the pre-aggregation result to obtain a first aggregation result of the first graph node.

6. The method according to claim 1, It is characterized in that The step of sending the first tensor calculation result of the graph node obtained by the processing unit executing the first stage tensor calculation task to the processing unit where the graph node is located, where the graph node is a neighboring node, includes: The second processing unit confirms that the first tensor calculation result of the second graph node is the only information sent by the second processing unit to the first processing unit at the first moment; At the first moment, the second processing unit sends a first tensor calculation result of the second graph node to the first processing unit.

7. The method according to claim 6, It is characterized in that Each of the plurality of processing units has P neighboring units, wherein the neighboring unit of each processing unit is a processing unit in the plurality of processing units, a data path is provided between each processing unit and the neighboring unit of the processing unit, and P is an integer greater than 1; When the first processing unit is a neighbor unit of the second processing unit, the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit, including: the second processing unit sends the first tensor calculation result of the second graph node to the first processing unit through the data path between the first processing unit and the second processing unit.

8. The method according to claim 7, It is characterized in that The computing device further includes a router; when the first processing unit is not a neighbor unit of the second processing unit, the second processing unit sending the first tensor calculation result of the second graph node to the first processing unit includes: The second processing unit receives a forwarding unit indication from the router; The second processing unit instructs the indicated processing unit to send the first tensor calculation result of the second graph node to the first processing unit through the forwarding unit to instruct the indicated processing unit to send the first tensor calculation result of the second graph node to the first processing unit.

9. The method according to claim 8, It is characterized in that The forwarding unit indication is generated by the router based on a routing table, wherein in the routing table, a next-hop processing unit of the forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit.

10. The method according to claim 9, It is characterized in that The method further comprises: The router calculates the shortest path from each source processing unit to each destination processing unit and a single-step path set corresponding to the shortest path, and obtains multiple shortest paths and a single-step path set corresponding to each shortest path in the multiple shortest paths, wherein the source processing unit and the destination processing unit are different processing units in the multiple processing units, and the source processing unit is a transmission starting point for the tensor calculation result, and the destination processing unit is a transmission end point for the tensor calculation result; The router selects single-step paths for forming the shortest paths from the multiple single-step path sets in order of the path lengths of the multiple shortest paths from low to high and in accordance with the principle that a next-hop processing unit of a forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit, so as to obtain the routing table.

11. A computing device, It is characterized in that The method comprises a plurality of processing units, wherein the plurality of processing units are allocated with graph nodes in a relationship graph, and different processing units are allocated with different graph nodes; The processing unit is used to perform a first-stage tensor calculation task, which includes performing a first tensor operation on feature data of a graph node assigned to the processing unit to obtain a first tensor calculation result of the graph node; The processing unit is used to send the first tensor calculation result of the graph node obtained by the processing unit executing the first phase of the tensor calculation task to the processing unit where the graph node with the graph node as a neighbor node is located after the tensor calculation task of the first phase of the processing unit is completed, and start to execute the tensor calculation task of the second phase; When a first processing unit assigned with a first graph node receives a first tensor calculation result of a second graph node sent by a second processing unit assigned with a second graph node, the first processing unit is used to interrupt the second stage tensor calculation task, and perform a feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node to obtain a first aggregation result of the first graph node; wherein the second graph node is a neighbor node of the first graph node in the relationship graph; When the feature aggregation operation of the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node is completed, the first processing unit is used to continue to execute the tensor calculation task of the second stage.

12. The device according to claim 11, It is characterized in that The processing unit includes a computing module, a buffer, and a communication module, wherein: The computing module of the processing unit is used to perform a first tensor operation on the feature data of the graph node assigned to the processing unit, and output the obtained first tensor calculation result of the graph node to the buffer of the processing unit; The communication module of the processing unit is used to send the first tensor calculation result of the graph node in the buffer of the processing unit to the processing unit where the graph node is located with the graph node as a neighbor node; The computing module of the first processing unit is used to receive the first tensor calculation result of the second graph node through the communication module of the first processing unit, and to obtain the first tensor calculation result of the first graph node from the buffer of the first processing unit, and to perform feature aggregation operations on the first tensor calculation result of the first graph node and the first tensor calculation result of the second graph node.

13. The device according to claim 12, It is characterized in that The device also includes a division unit; the division unit is used to divide the tensor operation to be performed by the processing unit into N stages of tensor calculation tasks, wherein the N stages of tensor calculation tasks are executed in sequence by the processing unit, and the data volume of the output result of the tensor calculation task of each stage is consistent with the space size of the buffer of the processing unit, and N is an integer greater than 1.

14. The device according to claim 13, It is characterized in that The processing unit is used to update the feature data of the graph node assigned to the processing unit using a weight matrix having M columns; M is an integer greater than 1; The division unit is used to divide the weight matrix into N sub-matrices with L columns, wherein the tensor calculation tasks of the N stages correspond to the N sub-matrices one by one, and M×L=N; The processing unit is used to use the sub-matrix corresponding to the tensor calculation task of the first stage to update the feature data of the graph node assigned to the processing unit to obtain the first tensor calculation result of the graph node.

15. The device according to claim 11, It is characterized in that The second processing unit is further allocated with a third graph node in the relationship graph, where the third graph node is a neighbor node of the first graph node in the relationship graph; The second processing unit is used to perform a feature aggregation operation on the first tensor calculation result of the second graph node and the first tensor calculation result of the third graph node to obtain pre-aggregation results of the second graph node and the third graph node; The second processing unit is used for sending the pre-aggregation result to the first processing unit; The first processing unit is used to perform a feature aggregation operation on the first tensor calculation result of the first graph node and the pre-aggregation result to obtain a first aggregation result of the first graph node.

16. The device according to claim 11, It is characterized in that The second processing unit is used to confirm that the first tensor calculation result of the second graph node is the only information sent by the second processing unit to the first processing unit at the first moment; At the first moment, the second processing unit is used to send the first tensor calculation result of the second graph node to the first processing unit.

17. The device according to claim 16, It is characterized in that Each of the plurality of processing units has P neighboring units, wherein the neighboring unit of each processing unit is a processing unit in the plurality of processing units, a data path is provided between each processing unit and the neighboring unit of the processing unit, and P is an integer greater than 1; When the first processing unit is a neighbor unit of the second processing unit, the second processing unit is used to send the first tensor calculation result of the second graph node to the first processing unit through the data path between the first processing unit and the second processing unit.

18. The device according to claim 17, It is characterized in that The computing device also includes a router; When the first processing unit is not a neighbor unit of the second processing unit, the second processing unit is used to receive a forwarding unit indication from the router; The second processing unit is used to instruct the indicated processing unit of the forwarding unit to send the first tensor calculation result of the second graph node to the first processing unit through the indicated processing unit of the forwarding unit.

19. The device according to claim 18, It is characterized in that The forwarding unit indication is generated by the router based on a routing table, wherein in the routing table, a next-hop processing unit of the forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit.

20. The device according to claim 19, It is characterized in that The router is also used to: Calculate the shortest path from each source processing unit to each destination processing unit and the single-step path set corresponding to the shortest path, and obtain multiple shortest paths and the single-step path set corresponding to each shortest path in the multiple shortest paths, wherein the source processing unit and the destination processing unit are different processing units in the multiple processing units, and the source processing unit is the transmission starting point of the tensor calculation result, and the destination processing unit is the transmission end point of the tensor calculation result; According to the order of the path lengths of the multiple shortest paths from low to high, and according to the principle that a next-hop processing unit of a forwarding unit corresponds to at most one previous-hop processing unit of the forwarding unit, single-step paths for forming the shortest path are selected from the multiple single-step path sets in turn to obtain the routing table.

21. A computing system, It is characterized in that include: A memory for storing feature data of graph nodes in the relationship graph; The computing device of any one of claims 11 to 20.

Citation Information

Patent Citations

  • Distributed graph embedding method and device

    CN109194707A

  • Method and device for optimizing tensor calculation performance

    CN112559163A

  • Neural hardware accelerator for parallel and distributed tensor computations

    US20190332925A1

Cited By

  • Living body detection method and device, electronic equipment and storage medium

    CN119360457A