forked from Xilinx/XRT
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve performance of exec_wait for multi-threaded use (Xilinx#7123)
* Improve performance of exec_wait for multi-threaded use First host thread invokes xrt_core::device::exec_wait and notifies subsequent threads upon completion per exec_wait. Performance testing of multipe threads running simple [run, wait] loops of same kernel run object showed that a multi-threaded application with n-threads had poor performace over n-process single thread application. The problem was narrowed down to a strange combination of mutex lock interacting with waiting threads to ensure mutual exclusion when calling exec_wait. The waiting treated a mutex lock more or less as queue when in fact it doesn't at all behave a such and some threads got starved out waiting in vain. In order to reduce multi-threaded wait time, condition variable wait is used for subsequent threads calling exec_wait while some other thread is busy running xrt_core::device::exec_wait. Condition variable wait and wake up is faster than letting multiple threads wait on a single mutex lock. This means that device::exec_wait is done by the first host thread that needs the call to exec_wait, while condition variable notification is used for additional threads. Signed-off-by: Soren Soe <[email protected]> * notify outside critical section and add exit condition for wait Signed-off-by: Soren Soe <[email protected]>
- Loading branch information
Showing
1 changed file
with
81 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters