Skip to content

Commit f11762e

Browse files
authored
Implement GetBackendAttribute to provide instance kind hint (triton-inference-server#181)
* Implement GetBackendAttribute to provide instance kind hint * Address comment * Address comment
1 parent 5b2c1a1 commit f11762e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/python_be.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,5 +2002,28 @@ TRITONBACKEND_ModelInstanceFinalize(TRITONBACKEND_ModelInstance* instance)
20022002
return nullptr;
20032003
}
20042004

2005+
TRITONSERVER_Error*
2006+
TRITONBACKEND_GetBackendAttribute(
2007+
TRITONBACKEND_Backend* backend,
2008+
TRITONBACKEND_BackendAttribute* backend_attributes)
2009+
{
2010+
LOG_MESSAGE(
2011+
TRITONSERVER_LOG_VERBOSE,
2012+
"TRITONBACKEND_GetBackendAttribute: setting attributes");
2013+
// Specify different preferred instance kind based on backend compatibility,
2014+
// so Triton core won't blindly auto-complete kind that may not be supported.
2015+
// Other instance groups setting are set to "no value" so that Triton core
2016+
// will auto-complete them with default policy.
2017+
#ifdef TRITON_ENABLE_GPU
2018+
RETURN_IF_ERROR(TRITONBACKEND_BackendAttributeAddPreferredInstanceGroup(backend_attributes,
2019+
TRITONSERVER_INSTANCEGROUPKIND_GPU, 0, nullptr, 0));
2020+
#else
2021+
RETURN_IF_ERROR(TRITONBACKEND_BackendAttributeAddPreferredInstanceGroup(backend_attributes,
2022+
TRITONSERVER_INSTANCEGROUPKIND_CPU, 0, nullptr, 0));
2023+
#endif
2024+
2025+
return nullptr;
2026+
}
2027+
20052028
} // extern "C"
20062029
}}} // namespace triton::backend::python

0 commit comments

Comments
 (0)