SubSystem Restart (SSR)¶
SSR is a feature of the QNN HTP BE that enables QNN to automatically recover the connection to the DSP after detecting it has crashed. With the connection restored, the QNN client can clean up any invalidated resources, and re-create them to continue utilizing the same instance of QNN. This feature is enabled for the the ARM based skel / stub QNN variant, as well as QNX and Windows platforms.
SSR Handling as a QNN Customer
The error code QNN_COMMON_ERR_SYSTEM_COMMUNICATION tells the client that the CDSP has crashed, and QNN has successfully recovered a connection to the CDSP. During the recover process, the CPU side registries are invalidated to prevent the use of now stale QNN API objects. Any attempt by a client to call a QNN API that will either attempt to cross the boundary between the CPU and the DSP, or simply reference an invalidated API object will receive the same afforementioned error code. This is the case for single-threaded or multi-threaded applications alike, such that each client can cleanup and recover at its own pace with no thread-to-thread coordination.
A simple example of the recovery process is outlined below, where a crash occurence during inference of a graph is responsible for triggering the SSR routine.
QNN API Object Validity
The list of objects affected by SSR are outlined below alongside what is required of the client to finish the recovery from a DSP crash and SSR occurence. Please note that all information on the DSP will be lost after a crash / SSR occurence, the table simply depicts a subset of QNN API objects related to the SSR process.
QNN API Object |
Lifecycle after SSR |
How to Recover |
|---|---|---|
Qnn_BackendHandle_t |
Valid |
N/A |
Qnn_ContextHandle_t |
Invalid |
QnnContext_free and one of the following for different use cases:
|
Qnn_DeviceHandle_t |
Valid |
N/A |
Qnn_GraphHandle_t |
Invalid |
|
Qnn_LogHandle_t |
Valid |
N/A |
Qnn_MemHandle_t |
Invalid |
QnnMem_deRegister and QnnMem_register |
Qnn_ProfileHandle_t |
Valid |
N/A |
QnnHtpPerfInfrastructure_PowerConfig_t |
Invalid |
Client needs to pass config to PerfInfra setPowerConfig API again |
QnnHtpPerfInfrastructure_MemoryConfig_t |
Invalid |
Client needs to pass config to PerfInfra setMemoryConfig API again |