Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions onnxruntime/core/providers/openvino/openvino_execution_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,23 @@ common::Status OpenVINOExecutionProvider::Compile(

#ifdef USE_OVEP_NPU_MEMORY
std::vector<AllocatorPtr> OpenVINOExecutionProvider::CreatePreferredAllocators() {
AllocatorCreationInfo npu_allocator_info{
[this](OrtDevice::DeviceId device_id) {
return std::make_unique<OVRTAllocator>(global_context_->ie_core.Get(), OrtDevice::NPU, device_id, OpenVINO_RT_NPU);
},
0,
};

// fill in allocator
return std::vector<AllocatorPtr>{CreateAllocator(npu_allocator_info)};
if (global_context_->device_type.find("NPU") != std::string::npos) {
AllocatorCreationInfo npu_allocator_info{
[this](OrtDevice::DeviceId device_id) {
return std::make_unique<OVRTAllocator>(
global_context_->ie_core.Get(),
OrtDevice::NPU,
device_id,
OpenVINO_RT_NPU);
},
0,
};

// fill in allocator
return std::vector<AllocatorPtr>{CreateAllocator(npu_allocator_info)};
} else {
return std::vector<AllocatorPtr>{};
}
}
#endif

Expand Down