GCAPS: GPU Context-Aware Preemptive Priority-based Scheduling for Real-Time Tasks

Cong Liu, Yidi Wang, Cong Liu 0005, Daniel Wong, Hyoseung KimarXiv 2024 · DOI

Abstract

In modern autonomous systems, GPUs are critical for AI-driven perception and decision-making. However, standard GPU drivers prioritize throughput and fairness over real-time predictability, often leading to priority inversion. This paper introduces GCAPS, a novel driver-level scheduling framework that enables high-priority real-time tasks to preempt lower-priority GPU workloads. By replacing standard round-robin policies with priority-aware scheduling, GCAPS achieves up to 40% higher taskset schedulability and significantly more predictable response times on Nvidia Jetson platforms with minimal code changes.

Introduction

Standard GPU drivers, such as Nvidia’s Tegra driver, typically employ a work-conserving round-robin policy. While efficient for general-purpose computing, this creates a "black box" problem for real-time engineers: a safety-critical task (e.g., emergency braking) may be delayed by a low-priority background process. Existing solutions often require either long blocking times or extensive application-level code rewrites. GCAPS aims to bridge this gap by providing fine-grained priority control at the driver level without requiring massive software modifications.

The GCAPS Framework

The core innovation of GCAPS is moving scheduling logic into the GPU device driver while maintaining a simple interface for developers.

Driver-Level TSG Scheduling

The authors modified the Nvidia Tegra driver's Time-Sliced Group (TSG) scheduler. Instead of cycling through all active tasks, the modified driver maintains a "runlist" that strictly prioritizes real-time tasks based on assigned priorities.

The modified driver runlist for priority-based TSG scheduling.

Implementation and Analysis

  • Developer Macros: Developers wrap GPU code blocks with gcapsGpuSegBegin() and gcapsGpuSegEnd() macros. These trigger IOCTL commands that notify the driver to update the runlist and potentially preempt lower-priority tasks.
  • Priority Decoupling: Using Audsley’s algorithm, GCAPS assigns GPU priorities independently of CPU priorities. This allows short, critical GPU kernels to be prioritized even if their parent CPU process has a lower priority.
  • Response Time Analysis (RTA): The framework includes a mathematical model to calculate the Worst-Case Response Time (WCRT), accounting for GPU context-switching overheads which typically range from 200µs to 1000µs.

Evaluation and Results

GCAPS was evaluated using synthetic tasksets and real-world benchmarks (e.g., matrix multiplication, histogram) on Nvidia Jetson Xavier NX and Orin Nano platforms.

Key Findings

  • Schedulability: GCAPS outperformed standard round-robin and synchronization-based methods by up to 40% in high-utilization scenarios.
  • Latency Reduction: In a Jetson Xavier case study, the Maximum Observed Response Time (MORT) for the highest-priority task dropped from 45.33ms under the standard driver to just 9.68ms with GCAPS.
  • Predictability: Experimental results closely tracked theoretical WCRT bounds, confirming the system's predictability.
Comparison of response times between standard scheduling (left) and GCAPS priority-based preemption (right).

Conclusion

GCAPS provides a predictable, high-performance solution for real-time GPU tasks by leveraging hardware-native context switching under a priority-aware driver policy. While it currently requires manual instrumentation and uses static priorities, future work could explore dynamic priority scheduling (like Earliest Deadline First) and spatial partitioning to further improve efficiency in complex autonomous systems.

Summary updated

BibTeX
@misc{liu2024gcaps,
  author = {Cong Liu and Yidi Wang and Cong Liu and Daniel Wong and Hyoseung Kim},
  title = {{GCAPS: GPU Context-Aware Preemptive Priority-based Scheduling for Real-Time Tasks}},
  year = {2024},
  eprint = {2406.05221},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.05221},
}
Figure