Group Remote Context

group ov_remote_context_c_api

Set of functions representing of RemoteContext.

Functions

ov_remote_context_create_tensor(const ov_remote_context_t *context, const ov_element_type_e type, const ov_shape_t shape, const size_t object_args_size, ov_tensor_t **remote_tensor, ...)

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
  • context – A pointer to the ov_remote_context_t instance.

  • type – Defines the element type of the tensor.

  • shape – Defines the shape of the tensor.

  • object_args_size – Size of the low-level tensor object parameters.

  • remote_tensor – Pointer to returned ov_tensor_t that contains remote tensor instance.

  • ... – variadic params Contains low-level tensor object parameters.

Returns

Status code of the operation: OK(0) for success.

ov_remote_context_get_params(const ov_remote_context_t *context, size_t *size, char **params)

Returns a string contains device-specific parameters required for low-level operations with the underlying object. Parameters include device/context handles, access flags, etc. Content of the returned map depends on a remote execution context that is currently set on the device (working scenario). One actaul example: “CONTEXT_TYPE OCL OCL_CONTEXT 0x5583b2ec7b40 OCL_QUEUE 0x5583b2e98ff0”.

Parameters
  • context – A pointer to the ov_remote_context_t instance.

  • size – The size of param pairs.

  • params – Param name:value list.

Returns

Status code of the operation: OK(0) for success.

ov_remote_context_create_host_tensor(const ov_remote_context_t *context, const ov_element_type_e type, const ov_shape_t shape, ov_tensor_t **tensor)

This method is used to create a host tensor object friendly for the device in current context. For example, GPU context may allocate USM host memory (if corresponding extension is available), which could be more efficient than regular host memory.

Parameters
  • context – A pointer to the ov_remote_context_t instance.

  • type – Defines the element type of the tensor.

  • shape – Defines the shape of the tensor.

  • tensor – Pointer to ov_tensor_t that contains host tensor.

Returns

Status code of the operation: OK(0) for success.

ov_remote_context_free(ov_remote_context_t *context)

Release the memory allocated by ov_remote_context_t.

Parameters

context – A pointer to the ov_remote_context_t to free memory.

Returns

Status code of the operation: OK(0) for success.

ov_remote_tensor_get_params(ov_tensor_t *tensor, size_t *size, char **params)

Returns a string contains device-specific parameters required for low-level operations with underlying object. Parameters include device/context/surface/buffer handles, access flags, etc. Content of the returned map depends on remote execution context that is currently set on the device (working scenario). One example: “MEM_HANDLE:0x559ff6904b00;OCL_CONTEXT:0x559ff71d62f0;SHARED_MEM_TYPE:OCL_BUFFER;”.

Parameters
  • tensor – Pointer to ov_tensor_t that contains host tensor.

  • size – The size of param pairs.

  • params – Param name:value list.

Returns

Status code of the operation: OK(0) for success.