File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
onnxruntime/core/providers/qnn/builder Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1724,6 +1724,15 @@ Status QnnBackendManager::GetOrRegisterContextMemHandle(Qnn_ContextHandle_t cont
17241724 void * shared_memory_address,
17251725 const Qnn_Tensor_t& qnn_tensor,
17261726 Qnn_MemHandle_t& mem_handle) {
1727+ // Multi-threading situations to consider:
1728+ // 1) Shared memory allocation is being freed in another thread while we are processing `shared_memory_address`.
1729+ // This implies incorrect usage as the memory is being freed while it is still in use. Let's assume this won't
1730+ // happen.
1731+ // 2) The shared memory allocation clean up function is being run from another thread while the
1732+ // QnnContextHandleRecord or QnnBackendManager objects are being destroyed.
1733+ // Usage of weak_ptrs from the clean up function should ensure that those objects are only accessed while they are
1734+ // in scope.
1735+
17271736 const auto context_handle_record_it = context_map_.find (context_handle);
17281737 ORT_RETURN_IF_NOT (context_handle_record_it != context_map_.end (), " QNN context not found: " , context_handle);
17291738
You can’t perform that action at this time.
0 commit comments