From 581fdbaad4e0becaf738ca34d9bf907e86248408 Mon Sep 17 00:00:00 2001 From: Jonathan Peyton Date: Wed, 15 Feb 2017 17:19:21 +0000 Subject: Enable yield cycle on Linux This change allows the runtime to turn __kmp_yield() on/off repeatedly on Linux. This feature was removed when disabling monitor thread, but there are applications that perform better with this feature on. Patch by Hansang Bae Differential Revision: https://reviews.llvm.org/D29227 llvm-svn: 295203 --- openmp/runtime/src/z_Linux_util.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'openmp/runtime/src/z_Linux_util.cpp') diff --git a/openmp/runtime/src/z_Linux_util.cpp b/openmp/runtime/src/z_Linux_util.cpp index b9490ea65d3..8cba1ff5607 100644 --- a/openmp/runtime/src/z_Linux_util.cpp +++ b/openmp/runtime/src/z_Linux_util.cpp @@ -1812,13 +1812,16 @@ __kmp_resume_monitor() void __kmp_yield( int cond ) { - if (cond + if (!cond) + return; #if KMP_USE_MONITOR - && __kmp_yielding_on + if (!__kmp_yielding_on) + return; +#else + if (__kmp_yield_cycle && !KMP_YIELD_NOW()) + return; #endif - ) { - sched_yield(); - } + sched_yield(); } /* ------------------------------------------------------------------------ */ -- cgit v1.2.3