Function QnnContext_createFromBinary¶
Defined in File QnnContext.h
Function Documentation¶
-
Qnn_ErrorHandle_t QnnContext_createFromBinary(Qnn_BackendHandle_t backend, Qnn_DeviceHandle_t device, const QnnContext_Config_t **config, const void *binaryBuffer, Qnn_ContextBinarySize_t binaryBufferSize, Qnn_ContextHandle_t *context, Qnn_ProfileHandle_t profile)¶
A function to create a context from a stored binary. The binary was previously obtained via QnnContext_getBinary() and stored by a client. The content of a context created in this way cannot be further altered, meaning no new nodes or tensors can be added to the context. Creating context by deserializing provided binary is meant for fast content creation, ready to execute on.
- Parameters
backend – [in] A backend handle.
device – [in] A device handle to set hardware affinity for the created context. NULL value can be supplied for device handle and it is equivalent to calling QnnDevice_create() with NULL config.
config – [in] Pointer to a NULL terminated array of config option pointers. NULL is allowed and indicates no config options are provided. In case they are not provided, all config options have a default value in accordance with the serialized context. If the same config option type is provided multiple times, the last option value will be used.
binaryBuffer – [in] A pointer to the context binary.
binaryBufferSize – [in] Holds the size of the context binary.
context – [out] A handle to the created context.
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.
- Returns
Error code:
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
QNN_CONTEXT_ERROR_CREATE_FROM_BINARY: failed to deserialize binary and create context from it
QNN_CONTEXT_ERROR_BINARY_VERSION: incompatible version of the binary
QNN_CONTEXT_ERROR_BINARY_CONFIGURATION: binary is not configured for this device
QNN_CONTEXT_ERROR_BINARY_SUBOPTIMAL: suboptimal binary is used when QNN_CONTEXT_BINARY_COMPATIBILITY_STRICT is specified in the config option
QNN_CONTEXT_ERROR_SET_PROFILE: failed to set profiling info
QNN_CONTEXT_ERROR_INVALID_HANDLE: backend, __profile_, or device is not a valid handle
QNN_CONTEXT_ERROR_INVALID_CONFIG: one or more config values is invalid
QNN_COMMON_ERROR_SYSTEM_COMMUNICATION: SSR occurence (successful recovery)
QNN_COMMON_ERROR_SYSTEM_COMMUNICATION_FATAL: SSR occurence (unsuccessful recovery)
Note
Use corresponding API through QnnInterface_t.