Coverage Report

Created: 2019-07-03 22:50

/home/liu/buildslave/linux-x64-runtests/build/lib/nnc/ccv_nnc_internal.h
Line
Count
Source (jump to first uncovered line)
1
/**********************************************************
2
 * C-based/Cached/Core Computer Vision Library
3
 * Liu Liu, 2010-02-01
4
 **********************************************************/
5
6
/**********************************************************
7
 * CCV - Neural Network Collection
8
 **********************************************************/
9
10
#ifndef GUARD_ccv_nnc_internal_h
11
#define GUARD_ccv_nnc_internal_h
12
13
#include <ccv.h>
14
#include <ccv_internal.h>
15
#include <nnc/ccv_nnc.h>
16
17
// Define some internal constraints
18
19
#define CCV_NNC_STACK_BITMASK_ALLOC (2)
20
792
#define CCV_NNC_TENSOR_PLACEHOLDER ((ccv_nnc_tensor_t*)(intptr_t)(0x10))
21
22
typedef void (*ccv_nnc_cmd_tensor_auto_f)(const ccv_nnc_cmd_param_t cmd, const ccv_nnc_tensor_param_t* const inputs, const int input_size, const ccv_nnc_hint_t hint, ccv_nnc_tensor_param_t* const outputs, const int output_size);
23
typedef int (*ccv_nnc_cmd_bitmask_f)(const int input_size, const int output_size, const uint64_t* const input_bitmasks, const int input_bitmask_size, const uint64_t* const output_bitmasks, const int output_bitmask_size);
24
typedef int (*ccv_nnc_cmd_inplace_f)(const int input_idx, const int input_size, const int output_idx, const int output_size);
25
26
typedef struct {
27
  int flags;
28
  ccv_nnc_cmd_bitmask_f bitmask;
29
  ccv_nnc_cmd_tensor_auto_f tensor_auto;
30
  ccv_nnc_cmd_inplace_f allow_inplace;
31
  ccv_nnc_cmd_inplace_f enforce_inplace;
32
} ccv_nnc_cmd_registry_t;
33
34
typedef struct {
35
  int tensor_formats; /**< [formats] The supported formats for this API implementation. */
36
  int tensor_datatypes; /**< [datatypes] The supported data types for this API implementation. */
37
  int tensor_memory; /**< [memory] The supported tensor memory type for this API implementation. */
38
  int algorithms; /**< [algorithms] Number of algorithms variation. */
39
  ccv_nnc_cmd_exec_f exec;
40
  ccv_nnc_cmd_autotune_f autotune;
41
} ccv_nnc_cmd_backend_registry_t;
42
43
static inline int ccv_nnc_tensor_hw(const ccv_nnc_tensor_param_t a, const int nd)
44
642
{
45
642
  if ((a.format == CCV_TENSOR_FORMAT_CHWN) ||
46
642
    (a.format == CCV_TENSOR_FORMAT_NHWC && 
nd == 253
CCV_NNC_MAX_DIM253
+ 1))
47
83
    return 0;
48
559
  else if ((a.format == CCV_TENSOR_FORMAT_NHWC && 
nd == 170
CCV_NNC_MAX_DIM170
+ 2) ||
49
559
       
(389
a.format == CCV_TENSOR_FORMAT_NCHW389
&&
nd == 389
CCV_NNC_MAX_DIM389
+ 1))
50
172
    return 1;
51
387
  else if (a.format == CCV_TENSOR_FORMAT_NCHW && nd == CCV_NNC_MAX_DIM + 2)
52
387
    return 2;
53
0
  return -1;
54
0
}
Unexecuted instantiation: ccv_nnc_cmd.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_tensor.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_stream.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_graph.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph_backward.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph_while.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_graph_while.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_tensor_tape.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph_case_of.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_graph_case_of.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph_minimize.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph_parallel.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_symbolic_graph_simplify.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_graph_run.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_cnnp_dataframe.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_cnnp_dataframe_core.c:ccv_nnc_tensor_hw
ccv_cnnp_dataframe_addons.c:ccv_nnc_tensor_hw
Line
Count
Source
44
24
{
45
24
  if ((a.format == CCV_TENSOR_FORMAT_CHWN) ||
46
24
    (a.format == CCV_TENSOR_FORMAT_NHWC && nd == CCV_NNC_MAX_DIM + 1))
47
24
    return 0;
48
0
  else if ((a.format == CCV_TENSOR_FORMAT_NHWC && nd == CCV_NNC_MAX_DIM + 2) ||
49
0
       (a.format == CCV_TENSOR_FORMAT_NCHW && nd == CCV_NNC_MAX_DIM + 1))
50
0
    return 1;
51
0
  else if (a.format == CCV_TENSOR_FORMAT_NCHW && nd == CCV_NNC_MAX_DIM + 2)
52
0
    return 2;
53
0
  return -1;
54
0
}
Unexecuted instantiation: ccv_cnnp_model.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_cnnp_model_io.c:ccv_nnc_tensor_hw
ccv_cnnp_model_core.c:ccv_nnc_tensor_hw
Line
Count
Source
44
73
{
45
73
  if ((a.format == CCV_TENSOR_FORMAT_CHWN) ||
46
73
    (a.format == CCV_TENSOR_FORMAT_NHWC && 
nd == 24
CCV_NNC_MAX_DIM24
+ 1))
47
0
    return 0;
48
73
  else if ((a.format == CCV_TENSOR_FORMAT_NHWC && 
nd == 24
CCV_NNC_MAX_DIM24
+ 2) ||
49
73
       
(49
a.format == CCV_TENSOR_FORMAT_NCHW49
&&
nd == 49
CCV_NNC_MAX_DIM49
+ 1))
50
24
    return 1;
51
49
  else if (a.format == CCV_TENSOR_FORMAT_NCHW && nd == CCV_NNC_MAX_DIM + 2)
52
49
    return 2;
53
0
  return -1;
54
0
}
Unexecuted instantiation: ccv_nnc_categorical_crossentropy_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_reduce_sum_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_reduce_max_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_util_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_sgd_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_relu_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_softmax_crossentropy_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_softmax_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_conv_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_conv_cpu_opt.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_gemm_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_gemm_cpu_opt.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_add_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_mul_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_batch_norm_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_ew_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_rand_uniform_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_max_pool_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_avg_pool_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_dropout_cpu_ref.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_categorical_crossentropy.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_reduce.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_util.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_sgd.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_relu.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_softmax_crossentropy.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_softmax.c:ccv_nnc_tensor_hw
Unexecuted instantiation: _ccv_nnc_conv_cpu_4x4_3x3_winograd.c:ccv_nnc_tensor_hw
Unexecuted instantiation: _ccv_nnc_conv_cpu_fft.c:ccv_nnc_tensor_hw
Unexecuted instantiation: _ccv_nnc_conv_cpu_gemm.c:ccv_nnc_tensor_hw
Unexecuted instantiation: _ccv_nnc_conv_cpu_opt.c:ccv_nnc_tensor_hw
ccv_nnc_convolution.c:ccv_nnc_tensor_hw
Line
Count
Source
44
290
{
45
290
  if ((a.format == CCV_TENSOR_FORMAT_CHWN) ||
46
290
    (a.format == CCV_TENSOR_FORMAT_NHWC && 
nd == 106
CCV_NNC_MAX_DIM106
+ 1))
47
38
    return 0;
48
252
  else if ((a.format == CCV_TENSOR_FORMAT_NHWC && 
nd == 68
CCV_NNC_MAX_DIM68
+ 2) ||
49
252
       
(184
a.format == CCV_TENSOR_FORMAT_NCHW184
&&
nd == 184
CCV_NNC_MAX_DIM184
+ 1))
50
68
    return 1;
51
184
  else if (a.format == CCV_TENSOR_FORMAT_NCHW && nd == CCV_NNC_MAX_DIM + 2)
52
184
    return 2;
53
0
  return -1;
54
0
}
Unexecuted instantiation: _ccv_nnc_gemm_cpu_opt.c:ccv_nnc_tensor_hw
Unexecuted instantiation: _ccv_nnc_gemm_cpu_sys.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_blas.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_batch_norm.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_ew.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_comm.c:ccv_nnc_tensor_hw
Unexecuted instantiation: ccv_nnc_rand.c:ccv_nnc_tensor_hw
ccv_nnc_pool.c:ccv_nnc_tensor_hw
Line
Count
Source
44
255
{
45
255
  if ((a.format == CCV_TENSOR_FORMAT_CHWN) ||
46
255
    (a.format == CCV_TENSOR_FORMAT_NHWC && 
nd == 99
CCV_NNC_MAX_DIM99
+ 1))
47
21
    return 0;
48
234
  else if ((a.format == CCV_TENSOR_FORMAT_NHWC && 
nd == 78
CCV_NNC_MAX_DIM78
+ 2) ||
49
234
       
(156
a.format == CCV_TENSOR_FORMAT_NCHW156
&&
nd == 156
CCV_NNC_MAX_DIM156
+ 1))
50
80
    return 1;
51
154
  else if (a.format == CCV_TENSOR_FORMAT_NCHW && nd == CCV_NNC_MAX_DIM + 2)
52
154
    return 2;
53
0
  return -1;
54
0
}
Unexecuted instantiation: ccv_nnc_dropout.c:ccv_nnc_tensor_hw
55
56
static inline void ccv_nnc_hint_tensor_forward(const ccv_nnc_cmd_param_t cmd, const ccv_nnc_tensor_param_t a, const ccv_nnc_hint_t hint, ccv_nnc_tensor_param_t* b)
57
474
{
58
474
  int i;
59
474
  assert(a.format == b->format);
60
474
  const int nd = ccv_nnc_tensor_nd(a.dim);
61
474
  assert(nd == CCV_NNC_MAX_DIM + 1 || nd == CCV_NNC_MAX_DIM + 2);
62
474
  int hw = ccv_nnc_tensor_hw(a, nd);
63
474
  assert(hw >= 0);
64
1.42k
  
for (i = 0; 474
i < CCV_NNC_MAX_DIM;
i++948
)
65
948
  {
66
948
    int stride = ccv_max(1, hint.stride.dim[i]);
67
948
    b->dim[i + hw] = (a.dim[i + hw] + hint.border.begin[i] + hint.border.end[i] - cmd.size.dim[i]) / stride + 1;
68
948
  }
69
474
}
Unexecuted instantiation: ccv_nnc_cmd.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_tensor.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_stream.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_graph.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph_backward.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph_while.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_graph_while.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_tensor_tape.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph_case_of.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_graph_case_of.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph_minimize.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph_parallel.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_symbolic_graph_simplify.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_graph_run.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_cnnp_dataframe.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_cnnp_dataframe_core.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_cnnp_model.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_cnnp_model_io.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_cnnp_model_core.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_categorical_crossentropy_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_reduce_sum_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_reduce_max_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_util_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_sgd_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_relu_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_softmax_crossentropy_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_softmax_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_conv_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_conv_cpu_opt.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_gemm_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_gemm_cpu_opt.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_add_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_mul_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_batch_norm_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_ew_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_rand_uniform_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_max_pool_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_avg_pool_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_dropout_cpu_ref.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_categorical_crossentropy.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_reduce.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_util.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_sgd.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_relu.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_softmax_crossentropy.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_softmax.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: _ccv_nnc_conv_cpu_4x4_3x3_winograd.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: _ccv_nnc_conv_cpu_fft.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: _ccv_nnc_conv_cpu_gemm.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: _ccv_nnc_conv_cpu_opt.c:ccv_nnc_hint_tensor_forward
ccv_nnc_convolution.c:ccv_nnc_hint_tensor_forward
Line
Count
Source
57
290
{
58
290
  int i;
59
290
  assert(a.format == b->format);
60
290
  const int nd = ccv_nnc_tensor_nd(a.dim);
61
290
  assert(nd == CCV_NNC_MAX_DIM + 1 || nd == CCV_NNC_MAX_DIM + 2);
62
290
  int hw = ccv_nnc_tensor_hw(a, nd);
63
290
  assert(hw >= 0);
64
870
  
for (i = 0; 290
i < CCV_NNC_MAX_DIM;
i++580
)
65
580
  {
66
580
    int stride = ccv_max(1, hint.stride.dim[i]);
67
580
    b->dim[i + hw] = (a.dim[i + hw] + hint.border.begin[i] + hint.border.end[i] - cmd.size.dim[i]) / stride + 1;
68
580
  }
69
290
}
Unexecuted instantiation: _ccv_nnc_gemm_cpu_opt.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: _ccv_nnc_gemm_cpu_sys.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_blas.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_batch_norm.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_ew.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_comm.c:ccv_nnc_hint_tensor_forward
Unexecuted instantiation: ccv_nnc_rand.c:ccv_nnc_hint_tensor_forward
ccv_nnc_pool.c:ccv_nnc_hint_tensor_forward
Line
Count
Source
57
184
{
58
184
  int i;
59
184
  assert(a.format == b->format);
60
184
  const int nd = ccv_nnc_tensor_nd(a.dim);
61
184
  assert(nd == CCV_NNC_MAX_DIM + 1 || nd == CCV_NNC_MAX_DIM + 2);
62
184
  int hw = ccv_nnc_tensor_hw(a, nd);
63
184
  assert(hw >= 0);
64
552
  
for (i = 0; 184
i < CCV_NNC_MAX_DIM;
i++368
)
65
368
  {
66
368
    int stride = ccv_max(1, hint.stride.dim[i]);
67
368
    b->dim[i + hw] = (a.dim[i + hw] + hint.border.begin[i] + hint.border.end[i] - cmd.size.dim[i]) / stride + 1;
68
368
  }
69
184
}
Unexecuted instantiation: ccv_nnc_dropout.c:ccv_nnc_hint_tensor_forward
70
71
static inline void ccv_nnc_hint_tensor_backward(const ccv_nnc_cmd_param_t cmd, const ccv_nnc_tensor_param_t a, const ccv_nnc_hint_t hint, ccv_nnc_tensor_param_t* b)
72
71
{
73
71
  int i;
74
71
  assert(a.format == b->format);
75
71
  const int nd = ccv_nnc_tensor_nd(a.dim);
76
71
  assert(nd == CCV_NNC_MAX_DIM + 1 || nd == CCV_NNC_MAX_DIM + 2);
77
71
  int hw = ccv_nnc_tensor_hw(a, nd);
78
71
  assert(hw >= 0);
79
213
  
for (i = 0; 71
i < CCV_NNC_MAX_DIM;
i++142
)
80
142
  {
81
142
    int stride = ccv_max(1, hint.stride.dim[i]);
82
142
    b->dim[i + hw] = (a.dim[i + hw] - 1) * stride - hint.border.begin[i] - hint.border.end[i] + cmd.size.dim[i];
83
142
  }
84
71
}
Unexecuted instantiation: ccv_nnc_cmd.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_tensor.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_stream.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_graph.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph_backward.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph_while.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_graph_while.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_tensor_tape.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph_case_of.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_graph_case_of.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph_minimize.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph_parallel.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_symbolic_graph_simplify.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_graph_run.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_cnnp_dataframe.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_cnnp_dataframe_core.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_cnnp_model.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_cnnp_model_io.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_cnnp_model_core.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_categorical_crossentropy_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_reduce_sum_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_reduce_max_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_util_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_sgd_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_relu_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_softmax_crossentropy_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_softmax_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_conv_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_conv_cpu_opt.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_gemm_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_gemm_cpu_opt.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_add_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_mul_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_batch_norm_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_ew_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_rand_uniform_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_max_pool_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_avg_pool_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_dropout_cpu_ref.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_categorical_crossentropy.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_reduce.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_util.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_sgd.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_relu.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_softmax_crossentropy.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_softmax.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: _ccv_nnc_conv_cpu_4x4_3x3_winograd.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: _ccv_nnc_conv_cpu_fft.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: _ccv_nnc_conv_cpu_gemm.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: _ccv_nnc_conv_cpu_opt.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_convolution.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: _ccv_nnc_gemm_cpu_opt.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: _ccv_nnc_gemm_cpu_sys.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_blas.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_batch_norm.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_ew.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_comm.c:ccv_nnc_hint_tensor_backward
Unexecuted instantiation: ccv_nnc_rand.c:ccv_nnc_hint_tensor_backward
ccv_nnc_pool.c:ccv_nnc_hint_tensor_backward
Line
Count
Source
72
71
{
73
71
  int i;
74
71
  assert(a.format == b->format);
75
71
  const int nd = ccv_nnc_tensor_nd(a.dim);
76
71
  assert(nd == CCV_NNC_MAX_DIM + 1 || nd == CCV_NNC_MAX_DIM + 2);
77
71
  int hw = ccv_nnc_tensor_hw(a, nd);
78
71
  assert(hw >= 0);
79
213
  
for (i = 0; 71
i < CCV_NNC_MAX_DIM;
i++142
)
80
142
  {
81
142
    int stride = ccv_max(1, hint.stride.dim[i]);
82
142
    b->dim[i + hw] = (a.dim[i + hw] - 1) * stride - hint.border.begin[i] - hint.border.end[i] + cmd.size.dim[i];
83
142
  }
84
71
}
Unexecuted instantiation: ccv_nnc_dropout.c:ccv_nnc_hint_tensor_backward
85
86
void ccv_nnc_hint_tensor_auto_forward_from_inputs(const ccv_nnc_cmd_param_t cmd, const ccv_nnc_tensor_param_t* const inputs, const int input_size, const ccv_nnc_hint_t hint, ccv_nnc_tensor_param_t* const outputs, const int output_size);
87
void ccv_nnc_hint_tensor_auto_backward_from_gradient(const ccv_nnc_cmd_param_t cmd, const ccv_nnc_tensor_param_t* const inputs, const int input_size, const ccv_nnc_hint_t hint, ccv_nnc_tensor_param_t* const outputs, const int output_size);
88
void ccv_nnc_hint_tensor_auto_backward_from_inputs(const ccv_nnc_cmd_param_t cmd, const ccv_nnc_tensor_param_t* const inputs, const int input_size, const ccv_nnc_hint_t hint, ccv_nnc_tensor_param_t* const outputs, const int output_size);
89
int ccv_nnc_device_ids_for_io(ccv_nnc_tensor_t* const* const inputs, const int input_size, ccv_nnc_tensor_t* const* const outputs, const int output_size, int* const device_ids, const int max_device_id_size);
90
91
static inline off_t ccv_nnc_tensor_view_offset(const ccv_nnc_tensor_view_t* const tv, const int ofs[CCV_NNC_MAX_DIM_ALLOC])
92
69
{
93
69
  int i;
94
69
  off_t offset = 0;
95
69
  size_t inc = CCV_GET_DATA_TYPE_SIZE(tv->info.datatype);
96
69
  const int nd = ccv_nnc_tensor_nd(tv->inc);
97
192
  for (i = nd - 1; i >= 0; 
i--123
)
98
123
  {
99
123
    offset += ofs[i] * inc;
100
123
    inc *= tv->inc[i];
101
123
  }
102
69
  return offset;
103
69
}
Unexecuted instantiation: ccv_nnc_cmd.c:ccv_nnc_tensor_view_offset
ccv_nnc_tensor.c:ccv_nnc_tensor_view_offset
Line
Count
Source
92
69
{
93
69
  int i;
94
69
  off_t offset = 0;
95
69
  size_t inc = CCV_GET_DATA_TYPE_SIZE(tv->info.datatype);
96
69
  const int nd = ccv_nnc_tensor_nd(tv->inc);
97
192
  for (i = nd - 1; i >= 0; 
i--123
)
98
123
  {
99
123
    offset += ofs[i] * inc;
100
123
    inc *= tv->inc[i];
101
123
  }
102
69
  return offset;
103
69
}
Unexecuted instantiation: ccv_nnc_stream.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_graph.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph_backward.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph_while.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_graph_while.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_tensor_tape.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph_case_of.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_graph_case_of.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph_minimize.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph_parallel.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_symbolic_graph_simplify.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_graph_run.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_cnnp_dataframe.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_cnnp_dataframe_core.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_cnnp_model.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_cnnp_model_io.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_cnnp_model_core.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_categorical_crossentropy_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_reduce_sum_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_reduce_max_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_util_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_sgd_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_relu_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_softmax_crossentropy_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_softmax_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_conv_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_conv_cpu_opt.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_gemm_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_gemm_cpu_opt.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_add_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_mul_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_batch_norm_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_ew_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_rand_uniform_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_max_pool_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_avg_pool_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_dropout_cpu_ref.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_categorical_crossentropy.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_reduce.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_util.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_sgd.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_relu.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_softmax_crossentropy.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_softmax.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: _ccv_nnc_conv_cpu_4x4_3x3_winograd.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: _ccv_nnc_conv_cpu_fft.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: _ccv_nnc_conv_cpu_gemm.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: _ccv_nnc_conv_cpu_opt.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_convolution.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: _ccv_nnc_gemm_cpu_opt.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: _ccv_nnc_gemm_cpu_sys.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_blas.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_batch_norm.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_ew.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_comm.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_rand.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_pool.c:ccv_nnc_tensor_view_offset
Unexecuted instantiation: ccv_nnc_dropout.c:ccv_nnc_tensor_view_offset
104
105
static inline void ccv_array_add_unique_int(ccv_array_t* ints, const int idx)
106
29.4k
{
107
29.4k
  int i;
108
136k
  for (i = 0; i < ints->rnum; 
i++106k
)
109
108k
    if (*(int*)ccv_array_get(ints, i) == idx)
110
1.45k
      return;
111
29.4k
  ccv_array_push(ints, &idx);
112
27.9k
}
Unexecuted instantiation: ccv_nnc_cmd.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_tensor.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_stream.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_graph.c:ccv_array_add_unique_int
ccv_nnc_symbolic_graph.c:ccv_array_add_unique_int
Line
Count
Source
106
7.07k
{
107
7.07k
  int i;
108
10.1k
  for (i = 0; i < ints->rnum; 
i++3.08k
)
109
3.09k
    if (*(int*)ccv_array_get(ints, i) == idx)
110
14
      return;
111
7.07k
  ccv_array_push(ints, &idx);
112
7.06k
}
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:ccv_array_add_unique_int
ccv_nnc_symbolic_graph_compile.c:ccv_array_add_unique_int
Line
Count
Source
106
6.14k
{
107
6.14k
  int i;
108
6.83k
  for (i = 0; i < ints->rnum; 
i++685
)
109
687
    if (*(int*)ccv_array_get(ints, i) == idx)
110
2
      return;
111
6.14k
  ccv_array_push(ints, &idx);
112
6.14k
}
Unexecuted instantiation: ccv_nnc_symbolic_graph_backward.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_symbolic_graph_while.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_graph_while.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_tensor_tape.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_symbolic_graph_case_of.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_graph_case_of.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_symbolic_graph_minimize.c:ccv_array_add_unique_int
ccv_nnc_symbolic_graph_parallel.c:ccv_array_add_unique_int
Line
Count
Source
106
1.01k
{
107
1.01k
  int i;
108
100k
  for (i = 0; i < ints->rnum; 
i++99.6k
)
109
100k
    if (*(int*)ccv_array_get(ints, i) == idx)
110
429
      return;
111
1.01k
  ccv_array_push(ints, &idx);
112
585
}
Unexecuted instantiation: ccv_nnc_symbolic_graph_simplify.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_graph_run.c:ccv_array_add_unique_int
ccv_nnc_dynamic_graph.c:ccv_array_add_unique_int
Line
Count
Source
106
15.1k
{
107
15.1k
  int i;
108
18.2k
  for (i = 0; i < ints->rnum; 
i++3.08k
)
109
4.08k
    if (*(int*)ccv_array_get(ints, i) == idx)
110
1.00k
      return;
111
15.1k
  ccv_array_push(ints, &idx);
112
14.1k
}
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_cnnp_dataframe.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_cnnp_dataframe_core.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:ccv_array_add_unique_int
ccv_cnnp_model.c:ccv_array_add_unique_int
Line
Count
Source
106
23
{
107
23
  int i;
108
113
  for (i = 0; i < ints->rnum; 
i++90
)
109
90
    if (*(int*)ccv_array_get(ints, i) == idx)
110
0
      return;
111
23
  ccv_array_push(ints, &idx);
112
23
}
Unexecuted instantiation: ccv_cnnp_model_io.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_cnnp_model_core.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_categorical_crossentropy_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_reduce_sum_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_reduce_max_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_util_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_sgd_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_relu_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_softmax_crossentropy_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_softmax_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_conv_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_conv_cpu_opt.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_gemm_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_gemm_cpu_opt.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_add_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_mul_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_batch_norm_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_ew_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_rand_uniform_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_max_pool_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_avg_pool_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_dropout_cpu_ref.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_categorical_crossentropy.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_reduce.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_util.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_sgd.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_relu.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_softmax_crossentropy.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_softmax.c:ccv_array_add_unique_int
Unexecuted instantiation: _ccv_nnc_conv_cpu_4x4_3x3_winograd.c:ccv_array_add_unique_int
Unexecuted instantiation: _ccv_nnc_conv_cpu_fft.c:ccv_array_add_unique_int
Unexecuted instantiation: _ccv_nnc_conv_cpu_gemm.c:ccv_array_add_unique_int
Unexecuted instantiation: _ccv_nnc_conv_cpu_opt.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_convolution.c:ccv_array_add_unique_int
Unexecuted instantiation: _ccv_nnc_gemm_cpu_opt.c:ccv_array_add_unique_int
Unexecuted instantiation: _ccv_nnc_gemm_cpu_sys.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_blas.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_batch_norm.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_ew.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_comm.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_rand.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_pool.c:ccv_array_add_unique_int
Unexecuted instantiation: ccv_nnc_dropout.c:ccv_array_add_unique_int
113
114
static inline void ccv_array_add_unique_uint(ccv_array_t* ints, const uint32_t idx)
115
1.36k
{
116
1.36k
  int i;
117
4.46k
  for (i = 0; i < ints->rnum; 
i++3.10k
)
118
3.62k
    if (*(uint32_t*)ccv_array_get(ints, i) == idx)
119
520
      return;
120
1.36k
  ccv_array_push(ints, &idx);
121
840
}
Unexecuted instantiation: ccv_nnc_cmd.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_tensor.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_stream.c:ccv_array_add_unique_uint
ccv_nnc_graph.c:ccv_array_add_unique_uint
Line
Count
Source
115
1.36k
{
116
1.36k
  int i;
117
4.46k
  for (i = 0; i < ints->rnum; 
i++3.10k
)
118
3.62k
    if (*(uint32_t*)ccv_array_get(ints, i) == idx)
119
520
      return;
120
1.36k
  ccv_array_push(ints, &idx);
121
840
}
Unexecuted instantiation: ccv_nnc_symbolic_graph.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_symbolic_graph_compile.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_symbolic_graph_backward.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_symbolic_graph_while.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_graph_while.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_tensor_tape.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_symbolic_graph_case_of.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_graph_case_of.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_symbolic_graph_minimize.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_symbolic_graph_parallel.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_symbolic_graph_simplify.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_graph_run.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_cnnp_dataframe.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_cnnp_dataframe_core.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_cnnp_model.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_cnnp_model_io.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_cnnp_model_core.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_categorical_crossentropy_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_reduce_sum_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_reduce_max_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_util_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_sgd_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_relu_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_softmax_crossentropy_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_softmax_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_conv_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_conv_cpu_opt.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_gemm_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_gemm_cpu_opt.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_add_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_mul_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_batch_norm_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_ew_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_rand_uniform_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_max_pool_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_avg_pool_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_dropout_cpu_ref.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_categorical_crossentropy.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_reduce.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_util.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_sgd.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_relu.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_softmax_crossentropy.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_softmax.c:ccv_array_add_unique_uint
Unexecuted instantiation: _ccv_nnc_conv_cpu_4x4_3x3_winograd.c:ccv_array_add_unique_uint
Unexecuted instantiation: _ccv_nnc_conv_cpu_fft.c:ccv_array_add_unique_uint
Unexecuted instantiation: _ccv_nnc_conv_cpu_gemm.c:ccv_array_add_unique_uint
Unexecuted instantiation: _ccv_nnc_conv_cpu_opt.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_convolution.c:ccv_array_add_unique_uint
Unexecuted instantiation: _ccv_nnc_gemm_cpu_opt.c:ccv_array_add_unique_uint
Unexecuted instantiation: _ccv_nnc_gemm_cpu_sys.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_blas.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_batch_norm.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_ew.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_comm.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_rand.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_pool.c:ccv_array_add_unique_uint
Unexecuted instantiation: ccv_nnc_dropout.c:ccv_array_add_unique_uint
122
123
#ifdef __cplusplus
124
#define REGISTER_COMMAND_BACKEND(x, y) extern "C" void _register_command_ ## x ## _backend_ ## y
125
#define REGISTER_COMMAND(x) extern "C" void _register_command_ ## x
126
#else
127
#define REGISTER_COMMAND_BACKEND(x, y) void _register_command_ ## x ## _backend_ ## y
128
#define REGISTER_COMMAND(x) void _register_command_ ## x
129
#endif
130
#define FIND_BACKEND(...)
131
#define FIND_FILE(...)
132
133
// x is the dimension.
134
// n[x] is the start point for the filter on y axis, so that we can avoid computing the padding.
135
// m[x] shows how long we should loop for filter on y axis, avoid computing the padding too.
136
#define SET_BORDER_OFFSET_SIZE_FOR(x, i, hint, wd, ad, n, m) \
137
121M
  do { \
138
121M
    n[x] = ccv_max(i[x] * hint.stride.dim[x] - hint.border.begin[x], 0) - (i[x] * hint.stride.dim[x] - hint.border.begin[x]); \
139
121M
    m[x] = (wd)[x] - n[x] - (i[x] * hint.stride.dim[x] - hint.border.begin[x] + (wd)[x] - ccv_min(ad[x], i[x] * hint.stride.dim[x] - hint.border.begin[x] + (wd)[x])); \
140
121M
  } while (0)
141
142
// Defines common graph visit macros
143
144
// The visitor function / macro takes parameter visitor(node_type* node, int index, int term);
145
#define CCV_NNC_GRAPH_VISIT(_graph, nodes, node_size, sources, source_size, destinations, destination_size, allow_subset, visitor) \
146
8.64k
  
do 15
{ \
147
8.64k
    /* Use the same data structure to do topological ordering. */ \
148
8.64k
    typedef struct { \
149
8.64k
      int8_t d; /* tag if this is the destination node. */ \
150
8.64k
      int8_t r; /* tag if this is reached as destination node. */ \
151
8.64k
      uint16_t c; /* number of incoming edges. */ \
152
8.64k
      int32_t edges; /* pointer to incoming edges list. */ \
153
8.64k
    } ccv_nnc_incoming_t; \
154
8.64k
    int _i_, _j_; \
155
8.64k
    /* Statistics of how many incoming edges for all nodes of a graph. */ \
156
8.64k
    int _incoming_edges_ = 0; \
157
1.41M
    for (_i_ = 0; _i_ < (node_size); 
_i_++1.40M
) /* assuming it is all reached */ \
158
1.40M
      _incoming_edges_ += ((nodes)[_i_].outgoings) ? 
(nodes)[_i_].outgoings->rnum1.03M
:
0362k
; \
159
8.64k
    const int _heap_mem_ = (node_size + _incoming_edges_ > 1024); \
160
8.64k
    ccv_nnc_incoming_t* _incomings_; \
161
8.64k
    if (_heap_mem_) \
162
8.64k
      
_incomings_ = (ccv_nnc_incoming_t*)3.45k
ccmalloc3.45k
(sizeof(ccv_nnc_incoming_t) * (node_size) + sizeof(int32_t) * ((node_size) * 2 + _incoming_edges_)); \
163
8.64k
    else \
164
8.64k
      
_incomings_ = (ccv_nnc_incoming_t*)alloca5.18k
(sizeof(ccv_nnc_incoming_t) * (node_size) + sizeof(int32_t) * ((node_size) * 2 + _incoming_edges_)); \
165
8.64k
    memset(_incomings_, 0, sizeof(ccv_nnc_incoming_t) * (node_size)); \
166
8.64k
    int32_t* _exists_[2] = { \
167
8.64k
      (int32_t*)(_incomings_ + (node_size)), \
168
8.64k
      (int32_t*)(_incomings_ + (node_size)) + (node_size), \
169
8.64k
    }; \
170
8.64k
    int32_t* const _edges_ = _exists_[1] + (node_size); \
171
27.7k
    for (_i_ = 0; _i_ < (source_size); 
_i_++19.0k
) \
172
19.0k
    { \
173
19.0k
      assert((sources)[_i_].graph == _graph); \
174
19.0k
      _exists_[0][_i_] = (sources)[_i_].d; \
175
19.0k
    } \
176
8.64k
    int _exist_size_[2] = { \
177
8.64k
      (source_size), \
178
8.64k
      0, \
179
8.64k
    }; \
180
8.64k
    int _p_ = 0, _q_ = 1; /* ping, pong swap. */ \
181
8.64k
    /* Gather statistics. */ \
182
115k
    while (_exist_size_[_p_] > 0) \
183
106k
    { \
184
106k
      _exist_size_[_q_] = 0; \
185
2.54M
      for (_i_ = 0; _i_ < _exist_size_[_p_]; 
_i_++2.43M
) \
186
2.43M
      { \
187
2.43M
        const int32_t _idx_ = _exists_[_p_][_i_]; \
188
2.43M
        if (_incomings_[_idx_].r == 1) \
189
2.43M
          
continue1.04M
; \
190
2.43M
        _incomings_[_idx_].r = 1; \
191
1.39M
        /* mark as not reached */ \
192
1.39M
        if ((nodes)[_idx_].outgoings) \
193
3.44M
          
for (_j_ = 0; 1.03M
_j_ < (nodes)[_idx_].outgoings->rnum;
_j_++2.41M
) \
194
2.41M
          { \
195
2.41M
            const int d = *(int*)ccv_array_get((nodes)[_idx_].outgoings, _j_); \
196
2.41M
            ++_incomings_[d].c; \
197
2.41M
            _exists_[_q_][_exist_size_[_q_]] = d; \
198
2.41M
            ++_exist_size_[_q_]; \
199
2.41M
          } \
200
1.39M
      } \
201
106k
      /* swap p and q. */ \
202
106k
      CCV_SWAP(_p_, _q_, _i_ /* using i as temp holder */); \
203
106k
    } \
204
8.64k
    /* Fill incoming edges. */ \
205
27.7k
    for (_i_ = 0; _i_ < (source_size); 
_i_++19.0k
) \
206
19.0k
    { \
207
19.0k
      assert((sources)[_i_].graph == _graph); \
208
19.0k
      _exists_[0][_i_] = (sources)[_i_].d; \
209
19.0k
    } \
210
8.64k
    _exist_size_[0] = (source_size); \
211
8.64k
    _exist_size_[1] = 0; \
212
8.64k
    _p_ = 0, _q_ = 1; /* ping, pong swap. */ \
213
8.64k
    int _bump_ = 1; \
214
115k
    while (_exist_size_[_p_] > 0) \
215
106k
    { \
216
106k
      _exist_size_[_q_] = 0; \
217
2.54M
      for (_i_ = 0; _i_ < _exist_size_[_p_]; 
_i_++2.43M
) \
218
2.43M
      { \
219
2.43M
        const int32_t _idx_ = _exists_[_p_][_i_]; \
220
2.43M
        if (_incomings_[_idx_].r == 2) \
221
2.43M
          
continue1.04M
; \
222
2.43M
        _incomings_[_idx_].r = 2; \
223
1.39M
        /* mark as not reached */ \
224
1.39M
        if ((nodes)[_idx_].outgoings) \
225
3.44M
          
for (_j_ = 0; 1.03M
_j_ < (nodes)[_idx_].outgoings->rnum;
_j_++2.41M
) \
226
2.41M
          { \
227
2.41M
            const int d = *(int*)ccv_array_get((nodes)[_idx_].outgoings, _j_); \
228
2.41M
            if (_incomings_[d].edges == 0) \
229
2.41M
            { \
230
1.37M
              _incomings_[d].edges = _bump_; \
231
1.37M
              _bump_ += _incomings_[d].c; \
232
1.37M
              _incomings_[d].c = 0; \
233
1.37M
            } \
234
2.41M
            _edges_[_incomings_[d].edges - 1 + _incomings_[d].c] = _idx_; \
235
2.41M
            ++_incomings_[d].c; \
236
2.41M
            _exists_[_q_][_exist_size_[_q_]] = d; \
237
2.41M
            ++_exist_size_[_q_]; \
238
2.41M
          } \
239
1.39M
      } \
240
106k
      /* swap p and q. */ \
241
106k
      CCV_SWAP(_p_, _q_, _i_ /* using i as temp holder */); \
242
106k
    } \
243
8.64k
    /* Traverse back and mark r if it can be marked */ \
244
370k
    for (_i_ = 0; _i_ < (destination_size); 
_i_++362k
) \
245
362k
    { \
246
362k
      assert((destinations)[_i_].graph == _graph); \
247
362k
      _exists_[0][_i_] = (destinations)[_i_].d; \
248
362k
    } \
249
8.64k
    _exist_size_[0] = (destination_size); \
250
8.64k
    _exist_size_[1] = 0; \
251
8.64k
    _p_ = 0, _q_ = 1; /* ping, pong swap. */ \
252
57.8k
    while (_exist_size_[_p_] > 0) \
253
49.1k
    { \
254
49.1k
      _exist_size_[_q_] = 0; \
255
2.80M
      for (_i_ = 0; _i_ < _exist_size_[_p_]; 
_i_++2.75M
) \
256
2.75M
      { \
257
2.75M
        const int32_t _idx_ = _exists_[_p_][_i_]; \
258
2.75M
        if (_incomings_[_idx_].r != 2) /* If cannot be traversed in forward pass, cannot in backward pass. */ \
259
2.75M
          
continue1.37M
; \
260
2.75M
        _incomings_[_idx_].r = 3; \
261
1.38M
        /* mark as not reached */ \
262
1.38M
        if (_incomings_[_idx_].edges > 0) \
263
3.76M
          
for (_j_ = 0; 1.36M
_j_ < _incomings_[_idx_].c;
_j_++2.39M
) \
264
2.39M
          { \
265
2.39M
            const int d = _edges_[_incomings_[_idx_].edges - 1 + _j_]; \
266
2.39M
            _exists_[_q_][_exist_size_[_q_]] = d; \
267
2.39M
            ++_exist_size_[_q_]; \
268
2.39M
          } \
269
1.38M
      } \
270
49.1k
      /* swap p and q. */ \
271
49.1k
      CCV_SWAP(_p_, _q_, _i_ /* using i as temp holder */); \
272
49.1k
    } \
273
370k
    for (_i_ = 0; _i_ < (destination_size); 
_i_++362k
) \
274
362k
    { \
275
362k
      assert((destinations)[_i_].graph == _graph); \
276
362k
      /* tagging destination nodes. */ \
277
362k
      _incomings_[(destinations)[_i_].d].d = 1; \
278
362k
    } \
279
27.7k
    
for (_i_ = 0; 8.64k
_i_ < (source_size);
_i_++19.0k
) \
280
19.0k
    { \
281
19.0k
      assert((sources)[_i_].graph == _graph); \
282
19.0k
      _exists_[0][_i_] = (sources)[_i_].d; \
283
19.0k
    } \
284
8.64k
    _p_ = 0; \
285
8.64k
    _q_ = 1; \
286
8.64k
    _exist_size_[0] = (source_size); \
287
8.64k
    _exist_size_[1] = 0; \
288
8.64k
    int _d_ = 0; \
289
8.64k
    /* After we have that statistics, we can do topsort and run the command. */ \
290
194k
    while (_exist_size_[_p_] > 0) \
291
185k
    { \
292
185k
      _exist_size_[_q_] = 0; \
293
1.57M
      for (_i_ = 0; _i_ < _exist_size_[_p_];) \
294
1.38M
      { \
295
1.38M
        const int32_t _idx_ = _exists_[_p_][_i_]; \
296
1.38M
        visitor(((nodes) + _idx_), (_idx_), (_incomings_[_idx_].d)); \
297
1.38M
        /* mark as reached */ \
298
1.38M
        if (_incomings_[_idx_].d) \
299
1.38M
        { \
300
362k
          ++_d_; \
301
362k
          _incomings_[_idx_].r = 4; \
302
362k
        } \
303
1.38M
        if ((nodes)[_idx_].outgoings) \
304
1.38M
        { \
305
1.02M
          if ((nodes)[_idx_].outgoings->rnum == 1) \
306
1.02M
          { \
307
253k
            /* Optimizing for the case have only one child. Go through that directly. */ \
308
253k
            const int d = *(int*)ccv_array_get((nodes)[_idx_].outgoings, 0); \
309
253k
            --_incomings_[d].c; \
310
253k
            if (_incomings_[d].c == 0 && 
_incomings_[d].r == 3242k
&&
_d_ < (destination_size)242k
) \
311
253k
            { \
312
242k
              _exists_[_p_][_i_] = d; \
313
242k
              continue; \
314
242k
            } \
315
253k
          } else \
316
2.91M
            
for (_j_ = 0; 770k
_j_ < (nodes)[_idx_].outgoings->rnum;
_j_++2.14M
) \
317
2.14M
            { \
318
2.14M
              const int d = *(int*)ccv_array_get((nodes)[_idx_].outgoings, _j_); \
319
2.14M
              --_incomings_[d].c; \
320
2.14M
              /* If all incoming edges are consumed, and not all destination node are computed, push it into next round */ \
321
2.14M
              if (_incomings_[d].c == 0 && 
_incomings_[d].r == 31.12M
&&
_d_ < (destination_size)1.12M
) \
322
2.14M
              { \
323
1.12M
                _exists_[_q_][_exist_size_[_q_]] = d; \
324
1.12M
                ++_exist_size_[_q_]; \
325
1.12M
              } \
326
2.14M
            } \
327
1.02M
        } \
328
1.38M
        ++_i_; \
329
1.14M
      } \
330
185k
      /* swap p and q. */ \
331
185k
      CCV_SWAP(_p_, _q_, _i_ /* using i as temp holder */); \
332
185k
    } \
333
370k
    for (_i_ = 0; _i_ < (destination_size); 
_i_++362k
) \
334
362k
    { \
335
362k
      assert((destinations)[_i_].graph == _graph); \
336
362k
      /* skip if this is already reached. */ \
337
362k
      if (_incomings_[(destinations)[_i_].d].r == 4) \
338
362k
        continue; \
339
362k
      /* this destination node should have every incoming nodes consumed. */ \
340
362k
      
if (0
!(allow_subset)0
) \
341
0
        { assert(_incomings_[(destinations)[_i_].d].c == 0); } \
342
0
      else if (_incomings_[(destinations)[_i_].d].c > 0) /* Otherwise if incoming is not satisfied, no need to execute (allow subset to get executed, that is). */ \
343
0
        continue; \
344
0
      /* fetch the info for destination node and exec current node. */ \
345
0
      visitor(((nodes) + (destinations)[_i_].d), ((destinations)[_i_].d), (_incomings_[(destinations)[_i_].d].d)); \
346
0
    } \
347
8.64k
    if (_heap_mem_) \
348
8.64k
      
ccfree3.45k
(_incomings_)3.45k
; \
349
8.64k
  } while (0);
350
351
typedef struct {
352
  int size;
353
  struct {
354
    int index;
355
    int term;
356
  } node[1];
357
} ccv_nnc_graph_visit_t;
358
359
static inline void ccv_nnc_graph_visit_free(ccv_nnc_graph_visit_t* graph_visit)
360
8.00k
{
361
8.00k
  ccfree(graph_visit);
362
8.00k
}
Unexecuted instantiation: ccv_nnc_cmd.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_tensor.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_stream.c:ccv_nnc_graph_visit_free
ccv_nnc_graph.c:ccv_nnc_graph_visit_free
Line
Count
Source
360
1.22k
{
361
1.22k
  ccfree(graph_visit);
362
1.22k
}
ccv_nnc_symbolic_graph.c:ccv_nnc_graph_visit_free
Line
Count
Source
360
3.43k
{
361
3.43k
  ccfree(graph_visit);
362
3.43k
}
Unexecuted instantiation: ccv_nnc_symbolic_graph_io.c:ccv_nnc_graph_visit_free
ccv_nnc_symbolic_graph_compile.c:ccv_nnc_graph_visit_free
Line
Count
Source
360
1.19k
{
361
1.19k
  ccfree(graph_visit);
362
1.19k
}
ccv_nnc_symbolic_graph_backward.c:ccv_nnc_graph_visit_free
Line
Count
Source
360
2.12k
{
361
2.12k
  ccfree(graph_visit);
362
2.12k
}
Unexecuted instantiation: ccv_nnc_symbolic_graph_while.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_graph_while.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_tensor_tape.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_symbolic_graph_case_of.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_graph_case_of.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_symbolic_graph_minimize.c:ccv_nnc_graph_visit_free
ccv_nnc_symbolic_graph_parallel.c:ccv_nnc_graph_visit_free
Line
Count
Source
360
5
{
361
5
  ccfree(graph_visit);
362
5
}
ccv_nnc_symbolic_graph_simplify.c:ccv_nnc_graph_visit_free
Line
Count
Source
360
27
{
361
27
  ccfree(graph_visit);
362
27
}
Unexecuted instantiation: ccv_nnc_graph_run.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_dynamic_graph.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_dynamic_graph_backward.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_dynamic_graph_minimize.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_cnnp_dataframe.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_cnnp_dataframe_core.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_cnnp_dataframe_addons.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_cnnp_model.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_cnnp_model_io.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_cnnp_model_core.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_categorical_crossentropy_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_reduce_sum_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_reduce_max_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_util_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_sgd_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_relu_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_softmax_crossentropy_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_softmax_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_conv_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_conv_cpu_opt.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_gemm_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_gemm_cpu_opt.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_add_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_mul_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_batch_norm_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_ew_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_rand_uniform_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_max_pool_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_avg_pool_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_dropout_cpu_ref.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_categorical_crossentropy.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_reduce.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_util.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_sgd.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_relu.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_softmax_crossentropy.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_softmax.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: _ccv_nnc_conv_cpu_4x4_3x3_winograd.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: _ccv_nnc_conv_cpu_fft.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: _ccv_nnc_conv_cpu_gemm.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: _ccv_nnc_conv_cpu_opt.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_convolution.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: _ccv_nnc_gemm_cpu_opt.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: _ccv_nnc_gemm_cpu_sys.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_blas.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_batch_norm.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_ew.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_comm.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_rand.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_pool.c:ccv_nnc_graph_visit_free
Unexecuted instantiation: ccv_nnc_dropout.c:ccv_nnc_graph_visit_free
363
364
24.3k
#define CCV_NNC_GRAPH_VISIT_FOR1(graph_visit, nodes, _node_, _index_, _term_, ...) { \
365
24.3k
  int _i_; \
366
159k
  for (_i_ = 0; _i_ < (graph_visit)->size; 
_i_++135k
) { \
367
135k
    const int _index_ __attribute__((unused)) = (graph_visit)->node[_i_].index; \
368
135k
    const int _term_ __attribute__((unused)) = (graph_visit)->node[_i_].term; \
369
135k
    typeof ((nodes)) const _node_ __attribute__((unused)) = (nodes) + _index_; \
370
371
#define ccv_nnc_graph_visit_for(graph_visit, nodes, ...) \
372
24.3k
  CCV_NNC_GRAPH_VISIT_FOR1(graph_visit, nodes, ##__VA_ARGS__, _node_unused_, _index_unused_, _term_unused_)
373
374
133k
#define ccv_nnc_graph_visit_endfor } }
375
376
#define CCV_NNC_GRAPH_VISIT_NEW_VISITOR1(_, _index_, _term_) \
377
1.37M
  _visit_->node[_visit_->size].index = (_index_); \
378
1.37M
  _visit_->node[_visit_->size].term = (_term_); \
379
1.37M
  ++_visit_->size;
380
381
8.00k
#define ccv_nnc_graph_visit_new(_graph, nodes, node_size, sources, source_size, destinations, destination_size, allow_subset) ({\
382
8.00k
  ccv_nnc_graph_visit_t* _visit_ = (ccv_nnc_graph_visit_t*)ccmalloc(sizeof(ccv_nnc_graph_visit_t) + sizeof(_visit_->node[0]) * ((node_size) - 1)); \
383
8.00k
  _visit_->size = 0; \
384
1.37M
  
CCV_NNC_GRAPH_VISIT8.00k
(_graph, nodes, node_size, sources, source_size, destinations, destination_size, allow_subset, CCV_NNC_GRAPH_VISIT_NEW_VISITOR1); \
385
8.00k
  assert(_visit_->size <= (node_size)); \
386
8.00k
  _visit_; \
387
8.00k
})
388
389
#endif