-
Notifications
You must be signed in to change notification settings - Fork 787
[UR][L0 v1/v2 adapter]Handle errors of img functions #18261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -274,7 +274,15 @@ ur_result_t createUrImgFromZeImage(ze_context_handle_t hContext, | |||
ur_exp_image_mem_native_handle_t *pImg) { | |||
ze_image_handle_t ZeImage; | |||
ZE2UR_CALL(zeImageCreate, (hContext, hDevice, &ZeImageDesc, &ZeImage)); | |||
ZE2UR_CALL(zeContextMakeImageResident, (hContext, hDevice, ZeImage)); | |||
if (ZeImage == nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually possible for ZeImage to be nullptr if we got SUCCESS from zeImageCreate?
try { | ||
ZE2UR_CALL_THROWS(zeContextMakeImageResident, (hContext, hDevice, ZeImage)); | ||
} catch (const ze_result_t &result) { | ||
ZE2UR_CALL(zeImageDestroy, (ZeImage)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of manually calling zeImageDestory (which is error prone) it would be better to use v2::raii:ze_image_handle_t
@intel/llvm-gatekeepers please merge, the issue is unrelated and tracked here: #18349 |
Handle errors in image functions to avoid memory leaks