Abstract
Serverless computing has revolutionized CPU workloads by abstracting infrastructure and enabling fine-grained scaling. However, integrating GPUs into Function-as-a-Service (FaaS) platforms remains inefficient due to the tight coupling of host CPU code and GPU resources. This paper introduces Kernel-as-a-Service (KaaS), a novel interface that treats GPU kernels as first-class, independently invocable functions. By decoupling kernels from host code and delegating memory management to the system, KaaS achieves up to 50x higher throughput and 16x lower latency than traditional FaaS+GPU approaches under heavy multitenant contention.
Introduction
Serverless computing platforms like AWS Lambda are popular because they offer automatic scaling and a pay-as-you-go model. While this works well for stateless CPU tasks, cloud providers struggle to offer a true serverless experience for GPUs. Currently, "GPU+FaaS" approaches attach a GPU to a standard container. Because the system cannot see what the user's Python code is doing with the hardware, it must grant the container exclusive access.
This leads to two major issues:
- Resource Stranding: GPUs remain idle while the host CPU code (often slow Python) executes.
- Cold Start Penalties: Scaling requires booting new processes and loading heavy ML frameworks (e.g., PyTorch), which can take hundreds of milliseconds, dwarfing the actual GPU execution time.
The KaaS Architecture
To address these inefficiencies, the authors propose Kernel-as-a-Service (KaaS). The core innovation is the fundamental decoupling of host CPU code from GPU execution. In KaaS, the system manages the GPU as a shared resource rather than an exclusive attachment to a container.
As shown in the figure above, traditional serverful and FaaS models bundle CPU and GPU resources. KaaS (c) separates the host (CPU/Mem) from the GPU, allowing the system to multiplex kernel graphs from multiple tenants onto the same hardware without restarting worker processes.
The kTask Model
Instead of uploading scripts that call GPU libraries, KaaS users submit kTasks (Kernel Tasks). A kTask is a directed acyclic graph (DAG) of precompiled CUDA kernels with explicit specifications for input, output, and temporary memory buffers.
By removing user-provided host code from the GPU executor, KaaS enables several system-level optimizations:
- System-Managed Memory: KaaS uses a tiered caching system for host and GPU memory. It can intelligently cache read-only data (like model weights) and evict them using an LRU policy, preventing the "out of memory" errors common in shared environments.
- Fine-Grained Scheduling: A permanent KaaS executor runs on the GPU, using a "CFS-Affinity" policy to multiplex tasks from different users with minimal overhead.
Evaluation and Results
The authors implemented a KaaS prototype on the Ray distributed framework and evaluated it against a baseline "eTask" (Exclusive Task) approach that mimics traditional FaaS.
Eliminating Cold Starts
Microbenchmarks revealed that the ~400ms "cold start" in traditional GPU serverless is primarily due to Python dependency loading. KaaS eliminates this entirely, with its only overhead being the physical time required to copy data into GPU memory.
Performance Under Contention
In scenarios with 8x oversubscription (32 clients sharing 4 GPUs), KaaS maintained peak throughput while the baseline collapsed due to constant worker restarts. For compute-intensive tasks like an iterative Jacobi solver, KaaS delivered 50x higher throughput and 16x lower tail latency.
Memory Pressure
Even when aggregate memory demands exceeded physical VRAM by 1.5x, KaaS maintained 53x greater throughput than the baseline by efficiently evicting and reloading cached buffers at a fine granularity.
Conclusion
KaaS demonstrates that the primary bottleneck in serverless GPU computing is the host code, not the hardware itself. By treating kernels as independent functions, KaaS provides the predictability needed for high-density multitenancy. Future work includes supporting concurrent kernel execution and exploring "Serverless SoCs"—hardware specifically designed to run KaaS-style workloads in heterogeneous data centers.
Summary updated