This is an archive of the discontinued LLVM Phabricator instance.

Improve threadprivate implementation
ClosedPublic

Authored by tlwilmar on Jan 10 2018, 12:53 PM.

Details

Summary

These changes improve the threadprivate implementation to allow the compiler to reuse the same caches consistently, without allocating new ones. To do this, we make it possible to resize caches when needed, and to point the compiler's pointer at newly resized caches. The implementation also works with older compilers by looking up existing caches rather than creating new ones. Because older compilers still call into the kmpc_threadprivate_cached function repeatedly, we still suffer the performance of the frequent locking to look up the existing cache. Future compilers should only call kmpc_threadprivate_cached once per piece of threadprivate data per global thread id.

Diff Detail

Repository
rL LLVM

Event Timeline

tlwilmar created this revision.Jan 10 2018, 12:53 PM
hbae added inline comments.Feb 12 2018, 9:53 AM
runtime/src/kmp_threadprivate.cpp
714 ↗(On Diff #129320)

Should we rephrase this so that it doesn't include 18.0/19.0?

tlwilmar updated this revision to Diff 134310.Feb 14 2018, 2:12 PM

Updated comment to be more general.

hbae accepted this revision.Feb 14 2018, 2:55 PM

LGTM.

This revision is now accepted and ready to land.Feb 14 2018, 2:55 PM
This revision was automatically updated to reflect the committed changes.