fix multi-thread exec of trt, test=release/1.5 #19379
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Cherry-pick of commit e1eca83, test=release/1.5]
The problem is only triggered by TensorRT and Clone(), and the user feedbacks that using version 1.4 can avoid this problem. There are two reasons for the final confirmation:
TensorRT uses the uniqueness of the molecular graph of the predictor_id area. Predictor::Clone() will change the predictor_id value, but the logic of TensorRT subgraph passes the predictor_id by value when Pass, and the Clone() does not re-trigger Pass, so the uniqueness fails.
Prior to commit ae576f3, the Deserialize() call to the TensorRT subgraph occurred at tensorrt_engine_op.h, once for each cloned-predictor. After this commit, the call occurred at tensorrt_subgraph_pass.cc, only once in ir_pass of master-predictor.
This pull request fixed the bug.