XPUException.h 415 B

12345678910111213141516171819202122
  1. #pragma once
  2. #include <c10/util/Exception.h>
  3. #include <sycl/sycl.hpp>
  4. namespace c10::xpu {
  5. static inline sycl::async_handler asyncHandler = [](sycl::exception_list el) {
  6. if (el.size() == 0) {
  7. return;
  8. }
  9. for (const auto& e : el) {
  10. try {
  11. std::rethrow_exception(e);
  12. } catch (sycl::exception& e) {
  13. TORCH_WARN("SYCL Exception: ", e.what());
  14. }
  15. }
  16. throw;
  17. };
  18. } // namespace c10::xpu