@@ -1583,10 +1583,6 @@ TensorrtExecutionProvider::TensorrtExecutionProvider(const TensorrtExecutionProv
15831583 LOGS_DEFAULT (WARNING) << " [TensorRT EP] TensorRT option trt_min_subgraph_size must be a positive integer value. Set it to 1" ;
15841584 min_subgraph_size_ = 1 ;
15851585 }
1586- if (max_workspace_size_ <= 0 ) {
1587- LOGS_DEFAULT (WARNING) << " [TensorRT EP] TensorRT option trt_max_workspace_size must be a positive integer value. Set it to 1073741824 (1GB)" ;
1588- max_workspace_size_ = 1 << 30 ;
1589- }
15901586 if (dla_core_ < 0 ) {
15911587 LOGS_DEFAULT (WARNING) << " [TensorRT EP] TensorRT option trt_dla_core must be a non-negative integer value. Set it to 0" ;
15921588 dla_core_ = 0 ;
@@ -2756,7 +2752,9 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
27562752 auto trt_config = std::unique_ptr<nvinfer1::IBuilderConfig>(trt_builder->createBuilderConfig ());
27572753 auto trt_parser = tensorrt_ptr::unique_pointer<nvonnxparser::IParser>(nvonnxparser::createParser (*trt_network, trt_logger));
27582754 trt_parser->parse (string_buf.data (), string_buf.size (), model_path_);
2759- trt_config->setMemoryPoolLimit (nvinfer1::MemoryPoolType::kWORKSPACE , max_workspace_size_);
2755+ if (max_workspace_size_ > 0 ) {
2756+ trt_config->setMemoryPoolLimit (nvinfer1::MemoryPoolType::kWORKSPACE , max_workspace_size_);
2757+ }
27602758
27612759 // Force Pow + Reduce ops in layer norm to run in FP32 to avoid overflow
27622760 if (fp16_enable_ && layer_norm_fp32_fallback_) {
@@ -3363,7 +3361,7 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
33633361 &parsers_[context->node_name ], &engines_[context->node_name ], &contexts_[context->node_name ],
33643362 &networks_[context->node_name ], input_info_[context->node_name ], output_info_[context->node_name ],
33653363 input_shape_ranges_[context->node_name ], &tensorrt_mu_, fp16_enable_, int8_enable_, int8_calibration_cache_available_,
3366- dla_enable_, dla_core_, &max_workspace_size_, trt_node_name_with_precision,
3364+ dla_enable_, dla_core_, trt_node_name_with_precision,
33673365 engine_cache_enable_, cache_path_, runtime_.get (), profiles_[context->node_name ],
33683366 context_memory_sharing_enable_, &max_ctx_mem_size_, dynamic_range_map, engine_decryption_enable_,
33693367 engine_decryption_, engine_encryption_, timing_cache_enable_, global_cache_path_, force_timing_cache_match_,
@@ -3538,7 +3536,9 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
35383536 trt_state->context ->reset ();
35393537 trt_state->engine ->reset ();
35403538 auto trt_config = std::unique_ptr<nvinfer1::IBuilderConfig>(trt_builder->createBuilderConfig ());
3541- trt_config->setMemoryPoolLimit (nvinfer1::MemoryPoolType::kWORKSPACE , *(trt_state->max_workspace_size_ptr ));
3539+ if (max_workspace_size_ > 0 ) {
3540+ trt_config->setMemoryPoolLimit (nvinfer1::MemoryPoolType::kWORKSPACE , max_workspace_size_);
3541+ }
35423542 for (auto trt_profile : trt_profiles) {
35433543 trt_config->addOptimizationProfile (trt_profile);
35443544 }
0 commit comments