1 #pragma once 2 3 #include <c10/core/Device.h> 4 #include <c10/xpu/XPUDeviceProp.h> 5 #include <c10/xpu/XPUMacros.h> 6 7 // The naming convention used here matches the naming convention of torch.xpu 8 9 namespace c10::xpu { 10 11 // Log a warning only once if no devices are detected. 12 C10_XPU_API DeviceIndex device_count(); 13 14 // Throws an error if no devices are detected. 15 C10_XPU_API DeviceIndex device_count_ensure_non_zero(); 16 17 C10_XPU_API DeviceIndex current_device(); 18 19 C10_XPU_API void set_device(DeviceIndex device); 20 21 C10_XPU_API DeviceIndex exchange_device(DeviceIndex device); 22 23 C10_XPU_API DeviceIndex maybe_exchange_device(DeviceIndex to_device); 24 25 C10_XPU_API sycl::device& get_raw_device(DeviceIndex device); 26 27 C10_XPU_API sycl::context& get_device_context(); 28 29 C10_XPU_API void get_device_properties( 30 DeviceProp* device_prop, 31 DeviceIndex device); 32 33 C10_XPU_API DeviceIndex get_device_idx_from_pointer(void* ptr); 34 35 } // namespace c10::xpu 36