mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
19da3da3d3
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
1.1 KiB
1.1 KiB
myst
| myst | ||||||
|---|---|---|---|---|---|---|
|
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