18void ess_WriteGM(uint64_t addr,
const void *data, uint64_t size);
19void ess_ReadGM(uint64_t addr,
void *data, uint64_t size);
24 int size_bytes = size *
sizeof(int);
27 handle.
size = size_bytes;
31 nextAlignedAddr = nextAlignedAddr + size_bytes;
32 uint64_t gapToAligned = nextAlignedAddr % 16;
34 nextAlignedAddr += (16 - gapToAligned);
36 printf(
"ExtMemModel: Failed to allocate %d memory.\n", size_bytes);
41 std::cout <<
"ExtMemModel constructor: " << ctx <<
" virtual address "
42 << std::hex << handle.
virtualAddr <<
", physical address "
57 std::cout <<
"get_device_address: " << ctx <<
" VA " << std::hex << VA
60 std::cout <<
"get_device_address: virtual address " << std::hex
61 << i.virtualAddr <<
", physical address " << i.physicalAddr
62 <<
", size " << std::dec << i.size << std::endl;
64 if (i.virtualAddr == VA)
65 return i.physicalAddr;
67 printf(
"ERROR: cannot get device address for allocation!\n");
void ess_ReadGM(uint64_t addr, void *data, uint64_t size)
u64 mlir_aie_get_device_address(aie_libxaie_ctx_t *ctx, void *VA)
Return a device address corresponding to the given host address.
void mlir_aie_sync_mem_dev(ext_mem_model_t &handle)
Synchronize the buffer from the host CPU to the device.
void ess_WriteGM(uint64_t addr, const void *data, uint64_t size)
void mlir_aie_sync_mem_cpu(ext_mem_model_t &handle)
Synchronize the buffer from the device to the host CPU.
int * mlir_aie_mem_alloc(aie_libxaie_ctx_t *ctx, ext_mem_model_t &handle, int size)
Allocate a buffer in device memory.
std::list< ext_mem_model_t > allocations