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.
31 #if !defined(LIBOFFLOAD_ERROR_CODES_H)
32 #define LIBOFFLOAD_ERROR_CODES_H
39 c_device_is_not_available
= 0,
40 c_invalid_device_number
,
47 c_invalid_env_var_value
,
48 c_invalid_env_var_int_value
,
49 c_invalid_env_report_value
,
52 c_myotarget_checkresult
,
53 c_myowrapper_checkresult
,
54 c_offload_descriptor_offload
,
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
,
71 c_process_set_cache_size
,
72 c_process_get_func_handles
,
73 c_process_wait_shutdown
,
74 c_process_proxy_flush
,
78 c_pipeline_start_run_funcs
,
80 c_buf_create_out_of_mem
,
81 c_buf_create_from_mem
,
93 c_zero_or_neg_ptr_len
,
94 c_zero_or_neg_transfer_size
,
97 c_different_src_and_dstn_sizes
,
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
,
108 c_incorrect_affinity
,
109 c_cannot_set_affinity
,
121 c_report_cpu_to_mic_data
,
123 c_report_mic_to_cpu_data
,
124 c_report_unknown_timer_node
,
125 c_report_unknown_trace_node
,
131 c_report_logical_card
,
132 c_report_physical_card
,
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
,
145 c_report_receive_pointer_data
,
146 c_report_received_pointer_data
,
147 c_report_start_target_func
,
149 c_report_scatter_copyin_data
,
150 c_report_gather_copyout_data
,
151 c_report_scatter_copyout_data
,
152 c_report_copyout_data
,
156 c_report_myoregister
,
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
,
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
,
181 c_report_state_stream
,
186 enum OffloadHostPhase
{
187 // Total time on host for entire offload
188 c_offload_host_total_offload
= 0,
190 // Time to load target binary
191 c_offload_host_initialize
,
193 // Time to acquire lrb availability dynamically
194 c_offload_host_target_acquire
,
196 // Time to wait for dependencies
197 c_offload_host_wait_deps
,
199 // Time to allocate pointer buffers, initiate writes for pointers
200 // and calculate size of copyin/copyout buffer
201 c_offload_host_setup_buffers
,
203 // Time to allocate pointer buffers
204 c_offload_host_alloc_buffers
,
206 // Time to initialize misc data
207 c_offload_host_setup_misc_data
,
209 // Time to allocate copyin/copyout buffer
210 c_offload_host_alloc_data_buffer
,
212 // Time to initiate writes from host pointers to buffers
213 c_offload_host_send_pointers
,
215 // Time to Gather IN data of offload into buffer
216 c_offload_host_gather_inputs
,
218 // Time to map buffer
219 c_offload_host_map_in_data_buffer
,
221 // Time to unmap buffer
222 c_offload_host_unmap_in_data_buffer
,
224 // Time to start remote function call that does computation on lrb
225 c_offload_host_start_compute
,
227 // Time to wait for compute to finish
228 c_offload_host_wait_compute
,
230 // Time to initiate reads from pointer buffers
231 c_offload_host_start_buffers_reads
,
233 // Time to update host variabels with OUT data from buffer
234 c_offload_host_scatter_outputs
,
236 // Time to map buffer
237 c_offload_host_map_out_data_buffer
,
239 // Time to unmap buffer
240 c_offload_host_unmap_out_data_buffer
,
242 // Time to wait reads from buffers to finish
243 c_offload_host_wait_buffers_reads
,
245 // Time to destroy buffers that are no longer needed
246 c_offload_host_destroy_buffers
,
249 c_offload_host_max_phase
252 enum OffloadTargetPhase
{
253 // Total time spent on the target
254 c_offload_target_total_time
= 0,
256 // Time to initialize offload descriptor
257 c_offload_target_descriptor_setup
,
259 // Time to find target entry point in lookup table
260 c_offload_target_func_lookup
,
262 // Total time spend executing offload entry
263 c_offload_target_func_time
,
265 // Time to initialize target variables with IN values from buffer
266 c_offload_target_scatter_inputs
,
268 // Time to add buffer reference for pointer buffers
269 c_offload_target_add_buffer_refs
,
271 // Total time on lrb for computation
272 c_offload_target_compute
,
274 // On lrb, time to copy OUT into buffer
275 c_offload_target_gather_outputs
,
277 // Time to release buffer references
278 c_offload_target_release_buffer_refs
,
281 c_offload_target_max_phase
287 #define DLL_LOCAL __attribute__((visibility("hidden")))
293 DLL_LOCAL
void __liboffload_error_support(error_types input_tag
, ...);
294 DLL_LOCAL
void __liboffload_report_support(error_types input_tag
, ...);
295 DLL_LOCAL
char const *offload_get_message_str(int msgCode
);
296 DLL_LOCAL
char const * report_get_message_str(error_types input_tag
);
297 DLL_LOCAL
char const * report_get_host_stage_str(int i
);
298 DLL_LOCAL
char const * report_get_target_stage_str(int i
);
303 #define test_msg_cat(nm, msg) \
304 fprintf(stderr, "\t TEST for %s \n \t", nm); \
305 __liboffload_error_support(msg);
307 #define test_msg_cat1(nm, msg, ...) \
308 fprintf(stderr, "\t TEST for %s \n \t", nm); \
309 __liboffload_error_support(msg, __VA_ARGS__);
311 DLL_LOCAL
void write_message(FILE * file
, int msgCode
, va_list args_p
);
313 #define LIBOFFLOAD_ERROR __liboffload_error_support
316 #define LIBOFFLOAD_ABORT \
317 _set_abort_behavior(0, _WRITE_ABORT_MSG); \
320 #define LIBOFFLOAD_ABORT \
324 #endif // !defined(LIBOFFLOAD_ERROR_CODES_H)