[Openmp-commits] [PATCH] D23307: [OMPT] Reset task exit frame when execution is finished

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Tue Aug 9 03:55:19 PDT 2016


protze.joachim created this revision.
protze.joachim added reviewers: jlpeyton, AndreyChurbanov.
protze.joachim added subscribers: Hahnfeld, openmp-commits.

The exit address is set when execution of a task is started and should be reset as soon as the execution is finished.
Especially for the asm implementation of __kmp_invoke_microtask, resetting in this call would be painfull, so reset just after the invokation.

The testcase shows the effect of this patch:
Before, the implicit barriers at the end of an implicit task would see an exit address for the implicit task.

This barrier is a task scheduling point. Thus, any explicit task scheduled there would see an exit, but no reenter address for the implicit task.

https://reviews.llvm.org/D23307

Files:
  runtime/src/kmp_runtime.c
  runtime/test/ompt/parallel/nested.c

Index: runtime/test/ompt/parallel/nested.c
===================================================================
--- runtime/test/ompt/parallel/nested.c
+++ runtime/test/ompt/parallel/nested.c
@@ -64,12 +64,20 @@
   // THREADS: {{^}}[[MASTER_ID]]: level 2: parallel_id=0, task_id=[[PARENT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[MAIN_REENTER]]
   // THREADS: {{^}}[[MASTER_ID]]: __builtin_frame_address(0)=[[NESTED_REENTER:0x[0-f]+]]
   // THREADS-NOT: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end
+  // explicit barrier
   // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]]
+  // THREADS: {{^}}[[MASTER_ID]]: level 0: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]], exit_frame=[[NESTED_EXIT]], reenter_frame=[[NESTED_REENTER]]
+  // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]]
+  // implicit barrier
+  // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]]
+  // THREADS: {{^}}[[MASTER_ID]]: level 0: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
   // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]]
   // THREADS: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[NESTED_IMPLICIT_TASK_ID]]
   // THREADS: {{^}}[[MASTER_ID]]: ompt_event_parallel_end: parallel_id=[[NESTED_PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], invoker=[[PARALLEL_INVOKER]]
   // THREADS-NOT: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end
+  // implicit barrier
   // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_begin: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
+  // THREADS: {{^}}[[MASTER_ID]]: level 0: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]], exit_frame=[[NULL]], reenter_frame=[[NULL]]
   // THREADS: {{^}}[[MASTER_ID]]: ompt_event_barrier_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
   // THREADS: {{^}}[[MASTER_ID]]: ompt_event_implicit_task_end: parallel_id=[[PARALLEL_ID]], task_id=[[IMPLICIT_TASK_ID]]
 
Index: runtime/src/kmp_runtime.c
===================================================================
--- runtime/src/kmp_runtime.c
+++ runtime/src/kmp_runtime.c
@@ -1545,6 +1545,9 @@
                                         , exit_runtime_p
 #endif
                                         );
+#if OMPT_SUPPORT
+                *exit_runtime_p=0;
+#endif
             }
 
 #if OMPT_SUPPORT
@@ -1742,6 +1745,9 @@
                         , exit_runtime_p
 #endif
                     );
+#if OMPT_SUPPORT
+                *exit_runtime_p=0;
+#endif
                 }
 
 #if OMPT_SUPPORT
@@ -1848,6 +1854,9 @@
                         , exit_runtime_p
 #endif
                     );
+#if OMPT_SUPPORT
+                *exit_runtime_p=0;
+#endif
                 }
 
 #if OMPT_SUPPORT
@@ -6823,6 +6832,9 @@
                                      , exit_runtime_p
 #endif
                                      );
+#if OMPT_SUPPORT
+                *exit_runtime_p=0;
+#endif
     }
 
 #if USE_ITT_BUILD


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23307.67313.patch
Type: text/x-patch
Size: 3312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20160809/bf1402c9/attachment-0001.bin>


More information about the Openmp-commits mailing list