-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
DNN: Invalid memory access in Int8 code #20799
Copy link
Copy link
Closed
Milestone
Description
Problem is introduced by #20228
Valgrind build report:
[ RUN ] Test_Int8_layers.Convolution2D/0, where GetParam() = OCV/CPU
==15338== Invalid read of size 4
==15338== at 0x4FA8AC1: cv::dnn::ConvolutionLayerInt8Impl::ParallelConv::operator()(cv::Range const&) const (convolution_layer.cpp:954)
==15338== by 0x6529CFC: cv::(anonymous namespace)::ParallelLoopBodyWrapper::operator()(cv::Range const&) const (parallel.cpp:338)
==15338== by 0x6540AFE: execute (parallel_impl.cpp:328)
==15338== by 0x6540AFE: cv::ThreadPool::run(cv::Range const&, cv::ParallelLoopBody const&, double) (parallel_impl.cpp:638)
==15338== by 0x6540E98: cv::parallel_for_pthreads(cv::Range const&, cv::ParallelLoopBody const&, double) (parallel_impl.cpp:741)
==15338== by 0x652A2BD: parallel_for_impl (parallel.cpp:595)
==15338== by 0x652A2BD: cv::parallel_for_(cv::Range const&, cv::ParallelLoopBody const&, double) (parallel.cpp:506)
==15338== by 0x4FA5066: cv::dnn::ConvolutionLayerInt8Impl::ParallelConv::run(cv::Mat const&, cv::Mat&, cv::Mat const&, cv::Mat const&, std::vector<int, std::allocator<int> > const&, cv::Mat const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, std::vector<unsigned long, std::allocator<unsigned long> > const&, cv::dnn::dnn4_v20210608::ActivationLayerInt8 const*, int, int, int, int) (convolution_layer.cpp:428)
==15338== by 0x4FA5714: cv::dnn::ConvolutionLayerInt8Impl::forward(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&) (convolution_layer.cpp:1104)
==15338== by 0x4F7EBAD: cv::dnn::dnn4_v20210608::Net::Impl::forwardLayer(cv::dnn::dnn4_v20210608::LayerData&) (dnn.cpp:3293)
==15338== by 0x4F7F9EB: cv::dnn::dnn4_v20210608::Net::Impl::forwardToLayer(cv::dnn::dnn4_v20210608::LayerData&, bool) (dnn.cpp:3438)
==15338== by 0x4F938B9: cv::dnn::dnn4_v20210608::Net::forward(cv::_OutputArray const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (dnn.cpp:4170)
==15338== by 0x20DD63: opencv_test::(anonymous namespace)::Test_Int8_layers::testLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, double, int, int, bool, bool, bool) (test_int8_layers.cpp:80)
==15338== by 0x21E07A: opencv_test::(anonymous namespace)::Test_Int8_layers_Convolution2D_Test::Body() (test_int8_layers.cpp:101)
==15338== Address 0x1bfae38c is 0 bytes after a block of size 12 alloc'd
==15338== at 0x4C33E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15338== by 0x4C33F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15338== by 0x63DE4F9: cv::fastMalloc(unsigned long) (alloc.cpp:137)
==15338== by 0x64C8F76: cv::StdMatAllocator::allocate(int, int const*, int, void*, unsigned long*, cv::AccessFlag, cv::UMatUsageFlags) const (matrix.cpp:147)
==15338== by 0x64CC537: cv::Mat::create(int, int const*, int) (matrix.cpp:705)
==15338== by 0x64CD19C: cv::Mat::create(int, int, int) (matrix.cpp:537)
==15338== by 0x64CD243: cv::Mat::Mat(int, int, int) (matrix.cpp:349)
==15338== by 0x4FE0EED: cv::dnn::ConvolutionLayerImpl::tryQuantize(std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > const&, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, cv::dnn::dnn4_v20210608::LayerParams&) (convolution_layer.cpp:2101)
==15338== by 0x4F967D6: cv::dnn::dnn4_v20210608::Net::quantize(cv::_InputArray const&, int, int) (dnn.cpp:4451)
==15338== by 0x20DA56: opencv_test::(anonymous namespace)::Test_Int8_layers::testLayer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double, double, int, int, bool, bool, bool) (test_int8_layers.cpp:68)
==15338== by 0x21E07A: opencv_test::(anonymous namespace)::Test_Int8_layers_Convolution2D_Test::Body() (test_int8_layers.cpp:101)
==15338== by 0x206BC9: opencv_test::(anonymous namespace)::Test_Int8_layers_Convolution2D_Test::TestBody() (test_int8_layers.cpp:98)
Reactions are currently unavailable