In the documentation for the XRT native APIs, under section ii Data Transfer Between Host and Device by Buffer Map API, there appears to be a typo:
The API xrt::bo::map() allows mapping the host-side buffer backing pointer to a user pointer. The host code can subsequently exercise the user pointer for the data reads and writes. However, after writing to the mapped pointer (or before reading from the mapped pointer) the API xrt::bo::sync() should be used with direction flag for the DMA operation.
It seems to me that the host-side buffer backing pointer and the user pointer are the same thing, and from the given code example that follows, it appears that what is really meant is a device-side buffer backing pointer and the user pointer:
auto input_buffer = xrt::bo(device, buffer_size_in_bytes, bank_grp_idx_0);
auto input_buffer_mapped = input_buffer.map<int*>();
for (auto i=0;i<data_size;++i) {
input_buffer_mapped[i] = i;
}
input_buffer.sync(XCL_BO_SYNC_BO_TO_DEVICE);
If I misunderstood what's happening, I would love some insight!
In the documentation for the XRT native APIs, under section ii Data Transfer Between Host and Device by Buffer Map API, there appears to be a typo:
It seems to me that the
host-side buffer backing pointerand theuser pointerare the same thing, and from the given code example that follows, it appears that what is really meant is adevice-side buffer backing pointerand theuser pointer:If I misunderstood what's happening, I would love some insight!