[Openmp-commits] [PATCH] D47717: [OMPT] Make sure that OMPT is enabled in runtime entry points that access internals of the runtime

Jonas Hahnfeld via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jun 4 07:26:08 PDT 2018


Hahnfeld added inline comments.


================
Comment at: runtime/src/ompt-general.cpp:458
           (ompt_callback_t)ompt_callbacks.ompt_callback(event_name);           \
-      if (mycb) {                                                              \
+      if (ompt_enabled.enabled && ompt_enabled.event_name && mycb) {           \
         *callback = mycb;                                                      \
----------------
Should we put an `if (ompt_enabled.enabled) return ompt_get_callback_failure` at the very beginning of the function? That seems invariant to the switch-case...


================
Comment at: runtime/src/ompt-specific.cpp:198
 ompt_data_t *__ompt_get_thread_data_internal() {
-  if (__kmp_get_gtid() >= 0) {
+  if (ompt_enabled.enabled && __kmp_get_gtid() >= 0) {
     kmp_info_t *thread = ompt_get_thread();
----------------
Is this needed in internal functions or does it just make things easier? I'm worried that adding these checks to internal functions will degrade performance...


https://reviews.llvm.org/D47717





More information about the Openmp-commits mailing list