We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c4ae460 commit 4c3f9abCopy full SHA for 4c3f9ab
source/adapters/hip/event.cpp
@@ -330,8 +330,19 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventCreateWithNativeHandle(
330
ur_event_handle_t *phEvent) {
331
std::ignore = pProperties;
332
333
- *phEvent = ur_event_handle_t_::makeWithNative(
334
- hContext, reinterpret_cast<hipEvent_t>(hNativeEvent));
+ std::unique_ptr<ur_event_handle_t_> EventPtr{nullptr};
+
335
+ try {
336
+ EventPtr =
337
+ std::unique_ptr<ur_event_handle_t_>(ur_event_handle_t_::makeWithNative(
338
+ hContext, reinterpret_cast<hipEvent_t>(hNativeEvent)));
339
+ } catch (const std::bad_alloc &) {
340
+ return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY;
341
+ } catch (...) {
342
+ return UR_RESULT_ERROR_UNKNOWN;
343
+ }
344
345
+ *phEvent = EventPtr.release();
346
347
return UR_RESULT_SUCCESS;
348
}
0 commit comments