From 82c58cf9e710b58f57199750a932048a47e2d9fc Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 12 Jul 2024 15:57:57 -0700 Subject: [PATCH 01/30] Exposing C pointer to TRITONSERVER_Server object --- python/tritonserver/_c/tritonserver_pybind.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 127bb15b8..a24d919ce 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,6 +1434,8 @@ class PyServer : public PyWrapper { owned_ = true; } + int get_c_ptr() {return this->Ptr();} // Calls PyWrapper + void Stop() const { ThrowIfError(TRITONSERVER_ServerStop(triton_object_)); } void RegisterModelRepository( @@ -2096,6 +2098,7 @@ PYBIND11_MODULE(triton_bindings, m) .export_values(); py::class_(m, "TRITONSERVER_Server") .def(py::init()) + .def("get_c_ptr()", &PyServer::get_c_ptr) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From 5d54ccd998fe1407c93b6bd3461a0f340bedd529 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 12 Jul 2024 17:34:28 -0700 Subject: [PATCH 02/30] Breaking down pointer --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index a24d919ce..31208fb8e 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,7 +1434,7 @@ class PyServer : public PyWrapper { owned_ = true; } - int get_c_ptr() {return this->Ptr();} // Calls PyWrapper + int get_c_ptr() {return &this->Ptr();} // Calls PyWrapper void Stop() const { ThrowIfError(TRITONSERVER_ServerStop(triton_object_)); } From 69236ccb66cfc0a8e7ed356641a7d632a0a07abe Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 12 Jul 2024 17:35:38 -0700 Subject: [PATCH 03/30] fixing casting logic --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 31208fb8e..ee6c9b71b 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,7 +1434,7 @@ class PyServer : public PyWrapper { owned_ = true; } - int get_c_ptr() {return &this->Ptr();} // Calls PyWrapper + int get_c_ptr() {return reinterpret_castthis->Ptr();} // Calls PyWrapper void Stop() const { ThrowIfError(TRITONSERVER_ServerStop(triton_object_)); } From 0370f8e46d877c2cadacb37736b9079c8072bb8f Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 12 Jul 2024 17:36:02 -0700 Subject: [PATCH 04/30] Making data types consistent --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index ee6c9b71b..c8b191123 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,7 +1434,7 @@ class PyServer : public PyWrapper { owned_ = true; } - int get_c_ptr() {return reinterpret_castthis->Ptr();} // Calls PyWrapper + uintptr_t get_c_ptr() {return reinterpret_castthis->Ptr();} // Calls PyWrapper void Stop() const { ThrowIfError(TRITONSERVER_ServerStop(triton_object_)); } From 817aaf40f9313a12ef9bdc1b7da24735c0b4ed3a Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 12 Jul 2024 17:36:50 -0700 Subject: [PATCH 05/30] Adding missing paranthesis --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index c8b191123..c9c8ba402 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,7 +1434,7 @@ class PyServer : public PyWrapper { owned_ = true; } - uintptr_t get_c_ptr() {return reinterpret_castthis->Ptr();} // Calls PyWrapper + uintptr_t get_c_ptr() {return reinterpret_cast(this->Ptr());} // Calls PyWrapper void Stop() const { ThrowIfError(TRITONSERVER_ServerStop(triton_object_)); } From 32e1c2c279ee424cab3b9c4e3440b71f4f16ef3a Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 12 Jul 2024 17:51:52 -0700 Subject: [PATCH 06/30] Adding API Support for C Pointer --- python/tritonserver/_api/_server.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index 9e78f8ac2..c619a2e55 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -56,6 +56,7 @@ TRITONSERVER_ServerOptions, UnavailableError, ) +# from tritonserver._c.triton_bindings import g uint = Annotated[int, ctypes.c_uint] @@ -535,7 +536,7 @@ def __init__( options = Options(**kwargs) self.options: Options = options self._server = Server._UnstartedServer() - + def start( self, wait_until_ready: bool = False, @@ -621,6 +622,9 @@ def stop(self) -> None: self._server.stop() self._server = Server._UnstartedServer() + def get_c_ptr(self): + return self._server.get_c_ptr() + def unregister_model_repository(self, repository_path: str) -> None: """Unregister model repository From 25383304832b65cf200b547f5fc40142d7863bee Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Mon, 15 Jul 2024 15:34:33 -0700 Subject: [PATCH 07/30] Fixing Function Name --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index c9c8ba402..a35df4343 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2098,7 +2098,7 @@ PYBIND11_MODULE(triton_bindings, m) .export_values(); py::class_(m, "TRITONSERVER_Server") .def(py::init()) - .def("get_c_ptr()", &PyServer::get_c_ptr) + .def("get_c_ptr", &PyServer::get_c_ptr) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From 629c34976c9551cd9af1b5a5eb8980291ab8ecb7 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Mon, 15 Jul 2024 15:58:25 -0700 Subject: [PATCH 08/30] Adding print statements --- python/tritonserver/_api/_server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index c619a2e55..f7bb93158 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -623,6 +623,8 @@ def stop(self) -> None: self._server = Server._UnstartedServer() def get_c_ptr(self): + print("THIS FUNCTION IS CALLED.") + print(f"Here is C++ Output: {self._server.get_c_ptr()}") return self._server.get_c_ptr() def unregister_model_repository(self, repository_path: str) -> None: From 50c79c723cd69b6bc06d8187d0e2717497bf259e Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Tue, 16 Jul 2024 06:39:29 -0700 Subject: [PATCH 09/30] Testing --- python/tritonserver/_api/_server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index f7bb93158..312a62184 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -778,7 +778,7 @@ def live(self) -> bool: True """ - + print("RUNNING LIVE!") return self._server.is_live() def ready(self) -> bool: From 312d8eb0481c80754e732f0121ee0bf1a84d6578 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Tue, 16 Jul 2024 09:13:49 -0700 Subject: [PATCH 10/30] Pushing an error on purpose --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index a35df4343..d7916dedd 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2100,7 +2100,7 @@ PYBIND11_MODULE(triton_bindings, m) .def(py::init()) .def("get_c_ptr", &PyServer::get_c_ptr) .def("stop", &PyServer::Stop) - .def("register_model_repository", &PyServer::RegisterModelRepository) + .def("register_model_repository", &PyServer::RegisterModelRepositor1y) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) .def("poll_model_repository", &PyServer::PollModelRepository) .def("is_live", &PyServer::IsLive) From 06fb46289f198aa7867cdb0eee0da0d4e7ec119b Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Tue, 16 Jul 2024 09:17:10 -0700 Subject: [PATCH 11/30] Undoing the error --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index d7916dedd..a35df4343 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2100,7 +2100,7 @@ PYBIND11_MODULE(triton_bindings, m) .def(py::init()) .def("get_c_ptr", &PyServer::get_c_ptr) .def("stop", &PyServer::Stop) - .def("register_model_repository", &PyServer::RegisterModelRepositor1y) + .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) .def("poll_model_repository", &PyServer::PollModelRepository) .def("is_live", &PyServer::IsLive) From 09e3d74b0253bd509838a529d4ea38d5d4fed3f8 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 2 Aug 2024 17:09:07 -0700 Subject: [PATCH 12/30] Cleaning up --- .gitignore | 1 + include/triton/core/tritonserver.h | 2 +- python/tritonserver/_c/tritonserver_pybind.cc | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 0e9f099a2..f4bb2bd93 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /build /.vscode *.so +*__pycache__/ \ No newline at end of file diff --git a/include/triton/core/tritonserver.h b/include/triton/core/tritonserver.h index ef5a45d6a..5fe25992a 100644 --- a/include/triton/core/tritonserver.h +++ b/include/triton/core/tritonserver.h @@ -32,7 +32,7 @@ #include #ifdef __cplusplus -extern "C" { +extern "C" { #endif #ifdef _COMPILING_TRITONSERVER diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index a35df4343..86b08e080 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -186,7 +186,9 @@ class PyWrapper { // requires a function wrapper to generalize the destructor. // Use internally to get the pointer of the underlying Triton object - TritonStruct* Ptr() { return triton_object_; } + TritonStruct* Ptr() { + return triton_object_; + } DISALLOW_COPY_AND_ASSIGN(PyWrapper); @@ -1434,7 +1436,9 @@ class PyServer : public PyWrapper { owned_ = true; } - uintptr_t get_c_ptr() {return reinterpret_cast(this->Ptr());} // Calls PyWrapper + uintptr_t get_c_ptr() { // Calls PyWrapper + return reinterpret_cast(this->Ptr()); + } void Stop() const { ThrowIfError(TRITONSERVER_ServerStop(triton_object_)); } From e1dfd777b7778f616b662bfa0b2e399724a46ba0 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 2 Aug 2024 17:23:18 -0700 Subject: [PATCH 13/30] remove extra print () --- python/tritonserver/_api/_server.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index 312a62184..13e02ae47 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -623,8 +623,6 @@ def stop(self) -> None: self._server = Server._UnstartedServer() def get_c_ptr(self): - print("THIS FUNCTION IS CALLED.") - print(f"Here is C++ Output: {self._server.get_c_ptr()}") return self._server.get_c_ptr() def unregister_model_repository(self, repository_path: str) -> None: From f75f566cd451c052843ea682663b426fabfb0e62 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Mon, 5 Aug 2024 16:21:55 -0700 Subject: [PATCH 14/30] Format w pre-commit --- include/triton/core/tritonserver.h | 2 +- python/tritonserver/_api/_server.py | 3 ++- python/tritonserver/_c/tritonserver_pybind.cc | 9 ++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/triton/core/tritonserver.h b/include/triton/core/tritonserver.h index 5fe25992a..ef5a45d6a 100644 --- a/include/triton/core/tritonserver.h +++ b/include/triton/core/tritonserver.h @@ -32,7 +32,7 @@ #include #ifdef __cplusplus -extern "C" { +extern "C" { #endif #ifdef _COMPILING_TRITONSERVER diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index 13e02ae47..2419b4256 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -56,6 +56,7 @@ TRITONSERVER_ServerOptions, UnavailableError, ) + # from tritonserver._c.triton_bindings import g uint = Annotated[int, ctypes.c_uint] @@ -536,7 +537,7 @@ def __init__( options = Options(**kwargs) self.options: Options = options self._server = Server._UnstartedServer() - + def start( self, wait_until_ready: bool = False, diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 86b08e080..6a3c34ed2 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -186,9 +186,7 @@ class PyWrapper { // requires a function wrapper to generalize the destructor. // Use internally to get the pointer of the underlying Triton object - TritonStruct* Ptr() { - return triton_object_; - } + TritonStruct* Ptr() { return triton_object_; } DISALLOW_COPY_AND_ASSIGN(PyWrapper); @@ -1436,9 +1434,10 @@ class PyServer : public PyWrapper { owned_ = true; } - uintptr_t get_c_ptr() { // Calls PyWrapper + uintptr_t get_c_ptr() + { // Calls PyWrapper return reinterpret_cast(this->Ptr()); - } + } void Stop() const { ThrowIfError(TRITONSERVER_ServerStop(triton_object_)); } From 3bdad402c92d9333cb5a828722eeec9365ea735c Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Mon, 5 Aug 2024 16:24:32 -0700 Subject: [PATCH 15/30] Removing extra lines and print statements --- python/tritonserver/_api/_server.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index 2419b4256..2aa4e8f5c 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -57,8 +57,6 @@ UnavailableError, ) -# from tritonserver._c.triton_bindings import g - uint = Annotated[int, ctypes.c_uint] @@ -777,7 +775,6 @@ def live(self) -> bool: True """ - print("RUNNING LIVE!") return self._server.is_live() def ready(self) -> bool: From e1b940b63b5fa63b320bcee805afcb601a63f0fb Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Mon, 5 Aug 2024 16:26:58 -0700 Subject: [PATCH 16/30] Spacing --- python/tritonserver/_api/_server.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index 2aa4e8f5c..e56576d74 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -775,6 +775,7 @@ def live(self) -> bool: True """ + return self._server.is_live() def ready(self) -> bool: From 5350d2cfc3d118a3dfdd74feac457bcb3347be10 Mon Sep 17 00:00:00 2001 From: KrishnanPrash <140860868+KrishnanPrash@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:05:36 -0700 Subject: [PATCH 17/30] Change function name Co-authored-by: Neelay Shah --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 6a3c34ed2..6bf2e59a6 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,7 +1434,7 @@ class PyServer : public PyWrapper { owned_ = true; } - uintptr_t get_c_ptr() + uintptr_t _ptr() { // Calls PyWrapper return reinterpret_cast(this->Ptr()); } From 8de60f1333924dd51d4eead3324ec26104ecece9 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 16 Aug 2024 15:07:06 -0700 Subject: [PATCH 18/30] New function name for binding --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 6bf2e59a6..9fbb1d5a5 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2101,7 +2101,7 @@ PYBIND11_MODULE(triton_bindings, m) .export_values(); py::class_(m, "TRITONSERVER_Server") .def(py::init()) - .def("get_c_ptr", &PyServer::get_c_ptr) + .def("get_c_ptr", &PyServer::_ptr) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From c71bbd252e674712b63a0acb5f6e9b621095805d Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 16 Aug 2024 15:53:28 -0700 Subject: [PATCH 19/30] Changing tritonserver api function name --- python/tritonserver/_api/_server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tritonserver/_api/_server.py b/python/tritonserver/_api/_server.py index e56576d74..b85d2e5c6 100644 --- a/python/tritonserver/_api/_server.py +++ b/python/tritonserver/_api/_server.py @@ -621,8 +621,8 @@ def stop(self) -> None: self._server.stop() self._server = Server._UnstartedServer() - def get_c_ptr(self): - return self._server.get_c_ptr() + def _ptr(self): + return self._server._ptr() def unregister_model_repository(self, repository_path: str) -> None: """Unregister model repository From dd10a8448a5269aae91ee0d7614a2cb4e27e9caf Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Fri, 16 Aug 2024 15:57:45 -0700 Subject: [PATCH 20/30] Changing binding func name --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 9fbb1d5a5..73872cd23 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2101,7 +2101,7 @@ PYBIND11_MODULE(triton_bindings, m) .export_values(); py::class_(m, "TRITONSERVER_Server") .def(py::init()) - .def("get_c_ptr", &PyServer::_ptr) + .def("_ptr", &PyServer::_ptr) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From 16828a56d7402f236fc20421d987ec74501fe0bb Mon Sep 17 00:00:00 2001 From: KrishnanPrash <140860868+KrishnanPrash@users.noreply.github.com> Date: Wed, 28 Aug 2024 19:42:37 -0700 Subject: [PATCH 21/30] Update .gitignore Co-authored-by: GuanLuo <41310872+GuanLuo@users.noreply.github.com> --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f4bb2bd93..9948de3b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /build /.vscode *.so -*__pycache__/ \ No newline at end of file +*__pycache__/ From ad4620fe95fcbaf1345cb57a1e5f11b229eeccc8 Mon Sep 17 00:00:00 2001 From: KrishnanPrash <140860868+KrishnanPrash@users.noreply.github.com> Date: Wed, 28 Aug 2024 19:43:07 -0700 Subject: [PATCH 22/30] Use inherited Ptr Co-authored-by: GuanLuo <41310872+GuanLuo@users.noreply.github.com> --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 8477e520d..c06af31f4 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2112,7 +2112,7 @@ PYBIND11_MODULE(triton_bindings, m) .export_values(); py::class_(m, "TRITONSERVER_Server") .def(py::init()) - .def("_ptr", &PyServer::_ptr) + .def("_ptr", &PyServer::Ptr) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From 042eee7dc9055f20839f3d1e1b3e9c0670c1f964 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Wed, 28 Aug 2024 19:48:04 -0700 Subject: [PATCH 23/30] removing extra function --- python/tritonserver/_c/tritonserver_pybind.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index c06af31f4..80c786907 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,11 +1434,6 @@ class PyServer : public PyWrapper { owned_ = true; } - uintptr_t _ptr() - { // Calls PyWrapper - return reinterpret_cast(this->Ptr()); - } - void Stop() const { // ServerStop is blocking for the duration of the server exit timeout, so From 07d638564876b8082bf95689c12e56e515fd97b9 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Thu, 29 Aug 2024 12:58:15 -0700 Subject: [PATCH 24/30] reverting to prev flow --- python/tritonserver/_c/tritonserver_pybind.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 80c786907..8477e520d 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,6 +1434,11 @@ class PyServer : public PyWrapper { owned_ = true; } + uintptr_t _ptr() + { // Calls PyWrapper + return reinterpret_cast(this->Ptr()); + } + void Stop() const { // ServerStop is blocking for the duration of the server exit timeout, so @@ -2107,7 +2112,7 @@ PYBIND11_MODULE(triton_bindings, m) .export_values(); py::class_(m, "TRITONSERVER_Server") .def(py::init()) - .def("_ptr", &PyServer::Ptr) + .def("_ptr", &PyServer::_ptr) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From a950a30764aa9054fa8efd31202eaf180c825d54 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Thu, 29 Aug 2024 15:16:03 -0700 Subject: [PATCH 25/30] Using lambda --- python/tritonserver/_c/tritonserver_pybind.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 8477e520d..64c535695 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2112,7 +2112,9 @@ PYBIND11_MODULE(triton_bindings, m) .export_values(); py::class_(m, "TRITONSERVER_Server") .def(py::init()) - .def("_ptr", &PyServer::_ptr) + .def( + "_ptr", + &(PyServer & server) { reinterpret_cast(server.Ptr();) }) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From 91868056bec438e500a5a4789be0e7cbff974efc Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Thu, 29 Aug 2024 15:16:47 -0700 Subject: [PATCH 26/30] Remove extra func --- python/tritonserver/_c/tritonserver_pybind.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 64c535695..986e0a0a4 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -1434,11 +1434,6 @@ class PyServer : public PyWrapper { owned_ = true; } - uintptr_t _ptr() - { // Calls PyWrapper - return reinterpret_cast(this->Ptr()); - } - void Stop() const { // ServerStop is blocking for the duration of the server exit timeout, so From 86e9557fd1d8eece73e2a0096eb8124fbe91f00e Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Thu, 29 Aug 2024 15:17:53 -0700 Subject: [PATCH 27/30] fixing lambda function --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 986e0a0a4..28d212890 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2109,7 +2109,7 @@ PYBIND11_MODULE(triton_bindings, m) .def(py::init()) .def( "_ptr", - &(PyServer & server) { reinterpret_cast(server.Ptr();) }) + &[](PyServer& server) { reinterpret_cast(server.Ptr();) }) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From a8dd33120ffde0b701b8d6200f9cdb57cfbfe146 Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Thu, 29 Aug 2024 15:19:58 -0700 Subject: [PATCH 28/30] fixing lambda func --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index 28d212890..b25f9e77c 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2109,7 +2109,7 @@ PYBIND11_MODULE(triton_bindings, m) .def(py::init()) .def( "_ptr", - &[](PyServer& server) { reinterpret_cast(server.Ptr();) }) + &[](PyServer& server) { reinterpret_cast(server.Ptr()); }) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From e4e3bd211576173b9ea84c9da4da0c959ed4459b Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Thu, 29 Aug 2024 15:21:11 -0700 Subject: [PATCH 29/30] removing reference --- python/tritonserver/_c/tritonserver_pybind.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index b25f9e77c..c5d650a0e 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2109,7 +2109,7 @@ PYBIND11_MODULE(triton_bindings, m) .def(py::init()) .def( "_ptr", - &[](PyServer& server) { reinterpret_cast(server.Ptr()); }) + [](PyServer& server) { reinterpret_cast(server.Ptr()); }) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository) From 6d5595046e18c39f9e26baf852b9cb1e4da8bcdf Mon Sep 17 00:00:00 2001 From: Krishnan Prashanth Date: Thu, 29 Aug 2024 15:28:56 -0700 Subject: [PATCH 30/30] adding return --- python/tritonserver/_c/tritonserver_pybind.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/tritonserver/_c/tritonserver_pybind.cc b/python/tritonserver/_c/tritonserver_pybind.cc index c5d650a0e..e7cd4b53b 100644 --- a/python/tritonserver/_c/tritonserver_pybind.cc +++ b/python/tritonserver/_c/tritonserver_pybind.cc @@ -2109,7 +2109,9 @@ PYBIND11_MODULE(triton_bindings, m) .def(py::init()) .def( "_ptr", - [](PyServer& server) { reinterpret_cast(server.Ptr()); }) + [](PyServer& server) { + return reinterpret_cast(server.Ptr()); + }) .def("stop", &PyServer::Stop) .def("register_model_repository", &PyServer::RegisterModelRepository) .def("unregister_model_repository", &PyServer::UnregisterModelRepository)