aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2018-09-07 18:45:13 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2018-09-07 18:45:13 +0000
commit7eaaab9be97d002f5d81007ed8e8ee494e3f0706 (patch)
tree22af30d150ed427665264f5336b1be78182da4ee
parentd590b1f16e7b0c5b2f8ca9d07d6dffd6b72f0b8e (diff)
[OpenMP] Synchronization hint constants added to headers
ident flags reserved for atomic hints. This patch adds omp_sync_hint_t to omp.h and omp_sync_hint_kind to omp_lib.h. For better maintainability the list of macros for ident flags was replaced with a enum. The new KMP_IDENT_ATOMIC_HINT_MASK was added to the enum to support possible future atomic hints. Also fix omp_lib.h.var to be under 72 chars again after 5.0 OpenMP Memory commit Patch by Olga Malysheva Differential Revision: https://reviews.llvm.org/D51233 git-svn-id: https://llvm.org/svn/llvm-project/openmp/trunk@341693 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--runtime/src/include/50/omp.h.var24
-rw-r--r--runtime/src/include/50/omp_lib.f90.var24
-rw-r--r--runtime/src/include/50/omp_lib.h.var49
-rw-r--r--runtime/src/kmp.h58
4 files changed, 99 insertions, 56 deletions
diff --git a/runtime/src/include/50/omp.h.var b/runtime/src/include/50/omp.h.var
index 3add8bf..7a626bd 100644
--- a/runtime/src/include/50/omp.h.var
+++ b/runtime/src/include/50/omp.h.var
@@ -92,17 +92,25 @@
extern void __KAI_KMPC_CONVENTION omp_destroy_nest_lock (omp_nest_lock_t *);
extern int __KAI_KMPC_CONVENTION omp_test_nest_lock (omp_nest_lock_t *);
- /* lock hint type for dynamic user lock */
- typedef enum omp_lock_hint_t {
- omp_lock_hint_none = 0,
- omp_lock_hint_uncontended = 1,
- omp_lock_hint_contended = (1<<1 ),
- omp_lock_hint_nonspeculative = (1<<2 ),
- omp_lock_hint_speculative = (1<<3 ),
+ /* OpenMP 5.0 Synchronization hints*/
+ typedef enum omp_sync_hint_t {
+ omp_sync_hint_none = 0,
+ omp_lock_hint_none = omp_sync_hint_none,
+ omp_sync_hint_uncontended = 1,
+ omp_lock_hint_uncontended = omp_sync_hint_uncontended,
+ omp_sync_hint_contended = (1<<1),
+ omp_lock_hint_contended = omp_sync_hint_contended,
+ omp_sync_hint_nonspeculative = (1<<2),
+ omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative,
+ omp_sync_hint_speculative = (1<<3),
+ omp_lock_hint_speculative = omp_sync_hint_speculative,
kmp_lock_hint_hle = (1<<16),
kmp_lock_hint_rtm = (1<<17),
kmp_lock_hint_adaptive = (1<<18)
- } omp_lock_hint_t;
+ } omp_sync_hint_t;
+
+ /* lock hint type for dynamic user lock */
+ typedef omp_sync_hint_t omp_lock_hint_t;
/* hinted lock initializers */
extern void __KAI_KMPC_CONVENTION omp_init_lock_with_hint(omp_lock_t *, omp_lock_hint_t);
diff --git a/runtime/src/include/50/omp_lib.f90.var b/runtime/src/include/50/omp_lib.f90.var
index e9e452c..624774d 100644
--- a/runtime/src/include/50/omp_lib.f90.var
+++ b/runtime/src/include/50/omp_lib.f90.var
@@ -27,7 +27,8 @@
integer, parameter :: kmp_size_t_kind = c_size_t
integer, parameter :: kmp_affinity_mask_kind = c_intptr_t
integer, parameter :: kmp_cancel_kind = omp_integer_kind
- integer, parameter :: omp_lock_hint_kind = omp_integer_kind
+ integer, parameter :: omp_sync_hint_kind = omp_integer_kind
+ integer, parameter :: omp_lock_hint_kind = omp_sync_hint_kind
integer, parameter :: omp_control_tool_kind = omp_integer_kind
integer, parameter :: omp_control_tool_result_kind = omp_integer_kind
integer, parameter :: omp_allocator_kind = c_intptr_t
@@ -62,14 +63,19 @@
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_sections = 3
integer (kind=kmp_cancel_kind), parameter :: kmp_cancel_taskgroup = 4
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_none = 0
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = 1
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = 2
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = 4
- integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = 8
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
- integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
+ integer (kind=omp_sync_hint_kind), parameter :: omp_sync_hint_none = 0
+ integer (kind=omp_sync_hint_kind), parameter :: omp_sync_hint_uncontended = 1
+ integer (kind=omp_sync_hint_kind), parameter :: omp_sync_hint_contended = 2
+ integer (kind=omp_sync_hint_kind), parameter :: omp_sync_hint_nonspeculative = 4
+ integer (kind=omp_sync_hint_kind), parameter :: omp_sync_hint_speculative = 8
+ integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_none = omp_sync_hint_none
+ integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_uncontended = omp_sync_hint_uncontended
+ integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_contended = omp_sync_hint_contended
+ integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_nonspeculative = omp_sync_hint_nonspeculative
+ integer (kind=omp_lock_hint_kind), parameter :: omp_lock_hint_speculative = omp_sync_hint_speculative
+ integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_hle = 65536
+ integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_rtm = 131072
+ integer (kind=omp_lock_hint_kind), parameter :: kmp_lock_hint_adaptive = 262144
integer (kind=omp_control_tool_kind), parameter :: omp_control_tool_start = 1
integer (kind=omp_control_tool_kind), parameter :: omp_control_tool_pause = 2
diff --git a/runtime/src/include/50/omp_lib.h.var b/runtime/src/include/50/omp_lib.h.var
index 7548098..b4158af 100644
--- a/runtime/src/include/50/omp_lib.h.var
+++ b/runtime/src/include/50/omp_lib.h.var
@@ -31,8 +31,10 @@
parameter(kmp_size_t_kind=int_ptr_kind())
integer kmp_affinity_mask_kind
parameter(kmp_affinity_mask_kind=int_ptr_kind())
+ integer omp_sync_hint_kind
+ parameter(omp_sync_hint_kind=omp_integer_kind)
integer omp_lock_hint_kind
- parameter(omp_lock_hint_kind=omp_integer_kind)
+ parameter(omp_lock_hint_kind=omp_sync_hint_kind)
integer omp_control_tool_kind
parameter(omp_control_tool_kind=omp_integer_kind)
integer omp_control_tool_result_kind
@@ -71,16 +73,26 @@
integer(kind=omp_proc_bind_kind)omp_proc_bind_spread
parameter(omp_proc_bind_spread=4)
+ integer(kind=omp_sync_hint_kind)omp_sync_hint_none
+ parameter(omp_sync_hint_none=0)
+ integer(kind=omp_sync_hint_kind)omp_sync_hint_uncontended
+ parameter(omp_sync_hint_uncontended=1)
+ integer(kind=omp_sync_hint_kind)omp_sync_hint_contended
+ parameter(omp_sync_hint_contended=2)
+ integer(kind=omp_sync_hint_kind)omp_sync_hint_nonspeculative
+ parameter(omp_sync_hint_nonspeculative=4)
+ integer(kind=omp_sync_hint_kind)omp_sync_hint_speculative
+ parameter(omp_sync_hint_speculative=8)
integer(kind=omp_lock_hint_kind)omp_lock_hint_none
- parameter(omp_lock_hint_none=0)
+ parameter(omp_lock_hint_none=omp_sync_hint_none)
integer(kind=omp_lock_hint_kind)omp_lock_hint_uncontended
- parameter(omp_lock_hint_uncontended=1)
+ parameter(omp_lock_hint_uncontended=omp_sync_hint_uncontended)
integer(kind=omp_lock_hint_kind)omp_lock_hint_contended
- parameter(omp_lock_hint_contended=2)
+ parameter(omp_lock_hint_contended=omp_sync_hint_contended)
integer(kind=omp_lock_hint_kind)omp_lock_hint_nonspeculative
parameter(omp_lock_hint_nonspeculative=4)
integer(kind=omp_lock_hint_kind)omp_lock_hint_speculative
- parameter(omp_lock_hint_speculative=8)
+ parameter(omp_lock_hint_speculative=omp_sync_hint_speculative)
integer(kind=omp_lock_hint_kind)kmp_lock_hint_hle
parameter(kmp_lock_hint_hle=65536)
integer(kind=omp_lock_hint_kind)kmp_lock_hint_rtm
@@ -106,15 +118,24 @@
integer(kind=omp_control_tool_result_kind)omp_control_tool_ignored
parameter(omp_control_tool_ignored=1)
- integer (kind=omp_allocator_kind), parameter :: omp_null_allocator = 0
- integer (kind=omp_allocator_kind), parameter :: omp_default_mem_alloc = 1
- integer (kind=omp_allocator_kind), parameter :: omp_large_cap_mem_alloc = 2
- integer (kind=omp_allocator_kind), parameter :: omp_const_mem_alloc = 3
- integer (kind=omp_allocator_kind), parameter :: omp_high_bw_mem_alloc = 4
- integer (kind=omp_allocator_kind), parameter :: omp_low_lat_mem_alloc = 5
- integer (kind=omp_allocator_kind), parameter :: omp_cgroup_mem_alloc = 6
- integer (kind=omp_allocator_kind), parameter :: omp_pteam_mem_alloc = 7
- integer (kind=omp_allocator_kind), parameter :: omp_thread_mem_alloc = 8
+ integer(kind=omp_allocator_kind)omp_null_allocator
+ parameter(omp_null_allocator=0)
+ integer(kind=omp_allocator_kind)omp_default_mem_alloc
+ parameter(omp_default_mem_alloc=1)
+ integer(kind=omp_allocator_kind)omp_large_cap_mem_alloc
+ parameter(omp_large_cap_mem_alloc=2)
+ integer(kind=omp_allocator_kind)omp_const_mem_alloc
+ parameter(omp_const_mem_alloc=3)
+ integer(kind=omp_allocator_kind)omp_high_bw_mem_alloc
+ parameter(omp_high_bw_mem_alloc=4)
+ integer(kind=omp_allocator_kind)omp_low_lat_mem_alloc
+ parameter(omp_low_lat_mem_alloc=5)
+ integer(kind=omp_allocator_kind)omp_cgroup_mem_alloc
+ parameter(omp_cgroup_mem_alloc=6)
+ integer(kind=omp_allocator_kind)omp_pteam_mem_alloc
+ parameter(omp_pteam_mem_alloc=7)
+ integer(kind=omp_allocator_kind)omp_thread_mem_alloc
+ parameter(omp_thread_mem_alloc=8)
interface
diff --git a/runtime/src/kmp.h b/runtime/src/kmp.h
index df9d3bc..796fb54 100644
--- a/runtime/src/kmp.h
+++ b/runtime/src/kmp.h
@@ -172,34 +172,42 @@ class kmp_stats_list;
@{
*/
-// FIXME DOXYGEN... need to group these flags somehow (Making them an anonymous
-// enum would do it...)
/*!
Values for bit flags used in the ident_t to describe the fields.
*/
-/*! Use trampoline for internal microtasks */
-#define KMP_IDENT_IMB 0x01
-/*! Use c-style ident structure */
-#define KMP_IDENT_KMPC 0x02
-/* 0x04 is no longer used */
-/*! Entry point generated by auto-parallelization */
-#define KMP_IDENT_AUTOPAR 0x08
-/*! Compiler generates atomic reduction option for kmpc_reduce* */
-#define KMP_IDENT_ATOMIC_REDUCE 0x10
-/*! To mark a 'barrier' directive in user code */
-#define KMP_IDENT_BARRIER_EXPL 0x20
-/*! To Mark implicit barriers. */
-#define KMP_IDENT_BARRIER_IMPL 0x0040
-#define KMP_IDENT_BARRIER_IMPL_MASK 0x01C0
-#define KMP_IDENT_BARRIER_IMPL_FOR 0x0040
-#define KMP_IDENT_BARRIER_IMPL_SECTIONS 0x00C0
-
-#define KMP_IDENT_BARRIER_IMPL_SINGLE 0x0140
-#define KMP_IDENT_BARRIER_IMPL_WORKSHARE 0x01C0
-
-#define KMP_IDENT_WORK_LOOP 0x200 // static loop
-#define KMP_IDENT_WORK_SECTIONS 0x400 // sections
-#define KMP_IDENT_WORK_DISTRIBUTE 0x800 // distribute
+enum {
+ /*! Use trampoline for internal microtasks */
+ KMP_IDENT_IMB = 0x01,
+ /*! Use c-style ident structure */
+ KMP_IDENT_KMPC = 0x02,
+ /* 0x04 is no longer used */
+ /*! Entry point generated by auto-parallelization */
+ KMP_IDENT_AUTOPAR = 0x08,
+ /*! Compiler generates atomic reduction option for kmpc_reduce* */
+ KMP_IDENT_ATOMIC_REDUCE = 0x10,
+ /*! To mark a 'barrier' directive in user code */
+ KMP_IDENT_BARRIER_EXPL = 0x20,
+ /*! To Mark implicit barriers. */
+ KMP_IDENT_BARRIER_IMPL = 0x0040,
+ KMP_IDENT_BARRIER_IMPL_MASK = 0x01C0,
+ KMP_IDENT_BARRIER_IMPL_FOR = 0x0040,
+ KMP_IDENT_BARRIER_IMPL_SECTIONS = 0x00C0,
+
+ KMP_IDENT_BARRIER_IMPL_SINGLE = 0x0140,
+ KMP_IDENT_BARRIER_IMPL_WORKSHARE = 0x01C0,
+
+ /*! To mark a static loop in OMPT callbacks */
+ KMP_IDENT_WORK_LOOP = 0x200,
+ /*! To mark a sections directive in OMPT callbacks */
+ KMP_IDENT_WORK_SECTIONS = 0x400,
+ /*! To mark a distirbute construct in OMPT callbacks */
+ KMP_IDENT_WORK_DISTRIBUTE = 0x800,
+ /*! Atomic hint; bottom four bits as omp_sync_hint_t. Top four reserved and
+ not currently used. If one day we need more bits, then we can use
+ an invalid combination of hints to mean that another, larger field
+ should be used in a different flag. */
+ KMP_IDENT_ATOMIC_HINT_MASK = 0xFF0000,
+};
/*!
* The ident structure that describes a source location.