Function QnnContext_create

Function Documentation

Qnn_ErrorHandle_t QnnContext_create(Qnn_BackendHandle_t backend, Qnn_DeviceHandle_t device, const QnnContext_Config_t **config, Qnn_ContextHandle_t *context)

A function to create a context. Context holds graphs, operations and tensors.

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. All config options have default value, in case not provided. If same config option type is provided multiple times, the last option value will be used.

  • context[out] A handle to the created context.

Returns

Error code:

  • QNN_SUCCESS: no error is encountered

  • QNN_CONTEXT_ERROR_INVALID_ARGUMENT: at least one argument is invalid

  • QNN_CONTEXT_ERROR_MEM_ALLOC: failure in allocating memory when creating context

  • QNN_CONTEXT_ERROR_INVALID_HANDLE: backend or device is not a valid handle

  • QNN_CONTEXT_ERROR_UNSUPPORTED_FEATURE: an optional feature is not supported

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