xref: /aosp_15_r20/external/pytorch/aten/src/ATen/xpu/XPUContext.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <ATen/Context.h>
4 #include <c10/xpu/XPUFunctions.h>
5 #include <c10/xpu/XPUStream.h>
6 
7 namespace at::xpu {
8 
9 // XPU is available if we compiled with XPU.
is_available()10 inline bool is_available() {
11   return c10::xpu::device_count() > 0;
12 }
13 
14 TORCH_XPU_API DeviceProp* getCurrentDeviceProperties();
15 
16 TORCH_XPU_API DeviceProp* getDeviceProperties(DeviceIndex device);
17 
18 TORCH_XPU_API int32_t getGlobalIdxFromDevice(DeviceIndex device);
19 
20 } // namespace at::xpu
21