XRT
XRT copied to clipboard
Failed to create xrt bo using host memory
I am trying to create a xrt buffer object using host memory and it is failing with error as "bad alloc". Can someone please guide what is the issue.
Host code:
// Allocate buffer based on the image size
size_t buffer_size = 1280 * 720; // Adjust the size based on your actual image
void* buffer_left;
posix_memalign(&buffer_left,4096, buffer_size);
// unsigned char* buffer_left = (unsigned char*)malloc(buffer_size);
if (load_png_to_memory(filename, (unsigned char*)buffer_left, buffer_size, &width, &height, &color_type) != 0) {
printf("Error loading PNG to memory\n");
free(buffer_left);
return -1;
}
auto device = xrt::device(0);
auto uuid = device.load_xclbin("stereolbm_accel.xclbin");
auto stereo_accel = xrt::kernel(device, uuid.get(), "stereolbm_accel");
try{
auto m_buffer = xrt::bo (device, buffer_left, buffer_size, stereo_accel.group_id(3));
}
catch (std::exception &e) {
LOG (FATAL) << "Unable to create Buffer: " << e.what();
}
The error I am getting is:
XRT build version: 2.13.0
Build hash:
Build date: 2022-09-15 17:01:20
Git branch:
PID: 113057
UID: 1000
[Tue Sep 17 09:53:46 2024 GMT]
HOST:
EXE: /home/ubuntu/Vitis_Vision_XRT_Flow/stereolbm/stereolbm_accel_xrt
[XRT] WARNING: The xrt.ini flag "data_transfer_trace" is deprecated and will be removed in a future release. Please use the equivalent flag "device_trace."
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0917 09:53:47.083050 113057 xf_stereolbm_tb.cpp:205] Unable to create Buffer: std::bad_alloc
*** Check failure stack trace: ***
Aborted (core dumped)