Hello,
I’m getting an error from compute-sanitizer when using cuvid decoder :
nvcc --version : release 12.6, V12.6.77
Using latest video codec SDK : Video_Codec_SDK_12.2.72
========= COMPUTE-SANITIZER
========= Program hit CUDA_ERROR_INVALID_VALUE (error 1) due to “invalid argument” on CUDA API call to cuArrayGetPlane.
========= Saved host backtrace up to driver entry point at error
========= Host Frame: [0x27fc24]
========= in /lib/x86_64-linux-gnu/libcuda.so.1
========= Host Frame: [0x2a45a]
========= in /lib/x86_64-linux-gnu/libnvcuvid.so.1
========= Host Frame: [0x25621]
========= in /lib/x86_64-linux-gnu/libnvcuvid.so.1
========= Host Frame: [0x30006]
========= in /lib/x86_64-linux-gnu/libnvcuvid.so.1
========= Host Frame: [0x33c60]
========= in /lib/x86_64-linux-gnu/libnvcuvid.so.1
========= Host Frame: [0x2ede9]
========= in /lib/x86_64-linux-gnu/libnvcuvid.so.1
========= Host Frame: [0x2de50]
========= in /lib/x86_64-linux-gnu/libnvcuvid.so.1
========= Host Frame:main [0x148a]
========= in /home/gabriel/dev/sources/test_cuvid/build/./cuvid_example
========= Host Frame:__libc_start_call_main in …/sysdeps/nptl/libc_start_call_main.h:58 [0x2a1c9]
========= in /lib/x86_64-linux-gnu/libc.so.6
========= Host Frame:__libc_start_main in …/csu/libc-start.c:360 [0x2a28a]
========= in /lib/x86_64-linux-gnu/libc.so.6
========= Host Frame:_start [0x1224]
========= in /home/gabriel/dev/sources/test_cuvid/build/./cuvid_example
I created a minimal example to reproduce the error :
#include <cuda.h>
#include "NvCodec/NvDecoder/NvDecoder.h"
#include <iostream>
#ifdef __cuda_cuda_h__
#ifndef CUDA_CHECK
#define CUDA_CHECK(err) __checkCudaErrors(err, __FILE__, __LINE__)
inline void __checkCudaErrors(CUresult err, const char *file, const int line) {
if (CUDA_SUCCESS != err) {
const char *errorStr = NULL;
cuGetErrorString(err, &errorStr);
fprintf(stderr,
"checkCudaErrors() Driver API error = %04d \"%s\" from file <%s>, "
"line %i.\n",
err, errorStr, file, line);
exit(EXIT_FAILURE);
}
}
#endif // CUDA_CHECK
#endif // __cuda_cuda_h__
int main() {
CUDA_CHECK(cuInit(0));
CUdevice device;
CUDA_CHECK(cuDeviceGet(&device, 0));
CUcontext ctx;
CUDA_CHECK(cuCtxCreate(&ctx, 0, device));
CUvideoctxlock ctx_lock;
CUDA_CHECK(cuvidCtxLockCreate(&ctx_lock, ctx));
CUvideodecoder decoder;
CUVIDDECODECREATEINFO videoDecodeCreateInfo = { 0 };
videoDecodeCreateInfo.CodecType = cudaVideoCodec_H264;
videoDecodeCreateInfo.ChromaFormat = cudaVideoChromaFormat_420;
videoDecodeCreateInfo.OutputFormat = cudaVideoSurfaceFormat_NV12;
videoDecodeCreateInfo.bitDepthMinus8 = 0;
videoDecodeCreateInfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Weave;
videoDecodeCreateInfo.ulNumOutputSurfaces = 2;
videoDecodeCreateInfo.ulCreationFlags = cudaVideoCreate_PreferCUVID;
videoDecodeCreateInfo.ulNumDecodeSurfaces = 20;
videoDecodeCreateInfo.vidLock = ctx_lock;
videoDecodeCreateInfo.ulWidth = 2560;
videoDecodeCreateInfo.ulHeight = 720;
videoDecodeCreateInfo.ulTargetWidth = 2560;
videoDecodeCreateInfo.ulTargetHeight = 720;
CUDA_CHECK(cuCtxPushCurrent(ctx));
// error here with compute-sanitizer
CUDA_CHECK(cuvidCreateDecoder(&decoder, &videoDecodeCreateInfo));
CUDA_CHECK(cuCtxPopCurrent(NULL));
CUDA_CHECK(cuvidDestroyDecoder(decoder));
CUDA_CHECK(cuCtxDestroy(ctx));
CUDA_CHECK(cuvidCtxLockDestroy(ctx_lock));
}
The following command is reporting errors :
compute-sanitizer --leak-check full --print-level error ./cuvid_example