mxnet
Classes | Macros | Typedefs | Enumerations | Functions
Dnnl_api_primitives_common
Collaboration diagram for Dnnl_api_primitives_common:

Classes

struct  dnnl_exec_arg_t
 
struct  dnnl_primitive_desc_iterator
 An opaque structure to describe a primitive descriptor iterator. More...
 
struct  dnnl_primitive_desc
 An opaque structure to describe a primitive descriptor. More...
 
struct  dnnl_primitive
 

Macros

#define DNNL_ARG_SRC_0   1
 Source argument #0. More...
 
#define DNNL_ARG_SRC   DNNL_ARG_SRC_0
 
#define DNNL_ARG_SRC_LAYER   DNNL_ARG_SRC_0
 
#define DNNL_ARG_FROM   DNNL_ARG_SRC_0
 
#define DNNL_ARG_SRC_1   2
 Source argument #1. More...
 
#define DNNL_ARG_SRC_ITER   DNNL_ARG_SRC_1
 
#define DNNL_ARG_SRC_2   3
 Source argument #2. More...
 
#define DNNL_ARG_SRC_ITER_C   DNNL_ARG_SRC_2
 
#define DNNL_ARG_DST_0   17
 Destination argument #0. More...
 
#define DNNL_ARG_DST   DNNL_ARG_DST_0
 
#define DNNL_ARG_TO   DNNL_ARG_DST_0
 
#define DNNL_ARG_DST_LAYER   DNNL_ARG_DST_0
 A special mnemonic for RNN output vector. An alias for DNNL_ARG_DST_0. More...
 
#define DNNL_ARG_DST_1   18
 Destination argument #1. More...
 
#define DNNL_ARG_DST_ITER   DNNL_ARG_DST_1
 
#define DNNL_ARG_DST_2   19
 Destination argument #2. More...
 
#define DNNL_ARG_DST_ITER_C   DNNL_ARG_DST_2
 
#define DNNL_ARG_WEIGHTS_0   33
 Weights argument #0. More...
 
#define DNNL_ARG_WEIGHTS   DNNL_ARG_WEIGHTS_0
 
#define DNNL_ARG_SCALE_SHIFT   DNNL_ARG_WEIGHTS_0
 
#define DNNL_ARG_WEIGHTS_LAYER   DNNL_ARG_WEIGHTS_0
 
#define DNNL_ARG_WEIGHTS_1   34
 Weights argument #1. More...
 
#define DNNL_ARG_WEIGHTS_ITER   DNNL_ARG_WEIGHTS_1
 
#define DNNL_ARG_WEIGHTS_2   35
 Weights argument #2. More...
 
#define DNNL_ARG_WEIGHTS_PEEPHOLE   DNNL_ARG_WEIGHTS_2
 
#define DNNL_ARG_WEIGHTS_3   36
 Weights argument #3. More...
 
#define DNNL_ARG_WEIGHTS_PROJECTION   DNNL_ARG_WEIGHTS_3
 
#define DNNL_ARG_BIAS   41
 Bias tensor argument. More...
 
#define DNNL_ARG_MEAN   49
 Mean values tensor argument. More...
 
#define DNNL_ARG_VARIANCE   50
 Variance values tensor argument. More...
 
#define DNNL_ARG_WORKSPACE   64
 
#define DNNL_ARG_SCRATCHPAD   80
 Scratchpad (temporary storage) tensor argument. More...
 
#define DNNL_ARG_DIFF_SRC_0   129
 Gradient (diff) of the source argument #0. More...
 
#define DNNL_ARG_DIFF_SRC   DNNL_ARG_DIFF_SRC_0
 
#define DNNL_ARG_DIFF_SRC_LAYER   DNNL_ARG_DIFF_SRC_0
 
#define DNNL_ARG_DIFF_SRC_1   130
 Gradient (diff) of the source argument #1. More...
 
#define DNNL_ARG_DIFF_SRC_ITER   DNNL_ARG_DIFF_SRC_1
 
#define DNNL_ARG_DIFF_SRC_2   131
 Gradient (diff) of the source argument #2. More...
 
#define DNNL_ARG_DIFF_SRC_ITER_C   DNNL_ARG_DIFF_SRC_2
 
#define DNNL_ARG_DIFF_DST_0   145
 Gradient (diff) of the destination argument #0. More...
 
#define DNNL_ARG_DIFF_DST   DNNL_ARG_DIFF_DST_0
 
#define DNNL_ARG_DIFF_DST_LAYER   DNNL_ARG_DIFF_DST_0
 
#define DNNL_ARG_DIFF_DST_1   146
 Gradient (diff) of the destination argument #1. More...
 
#define DNNL_ARG_DIFF_DST_ITER   DNNL_ARG_DIFF_DST_1
 
#define DNNL_ARG_DIFF_DST_2   147
 Gradient (diff) of the destination argument #2. More...
 
#define DNNL_ARG_DIFF_DST_ITER_C   DNNL_ARG_DIFF_DST_2
 
#define DNNL_ARG_DIFF_WEIGHTS_0   161
 Gradient (diff) of the weights argument #0. More...
 
#define DNNL_ARG_DIFF_WEIGHTS   DNNL_ARG_DIFF_WEIGHTS_0
 
#define DNNL_ARG_DIFF_SCALE_SHIFT   DNNL_ARG_DIFF_WEIGHTS_0
 
#define DNNL_ARG_DIFF_WEIGHTS_LAYER   DNNL_ARG_DIFF_WEIGHTS_0
 
#define DNNL_ARG_DIFF_WEIGHTS_1   162
 Gradient (diff) of the weights argument #1. More...
 
#define DNNL_ARG_DIFF_WEIGHTS_ITER   DNNL_ARG_DIFF_WEIGHTS_1
 
#define DNNL_ARG_DIFF_WEIGHTS_2   163
 Gradient (diff) of the weights argument #2. More...
 
#define DNNL_ARG_DIFF_WEIGHTS_PEEPHOLE   DNNL_ARG_DIFF_WEIGHTS_2
 
#define DNNL_ARG_DIFF_WEIGHTS_3   164
 Gradient (diff) of the weights argument #3. More...
 
#define DNNL_ARG_DIFF_WEIGHTS_PROJECTION   DNNL_ARG_DIFF_WEIGHTS_3
 
#define DNNL_ARG_DIFF_BIAS   169
 Gradient (diff) of the bias tensor argument. More...
 
#define DNNL_ARG_ATTR_OUTPUT_SCALES   513
 Output scaling factors provided at execution time. More...
 
#define DNNL_ARG_MULTIPLE_SRC   1024
 
#define DNNL_ARG_MULTIPLE_DST   2048
 
#define DNNL_ARG_ATTR_ZERO_POINTS   4096
 Zero points provided at execution time. More...
 
#define DNNL_ARG_ATTR_POST_OP_DW   8192
 

Typedefs

typedef void * dnnl_op_desc_t
 A pointer to any of the operation descriptors. More...
 
typedef const void * const_dnnl_op_desc_t
 A pointer to any of the operation descriptors (constant variant). More...
 
typedef struct dnnl_primitive_desc_iteratordnnl_primitive_desc_iterator_t
 A primitive descriptor iterator handle. More...
 
typedef const struct dnnl_primitive_desc_iteratorconst_dnnl_primitive_desc_iterator_t
 A constant primitive descriptor iterator handle. More...
 
typedef struct dnnl_primitive_descdnnl_primitive_desc_t
 A primitive descriptor handle. More...
 
typedef const struct dnnl_primitive_descconst_dnnl_primitive_desc_t
 A constant primitive descriptor handle. More...
 
typedef struct dnnl_primitivednnl_primitive_t
 A primitive handle. More...
 
typedef const struct dnnl_primitiveconst_dnnl_primitive_t
 A constant primitive handle. More...
 

Enumerations

enum  dnnl_prop_kind_t {
  dnnl_prop_kind_undef = 0, dnnl_forward_training = 64, dnnl_forward_inference = 96, dnnl_forward_scoring = dnnl_forward_inference,
  dnnl_forward = dnnl_forward_training, dnnl_backward = 128, dnnl_backward_data = 160, dnnl_backward_weights = 192,
  dnnl_backward_bias = 193
}
 Kinds of propagation. More...
 
enum  dnnl_primitive_kind_t {
  dnnl_undefined_primitive, dnnl_reorder, dnnl_shuffle, dnnl_concat,
  dnnl_sum, dnnl_convolution, dnnl_deconvolution, dnnl_eltwise,
  dnnl_softmax, dnnl_pooling, dnnl_lrn, dnnl_batch_normalization,
  dnnl_layer_normalization, dnnl_inner_product, dnnl_rnn, dnnl_gemm,
  dnnl_binary, dnnl_logsoftmax, dnnl_matmul, dnnl_resampling,
  dnnl_primitive_kind_max = 0x7fff
}
 
enum  dnnl_alg_kind_t {
  dnnl_alg_kind_undef, dnnl_convolution_direct = 0x1, dnnl_convolution_winograd = 0x2, dnnl_convolution_auto = 0x3,
  dnnl_deconvolution_direct = 0xa, dnnl_deconvolution_winograd = 0xb, dnnl_eltwise_relu = 0x1f, dnnl_eltwise_tanh = 0x2f,
  dnnl_eltwise_elu = 0x3f, dnnl_eltwise_square = 0x4f, dnnl_eltwise_abs = 0x5f, dnnl_eltwise_sqrt = 0x6f,
  dnnl_eltwise_linear = 0x7f, dnnl_eltwise_bounded_relu = 0x8f, dnnl_eltwise_soft_relu = 0x9f, dnnl_eltwise_logistic = 0xaf,
  dnnl_eltwise_exp = 0xbf, dnnl_eltwise_gelu_tanh = 0xcf, dnnl_eltwise_gelu = dnnl_eltwise_gelu_tanh, dnnl_eltwise_swish = 0xdf,
  dnnl_eltwise_log = 0xef, dnnl_eltwise_clip = 0xff, dnnl_eltwise_pow = 0x20, dnnl_eltwise_gelu_erf = 0x30,
  dnnl_eltwise_round = 0x40, dnnl_eltwise_relu_use_dst_for_bwd = 0x100, dnnl_eltwise_tanh_use_dst_for_bwd = 0x101, dnnl_eltwise_elu_use_dst_for_bwd = 0x102,
  dnnl_eltwise_sqrt_use_dst_for_bwd = 0x103, dnnl_eltwise_logistic_use_dst_for_bwd = 0x104, dnnl_eltwise_exp_use_dst_for_bwd = 0x105, dnnl_pooling_max = 0x1ff,
  dnnl_pooling_avg_include_padding = 0x2ff, dnnl_pooling_avg_exclude_padding = 0x3ff, dnnl_pooling_avg = dnnl_pooling_avg_exclude_padding, dnnl_lrn_across_channels = 0xaff,
  dnnl_lrn_within_channel = 0xbff, dnnl_vanilla_rnn = 0x1fff, dnnl_vanilla_lstm = 0x2fff, dnnl_vanilla_gru = 0x3fff,
  dnnl_lbr_gru = 0x4fff, dnnl_binary_add = 0x1fff0, dnnl_binary_mul = 0x1fff1, dnnl_binary_max = 0x1fff2,
  dnnl_binary_min = 0x1fff3, dnnl_resampling_nearest = 0x2fff0, dnnl_resampling_linear = 0x2fff1
}
 Kinds of algorithms. More...
 
enum  dnnl_normalization_flags_t { dnnl_normalization_flags_none = 0x0U, dnnl_use_global_stats = 0x1U, dnnl_use_scaleshift = 0x2U, dnnl_fuse_norm_relu = 0x4U }
 Flags for normalization primitives. More...
 
enum  dnnl_query_t {
  dnnl_query_undef = 0, dnnl_query_engine, dnnl_query_primitive_kind, dnnl_query_num_of_inputs_s32,
  dnnl_query_num_of_outputs_s32, dnnl_query_time_estimate_f64, dnnl_query_memory_consumption_s64, dnnl_query_scratchpad_engine,
  dnnl_query_impl_info_str, dnnl_query_reorder_src_engine, dnnl_query_reorder_dst_engine, dnnl_query_prop_kind,
  dnnl_query_some_d = 64, dnnl_query_op_d, dnnl_query_convolution_d, dnnl_query_deconvolution_d,
  dnnl_query_shuffle_d, dnnl_query_eltwise_d, dnnl_query_softmax_d, dnnl_query_pooling_d,
  dnnl_query_lrn_d, dnnl_query_batch_normalization_d, dnnl_query_layer_normalization_d, dnnl_query_inner_product_d,
  dnnl_query_rnn_d, dnnl_query_gemm_d, dnnl_query_binary_d, dnnl_query_logsoftmax_d,
  dnnl_query_matmul_d, dnnl_query_resampling_d, dnnl_query_some_md = 128, dnnl_query_src_md,
  dnnl_query_diff_src_md, dnnl_query_weights_md, dnnl_query_diff_weights_md, dnnl_query_dst_md,
  dnnl_query_diff_dst_md, dnnl_query_workspace_md, dnnl_query_scratchpad_md, dnnl_query_exec_arg_md = 255,
  dnnl_query_max = 0x7fff
}
 

Functions

dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_create (dnnl_primitive_desc_iterator_t *iterator, const_dnnl_op_desc_t op_desc, const_dnnl_primitive_attr_t attr, dnnl_engine_t engine, const_dnnl_primitive_desc_t hint_forward_primitive_desc)
 
dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_next (dnnl_primitive_desc_iterator_t iterator)
 
dnnl_primitive_desc_t DNNL_API dnnl_primitive_desc_iterator_fetch (const_dnnl_primitive_desc_iterator_t iterator)
 
dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_destroy (dnnl_primitive_desc_iterator_t iterator)
 
dnnl_status_t DNNL_API dnnl_primitive_desc_create (dnnl_primitive_desc_t *primitive_desc, const_dnnl_op_desc_t op_desc, const_dnnl_primitive_attr_t attr, dnnl_engine_t engine, const_dnnl_primitive_desc_t hint_forward_primitive_desc)
 
dnnl_status_t DNNL_API dnnl_primitive_desc_clone (dnnl_primitive_desc_t *primitive_desc, const_dnnl_primitive_desc_t existing_primitive_desc)
 
dnnl_status_t DNNL_API dnnl_primitive_desc_get_attr (const_dnnl_primitive_desc_t primitive_desc, const_dnnl_primitive_attr_t *attr)
 
dnnl_status_t DNNL_API dnnl_primitive_desc_destroy (dnnl_primitive_desc_t primitive_desc)
 
dnnl_status_t DNNL_API dnnl_primitive_desc_query (const_dnnl_primitive_desc_t primitive_desc, dnnl_query_t what, int index, void *result)
 
const dnnl_memory_desc_t DNNL_API * dnnl_primitive_desc_query_md (const_dnnl_primitive_desc_t primitive_desc, dnnl_query_t what, int index)
 
int DNNL_API dnnl_primitive_desc_query_s32 (const_dnnl_primitive_desc_t primitive_desc, dnnl_query_t what, int index)
 
dnnl_status_t DNNL_API dnnl_primitive_create (dnnl_primitive_t *primitive, const_dnnl_primitive_desc_t primitive_desc)
 
dnnl_status_t DNNL_API dnnl_primitive_execute (const_dnnl_primitive_t primitive, dnnl_stream_t stream, int nargs, const dnnl_exec_arg_t *args)
 
dnnl_status_t DNNL_API dnnl_primitive_get_primitive_desc (const_dnnl_primitive_t primitive, const_dnnl_primitive_desc_t *primitive_desc)
 
dnnl_status_t DNNL_API dnnl_primitive_destroy (dnnl_primitive_t primitive)
 

Detailed Description

Macro Definition Documentation

#define DNNL_ARG_ATTR_OUTPUT_SCALES   513

Output scaling factors provided at execution time.

#define DNNL_ARG_ATTR_POST_OP_DW   8192

Arguments for fused depthwise convolution. See dev_guide_attributes_post_ops_depthwise_fusion

#define DNNL_ARG_ATTR_ZERO_POINTS   4096

Zero points provided at execution time.

#define DNNL_ARG_BIAS   41

Bias tensor argument.

#define DNNL_ARG_DIFF_BIAS   169

Gradient (diff) of the bias tensor argument.

#define DNNL_ARG_DIFF_DST   DNNL_ARG_DIFF_DST_0

A special mnemonic for primitives that have a single diff destination argument. An alias for DNNL_ARG_DIFF_DST_0.

#define DNNL_ARG_DIFF_DST_0   145

Gradient (diff) of the destination argument #0.

#define DNNL_ARG_DIFF_DST_1   146

Gradient (diff) of the destination argument #1.

#define DNNL_ARG_DIFF_DST_2   147

Gradient (diff) of the destination argument #2.

#define DNNL_ARG_DIFF_DST_ITER   DNNL_ARG_DIFF_DST_1

A special mnemonic for gradient (diff) of RNN input recurrent hidden state vector. An alias for DNNL_ARG_DIFF_DST_1.

#define DNNL_ARG_DIFF_DST_ITER_C   DNNL_ARG_DIFF_DST_2

A special mnemonic for gradient (diff) of RNN input recurrent cell state vector. An alias for DNNL_ARG_DIFF_DST_2.

#define DNNL_ARG_DIFF_DST_LAYER   DNNL_ARG_DIFF_DST_0

A special mnemonic for gradient (diff) of RNN output vector. An alias for DNNL_ARG_DIFF_DST_0.

#define DNNL_ARG_DIFF_SCALE_SHIFT   DNNL_ARG_DIFF_WEIGHTS_0

A special mnemonic for diff of scale and shift argument of normalization primitives. Alias for DNNL_ARG_DIFF_WEIGHTS_0.

#define DNNL_ARG_DIFF_SRC   DNNL_ARG_DIFF_SRC_0

A special mnemonic for primitives that have a single diff source argument. An alias for DNNL_ARG_DIFF_SRC_0.

#define DNNL_ARG_DIFF_SRC_0   129

Gradient (diff) of the source argument #0.

#define DNNL_ARG_DIFF_SRC_1   130

Gradient (diff) of the source argument #1.

#define DNNL_ARG_DIFF_SRC_2   131

Gradient (diff) of the source argument #2.

#define DNNL_ARG_DIFF_SRC_ITER   DNNL_ARG_DIFF_SRC_1

A special mnemonic for gradient (diff) of RNN input recurrent hidden state vector. An alias for DNNL_ARG_DIFF_SRC_1.

#define DNNL_ARG_DIFF_SRC_ITER_C   DNNL_ARG_DIFF_SRC_2

A special mnemonic for gradient (diff) of RNN input recurrent cell state vector. An alias for DNNL_ARG_DIFF_SRC_1.

#define DNNL_ARG_DIFF_SRC_LAYER   DNNL_ARG_DIFF_SRC_0

A special mnemonic for gradient (diff) of RNN input vector. An alias for DNNL_ARG_DIFF_SRC_0.

#define DNNL_ARG_DIFF_WEIGHTS   DNNL_ARG_DIFF_WEIGHTS_0

A special mnemonic for primitives that have a single diff weights argument. Alias for DNNL_ARG_DIFF_WEIGHTS_0.

#define DNNL_ARG_DIFF_WEIGHTS_0   161

Gradient (diff) of the weights argument #0.

#define DNNL_ARG_DIFF_WEIGHTS_1   162

Gradient (diff) of the weights argument #1.

#define DNNL_ARG_DIFF_WEIGHTS_2   163

Gradient (diff) of the weights argument #2.

#define DNNL_ARG_DIFF_WEIGHTS_3   164

Gradient (diff) of the weights argument #3.

#define DNNL_ARG_DIFF_WEIGHTS_ITER   DNNL_ARG_DIFF_WEIGHTS_1

A special mnemonic for diff of RNN weights applied to the recurrent input. An alias for DNNL_ARG_DIFF_WEIGHTS_1.

#define DNNL_ARG_DIFF_WEIGHTS_LAYER   DNNL_ARG_DIFF_WEIGHTS_0

A special mnemonic for diff of RNN weights applied to the layer input. An alias for DNNL_ARG_DIFF_WEIGHTS_0.

#define DNNL_ARG_DIFF_WEIGHTS_PEEPHOLE   DNNL_ARG_DIFF_WEIGHTS_2

A special mnemonic for diff of RNN weights applied to the peephole weights. An alias for DNNL_ARG_DIFF_WEIGHTS_2.

#define DNNL_ARG_DIFF_WEIGHTS_PROJECTION   DNNL_ARG_DIFF_WEIGHTS_3

A special mnemonic for diff of RNN weights applied to the projection weights. An alias for DNNL_ARG_DIFF_WEIGHTS_3.

#define DNNL_ARG_DST   DNNL_ARG_DST_0

A special mnemonic for destination argument for primitives that have a single destination. An alias for DNNL_ARG_DST_0.

#define DNNL_ARG_DST_0   17

Destination argument #0.

#define DNNL_ARG_DST_1   18

Destination argument #1.

#define DNNL_ARG_DST_2   19

Destination argument #2.

#define DNNL_ARG_DST_ITER   DNNL_ARG_DST_1

A special mnemonic for RNN input recurrent hidden state vector. An alias for DNNL_ARG_DST_1.

#define DNNL_ARG_DST_ITER_C   DNNL_ARG_DST_2

A special mnemonic for LSTM output recurrent cell state vector. An alias for DNNL_ARG_DST_2.

#define DNNL_ARG_DST_LAYER   DNNL_ARG_DST_0

A special mnemonic for RNN output vector. An alias for DNNL_ARG_DST_0.

#define DNNL_ARG_FROM   DNNL_ARG_SRC_0

A special mnemonic for reorder source argument. An alias for DNNL_ARG_SRC_0.

#define DNNL_ARG_MEAN   49

Mean values tensor argument.

#define DNNL_ARG_MULTIPLE_DST   2048

Starting index for destination arguments for primitives that produce a variable number of destination arguments.

#define DNNL_ARG_MULTIPLE_SRC   1024

Starting index for source arguments for primitives that take a variable number of source arguments.

#define DNNL_ARG_SCALE_SHIFT   DNNL_ARG_WEIGHTS_0

A special mnemonic for scale and shift argument of normalization primitives. Alias for DNNL_ARG_WEIGHTS_0.

#define DNNL_ARG_SCRATCHPAD   80

Scratchpad (temporary storage) tensor argument.

#define DNNL_ARG_SRC   DNNL_ARG_SRC_0

A special mnemonic for source argument for primitives that have a single source. An alias for DNNL_ARG_SRC_0.

#define DNNL_ARG_SRC_0   1

Source argument #0.

#define DNNL_ARG_SRC_1   2

Source argument #1.

#define DNNL_ARG_SRC_2   3

Source argument #2.

#define DNNL_ARG_SRC_ITER   DNNL_ARG_SRC_1

A special mnemonic for RNN input recurrent hidden state vector. An alias for DNNL_ARG_SRC_1.

#define DNNL_ARG_SRC_ITER_C   DNNL_ARG_SRC_2

A special mnemonic for RNN input recurrent cell state vector. An alias for DNNL_ARG_SRC_2.

#define DNNL_ARG_SRC_LAYER   DNNL_ARG_SRC_0

A special mnemonic for RNN input vector. An alias for DNNL_ARG_SRC_0.

#define DNNL_ARG_TO   DNNL_ARG_DST_0

A special mnemonic for reorder destination argument. An alias for DNNL_ARG_DST_0.

#define DNNL_ARG_VARIANCE   50

Variance values tensor argument.

#define DNNL_ARG_WEIGHTS   DNNL_ARG_WEIGHTS_0

A special mnemonic for primitives that have a single weights argument. Alias for DNNL_ARG_WEIGHTS_0.

#define DNNL_ARG_WEIGHTS_0   33

Weights argument #0.

#define DNNL_ARG_WEIGHTS_1   34

Weights argument #1.

#define DNNL_ARG_WEIGHTS_2   35

Weights argument #2.

#define DNNL_ARG_WEIGHTS_3   36

Weights argument #3.

#define DNNL_ARG_WEIGHTS_ITER   DNNL_ARG_WEIGHTS_1

A special mnemonic for RNN weights applied to the recurrent input. An alias for DNNL_ARG_WEIGHTS_1.

#define DNNL_ARG_WEIGHTS_LAYER   DNNL_ARG_WEIGHTS_0

A special mnemonic for RNN weights applied to the layer input. An alias for DNNL_ARG_WEIGHTS_0.

#define DNNL_ARG_WEIGHTS_PEEPHOLE   DNNL_ARG_WEIGHTS_2

A special mnemonic for RNN weights applied to the peephole weights. An alias for DNNL_ARG_WEIGHTS_2.

#define DNNL_ARG_WEIGHTS_PROJECTION   DNNL_ARG_WEIGHTS_3

A special mnemonic for RNN weights applied to the projection weights. An alias for DNNL_ARG_WEIGHTS_3.

#define DNNL_ARG_WORKSPACE   64

Workspace tensor argument. Workspace is used to pass information from forward propagation to backward propagation computations.

Typedef Documentation

typedef const void* const_dnnl_op_desc_t

A pointer to any of the operation descriptors (constant variant).

A constant primitive descriptor iterator handle.

A constant primitive descriptor handle.

typedef const struct dnnl_primitive* const_dnnl_primitive_t

A constant primitive handle.

typedef void* dnnl_op_desc_t

A pointer to any of the operation descriptors.

A primitive descriptor iterator handle.

A primitive descriptor handle.

A primitive handle.

Enumeration Type Documentation

Kinds of algorithms.

Enumerator
dnnl_alg_kind_undef 
dnnl_convolution_direct 

Direct convolution.

dnnl_convolution_winograd 

Winograd convolution.

dnnl_convolution_auto 

Convolution algorithm(either direct or Winograd) is chosen just in time.

dnnl_deconvolution_direct 

Direct deconvolution.

dnnl_deconvolution_winograd 

Winograd deconvolution.

dnnl_eltwise_relu 

Eltwise: ReLU.

dnnl_eltwise_tanh 

Eltwise: hyperbolic tangent non-linearity (tanh)

dnnl_eltwise_elu 

Eltwise: exponential linear unit (elu)

dnnl_eltwise_square 

Eltwise: square.

dnnl_eltwise_abs 

Eltwise: abs.

dnnl_eltwise_sqrt 

Eltwise: square root.

dnnl_eltwise_linear 

Eltwise: linear.

dnnl_eltwise_bounded_relu 

Eltwise: bounded_relu.

dnnl_eltwise_soft_relu 

Eltwise: soft_relu.

dnnl_eltwise_logistic 

Eltwise: logistic.

dnnl_eltwise_exp 

Eltwise: exponent.

dnnl_eltwise_gelu_tanh 

Eltwise: gelu

@note Tanh approximation formula is used to approximate
the cumulative distribution function of a Gaussian here  
dnnl_eltwise_gelu 

Eltwise: tanh-based gelu (alias for dnnl_eltwise_gelu_tanh)

dnnl_eltwise_swish 

Eltwise: swish.

dnnl_eltwise_log 

Eltwise: natural logarithm.

dnnl_eltwise_clip 

Eltwise: clip.

dnnl_eltwise_pow 

Eltwise: pow.

dnnl_eltwise_gelu_erf 

Eltwise: erf-based gelu.

dnnl_eltwise_round 

Eltwise: round.

dnnl_eltwise_relu_use_dst_for_bwd 

Eltwise: ReLU (dst for backward)

dnnl_eltwise_tanh_use_dst_for_bwd 

Eltwise: hyperbolic tangent non-linearity (tanh) (dst for backward)

dnnl_eltwise_elu_use_dst_for_bwd 

Eltwise: exponential linear unit (elu) (dst for backward)

dnnl_eltwise_sqrt_use_dst_for_bwd 

Eltwise: square root (dst for backward)

dnnl_eltwise_logistic_use_dst_for_bwd 

Eltwise: logistic (dst for backward)

dnnl_eltwise_exp_use_dst_for_bwd 

Eltwise: exp (dst for backward)

dnnl_pooling_max 

Max pooling.

dnnl_pooling_avg_include_padding 

Average pooling include padding.

dnnl_pooling_avg_exclude_padding 

Average pooling exclude padding.

dnnl_pooling_avg 

Average pooling (alias for dnnl_pooling_avg_exclude_padding)

dnnl_lrn_across_channels 

Local response normalization (LRN) across multiple channels.

dnnl_lrn_within_channel 

LRN within a single channel.

dnnl_vanilla_rnn 

RNN cell.

dnnl_vanilla_lstm 

LSTM cell.

dnnl_vanilla_gru 

GRU cell.

dnnl_lbr_gru 

GRU cell with linear before reset

Modification of original GRU cell. Differs from #dnnl_vanilla_gru
in how the new memory gate is calculated:

\[ c_t = tanh(W_c*x_t + b_{c_x} + r_t*(U_c*h_{t-1}+b_{c_h})) \]

Primitive expects 4 biases on input: $[b_{u}, b_{r}, b_{c_x}, b_{c_h}]$

dnnl_binary_add 

Binary add.

dnnl_binary_mul 

Binary mul.

dnnl_binary_max 

Binary max.

dnnl_binary_min 

Binary min.

dnnl_resampling_nearest 

Nearest Neighbor Resampling Method.

dnnl_resampling_linear 

Linear Resampling Method.

Flags for normalization primitives.

Enumerator
dnnl_normalization_flags_none 

Use no normalization flags

If specified
 - on forward training propagation mean and variance are computed and
   stored as output
 - on backward propagation compute full derivative wrt data
 - on backward propagation prop_kind == #dnnl_backward_data has the same
   behavior as prop_kind == #dnnl_backward  
dnnl_use_global_stats 

Use global statistics

If specified
 - on forward propagation use mean and variance provided by user (input)
 - on backward propagation reduces the amount of computations, since
   mean and variance are considered as constants

 If not specified:
  - on forward propagation mean and variance are computed and stored as
    output
  - on backward propagation compute full derivative wrt data  
dnnl_use_scaleshift 

Use scale and shift parameters

If specified:
 - on forward propagation use scale and shift (aka scale and bias) for
   the batch normalization results
 - on backward propagation (for prop_kind == #dnnl_backward) compute
   diff wrt scale and shift (hence one extra output used)

If no specified:
 - on backward propagation prop_kind == #dnnl_backward_data has the
   same behavior as prop_kind == #dnnl_backward  
dnnl_fuse_norm_relu 

Fuse with ReLU

The flag implies negative slope being 0. On training this is the only
configuration supported. For inference, to use non-zero negative slope
consider using @ref dev_guide_attributes_post_ops.

If specified:
 - on inference this option behaves the same as if the primitive were
   fused with ReLU using post ops API with zero negative slope.
 - on training primitive requires workspace (required to be able to
   perform backward pass)  

Kinds of primitives. Used to implement a way to extend the library with new primitives without changing the ABI.

Enumerator
dnnl_undefined_primitive 

Undefined primitive.

dnnl_reorder 

A reorder primitive.

dnnl_shuffle 

A shuffle primitive.

dnnl_concat 

A (out-of-place) concat primitive.

dnnl_sum 

A sum primitive.

dnnl_convolution 

A convolution primitive.

dnnl_deconvolution 

A deconvolution primitive.

dnnl_eltwise 

An element-wise primitive.

dnnl_softmax 

A softmax primitive.

dnnl_pooling 

A pooling primitive.

dnnl_lrn 

An LRN primitive.

dnnl_batch_normalization 

A batch normalization primitive.

dnnl_layer_normalization 

A layer normalization primitive.

dnnl_inner_product 

An inner product primitive.

dnnl_rnn 

A rnn primitive.

dnnl_gemm 

A matrix multiplication primitive (internal).

dnnl_binary 

A binary primitive.

dnnl_logsoftmax 

A logsoftmax primitive.

dnnl_matmul 

A matrix multiplication primitive.

dnnl_resampling 

A resampling primitive.

dnnl_primitive_kind_max 

Parameter to allow internal only primitives without undefined behavior. This parameter is chosen to be valid for so long as sizeof(int) >= 2.

Kinds of propagation.

Enumerator
dnnl_prop_kind_undef 

Undefined propagation type.

dnnl_forward_training 

Forward data propagation (training mode). In this mode primitives perform computations necessary for subsequent backward propagation.

dnnl_forward_inference 

Forward data propagation (inference mode). In this mode primitives perform only computations that are necessary for inference and omit computations that are necessary only for backward propagation.

dnnl_forward_scoring 

Forward data propagation (alias for dnnl_forward_inference).

dnnl_forward 

Forward data propagation (alias for dnnl_forward_training).

dnnl_backward 

Backward propagation (with respect to all parameters).

dnnl_backward_data 

Backward data propagation.

dnnl_backward_weights 

Backward weights propagation.

dnnl_backward_bias 

Backward bias propagation.

Primitive descriptor query specification

For generic function dnnl_primitive_desc_query(), the type of result must agree with the queried argument. The correspondence table:

Query kind Type of query result
dnnl_query_engine dnnl_engine_t *
dnnl_query_scratchpad_engine dnnl_engine_t *
dnnl_query_primitive_kind dnnl_primitive_kind_t *
dnnl_query_*_s32 int *
dnnl_query_*_s64 dnnl_dim_t * (same as int64_t *)
dnnl_query_*_f64 double *
dnnl_query_*_str const char **
dnnl_query_op_d const_dnnl_op_desc_t *
dnnl_query_*_md const dnnl_memory_desc_t **
dnnl_query_*_<op>_d const dnnl_<op>_desc_t **
dnnl_query_*_pd const_dnnl_primitive_desc_t *
Note
Rule of thumb: all opaque types and structures are returned by reference. All numbers are returned by value.
Warning
All returned references point to constant objects and are valid only during the lifetime of the queried primitive descriptor. Returned objects must not be destroyed by the user. If you need to keep the object longer than the lifetime of the queried primitive descriptor, use dnnl_primitive_desc_clone() to make a copy.
Enumerator
dnnl_query_undef 

no query

dnnl_query_engine 

execution engine

dnnl_query_primitive_kind 

primitive kind

dnnl_query_num_of_inputs_s32 

number of inputs expected

dnnl_query_num_of_outputs_s32 

number of outputs expected

dnnl_query_time_estimate_f64 

runtime estimation (seconds)

dnnl_query_memory_consumption_s64 

memory consumption – extra

dnnl_query_scratchpad_engine 

(scratch) memory, additional to all inputs and outputs memory (bytes) scratchpad engine – engine to be used

dnnl_query_impl_info_str 

for creating scratchpad memory

implementation name

dnnl_query_reorder_src_engine 

source engine

dnnl_query_reorder_dst_engine 

destination engine

dnnl_query_prop_kind 

propagation kind

dnnl_query_some_d 

stub

dnnl_query_op_d 

op descriptor

dnnl_query_convolution_d 

convolution descriptor

dnnl_query_deconvolution_d 

deconvolution descriptor

dnnl_query_shuffle_d 

shuffle descriptor

dnnl_query_eltwise_d 

eltwise descriptor

dnnl_query_softmax_d 

softmax descriptor

dnnl_query_pooling_d 

pooling descriptor

dnnl_query_lrn_d 

lrn descriptor

dnnl_query_batch_normalization_d 

batch normalization descriptor

dnnl_query_layer_normalization_d 

layer normalization descriptor

dnnl_query_inner_product_d 

inner product descriptor

dnnl_query_rnn_d 

rnn descriptor

dnnl_query_gemm_d 

GEMM descriptor (internal)

dnnl_query_binary_d 

binary descriptor

dnnl_query_logsoftmax_d 

logsoftmax descriptor

dnnl_query_matmul_d 

matrix multiplication (matmul) descriptor

dnnl_query_resampling_d 

resampling descriptor

dnnl_query_some_md 

stub

dnnl_query_src_md 

source memory desc

dnnl_query_diff_src_md 

source gradient memory desc

dnnl_query_weights_md 

weights memory descriptor desc

dnnl_query_diff_weights_md 

weights grad. memory desc

dnnl_query_dst_md 

destination memory desc

dnnl_query_diff_dst_md 

destination grad. memory desc

dnnl_query_workspace_md 

workspace memory desc

dnnl_query_scratchpad_md 

scratchpad memory desc

dnnl_query_exec_arg_md 

memory desc of an execute argument

dnnl_query_max 

Function Documentation

dnnl_status_t DNNL_API dnnl_primitive_create ( dnnl_primitive_t primitive,
const_dnnl_primitive_desc_t  primitive_desc 
)

Creates a primitive.

Parameters
primitiveOutput primitive.
primitive_descPrimitive descriptor used to create the primitive.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_primitive_desc_clone ( dnnl_primitive_desc_t primitive_desc,
const_dnnl_primitive_desc_t  existing_primitive_desc 
)

Clones a primitive descriptor. The resulting primitive descriptor must be destroyed separately.

Parameters
primitive_descOutput primitive descriptor.
existing_primitive_descPrimitive descriptor to clone.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_primitive_desc_create ( dnnl_primitive_desc_t primitive_desc,
const_dnnl_op_desc_t  op_desc,
const_dnnl_primitive_attr_t  attr,
dnnl_engine_t  engine,
const_dnnl_primitive_desc_t  hint_forward_primitive_desc 
)

Creates a primitive descriptor. This function is equivalent to a sequence of dnnl_primitive_desc_iterator_create() and dnnl_primitive_desc_iterator_fetch(). In other words, the library will pick the first suitable implementation.

Parameters
primitive_descOutput primitive descriptor.
op_descOperation descriptor.
attrPrimitive attributes (can be NULL).
engineEngine to use.
hint_forward_primitive_descFor backward propagation: primitive descriptor for a respective forward propagation primitive. Pass NULL for forward propagation.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_primitive_desc_destroy ( dnnl_primitive_desc_t  primitive_desc)

Destroys a primitive descriptor.

Parameters
primitive_descPrimitive descriptor to destroy.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_primitive_desc_get_attr ( const_dnnl_primitive_desc_t  primitive_desc,
const_dnnl_primitive_attr_t attr 
)

Returns a constant reference to the attributes of a primitive descriptor.

Warning
It is an error to destroy the resulting attr.
The lifetime of an attr is the same as that of a primitive_desc, so it is an error to use the attr once the primitive_desc has been destroyed.
Parameters
primitive_descPrimitive descriptor.
attrOutput primitive attributes.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_create ( dnnl_primitive_desc_iterator_t iterator,
const_dnnl_op_desc_t  op_desc,
const_dnnl_primitive_attr_t  attr,
dnnl_engine_t  engine,
const_dnnl_primitive_desc_t  hint_forward_primitive_desc 
)

Creates a primitive descriptor iterator.

Parameters
iteratorOutput primitive descriptor iterator.
op_descOperation descriptor.
attrPrimitive attributes (can be NULL).
engineEngine to use.
hint_forward_primitive_descFor backward propagation: primitive descriptor for a respective forward propagation primitive. Pass NULL for forward propagation.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_destroy ( dnnl_primitive_desc_iterator_t  iterator)

Destroys a primitive descriptor iterator.

Parameters
iteratorPrimitive descriptor iterator to destroy.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_primitive_desc_t DNNL_API dnnl_primitive_desc_iterator_fetch ( const_dnnl_primitive_desc_iterator_t  iterator)

Fetches the current primitive descriptor from a primitive descriptor iterator.

Note
The user is responsible for deleting the resulting primitive descriptor using dnnl_primitive_desc_destroy().
Parameters
iteratorA primitive descriptor iterator.
Returns
A primitive descriptor.
dnnl_status_t DNNL_API dnnl_primitive_desc_iterator_next ( dnnl_primitive_desc_iterator_t  iterator)

Advances the primitive descriptor iterator to point to the next available implementation.

Parameters
iteratorA primitive descriptor iterator to advance.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_iterator_ends if no more implementations available.
dnnl_status_t DNNL_API dnnl_primitive_desc_query ( const_dnnl_primitive_desc_t  primitive_desc,
dnnl_query_t  what,
int  index,
void *  result 
)

Queries a primitive descriptor for various pieces of information.

The most common use case is to query a primitive descriptor, created with source, weights, and destination memory descriptors with format tags set to dnnl_format_tag_any, for the corresponding memory descriptors (in this case the what is set to dnnl_query_src_md, dnnl_query_weights_md, and dnnl_query_dst_md respectively) so that it is possible to create memory objects and reorder primitives if necessary.

Another typical use case is to query a primitive descriptor for workspace memory descriptor (with what set to dnnl_query_workspace_md). If this query returns dnnl_not_required status, then workspace memory is not required.

Note
When querying for a memory descriptor for a scratchpad, a workspace, or an optional parameter, the query will return a pointer to a zero memory descriptor if the parameter is not needed.

A few other use cases:

See also
dnnl_query_t for more options
Parameters
primitive_descPrimitive descriptor.
whatParameter to query.
indexIndex of the parameter to query for.
resultOutput result. The type depends on the query. For example, it must be a dnnl_memory_desc_t* if querying for a memory descriptor.
Returns
dnnl_success on success and a status describing the error otherwise.
const dnnl_memory_desc_t DNNL_API* dnnl_primitive_desc_query_md ( const_dnnl_primitive_desc_t  primitive_desc,
dnnl_query_t  what,
int  index 
)

Queries primitive descriptor for a memory descriptor.

Note
This function is a convenience version of dnnl_primitive_desc_query().
Parameters
primitive_descPrimitive descriptor.
whatKind of memory descriptor parameter to query for.
indexIndex of the parameter to query.
Returns
A pointer to the requested memory descriptor.
A pointer to a zero memory descriptor if the parameter is not needed.
NULL in case of any error.
int DNNL_API dnnl_primitive_desc_query_s32 ( const_dnnl_primitive_desc_t  primitive_desc,
dnnl_query_t  what,
int  index 
)

Queries primitive descriptor for a signed 32bit int.

Note
This function is a convenience version of dnnl_primitive_desc_query().
Parameters
primitive_descPrimitive descriptor.
whatKind of the value to query for.
indexIndex of the parameter to query.
Returns
The requested value.
0 in case of any error (in particular if the queried entity is not of type int32_t). Note that 0 may also be the actual returned value.
dnnl_status_t DNNL_API dnnl_primitive_destroy ( dnnl_primitive_t  primitive)

Destroys a primitive.

Parameters
primitiveThe primitive to destroy.
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_primitive_execute ( const_dnnl_primitive_t  primitive,
dnnl_stream_t  stream,
int  nargs,
const dnnl_exec_arg_t args 
)

Executes a primitive.

Parameters
primitivePrimitive to execute.
streamStream to use.
nargsNumber of arguments.
argsArray of arguments. Each argument is an <index, dnnl_memory_t> pair. The index is one of the DNNL_ARG_* values such as DNNL_ARG_SRC. Unless runtime shapes are used (see DNNL_RUNTIME_DIM_VAL), the memory object must have the same memory descriptor as that returned by dnnl_primitive_desc_query_md(dnnl_query_exec_arg_md, index).
Returns
dnnl_success on success and a status describing the error otherwise.
dnnl_status_t DNNL_API dnnl_primitive_get_primitive_desc ( const_dnnl_primitive_t  primitive,
const_dnnl_primitive_desc_t primitive_desc 
)

Retrieves a constant reference to the primitive descriptor of a given primitive.

Warning
It is an error to destroy the returned object. It is owned by the primitive. The const qualifier of the returned object prevents such attempts.
Parameters
primitivePrimitive to query for the primitive descriptor.
primitive_descOutput primitive descriptor.
Returns
dnnl_success on success and a status describing the error otherwise.