MLIR-AIE
|
#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) |
This is the memory function to allocate a 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) |
This is the memory function to sync the memory for 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 35 of file memory_allocator_ion.cpp.
u64 mlir_aie_get_device_address | ( | aie_libxaie_ctx_t * | _xaie, |
void * | host_address | ||
) |
Return a device address corresponding to the given host address.
host_address | A host-side pointer returned from mlir_aie_mem_alloc |
Definition at line 256 of file memory_allocator_ion.cpp.
int * mlir_aie_mem_alloc | ( | struct aie_libxaie_ctx_t * | ctx, |
ext_mem_model_t & | handle, | ||
int | size | ||
) |
This is the memory function to allocate a memory.
Allocate a buffer in device memory.
handle | Device Instance |
size | Size of the memory |
Definition at line 45 of file memory_allocator_ion.cpp.
References ion_heap_query::cnt, aie_libxaie_ctx_t::DevInst, ion_allocation_data::fd, ext_mem_model_t::fd, ion_heap_data::heap_id, ion_allocation_data::heap_id_mask, ion_heap_query::heaps, ION_HEAP_TYPE_SYSTEM_CONTIG, ION_IOC_ALLOC, ION_IOC_HEAP_QUERY, ion_allocation_data::len, ext_mem_model_t::MemInst, ion_heap_data::name, ext_mem_model_t::size, ion_heap_data::type, and ext_mem_model_t::virtualAddr.
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.
IOInst | Linux IO instance pointer |
MemInst | Linux Memory instance pointer. |
MemInst | Memory instance pointer. |
MemInst | Memory instance pointer. |
Definition at line 213 of file memory_allocator_ion.cpp.
References ext_mem_model_t::fd.
void mlir_aie_sync_mem_dev | ( | ext_mem_model_t & | handle | ) |
This is the memory function to sync the memory for Device.
Synchronize the buffer from the host CPU to the device.
MemInst | Memory instance pointer. |
Definition at line 240 of file memory_allocator_ion.cpp.
References ext_mem_model_t::fd.