samwyi opened a new issue #5632:
URL: https://github.com/apache/incubator-tvm/issues/5632


   **Problem:** When VulkanThreadEntry is destructed, its member "streams_" is 
destructed before  "pool" (members are destructed in reverse order of their 
appearance in class definition).  pool's destructor calls FreeDataSpace(), 
which calls StreamSync(), which references "streams_", which is already 
destructed. This caused seg fault.
   
   **Reproduce**:
   Run apps/benchmark/gpu_imagenet_bench.py using Vulkan target.
   
   **Proposed Solution**:
   Since pool's destructor references stream_, but not vice versa, stream_ 
should be destructed after pool. We can wrap pool with a unique_ptr, so we can 
destruct it inside ~VulkanThreadEntry(), which is called before 
VulkanThreadEntry::stream_'s destructor. Also, we destruct pool before 
streams_.clear(), so we can reuse the existing stream instead of creating a new 
one.
   
   **More background:**
   This is a regression introduced by the fix for 
https://github.com/apache/incubator-tvm/issues/5388. In the fix, 
FreeDataSpace() calls StreamSync() to make sure the buffer being freed is not 
longer in use. 


----------------------------------------------------------------
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