Developer Tools

PyTorch adds _sleep function for XPU GPU devices

New `torch.xpu._sleep` enables precise timing on Intel GPUs

Deep Dive

PyTorch's latest trunk commit adds `_sleep` support for XPU devices, as detailed in pull request #189527. This function, accessible via `torch.xpu._sleep`, enables developers to pause GPU execution on Intel's XPU architecture for a specified duration. The feature is specifically recommended for Xe2 or newer GPUs, ensuring optimal performance and compatibility. The underlying implementation is housed in the Intel torch-xpu-ops repository (PR #3629), and the PyTorch PR was approved by EikanWang and albanD, with dependencies on PR #190155.

This addition fills a gap in PyTorch's XPU support, giving users a low-level tool for GPU timing, synchronization, or testing. It mirrors similar `sleep` functions available on CUDA, allowing developers to port code or implement timeouts on Intel hardware. While not a high-level user feature, `_sleep` is valuable for debugging driver behavior, benchmarking, or coordinating multi-GPU workflows. The merge on July 24, 2023, marks a step toward feature parity between CUDA and XPU backends in PyTorch.

Key Points
  • Adds `torch.xpu._sleep` function for pausing execution on Intel GPUs
  • Recommended for Xe2 or newer XPU architectures
  • Implementation depends on intel/torch-xpu-ops PR #3629

Why It Matters

Enables low-level GPU timing control on Intel hardware, aiding debugging and synchronization workflows.

📬 Get the top 10 AI stories daily