You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/02/15 08:04:32 UTC

[GitHub] [tvm] huajsj commented on a change in pull request #10234: [Runtime][Pipeline Executor] multiple threads management and the data forwarding notification mechanism.

huajsj commented on a change in pull request #10234:
URL: https://github.com/apache/tvm/pull/10234#discussion_r806551025



##########
File path: src/runtime/pipeline/pipeline_struct.h
##########
@@ -42,6 +52,75 @@ using GlobalOutputPair = std::pair<int, int>;
  * The first 'int' is the module index, and the second 'int' is the module output index.
  */
 using ModuleOutputPair = std::pair<int, int>;
+/*!
+ *\brief The pair includes the module index and the module input index.
+ * The first 'int' is the module index, and the second 'int' is the module input index.
+ */
+using ModuleInputPair = std::pair<int, int>;
+/*!\brief The data notification structure.*/
+class DataNotify {
+ private:
+  /*!\brief The 'contitional variable' is used to wait for notification.*/
+  std::condition_variable condition_;
+  /*!\brief The mutex is used to protect the 'conditional variable'.*/
+  std::mutex mutex_;
+  /*!\brief Whether a data is ready or not.*/
+  volatile bool data_ready_ = false;
+  /*!\brief Whether the thread should exit or not.*/
+  volatile bool exit_state_ = false;

Review comment:
        seems like not need to use atomic, because 'data_ready_' already protected by 'mutex_'  and for exit_state, there is only a single 'writing' in ExitNotify then no race condition can happen.  although atomic is very light weight but it still involved additional perf cost, if not necessary we may need to avoid use it here. 




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org