From ab310943d62982a45734f52fed782ec57c9aa6a0 Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 9 Aug 2024 10:48:24 -0700 Subject: [PATCH] Add a yield instruction in the two spinloops of the threaded matmul implementation. --- Eigen/src/Core/products/GeneralMatrixMatrix.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Eigen/src/Core/products/GeneralMatrixMatrix.h b/Eigen/src/Core/products/GeneralMatrixMatrix.h index e9d0cae8d..ebfac0146 100644 --- a/Eigen/src/Core/products/GeneralMatrixMatrix.h +++ b/Eigen/src/Core/products/GeneralMatrixMatrix.h @@ -97,6 +97,7 @@ struct general_matrix_matrix_producttask_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 0) { while (info->task_info[i].sync != k) { + std::this_thread::yield(); } }