Function Snpe_UserMemoryMap_AddFdOffset

Function Documentation

Snpe_ErrorCode_t Snpe_UserMemoryMap_AddFdOffset(Snpe_UserMemoryMap_Handle_t handle, const char *name, void *address, size_t totalAllocatedSize, int32_t fd, uint64_t offset)

Adds a name and the corresponding buffer address to the map.

Parameters
  • handle[in] : Handle to access UserMemory Map

  • name[in] : The name of the UserMemory

  • address[in] : The pointer to the buffer memory

  • totalAllocatedSize[in] : Total allocated size in bytes

  • fd[in] : The file descriptor to the Buffer Memory. Passing -1 would lead SNPE to assume the address to be DSP Fast RPC allocated memory (libcdsprpc.so/dll)

  • offset[in] : The byte offset to the Buffer Memory. This allows a single large block of memory to be allocated for multiple tensors and individual tensors are identified by a common address/fd and an unique byte offset to the real address

Note

totalAllocatedSize is the total size of the allocation even if all of it is not used or only a portion of it is used via offsets. This will not always be equal to tensor size

Note

If a UserBuffer with the same name already exists, the new address/fd/offset would be added to the map along with the existing entries. Passing totalAllocatedSize=0, fd=-1 and offset=0 to this API is equivalent to invoking Snpe_UserMemoryMap_Add()