File size: 437 Bytes
c61ccee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#pragma once

#include <c10/util/Exception.h>
#include <sycl/sycl.hpp>

namespace c10::xpu {

static inline sycl::async_handler asyncHandler = [](sycl::exception_list el) {
  if (el.size() == 0) {
    return;
  }
  for (const auto& e : el) {
    try {
      std::rethrow_exception(e);
    } catch (sycl::exception& e) {
      TORCH_WARN("SYCL Exception: ", e.what());
    }
  }
  throw;
};

} // namespace c10::xpu