Skip to content

Commit

Permalink
[Paddle-TRT] tensorrt engine memory sharing default true (PaddlePaddl…
Browse files Browse the repository at this point in the history
…e#58251)

* tensorrt engine memory sharing default true

* set to false when trt version less than 7.2
  • Loading branch information
yuanlehome authored Oct 20, 2023
1 parent f34f90d commit f4d688b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,13 @@ std::string TensorRtSubgraphPass::CreateTensorRTOp(
auto inspector_serialize = Get<bool>("inspector_serialize");
auto disable_trt_plugin_fp16 = Get<bool>("disable_trt_plugin_fp16");
auto context_memory_sharing = Get<bool>("context_memory_sharing");
if (context_memory_sharing && TRT_VERSION < 7200) {
// https://forums.developer.nvidia.com/t/nvinfer1-createexecutioncontextwithoutdevicememory-returns-nullptr/111878/2
// when trt version less than 7.2,
// createExecutionContextWithoutDeviceMemory() has bug.
// so, we cannot enable engine context memory sharing.
context_memory_sharing = false;
}
auto enable_low_precision_io = Get<bool>("enable_low_precision_io");
auto workspace_size = Get<int64_t>("workspace_size");
auto gpu_device_id = Get<int>("gpu_device_id");
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/api/paddle_analysis_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ struct PD_INFER_DECL AnalysisConfig {

// memory reuse related.
bool enable_memory_optim_{false};
bool trt_engine_memory_sharing_{false};
bool trt_engine_memory_sharing_{true};
int trt_engine_memory_sharing_identifier_{0};

std::unordered_set<std::string> trt_ops_run_float_;
Expand Down

0 comments on commit f4d688b

Please sign in to comment.