Host Memory Simple¶
This is simple host memory example to describe how a user kernel can access the host memory. The host memory allocation is done through the host code. The kernel reads data from host memory and writes result to host memory.
KEY CONCEPTS: host memory, address translation unit
KEYWORDS: XCL_MEM_EXT_HOST_ONLY, HOST
Host Memory IP is used by the kernels to read and write data directly from/to the Host Memory. Unlike the XDMA data transfer, this data transfer mechanism does not utlize global memories (DDR, HBM, PLRAM ,etc) on the card. Host-memory provides DMA bypass capability that is primarily used for data transfer on a No-DMA platform.
Use the following V++ configuration option to connect a kernel AXI-Master Port to Host-memory IP.
Host code Guidelines¶
XRT OpenCL introduces a new buffer extension Flag
XCL_MEM_EXT_HOST_ONLY that should be used to denote a Host-only buffer
cl_mem_ext_ptr_t host_buffer_ext; host_buffer_ext.flags = XCL_MEM_EXT_HOST_ONLY; host_buffer_ext.obj = nullptr; host_buffer_ext.param = 0; OCL_CHECK(err, cl::Buffer buffer_in_a(context, CL_MEM_READ_ONLY | CL_MEM_EXT_PTR_XILINX, size_in_bytes, &host_buffer_ext, &err));
Platforms containing following strings in their names are not supported for this example :
_u25_ u30 u50lv u50_gen3x4 zc vck aws-vu9p-f1 2019 2018 samsung _u2_
Application code is located in the src directory. Accelerator binary files will be compiled to the xclbin directory. The xclbin directory is required by the Makefile and its contents will be filled during compilation. A listing of all the files in this example is shown below
Access these files in the github repo by clicking here.
COMMAND LINE ARGUMENTS¶
Once the environment has been configured, the application can be executed by
./host_memory_simple.exe <krnl_vadd XCLBIN>