File QnnSystemContext.h¶
↰ Parent directory (include/QNN/System)
QNN System Context API.
Contents
Definition (include/QNN/System/QnnSystemContext.h)¶
Detailed Description¶
This is a system API header dedicated to extensions to QnnContext that provide backend-agnostic services to users.
Includes¶
QnnDevice.h(File QnnDevice.h)QnnTypes.h(File QnnTypes.h)System/QnnSystemCommon.h(File QnnSystemCommon.h)
Included By¶
Classes¶
Enums¶
Functions¶
Defines¶
Typedefs¶
Full File Listing¶
QNN System Context API.
This is a system API header dedicated to extensions to QnnContext
that provide backend-agnostic services to users.
Defines
-
QNN_SYSTEM_CONTEXT_GRAPH_INFO_V1_INIT
{ \
NULL, /* graphName */ \
0, /* numGraphInputs */ \
NULL, /* graphInputs */ \
0, /* numGraphOutputs */ \
NULL, /* graphOutputs */ \
}
¶ QnnSystemContext_GraphInfoV1_t initializer macro.
-
QNN_SYSTEM_CONTEXT_GRAPH_INFO_V2_INIT
{ \
NULL, /* graphName */ \
0, /* numGraphInputs */ \
NULL, /* graphInputs */ \
0, /* numGraphOutputs */ \
NULL, /* graphOutputs */ \
0, /* numUpdateableTensors */ \
NULL, /* updateableTensors */ \
}
¶ QnnSystemContext_GraphInfoV2_t initializer macro.
-
QNN_SYSTEM_CONTEXT_GRAPH_INFO_V3_INIT
{ \
NULL, /* graphName */ \
0, /* numGraphInputs */ \
NULL, /* graphInputs */ \
0, /* numGraphOutputs */ \
NULL, /* graphOutputs */ \
0, /* numUpdateableTensors */ \
NULL, /* updateableTensors */ \
0, /* graphBlobInfoSize */ \
NULL, /* graphInfoBlob */ \
0, /* startOpIndex */ \
0, /* endOpIndex */ \
}
¶ QnnSystemContext_GraphInfoV3_t initializer macro.
-
QNN_SYSTEM_CONTEXT_GRAPH_INFO_INIT { \
QNN_SYSTEM_CONTEXT_GRAPH_INFO_UNDEFINED
, /* version */ \
{ \
QNN_SYSTEM_CONTEXT_GRAPH_INFO_V1_INIT/* graphInfoV1 */ \
} \
}
¶ QnnSystemContext_GraphInfo_t initializer macro.
-
QNN_SYSTEM_CONTEXT_BINARY_INFO_V1_INIT
{ \
0, /* backendId */ \
NULL, /* buildId */ \
QNN_VERSION_INIT, /* coreApiVersion */ \ QNN_VERSION_INIT, /* backendApiVersion */ \
NULL, /* socVersion */ \
QNN_VERSION_INIT, /* hwInfoBlobVersion */ \ QNN_VERSION_INIT, /* contextBlobVersion */ \
0, /* hwInfoBlobSize */ \
NULL, /* hwInfoBlob */ \
0, /* contextBlobSize */ \
0, /* numContextTensors */ \
NULL, /* contextTensors */ \
0, /* numGraphs */ \
NULL /* graphs */ \
}
¶ QnnSystemContext_BinaryInfoV1_t initializer macro.
-
QNN_SYSTEM_CONTEXT_BINARY_INFO_V2_INIT
{ \
0, /* backendId */ \
NULL, /* buildId */ \
QNN_VERSION_INIT, /* coreApiVersion */ \ QNN_VERSION_INIT, /* backendApiVersion */ \
NULL, /* socVersion */ \
QNN_VERSION_INIT, /* hwInfoBlobVersion */ \ QNN_VERSION_INIT, /* contextBlobVersion */ \
0, /* hwInfoBlobSize */ \
NULL, /* hwInfoBlob */ \
0, /* contextBlobSize */ \
0, /* numContextTensors */ \
NULL, /* contextTensors */ \
0, /* numGraphs */ \
NULL, /* graphs */ \
NULL /* platformInfo */ \
}
¶ QnnSystemContext_BinaryInfoV2_t initializer macro.
-
QNN_SYSTEM_CONTEXT_BINARY_INFO_V3_INIT
{ \
0, /* backendId */ \
NULL, /* buildId */ \
QNN_VERSION_INIT, /* coreApiVersion */ \ QNN_VERSION_INIT, /* backendApiVersion */ \
NULL, /* socVersion */ \
QNN_VERSION_INIT, /* contextBlobVersion */ \
0, /* contextBlobSize */ \
0, /* numContextTensors */ \
NULL, /* contextTensors */ \
0, /* numGraphs */ \
NULL, /* graphs */ \
NULL, /* platformInfo */ \
0, /* contextMetadataSize */ \
NULL, /* contextMetadata */ \
0 /* socModel */ \
}
¶ QnnSystemContext_BinaryInfoV3_t initializer macro.
-
QNN_SYSTEM_CONTEXT_BINARYINFO_INIT { \
QNN_SYSTEM_CONTEXT_BINARY_INFO_UNDEFINED
, /* version */ \
{ \
QNN_SYSTEM_CONTEXT_BINARY_INFO_V1_INIT/* contextBinaryInfoV1 */ \
} \
}
¶ QnnSystemContext_BinaryInfo_t initializer macro.
Typedefs
-
typedef void *QnnSystemContext_Handle_t¶
A typedef to indicate a QNN System context handle.
Enums
-
enum QnnSystemContext_Error_t
QNN System Context API result / error codes.
Values:
-
enumerator QNN_SYSTEM_CONTEXT_MINERROR = 30000
-
enumerator QNN_SYSTEM_CONTEXT_NO_ERROR = QNN_SYSTEM_COMMON_NO_ERROR
Qnn System Context success.
-
enumerator QNN_SYSTEM_CONTEXT_ERROR_UNSUPPORTED_FEATURE = QNN_SYSTEM_COMMON_ERROR_UNSUPPORTED_FEATURE
There is optional API component that is not supported yet.
-
enumerator QNN_SYSTEM_CONTEXT_ERROR_INVALID_HANDLE = QNN_SYSTEM_COMMON_ERROR_INVALID_HANDLE
QNN System Context invalid handle.
-
enumerator QNN_SYSTEM_CONTEXT_ERROR_INVALID_ARGUMENT = QNN_SYSTEM_COMMON_ERROR_INVALID_ARGUMENT
One or more arguments to a System Context API is/are NULL/invalid.
-
enumerator QNN_SYSTEM_CONTEXT_ERROR_OPERATION_FAILED = QNN_SYSTEM_CONTEXT_MINERROR + 2
Generic Failure in achieving the objective of a System Context API.
-
enumerator QNN_SYSTEM_CONTEXT_ERROR_MALFORMED_BINARY = QNN_SYSTEM_CONTEXT_MINERROR + 10
Malformed context binary.
-
enumerator QNN_SYSTEM_CONTEXT_MAXERROR = 49999
-
enumerator QNN_SYSTEM_CONTEXT_MINERROR = 30000
Functions
-
Qnn_ErrorHandle_t QnnSystemContext_create(QnnSystemContext_Handle_t *sysCtxHandle)¶
A function to create an instance of the QNN system context.
- Parameters
sysCtxHandle – [out] A handle to the created instance of a systemContext entity
- Returns
Error code
QNN_SUCCESS: Successfully created a systemContext entity
QNN_SYSTEM_CONTEXT_ERROR_INVALID_ARGUMENT: sysCtxHandle is NULL
QNN_COMMON_ERROR_MEM_ALLOC: Error encountered in allocating memory for systemContext instance
QNN_SYSTEM_CONTEXT_ERROR_UNSUPPORTED_FEATURE: system context features not supported
-
Qnn_ErrorHandle_t QnnSystemContext_getBinaryInfo(QnnSystemContext_Handle_t sysCtxHandle, void *binaryBuffer, uint64_t binaryBufferSize, const QnnSystemContext_BinaryInfo_t **binaryInfo, Qnn_ContextBinarySize_t *binaryInfoSize)¶
A function to get context info from the serialized binary buffer.
- Deprecated:
Use QnnSystemContext_getMetadata instead
- Parameters
sysCtxHandle – [in] Handle to the systemContext object
binaryBuffer – [in] Serialized buffer representing a context binary.
binaryBufferSize – [in] Size of context binary in bytes
binaryInfo – [out] Pointer to memory that will be populated with user-visible information about the context binary. Memory for this information is internally allocated and managed by QNN, and is associated with the handle sysCtxHandle created with QnnSystemContext_create(). This memory has to be released by calling QnnSystemContext_free() when it is no longer needed.
binaryInfoSize – [out] Size of metadata describing the contents of the context binary, in bytes.
- Returns
Error code
QNN_SUCCESS: Successfully returned context binary info to caller
QNN_SYSTEM_CONTEXT_ERROR_INVALID_HANDLE: Invalid System Context handle
QNN_SYSTEM_CONTEXT_ERROR_INVALID_ARGUMENT: One or more arguments to the API is/are NULL/invalid.
QNN_SYSTEM_CONTEXT_ERROR_OPERATION_FAILED: Failed to obtain context binary info
QNN_SYSTEM_CONTEXT_ERROR_MALFORMED_BINARY: The binary is either malformed or cannot be parsed successfully.
QNN_SYSTEM_CONTEXT_ERROR_UNSUPPORTED_FEATURE: not supported
-
Qnn_ErrorHandle_t QnnSystemContext_getMetadata(QnnSystemContext_Handle_t sysCtxHandle, const void *binaryBuffer, Qnn_ContextBinarySize_t binaryBufferSize, const QnnSystemContext_BinaryInfo_t **binaryInfo)¶
A function to get meta data from the serialized binary buffer.
- Parameters
sysCtxHandle – [in] Handle to the systemContext object
binaryBuffer – [in] Serialized buffer representing a const context binary.
binaryBufferSize – [in] Size of context binary in bytes
binaryInfo – [out] Pointer to memory that will be populated with user-visible information about the context binary. Memory for this information is internally allocated and managed by QNN, and is associated with the handle sysCtxHandle created with QnnSystemContext_create(). This memory has to be released by calling QnnSystemContext_free() when it is no longer needed.
- Returns
Error code
QNN_SUCCESS: Successfully returned context binary info to caller
QNN_SYSTEM_CONTEXT_ERROR_INVALID_HANDLE: Invalid System Context handle
QNN_SYSTEM_CONTEXT_ERROR_INVALID_ARGUMENT: One or more arguments to the API is/are NULL/invalid.
QNN_SYSTEM_CONTEXT_ERROR_OPERATION_FAILED: Failed to obtain context binary info
QNN_SYSTEM_CONTEXT_ERROR_MALFORMED_BINARY: The binary is either malformed or cannot be parsed successfully.
QNN_SYSTEM_CONTEXT_ERROR_UNSUPPORTED_FEATURE: not supported
-
Qnn_ErrorHandle_t QnnSystemContext_free(QnnSystemContext_Handle_t sysCtxHandle)¶
A function to free the instance of the System Context object. This API clears any intermediate memory allocated and associated with a valid handle.
- Parameters
sysCtxHandle – [in] Handle to the System Context object
- Returns
Error code
QNN_SUCCESS: Successfully freed instance of System Context
QNN_SYSTEM_CONTEXT_ERROR_INVALID_HANDLE: Invalid System Context handle to free
QNN_SYSTEM_CONTEXT_ERROR_UNSUPPORTED_FEATURE: not supported
-
struct QnnSystemContext_GraphInfoV1_t¶
- #include <QnnSystemContext.h>
Struct that provides information about graphs registered with a context. This is version V1 of the structure.
Public Members
-
const char *graphName¶
Name of graph.
-
uint32_t numGraphInputs¶
Number of input tensors to graph.
-
Qnn_Tensor_t *graphInputs¶
List of input tensors to graph.
-
uint32_t numGraphOutputs¶
Number of output tensors from graph.
-
Qnn_Tensor_t *graphOutputs¶
List of output tensors from graph.
-
const char *graphName¶
-
struct QnnSystemContext_GraphInfoV2_t¶
- #include <QnnSystemContext.h>
Struct that provides information about graphs registered with a context. This is version V2 of the structure.
Public Members
-
const char *graphName¶
Name of graph.
-
uint32_t numGraphInputs¶
Number of input tensors to graph.
-
Qnn_Tensor_t *graphInputs¶
List of input tensors to graph.
-
uint32_t numGraphOutputs¶
Number of output tensors from graph.
-
Qnn_Tensor_t *graphOutputs¶
List of output tensors from graph.
-
uint32_t numUpdateableTensors¶
Number of updatable tensors from graph.
-
Qnn_Tensor_t *updateableTensors¶
List of updatable tensors from graph.
-
const char *graphName¶
-
struct QnnSystemContext_GraphInfoV3_t¶
- #include <QnnSystemContext.h>
Struct that provides information about graphs registered with a context. This is version V3 of the structure.
Public Members
-
const char *graphName¶
Name of graph.
-
uint32_t numGraphInputs¶
Number of input tensors to graph.
-
Qnn_Tensor_t *graphInputs¶
List of input tensors to graph.
-
uint32_t numGraphOutputs¶
Number of output tensors from graph.
-
Qnn_Tensor_t *graphOutputs¶
List of output tensors from graph.
-
uint32_t numUpdateableTensors¶
Number of updatable tensors from graph.
-
Qnn_Tensor_t *updateableTensors¶
List of updatable tensors from graph.
-
uint32_t graphBlobInfoSize¶
Size of graph info blob stored in the context binary, in bytes.
-
void *graphBlobInfo¶
Graph Info blob. Needs to be interpreted based on backend-specific instructions.
-
uint32_t startOpIndex¶
start Op Index of a graph
-
uint32_t endOpIndex¶
end Op Index of a graph
-
const char *graphName¶
-
struct QnnSystemContext_GraphInfo_t¶
- #include <QnnSystemContext.h>
Public Members
-
union unnamed
- #include <QnnSystemContext.h>
Public Members
-
QnnSystemContext_GraphInfoV1_t graphInfoV1
-
QnnSystemContext_GraphInfoV2_t graphInfoV2
-
QnnSystemContext_GraphInfoV3_t graphInfoV3
-
QnnSystemContext_GraphInfoV1_t graphInfoV1
-
union unnamed
-
struct QnnSystemContext_BinaryInfoV1_t¶
- #include <QnnSystemContext.h>
Struct that provides information about contents of a context binary. This is version V1 of the structure.
Public Members
-
uint32_t backendId¶
Backend that this context binary is associated with.
-
const char *buildId¶
Build ID of QNN SDK used to create context binary.
-
Qnn_Version_t coreApiVersion¶
QNN core API version.
-
Qnn_Version_t backendApiVersion¶
Version of backend-specific API for the backend producing context binary.
-
const char *socVersion¶
Version of the SOC for which context binary was generated.
-
Qnn_Version_t hwInfoBlobVersion¶
Version of hardware info blob stored in the context binary.
-
Qnn_Version_t contextBlobVersion¶
Version of the opaque context blob generated by backend that is packed into the context binary Note that the context blob is not part of metadata. It is described by the metadata
-
uint32_t hwInfoBlobSize¶
Size of hardware info blob stored in the context binary, in bytes.
-
void *hwInfoBlob¶
Hardware Info blob. Needs to be interpreted based on backend-specific instructions.
-
uint64_t contextBlobSize¶
Size of opaque backend-specific context blob, in bytes.
-
uint32_t numContextTensors¶
Number of context tensors.
-
Qnn_Tensor_t *contextTensors¶
List of tensors registered to this context. Includes updatable context tensors.
-
uint32_t numGraphs¶
Number of graphs registered with this context.
-
QnnSystemContext_GraphInfo_t *graphs¶
List of graphs registered to this context.
-
uint32_t backendId¶
-
struct QnnSystemContext_BinaryInfoV2_t¶
- #include <QnnSystemContext.h>
Struct that provides information about contents of a context binary. This is version V2 of the structure.
Public Members
-
uint32_t backendId¶
Backend that this context binary is associated with.
-
const char *buildId¶
Build ID of QNN SDK used to create context binary.
-
Qnn_Version_t coreApiVersion¶
QNN core API version.
-
Qnn_Version_t backendApiVersion¶
Version of backend-specific API for the backend producing context binary.
-
const char *socVersion¶
Version of the SOC for which context binary was generated.
-
Qnn_Version_t hwInfoBlobVersion¶
Version of hardware info blob stored in the context binary.
-
Qnn_Version_t contextBlobVersion¶
Version of the opaque context blob generated by backend that is packed into the context binary Note that the context blob is not part of metadata. It is described by the metadata
-
uint32_t hwInfoBlobSize¶
Size of hardware info blob stored in the context binary, in bytes.
-
void *hwInfoBlob¶
Hardware Info blob. Needs to be interpreted based on backend-specific instructions.
-
uint64_t contextBlobSize¶
Size of opaque backend-specific context blob, in bytes.
-
uint32_t numContextTensors¶
Number of context tensors.
-
Qnn_Tensor_t *contextTensors¶
List of tensors registered to this context.
-
uint32_t numGraphs¶
Number of graphs registered with this context.
-
QnnSystemContext_GraphInfo_t *graphs¶
List of graphs registered to this context.
-
QnnDevice_PlatformInfo_t *platformInfo¶
Device information associated with the context.
-
uint32_t backendId¶
-
struct QnnSystemContext_BinaryInfoV3_t¶
- #include <QnnSystemContext.h>
Struct that provides information about contents of a context binary. This is version V3 of the structure.
Public Members
-
uint32_t backendId¶
Backend that this context binary is associated with.
-
const char *buildId¶
Build ID of QNN SDK used to create context binary.
-
Qnn_Version_t coreApiVersion¶
QNN core API version.
-
Qnn_Version_t backendApiVersion¶
Version of backend-specific API for the backend producing context binary.
-
const char *socVersion¶
Version of the SOC for which context binary was generated.
-
Qnn_Version_t contextBlobVersion¶
Version of the opaque context blob generated by backend that is packed into the context binary Note that the context blob is not part of metadata. It is described by the metadata
-
uint64_t contextBlobSize¶
Size of opaque backend-specific context blob, in bytes.
-
uint32_t numContextTensors¶
Number of context tensors.
-
Qnn_Tensor_t *contextTensors¶
List of tensors registered to this context.
-
uint32_t numGraphs¶
Number of graphs registered with this context.
-
QnnSystemContext_GraphInfo_t *graphs¶
List of graphs registered to this context.
-
QnnDevice_PlatformInfo_t *platformInfo¶
Device information associated with the context.
-
uint32_t contextMetadataSize¶
Size of context metadata stored in the context binary, in bytes.
-
void *contextMetadata¶
context-specific settings
-
uint32_t socModel¶
An integer representation of the identifier for the SoC.
-
uint32_t backendId¶
-
struct QnnSystemContext_BinaryInfo_t¶
- #include <QnnSystemContext.h>
Public Members
-
union unnamed
- #include <QnnSystemContext.h>
Public Members
-
QnnSystemContext_BinaryInfoV1_t contextBinaryInfoV1
-
QnnSystemContext_BinaryInfoV2_t contextBinaryInfoV2
-
QnnSystemContext_BinaryInfoV3_t contextBinaryInfoV3
-
QnnSystemContext_BinaryInfoV1_t contextBinaryInfoV1
-
union unnamed