Introduction
Dynamic Parallelism (DP) is a critical feature in modern GPU architectures, enabling a running thread to launch its own "child" kernels directly from the device. This capability is essential for handling irregular, nested workloads—such as graph processing, adaptive mesh refinement, and hierarchical data structures—where the computational requirements are data-dependent and cannot be determined a priori by the CPU. Despite its utility, DP often introduces significant performance overhead, frequently referred to as a "performance tax."
The Challenges of Dynamic Parallelism
The primary bottlenecks in standard DP implementations are congestion and underutilization. When thousands of parent threads independently launch tiny child grids, the hardware's command processor is overwhelmed by the sheer volume of launch requests, leading to high latency. Furthermore, these tiny grids often lack sufficient threads to saturate the GPU's massive parallel hardware, leaving compute units idle. While expert programmers can manually optimize these launches, the resulting code is often complex and difficult to maintain. This paper presents an automated compiler framework designed to mitigate these overheads through source-to-source transformations.
Proposed Optimization Framework
The proposed framework, built on Clang/LLVM, implements three primary optimization techniques: automated thresholding, thread block coarsening, and multi-block aggregation.
Automated Thresholding
The framework employs a heuristic-based analysis to estimate the number of child threads a specific launch will generate at runtime. If the predicted thread count falls below a predefined threshold, the compiler bypasses the expensive dynamic launch mechanism. Instead, it serializes the child kernel's work directly within the parent thread, as illustrated in Figure 1. This avoids the latency associated with kernel scheduling and launch configuration for trivial amounts of work.
Thread Block Coarsening
To improve hardware utilization and reduce scheduling overhead, the framework applies thread block coarsening. This technique merges the workloads of multiple original child thread blocks into a single, larger "coarsened" block (see Figure 2). By reducing the total number of blocks the GPU scheduler must manage, coarsening helps amortize the fixed costs of kernel execution and synchronization.
Multi-block Aggregation
The third pillar of the framework is multi-block aggregation, which combines child grids from different parent threads into a single, larger grid. Unlike prior warp-level or grid-level approaches, this framework introduces multi-block granularity. This allows groups of thread blocks to collaborate on a single launch entirely on the GPU, avoiding the CPU involvement required by global grid aggregation and providing a "sweet spot" that ensures the hardware remains saturated.
Evaluation and Results
The framework was evaluated on an NVIDIA Volta V100 GPU using a suite of irregular benchmarks, including Breadth-First Search (BFS), Minimum Spanning Tree (MST), and Triangle Counting (TC), utilizing datasets like KRON and USA-road-d.NY.
The quantitative results are substantial:
- 43.0× geometric mean speedup over baseline applications using standard Dynamic Parallelism.
- 3.6× speedup over previous state-of-the-art aggregation techniques (e.g., KLAP).
- 13.4× speedup from thresholding alone, highlighting the importance of avoiding unnecessary kernel launches.
Conclusion
By automating complex optimizations like multi-block aggregation and coarsening, this compiler framework significantly reduces the performance barriers to using Dynamic Parallelism. While limitations remain—such as the inability to transform kernels using barrier synchronization (__syncthreads())—the framework provides a powerful tool for developers to achieve high performance on irregular workloads without sacrificing code maintainability.
Summary updated