Function QnnContext_createFromBinaryListAsync

Function Documentation

Qnn_ErrorHandle_t QnnContext_createFromBinaryListAsync(Qnn_BackendHandle_t backend, Qnn_DeviceHandle_t device, const QnnContext_Params_t **contextParams, const QnnContext_Config_t **listConfig, Qnn_SignalHandle_t signal)

The purpose of this function is to asynchronously create multiple contexts from binaries in a single API call. The API can be used with QnnSignal. When the function is invoked, the deserialization/initialization of each context will occur in the background. As soon as a graph reaches an executable state (i.e., initialization is completed), the client will receive a notification via the specified notification function. Once notification is received, the client can proceed to execute the graph. If a context contains multiple graphs, there will be multiple callbacks through the notification function.

Parameters
  • backend[in] A backend handle.

  • device[in] A device handle used to set hardware affinity for the created context. A NULL value can be supplied for the device handle, which is equivalent to calling QnnDevice_create() with a NULL config.

  • contextParams[in] Pointer to a NULL-terminated array of context parameters.

  • listConfig[in] Config pointer to a NULL-terminated array of config option pointers that apply to all contexts in the list. NULL is allowed and indicates that no config options are provided. If not provided, all config options have default values consistent with the serialized context. If the same config option type is provided multiple times, the last option value will be used. listConfig will override options also specified in contextParams.

  • signal[in] Signal object to control 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 including the asynchronous deserialization/initialization.

Returns

Error code:

  • QNN_SUCCESS: no error is encountered

  • QNN_CONTEXT_ERROR_UNSUPPORTED_FEATURE: a feature is not supported

  • QNN_CONTEXT_ERROR_INVALID_ARGUMENT: contextParams is empty or any individual contextParam’s binaryBuffer or notifyFunc is NULL or binaryBufferSize is 0

  • QNN_CONTEXT_ERROR_MEM_ALLOC: memory allocation error while creating any context

  • QNN_CONTEXT_ERROR_CREATE_FROM_BINARY: failed to deserialize any 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, device, signal or any individual contextParam’s profile is not a valid handle

  • QNN_CONTEXT_ERROR_INVALID_CONFIG: one or more config values in either listConfig or any individual contextParam’s config is invalid

  • QNN_CONTEXT_ERROR_ABORTED: the call is aborted before completion due to user cancellation including during any individual asynchronous deserialization/initialization

  • QNN_CONTEXT_ERROR_TIMED_OUT: the call is aborted before completion due to a timeout including during any individual asynchronous deserialization/initialization

Note

: Until a notification is received indicating that at least one graph or context is in an executable state, other context or graph-based functions cannot be called.

Note

Use corresponding API through QnnInterface_t.