Function QnnGraph_finalize

Function Documentation

Qnn_ErrorHandle_t QnnGraph_finalize(Qnn_GraphHandle_t graphHandle, Qnn_ProfileHandle_t profileHandle, Qnn_SignalHandle_t signalHandle)

A function to finalize the graph. If called on a graph that was composed, the runtime will process the graph, validate that all operations are created successfully and that connectivity is correct. If called on a graph that was retrieved from a context binary (subject to backend support, see QNN_PROPERTY_GRAPH_SUPPORT_FINALIZE_DESERIALIZED_GRAPH), the runtime will perform additional setup required before execution.

Parameters
  • graphHandle[in] Handle to the graph to be finalized.

  • profileHandle[in] The profile handle on which metrics is populated and can be queried. Use NULL handle to disable profile collection. A handle being re-used would reset and is populated with values from the current call. This handle must be NULL when a continuous profile handle has been configured via the QNN_GRAPH_CONFIG_OPTION_PROFILE_HANDLE option

  • signalHandle[in] Signal object to control the execution of the finalize process. NULL may be passed to indicate that no execution control is requested, and the finalize operation should continue to completion uninterrupted. The signal object, if not NULL, is considered to be in-use for the duration of the call.

Returns

Error code:

  • QNN_SUCCESS: the graph is finalized successfully

  • QNN_GRAPH_ERROR_INVALID_HANDLE: graph is not a valid handle

  • QNN_GRAPH_ERROR_INVALID_ARGUMENT:

    • invalid param passed in OR

    • continuous graph profiling is enabled and the per-API handle is not NULL.

  • QNN_GRAPH_ERROR_CREATE_FAILED: op/kernel creation failed

  • QNN_GRAPH_ERROR_OPTIMIZATION_FAILED: graph optimization failed

  • QNN_GRAPH_ERROR_UNSUPPORTED_FEATURE: some API feature is not supported yet, e.g. signal or profile

  • QNN_GRAPH_ERROR_SET_PROFILE: set profile failed

  • QNN_GRAPH_ERROR_SIGNAL_IN_USE: the supplied control signal is already in-use by another call.

  • QNN_GRAPH_ERROR_ABORTED: the call is aborted before completion due to user cancellation

  • QNN_GRAPH_ERROR_TIMED_OUT: the call is aborted before completion due to a timeout

  • QNN_GRAPH_ERROR_FINALIZE_FAILED: finalize failed for some other reason

  • QNN_GRAPH_ERROR_SUBGRAPH: operation not permitted on a subgraph

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION: SSR occurence (successful recovery)

  • QNN_COMMON_ERROR_SYSTEM_COMMUNICATION_FATAL: SSR occurence (unsuccessful recovery)

Note

Graphs that contain zero nodes will fail to finalize.

Note

Some runtimes may require that this function is called before execution of a graph retrieved from a context binary, refer to backend specific documentation.

Note

Use corresponding API through QnnInterface_t.