[Openmp-commits] [openmp] 46262ca - [OpenMP] Remove uses of ATOMIC_VAR_INIT
Fangrui Song via Openmp-commits
openmp-commits at lists.llvm.org
Fri Feb 24 14:48:00 PST 2023
Author: Fangrui Song
Date: 2023-02-24T14:47:55-08:00
New Revision: 46262cab24312c71717ca70a9d0700481aa59152
URL: https://github.com/llvm/llvm-project/commit/46262cab24312c71717ca70a9d0700481aa59152
DIFF: https://github.com/llvm/llvm-project/commit/46262cab24312c71717ca70a9d0700481aa59152.diff
LOG: [OpenMP] Remove uses of ATOMIC_VAR_INIT
ATOMIC_VAR_INIT has a trivial definition
`#define ATOMIC_VAR_INIT(value) (value)`,
is deprecated in C17/C++20, and will be removed in newer standards in
newer GCC/Clang (e.g. https://reviews.llvm.org/D144196).
Added:
Modified:
openmp/runtime/src/kmp_global.cpp
openmp/runtime/src/kmp_lock.h
openmp/runtime/src/kmp_taskdeps.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/kmp_global.cpp b/openmp/runtime/src/kmp_global.cpp
index 7b94164f6dbb0..b1eca773db1eb 100644
--- a/openmp/runtime/src/kmp_global.cpp
+++ b/openmp/runtime/src/kmp_global.cpp
@@ -63,8 +63,8 @@ int __kmp_init_counter = 0;
int __kmp_root_counter = 0;
int __kmp_version = 0;
-std::atomic<kmp_int32> __kmp_team_counter = ATOMIC_VAR_INIT(0);
-std::atomic<kmp_int32> __kmp_task_counter = ATOMIC_VAR_INIT(0);
+std::atomic<kmp_int32> __kmp_team_counter = 0;
+std::atomic<kmp_int32> __kmp_task_counter = 0;
size_t __kmp_stksize = KMP_DEFAULT_STKSIZE;
#if KMP_USE_MONITOR
@@ -386,7 +386,7 @@ int __kmp_debug_buf_atomic =
char *__kmp_debug_buffer = NULL; /* Debug buffer itself */
std::atomic<int> __kmp_debug_count =
- ATOMIC_VAR_INIT(0); /* number of lines printed in buffer so far */
+ 0; /* number of lines printed in buffer so far */
int __kmp_debug_buf_warn_chars =
0; /* Keep track of char increase recommended in warnings */
/* end rotating debug buffer */
@@ -454,7 +454,7 @@ volatile kmp_info_t *__kmp_thread_pool = NULL;
volatile kmp_team_t *__kmp_team_pool = NULL;
KMP_ALIGN_CACHE
-std::atomic<int> __kmp_thread_pool_active_nth = ATOMIC_VAR_INIT(0);
+std::atomic<int> __kmp_thread_pool_active_nth = 0;
/* -------------------------------------------------
* GLOBAL/ROOT STATE */
diff --git a/openmp/runtime/src/kmp_lock.h b/openmp/runtime/src/kmp_lock.h
index a19f4ca323b86..f21179b4eb68a 100644
--- a/openmp/runtime/src/kmp_lock.h
+++ b/openmp/runtime/src/kmp_lock.h
@@ -138,7 +138,7 @@ typedef union kmp_tas_lock kmp_tas_lock_t;
// kmp_tas_lock_t xlock = KMP_TAS_LOCK_INITIALIZER( xlock );
#define KMP_TAS_LOCK_INITIALIZER(lock) \
{ \
- { ATOMIC_VAR_INIT(KMP_LOCK_FREE(tas)), 0 } \
+ { KMP_LOCK_FREE(tas), 0 } \
}
extern int __kmp_acquire_tas_lock(kmp_tas_lock_t *lck, kmp_int32 gtid);
@@ -276,11 +276,7 @@ typedef union kmp_ticket_lock kmp_ticket_lock_t;
// Note the macro argument. It is important to make var properly initialized.
#define KMP_TICKET_LOCK_INITIALIZER(lock) \
{ \
- { \
- ATOMIC_VAR_INIT(true) \
- , &(lock), NULL, ATOMIC_VAR_INIT(0U), ATOMIC_VAR_INIT(0U), \
- ATOMIC_VAR_INIT(0), ATOMIC_VAR_INIT(-1) \
- } \
+ { true, &(lock), NULL, 0U, 0U, 0, -1 } \
}
extern int __kmp_acquire_ticket_lock(kmp_ticket_lock_t *lck, kmp_int32 gtid);
diff --git a/openmp/runtime/src/kmp_taskdeps.cpp b/openmp/runtime/src/kmp_taskdeps.cpp
index 5fcb84d0befa7..ee4f96f7e5e26 100644
--- a/openmp/runtime/src/kmp_taskdeps.cpp
+++ b/openmp/runtime/src/kmp_taskdeps.cpp
@@ -30,7 +30,7 @@
// TODO: Any ITT support needed?
#ifdef KMP_SUPPORT_GRAPH_OUTPUT
-static std::atomic<kmp_int32> kmp_node_id_seed = ATOMIC_VAR_INIT(0);
+static std::atomic<kmp_int32> kmp_node_id_seed = 0;
#endif
static void __kmp_init_node(kmp_depnode_t *node) {
More information about the Openmp-commits
mailing list