I’ve created an image preprocessing pipeline using custon cuda kernels. For image Rescale, I’ve decided to use VPI library.
I recieve a GPU pointer from my previous image preprocessing module and I want to have zero copy. I came to know that in order to pass GPU pointer we need to create a wrapper around our image using vpiImageCreateWrapper. (link to discussion).
But the issue is that this create wrapper call is taking around 5-7 ms. I came along this discussion where they were discussing the performance issue of vpiImageCreateWrapper call. According to the dicussion, this calls takes around 5-7 ms unless we use pinned memory. And the final suggesstion was to use cuda backend while creating wrapper or use VPI 2.x rather than VPI 1.x.
I’ve tried using pinned memory plus cuda backend but both are not wroking and I’m still getting 5-7 ms latency while creating the wrapper.
CHECK_CUDA(cudaMallocHost((void**)&inputData, sizeof(VPIImageData)));
...
...
memset(inputData, 0, sizeof(VPIImageData));
inputData->bufferType = VPI_IMAGE_BUFFER_CUDA_PITCH_LINEAR;
inputData->buffer.pitch.format = VPI_IMAGE_FORMAT_RGB8;
inputData->buffer.pitch.numPlanes = 1;
inputData->buffer.pitch.planes[0].pitchBytes = prev_width * 3;
inputData->buffer.pitch.planes[0].width = prev_width;
inputData->buffer.pitch.planes[0].height = prev_height;
...
...
CHECK_VPI(vpiImageCreateWrapper(inputData, nullptr, VPI_BACKEND_CUDA, &vpiInput));
CHECK_VPI(vpiSubmitRescale(stream, VPI_BACKEND_CUDA, vpiInput, vpiOutput, VPI_INTERP_LINEAR, VPI_BORDER_ZERO, 0));
CHECK_VPI(vpiStreamSync(stream));
Here are my board specs:
- Model: NVIDIA Jetson Orin NX Engineering Reference Developer Kit Super
- L4T: 36.4.7
NV Power Mode[0]: MAXN_SUPER
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware: - P-Number: p3767-0000
- Module: NVIDIA Jetson Orin NX (16GB ram)
Platform: - Distribution: Ubuntu 22.04 Jammy Jellyfish
- Release: 5.15.148-tegra
Libraries: - CUDA: 12.6.85
- cuDNN: 9.19.1.2
- TensorRT: 10.7.0.23
- VPI: 3.2.4