To transfer the data through p2p the following steps are needed
Enable the p2p of the source device
Declare the source buffer
out1
as P2P buffer
Step 1: Enabling p2p of the device
sudo /opt/xilinx/xrt/bin/xbutil configure --device 0000:65:00.1 --p2p enable
After the warm reboot (sudo reboot now
) check the p2p enablement status through xbutil examine
xbutil examine -d 0000:65:00.1 -r platform
----------------------------------------------------
1/1 [0000:65:00.1] : xilinx_u50_gen3x16_xdma_base_5
----------------------------------------------------
Platform
...
...
P2P Status : enabled
Step 2: P2P version of the host-code inspection
The final p2p version of the host code is host_p2p.cpp
. There are only two differences
Output buffer of the source device is declared as p2p buffer
auto out1 = xrt::bo(device1, vector_size_bytes, xrt::bo::flags::p2p, krnl.group_id(1));
Output buffer synchronization of the source device is commented out
out1.sync(XCL_BO_SYNC_BO_FROM_DEVICE)
for (int i = 0; i < loop; i++) {
//out1.sync(XCL_BO_SYNC_BO_FROM_DEVICE);
in2.sync(XCL_BO_SYNC_BO_TO_DEVICE);
}