Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / runtime / src / ompt-internal.h
blob0d77413d549047a8e6933e88bf681d254bcbd2fa
1 /*
2 * ompt-internal.h - header of OMPT internal data structures
3 */
5 //===----------------------------------------------------------------------===//
6 //
7 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
8 // See https://llvm.org/LICENSE.txt for license information.
9 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
11 //===----------------------------------------------------------------------===//
13 #ifndef __OMPT_INTERNAL_H__
14 #define __OMPT_INTERNAL_H__
16 #include "ompt-event-specific.h"
17 #include "omp-tools.h"
19 #define OMPT_VERSION 1
21 #define _OMP_EXTERN extern "C"
23 #define OMPT_INVOKER(x) \
24 ((x == fork_context_gnu) ? ompt_parallel_invoker_program \
25 : ompt_parallel_invoker_runtime)
27 #define ompt_callback(e) e##_callback
29 typedef struct ompt_callbacks_internal_s {
30 #define ompt_event_macro(event, callback, eventid) \
31 callback ompt_callback(event);
33 FOREACH_OMPT_EVENT(ompt_event_macro)
35 #undef ompt_event_macro
36 } ompt_callbacks_internal_t;
38 typedef struct ompt_callbacks_active_s {
39 unsigned int enabled : 1;
40 #define ompt_event_macro(event, callback, eventid) unsigned int event : 1;
42 FOREACH_OMPT_EVENT(ompt_event_macro)
44 #undef ompt_event_macro
45 } ompt_callbacks_active_t;
47 #define TASK_TYPE_DETAILS_FORMAT(info) \
48 ((info->td_flags.task_serial || info->td_flags.tasking_ser) \
49 ? ompt_task_undeferred \
50 : 0x0) | \
51 ((!(info->td_flags.tiedness)) ? ompt_task_untied : 0x0) | \
52 (info->td_flags.final ? ompt_task_final : 0x0) | \
53 (info->td_flags.merged_if0 ? ompt_task_mergeable : 0x0)
55 typedef struct {
56 ompt_frame_t frame;
57 ompt_data_t task_data;
58 struct kmp_taskdata *scheduling_parent;
59 int thread_num;
60 ompt_dispatch_chunk_t dispatch_chunk;
61 } ompt_task_info_t;
63 typedef struct {
64 ompt_data_t parallel_data;
65 void *master_return_address;
66 } ompt_team_info_t;
68 typedef struct ompt_lw_taskteam_s {
69 ompt_team_info_t ompt_team_info;
70 ompt_task_info_t ompt_task_info;
71 int heap;
72 struct ompt_lw_taskteam_s *parent;
73 } ompt_lw_taskteam_t;
75 typedef struct {
76 ompt_data_t thread_data;
77 ompt_data_t task_data; /* stored here from implicit barrier-begin until
78 implicit-task-end */
79 ompt_data_t target_task_data; /* required by target support */
80 void *return_address; /* stored here on entry of runtime */
81 ompt_state_t state;
82 ompt_wait_id_t wait_id;
83 int ompt_task_yielded;
84 int parallel_flags; // information for the last parallel region invoked
85 void *idle_frame;
86 } ompt_thread_info_t;
88 extern ompt_callbacks_internal_t ompt_callbacks;
90 #if OMPT_SUPPORT && OMPT_OPTIONAL
91 #if USE_FAST_MEMORY
92 #define KMP_OMPT_DEPS_ALLOC __kmp_fast_allocate
93 #define KMP_OMPT_DEPS_FREE __kmp_fast_free
94 #else
95 #define KMP_OMPT_DEPS_ALLOC __kmp_thread_malloc
96 #define KMP_OMPT_DEPS_FREE __kmp_thread_free
97 #endif
98 #endif /* OMPT_SUPPORT && OMPT_OPTIONAL */
100 #ifdef __cplusplus
101 extern "C" {
102 #endif
104 void ompt_pre_init(void);
105 void ompt_post_init(void);
106 void ompt_fini(void);
108 #define OMPT_GET_RETURN_ADDRESS(level) __builtin_return_address(level)
109 #define OMPT_GET_FRAME_ADDRESS(level) __builtin_frame_address(level)
111 int __kmp_control_tool(uint64_t command, uint64_t modifier, void *arg);
113 extern ompt_callbacks_active_t ompt_enabled;
115 #if KMP_OS_WINDOWS
116 #define UNLIKELY(x) (x)
117 #define OMPT_NOINLINE __declspec(noinline)
118 #else
119 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
120 #define OMPT_NOINLINE __attribute__((noinline))
121 #endif
123 #ifdef __cplusplus
125 #endif
127 #endif