]> git.ipfire.org Git - thirdparty/gcc.git/blame - liboffloadmic/runtime/liboffload_error_codes.h
backport: Makefile.am (liboffloadmic_host_la_DEPENDENCIES): Remove libcoi_host and...
[thirdparty/gcc.git] / liboffloadmic / runtime / liboffload_error_codes.h
CommitLineData
5f520819 1/*
2eab9666 2 Copyright (c) 2014-2015 Intel Corporation. All Rights Reserved.
5f520819
KY
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
6 are met:
7
8 * Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright
11 notice, this list of conditions and the following disclaimer in the
12 documentation and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30
31#if !defined(LIBOFFLOAD_ERROR_CODES_H)
32#define LIBOFFLOAD_ERROR_CODES_H
33#include <stdarg.h>
34#include <stdlib.h>
35#include <stdio.h>
36
37typedef enum
38{
39 c_device_is_not_available = 0,
40 c_invalid_device_number,
41 c_offload1,
42 c_unknown_var_type,
43 c_send_func_ptr,
44 c_receive_func_ptr,
45 c_malloc,
46 c_offload_malloc,
47 c_invalid_env_var_value,
48 c_invalid_env_var_int_value,
49 c_invalid_env_report_value,
50 c_offload_signaled1,
51 c_offload_signaled2,
52 c_myotarget_checkresult,
53 c_myowrapper_checkresult,
54 c_offload_descriptor_offload,
55 c_merge_var_descs1,
56 c_merge_var_descs2,
57 c_mic_parse_env_var_list1,
58 c_mic_parse_env_var_list2,
59 c_mic_process_exit_ret,
60 c_mic_process_exit_sig,
61 c_mic_process_exit,
62 c_mic_init3,
63 c_mic_init4,
64 c_mic_init5,
65 c_mic_init6,
66 c_no_static_var_data,
67 c_no_ptr_data,
68 c_get_engine_handle,
69 c_get_engine_index,
70 c_process_create,
2eab9666 71 c_process_set_cache_size,
5f520819
KY
72 c_process_get_func_handles,
73 c_process_wait_shutdown,
74 c_process_proxy_flush,
75 c_load_library,
76 c_pipeline_create,
77 c_pipeline_run_func,
78 c_pipeline_start_run_funcs,
79 c_buf_create,
80 c_buf_create_out_of_mem,
81 c_buf_create_from_mem,
82 c_buf_destroy,
83 c_buf_map,
84 c_buf_unmap,
85 c_buf_read,
86 c_buf_write,
87 c_buf_copy,
88 c_buf_get_address,
89 c_buf_add_ref,
90 c_buf_release_ref,
91 c_buf_set_state,
92 c_event_wait,
93 c_zero_or_neg_ptr_len,
94 c_zero_or_neg_transfer_size,
2eab9666 95 c_bad_ptr_mem_alloc,
5f520819
KY
96 c_bad_ptr_mem_range,
97 c_different_src_and_dstn_sizes,
98 c_ranges_dont_match,
99 c_destination_is_over,
100 c_slice_of_noncont_array,
101 c_non_contiguous_dope_vector,
102 c_pointer_array_mismatch,
103 c_omp_invalid_device_num_env,
104 c_omp_invalid_device_num,
105 c_unknown_binary_type,
106 c_multiple_target_exes,
107 c_no_target_exe,
2eab9666
IV
108 c_incorrect_affinity,
109 c_cannot_set_affinity,
5f520819
KY
110 c_report_host,
111 c_report_target,
112 c_report_title,
113 c_report_from_file,
114 c_report_file,
115 c_report_line,
116 c_report_tag,
117 c_report_seconds,
118 c_report_bytes,
119 c_report_mic,
120 c_report_cpu_time,
121 c_report_cpu_to_mic_data,
122 c_report_mic_time,
123 c_report_mic_to_cpu_data,
124 c_report_unknown_timer_node,
125 c_report_unknown_trace_node,
126 c_report_offload,
127 c_report_w_tag,
128 c_report_state,
129 c_report_start,
130 c_report_init,
131 c_report_logical_card,
132 c_report_physical_card,
133 c_report_register,
134 c_report_init_func,
135 c_report_create_buf_host,
136 c_report_create_buf_mic,
137 c_report_send_pointer_data,
138 c_report_sent_pointer_data,
139 c_report_gather_copyin_data,
140 c_report_copyin_data,
141 c_report_state_signal,
142 c_report_signal,
143 c_report_wait,
144 c_report_compute,
145 c_report_receive_pointer_data,
146 c_report_received_pointer_data,
147 c_report_start_target_func,
148 c_report_var,
149 c_report_scatter_copyin_data,
150 c_report_gather_copyout_data,
151 c_report_scatter_copyout_data,
152 c_report_copyout_data,
153 c_report_unregister,
154 c_report_destroy,
155 c_report_myoinit,
156 c_report_myoregister,
157 c_report_myofini,
158 c_report_mic_myo_shared,
159 c_report_mic_myo_fptr,
160 c_report_myosharedmalloc,
161 c_report_myosharedfree,
162 c_report_myosharedalignedmalloc,
163 c_report_myosharedalignedfree,
164 c_report_myoacquire,
165 c_report_myorelease,
2eab9666
IV
166 c_report_myosupportsfeature,
167 c_report_myosharedarenacreate,
168 c_report_myosharedalignedarenamalloc,
169 c_report_myosharedalignedarenafree,
170 c_report_myoarenaacquire,
171 c_report_myoarenarelease,
172 c_coipipe_max_number,
173 c_in_with_preallocated,
174 c_report_no_host_exe,
175 c_report_path_buff_overflow,
176 c_create_pipeline_for_stream,
177 c_offload_no_stream,
178 c_get_engine_info,
179 c_clear_cpu_mask,
180 c_set_cpu_mask,
181 c_report_state_stream,
182 c_report_stream,
183 c_unload_library
5f520819
KY
184} error_types;
185
186enum OffloadHostPhase {
187 // Total time on host for entire offload
188 c_offload_host_total_offload = 0,
189
190 // Time to load target binary
191 c_offload_host_initialize,
192
193 // Time to acquire lrb availability dynamically
194 c_offload_host_target_acquire,
195
196 // Time to wait for dependencies
197 c_offload_host_wait_deps,
198
199 // Time to allocate pointer buffers, initiate writes for pointers
200 // and calculate size of copyin/copyout buffer
201 c_offload_host_setup_buffers,
202
203 // Time to allocate pointer buffers
204 c_offload_host_alloc_buffers,
205
206 // Time to initialize misc data
207 c_offload_host_setup_misc_data,
208
209 // Time to allocate copyin/copyout buffer
210 c_offload_host_alloc_data_buffer,
211
212 // Time to initiate writes from host pointers to buffers
213 c_offload_host_send_pointers,
214
215 // Time to Gather IN data of offload into buffer
216 c_offload_host_gather_inputs,
217
218 // Time to map buffer
219 c_offload_host_map_in_data_buffer,
220
221 // Time to unmap buffer
222 c_offload_host_unmap_in_data_buffer,
223
224 // Time to start remote function call that does computation on lrb
225 c_offload_host_start_compute,
226
227 // Time to wait for compute to finish
228 c_offload_host_wait_compute,
229
230 // Time to initiate reads from pointer buffers
231 c_offload_host_start_buffers_reads,
232
233 // Time to update host variabels with OUT data from buffer
234 c_offload_host_scatter_outputs,
235
236 // Time to map buffer
237 c_offload_host_map_out_data_buffer,
238
239 // Time to unmap buffer
240 c_offload_host_unmap_out_data_buffer,
241
242 // Time to wait reads from buffers to finish
243 c_offload_host_wait_buffers_reads,
244
245 // Time to destroy buffers that are no longer needed
246 c_offload_host_destroy_buffers,
247
248 // LAST TIME MONITOR
249 c_offload_host_max_phase
250};
251
252enum OffloadTargetPhase {
253 // Total time spent on the target
254 c_offload_target_total_time = 0,
255
256 // Time to initialize offload descriptor
257 c_offload_target_descriptor_setup,
258
259 // Time to find target entry point in lookup table
260 c_offload_target_func_lookup,
261
262 // Total time spend executing offload entry
263 c_offload_target_func_time,
264
265 // Time to initialize target variables with IN values from buffer
266 c_offload_target_scatter_inputs,
267
268 // Time to add buffer reference for pointer buffers
269 c_offload_target_add_buffer_refs,
270
271 // Total time on lrb for computation
272 c_offload_target_compute,
273
274 // On lrb, time to copy OUT into buffer
275 c_offload_target_gather_outputs,
276
277 // Time to release buffer references
278 c_offload_target_release_buffer_refs,
279
280 // LAST TIME MONITOR
281 c_offload_target_max_phase
282};
283
2eab9666
IV
284#ifdef TARGET_WINNT
285 #define DLL_LOCAL
286#else
287 #define DLL_LOCAL __attribute__((visibility("hidden")))
288#endif
289
5f520819
KY
290#ifdef __cplusplus
291extern "C" {
292#endif
2eab9666
IV
293DLL_LOCAL void __liboffload_error_support(error_types input_tag, ...);
294DLL_LOCAL void __liboffload_report_support(error_types input_tag, ...);
295DLL_LOCAL char const *offload_get_message_str(int msgCode);
296DLL_LOCAL char const * report_get_message_str(error_types input_tag);
297DLL_LOCAL char const * report_get_host_stage_str(int i);
298DLL_LOCAL char const * report_get_target_stage_str(int i);
5f520819
KY
299#ifdef __cplusplus
300}
301#endif
302
303#define test_msg_cat(nm, msg) \
304 fprintf(stderr, "\t TEST for %s \n \t", nm); \
305 __liboffload_error_support(msg);
306
307#define test_msg_cat1(nm, msg, ...) \
308 fprintf(stderr, "\t TEST for %s \n \t", nm); \
309 __liboffload_error_support(msg, __VA_ARGS__);
310
2eab9666 311DLL_LOCAL void write_message(FILE * file, int msgCode, va_list args_p);
5f520819
KY
312
313#define LIBOFFLOAD_ERROR __liboffload_error_support
314
315#ifdef TARGET_WINNT
316#define LIBOFFLOAD_ABORT \
317 _set_abort_behavior(0, _WRITE_ABORT_MSG); \
318 abort()
319#else
320#define LIBOFFLOAD_ABORT \
321 abort()
322#endif
323
324#endif // !defined(LIBOFFLOAD_ERROR_CODES_H)