Page MenuHomePhabricator

Fix implementation of OMP_THREAD_LIMIT
ClosedPublic

Authored by tlwilmar on Jul 26 2017, 1:43 PM.

Details

Summary

This change fixes the implementation of OMP_THREAD_LIMIT. The implementation of this previously was not restricted to a contention group (but it should be, according to the spec), and this is fixed here. A field is added to root thread to store a counter of the threads in the contention group. An extra check is added when reserving threads for a parallel region that checks this variable and compares to threadlimit-var, which is implemented as a new global variable, kmp_cg_max_nth. Associated settings changes were also made, and clean up of comments that referred to OMP_THREAD_LIMIT, but should refer to the new KMP_DEVICE_THREAD_LIMIT (added in an earlier patch).

Diff Detail

Repository
rL LLVM

Event Timeline

tlwilmar created this revision.Jul 26 2017, 1:43 PM
tlwilmar updated this revision to Diff 108520.Jul 27 2017, 1:40 PM

Added a test for OMP_THREAD_LIMIT env, api, and general functionality. Note that this test, when running correctly, will emit a Warning and a Hint, because the limit squashes the requested number of threads.

This revision is now accepted and ready to land.Jul 27 2017, 1:55 PM
This revision was automatically updated to reflect the committed changes.