janetsc commented on code in PR #12957:
URL: https://github.com/apache/tvm/pull/12957#discussion_r985329003


##########
src/runtime/hexagon/hexagon_buffer_manager.h:
##########
@@ -39,11 +38,17 @@ class HexagonBufferManager {
    * \param ptr Address of the HexagonBuffer as returned by 
`AllocateHexagonBuffer`.
    */
   void FreeHexagonBuffer(void* ptr) {
-    auto it = hexagon_buffer_map_.find(ptr);
-    CHECK(it != hexagon_buffer_map_.end())
-        << "Attempt made to free unknown or already freed dataspace 
allocation";
-    CHECK(it->second != nullptr);
-    {
+    if (auto it = hexagon_buffer_map_.find(ptr); it == 
hexagon_buffer_map_.end()) {
+      // This should be an assertion, but something seems to go wrong here.
+      // The symptom is that when resources are being released 
(ReleaseResources),
+      // one buffer disappears from the "runtime" buffer manager, and is not 
deleted
+      // when that manager is reset. The FreeHexagonBuffer is than called for 
that
+      // buffer, but with the "static" buffer manager instead. That manager 
doesn't
+      // find it in the map and throws an exception, which somehow doesn't 
abort
+      // the program.
+      HEXAGON_PRINT(ERROR, "Attempt made to free unknown or already freed 
dataspace allocation");
+    } else {
+      HEXAGON_ASSERT(it->second != nullptr);

Review Comment:
   I will investigate the buffer free after ReleaseResources.  This happens on 
session shutdown when the process is already being torn down.



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

To unsubscribe, e-mail: [email protected]

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

Reply via email to