Page MenuHomePhabricator

OMP_WAIT_POLICY changes.
ClosedPublic

Authored by jlpeyton on Mar 29 2016, 2:09 PM.

Details

Summary

This change has OMP_WAIT_POLICY=active to mean that threads will busy-wait in spin loops and virtually never go to sleep. OMP_WAIT_POLICY=passive now means that threads will immediately go to sleep inside a spin loop. KMP_BLOCKTIME was the previous mechanism to specify this behavior via KMP_BLOCKTIME=0 or KMP_BLOCKTIME=infinite, but the standard OpenMP environment variable should also be able to specify this behavior.

Diff Detail

Repository
rL LLVM

Event Timeline

jlpeyton updated this revision to Diff 51982.Mar 29 2016, 2:09 PM
jlpeyton retitled this revision from to OMP_WAIT_POLICY changes..
jlpeyton updated this object.
jlpeyton set the repository for this revision to rL LLVM.
jlpeyton added a subscriber: openmp-commits.

This change has OMP_WAIT_POLICY=active to mean that threads will busy-wait in spin loops and virtually never go to sleep. OMP_WAIT_POLICY=passive now means that threads will immediately go to sleep inside a spin loop. KMP_BLOCKTIME was the previous mechanism to specify this behavior via KMP_BLOCKTIME=0 or KMP_BLOCKTIME=infinite, but the standard OpenMP environment variable should also be able to specify this behavior.

To clarify, is this a change in behavior for OMP_WAIT_POLICY=active, or just for OMP_WAIT_POLICY=passive?

To clarify, is this a change in behavior for OMP_WAIT_POLICY=active, or just for OMP_WAIT_POLICY=passive?

Both actually.

A bit more details: earlier the OMP_WAIT_POLICY was attributed to the KMP_LIBRARY functionality, so the difference between active and passive behavior was the presence of "yield" calls for passive. Thus the majority of applications don't see any difference because of setting OMP_WAIT_POLICY. The blocktime affects performance much stronger than yields, so we decided to make the OMP_WAIT_POLICY more sensitive and added the functionality of KMP_BLOCKTIME to it.

In summary:
Old:

OMP_WAIT_POLICY-active
  threads spin for the default blocktime, no yields, then go to sleep.
OMP_WAIT_POLICY=passive
  threads spin for the default blocktime calling yields, then go to sleep.

New:

OMP_WAIT_POLICY-active
  threads spin forever, no yields.
OMP_WAIT_POLICY=passive
  threads do not spin, go to sleep immediately.

Of cause additional setting of the KMP_BLOCKTIME will change the behavior.

AndreyChurbanov accepted this revision.Apr 4 2016, 1:20 AM
AndreyChurbanov edited edge metadata.

LGTM

This revision is now accepted and ready to land.Apr 4 2016, 1:20 AM
This revision was automatically updated to reflect the committed changes.