This is an archive of the discontinued LLVM Phabricator instance.

[OMPT] Fix the lock id provided for ordered events
AbandonedPublic

Authored by protze.joachim on Nov 10 2015, 9:32 AM.

Details

Summary

With the current implementation, ompt_thread_info.wait_id is set to 0 once the thread got the lock. This value is used to provide the lock id for the event calls.

With this patch, the lock id as provided by the function argument is used. Now all event callbacks provide a consistent lock id.

Diff Detail

Event Timeline

protze.joachim retitled this revision from to [OMPT] Fix the lock id provided for ordered events.
protze.joachim updated this object.
protze.joachim added a subscriber: openmp-commits.

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 ) );
jlpeyton requested changes to this revision.Feb 2 2016, 8:08 AM
jlpeyton edited edge metadata.

Updating the status of this review to "Needs changes". The fundamental issue has apparently not been addressed according to John Mellor-Crummy.

This revision now requires changes to proceed.Feb 2 2016, 8:08 AM
protze.joachim abandoned this revision.Nov 5 2017, 6:15 AM

Subsumed by D38185