supersat commented on code in PR #11018:
URL: https://github.com/apache/tvm/pull/11018#discussion_r857817525


##########
src/runtime/threading_backend.cc:
##########
@@ -276,7 +334,17 @@ int ThreadGroup::Configure(AffinityMode mode, int 
nthreads, bool exclude_worker0
   return impl_->Configure(mode, nthreads, exclude_worker0, cpus);
 }
 
-void Yield() { std::this_thread::yield(); }
+void Yield() {
+#ifdef __hexagon__
+  // QuRT doesn't have a yield API, so instead we sleep for the minimum amount
+  // of time to let the OS schedule another thread. std::this_thread::yield()
+  // compiles down to an empty function.
+  qurt_sleep(1);

Review Comment:
   std::this_thread::yield() is broken on hexagon -- it just immediately 
returns. The documentation for qurt_sleep() is silent on what happens if a 0 is 
passed in -- qurt could simply short-circuit the function call and immediately 
return.
   Passing in a minimum amount of time (1 microsecond) guarantees the thread 
will yield.
   
   I am waiting on Qualcomm to clarify what the behavior of qurt_sleep(0) is. 



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