From 9ae5a091440b5465362011361843d046d8100a74 Mon Sep 17 00:00:00 2001 From: Ashish Karale Date: Thu, 19 Sep 2024 12:18:02 +0530 Subject: [PATCH] pre-commit fixes --- src/tensorrt.cc | 7 +++---- src/tensorrt_model.cc | 1 + src/tensorrt_model.h | 12 +++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/tensorrt.cc b/src/tensorrt.cc index aad6f21..1bd0266 100644 --- a/src/tensorrt.cc +++ b/src/tensorrt.cc @@ -350,13 +350,12 @@ TRITONBACKEND_ModelInstanceFinalize(TRITONBACKEND_ModelInstance* instance) RETURN_IF_ERROR(TRITONBACKEND_ModelInstanceState(instance, &vstate)); ModelInstanceState* instance_state = reinterpret_cast(vstate); - + LOG_MESSAGE( TRITONSERVER_LOG_INFO, "TRITONBACKEND_ModelInstanceFinalize: delete instance state"); - if (!instance_state) - { - return nullptr; + if (!instance_state) { + return nullptr; } ScopedRuntimeCiGContext cig_scope(instance_state->StateForModel()); diff --git a/src/tensorrt_model.cc b/src/tensorrt_model.cc index 7edcec6..8285189 100644 --- a/src/tensorrt_model.cc +++ b/src/tensorrt_model.cc @@ -25,6 +25,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "tensorrt_model.h" + #include namespace triton { namespace backend { namespace tensorrt { diff --git a/src/tensorrt_model.h b/src/tensorrt_model.h index c93bd58..708a51a 100644 --- a/src/tensorrt_model.h +++ b/src/tensorrt_model.h @@ -25,9 +25,10 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #pragma once -#include "triton/backend/backend_model.h" #include +#include "triton/backend/backend_model.h" + namespace triton { namespace backend { namespace tensorrt { class TensorRTModel : public BackendModel { @@ -55,9 +56,10 @@ class TensorRTModel : public BackendModel { bool BusyWaitEvents() { return busy_wait_events_; } - //! Following functions are related to CiG (Cuda in Graphics) context sharing for - //! gaming use case. Creating a shared contexts reduces context switching overhead - //! and leads to better performance of model execution along side Graphics workload. + //! Following functions are related to CiG (Cuda in Graphics) context sharing + //! for gaming use case. Creating a shared contexts reduces context switching + //! overhead and leads to better performance of model execution along side + //! Graphics workload. CUcontext GetCiGContext() { return cig_ctx_; } bool isCiGEnabled() { return cig_ctx_ != nullptr; } @@ -107,7 +109,7 @@ struct ScopedRuntimeCiGContext { } } ~ScopedRuntimeCiGContext() - { + { if (model_state_->isCiGEnabled()) { THROW_IF_BACKEND_MODEL_ERROR(model_state_->PopCiGContext()); }