masahi commented on code in PR #10937:
URL: https://github.com/apache/tvm/pull/10937#discussion_r845875542


##########
src/support/parallel_for.cc:
##########
@@ -118,26 +118,35 @@ void parallel_for_dynamic(int begin, int end, int 
num_threads,
     futures.emplace_back(task.get_future());
     threads.emplace_back(std::move(task), thread_id);
   }
+
+  auto try_await_futures = [&futures]() {
+    try {
+      for (auto&& future : futures) {
+        future.get();
+      }
+    } catch (const std::exception& e) {
+      LOG(WARNING) << "RuntimeError: parallel_for_dynamic error on future get 
with " << e.what();
+    }
+  };
+
   // Step 2.2. Launch worker 0 inplace
   try {
     worker(0);
   } catch (const std::exception& e) {
     for (auto&& thread : threads) {
       thread.join();
     }
-    LOG(FATAL) << "RuntimeError: parallel_for_dynamic error with " << e.what();
+    LOG(WARNING) << "RuntimeError: parallel_for_dynamic error on thread join 
with " << e.what();
+    try_await_futures();
+    return;

Review Comment:
   This `return` is necessary to avoid `thread.join` twice.



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