|
MLIR-AIE 1.4.5.dev
|
#include <errno.h>#include <fcntl.h>#include <limits.h>#include <linux/dma-buf.h>#include <pthread.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include <sys/ioctl.h>#include <sys/mman.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include "ion.h"#include "memory_allocator.h"Go to the source code of this file.
Macros | |
| #define | XAIE_128BIT_ALIGN_MASK 0xFF |
Functions | |
| int * | mlir_aie_mem_alloc (struct aie_libxaie_ctx_t *ctx, ext_mem_model_t &handle, int size) |
| Allocate a buffer in device memory. | |
| void | mlir_aie_sync_mem_cpu (ext_mem_model_t &handle) |
| This is function to attach the allocated memory descriptor to kernel driver. | |
| void | mlir_aie_sync_mem_dev (ext_mem_model_t &handle) |
| Synchronize the buffer from the host CPU to the device. | |
| u64 | mlir_aie_get_device_address (struct aie_libxaie_ctx_t *_xaie, void *VA) |
| Return a device address corresponding to the given host address. | |
| #define XAIE_128BIT_ALIGN_MASK 0xFF |
Definition at line 32 of file memory_allocator_ion.cpp.
| u64 mlir_aie_get_device_address | ( | aie_libxaie_ctx_t * | ctx, |
| void * | host_address ) |
Return a device address corresponding to the given host address.
| ctx | The AIE context |
| host_address | A host-side pointer returned from mlir_aie_mem_alloc |
Definition at line 225 of file memory_allocator_ion.cpp.
| int * mlir_aie_mem_alloc | ( | aie_libxaie_ctx_t * | ctx, |
| ext_mem_model_t & | handle, | ||
| int | size ) |
Allocate a buffer in device memory.
| ctx | The AIE context |
| handle | External memory model handle for tracking the allocation |
| size | The number of 32-bit words to allocate |
Definition at line 35 of file memory_allocator_ion.cpp.
References ext_mem_model_t::fd, ext_mem_model_t::MemInst, ext_mem_model_t::size, ext_mem_model_t::virtualAddr, and aie_libxaie_ctx_t::XAieDevInst.
| void mlir_aie_sync_mem_cpu | ( | ext_mem_model_t & | handle | ) |
This is function to attach the allocated memory descriptor to kernel driver.
Synchronize the buffer from the device to the host CPU.
@param IOInst: Linux IO instance pointer @param MemInst: Linux Memory instance pointer. @return XAIE_OK on success, Error code on failure. @note Internal only.
This is the memory function to free the memory
| MemInst | Memory instance pointer. |
Definition at line 193 of file memory_allocator_ion.cpp.
References ext_mem_model_t::fd.
| void mlir_aie_sync_mem_dev | ( | ext_mem_model_t & | handle | ) |
Synchronize the buffer from the host CPU to the device.
This is expected to be called after the host writes data into device memory, so that the data can be read by the device. In a non-cache coherent system, this implies flushing the processor cache associated with the buffer.
| handle | External memory model handle identifying the buffer to synchronize |
Definition at line 209 of file memory_allocator_ion.cpp.
References ext_mem_model_t::fd.