diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2019-01-15 19:39:32 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2019-01-15 19:39:32 +0000 |
commit | 9355d0dc13c01c80e74f0dd14230356f58a99e55 (patch) | |
tree | c0a3471d5458884c0211a48ac5ed74bcbdd28a95 /openmp/runtime/src/kmp_affinity.cpp | |
parent | 45b511fb05f9073d72c1511bebd772f8e9dd6f35 (diff) | |
download | bcm5719-llvm-9355d0dc13c01c80e74f0dd14230356f58a99e55.tar.gz bcm5719-llvm-9355d0dc13c01c80e74f0dd14230356f58a99e55.zip |
[OpenMP] Fix for nested proc_bind affinity bug
Using proc_bind clause on a nested #pragma omp parallel region
with KMP_AFFINITY set causes an assertion error. This assertion occurs because
the place-partition-var is not properly initialized in the nested master threads.
Trying to get an intuitive result with KMP_AFFINITY + proc_bind is difficult
because of how the KMP_AFFINITY gtid-to-place mapping occurs. This
patch creates an initial place list no matter what affinity mechanism is used.
For KMP_AFFINITY, the place-partition-var is initialized to all the places.
Differential Revision: https://reviews.llvm.org/D55795
llvm-svn: 351227
Diffstat (limited to 'openmp/runtime/src/kmp_affinity.cpp')
-rw-r--r-- | openmp/runtime/src/kmp_affinity.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp index 775862ebb7e..f14cdf68c08 100644 --- a/openmp/runtime/src/kmp_affinity.cpp +++ b/openmp/runtime/src/kmp_affinity.cpp @@ -4505,6 +4505,7 @@ static void __kmp_aux_affinity_initialize(void) { KMP_WARNING(AffNoValidProcID); } __kmp_affinity_type = affinity_none; + __kmp_create_affinity_none_places(); return; } break; @@ -4557,11 +4558,9 @@ static void __kmp_aux_affinity_initialize(void) { KMP_WARNING(AffBalancedNotAvail, "KMP_AFFINITY"); } __kmp_affinity_type = affinity_none; + __kmp_create_affinity_none_places(); return; - } else if (__kmp_affinity_uniform_topology()) { - break; - } else { // Non-uniform topology - + } else if (!__kmp_affinity_uniform_topology()) { // Save the depth for further usage __kmp_aff_depth = depth; @@ -4602,8 +4601,9 @@ static void __kmp_aux_affinity_initialize(void) { procarr[core * maxprocpercore + inlastcore] = proc; } - - break; + } + if (__kmp_affinity_compact >= depth) { + __kmp_affinity_compact = depth - 1; } sortAddresses: @@ -4781,6 +4781,11 @@ void __kmp_affinity_set_init_mask(int gtid, int isa_root) { th->th.th_new_place = i; th->th.th_first_place = 0; th->th.th_last_place = __kmp_affinity_num_masks - 1; + } else if (KMP_AFFINITY_NON_PROC_BIND) { + // When using a Non-OMP_PROC_BIND affinity method, + // set all threads' place-partition-var to the entire place list + th->th.th_first_place = 0; + th->th.th_last_place = __kmp_affinity_num_masks - 1; } if (i == KMP_PLACE_ALL) { |