[Openmp-commits] [openmp] r268826 - Fine tuning of TC* macros

Paul Osmialowski via Openmp-commits openmp-commits at lists.llvm.org
Fri May 6 17:00:00 PDT 2016


Author: pawosm01
Date: Fri May  6 19:00:00 2016
New Revision: 268826

URL: http://llvm.org/viewvc/llvm-project?rev=268826&view=rev
Log:
Fine tuning of TC* macros

This patch introduces following:
* TCI_* and TCD_* macros for incrementation and decrementation
* Fix for invalid use of TCR_8 in one expression

Differential Revision: http://reviews.llvm.org/D19880

Modified:
    openmp/trunk/runtime/src/kmp_lock.cpp
    openmp/trunk/runtime/src/kmp_os.h
    openmp/trunk/runtime/src/kmp_tasking.c

Modified: openmp/trunk/runtime/src/kmp_lock.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_lock.cpp?rev=268826&r1=268825&r2=268826&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_lock.cpp (original)
+++ openmp/trunk/runtime/src/kmp_lock.cpp Fri May  6 19:00:00 2016
@@ -2507,7 +2507,7 @@ __kmp_acquire_drdpa_lock_timed_template(
 
     KMP_FSYNC_PREPARE(lck);
     KMP_INIT_YIELD(spins);
-    while (TCR_8(polls[ticket & mask]).poll < ticket) { // volatile load
+    while (TCR_8(polls[ticket & mask].poll) < ticket) { // volatile load
         // If we are oversubscribed,
         // or have waited a bit (and KMP_LIBRARY=turnaround), then yield.
         // CPU Pause is in the macros for yield.

Modified: openmp/trunk/runtime/src/kmp_os.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_os.h?rev=268826&r1=268825&r2=268826&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_os.h (original)
+++ openmp/trunk/runtime/src/kmp_os.h Fri May  6 19:00:00 2016
@@ -596,8 +596,12 @@ extern kmp_real64 __kmp_xchg_real64( vol
 
 #define TCR_4(a)            (a)
 #define TCW_4(a,b)          (a) = (b)
+#define TCI_4(a)            (++(a))
+#define TCD_4(a)            (--(a))
 #define TCR_8(a)            (a)
 #define TCW_8(a,b)          (a) = (b)
+#define TCI_8(a)            (++(a))
+#define TCD_8(a)            (--(a))
 #define TCR_SYNC_4(a)       (a)
 #define TCW_SYNC_4(a,b)     (a) = (b)
 #define TCX_SYNC_4(a,b,c)   KMP_COMPARE_AND_STORE_REL32((volatile kmp_int32 *)(volatile void *)&(a), (kmp_int32)(b), (kmp_int32)(c))

Modified: openmp/trunk/runtime/src/kmp_tasking.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_tasking.c?rev=268826&r1=268825&r2=268826&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_tasking.c (original)
+++ openmp/trunk/runtime/src/kmp_tasking.c Fri May  6 19:00:00 2016
@@ -2845,7 +2845,7 @@ static void __kmp_first_top_half_finish_
        KMP_TEST_THEN_DEC32( (kmp_int32 *)(& taskdata->td_taskgroup->count) );
 
     // Create an imaginary children for this task so the bottom half cannot release the task before we have completed the second top half
-    TCR_4(taskdata->td_incomplete_child_tasks++);
+    TCI_4(taskdata->td_incomplete_child_tasks);
 }
 
 static void __kmp_second_top_half_finish_proxy( kmp_taskdata_t * taskdata )
@@ -2857,7 +2857,7 @@ static void __kmp_second_top_half_finish
     KMP_DEBUG_ASSERT( children >= 0 );
 
     // Remove the imaginary children
-    TCR_4(taskdata->td_incomplete_child_tasks--);
+    TCD_4(taskdata->td_incomplete_child_tasks);
 }
 
 static void __kmp_bottom_half_finish_proxy( kmp_int32 gtid, kmp_task_t * ptask )




More information about the Openmp-commits mailing list