[Openmp-commits] [openmp] r361158 - [OpenMP][OMPT] Fix locking testcases for 32 bit architectures

Joachim Protze via Openmp-commits openmp-commits at lists.llvm.org
Mon May 20 07:21:42 PDT 2019


Author: jprotze
Date: Mon May 20 07:21:42 2019
New Revision: 361158

URL: http://llvm.org/viewvc/llvm-project?rev=361158&view=rev
Log:
[OpenMP][OMPT] Fix locking testcases for 32 bit architectures

https://reviews.llvm.org/D58454 did not fix the problem for a typical use
case of building LLVM with gcc or icc and then testing with the newly built
clang compiler.
The compilers do not agree on how to extend a 32-bit pointer to uint64, so
make the pointer unsigned first, before adjusting the size.

Patch by Joachim Protze

Differential Revision: https://reviews.llvm.org/D58506

Modified:
    openmp/trunk/runtime/src/kmp_atomic.h
    openmp/trunk/runtime/src/kmp_csupport.cpp
    openmp/trunk/runtime/src/ompt-specific.cpp
    openmp/trunk/runtime/test/ompt/synchronization/lock.c
    openmp/trunk/runtime/test/ompt/synchronization/nest_lock.c

Modified: openmp/trunk/runtime/src/kmp_atomic.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_atomic.h?rev=361158&r1=361157&r2=361158&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_atomic.h (original)
+++ openmp/trunk/runtime/src/kmp_atomic.h Mon May 20 07:21:42 2019
@@ -363,7 +363,7 @@ static inline void __kmp_acquire_atomic_
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_mutex_acquire) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
-        ompt_mutex_atomic, 0, kmp_mutex_impl_queuing, (ompt_wait_id_t)lck,
+        ompt_mutex_atomic, 0, kmp_mutex_impl_queuing, (ompt_wait_id_t)(uintptr_t)lck,
         OMPT_GET_RETURN_ADDRESS(0));
   }
 #endif
@@ -373,7 +373,7 @@ static inline void __kmp_acquire_atomic_
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_mutex_acquired) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-        ompt_mutex_atomic, (ompt_wait_id_t)lck, OMPT_GET_RETURN_ADDRESS(0));
+        ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck, OMPT_GET_RETURN_ADDRESS(0));
   }
 #endif
 }
@@ -389,7 +389,7 @@ static inline void __kmp_release_atomic_
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_mutex_released) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-        ompt_mutex_atomic, (ompt_wait_id_t)lck, OMPT_GET_RETURN_ADDRESS(0));
+        ompt_mutex_atomic, (ompt_wait_id_t)(uintptr_t)lck, OMPT_GET_RETURN_ADDRESS(0));
   }
 #endif
 }

Modified: openmp/trunk/runtime/src/kmp_csupport.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.cpp?rev=361158&r1=361157&r2=361158&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.cpp (original)
+++ openmp/trunk/runtime/src/kmp_csupport.cpp Mon May 20 07:21:42 2019
@@ -891,7 +891,7 @@ void __kmpc_ordered(ident_t *loc, kmp_in
   if (ompt_enabled.enabled) {
     OMPT_STORE_RETURN_ADDRESS(gtid);
     team = __kmp_team_from_gtid(gtid);
-    lck = (ompt_wait_id_t)&team->t.t_ordered.dt.t_value;
+    lck = (ompt_wait_id_t)(uintptr_t)&team->t.t_ordered.dt.t_value;
     /* OMPT state update */
     th->th.ompt_thread_info.wait_id = lck;
     th->th.ompt_thread_info.state = ompt_state_wait_ordered;
@@ -900,8 +900,8 @@ void __kmpc_ordered(ident_t *loc, kmp_in
     codeptr_ra = OMPT_LOAD_RETURN_ADDRESS(gtid);
     if (ompt_enabled.ompt_callback_mutex_acquire) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
-          ompt_mutex_ordered, omp_lock_hint_none, kmp_mutex_impl_spin,
-          (ompt_wait_id_t)lck, codeptr_ra);
+          ompt_mutex_ordered, omp_lock_hint_none, kmp_mutex_impl_spin, lck,
+          codeptr_ra);
     }
   }
 #endif
@@ -920,7 +920,7 @@ void __kmpc_ordered(ident_t *loc, kmp_in
     /* OMPT event callback */
     if (ompt_enabled.ompt_callback_mutex_acquired) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-          ompt_mutex_ordered, (ompt_wait_id_t)lck, codeptr_ra);
+          ompt_mutex_ordered, (ompt_wait_id_t)(uintptr_t)lck, codeptr_ra);
     }
   }
 #endif
@@ -960,7 +960,8 @@ void __kmpc_end_ordered(ident_t *loc, km
   if (ompt_enabled.ompt_callback_mutex_released) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
         ompt_mutex_ordered,
-        (ompt_wait_id_t)&__kmp_team_from_gtid(gtid)->t.t_ordered.dt.t_value,
+        (ompt_wait_id_t)(uintptr_t)&__kmp_team_from_gtid(gtid)
+            ->t.t_ordered.dt.t_value,
         OMPT_LOAD_RETURN_ADDRESS(gtid));
   }
 #endif
@@ -1224,7 +1225,7 @@ void __kmpc_critical(ident_t *loc, kmp_i
     ti = __kmp_threads[global_tid]->th.ompt_thread_info;
     /* OMPT state update */
     prev_state = ti.state;
-    ti.wait_id = (ompt_wait_id_t)lck;
+    ti.wait_id = (ompt_wait_id_t)(uintptr_t)lck;
     ti.state = ompt_state_wait_critical;
 
     /* OMPT event callback */
@@ -1232,7 +1233,7 @@ void __kmpc_critical(ident_t *loc, kmp_i
     if (ompt_enabled.ompt_callback_mutex_acquire) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
           ompt_mutex_critical, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
-          (ompt_wait_id_t)crit, codeptr_ra);
+          (ompt_wait_id_t)(uintptr_t)lck, codeptr_ra);
     }
   }
 #endif
@@ -1252,7 +1253,7 @@ void __kmpc_critical(ident_t *loc, kmp_i
     /* OMPT event callback */
     if (ompt_enabled.ompt_callback_mutex_acquired) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-          ompt_mutex_critical, (ompt_wait_id_t)crit, codeptr_ra);
+          ompt_mutex_critical, (ompt_wait_id_t)(uintptr_t)lck, codeptr_ra);
     }
   }
 #endif
@@ -1438,14 +1439,15 @@ void __kmpc_critical_with_hint(ident_t *
       ti = __kmp_threads[global_tid]->th.ompt_thread_info;
       /* OMPT state update */
       prev_state = ti.state;
-      ti.wait_id = (ompt_wait_id_t)lck;
+      ti.wait_id = (ompt_wait_id_t)(uintptr_t)lck;
       ti.state = ompt_state_wait_critical;
 
       /* OMPT event callback */
       if (ompt_enabled.ompt_callback_mutex_acquire) {
         ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
             ompt_mutex_critical, (unsigned int)hint,
-            __ompt_get_mutex_impl_type(crit), (ompt_wait_id_t)crit, codeptr);
+            __ompt_get_mutex_impl_type(crit), (ompt_wait_id_t)(uintptr_t)lck,
+            codeptr);
       }
     }
 #endif
@@ -1476,14 +1478,15 @@ void __kmpc_critical_with_hint(ident_t *
       ti = __kmp_threads[global_tid]->th.ompt_thread_info;
       /* OMPT state update */
       prev_state = ti.state;
-      ti.wait_id = (ompt_wait_id_t)lck;
+      ti.wait_id = (ompt_wait_id_t)(uintptr_t)lck;
       ti.state = ompt_state_wait_critical;
 
       /* OMPT event callback */
       if (ompt_enabled.ompt_callback_mutex_acquire) {
         ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
             ompt_mutex_critical, (unsigned int)hint,
-            __ompt_get_mutex_impl_type(0, ilk), (ompt_wait_id_t)crit, codeptr);
+            __ompt_get_mutex_impl_type(0, ilk), (ompt_wait_id_t)(uintptr_t)lck,
+            codeptr);
       }
     }
 #endif
@@ -1503,7 +1506,7 @@ void __kmpc_critical_with_hint(ident_t *
     /* OMPT event callback */
     if (ompt_enabled.ompt_callback_mutex_acquired) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-          ompt_mutex_critical, (ompt_wait_id_t)crit, codeptr);
+          ompt_mutex_critical, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
     }
   }
 #endif
@@ -1601,7 +1604,8 @@ void __kmpc_end_critical(ident_t *loc, k
   OMPT_STORE_RETURN_ADDRESS(global_tid);
   if (ompt_enabled.ompt_callback_mutex_released) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-        ompt_mutex_critical, (ompt_wait_id_t)crit, OMPT_LOAD_RETURN_ADDRESS(0));
+        ompt_mutex_critical, (ompt_wait_id_t)(uintptr_t)lck,
+        OMPT_LOAD_RETURN_ADDRESS(0));
   }
 #endif
 
@@ -2233,8 +2237,8 @@ void __kmpc_init_lock_with_hint(ident_t
   if (ompt_enabled.ompt_callback_lock_init) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
         ompt_mutex_lock, (omp_lock_hint_t)hint,
-        __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
-        codeptr);
+        __ompt_get_mutex_impl_type(user_lock),
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 }
@@ -2257,8 +2261,8 @@ void __kmpc_init_nest_lock_with_hint(ide
   if (ompt_enabled.ompt_callback_lock_init) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
         ompt_mutex_nest_lock, (omp_lock_hint_t)hint,
-        __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
-        codeptr);
+        __ompt_get_mutex_impl_type(user_lock),
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 }
@@ -2283,8 +2287,8 @@ void __kmpc_init_lock(ident_t *loc, kmp_
   if (ompt_enabled.ompt_callback_lock_init) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
         ompt_mutex_lock, omp_lock_hint_none,
-        __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
-        codeptr);
+        __ompt_get_mutex_impl_type(user_lock),
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 
@@ -2326,7 +2330,7 @@ void __kmpc_init_lock(ident_t *loc, kmp_
   if (ompt_enabled.ompt_callback_lock_init) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
         ompt_mutex_lock, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
-        (ompt_wait_id_t)user_lock, codeptr);
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 
@@ -2355,8 +2359,8 @@ void __kmpc_init_nest_lock(ident_t *loc,
   if (ompt_enabled.ompt_callback_lock_init) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
         ompt_mutex_nest_lock, omp_lock_hint_none,
-        __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
-        codeptr);
+        __ompt_get_mutex_impl_type(user_lock),
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 
@@ -2401,7 +2405,7 @@ void __kmpc_init_nest_lock(ident_t *loc,
   if (ompt_enabled.ompt_callback_lock_init) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_init)(
         ompt_mutex_nest_lock, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
-        (ompt_wait_id_t)user_lock, codeptr);
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 
@@ -2437,7 +2441,7 @@ void __kmpc_destroy_lock(ident_t *loc, k
       lck = (kmp_user_lock_p)user_lock;
     }
     ompt_callbacks.ompt_callback(ompt_callback_lock_destroy)(
-        ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+        ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
   KMP_D_LOCK_FUNC(user_lock, destroy)((kmp_dyna_lock_t *)user_lock);
@@ -2465,7 +2469,7 @@ void __kmpc_destroy_lock(ident_t *loc, k
     codeptr = OMPT_GET_RETURN_ADDRESS(0);
   if (ompt_enabled.ompt_callback_lock_destroy) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_destroy)(
-        ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+        ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 
@@ -2505,7 +2509,7 @@ void __kmpc_destroy_nest_lock(ident_t *l
     codeptr = OMPT_GET_RETURN_ADDRESS(0);
   if (ompt_enabled.ompt_callback_lock_destroy) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_destroy)(
-        ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+        ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
   KMP_D_LOCK_FUNC(user_lock, destroy)((kmp_dyna_lock_t *)user_lock);
@@ -2537,7 +2541,7 @@ void __kmpc_destroy_nest_lock(ident_t *l
     codeptr = OMPT_GET_RETURN_ADDRESS(0);
   if (ompt_enabled.ompt_callback_lock_destroy) {
     ompt_callbacks.ompt_callback(ompt_callback_lock_destroy)(
-        ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+        ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 
@@ -2582,8 +2586,8 @@ void __kmpc_set_lock(ident_t *loc, kmp_i
   if (ompt_enabled.ompt_callback_mutex_acquire) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
         ompt_mutex_lock, omp_lock_hint_none,
-        __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
-        codeptr);
+        __ompt_get_mutex_impl_type(user_lock),
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 #if KMP_USE_INLINED_TAS
@@ -2604,7 +2608,7 @@ void __kmpc_set_lock(ident_t *loc, kmp_i
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_mutex_acquired) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-        ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+        ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 
@@ -2637,7 +2641,7 @@ void __kmpc_set_lock(ident_t *loc, kmp_i
   if (ompt_enabled.ompt_callback_mutex_acquire) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
         ompt_mutex_lock, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
-        (ompt_wait_id_t)lck, codeptr);
+        (ompt_wait_id_t)(uintptr_t)lck, codeptr);
   }
 #endif
 
@@ -2650,7 +2654,7 @@ void __kmpc_set_lock(ident_t *loc, kmp_i
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (ompt_enabled.ompt_callback_mutex_acquired) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-        ompt_mutex_lock, (ompt_wait_id_t)lck, codeptr);
+        ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
   }
 #endif
 
@@ -2672,8 +2676,8 @@ void __kmpc_set_nest_lock(ident_t *loc,
     if (ompt_enabled.ompt_callback_mutex_acquire) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
           ompt_mutex_nest_lock, omp_lock_hint_none,
-          __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
-          codeptr);
+          __ompt_get_mutex_impl_type(user_lock),
+          (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
     }
   }
 #endif
@@ -2690,13 +2694,14 @@ void __kmpc_set_nest_lock(ident_t *loc,
       if (ompt_enabled.ompt_callback_mutex_acquired) {
         // lock_first
         ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-            ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+            ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock,
+            codeptr);
       }
     } else {
       if (ompt_enabled.ompt_callback_nest_lock) {
         // lock_next
         ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
-            ompt_scope_begin, (ompt_wait_id_t)user_lock, codeptr);
+            ompt_scope_begin, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
       }
     }
   }
@@ -2734,7 +2739,8 @@ void __kmpc_set_nest_lock(ident_t *loc,
     if (ompt_enabled.ompt_callback_mutex_acquire) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
           ompt_mutex_nest_lock, omp_lock_hint_none,
-          __ompt_get_mutex_impl_type(), (ompt_wait_id_t)lck, codeptr);
+          __ompt_get_mutex_impl_type(), (ompt_wait_id_t)(uintptr_t)lck,
+          codeptr);
     }
   }
 #endif
@@ -2751,13 +2757,13 @@ void __kmpc_set_nest_lock(ident_t *loc,
       if (ompt_enabled.ompt_callback_mutex_acquired) {
         // lock_first
         ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-            ompt_mutex_nest_lock, (ompt_wait_id_t)lck, codeptr);
+            ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
       }
     } else {
       if (ompt_enabled.ompt_callback_nest_lock) {
         // lock_next
         ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
-            ompt_scope_begin, (ompt_wait_id_t)lck, codeptr);
+            ompt_scope_begin, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
       }
     }
   }
@@ -2793,7 +2799,7 @@ void __kmpc_unset_lock(ident_t *loc, kmp
     codeptr = OMPT_GET_RETURN_ADDRESS(0);
   if (ompt_enabled.ompt_callback_mutex_released) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-        ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+        ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 
@@ -2822,7 +2828,7 @@ void __kmpc_unset_lock(ident_t *loc, kmp
       codeptr = OMPT_GET_RETURN_ADDRESS(0);
     if (ompt_enabled.ompt_callback_mutex_released) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-          ompt_mutex_lock, (ompt_wait_id_t)lck, codeptr);
+          ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
     }
 #endif
 
@@ -2854,7 +2860,7 @@ void __kmpc_unset_lock(ident_t *loc, kmp
     codeptr = OMPT_GET_RETURN_ADDRESS(0);
   if (ompt_enabled.ompt_callback_mutex_released) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-        ompt_mutex_lock, (ompt_wait_id_t)lck, codeptr);
+        ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
   }
 #endif
 
@@ -2882,12 +2888,13 @@ void __kmpc_unset_nest_lock(ident_t *loc
       if (ompt_enabled.ompt_callback_mutex_released) {
         // release_lock_last
         ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-            ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+            ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock,
+            codeptr);
       }
     } else if (ompt_enabled.ompt_callback_nest_lock) {
       // release_lock_prev
       ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
-          ompt_scope_end, (ompt_wait_id_t)user_lock, codeptr);
+          ompt_scope_end, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
     }
   }
 #endif
@@ -2931,12 +2938,12 @@ void __kmpc_unset_nest_lock(ident_t *loc
         if (ompt_enabled.ompt_callback_mutex_released) {
           // release_lock_last
           ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-              ompt_mutex_nest_lock, (ompt_wait_id_t)lck, codeptr);
+              ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
         }
       } else if (ompt_enabled.ompt_callback_nest_lock) {
         // release_lock_previous
         ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
-            ompt_mutex_scope_end, (ompt_wait_id_t)lck, codeptr);
+            ompt_mutex_scope_end, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
       }
     }
 #endif
@@ -2973,12 +2980,12 @@ void __kmpc_unset_nest_lock(ident_t *loc
       if (ompt_enabled.ompt_callback_mutex_released) {
         // release_lock_last
         ompt_callbacks.ompt_callback(ompt_callback_mutex_released)(
-            ompt_mutex_nest_lock, (ompt_wait_id_t)lck, codeptr);
+            ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
       }
     } else if (ompt_enabled.ompt_callback_nest_lock) {
       // release_lock_previous
       ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
-          ompt_mutex_scope_end, (ompt_wait_id_t)lck, codeptr);
+          ompt_mutex_scope_end, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
     }
   }
 #endif
@@ -3004,8 +3011,8 @@ int __kmpc_test_lock(ident_t *loc, kmp_i
   if (ompt_enabled.ompt_callback_mutex_acquire) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
         ompt_mutex_lock, omp_lock_hint_none,
-        __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
-        codeptr);
+        __ompt_get_mutex_impl_type(user_lock),
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
 #if KMP_USE_INLINED_TAS
@@ -3027,7 +3034,7 @@ int __kmpc_test_lock(ident_t *loc, kmp_i
 #if OMPT_SUPPORT && OMPT_OPTIONAL
     if (ompt_enabled.ompt_callback_mutex_acquired) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-          ompt_mutex_lock, (ompt_wait_id_t)user_lock, codeptr);
+          ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
     }
 #endif
     return FTN_TRUE;
@@ -3068,7 +3075,7 @@ int __kmpc_test_lock(ident_t *loc, kmp_i
   if (ompt_enabled.ompt_callback_mutex_acquire) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
         ompt_mutex_lock, omp_lock_hint_none, __ompt_get_mutex_impl_type(),
-        (ompt_wait_id_t)lck, codeptr);
+        (ompt_wait_id_t)(uintptr_t)lck, codeptr);
   }
 #endif
 
@@ -3083,7 +3090,7 @@ int __kmpc_test_lock(ident_t *loc, kmp_i
 #if OMPT_SUPPORT && OMPT_OPTIONAL
   if (rc && ompt_enabled.ompt_callback_mutex_acquired) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-        ompt_mutex_lock, (ompt_wait_id_t)lck, codeptr);
+        ompt_mutex_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
   }
 #endif
 
@@ -3109,8 +3116,8 @@ int __kmpc_test_nest_lock(ident_t *loc,
   if (ompt_enabled.ompt_callback_mutex_acquire) {
     ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
         ompt_mutex_nest_lock, omp_lock_hint_none,
-        __ompt_get_mutex_impl_type(user_lock), (ompt_wait_id_t)user_lock,
-        codeptr);
+        __ompt_get_mutex_impl_type(user_lock),
+        (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
   }
 #endif
   rc = KMP_D_LOCK_FUNC(user_lock, test)((kmp_dyna_lock_t *)user_lock, gtid);
@@ -3127,13 +3134,14 @@ int __kmpc_test_nest_lock(ident_t *loc,
       if (ompt_enabled.ompt_callback_mutex_acquired) {
         // lock_first
         ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-            ompt_mutex_nest_lock, (ompt_wait_id_t)user_lock, codeptr);
+            ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)user_lock,
+            codeptr);
       }
     } else {
       if (ompt_enabled.ompt_callback_nest_lock) {
         // lock_next
         ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
-            ompt_scope_begin, (ompt_wait_id_t)user_lock, codeptr);
+            ompt_scope_begin, (ompt_wait_id_t)(uintptr_t)user_lock, codeptr);
       }
     }
   }
@@ -3174,7 +3182,8 @@ int __kmpc_test_nest_lock(ident_t *loc,
         ompt_enabled.ompt_callback_mutex_acquire) {
       ompt_callbacks.ompt_callback(ompt_callback_mutex_acquire)(
           ompt_mutex_nest_lock, omp_lock_hint_none,
-          __ompt_get_mutex_impl_type(), (ompt_wait_id_t)lck, codeptr);
+          __ompt_get_mutex_impl_type(), (ompt_wait_id_t)(uintptr_t)lck,
+          codeptr);
     }
 #endif
 
@@ -3192,13 +3201,13 @@ int __kmpc_test_nest_lock(ident_t *loc,
       if (ompt_enabled.ompt_callback_mutex_acquired) {
         // lock_first
         ompt_callbacks.ompt_callback(ompt_callback_mutex_acquired)(
-            ompt_mutex_nest_lock, (ompt_wait_id_t)lck, codeptr);
+            ompt_mutex_nest_lock, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
       }
     } else {
       if (ompt_enabled.ompt_callback_nest_lock) {
         // lock_next
         ompt_callbacks.ompt_callback(ompt_callback_nest_lock)(
-            ompt_mutex_scope_begin, (ompt_wait_id_t)lck, codeptr);
+            ompt_mutex_scope_begin, (ompt_wait_id_t)(uintptr_t)lck, codeptr);
       }
     }
   }

Modified: openmp/trunk/runtime/src/ompt-specific.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/ompt-specific.cpp?rev=361158&r1=361157&r2=361158&view=diff
==============================================================================
--- openmp/trunk/runtime/src/ompt-specific.cpp (original)
+++ openmp/trunk/runtime/src/ompt-specific.cpp Mon May 20 07:21:42 2019
@@ -210,7 +210,7 @@ ompt_data_t *__ompt_get_thread_data_inte
 void __ompt_thread_assign_wait_id(void *variable) {
   kmp_info_t *ti = ompt_get_thread();
 
-  ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)variable;
+  ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)(uintptr_t)variable;
 }
 
 int __ompt_get_state_internal(ompt_wait_id_t *omp_wait_id) {

Modified: openmp/trunk/runtime/test/ompt/synchronization/lock.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/ompt/synchronization/lock.c?rev=361158&r1=361157&r2=361158&view=diff
==============================================================================
--- openmp/trunk/runtime/test/ompt/synchronization/lock.c (original)
+++ openmp/trunk/runtime/test/ompt/synchronization/lock.c Mon May 20 07:21:42 2019
@@ -10,7 +10,7 @@ int main()
     print_ids(0);
 
   omp_lock_t lock;
-  printf("%" PRIu64 ": &lock: %" PRIu64 "\n", ompt_get_thread_data()->value, (ompt_wait_id_t) &lock);
+  printf("%" PRIu64 ": &lock: %" PRIu64 "\n", ompt_get_thread_data()->value, (ompt_wait_id_t)(uintptr_t) &lock);
   omp_init_lock(&lock);
   print_fuzzy_address(1);
   omp_set_lock(&lock);

Modified: openmp/trunk/runtime/test/ompt/synchronization/nest_lock.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/test/ompt/synchronization/nest_lock.c?rev=361158&r1=361157&r2=361158&view=diff
==============================================================================
--- openmp/trunk/runtime/test/ompt/synchronization/nest_lock.c (original)
+++ openmp/trunk/runtime/test/ompt/synchronization/nest_lock.c Mon May 20 07:21:42 2019
@@ -10,7 +10,7 @@ int main()
     print_ids(0);
 
   omp_nest_lock_t nest_lock;
-  printf("%" PRIu64 ": &nest_lock: %lli\n", ompt_get_thread_data()->value, (ompt_wait_id_t) &nest_lock);
+  printf("%" PRIu64 ": &nest_lock: %lli\n", ompt_get_thread_data()->value, (ompt_wait_id_t)(uintptr_t) &nest_lock);
   omp_init_nest_lock(&nest_lock);
   print_fuzzy_address(1);
   omp_set_nest_lock(&nest_lock);




More information about the Openmp-commits mailing list