[][src]Function onednn_sys::dnnl_primitive_desc_query

pub unsafe extern "C" fn dnnl_primitive_desc_query(
    primitive_desc: const_dnnl_primitive_desc_t,
    what: dnnl_query_t,
    index: c_int,
    result: *mut c_void
) -> dnnl_status_t

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 @p 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 @p 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:

  • query a primitive descriptor for the underlying operation descriptor (#dnnl_query_convolution_d, #dnnl_query_eltwise_d, #dnnl_query_rnn_d, etc.)
  • query a primitive descriptor for the implementation information string (#dnnl_query_impl_info_str)
  • query a primitive descriptor for the number of inputs and outputs (#dnnl_query_num_of_inputs_s32 and #dnnl_query_num_of_outputs_s32 respectively)

@sa dnnl_query_t for more options

@param primitive_desc Primitive descriptor. @param what Parameter to query. @param index Index of the parameter to query for. @param result Output result. The type depends on the query. For example, it must be a @c dnnl_memory_desc_t* if querying for a memory descriptor. @returns #dnnl_success on success and a status describing the error otherwise.