XPUContext.h 791 B

123456789101112131415161718192021222324252627
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. #pragma once
  3. #include <ATen/Context.h>
  4. #include <c10/xpu/XPUFunctions.h>
  5. #include <c10/xpu/XPUStream.h>
  6. namespace at::xpu {
  7. // XPU is available if we compiled with XPU.
  8. inline bool is_available() {
  9. return c10::xpu::device_count() > 0;
  10. }
  11. TORCH_XPU_API DeviceProp* getCurrentDeviceProperties();
  12. TORCH_XPU_API DeviceProp* getDeviceProperties(DeviceIndex device);
  13. TORCH_XPU_API int32_t getGlobalIdxFromDevice(DeviceIndex device);
  14. TORCH_XPU_API bool canDeviceAccessPeer(DeviceIndex device, DeviceIndex peer);
  15. } // namespace at::xpu
  16. #else
  17. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  18. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)