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

Enable parallel instance loading backend attribute #208

Merged
merged 2 commits into from
Aug 4, 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
20 changes: 20 additions & 0 deletions src/onnxruntime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2674,6 +2674,10 @@ TRITONBACKEND_ModelFinalize(TRITONBACKEND_Model* model)
TRITONBACKEND_ISPEC TRITONSERVER_Error*
TRITONBACKEND_ModelInstanceInitialize(TRITONBACKEND_ModelInstance* instance)
{
// NOTE: If the corresponding TRITONBACKEND_BackendAttribute is enabled by the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanmayv25 added note here as requested.

Also added some generic BackendAttribute docs in the backend repo here: triton-inference-server/backend#87 - please review as well.

// backend for parallel model instance loading, the
// TRITONBACKEND_ModelInstanceInitialize may be called concurrently.
// Therefore, this function should be thread-safe.
const char* cname;
RETURN_IF_ERROR(TRITONBACKEND_ModelInstanceName(instance, &cname));
std::string name(cname);
Expand Down Expand Up @@ -2784,5 +2788,21 @@ TRITONBACKEND_ModelInstanceExecute(
return nullptr; // success
}

TRITONSERVER_Error*
TRITONBACKEND_GetBackendAttribute(
TRITONBACKEND_Backend* backend,
TRITONBACKEND_BackendAttribute* backend_attributes)
{
LOG_MESSAGE(
TRITONSERVER_LOG_VERBOSE,
"TRITONBACKEND_GetBackendAttribute: setting attributes");
// This backend can safely handle parallel calls to
// TRITONBACKEND_ModelInstanceInitialize (thread-safe).
RETURN_IF_ERROR(TRITONBACKEND_BackendAttributeSetParallelModelInstanceLoading(
backend_attributes, true));

return nullptr;
}

} // extern "C"
}}} // namespace triton::backend::onnxruntime