File QnnSystemDlc.h¶
↰ Parent directory (include/QNN/System)
QNN System Context API.
Contents
Definition (include/QNN/System/QnnSystemDlc.h)¶
Detailed Description¶
This is a system API header to provide Deep Learning Container (DLC) services to users.
Includes¶
QnnInterface.h(File QnnInterface.h)QnnTypes.h(File QnnTypes.h)System/QnnSystemCommon.h(File QnnSystemCommon.h)System/QnnSystemContext.h(File QnnSystemContext.h)System/QnnSystemLog.h(File QnnSystemLog.h)
Included By¶
Enums¶
Functions¶
Full File Listing¶
QNN System Context API.
This is a system API header to provide
Deep Learning Container (DLC) services to users.
Typedefs
-
typedef void *QnnSystemDlc_Handle_t
A typedef to indicate a QNN System DLC handle.
-
typedef void *QnnSystemDlc_RecordHandle_t
A typedef to indicate a QNN System DLC handle.
Enums
-
enum QnnSystemDlc_Error_t¶
QNN System Context API result / error codes.
Values:
-
enumerator QNN_SYSTEM_DLC_MINERROR = 30000¶
-
enumerator QNN_SYSTEM_DLC_NO_ERROR = QNN_SYSTEM_COMMON_NO_ERROR¶
Qnn System Context success.
-
enumerator QNN_SYSTEM_DLC_ERROR_UNSUPPORTED_FEATURE = QNN_SYSTEM_COMMON_ERROR_UNSUPPORTED_FEATURE¶
There is optional API component that is not supported yet.
-
enumerator QNN_SYSTEM_DLC_ERROR_INVALID_HANDLE = QNN_SYSTEM_COMMON_ERROR_INVALID_HANDLE¶
QNN System DLC invalid handle.
-
enumerator QNN_SYSTEM_DLC_ERROR_INVALID_ARGUMENT = QNN_SYSTEM_COMMON_ERROR_INVALID_ARGUMENT¶
One or more arguments to a System DLC API is/are NULL/invalid.
-
enumerator QNN_SYSTEM_DLC_ERROR_OPERATION_FAILED = QNN_SYSTEM_DLC_MINERROR + 2¶
Generic Failure in achieving the objective of a System DLC API.
-
enumerator QNN_SYSTEM_DLC_ERROR_MALFORMED_BINARY = QNN_SYSTEM_DLC_MINERROR + 10¶
Malformed DLC Binary.
-
enumerator QNN_SYSTEM_DLC_MAXERROR = 49999¶
-
enumerator QNN_SYSTEM_DLC_MINERROR = 30000¶
-
enum QnnSystemContext_GraphConfigInfoVersion_t¶
Version of the graph config info.
Values:
-
enumerator QNN_SYSTEM_DLC_GRAPH_CONFIG_INFO_VERSION_1 = 0x01¶
-
enumerator QNN_SYSTEM_DLC_GRAPH_CONFIG_INFO_UNDEFINED = 0x7FFFFFFF¶
-
enumerator QNN_SYSTEM_DLC_GRAPH_CONFIG_INFO_VERSION_1 = 0x01¶
-
enum QnnSystemDlc_RecordType_t¶
Values:
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_DLC_METADATA = 0x01¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_MODEL_TOPOLOGY = 0x02¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_MODEL_PARAMS = 0x03¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_MODEL_RAW_WIEGHTS = 0x04¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_MODEL_ENCODINGS = 0x05¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_LORA_CONVERTER_METADATA = 0x06¶
-
enumerator QNN_SYSTEM_DLC_RECORD_PREFIX_HTP_CACHE_RECORD = 0x07¶
-
enumerator QNN_SYSTEM_DLC_RECORD_PREFIX_AIP_CACHE_RECORD = 0x08¶
-
enumerator QNN_SYSTEM_DLC_RECORD_PREFIX_HTA_CACHE_RECORD = 0x09¶
-
enumerator QNN_SYSTEM_DLC_RECORD_PREFIX_AIX_CACHE_RECORD = 0x0A¶
-
enumerator QNN_SYSTEM_DLC_RECORD_PREFIX_GPU_CACHE_RECORD = 0x0B¶
-
enumerator QNN_SYSTEM_DLC_RECORD_PREFIX_HEXNNV2_CACHE_RECORD = 0x0C¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_SOURCE_MAPPING = 0x0D¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_SOURCE_TOPOLOGY = 0x0E¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_HTP_SCHEMATIC_BIN = 0x0F¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_HTP_GRAPH_MAPPING = 0x10¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_GENAI_METADATA = 0x11¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_GENAI_ARTIFACT = 0x12¶
-
enumerator QNN_SYSTEM_DLC_RECORD_NAME_UNKNOWN = 0x7FFFFFFF¶
-
enumerator QNN_SYSTEM_DLC_RECORD_TYPE_DLC_METADATA = 0x01¶
Functions
-
Qnn_ErrorHandle_t QnnSystemDlc_createFromFile(Qnn_LogHandle_t logger, const char *dlcPath, QnnSystemDlc_Handle_t *dlcHandle)¶
A function to create an instance of the DLC from a file.
- Parameters
dlcPath – [in] path the DLC
logger – [in] a log handle produced from QnnSystemLog_create(). Can be NULL
dlcHandle – [out] A handle to the created instance of a systemContext entity
- Returns
Error code
QNN_SUCCESS: Successfully created a systemContext entity
QNN_SYSTEM_DLC_ERROR_INVALID_ARGUMENT: sysCtxHandle is NULL
QNN_COMMON_ERROR_MEM_ALLOC: Error encountered in allocating memory for systemContext instance
QNN_SYSTEM_DLC_ERROR_UNSUPPORTED_FEATURE: system context features not supported
-
Qnn_ErrorHandle_t QnnSystemDlc_createFromBinary(Qnn_LogHandle_t logger, const uint8_t *buffer, const Qnn_ContextBinarySize_t bufferSize, QnnSystemDlc_Handle_t *dlcHandle)¶
A function to create an instance of the DLC from a binary buffer.
- Parameters
buffer – [in] pointer to buffer representing the DLC
logger – [in] a log handle produced from QnnSystemLog_create(). Can be NULL
bufferSize – [in] size of the binary buffer
dlcHandle – [out] A handle to the created instance of a systemContext entity
- Returns
Error code
QNN_SUCCESS: Successfully created a systemContext entity
QNN_SYSTEM_DLC_ERROR_INVALID_ARGUMENT: sysCtxHandle is NULL
QNN_COMMON_ERROR_MEM_ALLOC: Error encountered in allocating memory for systemContext instance
QNN_SYSTEM_DLC_ERROR_UNSUPPORTED_FEATURE: system context features not supported
-
Qnn_ErrorHandle_t QnnSystemDlc_composeGraphs(QnnSystemDlc_Handle_t dlcHandle, const QnnSystemDlc_GraphConfigInfo_t **graphConfigs, const uint32_t numGraphConfigs, Qnn_BackendHandle_t backend, Qnn_ContextHandle_t context, QnnInterface_t backendInterface, QnnSystemContext_GraphInfoVersion_t graphVersion, QnnSystemContext_GraphInfo_t **graphs, uint32_t *numGraphs)¶
A function to compose graphs from a DLC on a particular backend, backend, through an backendInterface backendInterface. Memory allocated in graphs is owned by clients and may be released with calls to free().
- Parameters
dlcHandle – [in] the DLC to retrieve graphs from
graphConfigs – [in] the graph configuration information for a particular graph
numGraphConfigs – [in] number of graph configurations
backend – [in] the backend on which to compose the graphs
context – [in] the context on which to compose the graphs
backendInterface – [in] the interface used to compose the graph.
graphVersion – [in] version of the graph info structure to be returned
graphs – [out] An array of graph information representing what was created with the backend
numGraphs – [out] the number of created graphs
- Returns
Error code
QNN_SUCCESS: Successfully composed graphs
QNN_SYSTEM_DLC_ERROR_INVALID_ARGUMENT: Argument is NULL
QNN_COMMON_ERROR_MEM_ALLOC: Error encountered in allocating memory for
QNN_SYSTEM_DLC_ERROR_INVALID_HANDLE: Invalid Dlc handle to free
QNN_SYSTEM_DLC_ERROR_UNSUPPORTED_FEATURE: DLC features not supported
-
Qnn_ErrorHandle_t QnnSystemDlc_getOpMappings(QnnSystemDlc_Handle_t dlcHandle, const Qnn_OpMapping_t **opMappings, uint32_t *numOpMappings)¶
A function to retrieve Op Mapping information from a DLC.
- Parameters
dlcHandle – [in] Handle to the DLC
opMappings – [out] a list of op mappings. The memory allocated here is owned by the System library and is released when the corresponding DLC Handle is freed
numOpMappings – [out] the number of opMappings
- Returns
Error code
QNN_SUCCESS: Successfully freed instance of System Context
QNN_SYSTEM_DLC_ERROR_INVALID_HANDLE: Invalid Dlc handle to free
QNN_SYSTEM_DLC_ERROR_UNSUPPORTED_FEATURE: not supported
-
Qnn_ErrorHandle_t QnnSystemDlc_getRecordByName(QnnSystemDlc_Handle_t dlcHandle, const char *recordName, QnnSystemDlc_RecordHandle_t *recordHandle)¶
A function to retrieve a record associated with handle dlcHandle of name recordName
- Parameters
dlcHandle – [in] handle to the DLC to which this record is associated
recordName – [in] the name of the record to retrieve
recordHandle – [out] record handle matching recordName
- Returns
Error code
QNN_SUCCESS: Successfully retrieved record of recordName
QNN_SYSTEM_DLC_ERROR_INVALID_HANDLE: Invalid dlcHandle passed
QNN_SYSTEM_DLC_ERROR_INVALID_ARGUMENT: Invalid recordName or recordHandle passed
Note
If there are no records that match recordName, then recordHandle will be set to nullptr. Record names are unique within a DLC so this API will only return at most one record handle
-
Qnn_ErrorHandle_t QnnSystemDlc_getRecordsByType(QnnSystemDlc_Handle_t dlcHandle, QnnSystemDlc_RecordType_t recordType, uint8_t getMostOptimalContextBinary, QnnSystemDlc_RecordHandle_t **recordHandles, uint32_t *numRecordHandles)¶
A function to retrieve records associated with handle dlcHandle of type recordType
- Parameters
dlcHandle – [in] handle to the DLC to which the records are associated
recordType – [in] the type of the records to retrieve
getMostOptimalContextBinary – [in] option to retrieve the most-compatible context binary on current SoC. This option is only useful when retrieving context binaries. If set to 1, no more than one context binary will be returned even if the DLC has multiple context binaries that match the provided recordType. If set to 0, all context binaries that match recordType will be returned
recordHandles – [out] array of record handles matching recordType
numRecordHandles – [out] number of record handles in recordHandles array
- Returns
Error code
QNN_SUCCESS: Successfully retrieving records of type recordType
QNN_SYSTEM_DLC_ERROR_INVALID_HANDLE: Invalid dlcHandle passed
QNN_SYSTEM_DLC_ERROR_INVALID_ARGUMENT: invalid recordHandles or numRecordHandles passed
Note
If there are no records of recordType, then recordHandles will be set to nullptr and numRecordHandles will be set to 0
-
Qnn_ErrorHandle_t QnnSystemDlc_getRecordDataSize(QnnSystemDlc_RecordHandle_t recordHandle, uint64_t *dataSize)¶
A function to retrieve the size of the data in recordHandle
- Parameters
recordHandle – [in] record handle to retrieve the size of the data from
dataSize – [out] size of the data in the record
- Returns
Error code
QNN_SUCCESS: Successfully retrieved the size of the record
QNN_SYSTEM_DLC_ERROR_INVALID_HANDLE: Invalid record handle
QNN_SYSTEM_DLC_ERROR_INVALID_ARGUMENT: invalid dataSize pointer passed
-
Qnn_ErrorHandle_t QnnSystemDlc_readRecordDataMemoryMapped(QnnSystemDlc_RecordHandle_t recordHandle, const uint8_t **data, uint64_t *dataSize)¶
A function to retrieve the content of recordHandle as a memory mapped buffer data
- Parameters
recordHandle – [in] record handle to read from
data – [out] data read from the record
dataSize – [out] size of the data read
- Returns
Error code
QNN_SUCCESS: Successfully read the data of the record to user buffer
QNN_SYSTEM_DLC_ERROR_INVALID_HANDLE: Invalid record handle
QNN_SYSTEM_DLC_ERROR_INVALID_ARGUMENT: invalid user data pointer or dataSize pointer passed
-
Qnn_ErrorHandle_t QnnSystemDlc_freeRecord(QnnSystemDlc_RecordHandle_t recordHandle)¶
A function to free a record. Record will also be freed if the associated DLC handle is freed.
- Parameters
recordHandle – [in] handle to the record to be freed
- Returns
Error code
QNN_SUCCESS: Successfully freed instance of record handle
QNN_SYSTEM_DLC_ERROR_INVALID_HANDLE: Invalid record handle to free
Note
If the record is associated with a DLC, this API does not remove the record from the DLC. It will only free the record handle. To remove the record from the DLC, use the QnnSystemDlc_removeRecordByType() API
Note
This API will fail if the record is associated with a DLC and its handle has already been freed. Since freeing the DLC handle also frees all handles of the records associated with it, this operation will result in failure
-
Qnn_ErrorHandle_t QnnSystemDlc_free(QnnSystemDlc_Handle_t dlcHandle)¶
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_DLC_ERROR_INVALID_HANDLE: Invalid System Context handle to free
QNN_SYSTEM_DLC_ERROR_UNSUPPORTED_FEATURE: not supported
-
struct QnnSystemDlc_GraphConfigInfoV1_t¶
- #include <QnnSystemDlc.h>
-
struct QnnSystemDlc_GraphConfigInfo_t¶
- #include <QnnSystemDlc.h>
structure to define
Public Members
-
union unnamed
- #include <QnnSystemDlc.h>
Public Members
-
union unnamed