diff options
| author | Joachim Protze <protze@itc.rwth-aachen.de> | 2017-11-01 10:08:30 +0000 |
|---|---|---|
| committer | Joachim Protze <protze@itc.rwth-aachen.de> | 2017-11-01 10:08:30 +0000 |
| commit | 82e94a593433f36734e2d34898d353a2ecb65b8b (patch) | |
| tree | d7ac69e35db74384a401862feb3eb31e78ca94ca /openmp/runtime/src/ompt-specific.h | |
| parent | b93c06331ea77953e80bbd5ffb30167eade466f0 (diff) | |
| download | bcm5719-llvm-82e94a593433f36734e2d34898d353a2ecb65b8b.tar.gz bcm5719-llvm-82e94a593433f36734e2d34898d353a2ecb65b8b.zip | |
Update implementation of OMPT to the specification OpenMP 5.0 Preview 1 (TR4).
The code is tested to work with latest clang, GNU and Intel compiler. The implementation
is optimized for low overhead when no tool is attached shifting the cost to execution with
tool attached.
This patch does not implement OMPT for libomptarget.
Patch by Simon Convent and Joachim Protze
Differential Revision: https://reviews.llvm.org/D38185
llvm-svn: 317085
Diffstat (limited to 'openmp/runtime/src/ompt-specific.h')
| -rw-r--r-- | openmp/runtime/src/ompt-specific.h | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/openmp/runtime/src/ompt-specific.h b/openmp/runtime/src/ompt-specific.h index b4f09a41982..07223daef8e 100644 --- a/openmp/runtime/src/ompt-specific.h +++ b/openmp/runtime/src/ompt-specific.h @@ -13,42 +13,63 @@ typedef kmp_info_t ompt_thread_t; * forward declarations ****************************************************************************/ -void __ompt_team_assign_id(kmp_team_t *team, ompt_parallel_id_t ompt_pid); +void __ompt_team_assign_id(kmp_team_t *team, ompt_data_t ompt_pid); void __ompt_thread_assign_wait_id(void *variable); void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr, - int gtid, void *microtask, - ompt_parallel_id_t ompt_pid); + int gtid, ompt_data_t *ompt_pid, void *codeptr); -void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr); +void __ompt_lw_taskteam_link(ompt_lw_taskteam_t *lwt, ompt_thread_t *thr, + int on_heap); -ompt_lw_taskteam_t *__ompt_lw_taskteam_unlink(ompt_thread_t *thr); - -ompt_parallel_id_t __ompt_parallel_id_new(int gtid); -ompt_task_id_t __ompt_task_id_new(int gtid); +void __ompt_lw_taskteam_unlink(ompt_thread_t *thr); ompt_team_info_t *__ompt_get_teaminfo(int depth, int *size); -ompt_task_info_t *__ompt_get_taskinfo(int depth); - -void __ompt_thread_begin(ompt_thread_type_t thread_type, int gtid); +ompt_task_info_t *__ompt_get_task_info_object(int depth); -void __ompt_thread_end(ompt_thread_type_t thread_type, int gtid); +int __ompt_get_parallel_info_internal(int ancestor_level, + ompt_data_t **parallel_data, + int *team_size); -int __ompt_get_parallel_team_size_internal(int ancestor_level); +int __ompt_get_task_info_internal(int ancestor_level, int *type, + ompt_data_t **task_data, + ompt_frame_t **task_frame, + ompt_data_t **parallel_data, int *thread_num); -ompt_task_id_t __ompt_get_task_id_internal(int depth); +ompt_data_t *__ompt_get_thread_data_internal(); -ompt_frame_t *__ompt_get_task_frame_internal(int depth); +static uint64_t __ompt_get_get_unique_id_internal(); /***************************************************************************** * macros ****************************************************************************/ +#define OMPT_CUR_TASK_INFO(thr) (&(thr->th.th_current_task->ompt_task_info)) +#define OMPT_CUR_TASK_DATA(thr) \ + (&(thr->th.th_current_task->ompt_task_info.task_data)) +#define OMPT_CUR_TEAM_INFO(thr) (&(thr->th.th_team->t.ompt_team_info)) +#define OMPT_CUR_TEAM_DATA(thr) \ + (&(thr->th.th_team->t.ompt_team_info.parallel_data)) + #define OMPT_HAVE_WEAK_ATTRIBUTE KMP_HAVE_WEAK_ATTRIBUTE #define OMPT_HAVE_PSAPI KMP_HAVE_PSAPI #define OMPT_STR_MATCH(haystack, needle) __kmp_str_match(haystack, 0, needle) +inline void *__ompt_load_return_address(int gtid) { + kmp_info_t *thr = __kmp_threads[gtid]; + void *return_address = thr->th.ompt_thread_info.return_address; + thr->th.ompt_thread_info.return_address = NULL; + return return_address; +} + +#define OMPT_STORE_RETURN_ADDRESS(gtid) \ + if (ompt_enabled.enabled && gtid >= 0 && __kmp_threads[gtid] && \ + !__kmp_threads[gtid]->th.ompt_thread_info.return_address) \ + __kmp_threads[gtid]->th.ompt_thread_info.return_address = \ + __builtin_return_address(0) +#define OMPT_LOAD_RETURN_ADDRESS(gtid) __ompt_load_return_address(gtid) + //****************************************************************************** // inline functions //****************************************************************************** @@ -62,7 +83,7 @@ inline ompt_thread_t *ompt_get_thread() { return ompt_get_thread_gtid(gtid); } -inline void ompt_set_thread_state(ompt_thread_t *thread, ompt_state_t state) { +inline void ompt_set_thread_state(ompt_thread_t *thread, omp_state_t state) { thread->th.ompt_thread_info.state = state; } |

