Closed Heng-Zhou closed 1 year ago
Hi, Have you run it with vector_size_bytes? It seems that the test is only getting about a quarter of the way through the results before returning test passed. I don't think we redefined memcmp.
@randyh62 I run the vadd sample code with
vector_size_bytes
under three configurations: software emulation, hardware emulation and hardware, and the code all returns successfully withTEST PASSED
output. My hardware is Alveo U280 and I adapted the given tutorial to it, which is still based on XRT runtime, not OpenCL runtime. So, if there is no other problem, I thinkDATA_SIZE
is incorrect on line 74 of host.cpp which only performs 1/4 of the comparison. So, we should replace it withvector_size_bytes
.
Hi @randyh62 , I think @Heng-Zhou is correct.
DATA_SIZE
is per int.
vector_size_bytes
is per byte.
When doing memcmp
, we can use vector_size_bytes
or sizeof(bufReference)
.
fixed by 22a3dcc
The source code host.cpp for the host program of Vitis getting started tutorial calls
std::memcmp
on line 74:if (std::memcmp(bo2_map, bufReference, DATA_SIZE))
Here the third argument is
DATA_SIZE
which is the number of data items. But the C++ standard specifies that this argument should be the number of bytes to be compared (here):If we conform to the C++ standard, the third argument should be variable
vector_size_bytes
which is the number of bytes of the memory. So I was wondering whether it is a bug, or Xilinx redefined the meaning of the third parameter ofstd::memcmp
function.