diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2015-09-21 17:24:46 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2015-09-21 17:24:46 +0000 |
commit | 441f33769eeae58532bb5e7f79c2d755ea984272 (patch) | |
tree | d1f9691d2b7243a7aac699e81138075d22145fac /openmp | |
parent | 7d8e7bd7b5aa6d0b4b4c469e0581d407c6205134 (diff) | |
download | bcm5719-llvm-441f33769eeae58532bb5e7f79c2d755ea984272.tar.gz bcm5719-llvm-441f33769eeae58532bb5e7f79c2d755ea984272.zip |
Fix the OpenMP 3.0 build
This change adds guards to the code in places where they are missing to enable
the OpenMP 3.0 build.
Patch by Diego Caballero and Johnny Peyton
Mailing List: http://lists.llvm.org/pipermail/openmp-dev/2015-September/000935.html
llvm-svn: 248178
Diffstat (limited to 'openmp')
-rw-r--r-- | openmp/runtime/src/kmp_barrier.cpp | 4 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_debugger.c | 6 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_dispatch.cpp | 2 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_omp.h | 6 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_runtime.c | 2 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_sched.cpp | 4 | ||||
-rw-r--r-- | openmp/runtime/src/kmp_settings.c | 7 |
7 files changed, 25 insertions, 6 deletions
diff --git a/openmp/runtime/src/kmp_barrier.cpp b/openmp/runtime/src/kmp_barrier.cpp index c2f26fde797..505daec8795 100644 --- a/openmp/runtime/src/kmp_barrier.cpp +++ b/openmp/runtime/src/kmp_barrier.cpp @@ -735,9 +735,11 @@ __kmp_hierarchical_barrier_gather(enum barrier_type bt, kmp_info_t *this_thr, register kmp_uint64 new_state; int level = team->t.t_level; +#if OMP_40_ENABLED if (other_threads[0]->th.th_teams_microtask) // are we inside the teams construct? if (this_thr->th.th_teams_size.nteams > 1) ++level; // level was not increased in teams construct for team_of_masters +#endif if (level == 1) thr_bar->use_oncore_barrier = 1; else thr_bar->use_oncore_barrier = 0; // Do not use oncore barrier when nested @@ -908,12 +910,14 @@ __kmp_hierarchical_barrier_release(enum barrier_type bt, kmp_info_t *this_thr, i } int level = team->t.t_level; +#if OMP_40_ENABLED if (team->t.t_threads[0]->th.th_teams_microtask ) { // are we inside the teams construct? if (team->t.t_pkfn != (microtask_t)__kmp_teams_master && this_thr->th.th_teams_level == level) ++level; // level was not increased in teams construct for team_of_workers if( this_thr->th.th_teams_size.nteams > 1 ) ++level; // level was not increased in teams construct for team_of_masters } +#endif if (level == 1) thr_bar->use_oncore_barrier = 1; else thr_bar->use_oncore_barrier = 0; // Do not use oncore barrier when nested nproc = this_thr->th.th_team_nproc; diff --git a/openmp/runtime/src/kmp_debugger.c b/openmp/runtime/src/kmp_debugger.c index d46c8a9a978..b3c1acb49ba 100644 --- a/openmp/runtime/src/kmp_debugger.c +++ b/openmp/runtime/src/kmp_debugger.c @@ -110,11 +110,13 @@ __kmp_omp_debug_struct_info = { offset_and_size_of( kmp_base_info_t, th_bar ), offset_and_size_of( kmp_bstate_t, b_worker_arrived ), +#if OMP_40_ENABLED // teams information offset_and_size_of( kmp_base_info_t, th_teams_microtask), offset_and_size_of( kmp_base_info_t, th_teams_level), offset_and_size_of( kmp_teams_size_t, nteams ), offset_and_size_of( kmp_teams_size_t, nth ), +#endif // kmp_desc structure (for info field above) sizeof( kmp_desc_base_t ), @@ -140,7 +142,9 @@ __kmp_omp_debug_struct_info = { offset_and_size_of( kmp_base_team_t, t_pkfn ), offset_and_size_of( kmp_base_team_t, t_task_team ), offset_and_size_of( kmp_base_team_t, t_implicit_task_taskdata ), +#if OMP_40_ENABLED offset_and_size_of( kmp_base_team_t, t_cancel_request ), +#endif offset_and_size_of( kmp_base_team_t, t_bar ), offset_and_size_of( kmp_balign_team_t, b_master_arrived ), offset_and_size_of( kmp_balign_team_t, b_team_arrived ), @@ -200,6 +204,7 @@ __kmp_omp_debug_struct_info = { offset_and_size_of( kmp_taskdata_t, td_taskwait_counter ), offset_and_size_of( kmp_taskdata_t, td_taskwait_thread ), +#if OMP_40_ENABLED offset_and_size_of( kmp_taskdata_t, td_taskgroup ), offset_and_size_of( kmp_taskgroup_t, count ), offset_and_size_of( kmp_taskgroup_t, cancel_request ), @@ -211,6 +216,7 @@ __kmp_omp_debug_struct_info = { offset_and_size_of( kmp_base_depnode_t, task ), offset_and_size_of( kmp_base_depnode_t, npredecessors ), offset_and_size_of( kmp_base_depnode_t, nrefs ), +#endif offset_and_size_of( kmp_task_t, routine ), // thread_data_t. diff --git a/openmp/runtime/src/kmp_dispatch.cpp b/openmp/runtime/src/kmp_dispatch.cpp index ba87a5407cb..c0bd71b12d4 100644 --- a/openmp/runtime/src/kmp_dispatch.cpp +++ b/openmp/runtime/src/kmp_dispatch.cpp @@ -2224,9 +2224,9 @@ __kmp_dist_get_bounds( } } th = __kmp_threads[gtid]; - KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct team = th->th.th_team; #if OMP_40_ENABLED + KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct nteams = th->th.th_teams_size.nteams; #endif team_id = team->t.t_master_tid; diff --git a/openmp/runtime/src/kmp_omp.h b/openmp/runtime/src/kmp_omp.h index 5a9419ff35c..fc4de0f2360 100644 --- a/openmp/runtime/src/kmp_omp.h +++ b/openmp/runtime/src/kmp_omp.h @@ -109,11 +109,13 @@ typedef struct { offset_and_size_t th_bar; offset_and_size_t th_b_worker_arrived; // the worker increases it by 1 when it arrives to the barrier +#if OMP_40_ENABLED /* teams information */ offset_and_size_t th_teams_microtask;// entry address for teams construct offset_and_size_t th_teams_level; // initial level of teams construct offset_and_size_t th_teams_nteams; // number of teams in a league offset_and_size_t th_teams_nth; // number of threads in each team of the league +#endif /* kmp_desc structure (for info field above) */ kmp_int32 ds_sizeof_struct; @@ -133,7 +135,9 @@ typedef struct { offset_and_size_t t_pkfn; offset_and_size_t t_task_team; // task team structure offset_and_size_t t_implicit_task; // taskdata for the thread's implicit task +#if OMP_40_ENABLED offset_and_size_t t_cancel_request; +#endif offset_and_size_t t_bar; offset_and_size_t t_b_master_arrived; // increased by 1 when master arrives to a barrier offset_and_size_t t_b_team_arrived; // increased by one when all the threads arrived @@ -194,6 +198,7 @@ typedef struct { offset_and_size_t td_taskwait_counter; offset_and_size_t td_taskwait_thread; // gtid + 1 of thread encountered taskwait +#if OMP_40_ENABLED /* Taskgroup */ offset_and_size_t td_taskgroup; // pointer to the current taskgroup offset_and_size_t td_task_count; // number of allocated and not yet complete tasks @@ -207,6 +212,7 @@ typedef struct { offset_and_size_t dn_task; offset_and_size_t dn_npredecessors; offset_and_size_t dn_nrefs; +#endif offset_and_size_t dn_routine; /* kmp_thread_data_t */ diff --git a/openmp/runtime/src/kmp_runtime.c b/openmp/runtime/src/kmp_runtime.c index 10caaafd392..22fc3a17993 100644 --- a/openmp/runtime/src/kmp_runtime.c +++ b/openmp/runtime/src/kmp_runtime.c @@ -2362,9 +2362,11 @@ __kmp_join_call(ident_t *loc, int gtid // But there is barrier for external team (league). __kmp_internal_join( loc, gtid, team ); } +#if OMP_40_ENABLED else { master_th->th.th_task_state = 0; // AC: no tasking in teams (out of any parallel) } +#endif /* OMP_40_ENABLED */ KMP_MB(); diff --git a/openmp/runtime/src/kmp_sched.cpp b/openmp/runtime/src/kmp_sched.cpp index 4eec41b9d44..5fb5e4779e5 100644 --- a/openmp/runtime/src/kmp_sched.cpp +++ b/openmp/runtime/src/kmp_sched.cpp @@ -424,10 +424,10 @@ __kmp_dist_for_static_init( } tid = __kmp_tid_from_gtid( gtid ); th = __kmp_threads[gtid]; - KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct nth = th->th.th_team_nproc; team = th->th.th_team; #if OMP_40_ENABLED + KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct nteams = th->th.th_teams_size.nteams; #endif team_id = team->t.t_master_tid; @@ -662,9 +662,9 @@ __kmp_team_static_init( } } th = __kmp_threads[gtid]; - KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct team = th->th.th_team; #if OMP_40_ENABLED + KMP_DEBUG_ASSERT(th->th.th_teams_microtask); // we are in the teams construct nteams = th->th.th_teams_size.nteams; #endif team_id = team->t.t_master_tid; diff --git a/openmp/runtime/src/kmp_settings.c b/openmp/runtime/src/kmp_settings.c index 7356bf8abe5..ae8ac567e0b 100644 --- a/openmp/runtime/src/kmp_settings.c +++ b/openmp/runtime/src/kmp_settings.c @@ -2926,11 +2926,12 @@ __kmp_stg_parse_proc_bind( char const * name, char const * value, void * data ) // OMP_PROC_BIND => granularity=core,scatter elsewhere // __kmp_affinity_type = affinity_scatter; - if( __kmp_mic_type != non_mic ) { +# if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) + if( __kmp_mic_type != non_mic ) __kmp_affinity_gran = affinity_gran_fine; - } else { + else +# endif __kmp_affinity_gran = affinity_gran_core; - } } else { __kmp_affinity_type = affinity_none; |