This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Fix for http://bugs.llvm.org/show_bug.cgi?id=32456
ClosedPublic

Authored by AndreyChurbanov on Mar 29 2017, 9:11 AM.

Details

Summary

The ittnotify API was mistakenly enabled for static runtime library initially. This fix disables the ittnotify for the static build.

Main problem with ittnotify in static library is impossibility to dynamically detect the presence of the tool at run time once the executable is linked statically, e.g. such interfaces as dlopen, dlsym etc. are inaccessible.

Diff Detail

Repository
rL LLVM

Event Timeline

jlpeyton added inline comments.Mar 30 2017, 9:06 AM
runtime/CMakeLists.txt
311 ↗(On Diff #93378)

Can you add a message like:
libomp_say("ITT Notify not supported for static libraries - forcing ITT Notify off.")

runtime/CMakeLists.txt
311 ↗(On Diff #93378)

Is it worth checking if the build is standalone, as we usually keep silence otherwise?
And if ITT notify was already turned off before this setting, we actually do not forcing it off, so no warning needed.

I'd make both checks, like

if(LIBOMP_USE_ITT_NOTIFY AND NOT LIBOMP_ENABLE_SHARED)
  if(${LIBOMP_STANDALONE_BUILD})
    libomp_say("ITT Notify not supported for static libraries - forcing ITT Notify off")
  endif()
  set(LIBOMP_USE_ITT_NOTIFY FALSE)
endif()

Is it better?

jlpeyton added inline comments.Mar 30 2017, 12:05 PM
runtime/CMakeLists.txt
311 ↗(On Diff #93378)

I don't think we need to check for the standalone build. Only the block of messages in the # Print configuration after all variables are set. section are kept silent during the LLVM in-tree build. Everything else still prints as normal. The message won't look out of place in an LLVM in-tree build.

jlpeyton added inline comments.Mar 30 2017, 12:17 PM
runtime/CMakeLists.txt
311 ↗(On Diff #93378)

Ok, I forgot that libomp_say() prepends the "LIBOMP:" string to the message. You could use:
message(STATUS "ITT Notify not supported for static libraries - forcing ITT Notify off") so now it wouldn't look out of place.

AndreyChurbanov marked 4 inline comments as done.

comments addressed

This revision is now accepted and ready to land.Mar 31 2017, 9:19 AM
This revision was automatically updated to reflect the committed changes.