# C Interface

Defines

- QNN\_DELEGATE\_CAPI\_EXPORT

    - 

- QNN\_DELEGATE\_API\_VERSION\_MAJOR 0

    - 

- QNN\_DELEGATE\_API\_VERSION\_MINOR 24

    - 

- QNN\_DELEGATE\_API\_VERSION\_PATCH 0

    - 

- QNN\_DELEGATE\_GPU\_OPTION\_INIT   {                                   \
    [kGpuFp16](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1ab5e6a08beec9f90e845d77c44d6ac87ea8317f42cacc7aaf63b53773a6e606e3f),    /\*precision\*/        \
    [kGpuDefault](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a4b395ac50b8e45e75f0be571915387baa9befb2c7509d348261178c711649bed8)
, /\*performance\_mode\*/ \

""           /\*kernel\_repo\_dir\*/  \

}

    - 

- QNN\_DELEGATE\_HTP\_OPTION\_INIT   {                                                       \
    [kHtpDefault](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1aa5ff506decce630c216a8a1539d5c734a686992e4348aad07fc86dbb483a97120),              /\*performance\_mode\*/        \
    [kHtpPerfCtrlManual](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1ad070a6439f1d5bb22830262006d178d3a243d35d2cb5e4381038017265e0b183b),       /\*perf\_ctrl\_strategy\*/      \
    [kHtpFp16](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a00e872617c24879604041abc56ab381eaf928c1e498ef659e7b4582fca25aa2fe),                 /\*precision\*/               \
    [kHtpUnsignedPd](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a08384bc22ba5867633d08f44fdd0ad98a41a555c1e552d1698418e25656ea0dbf),           /\*pd\_session\*/              \
    [kHtpOptimizeForInference](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a8e61dbbf1c8ec8be89f7250f4dc739fda2f33d813c299848888d388f2bca6d3eb)
, /\*optimization\_strategy\*/   \

true,                     /\*useConvHmx\*/              \

false,                    /\*useFoldRelu\*/             \

0,                        /\*vtcm\_size\*/               \

0,                        /\*num\_hvx\_threads\*/         \

0,                        /\*device\_id\*/               \

}

    - 

- QNN\_DELEGATE\_DSP\_OPTION\_INIT   {                                                       \
    [kDspDefault](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a4abf6471a7905bbe48dd1258942d54d5aeefdfaa03eda1af50d06c37444a85cbc),              /\*performance\_mode\*/        \
    [kDspPerfCtrlManual](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a6996a7800d50aa6ab3e5c72fee24c29aa3986c1664fb200ebf09d162fa19a8835),       /\*perf\_ctrl\_strategy\*/      \
    [kDspUnsignedPd](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1ac708dfad295901173d5588fe88e18e45a9b5c880d67dc397c90d7da1826fb1872),           /\*pd\_session\*/              \
    [kDspStatic](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a195ab240a762d2d182555a140e460e4dafac72823733be0c0f49e2fd85efb3d5b)
,               /\*encoding\*/                \

}

    - 

- QNN\_DELEGATE\_IR\_OPTION\_INIT 
{                                                      \

nullptr,              /\*output\_path\*/                \

}

    - 

- QNN\_DELEGATE\_OP\_PACKAGE\_OPTION\_INIT 
{                                           \

0,              /\*num\_op\_package\_infos\*/  \

nullptr,        /\*op\_package\_infos\*/      \

}

    - 

- QNN\_DELEGATE\_SKIP\_OPTION\_INIT 
{                                            \

nullptr,     /\*skip\_delegate\_ops\*/         \

0,           /\*skip\_delegate\_ops\_nr\*/      \

nullptr,     /\*skip\_delegate\_node\_ids\*/    \

0,           /\*skip\_delegate\_node\_ids\_nr\*/ \

}

    - 

- QNN\_DELEGATE\_OPTION\_INIT   {                                                                     \
    [kUndefinedBackend](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a65d87d490f916ffb8c5f3cd8284b2110ac01bd4cc059820620b0cbb8c02d177a0)
,                    /\*backend\_type\*/              \

"",                                   /\*library\_path\*/              \

"",                                   /\*skel\_library\_dir\*/          \

[QNN\_DELEGATE\_GPU\_OPTION\_INIT](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a3dcafb726c87ef9b054e6b7198ec034c),         /\*gpu\_options\*/               \
    [QNN\_DELEGATE\_HTP\_OPTION\_INIT](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a503a3519f72be7e625cdad848d17b0fc),         /\*htp\_options\*/               \
    [QNN\_DELEGATE\_DSP\_OPTION\_INIT](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a0dcb9d180422756898d1275293abbe18),         /\*dsp\_options\*/               \
    [QNN\_DELEGATE\_IR\_OPTION\_INIT](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a506349f37b8a5354ec13a674c98d7f40),          /\*ir\_options\*/                \
    [kLogOff](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a98034eda2b371b5260d32624917ddb7ea31d251432248b8be8ef530b51bedbb71),                              /\*log\_level\*/                 \
    [kProfilingOff](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1ae9ba865477b791adff010190bba7052aae8896738fa36928dd3ccf4883f941cf9),                        /\*profiling\*/                 \
    [QNN\_DELEGATE\_OP\_PACKAGE\_OPTION\_INIT](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1adf140c8aa39c2f3a32f3e7725d1a0a5b)
,  /\*op\_package\_options\*/        \

"",                                   /\*tensor\_dump\_output\_path\*/   \

"",                                   /\*cache\_dir\*/                 \

"",                                   /\*model\_token\*/               \

[QNN\_DELEGATE\_SKIP\_OPTION\_INIT](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a97356899c1a8005298e1ab6842b5334a),        /\*skip\_options\*/              \
    [kQnnPriorityDefault](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a8453025efc589782de662ffe54c54c3da7f9cc709ad10f04f1e0d8e6ea4c4c8d6)
,                  /\*graph\_priority\*/            \

}

    - 

- TfLiteQnnDelegateCapabilitySupported 1

    - Return by [TfLiteQnnDelegateHasCapability()](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a6b809f15ebc457f9b1e39b1d35d9358b) if the capability is supported.

- TfLiteQnnDelegateCapabilityNotSupported 0

    - Return by [TfLiteQnnDelegateHasCapability()](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a6b809f15ebc457f9b1e39b1d35d9358b) if the capability is not supported.

Typedefs

- typedef enum [TfLiteQnnDelegateBackendType](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv428TfLiteQnnDelegateBackendType) TfLiteQnnDelegateBackendType

    - The QNN backend used to delegate the model’s nodes. Each backend has its own set of supported ops and tensor types.

- typedef enum [TfLiteQnnDelegateLogLevel](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv425TfLiteQnnDelegateLogLevel) TfLiteQnnDelegateLogLevel

    - Logging level of the delegate and QNN backend.

- typedef enum [TfLiteQnnDelegateGraphPriority](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv430TfLiteQnnDelegateGraphPriority) TfLiteQnnDelegateGraphPriority

    - Options to set Graph Priority. This is directly mapped to Qnn\_Priority\_t. Please refer to QNN SDK for additional information.

- typedef enum [TfLiteQnnDelegateProfilingOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv433TfLiteQnnDelegateProfilingOptions) TfLiteQnnDelegateProfilingOptions

    - Options to profile the QNN Delegate execution.

- typedef enum [TfLiteQnnDelegateGpuPrecision](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv429TfLiteQnnDelegateGpuPrecision) TfLiteQnnDelegateGpuPrecision

    - Defines the optimization levels of the graph tensors that are not input nor output tensors. This enum controls the trade-off between performance and accuracy.

- typedef enum [TfLiteQnnDelegateGpuPerformanceMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv435TfLiteQnnDelegateGpuPerformanceMode) TfLiteQnnDelegateGpuPerformanceMode

    - Defines performance modes available for GPU backend.

- typedef enum [TfLiteQnnDelegateHtpPerformanceMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv435TfLiteQnnDelegateHtpPerformanceMode) TfLiteQnnDelegateHtpPerformanceMode

    - Defines performance modes available for HTP backend.

- typedef enum [TfLiteQnnDelegateDspPerformanceMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv435TfLiteQnnDelegateDspPerformanceMode) TfLiteQnnDelegateDspPerformanceMode

    - Defines performance modes available for DSP backend.

- typedef enum [TfLiteQnnDelegateHtpPerfCtrlStrategy](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv436TfLiteQnnDelegateHtpPerfCtrlStrategy) TfLiteQnnDelegateHtpPerfCtrlStrategy

    - Defines performance control strategy

**Manual**: The performance mode is voted as the backend is initialized, and released at the moment of the backend is destroyed.

Users can control the vote/release of the performance mode by [TfLiteQnnDelegateSetPerf()](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a2783ba4dedc253b69ae859478f725f78).

Note that this is the default strategy.

For example, users can vote before inference starts, and release after all invocations are complete.

TfLiteQnnDelegateSetPerf(delegate, kPerformanceVote);
    // invoke inferences...
    TfLiteQnnDelegateSetPerf(delegate, kPerformanceRelease);
    Copy to clipboard

**AUTO**: QNN Delegate votes before starting inference, and releases after an idle interval.

- typedef enum [TfLiteQnnDelegateDspPerfCtrlStrategy](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv436TfLiteQnnDelegateDspPerfCtrlStrategy) TfLiteQnnDelegateDspPerfCtrlStrategy

    - Defines DSP performance control strategy. Similar to HTP cases.

- typedef enum [TfLiteQnnDelegateDspPdSession](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv429TfLiteQnnDelegateDspPdSession) TfLiteQnnDelegateDspPdSession

    - Defines pd sessions available for DSP backend.

- typedef enum [TfLiteQnnDelegateDspEncoding](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv428TfLiteQnnDelegateDspEncoding) TfLiteQnnDelegateDspEncoding

    - Defines encoding for DSP backend. Dynamic encoding is more precise but sacrifices a bit of performance.

- typedef enum [TfLiteQnnDelegateHtpPdSession](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv429TfLiteQnnDelegateHtpPdSession) TfLiteQnnDelegateHtpPdSession

    - Defines pd sessions available for HTP backend.

- typedef enum [TfLiteQnnDelegateHtpPrecision](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv429TfLiteQnnDelegateHtpPrecision) TfLiteQnnDelegateHtpPrecision

    - Defines the optimization levels of the graph tensors that are not input nor output tensors. This enum controls the trade-off between performance and accuracy.

- typedef enum [TfLiteQnnDelegateHtpOptimizationStrategy](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv440TfLiteQnnDelegateHtpOptimizationStrategy) TfLiteQnnDelegateHtpOptimizationStrategy

    - Defines the optimization strategy used by the HTP backend. [kHtpOptimizeForInference](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a8e61dbbf1c8ec8be89f7250f4dc739fda2f33d813c299848888d388f2bca6d3eb) will have longer preparation time, but more optimal graph. [kHtpOptimizeForPrepare](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a8e61dbbf1c8ec8be89f7250f4dc739fda8e8d9d3987e10578505406f0171fe8fa) will have shorter preparation time, but less optimal graph. [kHtpOptimizeForInferenceO3](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a8e61dbbf1c8ec8be89f7250f4dc739fdabdfd95ec287180b7899510d775111b44) will take into account QNN\_HTP\_DEVICE\_CONFIG\_OPTION\_SOC configuration when possible. When SOC information is taken into account, O3 configuration is expected to provide more optimal graph in most cases, but may result in less optimal graph in some cases. Please check HTP section in Qnn docs for more detail.

- typedef enum [TfLiteQnnDelegatePerformanceAction](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv434TfLiteQnnDelegatePerformanceAction) TfLiteQnnDelegatePerformanceAction

    - Defines the performance action used by [TfLiteQnnDelegateSetPerf()](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a2783ba4dedc253b69ae859478f725f78)

- typedef int32\_t TfLiteQnnDelegateCapabilityStatus

    - 

- typedef enum [TfLiteQnnDelegateCapability](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv427TfLiteQnnDelegateCapability) TfLiteQnnDelegateCapability

    - Defines possible QNN Delegate capabilities.

Enums

- enum TfLiteQnnDelegateBackendType

    - The QNN backend used to delegate the model’s nodes. Each backend has its own set of supported ops and tensor types.

*Values:*

- enumerator kUndefinedBackend = 0

    - 

- enumerator kGpuBackend

    - Backend for Adreno^TM^ GPU hardware accelerator.

- enumerator kHtpBackend

    - Backend for Hexagon HTP hardware accelerator.

- enumerator kDspBackend

    - Backend for Hexagon DSP hardware accelerator.

- enumerator kIrBackend

    - Backend for serializing model into dlc.

- enum TfLiteQnnDelegateLogLevel

    - Logging level of the delegate and QNN backend.

*Values:*

- enumerator kLogOff = 0

    - Disable delegate and QNN backend logging messages.

- enumerator kLogLevelError = 1

    - 

- enumerator kLogLevelWarn = 2

    - 

- enumerator kLogLevelInfo = 3

    - 

- enumerator kLogLevelVerbose = 4

    - 

- enumerator kLogLevelDebug = 5

    -

- enum TfLiteQnnDelegateGraphPriority

    - Options to set Graph Priority. This is directly mapped to Qnn\_Priority\_t. Please refer to QNN SDK for additional information.

*Values:*

- enumerator kQnnPriorityDefault = 0

    - 

- enumerator kQnnPriorityLow

    - 

- enumerator kQnnPriorityNormal

    - 

- enumerator kQnnPriorityNormalHigh

    - 

- enumerator kQnnPriorityHigh

    - 

- enumerator kQnnPriorityUndefined

    -

- enum TfLiteQnnDelegateProfilingOptions

    - Options to profile the QNN Delegate execution.

*Values:*

- enumerator kProfilingOff = 0

    - 

- enumerator kBasicProfiling

    - 

- enumerator kPerOpProfiling

    - 

- enumerator kLintingProfiling

    -

- enum TfLiteQnnDelegateGpuPrecision

    - Defines the optimization levels of the graph tensors that are not input nor output tensors. This enum controls the trade-off between performance and accuracy.

*Values:*

- enumerator kGpuUserProvided = 0

    - 

- enumerator kGpuFp32

    - 

- enumerator kGpuFp16

    - 

- enumerator kGpuHybrid

    -

- enum TfLiteQnnDelegateGpuPerformanceMode

    - Defines performance modes available for GPU backend.

*Values:*

- enumerator kGpuDefault = 0

    - 

- enumerator kGpuHigh

    - 

- enumerator kGpuNormal

    - 

- enumerator kGpuLow

    -

- enum TfLiteQnnDelegateHtpPerformanceMode

    - Defines performance modes available for HTP backend.

*Values:*

- enumerator kHtpDefault = 0

    - 

- enumerator kHtpSustainedHighPerformance = 1

    - 

- enumerator kHtpBurst = 2

    - 

- enumerator kHtpHighPerformance = 3

    - 

- enumerator kHtpPowerSaver = 4

    - 

- enumerator kHtpLowPowerSaver = 5

    - 

- enumerator kHtpHighPowerSaver = 6

    - 

- enumerator kHtpLowBalanced = 7

    - 

- enumerator kHtpBalanced = 8

    - 

- enumerator kHtpExtremePowerSaver = 9

    -

- enum TfLiteQnnDelegateDspPerformanceMode

    - Defines performance modes available for DSP backend.

*Values:*

- enumerator kDspDefault = 0

    - 

- enumerator kDspSustainedHighPerformance = 1

    - 

- enumerator kDspBurst = 2

    - 

- enumerator kDspHighPerformance = 3

    - 

- enumerator kDspPowerSaver = 4

    - 

- enumerator kDspLowPowerSaver = 5

    - 

- enumerator kDspHighPowerSaver = 6

    - 

- enumerator kDspLowBalanced = 7

    - 

- enumerator kDspBalanced = 8

    -

- enum TfLiteQnnDelegateHtpPerfCtrlStrategy

    - Defines performance control strategy

**Manual**: The performance mode is voted as the backend is initialized, and released at the moment of the backend is destroyed.

Users can control the vote/release of the performance mode by [TfLiteQnnDelegateSetPerf()](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a2783ba4dedc253b69ae859478f725f78).

Note that this is the default strategy.

For example, users can vote before inference starts, and release after all invocations are complete.

TfLiteQnnDelegateSetPerf(delegate, kPerformanceVote);
    // invoke inferences...
    TfLiteQnnDelegateSetPerf(delegate, kPerformanceRelease);
    Copy to clipboard

**AUTO**: QNN Delegate votes before starting inference, and releases after an idle interval.

*Values:*

- enumerator kHtpPerfCtrlManual = 0

    - 

- enumerator kHtpPerfCtrlAuto = 1

    -

- enum TfLiteQnnDelegateDspPerfCtrlStrategy

    - Defines DSP performance control strategy. Similar to HTP cases.

*Values:*

- enumerator kDspPerfCtrlManual = 0

    - 

- enumerator kDspPerfCtrlAuto = 1

    -

- enum TfLiteQnnDelegateDspPdSession

    - Defines pd sessions available for DSP backend.

*Values:*

- enumerator kDspUnsignedPd = 0

    - 

- enumerator kDspSignedPd

    - 

- enumerator kDspAdaptivePd

    -

- enum TfLiteQnnDelegateDspEncoding

    - Defines encoding for DSP backend. Dynamic encoding is more precise but sacrifices a bit of performance.

*Values:*

- enumerator kDspStatic = 0

    - 

- enumerator kDspDynamic = 1

    - 

- enumerator kDspUnknown = 0x7fffffff

    -

- enum TfLiteQnnDelegateHtpPdSession

    - Defines pd sessions available for HTP backend.

*Values:*

- enumerator kHtpUnsignedPd = 0

    - 

- enumerator kHtpSignedPd

    -

- enum TfLiteQnnDelegateHtpPrecision

    - Defines the optimization levels of the graph tensors that are not input nor output tensors. This enum controls the trade-off between performance and accuracy.

*Values:*

- enumerator kHtpQuantized = 0

    - 

- enumerator kHtpFp16

    -

- enum TfLiteQnnDelegateHtpOptimizationStrategy

    - Defines the optimization strategy used by the HTP backend. [kHtpOptimizeForInference](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a8e61dbbf1c8ec8be89f7250f4dc739fda2f33d813c299848888d388f2bca6d3eb) will have longer preparation time, but more optimal graph. [kHtpOptimizeForPrepare](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a8e61dbbf1c8ec8be89f7250f4dc739fda8e8d9d3987e10578505406f0171fe8fa) will have shorter preparation time, but less optimal graph. [kHtpOptimizeForInferenceO3](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a8e61dbbf1c8ec8be89f7250f4dc739fdabdfd95ec287180b7899510d775111b44) will take into account QNN\_HTP\_DEVICE\_CONFIG\_OPTION\_SOC configuration when possible. When SOC information is taken into account, O3 configuration is expected to provide more optimal graph in most cases, but may result in less optimal graph in some cases. Please check HTP section in Qnn docs for more detail.

*Values:*

- enumerator kHtpOptimizeForInference = 0

    - 

- enumerator kHtpOptimizeForPrepare

    - 

- enumerator kHtpOptimizeForInferenceO3

    -

- enum TfLiteQnnDelegatePerformanceAction

    - Defines the performance action used by [TfLiteQnnDelegateSetPerf()](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a2783ba4dedc253b69ae859478f725f78)

*Values:*

- enumerator kPerformanceVote = 0

    - 

- enumerator kPerformanceRelease = 1

    -

- enum TfLiteQnnDelegateCapability

    - Defines possible QNN Delegate capabilities.

*Values:*

- enumerator kCapHtpRuntimeQuant = 0

    - 

- enumerator kCapHtpRuntimeFp16 = 1

    - 

- enumerator kCapGpuRuntime = 2

    - 

- enumerator kCapDspRuntime = 3

    -

Functions

- [TfLiteQnnDelegateOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv424TfLiteQnnDelegateOptions) TfLiteQnnDelegateOptionsDefault()

    - Create the QNN Delegate options structure and populate with default values.

- TfLiteDelegate \*TfLiteQnnDelegateCreate(const [TfLiteQnnDelegateOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv424TfLiteQnnDelegateOptions) \*options)

    - Create the QNN Delegate with the specified options.

- void TfLiteQnnDelegateDelete(TfLiteDelegate \*delegate)

    - Delete the QNN Delegate once no longer required.

Note that this is not a thread-safe function, which might cause unexpected behaviour when using it with [TfLiteQnnDelegateSetPerf](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a2783ba4dedc253b69ae859478f725f78), [TfLiteQnnDelegateUpdateHtpPerfMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a08c1b117d10f815c3610fed4020811bb), [TfLiteQnnDelegateUpdateDspPerfMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1ad5504ae596c6e89533776d0e7c9786cf), or [TfLiteQnnDelegateDelete](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a0050c698036d0ea5e845474c87b0855b) at the same time.

- bool TfLiteQnnDelegateSetPerf(TfLiteDelegate \*delegate, const [TfLiteQnnDelegatePerformanceAction](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv434TfLiteQnnDelegatePerformanceAction) action)

    - Manually vote or release performance mode. “Vote” to request hardware to obey the performance mode setting as soon as possible. “Release” to release the vote. Note that this API only work for HTP/DSP backend with [kHtpPerfCtrlManual](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1ad070a6439f1d5bb22830262006d178d3a243d35d2cb5e4381038017265e0b183b) or [kDspPerfCtrlManual](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#QnnTFLiteDelegate_8h_1a6996a7800d50aa6ab3e5c72fee24c29aa3986c1664fb200ebf09d162fa19a8835). Return true for success, false for failure.

- [TfLiteQnnDelegateCapabilityStatus](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv433TfLiteQnnDelegateCapabilityStatus) TfLiteQnnDelegateHasCapability(const [TfLiteQnnDelegateCapability](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv427TfLiteQnnDelegateCapability) cap)

    - Detect whether the capability is supported on the platform running QNN Delegate.

Note that this is an experimental feature.

- bool TfLiteQnnDelegateUpdateHtpPerfMode(TfLiteDelegate \*delegate, const [TfLiteQnnDelegateHtpPerformanceMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv435TfLiteQnnDelegateHtpPerformanceMode) mode)

    - This API changes the performance mode of a created QNN Delegate on HTP backend, returning `true` for the mode set correctly, `false` for any failure.

It will perform a vote after a successful update. If the strategy of performance controlling is **manual**, the new mode takes effect before this API returns.

Note that this API cannot be called during graph invocation, and this is an experimental feature.

- bool TfLiteQnnDelegateUpdateDspPerfMode(TfLiteDelegate \*delegate, const [TfLiteQnnDelegateDspPerformanceMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv435TfLiteQnnDelegateDspPerformanceMode) mode)

    - This API changes the performance mode of a created QNN Delegate on DSP backend, returning `true` for the mode set correctly, `false` for any failure.

- [QnnDelegateApiVersion](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv421QnnDelegateApiVersion) TfLiteQnnDelegateGetApiVersion()

    - Get QNN Delegate API version.

- void \*TfLiteQnnDelegateAllocCustomMem(size\_t bytes, size\_t alignment)

    - Allocate specific tensors (usually graph inputs and outputs) on shared memory. Users are responsible to allocate “enough” tensor bytes, and set alignment as kDefaultTensorAlignment. The function returns a valid pointer if allocation is successful.

Note that this is an experimental feature.

- void TfLiteQnnDelegateFreeCustomMem(void \*buffer\_ptr)

    - Free the allocated shared memory.

Note that this is an experimental feature.

- [TfLiteQnnDelegateProfilingResult](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv432TfLiteQnnDelegateProfilingResult) TfLiteQnnDelegateGetProfilingResult(TfLiteDelegate \*delegate)

    - Get profiling result.

- void TfLiteQnnDelegateClearProfilingResult(TfLiteDelegate \*delegate)

    - Free the recorded profiling result.

- struct QnnDelegateApiVersion

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

A struct which is used to provide a version number using 3 values: major, minor, patch

Public Members

- uint32\_t major

    - 

- uint32\_t minor

    - 

- uint32\_t patch

    -

- struct TfLiteQnnDelegateGpuBackendOptions

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

Specifies the backend options for the GPU backend. To be used when selecting TfLiteQnnDelegateBackendType.kGpuBackend for the [TfLiteQnnDelegateOptions::backend\_type](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOptions_1a9c123140d4503bd3968d4add4e763eb3).

Public Members

- [TfLiteQnnDelegateGpuPrecision](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv429TfLiteQnnDelegateGpuPrecision) precision

    - The default precision is half float for the best performance.

- [TfLiteQnnDelegateGpuPerformanceMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv435TfLiteQnnDelegateGpuPerformanceMode) performance\_mode

    - The default performance mode sets high.

- const char \*kernel\_repo\_dir

    - The QNN GPU backend supports on-disk kernel persistence strategies where compiled GPU kernel binaries are cached to disk and can be shared across models having the same kernels and improve warm init times significantly.

- struct TfLiteQnnDelegateHtpBackendOptions

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

Specifies the backend options for the HTP backend. To be used when selecting TfLiteQnnDelegateBackendType.kGpuBackend for the [TfLiteQnnDelegateOptions::backend\_type](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOptions_1a9c123140d4503bd3968d4add4e763eb3).

Public Members

- [TfLiteQnnDelegateHtpPerformanceMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv435TfLiteQnnDelegateHtpPerformanceMode) performance\_mode

    - The default performance mode sets no configurations on the HTP.

- [TfLiteQnnDelegateHtpPerfCtrlStrategy](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv436TfLiteQnnDelegateHtpPerfCtrlStrategy) perf\_ctrl\_strategy

    - The default performance control strategy is Manual.

- [TfLiteQnnDelegateHtpPrecision](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv429TfLiteQnnDelegateHtpPrecision) precision

    - The default precision mode supports quantized networks. Other precision modes may only be supported on certain SoCs.

- [TfLiteQnnDelegateHtpPdSession](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv429TfLiteQnnDelegateHtpPdSession) pd\_session

    - Signed or unsigned HTP PD session. The default PD session is unsigned.

- [TfLiteQnnDelegateHtpOptimizationStrategy](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv440TfLiteQnnDelegateHtpOptimizationStrategy) optimization\_strategy

    - The default optimization strategy will optimize the graph for inference.

- bool useConvHmx

    - When using short conv hmx, one might have better performance, but convolution that have short depth and/or weights that are not symmetric could exhibit inaccurate results.

- bool useFoldRelu

    - When using fold relu, one might have better performance. This optimization is correct when quantization ranges for convolution are equal to or are subset of the Relu operation.

- uint32\_t vtcm\_size

    - Option to set VTCM size in MB. This is directly mapped to QNN\_HTP\_GRAPH\_CONFIG\_OPTION\_VTCM\_SIZE under QnnHtpGraph\_ConfigOption\_t. If VTCM size is set to 0, the default VTCM size will be used. If VTCM size is greater than VTCM size available for this device, it will be set to the maximum VTCM size for this device.

- uint32\_t num\_hvx\_threads

    - Option to set number of HVX threads. This is directly mapped to QNN\_HTP\_GRAPH\_CONFIG\_OPTION\_NUM\_HVX\_THREADS under QnnHtpGraph\_ConfigOption\_t. If this this option is set to 0, the default number of HVX threads will be used. If input exceeds the max number of HVX threads, the maximum number of threads supported will be used.

- uint32\_t device\_id

    - Some SoCs come with more than 1 HTP device. You can set which HTP device you want to run the model on by this attribute. But in most cases, you can just use the default device\_id.

- struct TfLiteQnnDelegateDspBackendOptions

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

Specifies the backend options for the DSP backend. To be used when selecting kDspBackend as the &lt;backend\_type&gt;.

Public Members

- [TfLiteQnnDelegateDspPerformanceMode](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv435TfLiteQnnDelegateDspPerformanceMode) performance\_mode

    - The default performance mode sets no configurations on the DSP.

- [TfLiteQnnDelegateDspPerfCtrlStrategy](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv436TfLiteQnnDelegateDspPerfCtrlStrategy) perf\_ctrl\_strategy

    - The default performance control strategy is Manual.

- [TfLiteQnnDelegateDspPdSession](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv429TfLiteQnnDelegateDspPdSession) pd\_session

    - The default PD session is unsigned.

- [TfLiteQnnDelegateDspEncoding](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv428TfLiteQnnDelegateDspEncoding) encoding

    - The default Encoding is static.

- struct TfLiteQnnDelegateIrBackendOptions

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

Specifies the backend options for the IR writer backend. To be used when selecting TfLiteQnnDelegateBackendType.kIrBackend for the [TfLiteQnnDelegateOptions::backend\_type](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOptions_1a9c123140d4503bd3968d4add4e763eb3).

Public Members

- const char \*output\_path

    -

- struct TfLiteQnnDelegateOpPackageOpMap

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

Map of TFLite custom operator name to op type defined within an op package.

Public Members

- const char \*custom\_op\_name

    - The TfLiteRegistration::custom\_name set during registration.

- const char \*qnn\_op\_type\_name

    - The corresponding op type name defined in the op package.

- struct TfLiteQnnDelegateOpPackageInfo

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

Structure containing the information needed to register and use an op package with QNN.

Public Members

- const char \*op\_package\_name

    - The name of the op package.

- const char \*op\_package\_path

    - The path on disk to the op package library.

- const char \*interface\_provider

    - The name of a function in the op package library which satisfies the QnnOpPackage\_InterfaceProvider\_t interface.

- const char \*target

    - The target which this op package library was compiled for.

- int num\_ops\_map

    - Number of elements in the [TfLiteQnnDelegateOpPackageInfo.ops\_map](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOpPackageInfo_1a5d8e007c95641fe0b69aa7adc42547f1) array.

- [TfLiteQnnDelegateOpPackageOpMap](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv431TfLiteQnnDelegateOpPackageOpMap) \*ops\_map

    - An array of [TfLiteQnnDelegateOpPackageOpMap](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOpPackageOpMap) structures.

- struct TfLiteQnnDelegateOpPackageOptions

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

Public Members

- int num\_op\_package\_infos

    - Number of elements in [TfLiteQnnDelegateOpPackageOptions.op\_package\_infos](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOpPackageOptions_1afbbcf5b3ee3232d773c218b973f03b9d) array.

- [TfLiteQnnDelegateOpPackageInfo](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv430TfLiteQnnDelegateOpPackageInfo) \*op\_package\_infos

    - An array of [TfLiteQnnDelegateOpPackageInfo](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOpPackageInfo) structures.

- struct TfLiteQnnDelegateSkipOption

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

Public Members

- const int \*skip\_delegate\_ops

    - Set ops not to be delegated manually based on the op id(s). To obtain all the op ids, please refer to tensorflow/lite/builtin\_ops.h. Notice that we skip all of with the types specified in the [skip\_delegate\_ops](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateSkipOption_1a1fd00a8b04d3908cc5c87241bb59b551) array. For example, if you set skip to include SquaredDifference, all instances of SquaredDifference ops in the model will not be delegated.

- uint32\_t skip\_delegate\_ops\_nr

    - Indicates the length of [skip\_delegate\_ops](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateSkipOption_1a1fd00a8b04d3908cc5c87241bb59b551) array.

- const int \*skip\_delegate\_node\_ids

    - Set node IDs not to be delegated. Node id can be obtained by node’s location information in .tflite.

- uint32\_t skip\_delegate\_node\_ids\_nr

    - Indicates the length of [skip\_delegate\_node\_ids](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateSkipOption_1a5083fd81406c916b94dbe23a208cc67c) array.

- struct TfLiteQnnDelegateOptions

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

Public Members

- [TfLiteQnnDelegateBackendType](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv428TfLiteQnnDelegateBackendType) backend\_type

    - The backend QNN library to open and execute the graph with. This is a required argument and will error out if kUndefinedBackend is supplied.

- const char \*library\_path

    - Optional parameter to override the QNN backend library.

- const char \*skel\_library\_dir

    - Optional parameter specifying the directory of QNN Skel library. Only useful for backends which have a Skel library.

- [TfLiteQnnDelegateGpuBackendOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv434TfLiteQnnDelegateGpuBackendOptions) gpu\_options

    - Optional backend specific options for the GPU backend. Only used when selecting TfLiteQnnDelegateBackendType.kGpuBackend, otherwise will be ignored.

- [TfLiteQnnDelegateHtpBackendOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv434TfLiteQnnDelegateHtpBackendOptions) htp\_options

    - Optional backend specific options for the HTP backend. Only used when selecting TfLiteQnnDelegateBackendType.kHtpBackend, otherwise will be ignored.

- [TfLiteQnnDelegateDspBackendOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv434TfLiteQnnDelegateDspBackendOptions) dsp\_options

    - Optional backend specific options for the DSP backend. Only used when selecting TfLiteQnnDelegateBackendType.kDspBackend, otherwise will be ignored.

- [TfLiteQnnDelegateIrBackendOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv433TfLiteQnnDelegateIrBackendOptions) ir\_options

    - Optional backend specific options for the IR backend. Only used when selecting TfLiteQnnDelegateBackendType.kIrBackend, otherwise will be ignored.

- [TfLiteQnnDelegateLogLevel](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv425TfLiteQnnDelegateLogLevel) log\_level

    - Logging level of the delegate and the backend. Default is off.

- [TfLiteQnnDelegateProfilingOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv433TfLiteQnnDelegateProfilingOptions) profiling

    - Option to enable profiling with the delegate. Default is off.

- [TfLiteQnnDelegateOpPackageOptions](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv433TfLiteQnnDelegateOpPackageOptions) op\_package\_options

    - Optional structure to specify op packages loaded and used by the backend.

- const char \*tensor\_dump\_output\_path

    - Tensor dump output path. If a path is given, Delegate will write outputs of each OP there. We don’t recommend using this option. It exists only for debugging accuracy issues.

- const char \*cache\_dir

    - Specifies the directory of a compiled model. Signals intent to either:

- Save the model if the file doesn’t exist, or
- Restore model from the file.

Model Cache specific options. Only used when setting [model\_token](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOptions_1a083b5dadd3699c90d0e3bf8b0f215af9), otherwise will be ignored.

We don’t recommend that delegate instances with/without cache be mixed in same process, unless an instance **without** cache is initialized, invoked, and *terminated* before an instance with cache is used in order to make sure all resources are prepared correctly.

TfLiteDelegate* delegate_wo_cache =
    TfLiteQnnDelegateCreate(&options_wo_cache);
    interpreter_0->ModifyGraphWithDelegate(delegate_wo_cache);
    
    // Perform inference with interpreter_0
    
    TfLiteQnnDelegateDelete(delegate_wo_cache);
    
    // after this, another delegate_with_cache can be used in the same
    // process, though not recommended at this moment.
    TfLiteDelegate* delegate_with_cache =
    TfLiteQnnDelegateCreate(&options_with_cache);
    
    // another interpreter
    interpreter_1->ModifyGraphWithDelegate(delegate_with_cache);
    
    // more delegates...etc.
    Copy to clipboard

- const char \*model\_token

    - The unique null-terminated token string that acts as a ‘namespace’ for all serialization entries. Should be unique to a particular model (graph & constants). For an example of how to generate this from a TFLite model, see StrFingerprint() in lite/delegates/serialization.h.

Model Cache specific options. Only used when setting [cache\_dir](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#structTfLiteQnnDelegateOptions_1a4bd74d5478246b2d69e36c67a01cb087), otherwise will be ignored.

- [TfLiteQnnDelegateSkipOption](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv427TfLiteQnnDelegateSkipOption) skip\_options

    - Option to skip node by specifying node types or node ids.

- [TfLiteQnnDelegateGraphPriority](https://docs.qualcomm.com/doc/80-63442-10/topic/c_interface.html#_CPPv430TfLiteQnnDelegateGraphPriority) graph\_priority

    - Option to set graph priority.

- struct TfLiteQnnDelegateProfilingResult

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

Structure of profiling result.

Public Members

- const uint8\_t \*buffer

    - Buffer of profiling result will be invalid once TfLiteQnnDelegateClearProfilingResult gets called

- uint32\_t buffer\_length

    - Buffer length of profiling result in bytes.

Last Published: Jun 04, 2026

[Previous Topic
API](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/api.md) [Next Topic
Java Interface](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/java_interface.md)