19 int size_bytes = size *
sizeof(int);
22 handle.
size = size_bytes;
26 nextAlignedAddr = nextAlignedAddr + size_bytes;
27 uint64_t gapToAligned = nextAlignedAddr % 16;
29 nextAlignedAddr += (16 - gapToAligned);
31 printf(
"ExtMemModel: Failed to allocate %d memory.\n", size_bytes);
36 std::cout <<
"ExtMemModel constructor: " << _xaie <<
" virtual address "
37 << std::hex << handle.
virtualAddr <<
", physical address "
52 std::cout <<
"get_device_address: " << _xaie <<
" VA " << std::hex << VA
55 std::cout <<
"get_device_address: virtual address " << std::hex
56 << i.virtualAddr <<
", physical address " << i.physicalAddr
57 <<
", size " << std::dec << i.size << std::endl;
59 if (i.virtualAddr == VA)
60 return i.physicalAddr;
62 printf(
"ERROR: cannot get device address for allocation!\n");
u64 mlir_aie_get_device_address(aie_libxaie_ctx_t *_xaie, 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.
int * mlir_aie_mem_alloc(aie_libxaie_ctx_t *_xaie, ext_mem_model_t &handle, int size)
Allocate a buffer in device memory.
void mlir_aie_sync_mem_cpu(ext_mem_model_t &handle)
Synchronize the buffer from the device to the host CPU.
std::list< ext_mem_model_t > allocations