VPI 3.2 Image Wrapper Performance Problems when using CudaMallocManaged

Hello, similar to Performance issues using vpiImageCreate*Wrapper

I have performance problems when using the following code

                        VPIImage img;
                        VPIImageData data = {};
                        data.bufferType = VPI_IMAGE_BUFFER_CUDA_PITCH_LINEAR;
                        data.buffer.pitch.numPlanes = 1;
                        data.buffer.pitch.format = VPI_IMAGE_FORMAT_U8;
                        data.buffer.pitch.planes[0].width  = mvImagePyramid[level]->getWidth();
                        data.buffer.pitch.planes[0].height = mvImagePyramid[level]->getHeight();
                        data.buffer.pitch.planes[0].data   = mvImagePyramid[level]->getRaw(); // get ptr allocated by CudaMallocManaged
                        data.buffer.pitch.planes[0].pitchBytes = mvImagePyramid[level]->getStep();
                        //data.buffer.pitch.planes[0].pixelType = VPI_PIXEL_TYPE_DEFAULT;

                        vpiImageCreateWrapper(&data, nullptr, 0, &img);

I just wanted to ask if there is anything else I can do/if this is a problem/ if you are aware of this problem?

Best,
Marc

Hi,

Would you mind sharing more info about your issues?

Do you meet the performance issues for the wrapper?
Or an VPI algorithm? If so, could you share a sample cod so we can check?

Thanks

The wrapper seems to be slower than expect. Granted: I double checked and I was running this in a very hot path. But I would like to know: Does the Wrapper do any memory allocations/check any memory region?

Ill try to generate a better example

Hi,

A sample will help us to understand your question.

As VPI supports various backends, it’s possible to have some internal memory allocation/movement.
But if the buffer won’t be destroyed during the pipeline, you can do the wrap and unwrap just in the beginning and terminated.

Thanks.

Up to this point I didnt set backend yet. All the VPI code is as you see. But I think we will use a cuda kernel solution instead of VPI

Hi

Setting the flags to 0 indicates the image can be accessed via all possible backends.

vpiImageCreateWrapper

So the wrapper will automatically trigger some mechanism (ex. prepare buffer for different backends).

Thanks.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.