mxnet
Functions
Common primitive operations
Collaboration diagram for Common primitive operations:

Functions

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_create (mkldnn_primitive_desc_iterator_t *iterator, const_mkldnn_op_desc_t op_desc, mkldnn_engine_t engine, const_mkldnn_primitive_desc_t hint_forward_primitive_desc)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_create_v2 (mkldnn_primitive_desc_iterator_t *iterator, const_mkldnn_op_desc_t op_desc, const_mkldnn_primitive_attr_t attr, mkldnn_engine_t engine, const_mkldnn_primitive_desc_t hint_forward_primitive_desc)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_next (mkldnn_primitive_desc_iterator_t iterator)
 
mkldnn_primitive_desc_t MKLDNN_API mkldnn_primitive_desc_iterator_fetch (const_mkldnn_primitive_desc_iterator_t iterator)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_destroy (mkldnn_primitive_desc_iterator_t iterator)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_create (mkldnn_primitive_desc_t *primitive_desc, const_mkldnn_op_desc_t op_desc, mkldnn_engine_t engine, const_mkldnn_primitive_desc_t hint_forward_primitive_desc)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_create_v2 (mkldnn_primitive_desc_t *primitive_desc, const_mkldnn_op_desc_t op_desc, const_mkldnn_primitive_attr_t attr, mkldnn_engine_t engine, const_mkldnn_primitive_desc_t hint_forward_primitive_desc)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_clone (mkldnn_primitive_desc_t *primitive_desc, const_mkldnn_primitive_desc_t existing_primitive_desc)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_get_attr (const_mkldnn_primitive_desc_t primitive_desc, const_mkldnn_primitive_attr_t *attr)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_destroy (mkldnn_primitive_desc_t primitive_desc)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_query (const_mkldnn_primitive_desc_t primitive_desc, mkldnn_query_t what, int index, void *result)
 
const mkldnn_memory_desc_t MKLDNN_APImkldnn_primitive_desc_query_memory_d (const_mkldnn_primitive_desc_t primitive_desc)
 
const_mkldnn_primitive_desc_t MKLDNN_API mkldnn_primitive_desc_query_pd (const_mkldnn_primitive_desc_t primitive_desc, mkldnn_query_t what, int index)
 
int MKLDNN_API mkldnn_primitive_desc_query_s32 (const_mkldnn_primitive_desc_t primitive_desc, mkldnn_query_t what, int index)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_create (mkldnn_primitive_t *primitive, const_mkldnn_primitive_desc_t primitive_desc, const mkldnn_primitive_at_t *inputs, const_mkldnn_primitive_t *outputs)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_get_primitive_desc (const_mkldnn_primitive_t primitive, const_mkldnn_primitive_desc_t *primitive_desc)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_get_input_at (const_mkldnn_primitive_t primitive, size_t index, mkldnn_primitive_at_t *input)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_get_output (const_mkldnn_primitive_t primitive, size_t index, const_mkldnn_primitive_t *output)
 
mkldnn_status_t MKLDNN_API mkldnn_primitive_destroy (mkldnn_primitive_t primitive)
 
mkldnn_primitive_at_t MKLDNN_API mkldnn_primitive_at (const_mkldnn_primitive_t primitive, size_t output_index)
 

Detailed Description

Function Documentation

mkldnn_primitive_at_t MKLDNN_API mkldnn_primitive_at ( const_mkldnn_primitive_t  primitive,
size_t  output_index 
)

Creates an mkldnn_primitive_at_t structure from a primitive and output_index. This function only fills in the data structure and does not check whether arguments are correct. The actual error checking is done when the resulting mkldnn_primitive_at structure is passed to a primitive creation function.

mkldnn_status_t MKLDNN_API mkldnn_primitive_create ( mkldnn_primitive_t primitive,
const_mkldnn_primitive_desc_t  primitive_desc,
const mkldnn_primitive_at_t inputs,
const_mkldnn_primitive_t outputs 
)

Creates a primitive using a primitive_desc descriptor and arrays of inputs and outputs.

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_clone ( mkldnn_primitive_desc_t primitive_desc,
const_mkldnn_primitive_desc_t  existing_primitive_desc 
)

Makes a copy of a primitive_desc.

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_create ( mkldnn_primitive_desc_t primitive_desc,
const_mkldnn_op_desc_t  op_desc,
mkldnn_engine_t  engine,
const_mkldnn_primitive_desc_t  hint_forward_primitive_desc 
)

Creates a primitive_desc using op_desc, engine, and optionally a hint primitive descriptor from forward propagation. The call is equivalent to creating a primitive descriptor iterator, immediately fetching a primitive descriptor, and then destroying the iterator.

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_create_v2 ( mkldnn_primitive_desc_t primitive_desc,
const_mkldnn_op_desc_t  op_desc,
const_mkldnn_primitive_attr_t  attr,
mkldnn_engine_t  engine,
const_mkldnn_primitive_desc_t  hint_forward_primitive_desc 
)

Creates a primitive_desc using op_desc, attr, engine, and optionally a hint primitive descriptor from forward propagation. The call is equivalent to creating a primitive descriptor iterator, immediately fetching a primitive descriptor, and then destroying the iterator.

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_destroy ( mkldnn_primitive_desc_t  primitive_desc)

Deletes a primitive_desc.

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_get_attr ( const_mkldnn_primitive_desc_t  primitive_desc,
const_mkldnn_primitive_attr_t attr 
)

Returns a constant reference to the attribute of a primitive_desc.

Warning
The user should not destroy the obtained attr.
The lifetime of an attr is the same as that of a primitive_desc, so it is illegal to use the attr once primitive_desc has been destroyed.
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_create ( mkldnn_primitive_desc_iterator_t iterator,
const_mkldnn_op_desc_t  op_desc,
mkldnn_engine_t  engine,
const_mkldnn_primitive_desc_t  hint_forward_primitive_desc 
)

Creates a primitive descriptor iterator for given op_desc, engine, and optionally a hint primitive descriptor from forward propagation (required for backward propagation). Pass NULL for forward propagation.

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_create_v2 ( mkldnn_primitive_desc_iterator_t iterator,
const_mkldnn_op_desc_t  op_desc,
const_mkldnn_primitive_attr_t  attr,
mkldnn_engine_t  engine,
const_mkldnn_primitive_desc_t  hint_forward_primitive_desc 
)

Creates a primitive descriptor iterator for given op_desc, attr, engine, and optionally a hint primitive descriptor from forward propagation (required for backward propagation). Pass NULL for forward propagation.

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_destroy ( mkldnn_primitive_desc_iterator_t  iterator)

Deletes a primitive descriptor iterator

mkldnn_primitive_desc_t MKLDNN_API mkldnn_primitive_desc_iterator_fetch ( const_mkldnn_primitive_desc_iterator_t  iterator)

Fetches the current primitive descriptor.

Note
The user should delete the fetched primitive descriptor using mkldnn_primitive_desc_destroy() once it is no longer needed.
mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_iterator_next ( mkldnn_primitive_desc_iterator_t  iterator)

Iterates over primitive descriptors. Returns mkldnn_iterator_ends if no more primitive descriptors are available.

mkldnn_status_t MKLDNN_API mkldnn_primitive_desc_query ( const_mkldnn_primitive_desc_t  primitive_desc,
mkldnn_query_t  what,
int  index,
void *  result 
)

Queries primitive descriptor

One of the most typical use cases is to query a convolution primitive descriptor created with source, weights, and destination formats equal to mkldnn_any about the corresponding memory primitive descriptors (what equals mkldnn_query_src_pd, mkldnn_query_weights_pd, and mkldnn_query_dst_pd respectively) to be able to prepare memory and create reorders if required.

Another quite typical use case is to query an operation primitive descriptor for a workspace (what equals mkldnn_query_workspace_pd). The returned status mkldnn_not_required indicates that a workspace is not required.

A few other possibilities:

See also
mkldnn_query_t for more options
const mkldnn_memory_desc_t MKLDNN_API* mkldnn_primitive_desc_query_memory_d ( const_mkldnn_primitive_desc_t  primitive_desc)

Queries primitive descriptor for memory descriptor

Returns
NULL in case of any error (in particular if the queried entity is not of type mkldnn_memory_desc_t).

This is just a specialized version of mkldnn_primitive_desc_query used for convenience.

const_mkldnn_primitive_desc_t MKLDNN_API mkldnn_primitive_desc_query_pd ( const_mkldnn_primitive_desc_t  primitive_desc,
mkldnn_query_t  what,
int  index 
)

Queries primitive descriptor for primitive descriptor

Returns
NULL in case of any error (in particular if the queried entity is not of type const_mkldnn_primitive_desc_t).

This is just a specialized version of mkldnn_primitive_desc_query used for convenience.

Example: Query an operation primitive descriptor for a workspace (what equals mkldnn_query_workspace_pd). Returned NULL indicates that the primitive does not require a workspace. Otherwise, a user should prepare the workspace and pass it to the corresponding primitive.

int MKLDNN_API mkldnn_primitive_desc_query_s32 ( const_mkldnn_primitive_desc_t  primitive_desc,
mkldnn_query_t  what,
int  index 
)

Queries primitive descriptor for signed 32bit int

Returns
0 in case of any error (in particular if the queried entity is not of type int32_t). Note that 0 might also be the actual returned value.

This is just a specialized version of mkldnn_primitive_desc_query used for convenience.

mkldnn_status_t MKLDNN_API mkldnn_primitive_destroy ( mkldnn_primitive_t  primitive)

Deletes a primitive.

mkldnn_status_t MKLDNN_API mkldnn_primitive_get_input_at ( const_mkldnn_primitive_t  primitive,
size_t  index,
mkldnn_primitive_at_t input 
)

For a primitive, returns input at the index position.

mkldnn_status_t MKLDNN_API mkldnn_primitive_get_output ( const_mkldnn_primitive_t  primitive,
size_t  index,
const_mkldnn_primitive_t output 
)

For a primitive, returns output at the index position.

mkldnn_status_t MKLDNN_API mkldnn_primitive_get_primitive_desc ( const_mkldnn_primitive_t  primitive,
const_mkldnn_primitive_desc_t primitive_desc 
)

Retrieves a reference to the primitive_desc descriptor of given primitive.

Warning
The returned object must not be destroyed by the user. The const qualifier of the returned object prevents such attempts.