Skip to content

Commit c5c0be5

Browse files
authored
[UR][CUDA][HIP] Add missing catch for native commands (#17524)
This UR entry point calls a user function pointer, which may throw exceptions so we need an exception catchall there to ensure they don't cross the UR C API boundary. It's unclear if exceptions should even be allowed in these user functions, but this is still a worthwhile precaution.
1 parent 270bb93 commit c5c0be5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

unified-runtime/source/adapters/cuda/enqueue_native.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueNativeCommandExp(
5555
return Err;
5656
} catch (CUresult CuErr) {
5757
return mapErrorUR(CuErr);
58+
} catch (...) {
59+
return UR_RESULT_ERROR_UNKNOWN;
5860
}
5961
return UR_RESULT_SUCCESS;
6062
}

unified-runtime/source/adapters/hip/enqueue_native.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueNativeCommandExp(
5858
return Err;
5959
} catch (hipError_t hipErr) {
6060
return mapErrorUR(hipErr);
61+
} catch (...) {
62+
return UR_RESULT_ERROR_UNKNOWN;
6163
}
6264
return UR_RESULT_SUCCESS;
6365
}

0 commit comments

Comments
 (0)