Files
pytorch/docs/cpp/source/api/xpu/index.md
T
Svetlana Karslioglu 19da3da3d3 Restructure C++ docs (#174096)
The fix-cpp-build branch is a major restructuring that:

- Drops Exhale (which auto-generated API docs but caused OOM in CI) in favor of hand-written RST pages using Breathe directives
- Reorganizes notes into a hierarchical API reference with proper categories
- Adds new content: XPU docs, stable ABI docs, DeviceGuard/Stream docs
- Always runs Doxygen instead of gating on an env var

Pull Request resolved: https://github.com/pytorch/pytorch/pull/174096
Approved by: https://github.com/janeyx99, https://github.com/seemethere, https://github.com/albanD
2026-04-07 17:24:38 +00:00

1.1 KiB

myst
myst
html_meta
description keywords
PyTorch XPU C++ API — Intel GPU support with device management, streams, and guards. PyTorch, C++, XPU, Intel GPU, device, stream

XPU Support

PyTorch provides XPU support for Intel GPU-accelerated tensor operations. The XPU API allows you to manage Intel GPU devices, streams for asynchronous execution, and synchronization.

When to use XPU APIs:

  • When running on Intel GPUs (Data Center GPU Max, Arc, etc.)
  • When implementing custom XPU kernels or operations
  • When managing asynchronous execution with XPU streams
  • When writing device-portable code alongside CUDA

Basic usage:

#include <torch/torch.h>

// Check if XPU is available
if (torch::xpu::is_available()) {
    // Create tensor on XPU
    auto tensor = torch::randn({2, 3}, torch::device(torch::kXPU));

    // Move model to XPU
    model->to(torch::kXPU);
}

Header Files

  • torch/xpu.h - High-level XPU utilities (device count, availability, seeding)
  • c10/xpu/XPUStream.h - XPU stream management

XPU Categories

:maxdepth: 1

streams
utilities