The attached patch adds support for ompt_event_task_dependences and ompt_event_task_dependence_pair events from the OMPT specification [1]. These events only apply to OpenMP 4.0 and 4.1 (aka 4.5) because task dependencies were introduced in 4.0. With respect to the changes: ompt_event_task_dependences According to the specification, this event is raised after the task has been created, thefore this event needs to be raised after ompt_event_task_begin (in __kmp_task_start). However, the dependencies are known at __kmpc_omp_task_with_deps which occurs before __kmp_task_start. My modifications extend the ompt_task_info_t struct in order to store the dependencies of the task when _kmpc_omp_task_with_deps occurs and then they are emitted in __kmp_task_start just after raising the ompt_event_task_begin. The deps field is allocated and valid until the event is raised and it is freed and set to null afterwards. ompt_event_task_dependence_pair The processing of the dependences (i.e. checking whenever a dependence is already satisfied) is done within __kmp_process_deps. That function checks every dependence and calls the __kmp_track_dependence routine which gives some support for graphical output. I used that routine to emit the dependence pair but I also needed to know the sink_task. Despite the fact that the code within KMP_SUPPORT_GRAPH_OUTPUT refers to task_sink it may be null because sink->dn.task (there's a comment regarding this) and in fact it does not point to a proper pointer value because the value is set in node->dn.task = task; after the __kmp_process_deps calls in __kmp_check_deps. I have extended the __kmp_process_deps and __kmp_track_dependence parameter list to receive the sink_task. [1] https://github.com/OpenMPToolsInterface/OMPT-Technical-Report/blob/target/ompt-tr.pdf Patch by Harald Servat Differential Revision: http://reviews.llvm.org/D14746 llvm-svn: 259038
94 lines
2.1 KiB
C
94 lines
2.1 KiB
C
#ifndef __OMPT_INTERNAL_H__
|
|
#define __OMPT_INTERNAL_H__
|
|
|
|
#include "ompt.h"
|
|
#include "ompt-event-specific.h"
|
|
|
|
#define OMPT_VERSION 1
|
|
|
|
#define _OMP_EXTERN extern "C"
|
|
|
|
#define OMPT_INVOKER(x) \
|
|
((x == fork_context_gnu) ? ompt_invoker_program : ompt_invoker_runtime)
|
|
|
|
|
|
#define ompt_callback(e) e ## _callback
|
|
|
|
|
|
typedef struct ompt_callbacks_s {
|
|
#define ompt_event_macro(event, callback, eventid) callback ompt_callback(event);
|
|
|
|
FOREACH_OMPT_EVENT(ompt_event_macro)
|
|
|
|
#undef ompt_event_macro
|
|
} ompt_callbacks_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
ompt_frame_t frame;
|
|
void* function;
|
|
ompt_task_id_t task_id;
|
|
#if OMP_40_ENABLED
|
|
int ndeps;
|
|
ompt_task_dependence_t *deps;
|
|
#endif /* OMP_40_ENABLED */
|
|
} ompt_task_info_t;
|
|
|
|
|
|
typedef struct {
|
|
ompt_parallel_id_t parallel_id;
|
|
void *microtask;
|
|
} ompt_team_info_t;
|
|
|
|
|
|
typedef struct ompt_lw_taskteam_s {
|
|
ompt_team_info_t ompt_team_info;
|
|
ompt_task_info_t ompt_task_info;
|
|
struct ompt_lw_taskteam_s *parent;
|
|
} ompt_lw_taskteam_t;
|
|
|
|
|
|
typedef struct ompt_parallel_info_s {
|
|
ompt_task_id_t parent_task_id; /* id of parent task */
|
|
ompt_parallel_id_t parallel_id; /* id of parallel region */
|
|
ompt_frame_t *parent_task_frame; /* frame data of parent task */
|
|
void *parallel_function; /* pointer to outlined function */
|
|
} ompt_parallel_info_t;
|
|
|
|
|
|
typedef struct {
|
|
ompt_state_t state;
|
|
ompt_wait_id_t wait_id;
|
|
void *idle_frame;
|
|
} ompt_thread_info_t;
|
|
|
|
|
|
extern ompt_callbacks_t ompt_callbacks;
|
|
|
|
#if OMP_40_ENABLED && OMPT_SUPPORT && OMPT_TRACE
|
|
#if USE_FAST_MEMORY
|
|
# define KMP_OMPT_DEPS_ALLOC __kmp_fast_allocate
|
|
# define KMP_OMPT_DEPS_FREE __kmp_fast_free
|
|
# else
|
|
# define KMP_OMPT_DEPS_ALLOC __kmp_thread_malloc
|
|
# define KMP_OMPT_DEPS_FREE __kmp_thread_free
|
|
# endif
|
|
#endif /* OMP_40_ENABLED && OMPT_SUPPORT && OMPT_TRACE */
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
void ompt_pre_init(void);
|
|
void ompt_post_init(void);
|
|
void ompt_fini(void);
|
|
|
|
extern int ompt_enabled;
|
|
|
|
#ifdef __cplusplus
|
|
};
|
|
#endif
|
|
|
|
#endif
|