Function Description
Creates shared memory during verification of the CPU-side operation of the kernel function. That is, creates a shared file in the /tmp directory and returns the mapping pointer to the file.
Function Prototype
void *GmAlloc(size_t size)
Parameters
| Parameter | Input/Output | Description |
| size | Input | Size of the shared memory to be allocated. |
Return Value
Returns a void* pointer, which indicates the start address of the shared memory space.
Supported Models
Kirin 9020 series processors
Kirin 9030 series processors
Kirin X90 series processors
Restrictions
This API generates a temporary file in the system /tmp directory. Therefore, the shared memory can be properly generated only when the drive space is sufficient.
Calling Example
constexpr int32_t len = 8 * 32 * 1024 * 8;
half* x = (half*) GmAlloc(len*sizeof(half));