Add a yield instruction in the two spinloops of the threaded matmul implementation.

This commit is contained in:
Rasmus Munk Larsen 2024-08-09 10:48:24 -07:00
parent 99ffad1971
commit ab310943d6

View File

@ -97,6 +97,7 @@ struct general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, Conjugat
// Then, we set info->task_info[tid].users to the number of threads to mark that all other threads are going to
// use it.
while (info->task_info[tid].users != 0) {
std::this_thread::yield();
}
info->task_info[tid].users = threads;
@ -115,6 +116,7 @@ struct general_matrix_matrix_product<Index, LhsScalar, LhsStorageOrder, Conjugat
// However, no need to wait for the B' part which has been updated by the current thread!
if (shift > 0) {
while (info->task_info[i].sync != k) {
std::this_thread::yield();
}
}