2 Copyright (c) 2014-2015 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_set_cache_size
:
148 write_message(stderr
, msg_c_process_set_cache_size
, args
);
150 case c_process_wait_shutdown
:
151 write_message(stderr
, msg_c_process_wait_shutdown
, args
);
153 case c_process_proxy_flush
:
154 write_message(stderr
, msg_c_process_proxy_flush
, args
);
156 case c_process_get_func_handles
:
157 write_message(stderr
, msg_c_process_get_func_handles
, args
);
160 write_message(stderr
, msg_c_load_library
, args
);
162 case c_coipipe_max_number
:
163 write_message(stderr
, msg_c_coi_pipeline_max_number
, args
);
165 case c_pipeline_create
:
166 write_message(stderr
, msg_c_pipeline_create
, args
);
168 case c_pipeline_run_func
:
169 write_message(stderr
, msg_c_pipeline_run_func
, args
);
171 case c_pipeline_start_run_funcs
:
172 write_message(stderr
, msg_c_pipeline_start_run_funcs
, args
);
175 write_message(stderr
, msg_c_buf_create
, args
);
177 case c_buf_create_out_of_mem
:
178 write_message(stderr
, msg_c_buf_create_out_of_mem
, args
);
180 case c_buf_create_from_mem
:
181 write_message(stderr
, msg_c_buf_create_from_mem
, args
);
184 write_message(stderr
, msg_c_buf_destroy
, args
);
187 write_message(stderr
, msg_c_buf_map
, args
);
190 write_message(stderr
, msg_c_buf_unmap
, args
);
193 write_message(stderr
, msg_c_buf_read
, args
);
196 write_message(stderr
, msg_c_buf_write
, args
);
199 write_message(stderr
, msg_c_buf_copy
, args
);
201 case c_buf_get_address
:
202 write_message(stderr
, msg_c_buf_get_address
, args
);
205 write_message(stderr
, msg_c_buf_add_ref
, args
);
207 case c_buf_release_ref
:
208 write_message(stderr
, msg_c_buf_release_ref
, args
);
210 case c_buf_set_state
:
211 write_message(stderr
, msg_c_buf_set_state
, args
);
214 write_message(stderr
, msg_c_event_wait
, args
);
216 case c_zero_or_neg_ptr_len
:
217 write_message(stderr
, msg_c_zero_or_neg_ptr_len
, args
);
219 case c_zero_or_neg_transfer_size
:
220 write_message(stderr
, msg_c_zero_or_neg_transfer_size
, args
);
222 case c_bad_ptr_mem_alloc
:
223 write_message(stderr
, msg_c_bad_ptr_mem_alloc
, args
);
225 case c_bad_ptr_mem_range
:
226 write_message(stderr
, msg_c_bad_ptr_mem_range
, args
);
228 case c_different_src_and_dstn_sizes
:
229 write_message(stderr
, msg_c_different_src_and_dstn_sizes
, args
);
231 case c_ranges_dont_match
:
232 write_message(stderr
, msg_c_ranges_dont_match
, args
);
234 case c_destination_is_over
:
235 write_message(stderr
, msg_c_destination_is_over
, args
);
237 case c_slice_of_noncont_array
:
238 write_message(stderr
, msg_c_slice_of_noncont_array
, args
);
240 case c_non_contiguous_dope_vector
:
241 write_message(stderr
, msg_c_non_contiguous_dope_vector
, args
);
243 case c_pointer_array_mismatch
:
244 write_message(stderr
, msg_c_pointer_array_mismatch
, args
);
246 case c_omp_invalid_device_num_env
:
247 write_message(stderr
, msg_c_omp_invalid_device_num_env
, args
);
249 case c_omp_invalid_device_num
:
250 write_message(stderr
, msg_c_omp_invalid_device_num
, args
);
252 case c_unknown_binary_type
:
253 write_message(stderr
, msg_c_unknown_binary_type
, args
);
255 case c_multiple_target_exes
:
256 write_message(stderr
, msg_c_multiple_target_exes
, args
);
258 case c_no_target_exe
:
259 write_message(stderr
, msg_c_no_target_exe
, args
);
261 case c_report_unknown_timer_node
:
262 write_message(stderr
, msg_c_report_unknown_timer_node
, args
);
264 case c_report_unknown_trace_node
:
265 write_message(stderr
, msg_c_report_unknown_trace_node
, args
);
267 case c_incorrect_affinity
:
268 write_message(stderr
, msg_c_incorrect_affinity
, args
);
270 case c_cannot_set_affinity
:
271 write_message(stderr
, msg_c_cannot_set_affinity
, args
);
273 case c_in_with_preallocated
:
274 write_message(stderr
, msg_c_in_with_preallocated
, args
);
276 case c_report_no_host_exe
:
277 write_message(stderr
, msg_c_report_no_host_exe
, args
);
279 case c_report_path_buff_overflow
:
280 write_message(stderr
, msg_c_report_path_buff_overflow
, args
);
282 case c_create_pipeline_for_stream
:
283 write_message(stderr
, msg_c_create_pipeline_for_stream
, args
);
285 case c_offload_no_stream
:
286 write_message(stderr
, msg_c_offload_no_stream
, args
);
288 case c_get_engine_info
:
289 write_message(stderr
, msg_c_get_engine_info
, args
);
291 case c_clear_cpu_mask
:
292 write_message(stderr
, msg_c_clear_cpu_mask
, args
);
295 write_message(stderr
, msg_c_set_cpu_mask
, args
);
297 case c_unload_library
:
298 write_message(stderr
, msg_c_unload_library
, args
);
304 char const * report_get_message_str(error_types input_tag
)
308 return (offload_get_message_str(msg_c_report_title
));
309 case c_report_from_file
:
310 return (offload_get_message_str(msg_c_report_from_file
));
311 case c_report_offload
:
312 return (offload_get_message_str(msg_c_report_offload
));
314 return (offload_get_message_str(msg_c_report_mic
));
316 return (offload_get_message_str(msg_c_report_file
));
318 return (offload_get_message_str(msg_c_report_line
));
320 return (offload_get_message_str(msg_c_report_host
));
322 return (offload_get_message_str(msg_c_report_tag
));
323 case c_report_cpu_time
:
324 return (offload_get_message_str(msg_c_report_cpu_time
));
325 case c_report_seconds
:
326 return (offload_get_message_str(msg_c_report_seconds
));
327 case c_report_cpu_to_mic_data
:
328 return (offload_get_message_str(msg_c_report_cpu_to_mic_data
));
330 return (offload_get_message_str(msg_c_report_bytes
));
331 case c_report_mic_time
:
332 return (offload_get_message_str(msg_c_report_mic_time
));
333 case c_report_mic_to_cpu_data
:
334 return (offload_get_message_str(msg_c_report_mic_to_cpu_data
));
335 case c_report_compute
:
336 return (offload_get_message_str(msg_c_report_compute
));
337 case c_report_copyin_data
:
338 return (offload_get_message_str(msg_c_report_copyin_data
));
339 case c_report_copyout_data
:
340 return (offload_get_message_str(msg_c_report_copyout_data
));
341 case c_report_create_buf_host
:
342 return (offload_get_message_str(c_report_create_buf_host
));
343 case c_report_create_buf_mic
:
344 return (offload_get_message_str(msg_c_report_create_buf_mic
));
345 case c_report_destroy
:
346 return (offload_get_message_str(msg_c_report_destroy
));
347 case c_report_gather_copyin_data
:
348 return (offload_get_message_str(msg_c_report_gather_copyin_data
));
349 case c_report_gather_copyout_data
:
350 return (offload_get_message_str(msg_c_report_gather_copyout_data
));
351 case c_report_state_signal
:
352 return (offload_get_message_str(msg_c_report_state_signal
));
353 case c_report_signal
:
354 return (offload_get_message_str(msg_c_report_signal
));
356 return (offload_get_message_str(msg_c_report_wait
));
358 return (offload_get_message_str(msg_c_report_init
));
359 case c_report_init_func
:
360 return (offload_get_message_str(msg_c_report_init_func
));
361 case c_report_logical_card
:
362 return (offload_get_message_str(msg_c_report_logical_card
));
363 case c_report_mic_myo_fptr
:
364 return (offload_get_message_str(msg_c_report_mic_myo_fptr
));
365 case c_report_mic_myo_shared
:
366 return (offload_get_message_str(msg_c_report_mic_myo_shared
));
367 case c_report_myoacquire
:
368 return (offload_get_message_str(msg_c_report_myoacquire
));
369 case c_report_myofini
:
370 return (offload_get_message_str(msg_c_report_myofini
));
371 case c_report_myoinit
:
372 return (offload_get_message_str(msg_c_report_myoinit
));
373 case c_report_myoregister
:
374 return (offload_get_message_str(msg_c_report_myoregister
));
375 case c_report_myorelease
:
376 return (offload_get_message_str(msg_c_report_myorelease
));
377 case c_report_myosharedalignedfree
:
379 offload_get_message_str(msg_c_report_myosharedalignedfree
));
380 case c_report_myosharedalignedmalloc
:
382 offload_get_message_str(msg_c_report_myosharedalignedmalloc
));
383 case c_report_myosharedfree
:
384 return (offload_get_message_str(msg_c_report_myosharedfree
));
385 case c_report_myosharedmalloc
:
386 return (offload_get_message_str(msg_c_report_myosharedmalloc
));
387 case c_report_physical_card
:
388 return (offload_get_message_str(msg_c_report_physical_card
));
389 case c_report_receive_pointer_data
:
391 offload_get_message_str(msg_c_report_receive_pointer_data
));
392 case c_report_received_pointer_data
:
394 offload_get_message_str(msg_c_report_received_pointer_data
));
395 case c_report_register
:
396 return (offload_get_message_str(msg_c_report_register
));
397 case c_report_scatter_copyin_data
:
398 return (offload_get_message_str(msg_c_report_scatter_copyin_data
));
399 case c_report_scatter_copyout_data
:
401 offload_get_message_str(msg_c_report_scatter_copyout_data
));
402 case c_report_send_pointer_data
:
403 return (offload_get_message_str(msg_c_report_send_pointer_data
));
404 case c_report_sent_pointer_data
:
405 return (offload_get_message_str(msg_c_report_sent_pointer_data
));
407 return (offload_get_message_str(msg_c_report_start
));
408 case c_report_start_target_func
:
409 return (offload_get_message_str(msg_c_report_start_target_func
));
411 return (offload_get_message_str(msg_c_report_state
));
412 case c_report_unregister
:
413 return (offload_get_message_str(msg_c_report_unregister
));
415 return (offload_get_message_str(msg_c_report_var
));
416 case c_report_stream
:
417 return (offload_get_message_str(msg_c_report_stream
));
418 case c_report_state_stream
:
419 return (offload_get_message_str(msg_c_report_state_stream
));
422 LIBOFFLOAD_ERROR(c_report_unknown_trace_node
);
427 char const * report_get_host_stage_str(int i
)
430 case c_offload_host_total_offload
:
432 offload_get_message_str(msg_c_report_host_total_offload_time
));
433 case c_offload_host_initialize
:
434 return (offload_get_message_str(msg_c_report_host_initialize
));
435 case c_offload_host_target_acquire
:
437 offload_get_message_str(msg_c_report_host_target_acquire
));
438 case c_offload_host_wait_deps
:
439 return (offload_get_message_str(msg_c_report_host_wait_deps
));
440 case c_offload_host_setup_buffers
:
441 return (offload_get_message_str(msg_c_report_host_setup_buffers
));
442 case c_offload_host_alloc_buffers
:
443 return (offload_get_message_str(msg_c_report_host_alloc_buffers
));
444 case c_offload_host_setup_misc_data
:
446 offload_get_message_str(msg_c_report_host_setup_misc_data
));
447 case c_offload_host_alloc_data_buffer
:
449 offload_get_message_str(msg_c_report_host_alloc_data_buffer
));
450 case c_offload_host_send_pointers
:
451 return (offload_get_message_str(msg_c_report_host_send_pointers
));
452 case c_offload_host_gather_inputs
:
453 return (offload_get_message_str(msg_c_report_host_gather_inputs
));
454 case c_offload_host_map_in_data_buffer
:
456 offload_get_message_str(msg_c_report_host_map_in_data_buffer
));
457 case c_offload_host_unmap_in_data_buffer
:
458 return (offload_get_message_str(
459 msg_c_report_host_unmap_in_data_buffer
));
460 case c_offload_host_start_compute
:
461 return (offload_get_message_str(msg_c_report_host_start_compute
));
462 case c_offload_host_wait_compute
:
463 return (offload_get_message_str(msg_c_report_host_wait_compute
));
464 case c_offload_host_start_buffers_reads
:
465 return (offload_get_message_str(
466 msg_c_report_host_start_buffers_reads
));
467 case c_offload_host_scatter_outputs
:
469 offload_get_message_str(msg_c_report_host_scatter_outputs
));
470 case c_offload_host_map_out_data_buffer
:
471 return (offload_get_message_str(
472 msg_c_report_host_map_out_data_buffer
));
473 case c_offload_host_unmap_out_data_buffer
:
474 return (offload_get_message_str(
475 msg_c_report_host_unmap_out_data_buffer
));
476 case c_offload_host_wait_buffers_reads
:
478 offload_get_message_str(msg_c_report_host_wait_buffers_reads
));
479 case c_offload_host_destroy_buffers
:
481 offload_get_message_str(msg_c_report_host_destroy_buffers
));
483 LIBOFFLOAD_ERROR(c_report_unknown_timer_node
);
488 char const * report_get_target_stage_str(int i
)
491 case c_offload_target_total_time
:
492 return (offload_get_message_str(msg_c_report_target_total_time
));
493 case c_offload_target_descriptor_setup
:
495 offload_get_message_str(msg_c_report_target_descriptor_setup
));
496 case c_offload_target_func_lookup
:
497 return (offload_get_message_str(msg_c_report_target_func_lookup
));
498 case c_offload_target_func_time
:
499 return (offload_get_message_str(msg_c_report_target_func_time
));
500 case c_offload_target_scatter_inputs
:
502 offload_get_message_str(msg_c_report_target_scatter_inputs
));
503 case c_offload_target_add_buffer_refs
:
505 offload_get_message_str(msg_c_report_target_add_buffer_refs
));
506 case c_offload_target_compute
:
507 return (offload_get_message_str(msg_c_report_target_compute
));
508 case c_offload_target_gather_outputs
:
509 return (offload_get_message_str
510 (msg_c_report_target_gather_outputs
));
511 case c_offload_target_release_buffer_refs
:
512 return (offload_get_message_str(
513 msg_c_report_target_release_buffer_refs
));
515 LIBOFFLOAD_ERROR(c_report_unknown_timer_node
);