[Openmp-commits] [PATCH] D14544: [OMPT] Fix the lock id provided for ordered events

John Mellor-Crummey via Openmp-commits openmp-commits at lists.llvm.org
Tue Dec 22 15:10:17 PST 2015

jmellorcrummey added a comment.

Neither this patch nor the original code address the problem that needs attention.

There is a synchronization object used to perform ordered synchronization. Neither loc nor the wait_id initialized to loc represent it. If you look at how __kmp_ordered is called from kmp_gsupport.c (which is used for code compiled with the GNU compilers), you will begin to understand the problem.

Here's how it is called in KMP_API_NAME_GOMP_ORDERED_START:

  MKLOC(loc, "GOMP_ordered_start");
  KA_TRACE(20, ("GOMP_ordered_start: T#%d\n", gtid));
  __kmpc_ordered(&loc, gtid);

Below is the definition for MKLOC:

#define MKLOC(loc,routine) static ident_t (loc) = {0, KMP_IDENT_KMPC, 0, 0, ";unknown;unknown;0;0;;" };

Thus, in __ kmpc_ordered, loc refers to the address of a static variable in the runtime library. When __ kmp_ordered_end is called, a different loc is passed. Neother represents the synchronization object that is used to maintain ordered synchronization. That synchronization object is only visible inside  &_&_kmp_dispatch_deo as the first argument to the __kmp_wait_yield template it calls

  __kmp_wait_yield< UT >( &sh->u.s.ordered_iteration, lower, __kmp_ge< UT > USE_ITT_BUILD_ARG( NULL ) );


More information about the Openmp-commits mailing list