[Openmp-commits] [openmp] ad24cf2 - [OpenMP] change omp_atk_* and omp_atv_* enumerators to lowercase [NFC]
Kelvin Li via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jan 23 08:16:09 PST 2020
Author: Kelvin Li
Date: 2020-01-23T11:15:44-05:00
New Revision: ad24cf2a942068e5bcdda3fbe58c084715266cf3
URL: https://github.com/llvm/llvm-project/commit/ad24cf2a942068e5bcdda3fbe58c084715266cf3
DIFF: https://github.com/llvm/llvm-project/commit/ad24cf2a942068e5bcdda3fbe58c084715266cf3.diff
LOG: [OpenMP] change omp_atk_* and omp_atv_* enumerators to lowercase [NFC]
The OpenMP spec defines the OMP_ATK_* and OMP_ATV_* to be lowercase.
Differential Revision: https://reviews.llvm.org/D73248
Added:
Modified:
openmp/runtime/src/include/omp.h.var
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_alloc.cpp
openmp/runtime/test/api/omp_alloc_def_fb.c
openmp/runtime/test/api/omp_alloc_hbw.c
openmp/runtime/test/api/omp_alloc_null_fb.c
Removed:
################################################################################
diff --git a/openmp/runtime/src/include/omp.h.var b/openmp/runtime/src/include/omp.h.var
index 2246e7012bee..dd5b8cec7e6b 100644
--- a/openmp/runtime/src/include/omp.h.var
+++ b/openmp/runtime/src/include/omp.h.var
@@ -228,36 +228,36 @@
typedef uintptr_t omp_uintptr_t;
typedef enum {
- OMP_ATK_THREADMODEL = 1,
- OMP_ATK_ALIGNMENT = 2,
- OMP_ATK_ACCESS = 3,
- OMP_ATK_POOL_SIZE = 4,
- OMP_ATK_FALLBACK = 5,
- OMP_ATK_FB_DATA = 6,
- OMP_ATK_PINNED = 7,
- OMP_ATK_PARTITION = 8
+ omp_atk_threadmodel = 1,
+ omp_atk_alignment = 2,
+ omp_atk_access = 3,
+ omp_atk_pool_size = 4,
+ omp_atk_fallback = 5,
+ omp_atk_fb_data = 6,
+ omp_atk_pinned = 7,
+ omp_atk_partition = 8
} omp_alloctrait_key_t;
typedef enum {
- OMP_ATV_FALSE = 0,
- OMP_ATV_TRUE = 1,
- OMP_ATV_DEFAULT = 2,
- OMP_ATV_CONTENDED = 3,
- OMP_ATV_UNCONTENDED = 4,
- OMP_ATV_SEQUENTIAL = 5,
- OMP_ATV_PRIVATE = 6,
- OMP_ATV_ALL = 7,
- OMP_ATV_THREAD = 8,
- OMP_ATV_PTEAM = 9,
- OMP_ATV_CGROUP = 10,
- OMP_ATV_DEFAULT_MEM_FB = 11,
- OMP_ATV_NULL_FB = 12,
- OMP_ATV_ABORT_FB = 13,
- OMP_ATV_ALLOCATOR_FB = 14,
- OMP_ATV_ENVIRONMENT = 15,
- OMP_ATV_NEAREST = 16,
- OMP_ATV_BLOCKED = 17,
- OMP_ATV_INTERLEAVED = 18
+ omp_atv_false = 0,
+ omp_atv_true = 1,
+ omp_atv_default = 2,
+ omp_atv_contended = 3,
+ omp_atv_uncontended = 4,
+ omp_atv_sequential = 5,
+ omp_atv_private = 6,
+ omp_atv_all = 7,
+ omp_atv_thread = 8,
+ omp_atv_pteam = 9,
+ omp_atv_cgroup = 10,
+ omp_atv_default_mem_fb = 11,
+ omp_atv_null_fb = 12,
+ omp_atv_abort_fb = 13,
+ omp_atv_allocator_fb = 14,
+ omp_atv_environment = 15,
+ omp_atv_nearest = 16,
+ omp_atv_blocked = 17,
+ omp_atv_interleaved = 18
} omp_alloctrait_value_t;
typedef struct {
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 086ab3bb011e..bb1f3edd0331 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -872,36 +872,36 @@ extern int __kmp_hws_abs_flag; // absolute or per-item number requested
typedef uintptr_t omp_uintptr_t;
typedef enum {
- OMP_ATK_THREADMODEL = 1,
- OMP_ATK_ALIGNMENT = 2,
- OMP_ATK_ACCESS = 3,
- OMP_ATK_POOL_SIZE = 4,
- OMP_ATK_FALLBACK = 5,
- OMP_ATK_FB_DATA = 6,
- OMP_ATK_PINNED = 7,
- OMP_ATK_PARTITION = 8
+ omp_atk_threadmodel = 1,
+ omp_atk_alignment = 2,
+ omp_atk_access = 3,
+ omp_atk_pool_size = 4,
+ omp_atk_fallback = 5,
+ omp_atk_fb_data = 6,
+ omp_atk_pinned = 7,
+ omp_atk_partition = 8
} omp_alloctrait_key_t;
typedef enum {
- OMP_ATV_FALSE = 0,
- OMP_ATV_TRUE = 1,
- OMP_ATV_DEFAULT = 2,
- OMP_ATV_CONTENDED = 3,
- OMP_ATV_UNCONTENDED = 4,
- OMP_ATV_SEQUENTIAL = 5,
- OMP_ATV_PRIVATE = 6,
- OMP_ATV_ALL = 7,
- OMP_ATV_THREAD = 8,
- OMP_ATV_PTEAM = 9,
- OMP_ATV_CGROUP = 10,
- OMP_ATV_DEFAULT_MEM_FB = 11,
- OMP_ATV_NULL_FB = 12,
- OMP_ATV_ABORT_FB = 13,
- OMP_ATV_ALLOCATOR_FB = 14,
- OMP_ATV_ENVIRONMENT = 15,
- OMP_ATV_NEAREST = 16,
- OMP_ATV_BLOCKED = 17,
- OMP_ATV_INTERLEAVED = 18
+ omp_atv_false = 0,
+ omp_atv_true = 1,
+ omp_atv_default = 2,
+ omp_atv_contended = 3,
+ omp_atv_uncontended = 4,
+ omp_atv_sequential = 5,
+ omp_atv_private = 6,
+ omp_atv_all = 7,
+ omp_atv_thread = 8,
+ omp_atv_pteam = 9,
+ omp_atv_cgroup = 10,
+ omp_atv_default_mem_fb = 11,
+ omp_atv_null_fb = 12,
+ omp_atv_abort_fb = 13,
+ omp_atv_allocator_fb = 14,
+ omp_atv_environment = 15,
+ omp_atv_nearest = 16,
+ omp_atv_blocked = 17,
+ omp_atv_interleaved = 18
} omp_alloctrait_value_t;
typedef void *omp_memspace_handle_t;
diff --git a/openmp/runtime/src/kmp_alloc.cpp b/openmp/runtime/src/kmp_alloc.cpp
index 16893d0ffca5..5138cd5a5cc4 100644
--- a/openmp/runtime/src/kmp_alloc.cpp
+++ b/openmp/runtime/src/kmp_alloc.cpp
@@ -1348,27 +1348,27 @@ omp_allocator_handle_t __kmpc_init_allocator(int gtid, omp_memspace_handle_t ms,
al->memspace = ms; // not used currently
for (i = 0; i < ntraits; ++i) {
switch (traits[i].key) {
- case OMP_ATK_THREADMODEL:
- case OMP_ATK_ACCESS:
- case OMP_ATK_PINNED:
+ case omp_atk_threadmodel:
+ case omp_atk_access:
+ case omp_atk_pinned:
break;
- case OMP_ATK_ALIGNMENT:
+ case omp_atk_alignment:
al->alignment = traits[i].value;
KMP_ASSERT(IS_POWER_OF_TWO(al->alignment));
break;
- case OMP_ATK_POOL_SIZE:
+ case omp_atk_pool_size:
al->pool_size = traits[i].value;
break;
- case OMP_ATK_FALLBACK:
+ case omp_atk_fallback:
al->fb = (omp_alloctrait_value_t)traits[i].value;
KMP_DEBUG_ASSERT(
- al->fb == OMP_ATV_DEFAULT_MEM_FB || al->fb == OMP_ATV_NULL_FB ||
- al->fb == OMP_ATV_ABORT_FB || al->fb == OMP_ATV_ALLOCATOR_FB);
+ al->fb == omp_atv_default_mem_fb || al->fb == omp_atv_null_fb ||
+ al->fb == omp_atv_abort_fb || al->fb == omp_atv_allocator_fb);
break;
- case OMP_ATK_FB_DATA:
+ case omp_atk_fb_data:
al->fb_data = RCAST(kmp_allocator_t *, traits[i].value);
break;
- case OMP_ATK_PARTITION:
+ case omp_atk_partition:
al->memkind = RCAST(void **, traits[i].value);
break;
default:
@@ -1377,17 +1377,17 @@ omp_allocator_handle_t __kmpc_init_allocator(int gtid, omp_memspace_handle_t ms,
}
if (al->fb == 0) {
// set default allocator
- al->fb = OMP_ATV_DEFAULT_MEM_FB;
+ al->fb = omp_atv_default_mem_fb;
al->fb_data = (kmp_allocator_t *)omp_default_mem_alloc;
- } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ } else if (al->fb == omp_atv_allocator_fb) {
KMP_ASSERT(al->fb_data != NULL);
- } else if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ } else if (al->fb == omp_atv_default_mem_fb) {
al->fb_data = (kmp_allocator_t *)omp_default_mem_alloc;
}
if (__kmp_memkind_available) {
// Let's use memkind library if available
if (ms == omp_high_bw_mem_space) {
- if (al->memkind == (void *)OMP_ATV_INTERLEAVED && mk_hbw_interleave) {
+ if (al->memkind == (void *)omp_atv_interleaved && mk_hbw_interleave) {
al->memkind = mk_hbw_interleave;
} else if (mk_hbw_preferred) {
// AC: do not try to use MEMKIND_HBW for now, because memkind library
@@ -1402,7 +1402,7 @@ omp_allocator_handle_t __kmpc_init_allocator(int gtid, omp_memspace_handle_t ms,
return omp_null_allocator;
}
} else {
- if (al->memkind == (void *)OMP_ATV_INTERLEAVED && mk_interleave) {
+ if (al->memkind == (void *)omp_atv_interleaved && mk_interleave) {
al->memkind = mk_interleave;
} else {
al->memkind = mk_default;
@@ -1477,12 +1477,12 @@ void *__kmpc_alloc(int gtid, size_t size, omp_allocator_handle_t allocator) {
if (used + desc.size_a > al->pool_size) {
// not enough space, need to go fallback path
KMP_TEST_THEN_ADD64((kmp_int64 *)&al->pool_used, -desc.size_a);
- if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ if (al->fb == omp_atv_default_mem_fb) {
al = (kmp_allocator_t *)omp_default_mem_alloc;
ptr = kmp_mk_alloc(*mk_default, desc.size_a);
- } else if (al->fb == OMP_ATV_ABORT_FB) {
+ } else if (al->fb == omp_atv_abort_fb) {
KMP_ASSERT(0); // abort fallback requested
- } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ } else if (al->fb == omp_atv_allocator_fb) {
KMP_ASSERT(al != al->fb_data);
al = al->fb_data;
return __kmpc_alloc(gtid, size, (omp_allocator_handle_t)al);
@@ -1491,12 +1491,12 @@ void *__kmpc_alloc(int gtid, size_t size, omp_allocator_handle_t allocator) {
// pool has enough space
ptr = kmp_mk_alloc(*al->memkind, desc.size_a);
if (ptr == NULL) {
- if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ if (al->fb == omp_atv_default_mem_fb) {
al = (kmp_allocator_t *)omp_default_mem_alloc;
ptr = kmp_mk_alloc(*mk_default, desc.size_a);
- } else if (al->fb == OMP_ATV_ABORT_FB) {
+ } else if (al->fb == omp_atv_abort_fb) {
KMP_ASSERT(0); // abort fallback requested
- } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ } else if (al->fb == omp_atv_allocator_fb) {
KMP_ASSERT(al != al->fb_data);
al = al->fb_data;
return __kmpc_alloc(gtid, size, (omp_allocator_handle_t)al);
@@ -1507,12 +1507,12 @@ void *__kmpc_alloc(int gtid, size_t size, omp_allocator_handle_t allocator) {
// custom allocator, pool size not requested
ptr = kmp_mk_alloc(*al->memkind, desc.size_a);
if (ptr == NULL) {
- if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ if (al->fb == omp_atv_default_mem_fb) {
al = (kmp_allocator_t *)omp_default_mem_alloc;
ptr = kmp_mk_alloc(*mk_default, desc.size_a);
- } else if (al->fb == OMP_ATV_ABORT_FB) {
+ } else if (al->fb == omp_atv_abort_fb) {
KMP_ASSERT(0); // abort fallback requested
- } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ } else if (al->fb == omp_atv_allocator_fb) {
KMP_ASSERT(al != al->fb_data);
al = al->fb_data;
return __kmpc_alloc(gtid, size, (omp_allocator_handle_t)al);
@@ -1533,12 +1533,12 @@ void *__kmpc_alloc(int gtid, size_t size, omp_allocator_handle_t allocator) {
if (used + desc.size_a > al->pool_size) {
// not enough space, need to go fallback path
KMP_TEST_THEN_ADD64((kmp_int64 *)&al->pool_used, -desc.size_a);
- if (al->fb == OMP_ATV_DEFAULT_MEM_FB) {
+ if (al->fb == omp_atv_default_mem_fb) {
al = (kmp_allocator_t *)omp_default_mem_alloc;
ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
- } else if (al->fb == OMP_ATV_ABORT_FB) {
+ } else if (al->fb == omp_atv_abort_fb) {
KMP_ASSERT(0); // abort fallback requested
- } else if (al->fb == OMP_ATV_ALLOCATOR_FB) {
+ } else if (al->fb == omp_atv_allocator_fb) {
KMP_ASSERT(al != al->fb_data);
al = al->fb_data;
return __kmpc_alloc(gtid, size, (omp_allocator_handle_t)al);
@@ -1546,14 +1546,14 @@ void *__kmpc_alloc(int gtid, size_t size, omp_allocator_handle_t allocator) {
} else {
// pool has enough space
ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
- if (ptr == NULL && al->fb == OMP_ATV_ABORT_FB) {
+ if (ptr == NULL && al->fb == omp_atv_abort_fb) {
KMP_ASSERT(0); // abort fallback requested
} // no sense to look for another fallback because of same internal alloc
}
} else {
// custom allocator, pool size not requested
ptr = __kmp_thread_malloc(__kmp_thread_from_gtid(gtid), desc.size_a);
- if (ptr == NULL && al->fb == OMP_ATV_ABORT_FB) {
+ if (ptr == NULL && al->fb == omp_atv_abort_fb) {
KMP_ASSERT(0); // abort fallback requested
} // no sense to look for another fallback because of same internal alloc
}
diff --git a/openmp/runtime/test/api/omp_alloc_def_fb.c b/openmp/runtime/test/api/omp_alloc_def_fb.c
index 3795f0990f62..cf1578366828 100644
--- a/openmp/runtime/test/api/omp_alloc_def_fb.c
+++ b/openmp/runtime/test/api/omp_alloc_def_fb.c
@@ -7,10 +7,10 @@ int main() {
omp_alloctrait_t at[2];
omp_allocator_handle_t a;
void *p[2];
- at[0].key = OMP_ATK_POOL_SIZE;
+ at[0].key = omp_atk_pool_size;
at[0].value = 2 * 1024 * 1024;
- at[1].key = OMP_ATK_FALLBACK;
- at[1].value = OMP_ATV_DEFAULT_MEM_FB;
+ at[1].key = omp_atk_fallback;
+ at[1].value = omp_atv_default_mem_fb;
a = omp_init_allocator(omp_large_cap_mem_space, 2, at);
printf("allocator large created: %p\n", a);
#pragma omp parallel num_threads(2)
diff --git a/openmp/runtime/test/api/omp_alloc_hbw.c b/openmp/runtime/test/api/omp_alloc_hbw.c
index e9445489670f..d28a9b51f387 100644
--- a/openmp/runtime/test/api/omp_alloc_hbw.c
+++ b/openmp/runtime/test/api/omp_alloc_hbw.c
@@ -7,10 +7,10 @@ int main() {
omp_alloctrait_t at[2];
omp_allocator_handle_t a;
void *p[2];
- at[0].key = OMP_ATK_POOL_SIZE;
+ at[0].key = omp_atk_pool_size;
at[0].value = 2 * 1024 * 1024;
- at[1].key = OMP_ATK_FALLBACK;
- at[1].value = OMP_ATV_NULL_FB;
+ at[1].key = omp_atk_fallback;
+ at[1].value = omp_atv_null_fb;
a = omp_init_allocator(omp_high_bw_mem_space, 2, at);
printf("allocator hbw created: %p\n", a);
#pragma omp parallel num_threads(2)
diff --git a/openmp/runtime/test/api/omp_alloc_null_fb.c b/openmp/runtime/test/api/omp_alloc_null_fb.c
index 9528c46047a2..c75e5c510e6a 100644
--- a/openmp/runtime/test/api/omp_alloc_null_fb.c
+++ b/openmp/runtime/test/api/omp_alloc_null_fb.c
@@ -7,10 +7,10 @@ int main() {
omp_alloctrait_t at[2];
omp_allocator_handle_t a;
void *p[2];
- at[0].key = OMP_ATK_POOL_SIZE;
+ at[0].key = omp_atk_pool_size;
at[0].value = 2 * 1024 * 1024;
- at[1].key = OMP_ATK_FALLBACK;
- at[1].value = OMP_ATV_NULL_FB;
+ at[1].key = omp_atk_fallback;
+ at[1].value = omp_atv_null_fb;
a = omp_init_allocator(omp_large_cap_mem_space, 2, at);
printf("allocator large created: %p\n", a);
#pragma omp parallel num_threads(2)
More information about the Openmp-commits
mailing list