Skip to content

Commit bbeac4d

Browse files
author
quic_calvnguy
committed
pr comments
1 parent 6fe0e9a commit bbeac4d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

onnxruntime/core/providers/qnn/builder/qnn_backend_manager.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,6 +1093,7 @@ Status QnnBackendManager::CreateContextFromListAsyncWithCallback(const QnnContex
10931093
ORT_RETURN_IF_ERROR(file_mapper_->GetContextBinMappedMemoryPtr(context_bin_filepath, &buffer));
10941094

10951095
auto sys_ctx_handle = GetSystemContextHandle();
1096+
ORT_RETURN_IF(sys_ctx_handle == nullptr, "System context handle is null.");
10961097

10971098
uint32_t graph_count = 0;
10981099
Qnn_Version_t blob_version;
@@ -1106,8 +1107,7 @@ Status QnnBackendManager::CreateContextFromListAsyncWithCallback(const QnnContex
11061107

11071108
// Return ORT failure to continue to retry logic in CreateContextVtcmBackupBufferSharingEnabled()
11081109
ORT_RETURN_IF(!MinVersionMet(blob_version, {3, 3, 3}), "Context binary of ", context_bin_filepath, " is v",
1109-
std::to_string(blob_version.major), ".", std::to_string(blob_version.minor),
1110-
".", std::to_string(blob_version.patch),
1110+
blob_version.major, ".", blob_version.minor, ".", blob_version.patch,
11111111
". File mapping is only supported for versions >= 3.3.3");
11121112

11131113
auto notify_param_ptr = std::make_unique<FileMappingCallbackInfo_t>(buffer, buffer_size, this);
@@ -1296,6 +1296,7 @@ Status QnnBackendManager::GetMaxSpillFillBufferSize(unsigned char* buffer,
12961296
// spill fill starts from 2.28
12971297
#if QNN_API_VERSION_MAJOR == 2 && (QNN_API_VERSION_MINOR >= 21)
12981298
auto sys_ctx_handle = GetSystemContextHandle();
1299+
ORT_RETURN_IF(sys_ctx_handle == nullptr, "System context handle is null.");
12991300

13001301
uint32_t graph_count = 0;
13011302
QnnSystemContext_GraphInfo_t* graphs_info = nullptr;
@@ -1372,6 +1373,7 @@ Status QnnBackendManager::LoadCachedQnnContextFromBuffer(char* buffer, uint64_t
13721373
#endif
13731374

13741375
auto sys_ctx_handle = GetSystemContextHandle();
1376+
ORT_RETURN_IF(sys_ctx_handle == nullptr, "System context handle is null.");
13751377

13761378
uint32_t graph_count = 0;
13771379
QnnSystemContext_GraphInfo_t* graphs_info = nullptr;
@@ -1393,8 +1395,8 @@ Status QnnBackendManager::LoadCachedQnnContextFromBuffer(char* buffer, uint64_t
13931395

13941396
#ifdef QNN_FILE_MAPPED_WEIGHTS_AVAILABLE
13951397
if (use_file_mapping && !MinVersionMet(blob_version, {3, 3, 3})) {
1396-
LOGS(*logger_, WARNING) << "Context binary of " << node_name << " is v" << std::to_string(blob_version.major) << "."
1397-
<< std::to_string(blob_version.minor) << "." << std::to_string(blob_version.patch)
1398+
LOGS(*logger_, WARNING) << "Context binary of " << node_name << " is v"
1399+
<< blob_version.major << "." << blob_version.minor << "." << blob_version.patch
13981400
<< ". File mapping is only supported for versions >= 3.3.3. Disabling file mapping for this node.";
13991401
use_file_mapping = false;
14001402
}

0 commit comments

Comments
 (0)