Function QnnContext_getBinarySize

Function Documentation

Qnn_ErrorHandle_t QnnContext_getBinarySize(Qnn_ContextHandle_t context, Qnn_ContextBinarySize_t *binaryBufferSize)

A function to get the size of memory to be allocated to hold the context content in binary (serialized) form. This function must be called after all entities in the context have been finalized.

Parameters
  • context[in] A context handle.

  • binaryBufferSize[out] The amount of memory in bytes a client will need to allocate to hold context content in binary form.

Returns

Error code:

  • QNN_SUCCESS: no error is encountered

  • QNN_CONTEXT_ERROR_UNSUPPORTED_FEATURE: a feature is not supported

  • QNN_CONTEXT_ERROR_INVALID_HANDLE: context is not a valid handle

  • QNN_CONTEXT_ERROR_INVALID_ARGUMENT: binaryBufferSize is NULL

  • QNN_CONTEXT_ERROR_NOT_FINALIZED: if there were any non-finalized entities in the context

  • QNN_CONTEXT_ERROR_GET_BINARY_SIZE_FAILED: Operation failure due to other factors

  • QNN_COMMON_ERROR_OPERATION_NOT_PERMITTED: Attempting to get binary size for a context re-created from a cached binary.

  • QNN_CONTEXT_ERROR_MEM_ALLOC: Not enough memory is available to retrieve the context content.

Note

Use corresponding API through QnnInterface_t.