Skip to content

Commit

Permalink
Limit Python based backend search to backend directory
Browse files Browse the repository at this point in the history
  • Loading branch information
kthui committed Nov 28, 2023
1 parent 1c2c618 commit 0d89719
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/backend_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ TritonModel::GetBackendLibraryProperties(
std::string backend_libname = model_config->runtime();
if (backend_libname.empty()) {
RETURN_IF_ERROR(GetBackendRuntimeLibraryName(
backend_name, *search_paths, &backend_libname, backend_libdir,
backend_libpath, is_python_based_backend));
backend_dir, backend_name, *search_paths, &backend_libname,
backend_libdir, backend_libpath, is_python_based_backend));
if (!*is_python_based_backend) {
// All variables are correctly set for C++ backends on initial search.
return Status::Success;
Expand Down Expand Up @@ -376,7 +376,7 @@ TritonModel::GetBackendLibraryProperties(

Status
TritonModel::GetBackendRuntimeLibraryName(
const std::string& backend_name,
const std::string& backend_dir, const std::string& backend_name,
const std::vector<std::string>& search_paths, std::string* backend_libname,
std::string* backend_libdir, std::string* backend_libpath,
bool* is_python_based_backend)
Expand All @@ -392,7 +392,7 @@ TritonModel::GetBackendRuntimeLibraryName(
// Try Python runtime
*backend_libname = kPythonFilename;
RETURN_IF_ERROR(FindBackendLibraryPath(
search_paths, *backend_libname, backend_libdir, backend_libpath));
{backend_dir}, *backend_libname, backend_libdir, backend_libpath));
if (!backend_libpath->empty()) {
*is_python_based_backend = true;
return Status::Success;
Expand Down
5 changes: 3 additions & 2 deletions src/backend_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ class TritonModel : public Model {

// Get 'backend_libname', 'backend_libdir', 'backend_libpath' and
// 'is_python_based_backend' by searching for different possible backend
// library names on 'search_paths'
// library names on 'search_paths'. Searching for Python based backend
// runtime is limited to 'backend_dir'.
static Status GetBackendRuntimeLibraryName(
const std::string& backend_name,
const std::string& backend_dir, const std::string& backend_name,
const std::vector<std::string>& search_paths,
std::string* backend_libname, std::string* backend_libdir,
std::string* backend_libpath, bool* is_python_based_backend);
Expand Down

0 comments on commit 0d89719

Please sign in to comment.