Skip to content
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

[v1.19.x] hmem/synapseai: Refine the error handling and warning #9579

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions src/hmem_synapseai.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,32 @@ int synapseai_init(void)

err = synapseai_dl_init();
if (err)
return -FI_ENODATA;
return err;

status = synapseai_ops.synInitialize();
if (status != synSuccess)
return -FI_ENODATA;
if (status != synSuccess) {
FI_WARN(&core_prov, FI_LOG_CORE,
"synInitialize failed: %d\n", status);
return -FI_EIO;
}

status = synapseai_ops.synDeviceGetCount(&device_count);
if (status != synSuccess || device_count == 0)
/*
* TODO We should call destroy here to free resources allocated
* in initialize, but the destroy call hangs on instances without
* a habana device
*/
return -FI_ENODATA;

/*
* TODO: Starting from here we should call synDestroy before
* returning error to free the resources allocated in synInitialize,
* but the destroy call hangs on instances without
* a habana device
*/

if (status != synSuccess) {
FI_WARN(&core_prov, FI_LOG_CORE,
"synDeviceGetCount failed: %d\n", status);
return -FI_EIO;
}

if (device_count == 0)
return -FI_ENOSYS;

return FI_SUCCESS;
}
Expand Down