SHL 2.2.x
Loading...
Searching...
No Matches
shl_debug.h
1/*
2 * Copyright (C) 2016-2023 T-Head Semiconductor Co., Ltd. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19/* SHL version 2.2.x */
20#ifndef INCLUDE_SHL_DEBUG_H_
21#define INCLUDE_SHL_DEBUG_H_
22#include "csi_nn.h"
23#include "shl_node.h"
24
25enum shl_debug_enum {
26 SHL_DEBUG_LEVEL_DEBUG = -2,
27 SHL_DEBUG_LEVEL_INFO,
28 SHL_DEBUG_LEVEL_WARNING,
29 SHL_DEBUG_LEVEL_ERROR,
30 SHL_DEBUG_LEVEL_FATAL,
31};
32
33#ifdef SHL_DEBUG
34#define SHL_DEBUG_CALL(func) func
35void shl_debug_debug(const char *format, ...);
36void shl_debug_info(const char *format, ...);
37void shl_debug_warning(const char *format, ...);
38void shl_debug_error(const char *format, ...);
39void shl_debug_fatal(const char *format, ...);
40int shl_debug_callback_unset();
41#else
42#define SHL_DEBUG_CALL(func)
43inline void shl_debug_debug(const char *format, ...) {}
44inline void shl_debug_info(const char *format, ...) {}
45inline void shl_debug_warning(const char *format, ...) {}
46inline void shl_debug_error(const char *format, ...) {}
47inline void shl_debug_fatal(const char *format, ...) {}
48inline int shl_debug_callback_unset() { return CSINN_CALLBACK_UNSET; }
49#endif
50
51int shl_debug_get_level();
52void shl_debug_set_level(int level);
53int shl_benchmark_layer(struct shl_node *node, uint64_t start_time, uint64_t end_time,
54 int layer_idx);
55int shl_dump_output_tensor(struct shl_node *node);
56
57int shl_conv2d_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
58 struct csinn_tensor *kernel, struct csinn_tensor *bias,
59 struct csinn_conv2d_params *params, const char *name);
60
61int shl_conv1d_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
62 struct csinn_tensor *kernel, struct csinn_tensor *bias,
63 struct csinn_conv1d_params *params, const char *name);
64
65int shl_conv3d_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
66 struct csinn_tensor *kernel, struct csinn_tensor *bias,
67 struct csinn_conv3d_params *params, const char *name);
68
69int shl_fsmn_debug_info(struct csinn_tensor *frame, struct csinn_tensor *l_filter,
70 struct csinn_tensor *r_filter, struct csinn_tensor *frame_sequence,
71 struct csinn_tensor *frame_counter, struct csinn_tensor *output,
72 struct csinn_fsmn_params *params, const char *name);
73
74int shl_siso_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
75 struct csinn_siso_params *params, const char *name);
76
77int shl_diso_debug_info(struct csinn_tensor *input0, struct csinn_tensor *input1,
78 struct csinn_tensor *output, struct csinn_diso_params *params,
79 const char *name);
80
81int shl_relu_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
82 struct csinn_relu_params *params, const char *name);
83
84int shl_arange_debug_info(struct csinn_tensor *output, struct csinn_arange_params *params,
85 const char *name);
86
87int shl_pool_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
88 struct csinn_pool_params *params, const char *name);
89
90int shl_pad_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
91 struct csinn_pad_params *params, const char *name);
92
93int shl_crop_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
94 struct csinn_crop_params *params, const char *name);
95
96int shl_roi_pool_debug_info(struct csinn_tensor *data, struct csinn_tensor *rois,
97 struct csinn_tensor *output, struct csinn_roi_pool_params *params,
98 const char *name);
99
100int shl_bn_debug_info(struct csinn_tensor *input, struct csinn_tensor *mean,
101 struct csinn_tensor *variance, struct csinn_tensor *gamma,
102 struct csinn_tensor *beta, struct csinn_tensor *output,
103 struct csinn_bn_params *params, const char *name);
104
105int shl_batch_to_space_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
106 struct csinn_batch_to_space_params *params, const char *name);
107
108int shl_batch_to_space_nd_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
109 struct csinn_batch_to_space_nd_params *params,
110 const char *name);
111
112int shl_cache_matmul_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
113 struct csinn_tensor *weight, struct csinn_tensor *bias,
114 struct csinn_cache_matmul_params *params, const char *name);
115
116int shl_cache_conv1d_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
117 struct csinn_tensor *weight, struct csinn_tensor *bias,
118 struct csinn_cache_conv1d_params *params, const char *name);
119
120int shl_space_to_depth_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
121 struct csinn_space_to_depth_params *params, const char *name);
122
123int shl_depth_to_space_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
124 struct csinn_depth_to_space_params *params, const char *name);
125
126int shl_space_to_batch_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
127 struct csinn_space_to_batch_params *params, const char *name);
128
129int shl_space_to_batch_nd_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
130 struct csinn_space_to_batch_nd_params *params,
131 const char *name);
132
133int shl_broadcast_to_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
134 struct csinn_broadcast_to_params *params, const char *name);
135
136int shl_reduce_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
137 struct csinn_reduce_params *params, const char *name);
138
139int shl_clip_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
140 struct csinn_clip_params *params, const char *name);
141
142int shl_col2im_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
143 struct csinn_col2im_params *params, const char *name);
144
145int shl_concat_debug_info(struct csinn_tensor **input, struct csinn_tensor *output,
146 struct csinn_concat_params *params, const char *name);
147
148int shl_cumprod_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
149 struct csinn_cumprod_params *params, const char *name);
150
151int shl_cumsum_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
152 struct csinn_cumsum_params *params, const char *name);
153
154int shl_expand_dims_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
155 struct csinn_expand_dims_params *params, const char *name);
156
157int shl_flatten_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
158 struct csinn_flatten_params *params, const char *name);
159
160int shl_fullyconnected_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
161 struct csinn_tensor *weights, struct csinn_tensor *bias,
162 struct csinn_fc_params *params, const char *name);
163
164int shl_gather_nd_debug_info(struct csinn_tensor *input, struct csinn_tensor *indices,
165 struct csinn_tensor *output, struct csinn_gather_nd_params *params,
166 const char *name);
167
168int shl_gather_debug_info(struct csinn_tensor *input, struct csinn_tensor *indices,
169 struct csinn_tensor *output, struct csinn_gather_params *params,
170 const char *name);
171
172int shl_hard_sigmoid_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
173 struct csinn_sigmoid_params *params, const char *name);
174
175int shl_im2col_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
176 struct csinn_im2col_params *params, const char *name);
177
178int shl_l2n_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
179 struct csinn_l2n_params *params, const char *name);
180
181int shl_layer_norm_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
182 struct csinn_tensor *gamma, struct csinn_tensor *beta,
183 struct csinn_layer_norm_params *params, const char *name);
184
185int shl_softmax_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
186 struct csinn_softmax_params *params, const char *name);
187
188int shl_lrn_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
189 struct csinn_lrn_params *params, const char *name);
190
191int shl_matmul_debug_info(struct csinn_tensor *mat0, struct csinn_tensor *mat1,
192 struct csinn_tensor *output, struct csinn_matmul_params *params,
193 const char *name);
194
195int shl_ndarray_size_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
196 struct csinn_ndarray_size_params *params, const char *name);
197
198int shl_nms_debug_info(struct csinn_tensor *input0, struct csinn_tensor *input1,
199 struct csinn_tensor *output, struct csinn_non_max_suppression_params *params,
200 const char *name);
201
202int shl_one_hot_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
203 struct csinn_one_hot_params *params, const char *name);
204
205int shl_prelu_debug_info(struct csinn_tensor *input0, struct csinn_tensor *input1,
206 struct csinn_tensor *output, struct csinn_prelu_params *params,
207 const char *name);
208
209int shl_proposal_debug_info(struct csinn_tensor *cls_prob, struct csinn_tensor *bbox_pred,
210 struct csinn_tensor *im_info, struct csinn_tensor *output,
211 struct csinn_proposal_params *params, const char *name);
212
213int shl_psroipooling_debug_info(struct csinn_tensor *data, struct csinn_tensor *rois,
214 struct csinn_tensor *output,
215 struct csinn_psroipooling_params *params, const char *name);
216
217int shl_reorg_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
218 struct csinn_reorg_params *params, const char *name);
219
220int shl_reshape_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
221 struct csinn_reshape_params *params, const char *name);
222
223int shl_resize_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
224 struct csinn_resize_params *params, const char *name);
225
226int shl_reverse_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
227 struct csinn_reverse_params *params, const char *name);
228
229int shl_roi_align_debug_info(struct csinn_tensor *data, struct csinn_tensor *rois,
230 struct csinn_tensor *output, struct csinn_roi_align_params *params,
231 const char *name);
232
233int shl_scatter_nd_debug_info(struct csinn_tensor *input, struct csinn_tensor *indices,
234 struct csinn_tensor *updates, struct csinn_tensor *output,
235 struct csinn_scatter_nd_params *params, const char *name);
236
237int shl_segment_debug_info(struct csinn_tensor *input0, struct csinn_tensor *input1,
238 struct csinn_tensor *output, struct csinn_segment_params *params,
239 const char *name);
240
241int shl_select_debug_info(struct csinn_tensor *condition, struct csinn_tensor *input0,
242 struct csinn_tensor *input1, struct csinn_tensor *output,
243 struct csinn_select_params *params, const char *name);
244
245int shl_sequence_mask_debug_info(struct csinn_tensor *input0, struct csinn_tensor *input1,
246 struct csinn_tensor *output,
247 struct csinn_sequence_mask_params *params, const char *name);
248
249int shl_shape_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
250 struct csinn_shape_params *params, const char *name);
251
252int shl_shuffle_channel_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
253 struct csinn_shuffle_channel_params *params, const char *name);
254
255int shl_sigmoid_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
256 struct csinn_sigmoid_params *params, const char *name);
257
258int shl_slice_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
259 struct csinn_slice_params *params, const char *name);
260
261int shl_split_debug_info(struct csinn_tensor *input, struct csinn_tensor **output,
262 struct csinn_split_params *params, const char *name);
263
264int shl_squeeze_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
265 struct csinn_squeeze_params *params, const char *name);
266
267int shl_stack_debug_info(struct csinn_tensor **input, struct csinn_tensor *output,
268 struct csinn_stack_params *params, const char *name);
269
270int shl_strided_slice_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
271 struct csinn_strided_slice_params *params, const char *name);
272
273int shl_tile_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
274 struct csinn_tile_params *params, const char *name);
275
276int shl_topk_debug_info(struct csinn_tensor *input0, struct csinn_tensor *input1,
277 struct csinn_tensor *output, struct csinn_topk_params *params,
278 const char *name);
279
280int shl_transpose_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
281 struct csinn_transpose_params *params, const char *name);
282
283int shl_unpooling_debug_info(struct csinn_tensor *input, struct csinn_tensor *mask,
284 struct csinn_tensor *output, struct csinn_unpooling_params *params,
285 const char *name);
286
287int shl_unstack_debug_info(struct csinn_tensor *input, struct csinn_tensor **output,
288 struct csinn_unstack_params *params, const char *name);
289
290int shl_where_debug_info(struct csinn_tensor *condition, struct csinn_tensor *x,
291 struct csinn_tensor *y, struct csinn_tensor *output,
292 struct csinn_where_params *params, const char *name);
293
294int shl_where_softmax_debug_info(struct csinn_tensor *condition, struct csinn_tensor *y,
295 struct csinn_tensor *output,
296 struct csinn_where_softmax_params *params, const char *name);
297
298int shl_cast_debug_info(struct csinn_tensor *input, struct csinn_tensor *output,
299 struct csinn_cast_params *params, const char *name);
300
301#endif // INCLUDE_SHL_DEBUG_H_
@ CSINN_CALLBACK_UNSET
Definition: csinn_data_structure.h:427
Definition: csinn_data_structure.h:893
Definition: csinn_data_structure.h:969
Definition: csinn_data_structure.h:959
Definition: csinn_data_structure.h:705
Definition: csinn_data_structure.h:1074
Definition: csinn_data_structure.h:1117
Definition: csinn_data_structure.h:1081
Definition: csinn_data_structure.h:1024
Definition: csinn_data_structure.h:780
Definition: csinn_data_structure.h:1162
Definition: csinn_data_structure.h:553
Definition: csinn_data_structure.h:575
Definition: csinn_data_structure.h:854
Definition: csinn_data_structure.h:1067
Definition: csinn_data_structure.h:1060
Definition: csinn_data_structure.h:984
Definition: csinn_data_structure.h:753
Definition: csinn_data_structure.h:837
Definition: csinn_data_structure.h:596
Definition: csinn_data_structure.h:849
Definition: csinn_data_structure.h:543
Definition: csinn_data_structure.h:924
Definition: csinn_data_structure.h:919
Definition: csinn_data_structure.h:1011
Definition: csinn_data_structure.h:715
Definition: csinn_data_structure.h:727
Definition: csinn_data_structure.h:746
Definition: csinn_data_structure.h:936
Definition: csinn_data_structure.h:1109
Definition: csinn_data_structure.h:991
Definition: csinn_data_structure.h:763
Definition: csinn_data_structure.h:605
Definition: csinn_data_structure.h:686
Definition: csinn_data_structure.h:787
Definition: csinn_data_structure.h:808
Definition: csinn_data_structure.h:1033
Definition: csinn_data_structure.h:676
Definition: csinn_data_structure.h:1047
Definition: csinn_data_structure.h:825
Definition: csinn_data_structure.h:773
Definition: csinn_data_structure.h:843
Definition: csinn_data_structure.h:636
Definition: csinn_data_structure.h:649
Definition: csinn_data_structure.h:666
Definition: csinn_data_structure.h:1053
Definition: csinn_data_structure.h:758
Definition: csinn_data_structure.h:1002
Definition: csinn_data_structure.h:832
Definition: csinn_data_structure.h:1097
Definition: csinn_data_structure.h:671
Definition: csinn_data_structure.h:661
Definition: csinn_data_structure.h:862
Definition: csinn_data_structure.h:692
Definition: csinn_data_structure.h:951
Definition: csinn_data_structure.h:941
Definition: csinn_data_structure.h:978
Definition: csinn_data_structure.h:871
Definition: csinn_data_structure.h:929
Definition: csinn_data_structure.h:879
Definition: csinn_data_structure.h:1088
Definition: csinn_data_structure.h:475
Definition: csinn_data_structure.h:886
Definition: csinn_data_structure.h:1103
Definition: csinn_data_structure.h:818
Definition: csinn_data_structure.h:627
Definition: csinn_data_structure.h:912
Definition: csinn_data_structure.h:907
Definition: csinn_data_structure.h:698