From 105af84ca26c1d9af730cc691c8eca1ca4e4580b Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Mon, 10 Jan 2022 15:17:59 +0100 Subject: [PATCH 1/2] Add an upper bound for the video decoder workaround - there is a bug when decoding video on non-default stream in selected driver leading to memory corruption. This PR adds a check for the last driver version that needs the workaround Signed-off-by: Janusz Lisiecki --- dali/operators/reader/nvdecoder/nvdecoder.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dali/operators/reader/nvdecoder/nvdecoder.cc b/dali/operators/reader/nvdecoder/nvdecoder.cc index 20757076d4a..2c9b9bcafef 100644 --- a/dali/operators/reader/nvdecoder/nvdecoder.cc +++ b/dali/operators/reader/nvdecoder/nvdecoder.cc @@ -59,22 +59,21 @@ NvDecoder::NvDecoder(int device_id, "Check your library paths and if NVIDIA driver is installed correctly."); - // This is a workaround for an issue with nvcuvid in drivers >460 where concurrent + // This is a workaround for an issue with nvcuvid in drivers >460 and <= 470.21 where concurrent // use on default context and non-default streams may lead to memory corruption. - // TODO(michalz): add an upper bound when the problem is fixed bool use_default_stream = false; #if NVML_ENABLED { nvml::Init(); static float driver_version = nvml::GetDriverVersion(); - if (driver_version > 460) + if (driver_version > 460 && driver_version <= 470.21) use_default_stream = true; } #else { int driver_cuda_version = 0; CUDA_CALL(cuDriverGetVersion(&driver_cuda_version)); - if (driver_cuda_version >= 11030) + if (driver_cuda_version >= 11030 && driver_cuda_version < 11040) use_default_stream = true; } #endif From de215de00560d44f7234627263ae1ac53214b9be Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki Date: Tue, 11 Jan 2022 12:04:24 +0100 Subject: [PATCH 2/2] Review fix Signed-off-by: Janusz Lisiecki --- dali/operators/reader/nvdecoder/nvdecoder.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dali/operators/reader/nvdecoder/nvdecoder.cc b/dali/operators/reader/nvdecoder/nvdecoder.cc index 2c9b9bcafef..ee5a94c865f 100644 --- a/dali/operators/reader/nvdecoder/nvdecoder.cc +++ b/dali/operators/reader/nvdecoder/nvdecoder.cc @@ -59,14 +59,14 @@ NvDecoder::NvDecoder(int device_id, "Check your library paths and if NVIDIA driver is installed correctly."); - // This is a workaround for an issue with nvcuvid in drivers >460 and <= 470.21 where concurrent + // This is a workaround for an issue with nvcuvid in drivers >460 and < 470.21 where concurrent // use on default context and non-default streams may lead to memory corruption. bool use_default_stream = false; #if NVML_ENABLED { nvml::Init(); static float driver_version = nvml::GetDriverVersion(); - if (driver_version > 460 && driver_version <= 470.21) + if (driver_version > 460 && driver_version < 470.21) use_default_stream = true; } #else