lsy643 commented on a change in pull request #7162:
URL: https://github.com/apache/tvm/pull/7162#discussion_r567538868



##########
File path: src/runtime/contrib/tensorrt/tensorrt_runtime.cc
##########
@@ -211,6 +218,16 @@ class TensorRTRuntime : public JSONRuntimeBase {
       builder.AddOutput(outputs_[i], EntryID(outputs_[i]));
     }
 
+    // Allocate Device Buffers
+    if (trt_engine_cache_.count(std::make_pair(symbol_name_, batch_size_))) {
+      TensorRTEngineAndContext& engine_and_context =
+          trt_engine_cache_.at(std::make_pair(symbol_name_, batch_size_));
+      if (engine_and_context.device_buffers.size() == 0) {
+        builder.CreateDeviceBuffers(&engine_and_context);
+        return;

Review comment:
       If the `CleanUp` is added, there will be a segmentation fault and so I 
don't call `CleanUp`.
   
   In the `BuildEngine` function from `tensorrt_runtime.cc`, the whole network 
has not been actually rebuilt since the function returns 
before`builder.BuildEngine` gets called.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to