Skip to content

Commit

Permalink
refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanlehome committed Sep 16, 2022
1 parent 0b5cf16 commit 0f7d3b1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions paddle/fluid/inference/api/analysis_predictor.cc
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ bool AnalysisPredictor::Run(const std::vector<PaddleTensor> &inputs,
}

#ifdef PADDLE_WITH_TENSORRT
if (config_.trt_engine_memory_sharing()) {
if (config_.tensorrt_engine_enabled()) {
inference::tensorrt::TensorRTEngine::predictor_id_per_thread =
predictor_id_;
VLOG(3) << "thread_local var predictor_id in TensorRTEngine is set to: "
Expand Down Expand Up @@ -1646,7 +1646,7 @@ bool AnalysisPredictor::ZeroCopyRun() {
#endif

#ifdef PADDLE_WITH_TENSORRT
if (config_.trt_engine_memory_sharing()) {
if (config_.tensorrt_engine_enabled()) {
inference::tensorrt::TensorRTEngine::predictor_id_per_thread =
predictor_id_;
VLOG(3) << "thread_local var predictor_id in TensorRTEngine is set to: "
Expand Down
2 changes: 1 addition & 1 deletion paddle/fluid/inference/tensorrt/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ class TRTEngineManager {
const phi::GPUPlace& place,
const phi::Stream& stream) {
std::unique_lock<std::mutex> lock(mutex_);
auto alignment = getAlignmentSize(place);
static auto alignment = getAlignmentSize(place);
if (context_memorys_.count(predictor_id) == 0) {
auto context_memory =
memory::Alloc(place, max_ctx_mem_size_ + alignment, stream);
Expand Down
6 changes: 1 addition & 5 deletions paddle/fluid/operators/tensorrt/tensorrt_engine_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,11 +476,7 @@ class TensorRTEngineOp : public framework::OperatorBase {
std::vector<std::string> output_maps =
Attr<std::vector<std::string>>("output_name_mapping");

// int num_inputs = 0;
// num_inputs += runtime_input_names_.size();
// const int num_bindings = num_inputs + Outputs("Ys").size();
// std::vector<void *> buffers(num_bindings);
// This method returns the total over all profiles.
// Get the total over all profiles
const int num_bindings = engine->GetNbBindings();
std::vector<void *> buffers(num_bindings, nullptr);

Expand Down

0 comments on commit 0f7d3b1

Please sign in to comment.