This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] [OMPT] [2/8] Implemented a connector for communication of OMPT callbacks between libraries.
ClosedPublic

Authored by dhruvachak on Apr 12 2022, 12:00 AM.

Details

Summary

This is part of a set of patches implementing OMPT target callback support and has been split out of the originally submitted https://reviews.llvm.org/D113728. The overall design can be found in https://rice.app.box.com/s/pf3gix2hs4d4o1aatwir1set05xmjljc

The purpose of this patch is to provide a way to register tool-provided callbacks into libomp when libomptarget is loaded.

Introduced a cmake variable LIBOMPTARGET_OMPT_SUPPORT that can be used to control OMPT target support. It follows host OMPT support, controlled by LIBOMP_HAVE_OMPT_SUPPORT.

Added a connector that can be used to communicate between OMPT implementations in libomp and libomptarget or libomptarget and a plugin.

Added a global constructor in libomptarget that uses the connector to force registration of tool-provided callbacks in libomp. A pair of init and fini functions are provided to libomp as part of the connect process which will be used to register the tool-provided callbacks in libomptarget.

Patch from John Mellor-Crummey <johnmc@rice.edu>
(With contributions from Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>)

Diff Detail

Event Timeline

dhruvachak created this revision.Apr 12 2022, 12:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2022, 12:00 AM
dhruvachak requested review of this revision.Apr 12 2022, 12:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2022, 12:00 AM

Removed absolute path for location of omp-tools.h.

Set the location of OpenMP tools directory in runtime and use it in libomptarget.

dhruvachak retitled this revision from [OpenMP] Implemented a connector for communication of OMPT callbacks between libraries. to [OpenMP] [OMPT] [2/8] Implemented a connector for communication of OMPT callbacks between libraries..Jun 20 2022, 6:18 PM
dhruvachak edited the summary of this revision. (Show Details)
dhruvachak edited the summary of this revision. (Show Details)Jun 20 2022, 7:24 PM
dreachem accepted this revision.Sep 7 2022, 8:01 AM

LGTM.

This revision is now accepted and ready to land.Sep 7 2022, 8:01 AM

This patch had to be reverted because of a link failure https://github.com/llvm/llvm-project/issues/58721

dhruvachak edited the summary of this revision. (Show Details)Nov 3 2022, 7:19 PM
dhruvachak reopened this revision.Nov 4 2022, 3:16 PM
This revision is now accepted and ready to land.Nov 4 2022, 3:16 PM
dhruvachak updated this revision to Diff 473351.Nov 4 2022, 3:20 PM

Fixed issues reported in https://github.com/llvm/llvm-project/issues/58721

Handled LIBOMP_OMPT_SUPPORT and its interaction with LIBOMPTARGET_OMPT_SUPPORT.

Replaced dlsym with llvm library API.

jhuber6 accepted this revision.Nov 11 2022, 6:20 AM
jhuber6 added a subscriber: jhuber6.

Make sure the new files in libomptarget match the LLVM style for the variables and filenames. Otherwise looks file

Changed new file name from ompt-connector.h to ompt_connector.h.

Make sure the new files in libomptarget match the LLVM style for the variables and filenames. Otherwise looks file

I changed the new include filename to ompt_connector.h. The filename formats appear mixed to me. Specifically, libomp seems to use "-" as the separator while libomptarget and plugins seem to use "_".

About variables, I tried to use CamelCase as much as possible for the new code. The problem is that the new code has to use OMPT APIs and they have a different naming format. So it is hard to avoid a mixed format. If you are referring to any specific use, let me know and I can fix it in a separate commit. Thanks.

This revision was landed with ongoing or failed builds.Nov 15 2022, 2:22 PM
This revision was automatically updated to reflect the committed changes.