XPUGraphsUtils.h 810 B

123456789101112131415161718192021222324252627
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. #pragma once
  3. #include <c10/xpu/XPUGraphsC10Utils.h>
  4. namespace at::xpu {
  5. inline CaptureStatus currentStreamCaptureStatus() {
  6. return c10::xpu::currentStreamCaptureStatusMayInitCtx();
  7. }
  8. inline void assertNotCapturing(const std::string& attempt) {
  9. auto status = currentStreamCaptureStatus();
  10. TORCH_CHECK(
  11. status == CaptureStatus::Executing,
  12. attempt,
  13. " during XPU graph capture. If you need this call to be captured, "
  14. "please file an issue. "
  15. "Current xpuStreamCaptureStatus: ",
  16. status);
  17. }
  18. } // namespace at::xpu
  19. #else
  20. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  21. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)