# QairtContext

Context creation and lifecycle management.

**Include:** `#include "QairtContext/QairtContext.h"`

- struct QairtContext\_V1\_t

    - *#include &lt;QairtContext.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtContext\_CreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv423QairtContext_CreateFn_t) create

    - 

- [QairtContext\_FreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_FreeFn_t) free

    - 

- [QairtContext\_SetConfigFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv426QairtContext_SetConfigFn_t) setConfig

    - 

- [QairtContext\_GetBinarySizeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv430QairtContext_GetBinarySizeFn_t) getBinarySize

    - 

- [QairtContext\_GetBinaryFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv426QairtContext_GetBinaryFn_t) getBinary

    - 

- [QairtContext\_ValidateBinaryFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv431QairtContext_ValidateBinaryFn_t) validateBinary

    - 

- [QairtContext\_CreateFromBinaryFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_CreateFromBinaryFn_t) createFromBinary

    - 

- [QairtContext\_FinalizeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv425QairtContext_FinalizeFn_t) finalize

    - 

- [QairtContext\_CreateGraphFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv428QairtContext_CreateGraphFn_t) createGraph

    - 

- [QairtContext\_RetrieveGraphFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv430QairtContext_RetrieveGraphFn_t) retrieveGraph

    - 

- [QairtContext\_RegisterMemFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv428QairtContext_RegisterMemFn_t) registerMem

    - 

- [QairtContext\_CreateContextTensorFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv436QairtContext_CreateContextTensorFn_t) createContextTensor

    - 

- [QairtContext\_UpdateContextTensorsFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv437QairtContext_UpdateContextTensorsFn_t) updateContextTensors

    - 

- [QairtContext\_GetBinarySectionSizeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv437QairtContext_GetBinarySectionSizeFn_t) getBinarySectionSize

    - 

- [QairtContext\_GetBinarySectionFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_GetBinarySectionFn_t) getBinarySection

    - 

- [QairtContext\_ApplyBinarySectionFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv435QairtContext_ApplyBinarySectionFn_t) applyBinarySection

    -

Functions

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_create([QairtBackend\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtBackend.html#_CPPv421QairtBackend_Handle_t) backendHandle, [QairtDevice\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtDevice.html#_CPPv420QairtDevice_Handle_t) deviceHandle, [QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) \*contextHandle)

    - Create a context handle associated with a backend and device.

- Parameters

    - - **backendHandle** – **[in]** A handle to a created backend.
- **deviceHandle** – **[in]** A handle to a device. NULL is allowed and is equivalent to calling [QairtDevice\_create()](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtDevice.html#QairtDevice_8h_1a1c5c76ca573fdb3b5b643bd3bb34b278) with a NULL config.
- **configHandle** – **[in]** A handle to a context configuration. NULL is allowed and indicates default configuration values are used.
- **contextHandle** – **[out]** A handle to the created context.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Context was successfully created.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: At least one argument is invalid.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Failure in allocating memory when creating context.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *backendHandle* or *deviceHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: An optional feature is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_CONFIG: One or more config values is invalid.
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION: SSR occurrence (successful recovery).
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION\_FATAL: SSR occurrence (unsuccessful recovery).

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_free([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t) profileHandle)

    - Free a context handle and associated resources.

- Parameters

    - - **contextHandle** – **[in]** A handle to a created context.
- **profileHandle** – **[in]** Optional profile handle to collect metrics during context teardown. Use NULL to disable profiling. A handle being re-used would reset and is populated with values from the current call.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Context was successfully freed.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory deallocation error.
- QAIRT\_CONTEXT\_ERROR\_SET\_PROFILE: Failed to set profiling info.
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION: SSR occurrence (successful recovery).
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION\_FATAL: SSR occurrence (unsuccessful recovery).

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_setConfig([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, [QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle)

    - Set or modify configuration options on an already created context.

Backends are not required to support this API.

- Parameters

    - - **contextHandle** – **[in]** A handle to a created context.
- **configHandle** – **[in]** A handle to a context configuration. If a backend cannot support the provided config, this call will fail.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Configuration was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* or *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: At least one config option is invalid.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: One or more configuration options are not supported.
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION: SSR occurrence (successful recovery).
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION\_FATAL: SSR occurrence (unsuccessful recovery).

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_getBinarySize([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, uint64\_t \*size)

    - Get the size of the binary (serialized) representation of a context.

This function must be called after all entities in the context have been finalized.

- Parameters

    - - **contextHandle** – **[in]** A handle to a created context.
- **size** – **[out]** The size in bytes of the context binary.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Size was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: Binary serialization is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *size* is NULL.
- QAIRT\_CONTEXT\_ERROR\_NOT\_FINALIZED: If there were any non-finalized entities in the context.
- QAIRT\_CONTEXT\_ERROR\_GET\_BINARY\_SIZE\_FAILED: Operation failure due to other factors.
- QAIRT\_COMMON\_ERROR\_OPERATION\_NOT\_PERMITTED: Attempting to get binary size for a context re-created from a cached binary.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Not enough memory is available to retrieve the context content.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_getBinary([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle, uint64\_t \*writtenBufferSize)

    - Get the binary (serialized) representation of a context.

The binary can be used to re-create context by using [QairtContext\_createFromBinary()](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#QairtContext_8h_1a16aa2b1ff1a7281111d90669eb3f4cc5). This function must be called after all entities in the context have been finalized. Unconsumed tensors are not included in the binary. Client is responsible for allocation of sufficient and valid memory to hold the serialized context content produced by this method. It is recommended the user calls [QairtContext\_getBinarySize()](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#QairtContext_8h_1a7d7bead576c552cfaa35cc7c4ce02a20) to allocate a buffer of sufficient space to hold the binary.

- Parameters

    - - **contextHandle** – **[in]** A handle to a created context.
- **binaryBufferHandle** – **[in]** A handle to a binary buffer to store the context binary.
- **writtenBufferSize** – **[out]** The actual size written to *binaryBufferHandle*’s underlying buffer, in bytes.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: Binary serialization is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* or *binaryBufferHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: One of the arguments to the API is invalid/NULL.
- QAIRT\_CONTEXT\_ERROR\_NOT\_FINALIZED: If there were any non-finalized entities in the context.
- QAIRT\_CONTEXT\_ERROR\_GET\_BINARY\_FAILED: Operation failure due to other factors.
- QAIRT\_COMMON\_ERROR\_OPERATION\_NOT\_PERMITTED: Attempting to get binary for a context re-created from a cached binary.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Not enough memory is available to retrieve the context content.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_validateBinary([QairtBackend\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtBackend.html#_CPPv421QairtBackend_Handle_t) backendHandle, [QairtDevice\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtDevice.html#_CPPv420QairtDevice_Handle_t) deviceHandle, [QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) contextBinaryHandle)

    - Validate a context binary for compatibility with the backend and device.

- Parameters

    - - **backendHandle** – **[in]** A handle to a created backend.
- **deviceHandle** – **[in]** A handle to a device. NULL is allowed and indicates the default device.
- **configHandle** – **[in]** A handle to a context configuration. NULL is allowed.
- **contextBinaryHandle** – **[in]** A handle to a context binary buffer to validate.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary is valid and compatible.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: Binary validation is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *contextBinaryHandle* is NULL.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error while validating binary cache.
- QAIRT\_CONTEXT\_ERROR\_CREATE\_FROM\_BINARY: Failed to validate binary cache.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_VERSION: Incompatible version of the binary.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_CONFIGURATION: Binary is not configured for this device.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_SUBOPTIMAL: Suboptimal binary is used when QAIRT\_CONTEXT\_BINARY\_COMPATIBILITY\_STRICT is specified in the config option.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *backendHandle* or *deviceHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_CONFIG: One or more config values is invalid.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_createFromBinary([QairtBackend\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtBackend.html#_CPPv421QairtBackend_Handle_t) backendHandle, [QairtDevice\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtDevice.html#_CPPv420QairtDevice_Handle_t) deviceHandle, [QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [QairtSignal\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtSignal.html#_CPPv420QairtSignal_Handle_t) signalHandle, [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t) profileHandle, [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryHandle, [QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) \*contextHandle)

    - Create a context from a binary representation.

- Parameters

    - - **backendHandle** – **[in]** A handle to a created backend.
- **deviceHandle** – **[in]** A handle to a device. NULL is allowed and indicates the default device.
- **configHandle** – **[in]** A handle to a context configuration. NULL is allowed.
- **signalHandle** – **[in]** Optional signal handle for controlling the operation. Use NULL to proceed without signal control. The signal object, if not NULL, is considered to be in-use for the duration of the call.
- **profileHandle** – **[in]** Optional profile handle to collect metrics. Use NULL to disable profiling. A handle being re-used would reset and is populated with values from the current call.
- **binaryHandle** – **[in]** A handle to a context binary buffer.
- **contextHandle** – **[out]** A handle to the created context.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Context was successfully created from binary.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: Binary deserialization is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *binaryHandle* or *contextHandle* is NULL.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error while creating context.
- QAIRT\_CONTEXT\_ERROR\_CREATE\_FROM\_BINARY: Failed to deserialize binary and create context from it.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_VERSION: Incompatible version of the binary.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_CONFIGURATION: Binary is not configured for this device.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_SUBOPTIMAL: Suboptimal binary is used when QAIRT\_CONTEXT\_BINARY\_COMPATIBILITY\_STRICT is specified in the config option.
- QAIRT\_CONTEXT\_ERROR\_SET\_PROFILE: Failed to set profiling info.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *backendHandle*, *profileHandle*, or *deviceHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_CONFIG: One or more config values is invalid.
- QAIRT\_CONTEXT\_ERROR\_ABORTED: The call is aborted before completion due to user cancellation.
- QAIRT\_CONTEXT\_ERROR\_TIMED\_OUT: The call is aborted before completion due to a timeout.
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION: SSR occurrence (successful recovery).
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION\_FATAL: SSR occurrence (unsuccessful recovery).

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_finalize([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t) profileHandle)

    - A function to finish context creation when originally created with deferred graph initialization enabled (see QAIRT\_CONTEXT\_CONFIG\_OPTION\_DEFER\_GRAPH\_INIT)

- Parameters

    - - **contextHandle** – **[in]** A handle to a created context.
- **profileHandle** – **[in]** Optional profile handle to collect metrics during finalization. Use NULL to disable profiling. A handle being re-used would reset and is populated with values from the current call.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Context was successfully finalized.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error while creating context.
- QAIRT\_CONTEXT\_ERROR\_CREATE\_FROM\_BINARY: Failed to deserialize binary and create context from it.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_VERSION: Incompatible version of the binary.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_CONFIGURATION: Binary is not configured for this device.
- QAIRT\_CONTEXT\_ERROR\_BINARY\_SUBOPTIMAL: Suboptimal binary is used when QAIRT\_CONTEXT\_BINARY\_COMPATIBILITY\_STRICT is specified in the config option.
- QAIRT\_CONTEXT\_ERROR\_SET\_PROFILE: Failed to set profiling info.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_CONFIG: One or more config values is invalid.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: Context finalization is not supported.
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION: SSR occurrence (successful recovery).
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION\_FATAL: SSR occurrence (unsuccessful recovery).

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_createGraph([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, const char \*graphName, const [QairtGraph\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv425QairtGraph_ConfigHandle_t) configHandle, [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t) \*graphHandle)

    - Create a graph within a given context associated with a created graph handle.

- Parameters

    - - **contextHandle** – **[in]** A handle to the context in which the graph would be created. This must be a valid context handle previously created via QairtContext APIs.
- **graphName** – **[in]** A string identifier for the graph. This name must be unique within the context and is used for retrieval and caching purposes.
- **configHandle** – **[in]** A handle to a configuration object for the graph. This handle may encapsulate multiple configuration options. If NULL, default configuration values are used.
- **graphHandle** – **[out]** A handle to the created graph.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Graph was successfully created.
- QAIRT\_GRAPH\_ERROR\_INVALID\_ARGUMENT: One or more arguments are invalid (e.g., NULL graph handle).
- QAIRT\_GRAPH\_ERROR\_INVALID\_NAME: Graph name is NULL or not unique within the context.
- QAIRT\_GRAPH\_ERROR\_INVALID\_HANDLE: Context handle is invalid.
- QAIRT\_GRAPH\_ERROR\_MEM\_ALLOC: Graph creation failed due to memory/resource allocation issues.
- QAIRT\_GRAPH\_ERROR\_UNSUPPORTED\_FEATURE: One or more configuration options are not supported.
- QAIRT\_GRAPH\_ERROR\_CREATE\_FAILED: Graph creation failed due to an internal error.
- QAIRT\_GRAPH\_ERROR\_PROFILE\_IN\_USE: A profile handle used in config is already bound to another graph.
- QAIRT\_COMMON\_ERROR\_OPERATION\_NOT\_PERMITTED: Operation not permitted in the current context state.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_retrieveGraph([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, const char \*graphName, [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t) \*graphHandle)

    - Retrieve a graph from a context by name.

- Parameters

    - - **contextHandle** – **[in]** A handle to the context from which to retrieve the graph.
- **graphName** – **[in]** The name of the graph to retrieve.
- **graphHandle** – **[out]** A handle to the retrieved graph.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Graph was successfully retrieved.
- QAIRT\_GRAPH\_ERROR\_INVALID\_ARGUMENT: *graphName* or *graphHandle* is NULL.
- QAIRT\_GRAPH\_ERROR\_INVALID\_HANDLE: *contextHandle* is not a valid handle.
- QAIRT\_GRAPH\_ERROR\_GRAPH\_DOES\_NOT\_EXIST: No graph with the specified name exists in the context.
- QAIRT\_GRAPH\_ERROR\_INVALID\_NAME: *graphName* is invalid.
- QAIRT\_GRAPH\_ERROR\_MEM\_ALLOC: Memory allocation error while retrieving graph.
- QAIRT\_GRAPH\_ERROR\_UNSUPPORTED\_FEATURE: Graph retrieval is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* is not a valid context handle.
- QAIRT\_CONTEXT\_ERROR\_CTX\_DOES\_NOT\_EXIST: Context does not exist.
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION: SSR occurrence (successful recovery).
- QAIRT\_COMMON\_ERROR\_SYSTEM\_COMMUNICATION\_FATAL: SSR occurrence (unsuccessful recovery).

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- QAIRT\_API Qairt\_Status\_t QairtContext\_registerMem (QairtContext\_Handle\_t contextHandle, QairtMem\_DescriptorHandle\_t \*memDescriptorHandles, uint32\_t numDescriptors, QairtMem\_Handle\_t \*memHandles)

    - Register existing memory to memory handles.

Used to instruct QAIRT to use this memory directly.

- Parameters

    - - **contextHandle** – **[in]** A context handle.
- **memDescriptorHandles** – **[in]** Array of memory descriptor handles to be registered.
- **numDescriptors** – **[in]** Number of memory descriptor handles in the array.
- **memHandles** – **[out]** Array of allocated memory handles, length is *numDescriptors*. Same shape as *memDescriptorHandles* (i.e. memHandles[n] corresponds to memDescriptorHandles[n]).

- Returns

    - Error code:

- QAIRT\_SUCCESS: memory was successfully registered
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: backend does not support this API
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* is not a valid handle
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: NULL array ptr, invalid memory descriptor, or *numDescriptors* is 0
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error during registration
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALREADY\_REGISTERED: memory has already been registered
- QAIRT\_CONTEXT\_ERROR\_MEM\_UNSUPPORTED\_TYPE: backend does not support a memType specified within *memDescriptorHandles*
- QAIRT\_CONTEXT\_ERROR\_MEM\_MAPPING: failed to map between memory file descriptor and memory address
- QAIRT\_CONTEXT\_ERROR\_MEM\_INVALID\_SHAPE: backend does not support a memShape specified within *memDescriptorHandles*

Note

memHandles parameter: Array memory is owned by the client. Array size must be at least *numDescriptors*\*sizeof(QairtMem\_Handle\_t). The array will be initialized to NULL by the backend. Upon failure, no memory will be registered and the *memHandles* array will remain NULL.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_createContextTensor([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, [QairtTensor\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtTensor.html#_CPPv420QairtTensor_Handle_t) tensorHandle)

    - Create a new tensor on QairtContext\_Handle\_t.

This call may or may not allocate memory, depending on the tensor type
       and the accelerator implementation. Optionally it may be initialized with
       data provided in the tensor if present.
    Copy to clipboard

- Parameters

    - - **contextHandle** – **[in]** The context in which the tensor would be created.
- **tensorHandle** – **[inout]** A pre-configured tensor handle. For tensors containing static data (such as weights or biases), the tensor type is expected to be QAIRT\_TENSOR\_TYPE\_STATIC. Valid data must be presented in the tensor at creation. This data will be copied, and may be safely de-allocated after this call returns. Other tensor types (e.g: APP\_READ, APP\_WRITE, APP\_READWRITE, NULL) must have the data pointer set to NULL at the time of creation. Creating a tensor with a name that duplicates a previously created tensor name in the context and all child graphs results in undefined behaviour. The dimensions are treated as the maximum dimensions during tensor creation. The tensor ID will be assigned by the backend directly to this handle as part of this call.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Successfully created a context tensor
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: Provided context or tensor handle is invalid
- QAIRT\_TENSOR\_ERROR\_INVALID\_TENSOR\_PARAM: One or more tensor parameters is invalid
- QAIRT\_TENSOR\_ERROR\_UNSUPPORTED\_TENSOR\_PARAM: One or more tensor parameters are unsupported
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Failure in creating tensor due to issues with memory allocation
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: some API feature is not supported yet

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

Warning

Context tensors cannot be of type QAIRT\_TENSOR\_TYPE\_NATIVE. Native tensors connect nodes within a single graph.

Warning

Context tensors cannot be of datatype QAIRT\_DATATYPE\_STRING.

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_getBinarySectionSize([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t) graphHandle, [QairtContext\_SectionType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv426QairtContext_SectionType_t) section, uint64\_t \*binaryBufferSize)

    - Get the size of a binary section for a context.

The section type specifies which portion of the binary to query. This function must be called after all entities in the context have been finalized.

- Parameters

    - - **contextHandle** – **[in]** A handle to a created context.
- **graphHandle** – **[in]** A graph handle. This argument is optional. When supplied, the returned size only applies to the context binary section pertaining to this graph. When NULL, the returned size applies to all graphs in the context.
- **section** – **[in]** The section of the binary to query.
- **binaryBufferSize** – **[out]** The amount of memory in bytes a client will need to allocate to hold the context binary section.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Size was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: Binary section retrieval is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *binaryBufferSize* is NULL.
- QAIRT\_CONTEXT\_ERROR\_NOT\_FINALIZED: If there were any non-finalized entities in the context.
- QAIRT\_CONTEXT\_ERROR\_GET\_BINARY\_SIZE\_FAILED: Operation failure due to other factors.
- QAIRT\_COMMON\_ERROR\_OPERATION\_NOT\_PERMITTED: Attempting to get binary size for a context re-created from a cached binary.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Not enough memory is available to retrieve the context content.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_getBinarySection([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t) graphHandle, [QairtContext\_SectionType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv426QairtContext_SectionType_t) section, [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle, [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t) profileHandle, [QairtSignal\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtSignal.html#_CPPv420QairtSignal_Handle_t) signalHandle, uint64\_t \*writtenBufferSize)

    - Retrieve a section of the context binary.

The section type specifies which portion of the binary to retrieve. The size of the section should first be queried via [QairtContext\_getBinarySectionSize()](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#QairtContext_8h_1a3aa08e2653eaf16da9a7f50bf068ead0) to allocate a buffer of sufficient size.

- Parameters

    - - **contextHandle** – **[in]** A handle to a created context.
- **graphHandle** – **[in]** A graph handle. This argument is optional. When supplied, the returned binary only contains the context binary section pertaining to this graph. When NULL, the returned binary contains associated updates to all graphs in the context.
- **section** – **[in]** The section of the binary to retrieve.
- **binaryBufferHandle** – **[in]** A handle to a binary buffer to store the section binary. The buffer must be pre-allocated with sufficient size.
- **profileHandle** – **[in]** Optional profile handle to collect metrics. Use NULL to disable profiling. A handle being re-used would reset and is populated with values from the current call.
- **signalHandle** – **[in]** Optional signal handle for controlling the operation. Use NULL to proceed without signal control. The signal object, if not NULL, is considered to be in-use for the duration of the call.
- **writtenBufferSize** – **[out]** The actual number of bytes written into *binaryBufferHandle*’s underlying buffer.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary section was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: Binary section retrieval is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *contextHandle* or *graphHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: One of the arguments to the API is invalid/NULL.
- QAIRT\_CONTEXT\_ERROR\_NOT\_FINALIZED: If there were any non-finalized entities in the context.
- QAIRT\_CONTEXT\_ERROR\_GET\_BINARY\_FAILED: Operation failure due to other factors.
- QAIRT\_COMMON\_ERROR\_OPERATION\_NOT\_PERMITTED: Attempting to get binary section for a context re-created from a cached binary.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Not enough memory is available to retrieve the context content.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_applyBinarySection([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t) graphHandle, [QairtContext\_SectionType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv426QairtContext_SectionType_t) section, [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle, [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t) profileHandle, [QairtSignal\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtSignal.html#_CPPv420QairtSignal_Handle_t) signalHandle)

    - Apply a binary section to a context.

The section was previously obtained via [QairtContext\_getBinarySection()](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#QairtContext_8h_1aafa9d6f1ced8cb6afc4122b90258400a). If successful, this section overwrites previously applied sections. If the call fails, the context retains its prior state and remains valid for subsequent inferences.

- Parameters

    - - **contextHandle** – **[in]** A handle to a created context.
- **graphHandle** – **[in]** A graph handle. This argument is optional. When supplied, the binary section pertains to this graph. When NULL, the binary section applies to all graphs in the context.
- **section** – **[in]** The section type of the binary to apply.
- **binaryBufferHandle** – **[in]** A handle to a binary buffer containing the section to apply.
- **profileHandle** – **[in]** Optional profile handle to collect metrics. Use NULL to disable profiling. A handle being re-used would reset and is populated with values from the current call.
- **signalHandle** – **[in]** Optional signal handle for controlling the operation. Use NULL to proceed without signal control. The signal object, if not NULL, is considered to be in-use for the duration of the call.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary section was successfully applied.
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: A feature is not supported.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: A provided handle is not a valid.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error while applying context update.
- QAIRT\_CONTEXT\_ERROR\_SET\_PROFILE: Failed to set profiling info.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

Note

When using this API with QAIRT\_CONTEXT\_CONFIG\_PERSISTENT\_BINARY enabled, binaryBufferHandle should remain valid from the first call to QairtContext\_applyBinarySection until QairtContext\_free.

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_updateContextTensors([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t) contextHandle, const [QairtTensor\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtTensor.html#_CPPv420QairtTensor_Handle_t) \*tensorHandles, uint64\_t numTensors)

    - Update tensors previously created on a context.

Valid fields to update are: data and quantization parameters for UPDATEABLE\_STATIC tensors, quantization parameters for UPDATEABLE\_NATIVE, UPDATEABLE\_APP\_READ, UPDATEABLE\_APP\_WRITE, and UPDATEABLE\_APP\_READWRITE tensors.

- Parameters

    - - **contextHandle** – **[in]** The context on which the tensors were created.
- **tensorHandles** – **[in]** Array of tensor handles to update. Each handle must carry the ID assigned during tensor creation.
- **numTensors** – **[in]** Number of tensor handles in the *tensorHandles* array.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Successfully updated context tensors
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: Provided context or tensor handle is invalid
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *tensorHandles* is NULL
- QAIRT\_TENSOR\_ERROR\_INCOMPATIBLE\_TENSOR\_UPDATE: Tensor type does not support updates
- QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE: some API feature is not supported yet

Note

Multiple calls can be made, but updates will not take effect until QairtGraph\_finalize() is called for one or more of the graphs to which the context tensors are associated.

Note

Use corresponding API through [QairtContext\_V1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__V1__t).

Typedefs

- typedef struct \_QairtContext\_Handle\_t \*QairtContext\_Handle\_t

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_CreateFn\_t)([QairtBackend\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtBackend.html#_CPPv421QairtBackend_Handle_t), [QairtDevice\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtDevice.html#_CPPv420QairtDevice_Handle_t), [QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_FreeFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_SetConfigFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_GetBinarySizeFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), uint64\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_GetBinaryFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t), uint64\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_ValidateBinaryFn\_t)([QairtBackend\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtBackend.html#_CPPv421QairtBackend_Handle_t), [QairtDevice\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtDevice.html#_CPPv420QairtDevice_Handle_t), [QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_CreateFromBinaryFn\_t)([QairtBackend\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtBackend.html#_CPPv421QairtBackend_Handle_t), [QairtDevice\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtDevice.html#_CPPv420QairtDevice_Handle_t), [QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [QairtSignal\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtSignal.html#_CPPv420QairtSignal_Handle_t), [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t), [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t), [QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_FinalizeFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_CreateGraphFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), const char\*, const [QairtGraph\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv425QairtGraph_ConfigHandle_t), [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_RetrieveGraphFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), const char\*, [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_RegisterMemFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t)\*, uint32\_t, [QairtMem\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv417QairtMem_Handle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_CreateContextTensorFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtTensor\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtTensor.html#_CPPv420QairtTensor_Handle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_UpdateContextTensorsFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), const [QairtTensor\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtTensor.html#_CPPv420QairtTensor_Handle_t)\*, uint64\_t)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_GetBinarySectionSizeFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t), [QairtContext\_SectionType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv426QairtContext_SectionType_t), uint64\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_GetBinarySectionFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t), [QairtContext\_SectionType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv426QairtContext_SectionType_t), [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t), [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t), [QairtSignal\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtSignal.html#_CPPv420QairtSignal_Handle_t), uint64\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_ApplyBinarySectionFn\_t)([QairtContext\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv421QairtContext_Handle_t), [QairtGraph\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtGraph.html#_CPPv419QairtGraph_Handle_t), [QairtContext\_SectionType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv426QairtContext_SectionType_t), [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t), [QairtProfile\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtProfile.html#_CPPv421QairtProfile_Handle_t), [QairtSignal\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtSignal.html#_CPPv420QairtSignal_Handle_t))

    -

Defines

- QAIRT\_CONTEXT\_V1\_ID QAIRT\_MIN\_ID\_CONTEXT

    - 

- QAIRT\_CONTEXT\_ASYNC\_EXEC\_DEPTH\_V1\_ID QAIRT\_MIN\_ID\_CONTEXT + 1

    - 

- QAIRT\_CONTEXT\_ENABLE\_GRAPHS\_V1\_ID QAIRT\_MIN\_ID\_CONTEXT + 2

    - 

- QAIRT\_CONTEXT\_CONFIG\_V1\_ID QAIRT\_MIN\_ID\_CONTEXT + 3

    - 

- QAIRT\_CONTEXT\_BINARY\_BUFFER\_V1\_ID QAIRT\_MIN\_ID\_CONTEXT + 4

    - 

- QAIRT\_CONTEXT\_BINARY\_V1\_ID QAIRT\_MIN\_ID\_CONTEXT + 5

    -

* * *

Context binary serialization and deserialization.

**Include:** `#include "QairtContext/QairtContextBinary.h"`

- struct QairtContext\_BinaryBufferV1\_t

    - *#include &lt;QairtContextBinary.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtContext\_BinaryBuffer\_CreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv436QairtContext_BinaryBuffer_CreateFn_t) create

    - 

- [QairtContext\_BinaryBuffer\_FreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv434QairtContext_BinaryBuffer_FreeFn_t) free

    - 

- [QairtContext\_BinaryBuffer\_SetDataFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv437QairtContext_BinaryBuffer_SetDataFn_t) setData

    - 

- [QairtContext\_BinaryBuffer\_GetDataFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv437QairtContext_BinaryBuffer_GetDataFn_t) getData

    - 

- [QairtContext\_BinaryBuffer\_SetSizeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv437QairtContext_BinaryBuffer_SetSizeFn_t) setSize

    - 

- [QairtContext\_BinaryBuffer\_GetSizeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv437QairtContext_BinaryBuffer_GetSizeFn_t) getSize

    -

- struct QairtContext\_BinaryV1\_t

    - *#include &lt;QairtContextBinary.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtContext\_Binary\_CreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv430QairtContext_Binary_CreateFn_t) create

    - 

- [QairtContext\_Binary\_FreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv428QairtContext_Binary_FreeFn_t) free

    - 

- [QairtContext\_Binary\_GetTypeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv431QairtContext_Binary_GetTypeFn_t) getType

    - 

- [QairtContext\_Binary\_SetBinaryBufferFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv439QairtContext_Binary_SetBinaryBufferFn_t) setBuffer

    - 

- [QairtContext\_Binary\_GetBinaryBufferFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv439QairtContext_Binary_GetBinaryBufferFn_t) getBuffer

    -

Functions

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_BinaryBuffer\_create([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) \*binaryBufferHandle)

    - Create a binary buffer handle.

- Parameters

    - **binaryBufferHandle** – **[out]** A handle to the created binary buffer.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary buffer was successfully created.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *binaryBufferHandle* is NULL.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error while creating binary buffer.

Note

Use corresponding API through [QairtContext\_BinaryBufferV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryBufferV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_BinaryBuffer\_free([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle)

    - Free a binary buffer handle and associated resources.

- Parameters

    - **binaryBufferHandle** – **[in]** A handle to a created binary buffer.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary buffer was successfully freed.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryBufferHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory deallocation error.

Note

Use corresponding API through [QairtContext\_BinaryBufferV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryBufferV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_BinaryBuffer\_setData([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle, void \*data)

    - Set data pointer for a binary buffer.

- Parameters

    - - **binaryBufferHandle** – **[in]** A handle to a created binary buffer.
- **data** – **[in]** Pointer to the data to be associated with the binary buffer.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Data was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryBufferHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *data* is NULL.

Note

Use corresponding API through [QairtContext\_BinaryBufferV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryBufferV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_BinaryBuffer\_setSize([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle, uint64\_t size)

    - Set size for a binary buffer.

- Parameters

    - - **binaryBufferHandle** – **[in]** A handle to a created binary buffer.
- **size** – **[in]** Size of the binary buffer in bytes.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Size was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryBufferHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *size* is invalid.

Note

Use corresponding API through [QairtContext\_BinaryBufferV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryBufferV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_BinaryBuffer\_getData([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle, void \*\*data)

    - Get data pointer from a binary buffer.

- Parameters

    - - **binaryBufferHandle** – **[in]** A handle to a created binary buffer.
- **data** – **[out]** Pointer to retrieve the data associated with the binary buffer.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Data was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryBufferHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *data* is NULL.

Note

Use corresponding API through [QairtContext\_BinaryBufferV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryBufferV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_BinaryBuffer\_getSize([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle, uint64\_t \*size)

    - Get size from a binary buffer.

- Parameters

    - - **binaryBufferHandle** – **[in]** A handle to a created binary buffer.
- **size** – **[out]** Pointer to retrieve the size of the binary buffer in bytes.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Size was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryBufferHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *size* is NULL.

Note

Use corresponding API through [QairtContext\_BinaryBufferV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryBufferV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Binary\_create([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t) \*binaryHandle)

    - Create a binary handle.

- Parameters

    - **binaryHandle** – **[out]** A handle to the created binary.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary was successfully created.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *binaryHandle* is NULL.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error while creating binary.

Note

Use corresponding API through [QairtContext\_BinaryV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Binary\_free([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t) binaryHandle)

    - Free a binary handle and associated resources.

- Parameters

    - **binaryHandle** – **[in]** A handle to a created binary.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary was successfully freed.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory deallocation error.

Note

Use corresponding API through [QairtContext\_BinaryV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_binaryGetType([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t) binaryHandle, [QairtContext\_BinaryType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv425QairtContext_BinaryType_t) \*type)

    - Get the type of a binary.

- Parameters

    - - **binaryHandle** – **[in]** A handle to a created binary.
- **type** – **[out]** Pointer to retrieve the binary type.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Type was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *type* is NULL.

Note

Use corresponding API through [QairtContext\_BinaryV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_binarySetBuffer([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t) binaryHandle, [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) binaryBufferHandle)

    - Set binary buffer for a binary handle.

- Parameters

    - - **binaryHandle** – **[in]** A handle to a created binary.
- **binaryBufferHandle** – **[in]** A handle to a binary buffer to associate with the binary.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary buffer was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryHandle* or *binaryBufferHandle* is not a valid handle.

Note

Use corresponding API through [QairtContext\_BinaryV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_binaryGetBuffer([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t) binaryHandle, [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t) \*binaryBufferHandle)

    - Get binary buffer from a binary handle.

- Parameters

    - - **binaryHandle** – **[in]** A handle to a created binary.
- **binaryBufferHandle** – **[out]** Pointer to retrieve the binary buffer handle.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary buffer was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *binaryHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *binaryBufferHandle* is NULL.

Note

Use corresponding API through [QairtContext\_BinaryV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__BinaryV1__t).

Enums

- enum QairtContext\_BinaryType\_t

    - Define Qairt Context Binary Compatibility Type.

*Values:*

- enumerator QAIRT\_CONTEXT\_BINARY\_TYPE\_RAW = 0

    - 

- enumerator QAIRT\_CONTEXT\_BINARY\_TYPE\_MEM\_HANDLE = 1

    - 

- enumerator QAIRT\_CONTEXT\_BINARY\_TYPE\_UNDEFINED = 0x7FFFFFF

    -

Typedefs

- typedef struct \_QairtContext\_BinaryBufferHandle\_t \*QairtContext\_BinaryBufferHandle\_t

    - Define Context Binary Buffer.

- typedef struct \_QairtContext\_BinaryHandle\_t \*QairtContext\_BinaryHandle\_t

    - Define Context Binary.

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_BinaryBuffer\_CreateFn\_t)([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t)\*)

    - Binary Buffer.

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_BinaryBuffer\_FreeFn\_t)([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_BinaryBuffer\_SetDataFn\_t)([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t), void\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_BinaryBuffer\_GetDataFn\_t)([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t), void\*\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_BinaryBuffer\_SetSizeFn\_t)([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t), uint64\_t)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_BinaryBuffer\_GetSizeFn\_t)([QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t), uint64\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Binary\_CreateFn\_t)([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t)\*)

    - Binary.

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Binary\_FreeFn\_t)([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Binary\_GetTypeFn\_t)([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t), [QairtContext\_BinaryType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv425QairtContext_BinaryType_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Binary\_SetBinaryBufferFn\_t)([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t), [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Binary\_GetBinaryBufferFn\_t)([QairtContext\_BinaryHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_BinaryHandle_t), [QairtContext\_BinaryBufferHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_BinaryBufferHandle_t)\*)

    -

* * *

Common context types and error codes.

**Include:** `#include "QairtContext/QairtContextCommon.h"`

Enums

- enum QairtContext\_Error\_t

    - QAIRT Context API result / error codes.

*Values:*

- enumerator QAIRT\_CONTEXT\_MIN\_ERROR = QAIRT\_MIN\_ERROR\_CONTEXT

    - 

- enumerator QAIRT\_CONTEXT\_NO\_ERROR = QAIRT\_SUCCESS

    - QAIRT context success.

- enumerator QAIRT\_CONTEXT\_ERROR\_UNSUPPORTED\_FEATURE = [QAIRT\_COMMON\_ERROR\_NOT\_SUPPORTED](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv4N19QairtCommon_Error_t32QAIRT_COMMON_ERROR_NOT_SUPPORTEDE)

    - There is optional API component that is not supported yet.

See QairtCapability

- enumerator QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC = [QAIRT\_COMMON\_ERROR\_MEM\_ALLOC](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv4N19QairtCommon_Error_t28QAIRT_COMMON_ERROR_MEM_ALLOCE)

    - Context-specific memory allocation/deallocation failure.

- enumerator QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT = 5000

    - An argument to QAIRT context API is deemed invalid by a backend.

- enumerator QAIRT\_CONTEXT\_ERROR\_CTX\_DOES\_NOT\_EXIST = 5001

    - A QAIRT context has not yet been created in the backend.

- enumerator QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE = 5002

    - Invalid/NULL QAIRT context handle.

- enumerator QAIRT\_CONTEXT\_ERROR\_NOT\_FINALIZED = 5003

    - Attempting an operation when graphs in a context haven’t been finalized.

- enumerator QAIRT\_CONTEXT\_ERROR\_BINARY\_VERSION = 5004

    - Attempt to access context binary with an incompatible version.

- enumerator QAIRT\_CONTEXT\_ERROR\_CREATE\_FROM\_BINARY = 5005

    - Failure to create context from binary.

- enumerator QAIRT\_CONTEXT\_ERROR\_GET\_BINARY\_SIZE\_FAILED = 5006

    - Failure to get size of a QAIRT serialized context.

- enumerator QAIRT\_CONTEXT\_ERROR\_GET\_BINARY\_FAILED = 5007

    - Failure to generate a QAIRT serialized context.

- enumerator QAIRT\_CONTEXT\_ERROR\_BINARY\_CONFIGURATION = 5008

    - Invalid context binary configuration.

- enumerator QAIRT\_CONTEXT\_ERROR\_SET\_PROFILE = 5009

    - Failure to set profile.

- enumerator QAIRT\_CONTEXT\_ERROR\_INVALID\_CONFIG = 5010

    - Invalid config.

- enumerator QAIRT\_CONTEXT\_ERROR\_BINARY\_SUBOPTIMAL = 5011

    - Attempt to create a context from suboptimal binary.

- enumerator QAIRT\_CONTEXT\_ERROR\_ABORTED = 5012

    - Call aborted early due to a QairtSignal\_trigger call issued to the observed signal object.

- enumerator QAIRT\_CONTEXT\_ERROR\_TIMED\_OUT = 5013

    - Call aborted early due to a QairtSignal timeout.

- enumerator QAIRT\_CONTEXT\_ERROR\_INCREMENT\_INVALID\_BUFFER = 5014

    - Incremental Binary Buffer was not allocated by backend.

- enumerator QAIRT\_CONTEXT\_ERROR\_MEM\_ALREADY\_REGISTERED = 5015

    - Memory has already been registered with the context.

- enumerator QAIRT\_CONTEXT\_ERROR\_MEM\_UNSUPPORTED\_TYPE = 5016

    - Backend does not support the requested memory type.

- enumerator QAIRT\_CONTEXT\_ERROR\_MEM\_MAPPING = 5017

    - Failed to map between memory file descriptor and memory address.

- enumerator QAIRT\_CONTEXT\_ERROR\_MEM\_INVALID\_SHAPE = 5018

    - Invalid memory shape based on backend’s memory restrictions.

- enumerator QAIRT\_CONTEXT\_MAX\_ERROR = QAIRT\_MAX\_ERROR\_CONTEXT

    - 

- enumerator QAIRT\_CONTEXT\_ERROR\_UNDEFINED = 0x7FFFFFFF

    - Unused, present to ensure 32 bits.

- enum QairtContext\_SectionType\_t

    - Enum to distinguish type of binary section to retrieve.

*Values:*

- enumerator QAIRT\_CONTEXT\_SECTION\_UPDATABLE = 1

    - Portion of the context binary containing recent updates applied through QairtTensor\_updateGraphTensors() or QairtTensor\_updateContextTensors()

- enumerator QAIRT\_CONTEXT\_SECTION\_UPDATABLE\_WEIGHTS = 2

    - Portion of the context binary containing recent static data updates applied through QairtTensor\_updateGraphTensors() or QairtTensor\_updateContextTensors()

- enumerator QAIRT\_CONTEXT\_SECTION\_UPDATABLE\_QUANT\_PARAMS = 3

    - Portion of the context binary containing recent quantization updates applied through QairtTensor\_updateGraphTensors() or QairtTensor\_updateContextTensors()

- enumerator QAIRT\_CONTEXT\_SECTION\_UNDEFINED = 0x7FFFFFFF

    - Unused, present to ensure 32 bits.

* * *

Context configuration options.

**Include:** `#include "QairtContext/QairtContextConfig.h"`

- struct QairtContext\_AsyncExecutionDepthV1\_t

    - *#include &lt;QairtContextConfig.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtContext\_AsyncExecutionCreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv437QairtContext_AsyncExecutionCreateFn_t) create

    - 

- [QairtContext\_AsyncExecutionFreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv435QairtContext_AsyncExecutionFreeFn_t) free

    - 

- [QairtContext\_AsyncExecutionSetDepthFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv439QairtContext_AsyncExecutionSetDepthFn_t) setAsyncExecutionDepth

    - 

- [QairtContext\_AsyncExecutionGetDepthFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv439QairtContext_AsyncExecutionGetDepthFn_t) getAsyncExecutionDepth

    -

- struct QairtContext\_ConfigV1\_t

    - *#include &lt;QairtContextConfig.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtContext\_Config\_CreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv430QairtContext_Config_CreateFn_t) create

    - 

- [QairtContext\_Config\_FreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv428QairtContext_Config_FreeFn_t) free

    - 

- [QairtContext\_Config\_SetCustomConfigsFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_Config_SetCustomConfigsFn_t) setCustomConfigs

    - 

- [QairtContext\_Config\_GetNumCustomConfigsFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv443QairtContext_Config_GetNumCustomConfigsFn_t) getNumCustomConfigs

    - 

- [QairtContext\_Config\_GetCustomConfigAtFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv441QairtContext_Config_GetCustomConfigAtFn_t) getCustomConfigAt

    - 

- [QairtContext\_Config\_SetPriorityFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv435QairtContext_Config_SetPriorityFn_t) setPriority

    - 

- [QairtContext\_Config\_GetPriorityFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv435QairtContext_Config_GetPriorityFn_t) getPriority

    - 

- [QairtContext\_Config\_SetOemKeyFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_Config_SetOemKeyFn_t) setOemKey

    - 

- [QairtContext\_Config\_GetOemKeyFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_Config_GetOemKeyFn_t) getOemKey

    - 

- [QairtContext\_Config\_SetAsyncQueueDepthFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv442QairtContext_Config_SetAsyncQueueDepthFn_t) setAsyncQueueDepth

    - 

- [QairtContext\_Config\_GetAsyncQueueDepthFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv442QairtContext_Config_GetAsyncQueueDepthFn_t) getAsyncQueueDepth

    - 

- [QairtContext\_Config\_SetEnableGraphFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv438QairtContext_Config_SetEnableGraphFn_t) setEnableGraph

    - 

- [QairtContext\_Config\_GetNumEnabledGraphsFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv443QairtContext_Config_GetNumEnabledGraphsFn_t) getNumEnabledGraphs

    - 

- [QairtContext\_Config\_GetEnabledGraphAtFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv441QairtContext_Config_GetEnabledGraphAtFn_t) getEnabledGraphAt

    - 

- [QairtContext\_Config\_SetMemoryLimitHintFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv442QairtContext_Config_SetMemoryLimitHintFn_t) setMemoryLimitHint

    - 

- [QairtContext\_Config\_GetMemoryLimitHintFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv442QairtContext_Config_GetMemoryLimitHintFn_t) getMemoryLimitHint

    - 

- [QairtContext\_Config\_SetIsPersistentBinaryFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv445QairtContext_Config_SetIsPersistentBinaryFn_t) setIsPersistentBinary

    - 

- [QairtContext\_Config\_GetIsPersistentBinaryFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv445QairtContext_Config_GetIsPersistentBinaryFn_t) getIsPersistentBinary

    - 

- [QairtContext\_Config\_SetBinaryCompatibilityFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv446QairtContext_Config_SetBinaryCompatibilityFn_t) setBinaryCompatibilityType

    - 

- [QairtContext\_Config\_GetBinaryCompatibilityFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv446QairtContext_Config_GetBinaryCompatibilityFn_t) getBinaryCompatibilityType

    -

Functions

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_AsyncExecutionCreate([QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t) \*asyncDepthHandle)

    - Create an async execution depth handle.

- Parameters

    - **asyncDepthHandle** – **[out]** A handle to the created async execution depth.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Async execution depth was successfully created.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *asyncDepthHandle* is NULL.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error while creating async execution depth.

Note

Use corresponding API through [QairtContext\_AsyncExecutionDepthV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__AsyncExecutionDepthV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_AsyncExecutionFree([QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t) asyncDepthHandle)

    - Free an async execution depth handle and associated resources.

- Parameters

    - **asyncDepthHandle** – **[in]** A handle to a created async execution depth.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Async execution depth was successfully freed.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *asyncDepthHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory deallocation error.

Note

Use corresponding API through [QairtContext\_AsyncExecutionDepthV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__AsyncExecutionDepthV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_AsyncExecutionSetDepth([QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t) asyncDepthHandle, uint32\_t depth)

    - Set the depth value for async execution.

- Parameters

    - - **asyncDepthHandle** – **[in]** A handle to a created async execution depth.
- **depth** – **[in]** The depth value to set.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Depth was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *asyncDepthHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *depth* is invalid.

Note

Use corresponding API through [QairtContext\_AsyncExecutionDepthV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__AsyncExecutionDepthV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_AsyncExecutionGetDepth([QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t) asyncDepthHandle, uint32\_t \*depth)

    - Get the depth value for async execution.

- Parameters

    - - **asyncDepthHandle** – **[in]** A handle to a created async execution depth.
- **depth** – **[out]** Pointer to retrieve the depth value.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Depth was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *asyncDepthHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *depth* is NULL.

Note

Use corresponding API through [QairtContext\_AsyncExecutionDepthV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__AsyncExecutionDepthV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_create([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) \*configHandle)

    - Create a context configuration handle.

- Parameters

    - **configHandle** – **[out]** A handle to the created context configuration.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Context configuration was successfully created.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *configHandle* is NULL.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory allocation error while creating context configuration.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_free([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle)

    - Free a context configuration handle and associated resources.

- Parameters

    - **configHandle** – **[in]** A handle to a created context configuration.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Context configuration was successfully freed.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_MEM\_ALLOC: Memory deallocation error.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_setCustomConfigs([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [QairtContext\_CustomConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_CustomConfigHandle_t) \*customConfigHandles, uint32\_t numCustomConfigs)

    - Set custom configurations for a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **customConfigHandles** – **[in]** An array of custom configuration handles to set on the context configuration.
- **numCustomConfigs** – **[in]** The number of custom configuration handles in the *customConfigHandles* array.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Custom configurations were successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle, or one or more handles in *customConfigHandles* are not valid handles.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *customConfigHandles* is NULL when *numCustomConfigs* is greater than zero.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getNumCustomConfigs([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, uint32\_t \*numCustomConfigs)

    - Get the number of custom configurations set on a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **numCustomConfigs** – **[out]** The number of custom configuration handles currently set on the context configuration.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Count was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *numCustomConfigs* is NULL.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getCustomConfigAt([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, uint32\_t index, [QairtContext\_CustomConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_CustomConfigHandle_t) \*customConfigHandle)

    - Get the custom configuration handle at a given index.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **index** – **[in]** Index of the custom configuration to retrieve. Must be less than the value returned by [QairtContext\_Config\_getNumCustomConfigs()](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#QairtContextConfig_8h_1a8a6aff99e897ca7ebb290267a4b2d277).
- **customConfigHandle** – **[out]** The retrieved custom configuration handle. Should not be freed.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Handle was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *customConfigHandle* is NULL or *index* is out of range.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_setPriority([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [Qairt\_Priority\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv416Qairt_Priority_t) priority)

    - Set the priority for a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **priority** – **[in]** The priority value to set.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Priority was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *priority* is invalid.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getPriority([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [Qairt\_Priority\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv416Qairt_Priority_t) \*priority)

    - Get the priority from a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **priority** – **[out]** Pointer to retrieve the priority value.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Priority was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *priority* is NULL.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_setOemKey([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, const char \*oemKey)

    - Set the OEM key for a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **oemKey** – **[in]** The OEM key string to set.

- Returns

    - Error code:

- QAIRT\_SUCCESS: OEM key was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *oemKey* is NULL.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getOemKey([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, const char \*\*oemKey)

    - Get the OEM key from a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **oemKey** – **[out]** Pointer to retrieve the OEM key string.

- Returns

    - Error code:

- QAIRT\_SUCCESS: OEM key was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *oemKey* is NULL.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_setAsyncQueueDepth([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t) depthHandle)

    - Set the async queue depth for a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **depthHandle** – **[in]** A handle to an async execution depth.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Async queue depth was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* or *depthHandle* is not a valid handle.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getAsyncQueueDepth([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t) \*depthHandle)

    - Get the async queue depth from a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **depthHandle** – **[out]** Pointer to retrieve the async execution depth handle.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Async queue depth was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *depthHandle* is NULL.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_setMemoryLimitHint([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, uint64\_t memoryLimitHint)

    - Set the memory limit hint for a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **memoryLimitHint** – **[in]** The memory limit hint value in bytes.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Memory limit hint was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *memoryLimitHint* is invalid.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getMemoryLimitHint([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, uint64\_t \*memoryLimitHint)

    - Get the memory limit hint from a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **memoryLimitHint** – **[out]** Pointer to retrieve the memory limit hint value.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Memory limit hint was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *memoryLimitHint* is NULL.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_setIsPersistentBinary([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, uint8\_t isPersistentBinary)

    - Set the persistent binary flag for a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **isPersistentBinary** – **[in]** Flag indicating whether binary should be persistent.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Persistent binary flag was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *isPersistentBinary* is invalid.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getIsPersistentBinary([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, uint8\_t \*isPersistentBinary)

    - Get the persistent binary flag from a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **isPersistentBinary** – **[out]** Pointer to retrieve the persistent binary flag.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Persistent binary flag was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *isPersistentBinary* is NULL.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_setBinaryCompatibilityType([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [QairtContext\_BinaryCompatibilityType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv438QairtContext_BinaryCompatibilityType_t) compatibilityType)

    - Set the binary compatibility type for a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **compatibilityType** – **[in]** The binary compatibility type to set.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary compatibility type was successfully set.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *compatibilityType* is invalid.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getBinaryCompatibilityType([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, [QairtContext\_BinaryCompatibilityType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv438QairtContext_BinaryCompatibilityType_t) \*compatibilityType)

    - Get the binary compatibility type from a context configuration.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **compatibilityType** – **[out]** Pointer to retrieve the binary compatibility type.

- Returns

    - Error code:

- QAIRT\_SUCCESS: Binary compatibility type was successfully retrieved.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle.
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *compatibilityType* is NULL.

Note

Use corresponding API through [QairtContext\_ConfigV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#structQairtContext__ConfigV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_setEnableGraph([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, const char \*graphName)

    - Adds an enabled graph to the Context Config.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **graphName** – **[in]** A null-terminated graph name.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *graphName* is NULL or invalid

Note

Use corresponding API through QairtContext\_ConfigHandle\_t.

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getNumEnabledGraphs([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, uint32\_t \*numEnabledGraphs)

    - Gets the number of enabled graphs associated with a Context Config handle.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **numEnabledGraphs** – **[out]** Pointer to retrieve the number of enabled graphs associated with the Context Config handle.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *numEnabledGraphs* is NULL

Note

Use corresponding API through QairtContext\_ConfigHandle\_t.

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtContext\_Config\_getEnabledGraphAt([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t) configHandle, uint32\_t index, const char \*\*graphName)

    - Gets enabled graph name at a particular index associated with the Context Config Handle.

- Parameters

    - - **configHandle** – **[in]** A handle to a created context configuration.
- **index** – **[in]** Index of the enabled graph. Value must be less than getNumEnabledGraphs.
- **graphName** – **[out]** The null-terminated graph name.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_CONTEXT\_ERROR\_INVALID\_HANDLE: *configHandle* is not a valid handle
- QAIRT\_CONTEXT\_ERROR\_INVALID\_ARGUMENT: *graphName* is NULL or *index* is invalid

Note

Use corresponding API through QairtContext\_ConfigHandle\_t.

Enums

- enum QairtContext\_BinaryCompatibilityType\_t

    - Define Qairt Context Binary Compatibility Type.

*Values:*

- enumerator QAIRT\_CONTEXT\_BINARY\_COMPATIBILITY\_PERMISSIVE = 0

    - A binary cache is compatible if it could run on the device.

This is the default.

- enumerator QAIRT\_CONTEXT\_BINARY\_COMPATIBILITY\_STRICT = 1

    - A binary cache is compatible if it could run on the device and fully utilize hardware capability, otherwise QairtContext\_CreateFromBinary may return QAIRT\_CONTEXT\_ERROR\_BINARY\_SUBOPTIMAL.

- enumerator QAIRT\_CONTEXT\_BINARY\_COMPATIBILITY\_TYPE\_UNDEFINED = 0x7FFFFFF

    -

Typedefs

- typedef struct \_QairtContext\_CustomConfigHandle\_t \*QairtContext\_CustomConfigHandle\_t

    - Define Qairt Context Custom Config handle.

- typedef struct \_QairtContext\_AsyncExecutionDepthHandle\_t \*QairtContext\_AsyncExecutionDepthHandle\_t

    - Define Qairt Context Async Execution depth handle.

- typedef struct \_QairtContext\_OemHandle\_t \*QairtContext\_OemHandle\_t

    - Define OemKey handle.

- typedef struct \_QairtContext\_ConfigHandle\_t \*QairtContext\_ConfigHandle\_t

    - Define Qairt Context Configuration handle.

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_AsyncExecutionSetDepthFn\_t)([QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t), uint32\_t)

    - AsyncExecutionDepth.

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_AsyncExecutionGetDepthFn\_t)([QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t), uint32\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_AsyncExecutionCreateFn\_t)([QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_AsyncExecutionFreeFn\_t)([QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_CreateFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t)\*)

    - ContextConfig.

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_FreeFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_SetCustomConfigsFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [QairtContext\_CustomConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_CustomConfigHandle_t)\*, uint32\_t numCustomConfigs)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetNumCustomConfigsFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), uint32\_t \*numConfigs)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetCustomConfigAtFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), uint32\_t index, [QairtContext\_CustomConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv433QairtContext_CustomConfigHandle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_SetPriorityFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [Qairt\_Priority\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv416Qairt_Priority_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetPriorityFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [Qairt\_Priority\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv416Qairt_Priority_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_SetOemKeyFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), const char \*oemKey)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetOemKeyFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), const char \*\*oemKey)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_SetAsyncQueueDepthFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetAsyncQueueDepthFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [QairtContext\_AsyncExecutionDepthHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv440QairtContext_AsyncExecutionDepthHandle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_SetEnableGraphFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), const char \*graphName)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetNumEnabledGraphsFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), uint32\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetEnabledGraphAtFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), uint32\_t, const char\*\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_SetMemoryLimitHintFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), uint64\_t)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetMemoryLimitHintFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), uint64\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_SetIsPersistentBinaryFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), uint8\_t)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetIsPersistentBinaryFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), uint8\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_SetBinaryCompatibilityFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [QairtContext\_BinaryCompatibilityType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv438QairtContext_BinaryCompatibilityType_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtContext\_Config\_GetBinaryCompatibilityFn\_t)([QairtContext\_ConfigHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv427QairtContext_ConfigHandle_t), [QairtContext\_BinaryCompatibilityType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtContext.html#_CPPv438QairtContext_BinaryCompatibilityType_t)\*)

    -

* * *

Custom context property callbacks.

**Include:** `#include "QairtContext/QairtContextProperty.h"`

Warning

doxygenfile: Cannot find file “QairtContext/QairtContextProperty.h

Last Published: Jun 04, 2026

[Previous Topic
QairtSystem](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/QairtSystem.md) [Next Topic
QairtGraph](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/QairtGraph.md)