Intel® FPGA SDK for OpenCL™ Pro Edition: Custom Platform Toolkit User Guide

ID 683085
Date 3/28/2022
Public
Document Table of Contents

2.3.22. aocl_mmd_device_alloc

Allocate memory that is owned by the device. This pointer can only be accessed by the kernel. It cannot be accessed by the host. The host is able to manipulate the pointer (for example, increment it) and not just access the underlying data. This memory must be deallocated by the aocl_mmd_free() function.

Syntax

void * aocl_mmd_device_alloc (int handle,
                              size_t size,
                              size_t alignment,
                              aocl_mmd_mem_properties_t *properties,
                              int* error);

Function Arguments

  • handle—Device that has access to this memory.
  • size—The size of the memory region.
  • alignment—The alignment (in bytes) of the memory region.
  • properties—Specifies additional information about the allocated memory, described by a property type name and its corresponding value. Each property type name is immediately followed by the corresponding desired value. The list is terminated with a zero. Supported values are described above. For example, [<property1>, <value1>, <property2>, <value2>, 0]

Return Values

Returns one of the following error code:

  • AOCL_MMD_ERROR_SUCCESS—No error occurred
  • AOCL_MMD_ERROR_INVALID_HANDLE—The device handle provided is invalid.
  • AOCL_MMD_ERROR_OUT_OF_MEMORY—Ran out of memory.
  • AOCL_MMD_ERROR_UNSUPPORTED_ALIGNMENT—The device does not support the provided alignment.
  • AOCL_MMD_ERROR_UNSUPPORTED_PROPERTY—The device does not support the provided property.