Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[NPU] Adding support for importing raw pointer into zero memory through remote tensor (#32908)

Bogdan Pereanu7bf1918b02ed
diff --git a/docs/articles_en/assets/snippets/npu_remote_objects_creation.cpp b/docs/articles_en/assets/snippets/npu_remote_objects_creation.cpp
index 9eb064aeeed..8a181aef8d4 100644
--- a/docs/articles_en/assets/snippets/npu_remote_objects_creation.cpp
+++ b/docs/articles_en/assets/snippets/npu_remote_objects_creation.cpp
@@ -44,14 +44,24 @@ int main() {
{
//! [wrap_nt_handle]
void* shared_buffer = nullptr;
- auto remote_tensor = npu_context.create_tensor(in_element_type, in_shape, shared_buffer);
+ ov::intel_npu::MemType memory_type = ov::intel_npu::MemType::SHARED_BUF;
+ auto remote_tensor = npu_context.create_tensor(in_element_type, in_shape, shared_buffer, memory_type);
//! [wrap_nt_handle]
}
+ {
+ //! [import_cpu_va]
+ void* standard_allocation = nullptr;
+ ov::intel_npu::MemType memory_type = ov::intel_npu::MemType::CPU_VA;
+ auto remote_tensor = npu_context.create_tensor(in_element_type, in_shape, standard_allocation, memory_type);
+ //! [import_cpu_va]
+ }
+
{
//! [wrap_dmabuf_fd]
int32_t fd_heap = 0; // create the DMA-BUF System Heap file descriptor
- auto remote_tensor = npu_context.create_tensor(in_element_type, in_shape, fd_heap);
+ ov::intel_npu::MemType memory_type = ov::intel_npu::MemType::SHARED_BUF;
+ auto remote_tensor = npu_context.create_tensor(in_element_type, in_shape, fd_heap, memory_type);
//! [wrap_dmabuf_fd]
}
diff --git a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device/remote-tensor-api-npu-plugin.rst b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device/remote-tensor-api-npu-plugin.rst
index 4cf35e90fcc..9aa46aa82c1 100644
--- a/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device/remote-tensor-api-npu-plugin.rst
+++ b/docs/articles_en/openvino-workflow/running-inference/inference-devices-and-modes/npu-device/remote-tensor-api-npu-plugin.rst
@@ -12,8 +12,8 @@ The NPU plugin supports memory sharing between OpenVINO and native APIs such as
It implements the ``ov::RemoteContext`` and ``ov::RemoteTensor`` interfaces, providing mechanisms for efficient memory sharing.
On Windows, the plugin exports an NT handle; on Linux, it uses a DMA-BUF System Heap. You can share this memory by
passing the pointer as the ``shared_buffer`` member to the ``remote_tensor(..., shared_buffer)`` create function.
-Another option is to share memory by mapping a file into memory. These methods help avoid memory copy overhead when
-plugging OpenVINO inference into an existing NPU pipeline.
+Another option is to import memory by mapping a file into memory or by using a CPU virtual address allocation. These methods
+help avoid memory copy overhead when plugging OpenVINO inference into an existing NPU pipeline.
Supported scenario by the Remote Tensor API:
@@ -81,8 +81,15 @@ For more details, see the code snippets below:
:language: cpp
:fragment: [file_mapping]
+ .. tab-item:: Import CPU virtual address allocation
+ :sync: import-cpu-va
+
+ .. doxygensnippet:: docs/articles_en/assets/snippets/npu_remote_objects_creation.cpp
+ :language: cpp
+ :fragment: [import_cpu_va]
+
.. tab-item:: NT handle
- :sync: nthandle
+ :sync: nt-handle
.. doxygensnippet:: docs/articles_en/assets/snippets/npu_remote_objects_creation.cpp
:language: cpp
@@ -118,7 +125,23 @@ For more details, see the code snippets below:
Limitations
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-* Allocation of the NT handle or DMA-BUF System Heap file descriptor is done manually.
+The NPU plugin does not support methods for direct allocation of native handles.
+
+.. warning::
+
+ **CPU Virtual Address Allocation Requirements**
+ When using CPU virtual address allocations, you **must** comply with the following requirements to prevent memory corruption and crashes:
+
+ **1. Memory Alignment (Mandatory)**
+ Both the allocation pointer and its size must be aligned to the standard page size (4KB). Non-aligned allocations will be rejected.
+
+ **2. Allocation Lifetime (Critical)**
+ The allocation must remain valid **until ALL** of the following have occurred:
+ * All inference requests using this remote tensor have completed execution, **AND**
+ * All inference requests using this remote tensor have been destroyed, **AND**
+ * The remote tensor has been destroyed
+
+ Failure to maintain the allocation for the entire lifecycle will result in undefined behavior and potential crashes.
Low-Level Methods for RemoteContext and RemoteTensor Creation
#############################################################
diff --git a/src/inference/include/openvino/runtime/intel_npu/level_zero/level_zero.hpp b/src/inference/include/openvino/runtime/intel_npu/level_zero/level_zero.hpp
index 971d04844d5..2a860a23144 100644
--- a/src/inference/include/openvino/runtime/intel_npu/level_zero/level_zero.hpp
+++ b/src/inference/include/openvino/runtime/intel_npu/level_zero/level_zero.hpp
@@ -49,7 +49,8 @@ public:
{std::string(ov::intel_npu::mem_type.name()),
{ov::Any(ov::intel_npu::MemType::L0_INTERNAL_BUF).as<std::string>(),
ov::Any(ov::intel_npu::MemType::SHARED_BUF).as<std::string>(),
- ov::Any(ov::intel_npu::MemType::MMAPED_FILE).as<std::string>()}}});
+ ov::Any(ov::intel_npu::MemType::MMAPED_FILE).as<std::string>(),
+ ov::Any(ov::intel_npu::MemType::CPU_VA).as<std::string>()}}});
}
/**
@@ -101,14 +102,25 @@ public:
}
/**
- * @brief This function is used to obtain remote tensor object from user-supplied NT handle object
+ * @brief This function is used to obtain remote tensor object from user-supplied NT handle object or raw pointer
* @param type Tensor element type
* @param shape Tensor shape
* @param buffer A void* object that should be wrapped by a remote tensor
+ * @param memory_type Memory type to use (default: SHARED_BUF)
+ * @param tensor_type Type of the tensor to be shared, input, output or binded (default: BINDED)
* @return A remote tensor instance
*/
- ZeroBufferTensor create_tensor(const element::Type type, const Shape& shape, void* buffer) {
- AnyMap params = {{mem_type.name(), MemType::SHARED_BUF}, {mem_handle.name(), buffer}};
+ ZeroBufferTensor create_tensor(const element::Type type,
+ const Shape& shape,
+ void* buffer,
+ const MemType memory_type = MemType::SHARED_BUF,
+ const TensorType tensor_type = TensorType::BINDED) {
+ OPENVINO_ASSERT(memory_type == MemType::SHARED_BUF || memory_type == MemType::CPU_VA,
+ "Only SHARED_BUF and CPU_VA memory types are supported for raw buffer pointer or NT handle");
+
+ AnyMap params = {{mem_type.name(), memory_type},
+ {mem_handle.name(), buffer},
+ {ov::intel_npu::tensor_type.name(), tensor_type}};
return create_tensor(type, shape, params).as<ZeroBufferTensor>();
}
@@ -117,11 +129,21 @@ public:
* @param type Tensor element type
* @param shape Tensor shape
* @param fd A int object that should be wrapped by a remote tensor
+ * @param memory_type Memory type to use (default: SHARED_BUF)
+ * @param tensor_type Type of the tensor to be shared, input, output or binded (default: BINDED)
* @return A remote tensor instance
*/
- ZeroBufferTensor create_tensor(const element::Type type, const Shape& shape, int fd) {
- AnyMap params = {{mem_type.name(), MemType::SHARED_BUF},
- {mem_handle.name(), reinterpret_cast<void*>(static_cast<intptr_t>(fd))}};
+ ZeroBufferTensor create_tensor(const element::Type type,
+ const Shape& shape,
+ int fd,
+ const MemType memory_type = MemType::SHARED_BUF,
+ const TensorType tensor_type = TensorType::BINDED) {
+ OPENVINO_ASSERT(memory_type == MemType::SHARED_BUF,
+ "Only SHARED_BUF memory type is supported for DMA-BUF file descriptor");
+
+ AnyMap params = {{mem_type.name(), memory_type},
+ {mem_handle.name(), reinterpret_cast<void*>(static_cast<intptr_t>(fd))},
+ {ov::intel_npu::tensor_type.name(), tensor_type}};
return create_tensor(type, shape, params).as<ZeroBufferTensor>();
}
diff --git a/src/inference/include/openvino/runtime/intel_npu/remote_properties.hpp b/src/inference/include/openvino/runtime/intel_npu/remote_properties.hpp
index 323e2f32842..dab720c1f03 100644
--- a/src/inference/include/openvino/runtime/intel_npu/remote_properties.hpp
+++ b/src/inference/include/openvino/runtime/intel_npu/remote_properties.hpp
@@ -25,6 +25,7 @@ enum class MemType {
L0_INTERNAL_BUF = 0, //!< Internal Level Zero buffer type allocated by plugin
SHARED_BUF = 1, //!< Shared buffer
MMAPED_FILE = 2, //!< Memory-mapped file buffer
+ CPU_VA = 3 //!< CPU Virtual Address buffer
};
/** @cond INTERNAL */
@@ -36,6 +37,8 @@ inline std::ostream& operator<<(std::ostream& os, const MemType& mem_type) {
return os << "SHARED_BUF";
case MemType::MMAPED_FILE:
return os << "MMAPED_FILE";
+ case MemType::CPU_VA:
+ return os << "CPU_VA";
default:
OPENVINO_THROW("Unsupported memory type");
}
@@ -50,6 +53,8 @@ inline std::istream& operator>>(std::istream& is, MemType& mem_type) {
mem_type = MemType::SHARED_BUF;
} else if (str == "MMAPED_FILE") {
mem_type = MemType::MMAPED_FILE;
+ } else if (str == "CPU_VA") {
+ mem_type = MemType::CPU_VA;
} else {
OPENVINO_THROW("Unsupported memory type: ", str);
}
diff --git a/src/plugins/intel_npu/src/plugin/src/remote_context.cpp b/src/plugins/intel_npu/src/plugin/src/remote_context.cpp
index 6b706dc8400..c901724f68d 100644
--- a/src/plugins/intel_npu/src/plugin/src/remote_context.cpp
+++ b/src/plugins/intel_npu/src/plugin/src/remote_context.cpp
@@ -86,8 +86,9 @@ ov::SoPtr<ov::IRemoteTensor> RemoteContextImpl::create_tensor(const ov::element:
return {std::make_shared<ZeroRemoteTensor>(get_this_shared_ptr(), _init_structs, type, shape)};
}
- // Mem_handle shall be set if mem_type is a shared memory type.
- if (mem_type_object.value() == MemType::SHARED_BUF && !mem_handle_object.has_value()) {
+ // Mem_handle shall be set if mem_type is a shared memory type or a CPU virtual address.
+ if ((mem_type_object.value() == MemType::SHARED_BUF || mem_type_object.value() == MemType::CPU_VA) &&
+ !mem_handle_object.has_value()) {
OPENVINO_THROW("No parameter ", mem_handle.name(), " found in parameters map");
}
diff --git a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_remote_tensor.hpp b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_remote_tensor.hpp
index 3c41887c4e5..324d23e7e5e 100644
--- a/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_remote_tensor.hpp
+++ b/src/plugins/intel_npu/src/utils/include/intel_npu/utils/zero/zero_remote_tensor.hpp
@@ -24,10 +24,10 @@ public:
const std::shared_ptr<ZeroInitStructsHolder>& init_structs,
const ov::element::Type& element_type,
const ov::Shape& shape,
- ov::intel_npu::TensorType tensor_type = ov::intel_npu::TensorType::BINDED,
- ov::intel_npu::MemType mem_type = ov::intel_npu::MemType::L0_INTERNAL_BUF,
- const void* mem = nullptr,
- const std::optional<ov::intel_npu::FileDescriptor>& file_descriptor = std::nullopt);
+ ov::intel_npu::TensorType zero_tensor_type = ov::intel_npu::TensorType::BINDED,
+ ov::intel_npu::MemType memory_type = ov::intel_npu::MemType::L0_INTERNAL_BUF,
+ const void* memory = nullptr,
+ const std::optional<ov::intel_npu::FileDescriptor>& file_desc = std::nullopt);
/**
* @brief Returns additional information associated with tensor
diff --git a/src/plugins/intel_npu/src/utils/src/zero/zero_remote_tensor.cpp b/src/plugins/intel_npu/src/utils/src/zero/zero_remote_tensor.cpp
index 1d7bc799c7f..f80dd75c961 100644
--- a/src/plugins/intel_npu/src/utils/src/zero/zero_remote_tensor.cpp
+++ b/src/plugins/intel_npu/src/utils/src/zero/zero_remote_tensor.cpp
@@ -18,20 +18,20 @@ ZeroRemoteTensor::ZeroRemoteTensor(const std::shared_ptr<ov::IRemoteContext>& co
const std::shared_ptr<ZeroInitStructsHolder>& init_structs,
const ov::element::Type& element_type,
const ov::Shape& shape,
- TensorType tensor_type,
- MemType mem_type,
- const void* mem,
- const std::optional<ov::intel_npu::FileDescriptor>& file_descriptor)
+ TensorType zero_tensor_type,
+ MemType memory_type,
+ const void* memory,
+ const std::optional<FileDescriptor>& file_desc)
: _context(context),
_init_structs(init_structs),
_element_type(element_type),
_shape(shape),
_capacity(shape),
_logger("ZeroRemoteContext", Logger::global().level()),
- _tensor_type(tensor_type),
- _mem_type(mem_type),
- _file_descriptor(file_descriptor),
- _mem(mem) {
+ _tensor_type(zero_tensor_type),
+ _mem_type(memory_type),
+ _file_descriptor(file_desc),
+ _mem(memory) {
OPENVINO_ASSERT(shape_size(_shape) != 0);
OPENVINO_ASSERT(_element_type.is_static());
@@ -169,13 +169,6 @@ void ZeroRemoteTensor::allocate(const size_t bytes) {
file_descriptor.name(),
" found in parameters map");
- if (!_init_structs->isExternalMemoryStandardAllocationSupported()) {
- _logger.info("Importing mmaped memory isn't supported for this configuration. File data will be copied to "
- "the level zero memory");
- copy_file_data_to_level_zero_memory(bytes);
- break;
- }
-
if (_tensor_type == TensorType::OUTPUT) {
// It is impossible to work on output today since ov::read_tensor_data opens the file in read-only mode.
OPENVINO_THROW("Importing memory from a memory-mapped file is supported only for input tensors");
@@ -184,6 +177,13 @@ void ZeroRemoteTensor::allocate(const size_t bytes) {
_tensor_type = TensorType::INPUT;
}
+ if (!_init_structs->isExternalMemoryStandardAllocationSupported()) {
+ _logger.info("Importing mmaped memory isn't supported for this configuration. File data will be copied to "
+ "the level zero memory");
+ copy_file_data_to_level_zero_memory(bytes);
+ break;
+ }
+
_mmap_tensor = ov::read_tensor_data(_file_descriptor.value()._file_path,
_element_type,
_shape,
@@ -205,6 +205,15 @@ void ZeroRemoteTensor::allocate(const size_t bytes) {
}
break;
}
+ case MemType::CPU_VA: {
+ _host_memory = ZeroMemPool::get_instance().import_standard_allocation_memory(
+ _init_structs,
+ _mem,
+ bytes,
+ _tensor_type == TensorType::INPUT ? true : false);
+ _data = _host_memory->data();
+ break;
+ }
default:
_data = nullptr;
}
@@ -223,12 +232,11 @@ void ZeroRemoteTensor::update_properties() {
switch (_mem_type) {
case MemType::L0_INTERNAL_BUF:
case MemType::MMAPED_FILE:
+ case MemType::CPU_VA:
_properties = {mem_type(_mem_type), mem_handle(_data), tensor_type(_tensor_type)};
-
break;
case MemType::SHARED_BUF:
- _properties = {mem_type(_mem_type), mem_handle(_data)};
-
+ _properties = {mem_type(_mem_type), mem_handle(_data), tensor_type(_tensor_type)};
break;
default:
OPENVINO_THROW("Unsupported object type ", static_cast<int>(_mem_type));
diff --git a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.hpp b/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.hpp
index 09999294dc5..e5440f40e64 100644
--- a/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.hpp
+++ b/src/plugins/intel_npu/tests/functional/behavior/remote_tensor_tests/remote_run.hpp
@@ -460,6 +460,172 @@ TEST_P(RemoteRunTests, CheckRemoteTensorImportFile3) {
std::filesystem::remove(filename);
}
+TEST_P(RemoteRunTests, TryImportCpuVAExpectedErrorUnalignedSize) {
+ SKIP_IF_CURRENT_TEST_IS_DISABLED()
+
+ if (std::make_shared<::intel_npu::ZeroInitStructsHolder>()->isExternalMemoryStandardAllocationSupported()) {
+ auto shape = Shape{1, 64};
+ auto shape_size = ov::shape_size(shape);
+
+ auto data = ::operator new(shape_size * sizeof(float), std::align_val_t(4096));
+ for (size_t i = 0; i < shape_size; ++i) {
+ static_cast<float*>(data)[i] = 5.f;
+ }
+
+ auto context = core->get_default_context(target_device);
+
+ ov::AnyMap params = {{ov::intel_npu::mem_type.name(), ov::intel_npu::MemType::CPU_VA},
+ {ov::intel_npu::mem_handle.name(), data}};
+ ASSERT_THROW(auto remote_tensor = context.create_tensor(ov::element::f32, shape, params), std::exception);
+
+ ::operator delete(data, std::align_val_t(4096));
+ } else {
+ GTEST_SKIP() << "Standard allocation is not supported by the driver";
+ }
+}
+
+TEST_P(RemoteRunTests, TryImportCpuVAExpectedErrorUnalignedAddress) {
+ SKIP_IF_CURRENT_TEST_IS_DISABLED()
+
+ if (std::make_shared<::intel_npu::ZeroInitStructsHolder>()->isExternalMemoryStandardAllocationSupported()) {
+ auto shape = Shape{1, 1024};
+ auto shape_size = ov::shape_size(shape);
+
+ auto data = ::operator new(shape_size * sizeof(float) + 64, std::align_val_t(4096));
+ auto unaligned_data = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(data) + 64);
+ for (size_t i = 0; i < shape_size; ++i) {
+ static_cast<float*>(unaligned_data)[i] = 5.f;
+ }
+
+ auto context = core->get_default_context(target_device);
+
+ ov::AnyMap params = {{ov::intel_npu::mem_type.name(), ov::intel_npu::MemType::CPU_VA},
+ {ov::intel_npu::mem_handle.name(), unaligned_data}};
+ ASSERT_THROW(auto remote_tensor = context.create_tensor(ov::element::f32, shape, params), std::exception);
+
+ ::operator delete(data, std::align_val_t(4096));
+ } else {
+ GTEST_SKIP() << "Standard allocation is not supported by the driver";
+ }
+}
+
+TEST_P(RemoteRunTests, ImportCpuVAUsingNpuRemoteTensorAPI) {
+ SKIP_IF_CURRENT_TEST_IS_DISABLED()
+
+ if (std::make_shared<::intel_npu::ZeroInitStructsHolder>()->isExternalMemoryStandardAllocationSupported()) {
+ auto shape = Shape{1, 1024};
+ auto shape_size = ov::shape_size(shape);
+ auto model = createModel(element::f32, shape, "N...");
+
+ ov::CompiledModel compiled_model;
+ ov::InferRequest inference_request;
+
+ auto input_data = ::operator new(shape_size * sizeof(float), std::align_val_t(4096));
+ auto output_data = ::operator new(shape_size * sizeof(float), std::align_val_t(4096));
+ for (size_t i = 0; i < shape_size; ++i) {
+ static_cast<float*>(input_data)[i] = 5.f;
+ }
+
+ auto zero_context = core->get_default_context(target_device).as<ov::intel_npu::level_zero::ZeroContext>();
+
+ OV_ASSERT_NO_THROW(compiled_model = core->compile_model(model, target_device, configuration));
+ OV_ASSERT_NO_THROW(inference_request = compiled_model.create_infer_request());
+
+ ov::intel_npu::level_zero::ZeroBufferTensor input_remote_tensor, output_remote_tensor;
+ OV_ASSERT_NO_THROW(input_remote_tensor = zero_context.create_tensor(ov::element::f32,
+ shape,
+ input_data,
+ ov::intel_npu::MemType::CPU_VA,
+ ov::intel_npu::TensorType::INPUT));
+
+ OV_ASSERT_NO_THROW(output_remote_tensor = zero_context.create_tensor(ov::element::f32,
+ shape,
+ output_data,
+ ov::intel_npu::MemType::CPU_VA,
+ ov::intel_npu::TensorType::OUTPUT));
+
+ OV_ASSERT_NO_THROW(inference_request.set_input_tensor(input_remote_tensor));
+ OV_ASSERT_NO_THROW(inference_request.set_output_tensor(output_remote_tensor));
+ OV_ASSERT_NO_THROW(inference_request.infer());
+
+ float* output_tensor_data = reinterpret_cast<float*>(output_remote_tensor.get());
+
+ float expected_result = 6.0f;
+ for (size_t j = 0; j < output_remote_tensor.get_size(); ++j) {
+ EXPECT_NEAR(output_tensor_data[j], expected_result, 1e-5)
+ << " Expected=" << expected_result << ", actual=" << output_tensor_data[j] << " for index " << j;
+ }
+
+ inference_request = {};
+ input_remote_tensor = {};
+ output_remote_tensor = {};
+
+ ::operator delete(input_data, std::align_val_t(4096));
+ ::operator delete(output_data, std::align_val_t(4096));
+ } else {
+ GTEST_SKIP() << "Standard allocation is not supported by the driver";
+ }
+}
+
+TEST_P(RemoteRunTests, ImportCpuVAUwithoutSettingBufferExpectedError) {
+ SKIP_IF_CURRENT_TEST_IS_DISABLED()
+ auto shape = Shape{1, 1024};
+
+ auto zero_context = core->get_default_context(target_device).as<ov::intel_npu::level_zero::ZeroContext>();
+
+ ov::intel_npu::level_zero::ZeroBufferTensor remote_tensor;
+ ASSERT_THROW(
+ remote_tensor = zero_context.create_tensor(ov::element::f32, shape, nullptr, ov::intel_npu::MemType::CPU_VA),
+ std::exception);
+}
+
+TEST_P(RemoteRunTests, ImportCpuVAUsingStandardRemoteTensorAPI) {
+ SKIP_IF_CURRENT_TEST_IS_DISABLED()
+
+ if (std::make_shared<::intel_npu::ZeroInitStructsHolder>()->isExternalMemoryStandardAllocationSupported()) {
+ auto shape = Shape{1, 1024};
+ auto shape_size = ov::shape_size(shape);
+ auto model = createModel(element::f32, shape, "N...");
+
+ ov::CompiledModel compiled_model;
+ ov::InferRequest inference_request;
+
+ auto data = ::operator new(shape_size * sizeof(float), std::align_val_t(4096));
+ for (size_t i = 0; i < shape_size; ++i) {
+ static_cast<float*>(data)[i] = 5.f;
+ }
+
+ auto context = core->get_default_context(target_device);
+ OV_ASSERT_NO_THROW(compiled_model = core->compile_model(model, target_device, configuration));
+ OV_ASSERT_NO_THROW(inference_request = compiled_model.create_infer_request());
+
+ ov::AnyMap params = {{ov::intel_npu::mem_type.name(), ov::intel_npu::MemType::CPU_VA},
+ {ov::intel_npu::mem_handle.name(), data}};
+ ov::RemoteTensor remote_tensor;
+ OV_ASSERT_NO_THROW(remote_tensor = context.create_tensor(ov::element::f32, shape, params));
+
+ OV_ASSERT_NO_THROW(inference_request.set_input_tensor(remote_tensor));
+ OV_ASSERT_NO_THROW(inference_request.infer());
+
+ auto output_tensor = inference_request.get_output_tensor();
+ float* output_tensor_data = reinterpret_cast<float*>(output_tensor.data());
+
+ float expected_result = 6.0f;
+ for (size_t j = 0; j < output_tensor.get_size(); ++j) {
+ EXPECT_NEAR(output_tensor_data[j], expected_result, 1e-5)
+ << " Expected=" << expected_result << ", actual=" << output_tensor_data[j] << " for index " << j;
+ }
+
+ // destroy inference request and remote tensor to ensure that the file is closed
+ inference_request = {};
+ remote_tensor = {};
+
+ ::operator delete(data, std::align_val_t(4096));
+ } else {
+ GTEST_SKIP() << "Standard allocation is not supported by the driver";
+ }
+}
+
TEST_P(RemoteRunTests, CheckRemoteTensorInternalBufSetPropertyInContext) {
// Skip test according to plugin specific disabledTestPatterns() (if any)
SKIP_IF_CURRENT_TEST_IS_DISABLED()