xref: /aosp_15_r20/external/pytorch/aten/src/ATen/xpu/XPUDevice.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <ATen/Context.h>
4 #include <c10/xpu/XPUFunctions.h>
5 
6 namespace at::xpu {
7 
getDeviceFromPtr(void * ptr)8 inline Device getDeviceFromPtr(void* ptr) {
9   auto device = c10::xpu::get_device_idx_from_pointer(ptr);
10   return {c10::DeviceType::XPU, device};
11 }
12 
13 } // namespace at::xpu
14