Characterizing and Understanding GCNs on GPU

01/28/2020 ∙ by Mingyu Yan, et al. ∙ 0

Graph convolutional neural networks (GCNs) have achieved state-of-the-art performance on graph-structured data analysis. Like traditional neural networks, training and inference of GCNs are accelerated with GPUs. Therefore, characterizing and understanding the execution pattern of GCNs on GPU is important for both software and hardware optimization. Unfortunately, to the best of our knowledge, there is no detailed characterization effort of GCN workloads on GPU. In this paper, we characterize GCN workloads at inference stage and explore GCN models on NVIDIA V100 GPU. Given the characterization and exploration, we propose several useful guidelines for both software optimization and hardware optimization for the efficient execution of GCNs on GPU.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

In recent years, Graph Convolutional Neural Networks (GCNs) that operate on graph-structured data have achieved state-of-the-art performance on tasks like node classification, link prediction, and recommendations, etc. GCNs have become a new workload family member in data-centers [pytorch_biggraph, Graph_Nets_library]. Like traditional neural networks, training and inference of GCN models are accelerated with Graphics Processing Units (GPUs) to achieve an order of magnitude lower latency [pytorch_biggraph]. Therefore, characterizing the execution pattern of GCNs on GPUs is important for both software and hardware optimization for GCNs.

To the best of our knowledge, there is no characterizing effort of GCNs on GPU. Popular GCN models usually contain two major execution phases with distinct execution pattern: Aggregation and Combination

. The former phase aggregates the feature vectors of the neighbor nodes like graph processing, so it exhibits a similar irregular execution pattern. The latter phase updates the feature vectors with multi-layer perceptrons (MLPs), so it has alike regular patterns with traditional neural networks. Nevertheless, GCNs have shown several new features that make their execution patterns differ from traditional workloads, so conclusions in existing characterization studies on graph processing and neural networks cannot be directly inferred in GCNs.

To understand the computation and memory accessing pattern of GCNs, we profile and analyze the inference stage of several GCN models on popular benchmarks with NVIDIA GPU V100, and the results are compared with traditional graph processing and MLP workloads. Besides, we also conduct an exploration of how configurations like dimension size influence the execution time. Our key observations and insights toward architecture design are summarized below.

  • Comparison to Graph Processing: 1) High-degree spatial data locality and parallelism exist intra vertex; 2) Only inter-warp atomic collision exists; 3) L2 cache hit ratio in Aggregation phase is extremely lower than graph processing due to the long reuse distance of vertex data.

  • Comparison to MLP-based Neural Network: 1) The parameters of MLP exhibit extremely high reusability inter vertex; 2) High-degree parallelism exists inter vertex.

  • Overall Execution: 1) Hybrid execution pattern exists in GCNs; 2) Execute Combination phase ahead of Aggregation phase helps reduce data access and computation of Aggregation phase; 3) A dataflow exists inter phase for each vertex.

  • Exploration: 1) The execution time of Combination is almost proportion to input feature length, while the execution time of Aggregation phase in various length are almost the same since it is independent on the length of input feature vector; 2) Both the execution time for Aggregation phase and Combination phase are almost proportion to output feature length; 3) There are sweet spots for the execution of Combination phase in terms of the length of input and output feature.

Given the characterization and exploration, we propose useful guidelines as follows for both software framework optimization and hardware optimization for GCNs.

  • Software Optimization Guideline: 1) A degree-aware feature access scheduling to reuse the vertex with high degree; 2) Vectorizing atomic operation to improve the efficiency of parallelism; 3) An adaptive execution granularity to leverage the inter-phase dataflow and hardware-optimized function.

  • Hardware Optimization Guideline: 1) A degree- and length-aware replacement policy for Cache to reuse the feature of high-degree vertex and improve memory level parallelism.

2 Background of GCNs

In general, GCNs follow a neighborhood gather scheme. The feature vector of each vertex is updated by recursive aggregation of the feature vectors of neighbor nodes and combination of features via an MLP or a single fully-connected layer [AliGraph]. Let be the feature vector of vertex at layer , be the neighbor list of vertex , and

be the activation function, we briefly summarize three popular GCN models as follows.

Graph Convolutional Network (GCN) [kipf2016semi]. The propagation rule of GCN at layer is defined as follows:

(1)

where the term (Combination) multiplies the feature vector of each vertex by the weight matrix and then the term (Aggregation) updates each feature vector with the average of its neighborhood.

Graph Isomorphism Network (GIN) [xu2018powerful]. In GIN-0 introduced in Xu et al. (2018) [xu2018powerful], the feature vector of each vertex is updated with

(2)

in which the feature vectors are first aggregated by the summation of neighborhood and then updated with MLP.

GraphSAGE (SAG)[hamilton2017inductive]. In GraphSAGE, the feature vectors are updated with the same propagation rule of GCN, the difference is that while GCN updates the feature vectors of all vertexes in the graph in each iteration, GraphSAGE only update a batch of vertexes along with their 2-hop neighbors in an iteration.

There are three major different features between GCNs with traditional graph processing and neural networks:

  1. Large and Variable Feature Length. The feature data in graph processing are small, usually one element for each vertex, while the feature vector of each vertex in the Aggregation phase of GCNs usually contains hundreds of entries and varies across layers and datasets.

  2. Parameters Shared by Vertices

    . In traditional MLP-based neural network, to classify one sample, only one feature vector is forward through the MLP, and the parameters in the MLP are not shared. However, in node classification of GCNs with

    layers, the feature vectors of all -hop neighbours are forwarded; In graph classification, the feature vectors of all vertexes are required. As a result, in GCNs, the parameters in the MLP can be fully shared by each feature vector.

  3. Alternative Execution, the two phases are executed alternatively until the final result is produced.

3 Evaluation Setup

Benchmark. Table II and Table I provide the information of the benchmark GCN models and graph datasets used in our evaluation. For GCNs, we select three advanced models: Graph Convolutional Network (GCN) [kipf2016semi], Graph Isomorphism Network (GIN) [xu2018powerful], and GraphSAGE (SAG) [hamilton2017inductive]. For clarity, we evaluate the first graph-convolutional layer of each model on popular datasets including Cora, Citeseer, Pubmed, and Reddit. For classical graph processing, we run PageRank on the Reddit and LiveJournal dataset. For traditional MLP, we test a single fully-connected layer on MNIST. Notably, we mainly focus on the inference stage rather than training.

Aggregation Operator & Combination Operator
GCN (GCN) Mean & MLP: –128
GraphSage (SAG) Mean & MLP: –128
GINConv (GIN) Add & MLP: –128–128
PageRank (PGR) Graph Processing
MLP-MNIST MLP: 784–128 with batching size 1000
TABLE I: Configuration of convolution layers. Here denotes the length of feature vector .
Dataset #Vertex Feature Len. #Edge
Cora (CR) 2,708 1,433 5,429
Citeseer (CS) 3,327 3,703 4,732
Pubmed (PB) 19,717 500 44,338
Reddit (RD) 232,965 602 11,606,919
LiveJournal (LJ) 4,847,571 1 68,993,773
TABLE II: Datasets information [1stChebNet, GraphDynS]

Profiling Platform. The GCN models are implemented with the state-of-the-art GPU-based software framework for GCNs: PyTorch Geometric [PyTorch_Geometric]. The PageRank is implemented with Gunrock [Gunrock]. All the workloads are profiled on single NVIDIA GPU V100 with NVIDIA NVProf and averaged among 5 iteration.

4 Observation and Analysis

This section is organized as follows. First, we present an overview of our profiling result. Then, we characterize dominant kernels in Aggregation and Combination phase and compare them with traditional workloads. At last, we explore the impact of feature length on execution time.

4.1 Overview of Profile

Execution Time Breakdown. Fig. 1 illustrates the execution time breakdown of major kernels that occupy most of execution time on GPU.

The sgemm kernels multiplies the weight matrix with feature vectors to perform Combination. The indexSelect kernel and scatter kernel execute Aggregation function for all vertices. Specifically, the indexSelect kernel uses the neighbor ID to select the neighbor’s feature vector of each vertex, and then uses these feature vectors to build a dense feature matrix for the input of scatter kernel. Each thread in the scatter kernel executes aggregation operator for each element in a neighbor’s feature vector.

As illustrated in Fig. 1, the above three kernels take up 65% to 90% execution time in different configurations. The portion of execution time that each kernel takes is determined by the sequence of Combination and Aggregation as well as the length of feature vectors. Specifically, GIN executes Aggregation phase first while the other two execute Combination phase first. While the scale of Combination is similar among the three models, the feature vector length in GCN and SAG are significantly reduce by Combination, so their Aggregation phase take much fewer time than GIN. In terms of dataset, the Combination takes more execution time in the datasets with longer feature length, i.e. CS.

Fig. 1: Execution time breakdown on V100 GPU.

4.2 Analysis of Aggregation Phase

Here, we provide detailed analysis of the Aggregation phase in SAG and compare it with PGR on the RD and LJ datasets.

Fig. 2: The profiling result of Aggregation phase.
Fig. 3: The result of Combination phase.

High-degree spatial data locality exists in the access to feature data. This locality derives from the access to each long-length feature vector. Fig. 3 (a) and (b) respectively illustrate that L1 cache hit ratio and L1 cache to multiprocessor throughput(GB/sec) of Aggregation phase are higher than that in graph processing on the same dataset (i.e., RD). Besides, Fig. 3(c) depicts that the value of Memory Throttle of PGR is extremely higher than Aggregation phase (39.27% v.s. 0.225%). It means a large number of pending memory operations prevent further forward progress in the micro-architecture pipeline on PGR due to the fine-grained and irregular data access to feature data. However, the accesses to long-length feature data in Aggregation phase can be reduced by combining several memory transactions into one. These three results demonstrate that Aggregation phase has an extra spatial locality in the access to feature data compared to graph processing.

High-degree parallelism exists intra vertex. Except for the inter-vertex and inter-edge parallelism as in graph processing, Aggregation phase possesses a new kind of parallelism, the intra-vertex parallelism. This parallelism comes from the element-wise aggregation of each neighboring vertex feature vector. As a result, the Achieved Occupancy and Issue Slot Utilization of Aggregation phase are higher than that in graph processing as shown in Fig. 3(d) and (e).

Only inter-warp atomic collision exists in parallelism exploitation. Atomic collision refers to scenarios where multiple threads try to read-modify-write the same data word simultaneously. To guarantee the atomicity, these updates from different threads will be serialized. There are two collisions existing in GPUs: inter-warp collision and intra-warp collision. Since each thread inside a warp processes one of the consecutive feature elements of neighboring feature vector, there is almost no intra-warp collision in Aggregation phase. In contrary, in PGR, each thread processes a random vertex with a single feature element. It means that the threads intra or inter warp may update the same vertex, which causes inter-warp collision or intra-warp collision. Thus, Atomic Transactions Per Request is 1.1 in Aggregation phase (Fig. 3(f)), smaller than the 17.9 in PGR.

Aggregation phase exhibits lower reuse of neighbors’ feature data than that in graph processing. Although the graph traversal in Aggregation phase is same to that in PGR, L2 cache hit ratio in Aggregation phase is extremely low. Fig. 3(g) shows L2 cache hit ratio of Aggregation phase is only 6.9% while that is 56.2% in PGR, even although they process the same graph. The reason is as follows. The vertex data in graph processing is only one element, while the feature vector contains hundreds element in Aggregation phase. As a result, L2 cache can hold many vertex data in PGR, which enlarges the opportunity to reuse the vertex data of the shared neighbor. However, L2 cache can only contain smaller amount of feature vectors in Aggregation phase, which results in longer data reuse distance of feature vector than that in graph processing. Therefore, Aggregation phase exhibits low reuse of neighbors’ feature data.

4.3 Analysis of Combination Phase

Here, we provide detailed analysis of the Combination phase on SAG model with RD dataset and compare it with MLP-MNIST with batch size 1,000, such that both model has similar batch size and input feature vector length.

The parameters of neural network exhibits extremely high reusability inter vertex. To classify one handwritten number in MNIST with MLP, only a single feature vector need to be forwarded. On the contrary, in node classification tasks, the feature vectors of all the neighbors within -hop of the target node need to be processed. In graph classification tasks, all the vertex in the graphs should be processed. When processing multiple feature vectors, the parameters in the model can be shared across all the features. As a result, Combination phase presents more reusability on the parameters of neural network.

High-degree parallelism exists inter vertex. As mentioned before, the amount of feature vectors processed in Combination phase is much larger than traditional neural networks, which introduces more parallelism. As a result, it is more capable of feeding up the thousands of parallel floating-point units in GPU and hiding the latency to memory. As shown in Fig. 3 (a) and (b), Multiprocessor Activity(%) and Executed IPC of Combination phase are 98.885% and 1.8, more than 76.829% and 1.3 respectively, the values of MLP-MNIST.

4.4 Analysis of Overall Execution

Here, we analysis the overall execution on SAG model.

Fig. 4: Percentages of issue stall reasons on SAG model.

Hybrid execution patterns exist. In Aggregation phase, the Computation Unit Utilization is only 50% and the Executed IPC is only 1.78 on average as shown in Table III. The aggregation heavily relies on the graph structure so that it is obstructed by irregularity [GraphDynS] and load-load data dependency chain [Memory_Hierarchy_Graph]. Therefore, it is mainly stalled for Data Request and Execution Dependency as depicted in Fig. 4. The irregularity also leads to low L2 Cache Hit Rate (6.87%) and high DRAM Byte per Operation (2.35). In contrary, the Combination phase achieves 90% Computation Unit Utilization and 2.49 Executed IPC. The intensive Float-Point calculations well hide the data access latency, and the stalls are issued majorly for Pipe Busy and Not Selected, which is due to the limited number of computation units. The regular execution pattern leads to high spatial and temporal data locality, the L2 Cache Hit Rate is 82.5% and DRAM Byte per Operation is as low as 0.01. As a result, while the Aggregation phase is memory bound with irregular data access pattern and low data reusability, the Combination phase is computation bound with regular data access pattern and high data reusability.

Aggregation Combination
Computation Unit Utilization 50% 90%
Executed IPC 1.78 2.49
L2 Cache Hit Rate 6.87% 82.5%
DRAM Byte per Operation 2.35 0.01
Execution Bound Memory Compute
Data Access Pattern Irregular Regular
Data Reusability Low High
TABLE III: Characterization of hybrid execution patterns on RD

Execute Combination phase ahead of Aggregation phase helps reduce data access and computation of Aggregation phase. While the feature length in RD is 602, the Combination phase usually reduces the dimension to 128 by a factor of . Therefore, in the Aggregation phase, the data access to neighbor’s feature vector becomes less and the computation for the aggregation of each neighbor also becomes less. Table. IV illustrates the reduction of data accesses and computations in Aggregation phase, up to 4.75 and 4.72 respectively. Moreover, the performance achieves 4.76 improvement.

Com Agg Agg Com Reduction
Data Accesses (bytes) 568,064,375 2,698,865,170 4.75
Computations (Operations) 231,995,186 1,096,220,688 4.72
Execution Time (ms) 1.12 5.34 4.76
TABLE IV: Impact of the execution flow on Aggregation phase.

A dataflow exists inter phase in GCNs for each vertex. The result of each vertex in Aggregation phase is taken as the input of Combination phase for the transformation of each vertex. It indicates that a vertex is able to start the execution in Combination phase after this vertex completes its aggregation. Therefore, an inter-phase dataflow exists in GCNs for each vertex. However, to leverage the hardware-optimized functions, the implementation of GCNs on GPU misses this inter-phase dataflow. As a result, many unnecessary data accesses and data addressing computations are introduced.

4.5 Exploring GCN Model

Here, we explore the new features of GCNs on SAG model with RD dataset. As SAG executes Combination phase ahead of Aggregation phase, the execution time of Combination phase is determined by the length of both input and output feature vector, while Aggregation is only determined by the length of output feature vector.

Fig. 5: Exploration on the length of input feature vector (a) and output feature vector (b).

Various Length of Input Feature Vector. As illustrated in Fig. 5 (a), the execution time of Combination phase is almost proportion to input feature length. An interesting observation is that there are sweet spots when the input dimension is the index of 2, i.e. 256.

Various Length of Output Feature Vector. As illustrated in Fig. 5 (b), the execution time of Aggregation phase increases linearly with the output feature length. On the other hand, the Combination phase is insensitive to the output feature size when the feature length is smaller than 64, which is due to the redundant computational resources. Besides, the sweet spot still exists when the output dimension is the index of 2.

5 Architectural Guidelines

5.1 Software Optimization Guideline

Degree-aware Feature Access Scheduling. Real-world graphs possess well-connected regions where relatively few vertices share edges with many common neighbors. It indicates that the vertices with large degree exhibits high reusability on their feature data. Thus, an online data access scheduling can leverage that to shorten the reuse distance.

Vectorizing Atomic Operation. To improve the parallelism efficiency, vectorizing atomic operation is available for Aggregation to reduces the atomic overhead in GPU since only inter-warp collision exits in GCNs.

Adaptive Execution Granularity. Leveraging inter-phase dataflow is an excellent opportunity to overlap the memory-bound Aggregation phase and computation-bound Combination phase. Meanwhile, it is also important to leverage the architecture’s advantage. Therefore, an appropriate or adaptive granularity for execution can achieve a better trade-off.

5.2 Hardware Optimization Guideline

Degree- and Length-aware Replacement Policy. To ease the programmer efforts and improve data reuse, L2 Cache can be modified to equip a degree- and length-aware replacement policy. This policy can replace the vertex feature by aware of its degree, which indicates its reusability. Besides, it can replace the whole vertex feature vector in a time since all the elements in vector are used together. This way helps fire many requests at the same time to exploit the high bandwidth memory.

6 Conclusion

In this work, we characterize and explore an emerging application GCNs on NVIDIA V100 GPU. The characterization results can help programmers understand the execution pattern of GCNs. We also believe the observations made in this paper will provide useful guidance to enable future architecture and system research for GCNs.

References