This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What's the best way to fill a buffer?

ARM Graphic expert:

     I have a cl_mem buffer, which will be reused every camera frame,  so it need reset to zero before we can use it.

     for opencl 1.2 we can use clEnqueueFillBuffer, for mali driver, what would be the most efficient way to fill the buffer?

     I have write a kernel and fill the buffer on gpu, but it turn out to be very slow, the kernel:

__kernel void set(__global int* dstptr)

{

    int y = get_global_id(0);

    __global int* dst = dstptr + y*ROW_WIDTH;

    for (int i=0; i<(ROW_WIDTH/4); i++) {

        *dst = 0;

        dst++;

    }  

}

     ROW_WIDTH is a compile time macro, which is set to prime number of the buffer size, for example, for the buffer size 1280*960,  it's 75.

     And it turn out to be very slow, why? and what's can be done?

Parents
  • Hi songmao,

    thank you very much for providing the information about your platform and Mali driver.

    In order to understand if the power management for the GPU affects the performance of your OpenCL kernel, you could try to execute it in a loop

    i.e.

    for(i = 0; i < N; ++i)

    {

        start timer

            exec opencl kernel

        stop timer (show timer)

    }

      

    If the execution time decreases with every iteration, it probably means that the power management for your GPU is enabled.

    Hope this can help your investigation,

    Once again many thanks,

    Gian Marco

Reply
  • Hi songmao,

    thank you very much for providing the information about your platform and Mali driver.

    In order to understand if the power management for the GPU affects the performance of your OpenCL kernel, you could try to execute it in a loop

    i.e.

    for(i = 0; i < N; ++i)

    {

        start timer

            exec opencl kernel

        stop timer (show timer)

    }

      

    If the execution time decreases with every iteration, it probably means that the power management for your GPU is enabled.

    Hope this can help your investigation,

    Once again many thanks,

    Gian Marco

Children
No data