From f8d22f9db8b5ce50e8deec8e94c7547a4a6b9cbc Mon Sep 17 00:00:00 2001 From: Joachim Protze Date: Thu, 21 Dec 2017 13:55:39 +0000 Subject: [OMPT] Fix return address handling in a few GOMP interface methods This revision fixes failing testcases with parallel for loops and the gomp interface. The return address needs to be stored at entry to runtime. The storage is cleared on usage, so we need to update the storage before calling again internal functions, that will trigger event callbacks. Differential Revision: https://reviews.llvm.org/D41181 llvm-svn: 321265 --- openmp/runtime/src/kmp_gsupport.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'openmp/runtime/src') diff --git a/openmp/runtime/src/kmp_gsupport.cpp b/openmp/runtime/src/kmp_gsupport.cpp index 83b19734e05..9fa05e6afbe 100644 --- a/openmp/runtime/src/kmp_gsupport.cpp +++ b/openmp/runtime/src/kmp_gsupport.cpp @@ -326,10 +326,6 @@ static long chunk_size) { // Intialize the loop worksharing construct. -#if OMPT_SUPPORT - if (ompt_enabled.enabled) - OMPT_STORE_RETURN_ADDRESS(*gtid); -#endif KMP_DISPATCH_INIT(loc, *gtid, schedule, start, end, incr, chunk_size, schedule != kmp_sch_static); @@ -819,8 +815,10 @@ LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_ORDERED_RUNTIME_NEXT), (microtask_t)__kmp_GOMP_parallel_microtask_wrapper, \ 9, task, data, num_threads, &loc, (schedule), lb, \ (str > 0) ? (ub - 1) : (ub + 1), str, chunk_sz); \ + IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid)); \ } else { \ __kmp_GOMP_serialized_parallel(&loc, gtid, task); \ + IF_OMPT_SUPPORT(OMPT_STORE_RETURN_ADDRESS(gtid)); \ } \ \ KMP_DISPATCH_INIT(&loc, gtid, (schedule), lb, \ @@ -1040,6 +1038,10 @@ unsigned KMP_EXPAND_NAME(KMP_API_NAME_GOMP_SECTIONS_NEXT)(void) { MKLOC(loc, "GOMP_sections_next"); KA_TRACE(20, ("GOMP_sections_next: T#%d\n", gtid)); +#if OMPT_SUPPORT + OMPT_STORE_RETURN_ADDRESS(gtid); +#endif + status = KMP_DISPATCH_NEXT(&loc, gtid, NULL, &lb, &ub, &stride); if (status) { KMP_DEBUG_ASSERT(stride == 1); @@ -1206,6 +1208,10 @@ void KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_SECTIONS)(void (*task)(void *), __kmp_GOMP_serialized_parallel(&loc, gtid, task); } +#if OMPT_SUPPORT + OMPT_STORE_RETURN_ADDRESS(gtid); +#endif + KMP_DISPATCH_INIT(&loc, gtid, kmp_nm_dynamic_chunked, 1, count, 1, 1, TRUE); task(data); -- cgit v1.2.3