source: Daodan/MSYS2/mingw32/lib/gcc/i686-w64-mingw32/11.2.0/include/acc_prof.h@ 1181

Last change on this file since 1181 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 7.3 KB
Line 
1/* OpenACC Profiling Interface
2
3 Copyright (C) 2019-2021 Free Software Foundation, Inc.
4
5 Contributed by Mentor, a Siemens Business.
6
7 This file is part of the GNU Offloading and Multi Processing Library
8 (libgomp).
9
10 Libgomp is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3, or (at your option)
13 any later version.
14
15 Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 more details.
19
20 Under Section 7 of GPL version 3, you are granted additional
21 permissions described in the GCC Runtime Library Exception, version
22 3.1, as published by the Free Software Foundation.
23
24 You should have received a copy of the GNU General Public License and
25 a copy of the GCC Runtime Library Exception along with this program;
26 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
27 <http://www.gnu.org/licenses/>. */
28
29#ifndef _ACC_PROF_H
30#define _ACC_PROF_H 1
31
32
33/* The OpenACC specification doesn't say so explicitly, but as its Profiling
34 Interface explicitly makes use of, for example, <openacc.h>'s
35 'acc_device_t', we supposedly are to '#include' that file here. */
36
37#include <openacc.h>
38
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44
45/* Events. */
46
47typedef enum acc_event_t
48{
49 acc_ev_none = 0,
50 acc_ev_device_init_start,
51 acc_ev_device_init_end,
52 acc_ev_device_shutdown_start,
53 acc_ev_device_shutdown_end,
54 acc_ev_runtime_shutdown,
55 acc_ev_create,
56 acc_ev_delete,
57 acc_ev_alloc,
58 acc_ev_free,
59 acc_ev_enter_data_start,
60 acc_ev_enter_data_end,
61 acc_ev_exit_data_start,
62 acc_ev_exit_data_end,
63 acc_ev_update_start,
64 acc_ev_update_end,
65 acc_ev_compute_construct_start,
66 acc_ev_compute_construct_end,
67 acc_ev_enqueue_launch_start,
68 acc_ev_enqueue_launch_end,
69 acc_ev_enqueue_upload_start,
70 acc_ev_enqueue_upload_end,
71 acc_ev_enqueue_download_start,
72 acc_ev_enqueue_download_end,
73 acc_ev_wait_start,
74 acc_ev_wait_end,
75 acc_ev_last
76} acc_event_t;
77
78
79/* Callbacks Signature. */
80
81/* "The datatype 'ssize_t' means a signed 32-bit integer for a 32-bit binary
82 and a 64-bit integer for a 64-bit binary". */
83typedef signed long int _acc_prof_ssize_t;
84/* "The datatype 'size_t' means an unsigned 32-bit integer for a 32-bit binary
85 and a 64-bit integer for a 64-bit binary". */
86typedef unsigned long int _acc_prof_size_t;
87/* "The datatype 'int' means a 32-bit integer for both 32-bit and 64-bit
88 binaries". */
89typedef int _acc_prof_int_t;
90
91/* Internal helpers: a struct's 'valid_bytes' may be less than its 'sizeof'. */
92#define _ACC_PROF_VALID_BYTES_STRUCT(_struct, _lastfield, _valid_bytes_lastfield) \
93 offsetof (_struct, _lastfield) + (_valid_bytes_lastfield)
94#if 0 /* Untested. */
95#define _ACC_PROF_VALID_BYTES_TYPE_N(_type, _n, _valid_bytes_type) \
96 ((_n - 1) * sizeof (_type) + (_valid_bytes_type))
97#endif
98#define _ACC_PROF_VALID_BYTES_BASICTYPE(_basictype) \
99 (sizeof (_basictype))
100
101typedef struct acc_prof_info
102{
103 acc_event_t event_type;
104 _acc_prof_int_t valid_bytes;
105 _acc_prof_int_t version;
106 acc_device_t device_type;
107 _acc_prof_int_t device_number;
108 _acc_prof_int_t thread_id;
109 _acc_prof_ssize_t async;
110 _acc_prof_ssize_t async_queue;
111 const char *src_file;
112 const char *func_name;
113 _acc_prof_int_t line_no, end_line_no;
114 _acc_prof_int_t func_line_no, func_end_line_no;
115#define _ACC_PROF_INFO_VALID_BYTES \
116 _ACC_PROF_VALID_BYTES_STRUCT (acc_prof_info, func_end_line_no, \
117 _ACC_PROF_VALID_BYTES_BASICTYPE (_acc_prof_int_t))
118} acc_prof_info;
119
120/* We implement the OpenACC 2.6 Profiling Interface. */
121
122#define _ACC_PROF_INFO_VERSION 201711
123
124typedef enum acc_construct_t
125{
126 acc_construct_parallel = 0,
127 acc_construct_kernels,
128 acc_construct_loop,
129 acc_construct_data,
130 acc_construct_enter_data,
131 acc_construct_exit_data,
132 acc_construct_host_data,
133 acc_construct_atomic,
134 acc_construct_declare,
135 acc_construct_init,
136 acc_construct_shutdown,
137 acc_construct_set,
138 acc_construct_update,
139 acc_construct_routine,
140 acc_construct_wait,
141 acc_construct_runtime_api,
142 acc_construct_serial
143} acc_construct_t;
144
145typedef struct acc_data_event_info
146{
147 acc_event_t event_type;
148 _acc_prof_int_t valid_bytes;
149 acc_construct_t parent_construct;
150 _acc_prof_int_t implicit;
151 void *tool_info;
152 const char *var_name;
153 _acc_prof_size_t bytes;
154 const void *host_ptr;
155 const void *device_ptr;
156#define _ACC_DATA_EVENT_INFO_VALID_BYTES \
157 _ACC_PROF_VALID_BYTES_STRUCT (acc_data_event_info, device_ptr, \
158 _ACC_PROF_VALID_BYTES_BASICTYPE (void *))
159} acc_data_event_info;
160
161typedef struct acc_launch_event_info
162{
163 acc_event_t event_type;
164 _acc_prof_int_t valid_bytes;
165 acc_construct_t parent_construct;
166 _acc_prof_int_t implicit;
167 void *tool_info;
168 const char *kernel_name;
169 _acc_prof_size_t num_gangs, num_workers, vector_length;
170#define _ACC_LAUNCH_EVENT_INFO_VALID_BYTES \
171 _ACC_PROF_VALID_BYTES_STRUCT (acc_launch_event_info, vector_length, \
172 _ACC_PROF_VALID_BYTES_BASICTYPE (_acc_prof_size_t))
173} acc_launch_event_info;
174
175typedef struct acc_other_event_info
176{
177 acc_event_t event_type;
178 _acc_prof_int_t valid_bytes;
179 acc_construct_t parent_construct;
180 _acc_prof_int_t implicit;
181 void *tool_info;
182#define _ACC_OTHER_EVENT_INFO_VALID_BYTES \
183 _ACC_PROF_VALID_BYTES_STRUCT (acc_other_event_info, tool_info, \
184 _ACC_PROF_VALID_BYTES_BASICTYPE (void *))
185} acc_other_event_info;
186
187typedef union acc_event_info
188{
189 acc_event_t event_type;
190 acc_data_event_info data_event;
191 acc_launch_event_info launch_event;
192 acc_other_event_info other_event;
193} acc_event_info;
194
195typedef enum acc_device_api
196{
197 acc_device_api_none = 0,
198 acc_device_api_cuda,
199 acc_device_api_opencl,
200 acc_device_api_coi,
201 acc_device_api_other
202} acc_device_api;
203
204typedef struct acc_api_info
205{
206 acc_device_api device_api;
207 _acc_prof_int_t valid_bytes;
208 acc_device_t device_type;
209 _acc_prof_int_t vendor;
210 const void *device_handle;
211 const void *context_handle;
212 const void *async_handle;
213#define _ACC_API_INFO_VALID_BYTES \
214 _ACC_PROF_VALID_BYTES_STRUCT (acc_api_info, async_handle, \
215 _ACC_PROF_VALID_BYTES_BASICTYPE (void *))
216} acc_api_info;
217
218/* Don't tag 'acc_prof_callback' as '__GOACC_NOTHROW': these functions are
219 provided by user code, and must be expected to do anything. */
220typedef void (*acc_prof_callback) (acc_prof_info *, acc_event_info *,
221 acc_api_info *);
222
223
224/* Loading the Library. */
225
226typedef enum acc_register_t
227{
228 acc_reg = 0,
229 acc_toggle = 1,
230 acc_toggle_per_thread = 2
231} acc_register_t;
232
233typedef void (*acc_prof_reg) (acc_event_t, acc_prof_callback, acc_register_t);
234extern void acc_prof_register (acc_event_t, acc_prof_callback,
235 acc_register_t) __GOACC_NOTHROW;
236extern void acc_prof_unregister (acc_event_t, acc_prof_callback,
237 acc_register_t) __GOACC_NOTHROW;
238typedef void (*acc_query_fn) ();
239typedef acc_query_fn (*acc_prof_lookup_func) (const char *);
240extern acc_query_fn acc_prof_lookup (const char *) __GOACC_NOTHROW;
241/* Don't tag 'acc_register_library' as '__GOACC_NOTHROW': this function can be
242 overridden by user code, and must be expected to do anything. */
243extern void acc_register_library (acc_prof_reg, acc_prof_reg,
244 acc_prof_lookup_func);
245
246
247#ifdef __cplusplus
248}
249#endif
250
251
252#endif /* _ACC_PROF_H */
Note: See TracBrowser for help on using the repository browser.