diff options
author | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2017-07-18 18:50:13 +0000 |
---|---|---|
committer | Jonathan Peyton <jonathan.l.peyton@intel.com> | 2017-07-18 18:50:13 +0000 |
commit | 93e17cfe6c2e8e20f99d45241804732a78737baf (patch) | |
tree | 674194c7c383f1f20131be6cfe0224849d67a03c /openmp/runtime/src/kmp_settings.cpp | |
parent | d01e956d38b60508cef4851a6668838261e9b700 (diff) | |
download | bcm5719-llvm-93e17cfe6c2e8e20f99d45241804732a78737baf.tar.gz bcm5719-llvm-93e17cfe6c2e8e20f99d45241804732a78737baf.zip |
Add recursive task scheduling strategy to taskloop implementation
Summary:
Taskloop implementation is extended by using recursive task scheduling.
Envirable KMP_TASKLOOP_MIN_TASKS added as a manual threshold for the user
to switch from recursive to linear tasks scheduling.
Details:
* The calculations for the loop parameters are moved from __kmp_taskloop_linear
upper level
* Initial calculation is done in the __kmpc_taskloop, further range splitting
is done in the __kmp_taskloop_recur.
* Added threshold to switch from recursive to linear tasks scheduling;
* One half of split range is scheduled as an internal task which just moves
sub-range parameters to the stealing thread that continues recursive
scheduling (if number of tasks still enough), the other half is processed
recursively;
* Internal task duplication routine fixed to assign parent task, that was not
needed when all tasks were scheduled by same thread, but is needed now.
Patch by Andrey Churbanov
Differential Revision: https://reviews.llvm.org/D35273
llvm-svn: 308338
Diffstat (limited to 'openmp/runtime/src/kmp_settings.cpp')
-rw-r--r-- | openmp/runtime/src/kmp_settings.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/openmp/runtime/src/kmp_settings.cpp b/openmp/runtime/src/kmp_settings.cpp index 2360ed86186..00d9ba51eb4 100644 --- a/openmp/runtime/src/kmp_settings.cpp +++ b/openmp/runtime/src/kmp_settings.cpp @@ -1167,6 +1167,20 @@ static void __kmp_stg_print_max_task_priority(kmp_str_buf_t *buffer, char const *name, void *data) { __kmp_stg_print_int(buffer, name, __kmp_max_task_priority); } // __kmp_stg_print_max_task_priority + +// 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) { + 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) { + __kmp_stg_print_int(buffer, name, __kmp_taskloop_min_tasks); +} // __kmp_stg_print_taskloop_min_tasks #endif // OMP_45_ENABLED // ----------------------------------------------------------------------------- @@ -4370,6 +4384,8 @@ static kmp_setting_t __kmp_stg_table[] = { #if OMP_45_ENABLED {"OMP_MAX_TASK_PRIORITY", __kmp_stg_parse_max_task_priority, __kmp_stg_print_max_task_priority, NULL, 0, 0}, + {"KMP_TASKLOOP_MIN_TASKS", __kmp_stg_parse_taskloop_min_tasks, + __kmp_stg_print_taskloop_min_tasks, NULL, 0, 0}, #endif {"OMP_THREAD_LIMIT", __kmp_stg_parse_all_threads, __kmp_stg_print_all_threads, NULL, 0, 0}, |