@@ -86,7 +86,9 @@ TRTEngine::TRTEngine(std::vector<std::string> serialized_info)
8686 static_cast<bool>(std::stoi(serialized_info[HW_COMPATIBLE_IDX])),
8787 static_cast<bool>(std::stoi(serialized_info[REQUIRES_OUTPUT_ALLOCATOR_IDX])),
8888 serialized_info[SERIALIZED_METADATA_IDX],
89- (static_cast <bool >(std::stoi(serialized_info[RESOURCE_ALLOCATION_STRATEGY_IDX])) ? ResourceAllocationStrategy::kDynamic : ResourceAllocationStrategy::kStatic)) {}
89+ (static_cast <bool >(std::stoi(serialized_info[RESOURCE_ALLOCATION_STRATEGY_IDX]))
90+ ? ResourceAllocationStrategy::kDynamic
91+ : ResourceAllocationStrategy::kStatic)) {}
9092
9193TRTEngine::TRTEngine (
9294 const std::string& mod_name,
@@ -129,7 +131,9 @@ TRTEngine::TRTEngine(
129131 }
130132
131133 this ->resource_allocation_strategy = resource_allocation_strategy;
132- LOG_DEBUG (" Resource allocation strategy: " << (this ->resource_allocation_strategy == ResourceAllocationStrategy::kDynamic ? " Dynamic" : " Static" ));
134+ LOG_DEBUG (
135+ " Resource allocation strategy: "
136+ << (this ->resource_allocation_strategy == ResourceAllocationStrategy::kDynamic ? " Dynamic" : " Static" ));
133137 if (this ->resource_allocation_strategy == ResourceAllocationStrategy::kDynamic ) {
134138 this ->exec_ctx =
135139 make_trt (cuda_engine->createExecutionContext (nvinfer1::ExecutionContextAllocationStrategy::kUSER_MANAGED ));
@@ -472,7 +476,8 @@ std::vector<std::string> TRTEngine::serialize() {
472476 serialized_info[REQUIRES_OUTPUT_ALLOCATOR_IDX] = this ->requires_output_allocator ? " 1" : " 0" ;
473477 serialized_info[SERIALIZED_METADATA_IDX] = this ->serialized_metadata ;
474478 serialized_info[TARGET_PLATFORM_IDX] = this ->target_platform .serialize ();
475- serialized_info[RESOURCE_ALLOCATION_STRATEGY_IDX] = this ->resource_allocation_strategy == ResourceAllocationStrategy::kDynamic ? " 1" : " 0" ;
479+ serialized_info[RESOURCE_ALLOCATION_STRATEGY_IDX] =
480+ this ->resource_allocation_strategy == ResourceAllocationStrategy::kDynamic ? " 1" : " 0" ;
476481
477482 return serialized_info;
478483}
@@ -486,11 +491,11 @@ void TRTEngine::set_resource_allocation_strategy(TRTEngine::ResourceAllocationSt
486491 this ->resource_allocation_strategy = new_strategy;
487492 if (this ->resource_allocation_strategy == TRTEngine::ResourceAllocationStrategy::kDynamic ) {
488493 LOG_DEBUG (" Setting resource allocation strategy to dynamic" );
489- this ->exec_ctx = make_trt (cuda_engine->createExecutionContext (nvinfer1::ExecutionContextAllocationStrategy::kUSER_MANAGED ));
494+ this ->exec_ctx =
495+ make_trt (cuda_engine->createExecutionContext (nvinfer1::ExecutionContextAllocationStrategy::kUSER_MANAGED ));
490496 } else {
491497 LOG_DEBUG (" Setting resource allocation strategy to static" );
492- this ->exec_ctx = make_trt (
493- cuda_engine->createExecutionContext ());
498+ this ->exec_ctx = make_trt (cuda_engine->createExecutionContext ());
494499 }
495500 }
496501}
0 commit comments