Skip to content

Commit

Permalink
pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Akarale98 committed Sep 24, 2024
1 parent 89ab580 commit b624b98
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/instance_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ ModelInstanceState::~ModelInstanceState()
#ifdef TRITON_ENABLE_CIG
// Set device if CiG is disabled
if (!model_state_->isCiGEnabled())
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG
{
cudaSetDevice(DeviceId());
}
Expand Down Expand Up @@ -433,7 +433,7 @@ ModelInstanceState::Run(
#ifdef TRITON_ENABLE_CIG
// Set device if CiG is disabled
if (!model_state_->isCiGEnabled())
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG
{
cudaSetDevice(DeviceId());
}
Expand Down Expand Up @@ -1566,7 +1566,7 @@ ModelInstanceState::InitStreamsAndEvents()
#ifdef TRITON_ENABLE_CIG
// Set device if CiG is disabled
if (!model_state_->isCiGEnabled())
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG
{
// Set the device before preparing the context.
auto cuerr = cudaSetDevice(DeviceId());
Expand Down
17 changes: 8 additions & 9 deletions src/model_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ ModelState::~ModelState()
for (auto& device_engine : device_engines_) {
#ifdef TRITON_ENABLE_CIG
// Set device if CiG is disabled
if (!isCiGEnabled())
#endif //TRITON_ENABLE_CIG
if (!isCiGEnabled())
#endif // TRITON_ENABLE_CIG
{
cudaSetDevice(device_engine.first.first);
}
Expand Down Expand Up @@ -215,11 +215,10 @@ ModelState::CreateEngine(
// We share the engine (for models that don't have dynamic shapes) and
// runtime across instances that have access to the same GPU/NVDLA.
if (eit->second.second == nullptr) {

#ifdef TRITON_ENABLE_CIG
// Set device if CiG is disabled
if (!isCiGEnabled())
#endif //TRITON_ENABLE_CIG
if (!isCiGEnabled())
#endif // TRITON_ENABLE_CIG
{
auto cuerr = cudaSetDevice(gpu_device);
if (cuerr != cudaSuccess) {
Expand Down Expand Up @@ -335,8 +334,8 @@ ModelState::AutoCompleteConfig()

#ifdef TRITON_ENABLE_CIG
// Set device if CiG is disabled
if (!isCiGEnabled())
#endif //TRITON_ENABLE_CIG
if (!isCiGEnabled())
#endif // TRITON_ENABLE_CIG
{
cuerr = cudaSetDevice(device_id);
if (cuerr != cudaSuccess) {
Expand Down Expand Up @@ -393,8 +392,8 @@ ModelState::AutoCompleteConfig()

#ifdef TRITON_ENABLE_CIG
// Set device if CiG is disabled
if (!isCiGEnabled())
#endif //TRITON_ENABLE_CIG
if (!isCiGEnabled())
#endif // TRITON_ENABLE_CIG
{
cuerr = cudaSetDevice(current_device);
if (cuerr != cudaSuccess) {
Expand Down
6 changes: 3 additions & 3 deletions src/tensorrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ TRITONBACKEND_ModelInstanceInitialize(TRITONBACKEND_ModelInstance* instance)

#ifdef TRITON_ENABLE_CIG
ScopedRuntimeCiGContext cig_scope(model_state);
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG

// With each instance we create a ModelInstanceState object and
// associate it with the TRITONBACKEND_ModelInstance.
Expand Down Expand Up @@ -361,7 +361,7 @@ TRITONBACKEND_ModelInstanceFinalize(TRITONBACKEND_ModelInstance* instance)
}
#ifdef TRITON_ENABLE_CIG
ScopedRuntimeCiGContext cig_scope(instance_state->StateForModel());
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG

delete instance_state;

Expand All @@ -388,7 +388,7 @@ TRITONBACKEND_ModelInstanceExecute(

#ifdef TRITON_ENABLE_CIG
ScopedRuntimeCiGContext cig_scope(model_state);
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG

// For TensorRT backend, the executing instance may not closely tie to
// TRITONBACKEND_ModelInstance, the instance will be assigned based on
Expand Down
5 changes: 3 additions & 2 deletions src/tensorrt_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ TensorRTModel::TensorRTModel(TRITONBACKEND_Model* triton_model)
separate_output_stream_(false), eager_batching_(false),
busy_wait_events_(false)
#ifdef TRITON_ENABLE_CIG
,cig_ctx_(nullptr)
,
cig_ctx_(nullptr)
#endif // TRITON_ENABLE_CIG
{
ParseModelConfig();
Expand Down Expand Up @@ -110,7 +111,7 @@ TensorRTModel::ParseModelConfig()
LOG_MESSAGE(TRITONSERVER_LOG_VERBOSE, "CiG Context pointer is set");
}
}
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG

return nullptr; // Success
}
Expand Down
9 changes: 4 additions & 5 deletions src/tensorrt_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#ifdef TRITON_ENABLE_CIG
#include <cuda.h>
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG

#include "triton/backend/backend_model.h"

Expand Down Expand Up @@ -90,7 +90,7 @@ class TensorRTModel : public BackendModel {
}
return nullptr;
}
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG

protected:
common::TritonJson::Value graph_specs_;
Expand All @@ -102,8 +102,7 @@ class TensorRTModel : public BackendModel {
bool busy_wait_events_;
#ifdef TRITON_ENABLE_CIG
CUcontext cig_ctx_;
#endif //TRITON_ENABLE_CIG

#endif // TRITON_ENABLE_CIG
};

#ifdef TRITON_ENABLE_CIG
Expand All @@ -123,6 +122,6 @@ struct ScopedRuntimeCiGContext {
}
TensorRTModel* model_state_;
};
#endif //TRITON_ENABLE_CIG
#endif // TRITON_ENABLE_CIG

}}} // namespace triton::backend::tensorrt

0 comments on commit b624b98

Please sign in to comment.