Class ov::intel_npu::level_zero::ZeroContext#

class ZeroContext : public ov::RemoteContext#

This class represents an abstraction for NPU plugin remote context which is shared with LevelZero context object. The plugin object derived from this class can be obtained either with CompiledModel::get_context() or Core::create_context() calls.

Public Functions

inline ZeroContext(Core &core)#

Constructs context object from user-supplied LevelZero context handle.

Parameters:

core – A reference to OpenVINO Runtime Core object

inline void *get()#

Returns the underlying LevelZero context handle.

Returns:

void*

inline ZeroBufferTensor create_tensor(const element::Type type, const Shape &shape, void *buffer)#

This function is used to obtain remote tensor object from user-supplied NT handle object.

Parameters:
  • typeTensor element type

  • shapeTensor shape

  • buffer – A void* object that should be wrapped by a remote tensor

Returns:

A remote tensor instance

inline ZeroBufferTensor create_tensor(const element::Type type, const Shape &shape, int fd)#

This function is used to obtain remote tensor object from user-supplied DMA-BUF System Heap object.

Parameters:
  • typeTensor element type

  • shapeTensor shape

  • fd – A int object that should be wrapped by a remote tensor

Returns:

A remote tensor instance

inline ZeroBufferTensor create_l0_host_tensor(const element::Type type, const Shape &shape, const TensorType tensor_type = TensorType::BINDED)#

This function is used to obtain remote tensor object.

Parameters:
  • typeTensor element type

  • shapeTensor shape

  • tensor_type – Type of the tensor to be shared, input, output or binded

Returns:

A remote tensor instance

RemoteTensor create_tensor(const element::Type &type, const Shape &shape, const AnyMap &params = {})#

Allocates memory tensor in device memory or wraps user-supplied memory handle using the specified tensor description and low-level device-specific parameters. Returns a pointer to the object that implements the RemoteTensor interface.

Parameters:
  • type – Defines the element type of the tensor.

  • shape – Defines the shape of the tensor.

  • params – Map of the low-level tensor object parameters.

Returns:

Pointer to a plugin object that implements the RemoteTensor interface.