mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-17 21:07:52 +00:00
Cleanup: __kmp_env_* variables
Removed unused __kmp_env_* variables. Also clangified other people's code. Patch by Terry Wilmarth Differential Revision: https://reviews.llvm.org/D35808 llvm-svn: 309000
This commit is contained in:
parent
0d920c4418
commit
d74d890247
@ -2833,16 +2833,10 @@ extern int __kmp_stkpadding; /* Should we pad root thread(s) stack */
|
||||
|
||||
extern size_t
|
||||
__kmp_malloc_pool_incr; /* incremental size of pool for kmp_malloc() */
|
||||
extern int __kmp_env_chunk; /* was KMP_CHUNK specified? */
|
||||
extern int __kmp_env_stksize; /* was KMP_STACKSIZE specified? */
|
||||
extern int __kmp_env_omp_stksize; /* was OMP_STACKSIZE specified? */
|
||||
extern int __kmp_env_all_threads; /* was KMP_ALL_THREADS or KMP_MAX_THREADS
|
||||
specified? */
|
||||
extern int __kmp_env_omp_all_threads; /* was OMP_THREAD_LIMIT specified? */
|
||||
extern int __kmp_env_blocktime; /* was KMP_BLOCKTIME specified? */
|
||||
extern int __kmp_env_checks; /* was KMP_CHECKS specified? */
|
||||
extern int
|
||||
__kmp_env_consistency_check; /* was KMP_CONSISTENCY_CHECK specified? */
|
||||
extern int __kmp_env_consistency_check; // was KMP_CONSISTENCY_CHECK specified?
|
||||
extern int __kmp_generate_warnings; /* should we issue warnings? */
|
||||
extern int __kmp_reserve_warn; /* have we issued reserve_threads warning? */
|
||||
|
||||
|
@ -376,12 +376,7 @@ int __kmp_need_register_atfork =
|
||||
TRUE; /* At initialization, call pthread_atfork to install fork handler */
|
||||
int __kmp_need_register_atfork_specified = TRUE;
|
||||
|
||||
int __kmp_env_chunk = FALSE; /* KMP_CHUNK specified? */
|
||||
int __kmp_env_stksize = FALSE; /* KMP_STACKSIZE specified? */
|
||||
int __kmp_env_omp_stksize = FALSE; /* OMP_STACKSIZE specified? */
|
||||
int __kmp_env_all_threads =
|
||||
FALSE; /* KMP_ALL_THREADS or KMP_MAX_THREADS specified? */
|
||||
int __kmp_env_omp_all_threads = FALSE; /* OMP_THREAD_LIMIT specified? */
|
||||
int __kmp_env_blocktime = FALSE; /* KMP_BLOCKTIME specified? */
|
||||
int __kmp_env_checks = FALSE; /* KMP_CHECKS specified? */
|
||||
int __kmp_env_consistency_check = FALSE; /* KMP_CONSISTENCY_CHECK specified? */
|
||||
|
@ -641,6 +641,9 @@ static void __kmp_stg_print_blocktime(kmp_str_buf_t *buffer, char const *name,
|
||||
__kmp_stg_print_int(buffer, name, __kmp_dflt_blocktime);
|
||||
} // __kmp_stg_print_blocktime
|
||||
|
||||
// Used for OMP_WAIT_POLICY
|
||||
static char const *blocktime_str = NULL;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// KMP_DUPLICATE_LIB_OK
|
||||
|
||||
@ -678,8 +681,6 @@ static void __kmp_stg_print_inherit_fp_control(kmp_str_buf_t *buffer,
|
||||
// -----------------------------------------------------------------------------
|
||||
// KMP_LIBRARY, OMP_WAIT_POLICY
|
||||
|
||||
static char const *blocktime_str = NULL;
|
||||
|
||||
static void __kmp_stg_parse_wait_policy(char const *name, char const *value,
|
||||
void *data) {
|
||||
|
||||
@ -1171,14 +1172,14 @@ static void __kmp_stg_print_max_task_priority(kmp_str_buf_t *buffer,
|
||||
// KMP_TASKLOOP_MIN_TASKS
|
||||
// taskloop threashold to switch from recursive to linear tasks creation
|
||||
static void __kmp_stg_parse_taskloop_min_tasks(char const *name,
|
||||
char const *value, void *data) {
|
||||
char const *value, void *data) {
|
||||
int tmp;
|
||||
__kmp_stg_parse_int(name, value, 0, INT_MAX, &tmp);
|
||||
__kmp_taskloop_min_tasks = tmp;
|
||||
} // __kmp_stg_parse_taskloop_min_tasks
|
||||
|
||||
static void __kmp_stg_print_taskloop_min_tasks(kmp_str_buf_t *buffer,
|
||||
char const *name, void *data) {
|
||||
char const *name, void *data) {
|
||||
__kmp_stg_print_int(buffer, name, __kmp_taskloop_min_tasks);
|
||||
} // __kmp_stg_print_taskloop_min_tasks
|
||||
#endif // OMP_45_ENABLED
|
||||
@ -3381,8 +3382,6 @@ static void __kmp_stg_parse_omp_schedule(char const *name, char const *value,
|
||||
value = NULL; /* skip processing of comma */
|
||||
}
|
||||
if (value && comma) {
|
||||
__kmp_env_chunk = TRUE;
|
||||
|
||||
if (__kmp_sched == kmp_sch_static)
|
||||
__kmp_sched = kmp_sch_static_chunked;
|
||||
++comma;
|
||||
@ -3406,8 +3405,7 @@ static void __kmp_stg_parse_omp_schedule(char const *name, char const *value,
|
||||
__kmp_msg_null);
|
||||
KMP_INFORM(Using_int_Value, name, __kmp_chunk);
|
||||
}
|
||||
} else
|
||||
__kmp_env_chunk = FALSE;
|
||||
}
|
||||
} else
|
||||
KMP_WARNING(EmptyString, name);
|
||||
}
|
||||
@ -4925,7 +4923,7 @@ void __kmp_env_initialize(char const *string) {
|
||||
}
|
||||
}; // for i
|
||||
|
||||
// We need to know if blocktime was set when processing OMP_WAIT_POLICY
|
||||
// We need to know if blocktime was set when processing OMP_WAIT_POLICY
|
||||
blocktime_str = __kmp_env_blk_var(&block, "KMP_BLOCKTIME");
|
||||
|
||||
// Special case. If we parse environment, not a string, process KMP_WARNINGS
|
||||
|
@ -3308,8 +3308,9 @@ void __kmp_taskloop_linear(ident_t *loc, int gtid, kmp_task_t *task,
|
||||
KMP_DEBUG_ASSERT(num_tasks > extras);
|
||||
KMP_DEBUG_ASSERT(num_tasks > 0);
|
||||
KA_TRACE(20, ("__kmp_taskloop_linear: T#%d: %lld tasks, grainsize %lld, "
|
||||
"extras %lld, i=%lld,%lld(%d)%lld, dup %p\n", gtid, num_tasks,
|
||||
grainsize, extras, lower, upper, ub_glob, st, task_dup));
|
||||
"extras %lld, i=%lld,%lld(%d)%lld, dup %p\n",
|
||||
gtid, num_tasks, grainsize, extras, lower, upper, ub_glob, st,
|
||||
task_dup));
|
||||
|
||||
// Launch num_tasks tasks, assign grainsize iterations each task
|
||||
for (i = 0; i < num_tasks; ++i) {
|
||||
@ -3331,7 +3332,7 @@ void __kmp_taskloop_linear(ident_t *loc, int gtid, kmp_task_t *task,
|
||||
KMP_DEBUG_ASSERT((kmp_uint64)st > *ub - upper);
|
||||
if ((kmp_uint64)st > ub_glob - upper)
|
||||
lastpriv = 1;
|
||||
} else { // negative loop stride
|
||||
} else { // negative loop stride
|
||||
KMP_DEBUG_ASSERT(upper + st < *ub);
|
||||
if (upper - ub_glob < (kmp_uint64)(-st))
|
||||
lastpriv = 1;
|
||||
@ -3378,12 +3379,13 @@ void __kmp_taskloop_recur(ident_t *, int, kmp_task_t *, kmp_uint64 *,
|
||||
|
||||
// Execute part of the the taskloop submitted as a task.
|
||||
int __kmp_taskloop_task(int gtid, void *ptask) {
|
||||
__taskloop_params_t *p = (__taskloop_params_t*)((kmp_task_t*)ptask)->shareds;
|
||||
__taskloop_params_t *p =
|
||||
(__taskloop_params_t *)((kmp_task_t *)ptask)->shareds;
|
||||
kmp_task_t *task = p->task;
|
||||
kmp_uint64 *lb = p->lb;
|
||||
kmp_uint64 *ub = p->ub;
|
||||
void *task_dup = p->task_dup;
|
||||
// p_task_dup_t ptask_dup = (p_task_dup_t)task_dup;
|
||||
// p_task_dup_t ptask_dup = (p_task_dup_t)task_dup;
|
||||
kmp_int64 st = p->st;
|
||||
kmp_uint64 ub_glob = p->ub_glob;
|
||||
kmp_uint64 num_tasks = p->num_tasks;
|
||||
@ -3395,10 +3397,11 @@ int __kmp_taskloop_task(int gtid, void *ptask) {
|
||||
kmp_taskdata_t *taskdata = KMP_TASK_TO_TASKDATA(task);
|
||||
KMP_DEBUG_ASSERT(task != NULL);
|
||||
KA_TRACE(20, ("__kmp_taskloop_task: T#%d, task %p: %lld tasks, grainsize"
|
||||
" %lld, extras %lld, i=%lld,%lld(%d), dup %p\n", gtid, taskdata,
|
||||
num_tasks, grainsize, extras, *lb, *ub, st, task_dup));
|
||||
" %lld, extras %lld, i=%lld,%lld(%d), dup %p\n",
|
||||
gtid, taskdata, num_tasks, grainsize, extras, *lb, *ub, st,
|
||||
task_dup));
|
||||
#endif
|
||||
KMP_DEBUG_ASSERT(num_tasks*2+1 > num_t_min);
|
||||
KMP_DEBUG_ASSERT(num_tasks * 2 + 1 > num_t_min);
|
||||
if (num_tasks > num_t_min)
|
||||
__kmp_taskloop_recur(NULL, gtid, task, lb, ub, st, ub_glob, num_tasks,
|
||||
grainsize, extras, tc, num_t_min, task_dup);
|
||||
@ -3436,14 +3439,15 @@ void __kmp_taskloop_recur(ident_t *loc, int gtid, kmp_task_t *task,
|
||||
KMP_DEBUG_ASSERT(task != NULL);
|
||||
KMP_DEBUG_ASSERT(num_tasks > num_t_min);
|
||||
KA_TRACE(20, ("__kmp_taskloop_recur: T#%d, task %p: %lld tasks, grainsize"
|
||||
" %lld, extras %lld, i=%lld,%lld(%d), dup %p\n", gtid, taskdata,
|
||||
num_tasks, grainsize, extras, *lb, *ub, st, task_dup));
|
||||
" %lld, extras %lld, i=%lld,%lld(%d), dup %p\n",
|
||||
gtid, taskdata, num_tasks, grainsize, extras, *lb, *ub, st,
|
||||
task_dup));
|
||||
#endif
|
||||
p_task_dup_t ptask_dup = (p_task_dup_t)task_dup;
|
||||
kmp_uint64 lower = *lb;
|
||||
kmp_uint64 upper = *ub;
|
||||
kmp_info_t *thread = __kmp_threads[gtid];
|
||||
// kmp_taskdata_t *current_task = thread->th.th_current_task;
|
||||
// kmp_taskdata_t *current_task = thread->th.th_current_task;
|
||||
kmp_task_t *next_task;
|
||||
kmp_int32 lastpriv = 0;
|
||||
size_t lower_offset =
|
||||
@ -3485,9 +3489,9 @@ void __kmp_taskloop_recur(ident_t *loc, int gtid, kmp_task_t *task,
|
||||
|
||||
// create auxiliary task for 2nd half of the loop
|
||||
kmp_task_t *new_task =
|
||||
__kmpc_omp_task_alloc(loc, gtid, 1, 3 * sizeof(void*),
|
||||
__kmpc_omp_task_alloc(loc, gtid, 1, 3 * sizeof(void *),
|
||||
sizeof(__taskloop_params_t), &__kmp_taskloop_task);
|
||||
__taskloop_params_t * p = (__taskloop_params_t *)new_task->shareds;
|
||||
__taskloop_params_t *p = (__taskloop_params_t *)new_task->shareds;
|
||||
p->task = next_task;
|
||||
p->lb = (kmp_uint64 *)((char *)next_task + lower_offset);
|
||||
p->ub = (kmp_uint64 *)((char *)next_task + upper_offset);
|
||||
@ -3503,8 +3507,8 @@ void __kmp_taskloop_recur(ident_t *loc, int gtid, kmp_task_t *task,
|
||||
|
||||
// execute the 1st half of current subrange
|
||||
if (n_tsk0 > num_t_min)
|
||||
__kmp_taskloop_recur(loc, gtid, task, lb, ub, st, ub_glob, n_tsk0,
|
||||
gr_size0, ext0, tc0, num_t_min, task_dup);
|
||||
__kmp_taskloop_recur(loc, gtid, task, lb, ub, st, ub_glob, n_tsk0, gr_size0,
|
||||
ext0, tc0, num_t_min, task_dup);
|
||||
else
|
||||
__kmp_taskloop_linear(loc, gtid, task, lb, ub, st, ub_glob, n_tsk0,
|
||||
gr_size0, ext0, tc0, task_dup);
|
||||
@ -3535,8 +3539,8 @@ void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
|
||||
KMP_DEBUG_ASSERT(task != NULL);
|
||||
|
||||
KA_TRACE(20, ("__kmpc_taskloop: T#%d, task %p, lb %lld, ub %lld, st %lld, "
|
||||
"grain %llu(%d), dup %p\n", gtid, taskdata, *lb, *ub, st,
|
||||
grainsize, sched, task_dup));
|
||||
"grain %llu(%d), dup %p\n",
|
||||
gtid, taskdata, *lb, *ub, st, grainsize, sched, task_dup));
|
||||
|
||||
if (nogroup == 0)
|
||||
__kmpc_taskgroup(loc, gtid);
|
||||
@ -3570,8 +3574,8 @@ void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
|
||||
}
|
||||
if (num_tasks_min == 0)
|
||||
// TODO: can we choose better default heuristic?
|
||||
num_tasks_min = KMP_MIN(thread->th.th_team_nproc * 10,
|
||||
INITIAL_TASK_DEQUE_SIZE);
|
||||
num_tasks_min =
|
||||
KMP_MIN(thread->th.th_team_nproc * 10, INITIAL_TASK_DEQUE_SIZE);
|
||||
|
||||
// compute num_tasks/grainsize based on the input provided
|
||||
switch (sched) {
|
||||
@ -3618,14 +3622,14 @@ void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
|
||||
grainsize, extras, tc, task_dup);
|
||||
} else if (num_tasks > num_tasks_min) {
|
||||
KA_TRACE(20, ("__kmpc_taskloop: T#%d, go recursive: tc %llu, #tasks %llu"
|
||||
"(%lld), grain %llu, extras %llu\n", gtid, tc, num_tasks,
|
||||
num_tasks_min, grainsize, extras));
|
||||
"(%lld), grain %llu, extras %llu\n",
|
||||
gtid, tc, num_tasks, num_tasks_min, grainsize, extras));
|
||||
__kmp_taskloop_recur(loc, gtid, task, lb, ub, st, ub_glob, num_tasks,
|
||||
grainsize, extras, tc, num_tasks_min, task_dup);
|
||||
} else {
|
||||
KA_TRACE(20, ("__kmpc_taskloop: T#%d, go linear: tc %llu, #tasks %llu"
|
||||
"(%lld), grain %llu, extras %llu\n", gtid, tc, num_tasks,
|
||||
num_tasks_min, grainsize, extras));
|
||||
"(%lld), grain %llu, extras %llu\n",
|
||||
gtid, tc, num_tasks, num_tasks_min, grainsize, extras));
|
||||
__kmp_taskloop_linear(loc, gtid, task, lb, ub, st, ub_glob, num_tasks,
|
||||
grainsize, extras, tc, task_dup);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user