NVIDIA has expanded support for Green Contexts to the CUDA 13.1 Runtime API, giving developers explicit control over how GPU hardware resources are partitioned within a single process. First introduced in the CUDA 12.4 Driver API, Green Contexts allow applications to assign dedicated subsets of Streaming Multiprocessors (SMs) and configure isolated workqueues, preventing background tasks from interfering with latency-sensitive workloads.
Bypassing Stream Priority Bottlenecks
Standard CUDA execution relies on stream priorities to schedule concurrent work, but stream priority cannot preempt blocks already executing on an SM. When a throughput-oriented kernel saturates the GPU, a high-priority task must wait for active blocks to drain before SM resources become available.
Green Contexts eliminate this delay by carving out dedicated hardware resources for critical kernels. In NVIDIA benchmarks on a Blackwell GPU with 148 SMs, running a critical kernel on dedicated Green Context partitions reduced latency by 20x compared to high-priority stream scheduling without partitioning. Stream priority alone provided a 27x improvement over unprioritized default streams, but bound latency to block drain times.
Explicit Resource Control via Runtime Handles
Traditional CUDA Runtime applications select devices through calls such as cudaSetDevice() and infer execution targets from implicit thread-local state. CUDA 13.1 introduces the cudaExecutionContext_t type to make resource selection explicit.
Developers define partitions using cudaGreenCtxCreate() and assign explicit handles to streams with cudaExecutionCtxStreamCreate(). In addition to SM counts, applications can provision dedicated workqueue resources using descriptors, avoiding false dependencies and queue serialization across independent streams.
Targeted Workloads and Integration
NVIDIA highlights Green Contexts for applications requiring precise performance isolation, such as overlapping communication and GEMM kernels during distributed training or executing real-time operators in AI platforms like NVIDIA Holoscan. The model is opt-in and additive, allowing developers to maintain full-device targeting via cudaDeviceGetExecutionCtx() or adopt granular partitioning where required.
AI-generated editorial illustration; not a documentary photograph.
Source: Control How Your GPU Shares Work with Green Contexts

Leave a Reply