HomePhabricator

[OpenMP] Make use of sched_yield optional in runtime

Authored by jlpeyton on Feb 28 2019, 11:11 AM.

Description

[OpenMP] Make use of sched_yield optional in runtime

This patch cleans up the yielding code and makes it optional. An
environment variable, KMP_USE_YIELD, was added. Yielding is still
on by default (KMP_USE_YIELD=1), but can be turned off completely
(KMP_USE_YIELD=0), or turned on only when oversubscription is detected
(KMP_USE_YIELD=2). Note that oversubscription cannot always be detected
by the runtime (for example, when the runtime is initialized and the
process forks, oversubscription cannot be detected currently over
multiple instances of the runtime).

Because yielding can be controlled by user now, the library mode
settings (from KMP_LIBRARY) for throughput and turnaround have been
adjusted by altering blocktime, unless that was also explicitly set.

In the original code, there were a number of places where a double yield
might have been done under oversubscription. This version checks
oversubscription and if that's not going to yield, then it does
the spin check.

Patch by Terry Wilmarth

Differential Revision: https://reviews.llvm.org/D58148

llvm-svn: 355120

Details

Committed
jlpeytonFeb 28 2019, 11:11 AM
Differential Revision
D58148: Make use of sched_yield optional in runtime
Parents
rG23452e1c85ce: [PGO] Update InstrProfData.inc to sync with llvm
Branches
Unknown
Tags
Unknown