Function QnnContext_applyBinarySection

Function Documentation

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

Apply a section to the contextBinary produced by a prior QnnContext_getBinarySection() call. If successful, this section overwrites previously applied sections. If the call to applyBinarySection() fails, it indicates the changes were not applied, and that the context retains its prior state. In this case the context is still valid and may be used for subsequent inferences.

  • QNN_SUCCESS: no error is encountered

  • QNN_CONTEXT_ERROR_UNSUPPORTED_FEATURE: a feature is not supported

  • QNN_CONTEXT_ERROR_INVALID_ARGUMENT: binaryBuffer or context is NULL

  • QNN_CONTEXT_ERROR_MEM_ALLOC: memory allocation error while creating context update

  • QNN_CONTEXT_ERROR_SET_PROFILE: failed to set profiling info

  • QNN_CONTEXT_ERROR_INVALID_HANDLE: backend, __profile_, or signal is not a valid handle

Parameters
  • context[in] A context handle.

  • 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.

  • 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.

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

  • 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.

Note

Use corresponding API through QnnInterface_t.

Note

When using this API with QNN_CONTEXT_CONFIG_PERSISTENT_BINARY enabled, binaryBuffer should be available and persistent from first call to QnnContext_applyBinarySection until QnnContext_free.