NVIDIA Green Contexts in CUDA 13.1 Partition SMs to Slash Tail Latency
NVIDIA introduced Green Contexts in the CUDA 13.1 Runtime API, letting developers explicitly carve out Streaming Multiprocessors and workqueues within a single process. On Blackwell hardware, reserving compute resources for latency-critical kernels reduced scheduling delays from 0.140 ms to 0.007 ms.

Why it matters
You can now run background batch inference or data preprocessing alongside real-time latency-sensitive AI kernels without blocking high-priority requests.
TL;DR
- 01Green Contexts arrive in the CUDA 13.1 Runtime API to partition SMs within a single process.
- 02Prevents heavy background kernels from stalling latency-critical inference tasks.
- 03Cuts kernel startup delay from 0.140 ms to 0.007 ms on Blackwell architectures.
Key facts
- Runtime API Availability
- CUDA 13.1 (Driver API since CUDA 12.4)
- Kernel Latency Drop
- 0.140 ms to 0.007 ms on Blackwell (vendor reported)
- Test Hardware
- NVIDIA Blackwell GPU with 148 SMs
The Tail-Latency Bottleneck on Shared GPUs
Modern AI serving architectures frequently execute heterogeneous workloads concurrently: data preprocessing routines alongside model inference, or communication collectives alongside matrix multiplication (GEMM). While CUDA stream priorities help order tasks in queues, they cannot preempt hardware execution blocks already scheduled on an SM. If a large throughput kernel fully saturates the GPU, critical tasks suffer substantial latency jitter waiting for slots to drain.
Explicit Resource Partitioning with CUDA 13.1
While previously restricted to the lower-level Driver API in CUDA 12.4, CUDA 13.1 brings Green Contexts to the standard Runtime API through cudaGreenCtxCreate() and cudaExecutionCtxStreamCreate(). Applications can explicitly slice execution units:
- SM partitioning: Allocates a fixed subset of SMs to dedicated contexts, ensuring latency-sensitive kernels never compete for the same execution hardware.
- Workqueue isolation: Assigns distinct hardware queues via
cudaDevResourceTypeWorkqueueConfig, eliminating unintentional serialization and queue contention across independent streams.
Benchmark measurements on a Blackwell GPU featuring 148 SMs demonstrated a reduction in critical kernel latency from 0.140 ms down to 0.007 ms when co-scheduled against saturated bulk workloads.
Try it in 2 minutes
cudaGreenCtxCreate(&greenCtx, desc, device, 0);
cudaExecutionCtxStreamCreate(&s, greenCtx, 0, 0);cpp
✓ When to use
- Multi-stage inference services serving real-time requests concurrently with heavy background data preprocessing.
- Overlapping communication kernels and GEMM workloads in distributed serving architectures.
✕ When NOT to use
- Simple single-workload applications that already consume 100% of GPU compute sequentially.
- Legacy CUDA setups operating below version 13.1 without Driver API access.
What to do today
- Update development environments to CUDA Toolkit 13.1 or later.
- Replace device-level stream initialization with cudaGreenCtxCreate and cudaExecutionCtxStreamCreate.
- Isolate real-time inference streaming pipelines from background data batching tasks.