Function QnnContext_getBinarySection

Function Documentation

Qnn_ErrorHandle_t QnnContext_getBinarySection(Qnn_ContextHandle_t context, Qnn_GraphHandle_t graph, QnnContext_SectionType_t section, const QnnContext_Buffer_t *binaryBuffer, Qnn_ContextBinarySize_t *writtenBufferSize, Qnn_ProfileHandle_t profile, Qnn_SignalHandle_t signal)

Retrieve section of the context binary. Content of the section is specified by section. The size of the section is retrieved from QnnContext_getBinarySectionSize().

Parameters
  • context[in] A context handle.

  • binaryBuffer[in] Pointer to the user-allocated context binary memory.

  • graph[in] A graph handle. This argument is optional. When supplied the returned binary only contains the context binary section pertaining to this graph. When excluded the returned binary contains associated updates to all graphs in the context. Some backends may require graph as an argument. Support is determined by QNN_PROPERTY_CONTEXT_SUPPORT_BINARY_SECTION_FULL_CONTEXT.

  • section[in] The section of the binary to retrieve. When section is QNN_CONTEXT_SECTION_UPDATABLE the returned binary will contain all of the updatable tensors associated with the context and graph combination. Binary sections of type QNN_CONTEXT_SECTION_UPDATABLE have Qnn System Context metadata containing information about any modified input and output tensors, and therefore may be used with QnnSystemContext_getMetadata() and QnnSystemContext_getBinaryInfo().

  • profile[in] The profile handle on which metrics are populated and can be queried. Use NULL handle to disable profile collection. A handle being re-used would reset and is populated with values from the current call.

  • signal[in] Signal object to control the execution of the create context from binary process. NULL may be passed to indicate that no execution control is requested, and the create operation should continue to completion uninterrupted. The signal object, if not NULL, is considered to be in-use for the duration of the call.

  • writtenBufferSize[out] Amount of memory actually written into binaryBuffer, in bytes.

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: one of the arguments to the API is invalid/NULL

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

  • QNN_CONTEXT_ERROR_GET_BINARY_FAILED: Operation failure due to other factors

  • QNN_COMMON_ERROR_OPERATION_NOT_PERMITTED: Attempting to get binary update 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.