Function QnnMem_register¶
Defined in File QnnMem.h
Function Documentation¶
-
Qnn_ErrorHandle_t QnnMem_register(Qnn_ContextHandle_t context, const Qnn_MemDescriptor_t *memDescriptors, uint32_t numDescriptors, Qnn_MemHandle_t *memHandles)¶
Register existing memory to memory handle. Used to instruct QNN to use this memory directly.
- Parameters
context – [in] A context handle.
memDescriptors – [in] Array of memory descriptors to be registered.
numDescriptors – [in] Number of memory descriptors in the array.
memHandles – [out] Array of allocated memory handles, length is numDescriptors. Same shape as memDescriptors (i.e. memHandles[n] corresponds to memDescriptors[n]).
- Returns
Error code:
QNN_SUCCESS: memory was successfully registered
QNN_MEM_ERROR_NOT_SUPPORTED: backend does not support this API
QNN_MEM_ERROR_ALREADY_REGISTERED: memory has already been registered
QNN_MEM_ERROR_UNSUPPORTED_MEMTYPE: backend does not support a memType specified within memDescriptors
QNN_MEM_ERROR_MAPPING: failed to map between memory file descriptor and memory address
QNN_MEM_ERROR_INVALID_ARGUMENT: NULL array ptr or invalid memory descriptor
QNN_MEM_ERROR_INVALID_SHAPE: backend does not support a memShape specified within memDescriptors
QNN_MEM_ERROR_INVALID_HANDLE: context is not a valid handle
Note
memHandles parameter: Array memory is owned by the client. Array size must be at least numDescriptors*sizeof(Qnn_MemHandle_t). The array will be initialized to NULL by the backend. Upon failure, no memory will be registered and the memHandles array will remain NULL.