2 Copyright (c) 2014 Intel Corporation. All Rights Reserved.
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions
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.
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.
34 #define va_copy(dst, src) ((dst) = (src))
37 #include "liboffload_msg.h"
39 #include "liboffload_error_codes.h"
41 /***********************************************/
42 /* error-handling function, liboffload_error_support */
43 /***********************************************/
45 void __liboffload_error_support(error_types input_tag
, ...)
48 va_start(args
, input_tag
);
51 case c_device_is_not_available
:
52 write_message(stderr
, msg_c_device_is_not_available
, args
);
54 case c_invalid_device_number
:
55 write_message(stderr
, msg_c_invalid_device_number
, args
);
58 write_message(stderr
, msg_c_send_func_ptr
, args
);
60 case c_receive_func_ptr
:
61 write_message(stderr
, msg_c_receive_func_ptr
, args
);
64 write_message(stderr
, msg_c_malloc
, args
);
66 case c_offload_malloc
:
67 write_message(stderr
, msg_c_offload_malloc
, args
);
70 write_message(stderr
, msg_c_offload1
, args
);
72 case c_unknown_var_type
:
73 write_message(stderr
, c_unknown_var_type
, args
);
75 case c_invalid_env_var_value
:
76 write_message(stderr
, msg_c_invalid_env_var_value
, args
);
78 case c_invalid_env_var_int_value
:
79 write_message(stderr
, msg_c_invalid_env_var_int_value
, args
);
81 case c_invalid_env_report_value
:
82 write_message(stderr
, msg_c_invalid_env_report_value
, args
);
84 case c_offload_signaled1
:
85 write_message(stderr
, msg_c_offload_signaled1
, args
);
87 case c_offload_signaled2
:
88 write_message(stderr
, msg_c_offload_signaled2
, args
);
90 case c_myowrapper_checkresult
:
91 write_message(stderr
, msg_c_myowrapper_checkresult
, args
);
93 case c_myotarget_checkresult
:
94 write_message(stderr
, msg_c_myotarget_checkresult
, args
);
96 case c_offload_descriptor_offload
:
97 write_message(stderr
, msg_c_offload_descriptor_offload
, args
);
99 case c_merge_var_descs1
:
100 write_message(stderr
, msg_c_merge_var_descs1
, args
);
102 case c_merge_var_descs2
:
103 write_message(stderr
, msg_c_merge_var_descs2
, args
);
105 case c_mic_parse_env_var_list1
:
106 write_message(stderr
, msg_c_mic_parse_env_var_list1
, args
);
108 case c_mic_parse_env_var_list2
:
109 write_message(stderr
, msg_c_mic_parse_env_var_list2
, args
);
111 case c_mic_process_exit_ret
:
112 write_message(stderr
, msg_c_mic_process_exit_ret
, args
);
114 case c_mic_process_exit_sig
:
115 write_message(stderr
, msg_c_mic_process_exit_sig
, args
);
117 case c_mic_process_exit
:
118 write_message(stderr
, msg_c_mic_process_exit
, args
);
121 write_message(stderr
, msg_c_mic_init3
, args
);
124 write_message(stderr
, msg_c_mic_init4
, args
);
127 write_message(stderr
, msg_c_mic_init5
, args
);
130 write_message(stderr
, msg_c_mic_init6
, args
);
132 case c_no_static_var_data
:
133 write_message(stderr
, msg_c_no_static_var_data
, args
);
136 write_message(stderr
, msg_c_no_ptr_data
, args
);
138 case c_get_engine_handle
:
139 write_message(stderr
, msg_c_get_engine_handle
, args
);
141 case c_get_engine_index
:
142 write_message(stderr
, msg_c_get_engine_index
, args
);
144 case c_process_create
:
145 write_message(stderr
, msg_c_process_create
, args
);
147 case c_process_wait_shutdown
:
148 write_message(stderr
, msg_c_process_wait_shutdown
, args
);
150 case c_process_proxy_flush
:
151 write_message(stderr
, msg_c_process_proxy_flush
, args
);
153 case c_process_get_func_handles
:
154 write_message(stderr
, msg_c_process_get_func_handles
, args
);
157 write_message(stderr
, msg_c_load_library
, args
);
159 case c_coipipe_max_number
:
160 write_message(stderr
, msg_c_coi_pipeline_max_number
, args
);
162 case c_pipeline_create
:
163 write_message(stderr
, msg_c_pipeline_create
, args
);
165 case c_pipeline_run_func
:
166 write_message(stderr
, msg_c_pipeline_run_func
, args
);
168 case c_pipeline_start_run_funcs
:
169 write_message(stderr
, msg_c_pipeline_start_run_funcs
, args
);
172 write_message(stderr
, msg_c_buf_create
, args
);
174 case c_buf_create_out_of_mem
:
175 write_message(stderr
, msg_c_buf_create_out_of_mem
, args
);
177 case c_buf_create_from_mem
:
178 write_message(stderr
, msg_c_buf_create_from_mem
, args
);
181 write_message(stderr
, msg_c_buf_destroy
, args
);
184 write_message(stderr
, msg_c_buf_map
, args
);
187 write_message(stderr
, msg_c_buf_unmap
, args
);
190 write_message(stderr
, msg_c_buf_read
, args
);
193 write_message(stderr
, msg_c_buf_write
, args
);
196 write_message(stderr
, msg_c_buf_copy
, args
);
198 case c_buf_get_address
:
199 write_message(stderr
, msg_c_buf_get_address
, args
);
202 write_message(stderr
, msg_c_buf_add_ref
, args
);
204 case c_buf_release_ref
:
205 write_message(stderr
, msg_c_buf_release_ref
, args
);
207 case c_buf_set_state
:
208 write_message(stderr
, msg_c_buf_set_state
, args
);
211 write_message(stderr
, msg_c_event_wait
, args
);
213 case c_zero_or_neg_ptr_len
:
214 write_message(stderr
, msg_c_zero_or_neg_ptr_len
, args
);
216 case c_zero_or_neg_transfer_size
:
217 write_message(stderr
, msg_c_zero_or_neg_transfer_size
, args
);
219 case c_bad_ptr_mem_range
:
220 write_message(stderr
, msg_c_bad_ptr_mem_range
, args
);
222 case c_different_src_and_dstn_sizes
:
223 write_message(stderr
, msg_c_different_src_and_dstn_sizes
, args
);
225 case c_ranges_dont_match
:
226 write_message(stderr
, msg_c_ranges_dont_match
, args
);
228 case c_destination_is_over
:
229 write_message(stderr
, msg_c_destination_is_over
, args
);
231 case c_slice_of_noncont_array
:
232 write_message(stderr
, msg_c_slice_of_noncont_array
, args
);
234 case c_non_contiguous_dope_vector
:
235 write_message(stderr
, msg_c_non_contiguous_dope_vector
, args
);
237 case c_pointer_array_mismatch
:
238 write_message(stderr
, msg_c_pointer_array_mismatch
, args
);
240 case c_omp_invalid_device_num_env
:
241 write_message(stderr
, msg_c_omp_invalid_device_num_env
, args
);
243 case c_omp_invalid_device_num
:
244 write_message(stderr
, msg_c_omp_invalid_device_num
, args
);
246 case c_unknown_binary_type
:
247 write_message(stderr
, msg_c_unknown_binary_type
, args
);
249 case c_multiple_target_exes
:
250 write_message(stderr
, msg_c_multiple_target_exes
, args
);
252 case c_no_target_exe
:
253 write_message(stderr
, msg_c_no_target_exe
, args
);
255 case c_report_unknown_timer_node
:
256 write_message(stderr
, msg_c_report_unknown_timer_node
, args
);
258 case c_report_unknown_trace_node
:
259 write_message(stderr
, msg_c_report_unknown_trace_node
, args
);
265 char const * report_get_message_str(error_types input_tag
)
269 return (offload_get_message_str(msg_c_report_title
));
270 case c_report_from_file
:
271 return (offload_get_message_str(msg_c_report_from_file
));
272 case c_report_offload
:
273 return (offload_get_message_str(msg_c_report_offload
));
275 return (offload_get_message_str(msg_c_report_mic
));
277 return (offload_get_message_str(msg_c_report_file
));
279 return (offload_get_message_str(msg_c_report_line
));
281 return (offload_get_message_str(msg_c_report_host
));
283 return (offload_get_message_str(msg_c_report_tag
));
284 case c_report_cpu_time
:
285 return (offload_get_message_str(msg_c_report_cpu_time
));
286 case c_report_seconds
:
287 return (offload_get_message_str(msg_c_report_seconds
));
288 case c_report_cpu_to_mic_data
:
289 return (offload_get_message_str(msg_c_report_cpu_to_mic_data
));
291 return (offload_get_message_str(msg_c_report_bytes
));
292 case c_report_mic_time
:
293 return (offload_get_message_str(msg_c_report_mic_time
));
294 case c_report_mic_to_cpu_data
:
295 return (offload_get_message_str(msg_c_report_mic_to_cpu_data
));
296 case c_report_compute
:
297 return (offload_get_message_str(msg_c_report_compute
));
298 case c_report_copyin_data
:
299 return (offload_get_message_str(msg_c_report_copyin_data
));
300 case c_report_copyout_data
:
301 return (offload_get_message_str(msg_c_report_copyout_data
));
302 case c_report_create_buf_host
:
303 return (offload_get_message_str(c_report_create_buf_host
));
304 case c_report_create_buf_mic
:
305 return (offload_get_message_str(msg_c_report_create_buf_mic
));
306 case c_report_destroy
:
307 return (offload_get_message_str(msg_c_report_destroy
));
308 case c_report_gather_copyin_data
:
309 return (offload_get_message_str(msg_c_report_gather_copyin_data
));
310 case c_report_gather_copyout_data
:
311 return (offload_get_message_str(msg_c_report_gather_copyout_data
));
312 case c_report_state_signal
:
313 return (offload_get_message_str(msg_c_report_state_signal
));
314 case c_report_signal
:
315 return (offload_get_message_str(msg_c_report_signal
));
317 return (offload_get_message_str(msg_c_report_wait
));
319 return (offload_get_message_str(msg_c_report_init
));
320 case c_report_init_func
:
321 return (offload_get_message_str(msg_c_report_init_func
));
322 case c_report_logical_card
:
323 return (offload_get_message_str(msg_c_report_logical_card
));
324 case c_report_mic_myo_fptr
:
325 return (offload_get_message_str(msg_c_report_mic_myo_fptr
));
326 case c_report_mic_myo_shared
:
327 return (offload_get_message_str(msg_c_report_mic_myo_shared
));
328 case c_report_myoacquire
:
329 return (offload_get_message_str(msg_c_report_myoacquire
));
330 case c_report_myofini
:
331 return (offload_get_message_str(msg_c_report_myofini
));
332 case c_report_myoinit
:
333 return (offload_get_message_str(msg_c_report_myoinit
));
334 case c_report_myoregister
:
335 return (offload_get_message_str(msg_c_report_myoregister
));
336 case c_report_myorelease
:
337 return (offload_get_message_str(msg_c_report_myorelease
));
338 case c_report_myosharedalignedfree
:
340 offload_get_message_str(msg_c_report_myosharedalignedfree
));
341 case c_report_myosharedalignedmalloc
:
343 offload_get_message_str(msg_c_report_myosharedalignedmalloc
));
344 case c_report_myosharedfree
:
345 return (offload_get_message_str(msg_c_report_myosharedfree
));
346 case c_report_myosharedmalloc
:
347 return (offload_get_message_str(msg_c_report_myosharedmalloc
));
348 case c_report_physical_card
:
349 return (offload_get_message_str(msg_c_report_physical_card
));
350 case c_report_receive_pointer_data
:
352 offload_get_message_str(msg_c_report_receive_pointer_data
));
353 case c_report_received_pointer_data
:
355 offload_get_message_str(msg_c_report_received_pointer_data
));
356 case c_report_register
:
357 return (offload_get_message_str(msg_c_report_register
));
358 case c_report_scatter_copyin_data
:
359 return (offload_get_message_str(msg_c_report_scatter_copyin_data
));
360 case c_report_scatter_copyout_data
:
362 offload_get_message_str(msg_c_report_scatter_copyout_data
));
363 case c_report_send_pointer_data
:
364 return (offload_get_message_str(msg_c_report_send_pointer_data
));
365 case c_report_sent_pointer_data
:
366 return (offload_get_message_str(msg_c_report_sent_pointer_data
));
368 return (offload_get_message_str(msg_c_report_start
));
369 case c_report_start_target_func
:
370 return (offload_get_message_str(msg_c_report_start_target_func
));
372 return (offload_get_message_str(msg_c_report_state
));
373 case c_report_unregister
:
374 return (offload_get_message_str(msg_c_report_unregister
));
376 return (offload_get_message_str(msg_c_report_var
));
379 LIBOFFLOAD_ERROR(c_report_unknown_trace_node
);
384 char const * report_get_host_stage_str(int i
)
387 case c_offload_host_total_offload
:
389 offload_get_message_str(msg_c_report_host_total_offload_time
));
390 case c_offload_host_initialize
:
391 return (offload_get_message_str(msg_c_report_host_initialize
));
392 case c_offload_host_target_acquire
:
394 offload_get_message_str(msg_c_report_host_target_acquire
));
395 case c_offload_host_wait_deps
:
396 return (offload_get_message_str(msg_c_report_host_wait_deps
));
397 case c_offload_host_setup_buffers
:
398 return (offload_get_message_str(msg_c_report_host_setup_buffers
));
399 case c_offload_host_alloc_buffers
:
400 return (offload_get_message_str(msg_c_report_host_alloc_buffers
));
401 case c_offload_host_setup_misc_data
:
403 offload_get_message_str(msg_c_report_host_setup_misc_data
));
404 case c_offload_host_alloc_data_buffer
:
406 offload_get_message_str(msg_c_report_host_alloc_data_buffer
));
407 case c_offload_host_send_pointers
:
408 return (offload_get_message_str(msg_c_report_host_send_pointers
));
409 case c_offload_host_gather_inputs
:
410 return (offload_get_message_str(msg_c_report_host_gather_inputs
));
411 case c_offload_host_map_in_data_buffer
:
413 offload_get_message_str(msg_c_report_host_map_in_data_buffer
));
414 case c_offload_host_unmap_in_data_buffer
:
415 return (offload_get_message_str(
416 msg_c_report_host_unmap_in_data_buffer
));
417 case c_offload_host_start_compute
:
418 return (offload_get_message_str(msg_c_report_host_start_compute
));
419 case c_offload_host_wait_compute
:
420 return (offload_get_message_str(msg_c_report_host_wait_compute
));
421 case c_offload_host_start_buffers_reads
:
422 return (offload_get_message_str(
423 msg_c_report_host_start_buffers_reads
));
424 case c_offload_host_scatter_outputs
:
426 offload_get_message_str(msg_c_report_host_scatter_outputs
));
427 case c_offload_host_map_out_data_buffer
:
428 return (offload_get_message_str(
429 msg_c_report_host_map_out_data_buffer
));
430 case c_offload_host_unmap_out_data_buffer
:
431 return (offload_get_message_str(
432 msg_c_report_host_unmap_out_data_buffer
));
433 case c_offload_host_wait_buffers_reads
:
435 offload_get_message_str(msg_c_report_host_wait_buffers_reads
));
436 case c_offload_host_destroy_buffers
:
438 offload_get_message_str(msg_c_report_host_destroy_buffers
));
440 LIBOFFLOAD_ERROR(c_report_unknown_timer_node
);
445 char const * report_get_target_stage_str(int i
)
448 case c_offload_target_total_time
:
449 return (offload_get_message_str(msg_c_report_target_total_time
));
450 case c_offload_target_descriptor_setup
:
452 offload_get_message_str(msg_c_report_target_descriptor_setup
));
453 case c_offload_target_func_lookup
:
454 return (offload_get_message_str(msg_c_report_target_func_lookup
));
455 case c_offload_target_func_time
:
456 return (offload_get_message_str(msg_c_report_target_func_time
));
457 case c_offload_target_scatter_inputs
:
459 offload_get_message_str(msg_c_report_target_scatter_inputs
));
460 case c_offload_target_add_buffer_refs
:
462 offload_get_message_str(msg_c_report_target_add_buffer_refs
));
463 case c_offload_target_compute
:
464 return (offload_get_message_str(msg_c_report_target_compute
));
465 case c_offload_target_gather_outputs
:
466 return (offload_get_message_str
467 (msg_c_report_target_gather_outputs
));
468 case c_offload_target_release_buffer_refs
:
469 return (offload_get_message_str(
470 msg_c_report_target_release_buffer_refs
));
472 LIBOFFLOAD_ERROR(c_report_unknown_timer_node
);