Skip to content

Commit

Permalink
Backward Compatability for 2.28
Browse files Browse the repository at this point in the history
  • Loading branch information
winskuo-quic committed Dec 11, 2024
1 parent 45c9679 commit 6096504
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backends/qualcomm/runtime/backends/QnnBackendCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ Error QnnBackendCache::GetQnnGraphInfoFromBinary(
} else if (binaryinfo->version == QNN_SYSTEM_CONTEXT_BINARY_INFO_VERSION_2) {
num_graphs = binaryinfo->contextBinaryInfoV2.numGraphs;
graphs = binaryinfo->contextBinaryInfoV2.graphs;
#if (QNN_API_VERSION_MAJOR >= 2 && QNN_API_VERSION_MINOR >= 21)
} else if (binaryinfo->version == QNN_SYSTEM_CONTEXT_BINARY_INFO_VERSION_3) {
num_graphs = binaryinfo->contextBinaryInfoV3.numGraphs;
graphs = binaryinfo->contextBinaryInfoV3.graphs;
#endif
} else {
QNN_EXECUTORCH_LOG_WARN(
"Unknown QNN BinaryInfo version %d.", binaryinfo->version);
Expand All @@ -66,8 +68,10 @@ Error QnnBackendCache::GetQnnGraphInfoFromBinary(
RetrieveGraphInfo<QnnSystemContext_GraphInfoV1_t>(graphs[i].graphInfoV1);
} else if (graphs->version == QNN_SYSTEM_CONTEXT_GRAPH_INFO_VERSION_2) {
RetrieveGraphInfo<QnnSystemContext_GraphInfoV2_t>(graphs[i].graphInfoV2);
#if (QNN_API_VERSION_MAJOR >= 2 && QNN_API_VERSION_MINOR >= 21)
} else if (graphs->version == QNN_SYSTEM_CONTEXT_GRAPH_INFO_VERSION_3) {
RetrieveGraphInfo<QnnSystemContext_GraphInfoV3_t>(graphs[i].graphInfoV3);
#endif
} else {
QNN_EXECUTORCH_LOG_WARN(
"Unknown QNN GraphInfo version %d.", binaryinfo->version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@ using executorch::runtime::Error;
Error HtpBackendCache::RetrieveBackendBinaryInfo(
const QnnSystemContext_BinaryInfo_t* binaryinfo) {
QnnHtpSystemContext_HwBlobInfo_t* htp_hwblobinfo = nullptr;
#if (QNN_API_VERSION_MAJOR >= 2 && QNN_API_VERSION_MINOR >= 21)
QnnHtpSystemContext_GraphBlobInfo_t* htp_graphblobinfo = nullptr;
#endif

if (binaryinfo->version == QNN_SYSTEM_CONTEXT_BINARY_INFO_VERSION_1) {
htp_hwblobinfo = static_cast<QnnHtpSystemContext_HwBlobInfo_t*>(
binaryinfo->contextBinaryInfoV1.hwInfoBlob);
} else if (binaryinfo->version == QNN_SYSTEM_CONTEXT_BINARY_INFO_VERSION_2) {
htp_hwblobinfo = static_cast<QnnHtpSystemContext_HwBlobInfo_t*>(
binaryinfo->contextBinaryInfoV2.hwInfoBlob);
#if (QNN_API_VERSION_MAJOR >= 2 && QNN_API_VERSION_MINOR >= 21)
} else if (binaryinfo->version == QNN_SYSTEM_CONTEXT_BINARY_INFO_VERSION_3) {
htp_graphblobinfo = static_cast<QnnHtpSystemContext_GraphBlobInfo_t*>(
binaryinfo->contextBinaryInfoV3.graphs->graphInfoV3.graphBlobInfo);
#endif
} else {
QNN_EXECUTORCH_LOG_WARN(
"Unknown QNN BinaryInfo version %d.", binaryinfo->version);
Expand All @@ -46,6 +50,7 @@ Error HtpBackendCache::RetrieveBackendBinaryInfo(
}
}

#if (QNN_API_VERSION_MAJOR >= 2 && QNN_API_VERSION_MINOR >= 21)
if (htp_graphblobinfo) {
if (htp_graphblobinfo->version ==
QNN_SYSTEM_CONTEXT_HTP_GRAPH_INFO_BLOB_VERSION_V1) {
Expand All @@ -58,6 +63,7 @@ Error HtpBackendCache::RetrieveBackendBinaryInfo(
return Error::Internal;
}
}
#endif

return Error::Ok;
}
Expand Down

0 comments on commit 6096504

Please sign in to comment.