rmlCreateTensorFromMTLBuffer

Creates a tensor from an existing Metal buffer.

rml_status rmlSetMIOpenAutoTuningOn(

rml_context context,

void* buffer,

const rml_tensor_info* info,

rml_access_mode mode,

rml_tensor* tensor);

API

Metal Interoperation

Parameters

Parameter

Input/Output

Description

context

input

A valid context handle.

buffer

input

An MTLBuffer instance (id<MTLBuffer>).

info

input

A tensor description with all dimensions specified.

mode

input

A tensor access mode.

tensor

output

A pointer to a resulting tensor handle.

Return and Status Codes

Returns a valid tensor handle in case of success and status:

  • RML_OK if the operation is successful

  • RML_ERROR_BAD_PARAMETER if the context is invalid, the buffer is NULL, the info is NULL or invalid, the mode is invalid or the tensor is NULL

  • RML_ERROR_INTERNAL in case of an internal error

To get more details in case of failure, call rmlGetLastError().

The tensor should be released with rmlReleaseTensor().