Skip to content

Commit 66bf2d3

Browse files
Make sure to catch SYCL exception around event::wait calls
1 parent 646aee6 commit 66bf2d3

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

libsyclinterface/source/dpctl_sycl_event_interface.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ void DPCTLEvent_Wait(__dpctl_keep DPCTLSyclEventRef ERef)
6060
{
6161
if (ERef) {
6262
auto SyclEvent = unwrap(ERef);
63-
if (SyclEvent)
64-
SyclEvent->wait();
63+
try {
64+
if (SyclEvent)
65+
SyclEvent->wait();
66+
} catch (std::exception const &e) {
67+
error_handler(e, __FILE__, __func__, __LINE__);
68+
}
6569
}
6670
else {
6771
error_handler("Cannot wait for the event. DPCTLSyclEventRef as "
@@ -74,8 +78,12 @@ void DPCTLEvent_WaitAndThrow(__dpctl_keep DPCTLSyclEventRef ERef)
7478
{
7579
if (ERef) {
7680
auto SyclEvent = unwrap(ERef);
77-
if (SyclEvent)
78-
SyclEvent->wait_and_throw();
81+
try {
82+
if (SyclEvent)
83+
SyclEvent->wait_and_throw();
84+
} catch (std::exception const &e) {
85+
error_handler(e, __FILE__, __func__, __LINE__);
86+
}
7987
}
8088
else {
8189
error_handler("Cannot wait_and_throw for the event. DPCTLSyclEventRef "

0 commit comments

Comments
 (0)