Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create xrt bo using host memory #8425

Open
jasvinderkhurana opened this issue Sep 17, 2024 · 0 comments
Open

Failed to create xrt bo using host memory #8425

jasvinderkhurana opened this issue Sep 17, 2024 · 0 comments

Comments

@jasvinderkhurana
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant