TL;DR
Kernelet is a runtime system that improves GPU throughput in shared environments by dynamically "slicing" large kernels into smaller sub-units. By using a novel Markov chain-based performance model to co-schedule complementary slices (e.g., pairing a compute-heavy task with a memory-heavy one), it achieves up to a 31% performance boost over standard execution methods.
What Problem Does This Paper Address?
While modern GPUs are incredibly powerful, individual kernels often fail to fully utilize their resources. A kernel might be "compute-bound" (stalling the memory bus while the processors work) or "memory-bound" (leaving the processors idle while waiting for data).
In shared environments like clusters or clouds, multiple users submit kernels simultaneously. Even though architectures like NVIDIA's Fermi introduced "concurrent kernel execution," they often fall short. A single large kernel can still hog the entire GPU, forcing other kernels to wait in a queue even if the GPU is 90% underutilized. The authors identify a major gap: we need a way to break these "resource-hogging" kernels into smaller pieces that can be interleaved to fill the hardware's idle gaps.
Methods
The authors introduce Kernelet, which consists of three main components:
- Dynamic Kernel Slicing: Kernelet intercepts GPU kernels at the assembly level (PTX or SASS). It divides a kernel into "slices"—groups of thread blocks. To make this transparent to the user, it uses a technique called index rectification, which modifies the internal thread IDs so the slice "thinks" it is part of the original, larger grid.
- Markov Chain Performance Model: This is the core innovation. Predicting how two kernels will behave when running together is difficult because warp scheduling is non-deterministic. The authors model the Streaming Multiprocessor (SM) as a stochastic process. By calculating the probability of warps being in "ready" or "idle" states, the model estimates the Co-scheduling Profit (CP)—the throughput gain from running two specific kernels together.
- Greedy Scheduler: To keep runtime overhead low, the scheduler doesn't try to solve the NP-complete problem of scheduling $N$ kernels. Instead, it focuses on pairing two kernels at a time. It uses "pruning" rules to quickly discard pairs that are too similar (e.g., two memory-heavy kernels that would just fight for bandwidth) and selects the pair with the highest predicted CP.
Datasets
The system was evaluated using eight common GPGPU benchmarks representing different resource needs:
- Compute-Intensive: Matrix Multiplication (MM), Black Scholes (BS), Tiny Encryption Algorithm (TEA), and Magnetic Resonance Imaging (MRIQ).
- Memory-Intensive: Pointer Chasing (PC), Sparse Matrix-Vector Multiplication (SPMV), Stencil (ST), and Sum of Absolute Differences (SAD).
These were tested on two architectures: the NVIDIA Tesla C2050 (Fermi) and the GTX680 (Kepler).
Key Insights and Ideas
- Complementary Resource Usage: The "aha moment" is that throughput isn't just about speed; it's about balance. Pairing a kernel that has high Pipeline Utilization (PUR) with one that has high Memory-bandwidth Utilization (MUR) allows the second kernel to "hide" in the idle cycles of the first.
- Slicing Granularity Matters: There is a trade-off between flexibility and overhead. Small slices allow for perfect scheduling but increase the cost of launching many tiny kernels. The authors found that setting a slice size that results in roughly 2% overhead is the "sweet spot."
- Assembly-Level Transformation: By working with PTX/SASS code, Kernelet works on existing binaries without requiring developers to rewrite their source code or provide manual hints.
Key Results
- Throughput Gains: Kernelet improved throughput by 5.0%–31.1% on the Tesla C2050 and 6.7%–23.4% on the GTX680 compared to standard sequential execution.
- Model Accuracy: The Markov chain model proved highly accurate, predicting Instruction Per Cycle (IPC) with an average absolute error of only 0.08 on the C2050.
- Superiority over Randomness: Using a Monte Carlo simulation of 1,000 random schedules, the authors showed that random co-scheduling often hurts performance. Kernelet’s model-driven approach consistently found the "winning" combinations in the massive search space.
Limitations and Future Work
- Two-Kernel Limit: The current scheduler only considers co-running two kernels at once. While this simplifies the math and reduces overhead, modern high-end GPUs might have enough resources to benefit from three or more concurrent kernels.
- Thread Block Independence: The slicing technique assumes that thread blocks are independent. While this is a standard assumption in the CUDA programming model, kernels that rely on complex inter-block communication or specific execution orders might break under slicing.
- Hardware Evolution: Since this paper was published (2013), NVIDIA has introduced hardware features like Multi-Process Service (MPS) and Multi-Instance GPU (MIG). Future work could involve integrating Kernelet’s sophisticated performance modeling with these newer hardware-level partitioning features.
Summary updated