[Openmp-commits] Switch to TLS for POWER

Alexandre Eichenberger alexe at us.ibm.com
Thu Jun 4 05:45:45 PDT 2015


I would like to request switching the threadprivate scheme to TLS (Thread
Level Storage) for POWER before we get legacy code out there. Individual
measurements has shown TLS to have about 10x lower overhead (number may
change depending to the TLS scheme). TLS is also used by other compilers
(e.g. XL) and thus provide better interoperability.

Approach is relatively simple: compiler still generate a call to register
the constructors and the destructors, but the functions calling the
constructor/destructors have been changed a bit so that the compiler call
the constructor on the TLS version of the object (not the global one, as it
currently is in KMP). Then, prior to starting a parallel function, the
workers check if there are no new constructors/destructors that have been
registered; if there are, they will call the constructors prior to starting
the parallel region. Destructors are called when killing a worker thread.

KMP code change have been done (exclusively under #def for power
architecture), LLVM changes have been done, code has been tested. Commit
will need to be coordinated with the LLVM changes, which must go at the
same time.

If there is interest, and no code legacy issue, this patch could also be
applied for other architectures that have TLS support.

Alexandre

(See attached file: june3-threadprivate-patch)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: june3-threadprivate-patch
Type: application/octet-stream
Size: 4944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20150604/56f2a0ac/attachment.obj>


More information about the Openmp-commits mailing list