# QairtMem

Common memory types.

**Include:** `#include "QairtMem/QairtMemCommon.h"`

Enums

- enum QairtMem\_Error\_t

    - QAIRT Mem(ory) API result / error codes.

*Values:*

- enumerator QAIRT\_MEM\_MIN\_ERROR = QAIRT\_MIN\_ERROR\_MEM

    - 

- enumerator QAIRT\_MEM\_NO\_ERROR = QAIRT\_SUCCESS

    - Qairt Memory success.

- enumerator QAIRT\_MEM\_ERROR\_NOT\_SUPPORTED = [QAIRT\_COMMON\_ERROR\_NOT\_SUPPORTED](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv4N19QairtCommon_Error_t32QAIRT_COMMON_ERROR_NOT_SUPPORTEDE)

    - Backend does not support requested functionality.

- enumerator QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT = 8000

    - Invalid function argument.

- enumerator QAIRT\_MEM\_ERROR\_INVALID\_HANDLE = 8001

    - Invalid memory handle.

- enumerator QAIRT\_MEM\_ERROR\_ALREADY\_REGISTERED = 8002

    - Provided memory has already been registered.

- enumerator QAIRT\_MEM\_ERROR\_MAPPING = 8003

    - Error in memory mapping.

- enumerator QAIRT\_MEM\_ERROR\_INVALID\_SHAPE = 8004

    - Invalid memory shape based on a backend’s memory restrictions (e.g.

alignment incompatibility)

- enumerator QAIRT\_MEM\_ERROR\_UNSUPPORTED\_MEMTYPE = 8005

    - Backend does not support requested memory type.

- enumerator QAIRT\_MEM\_MAX\_ERROR = QAIRT\_MAX\_ERROR\_MEM

    - 

- enumerator QAIRT\_MEM\_ERROR\_UNDEFINED = 0x7FFFFFFF

    -

* * *

Memory descriptor types.

**Include:** `#include "QairtMem/QairtMemDescriptor.h"`

- struct QairtMem\_DescriptorV1\_t

    - *#include &lt;QairtMemDescriptor.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtMem\_Descriptor\_CreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv430QairtMem_Descriptor_CreateFn_t) create

    - 

- [QairtMem\_Descriptor\_FreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv428QairtMem_Descriptor_FreeFn_t) free

    - 

- [QairtMem\_Descriptor\_SetMemShapeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv435QairtMem_Descriptor_SetMemShapeFn_t) setMemShape

    - 

- [QairtMem\_Descriptor\_GetMemShapeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv435QairtMem_Descriptor_GetMemShapeFn_t) getMemShape

    - 

- [QairtMem\_Descriptor\_SetDataTypeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv435QairtMem_Descriptor_SetDataTypeFn_t) setDataType

    - 

- [QairtMem\_Descriptor\_GetDataTypeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv435QairtMem_Descriptor_GetDataTypeFn_t) getDataType

    - 

- [QairtMem\_Descriptor\_GetMemTypeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv434QairtMem_Descriptor_GetMemTypeFn_t) getMemType

    - 

- [QairtMem\_Descriptor\_SetCustomInfoFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv437QairtMem_Descriptor_SetCustomInfoFn_t) setCustomInfo

    - 

- [QairtMem\_Descriptor\_GetCustomInfoFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv437QairtMem_Descriptor_GetCustomInfoFn_t) getCustomInfo

    - 

- [QairtMem\_Descriptor\_SetDmaBufFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv433QairtMem_Descriptor_SetDmaBufFn_t) setDmaBuf

    - 

- [QairtMem\_Descriptor\_GetDmaBufFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv433QairtMem_Descriptor_GetDmaBufFn_t) getDmaBuf

    - 

- [QairtMem\_Descriptor\_DeregisterMemFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv437QairtMem_Descriptor_DeregisterMemFn_t) deregisterMem

    -

Functions

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_create([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) \*descriptorHandle)

    - Creates a Mem Descriptor handle.

- Parameters

    - **descriptorHandle** – **[out]** A handle to the created mem descriptor.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* is not an assignable handle

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_free([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle)

    - Frees a Mem Descriptor handle.

- Parameters

    - **descriptorHandle** – **[in]** A handle to the created mem descriptor.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* is not an assignable handle

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_setMemShape([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, [QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) memShapeHandle)

    - Sets a shape handle onto a descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor.
- **memShapeHandle** – **[in]** A mem shape handle, created and configured via the Mem Shape component APIs. Once set onto the descriptor, the Mem Shape handle may be freed.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* or *memShapeHandle* are not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_getMemShape([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, [QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) \*memShapeHandle)

    - Gets a shape handle onto a descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor. Once set, the Mem Shape handle may be freed.
- **memShapeHandle** – **[out]** A referenced memShape handle. Reference handles should not be freed. Referenced handles are invalidated if modification operations are performed from the same component API.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *backend* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_setDataType([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, [Qairt\_DataType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv416Qairt_DataType_t) dataType)

    - Sets a data type on a descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor.
- **dataType** – **[in]** The datatype to set

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_getDataType([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, [Qairt\_DataType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv416Qairt_DataType_t) \*dataType)

    - Gets the data type from a descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor.
- **dataType** – **[out]** The datatype value associated with the descriptor handle.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_getMemType([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, [Qairt\_MemType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv415Qairt_MemType_t) \*memType)

    - Gets the mem type from a descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor.
- **memType** – **[out]** The memType value associated with the descriptor handle.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_setCustomInfo([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, [QairtMem\_CustomInfoHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_CustomInfoHandle_t) customInfoHandle)

    - Sets a custom info handle onto a descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor.
- **customInfoHandle** – **[in]** A QairtMem custom info handle, created and configured via the QairtMem Custom Info component APIs, as defined by the backend. Once set onto the descriptor, the custom info handle may be freed.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* or *customInfoHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_getCustomInfo([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, [QairtMem\_CustomInfoHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_CustomInfoHandle_t) \*customInfoHandle)

    - Gets the custom info handle associated with the descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor.
- **customInfoHandle** – **[out]** A referenced QairtMem custom info handle, created and configured via the QairtMem Custom Info component APIs, as defined by the backend. Reference handles should not be freed. Referenced handles are invalidated if modification operations are performed from the same component API.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* or *customInfoHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_setDmaBuf([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, int32\_t fd, void \*data)

    - Sets the dma buf on a descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor.
- **fd** – **[in]** The file descriptor for memory. Must be set to QAIRT\_MEM\_INVALID\_FD if not applicable.
- **data** – **[in]** Data pointer, created by app, using mmap on the above file descriptor.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_getDmaBuf([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t) descriptorHandle, int32\_t \*fd, void \*\*data)

    - Gets the dma buf associated with the descriptor handle.

- Parameters

    - - **descriptorHandle** – **[in]** A handle to the created mem descriptor.
- **fd** – **[out]** The file descriptor for memory. Must be set to QAIRT\_MEM\_INVALID\_FD if not applicable.
- **data** – **[out]** Data pointer, created by app, using mmap on the above file descriptor.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *descriptorHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Descriptor\_deregisterMem([QairtMem\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv417QairtMem_Handle_t) \*memHandles, uint32\_t numHandles)

    - Deregister a memory handle which was registered via QairtMem\_register and invalidates memHandle for the given backend handle.

- Parameters

    - - **memHandlesHandle** – **[in]** Array of memory handles to be deregistered.
- **numHandles** – **[in]** Number of memory handles in the array.

- Returns

    - Error code:

- QAIRT\_SUCCESS: memory was successfully de-registered
- QAIRT\_MEM\_ERROR\_NOT\_SUPPORTED: backend does not support this API
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: *memHandles* is NULL
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: a handle within *memHandles* is NULL/invalid

Note

memHandles parameter: Upon failure, all valid handles within *memHandlesHandle* will still be de-registered.

Note

Use corresponding API through [QairtMem\_DescriptorV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__DescriptorV1__t).

Enums

- enum Qairt\_MemType\_t

    - An enumeration of memory types which may be used to provide data for a QAIRT tensor.

*Values:*

- enumerator QAIRT\_UNSUPPORTED = 1

    - 

- enumerator QAIRT\_MEM\_TYPE\_CUSTOM = 2

    - Memory allocated by a custom backend mechanism.

- enumerator QAIRT\_MEM\_TYPE\_DMA\_BUF = 3

    - Memory allocated by DMA-BUF subsystem.

- enumerator QAIRT\_MEM\_TYPE\_UNDEFINED = 0x7FFFFFFF

    -

Typedefs

- typedef struct \_QairtMem\_Handle\_t \*QairtMem\_Handle\_t

    - 

- typedef struct \_QairtMem\_DescriptorHandle\_t \*QairtMem\_DescriptorHandle\_t

    - 

- typedef struct \_QairtMem\_CustomInfoHandle\_t \*QairtMem\_CustomInfoHandle\_t

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_CreateFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_FreeFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_SetMemShapeFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), [QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_GetMemShapeFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), [QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_SetDataTypeFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), [Qairt\_DataType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv416Qairt_DataType_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_GetDataTypeFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), [Qairt\_DataType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv416Qairt_DataType_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_GetMemTypeFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), [Qairt\_MemType\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv415Qairt_MemType_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_SetCustomInfoFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), [QairtMem\_CustomInfoHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_CustomInfoHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_GetCustomInfoFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), [QairtMem\_CustomInfoHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_CustomInfoHandle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_SetDmaBufFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), int32\_t, void\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_GetDmaBufFn\_t)([QairtMem\_DescriptorHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv427QairtMem_DescriptorHandle_t), int32\_t\*, void\*\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Descriptor\_DeregisterMemFn\_t)([QairtMem\_Handle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv417QairtMem_Handle_t) \*memHandles, uint32\_t numHandles)

    -

Defines

- QAIRT\_MEM\_DESCRIPTOR\_V1\_ID QAIRT\_MIN\_ID\_MEM

    - 

- QAIRT\_MEM\_SHAPE\_V1\_ID QAIRT\_MIN\_ID\_MEM + 2

    -

* * *

Memory shape types.

**Include:** `#include "QairtMem/QairtMemShape.h"`

- struct QairtMem\_ShapeV1\_t

    - *#include &lt;QairtMemShape.h&gt;*

Public Members

- uint64\_t size

    - 

- [Qairt\_GetInterfaceFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv422Qairt_GetInterfaceFn_t) getInterface

    - 

- [QairtMem\_Shape\_CreateFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv425QairtMem_Shape_CreateFn_t) create

    - 

- [QairtMem\_Shape\_FreeFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv423QairtMem_Shape_FreeFn_t) free

    - 

- [QairtMem\_Shape\_GetRankFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv426QairtMem_Shape_GetRankFn_t) getRank

    - 

- [QairtMem\_Shape\_SetDimensionsFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv432QairtMem_Shape_SetDimensionsFn_t) setDimensions

    - 

- [QairtMem\_Shape\_GetDimensionAtFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv433QairtMem_Shape_GetDimensionAtFn_t) getDimensionAt

    - 

- [QairtMem\_Shape\_SetShapeConfigFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv433QairtMem_Shape_SetShapeConfigFn_t) setShapeConfig

    - 

- [QairtMem\_Shape\_GetShapeConfigFn\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv433QairtMem_Shape_GetShapeConfigFn_t) getShapeConfig

    -

Functions

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Shape\_create([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) \*shapeHandle)

    - Creates a Mem Shape handle.

- Parameters

    - **shapeHandle** – **[out]** A handle to the created mem shape.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *shapeHandle* is not an assignable handle

Note

Use corresponding API through [QairtMem\_ShapeV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__ShapeV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Shape\_free([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) shapeHandle)

    - Frees a Mem Shape handle.

- Parameters

    - **shapeHandle** – **[in]** A handle to the created mem shape.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *shapeHandle* is not a valid handle

Note

Use corresponding API through [QairtMem\_ShapeV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__ShapeV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Shape\_getRank([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) shapeHandle, uint32\_t \*rank)

    - Gets the rank from a shape handle.

- Parameters

    - - **shapeHandle** – **[in]** A handle to the created mem shape.
- **rank** – **[out]** The rank associated with the shape handle.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *shapeHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_ShapeV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__ShapeV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Shape\_setDimensions([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) shapeHandle, uint32\_t \*dimensions, const uint32\_t rank)

    - Sets the dimensions on a shape handle.

- Parameters

    - - **shapeHandle** – **[in]** A handle to the created mem shape.
- **dimensions** – **[in]** An array of dimensions, with length rank.
- **rank** – **[in]** The number of dimensions in the dimensions array.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *shapeHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_ShapeV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__ShapeV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Shape\_getDimensionAt([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) shapeHandle, uint32\_t index, uint32\_t \*dim)

    - Gets the dimension at an index.

- Parameters

    - - **shapeHandle** – **[in]** A handle to the created mem shape.
- **index** – **[in]** The index of the dimension to retrieve. Must be less than rank.
- **dim** – **[out]** An array of dimensions, with length rank.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *shapeHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_ShapeV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__ShapeV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Shape\_setShapeConfig([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) shapeHandle, const char \*config)

    - Sets the shape config on a shape handle.

- Parameters

    - - **shapeHandle** – **[in]** A handle to the created mem shape.
- **config** – **[in]** The configuration to set. Allowed to be NULL.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *shapeHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_ShapeV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__ShapeV1__t).

- [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) QairtMem\_Shape\_getShapeConfig([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t) shapeHandle, const char \*\*config)

    - Gets the shape config associated with the shape handle.

- Parameters

    - - **shapeHandle** – **[in]** A handle to the created mem shape.
- **config** – **[out]** The configuration associated with the handle. Allowed to be NULL.

- Returns

    - Error code:

- QAIRT\_SUCCESS: no error is encountered
- QAIRT\_MEM\_ERROR\_INVALID\_HANDLE: *shapeHandle* is not a valid handle
- QAIRT\_MEM\_ERROR\_INVALID\_ARGUMENT: at least one argument is invalid

Note

Use corresponding API through [QairtMem\_ShapeV1\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#structQairtMem__ShapeV1__t).

Typedefs

- typedef struct \_QairtMem\_ShapeHandle\_t \*QairtMem\_ShapeHandle\_t

    - MemShape handle used to interface with MemShape APIs.

The handle itself is created and freed by the client.
    Copy to clipboard

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Shape\_CreateFn\_t)([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t)\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Shape\_FreeFn\_t)([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t))

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Shape\_GetRankFn\_t)([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t), uint32\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Shape\_SetDimensionsFn\_t)([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t), uint32\_t\*, const uint32\_t)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Shape\_GetDimensionAtFn\_t)([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t), uint32\_t, uint32\_t\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Shape\_SetShapeConfigFn\_t)([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t), const char\*)

    - 

- typedef [Qairt\_Status\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtCommon.html#_CPPv414Qairt_Status_t) (\*QairtMem\_Shape\_GetShapeConfigFn\_t)([QairtMem\_ShapeHandle\_t](https://docs.qualcomm.com/doc/80-63442-10/topic/QairtMem.html#_CPPv422QairtMem_ShapeHandle_t), const char\*\*)

    -

Last Published: Jun 04, 2026

[Previous Topic
QairtDevice](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/QairtDevice.md) [Next Topic
QairtProfile](https://docs.qualcomm.com/bundle/publicresource/80-63442-10/topics/QairtProfile.md)