From: Alexander Karsakov Date: Tue, 12 Aug 2014 14:02:29 +0000 (+0400) Subject: Set minimum matrix size for AmdBlas::gemm to 20 since it works incorrect for small... X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3029^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=713ddb89bd0061094017cc63eed4b85259349855;p=platform%2Fupstream%2Fopencv.git Set minimum matrix size for AmdBlas::gemm to 20 since it works incorrect for small sizes --- diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp index 99711e2..5f5e438 100644 --- a/modules/core/src/matmul.cpp +++ b/modules/core/src/matmul.cpp @@ -781,8 +781,9 @@ void cv::gemm( InputArray matA, InputArray matB, double alpha, InputArray matC, double beta, OutputArray _matD, int flags ) { #ifdef HAVE_CLAMDBLAS - CV_OCL_RUN(ocl::haveAmdBlas() && matA.dims() <= 2 && matB.dims() <= 2 && matC.dims() <= 2 && _matD.isUMat(), - ocl_gemm(matA, matB, alpha, matC, beta, _matD, flags)) + CV_OCL_RUN(ocl::haveAmdBlas() && matA.dims() <= 2 && matB.dims() <= 2 && matC.dims() <= 2 && _matD.isUMat() && + matA.cols() > 20 && matA.rows() > 20 && matB.cols() > 20, // since it works incorrect for small sizes + ocl_gemm(matA, matB, alpha, matC, beta, _matD, flags)) #endif const int block_lin_size = 128; diff --git a/modules/core/test/ocl/test_gemm.cpp b/modules/core/test/ocl/test_gemm.cpp index e98135a..493b6cd 100644 --- a/modules/core/test/ocl/test_gemm.cpp +++ b/modules/core/test/ocl/test_gemm.cpp @@ -90,14 +90,15 @@ PARAM_TEST_CASE(Gemm, void generateTestData() { - Size ARoiSize = randomSize(1, MAX_VALUE); + // set minimum size to 20, since testing less sizes doesn't make sense + Size ARoiSize = randomSize(20, MAX_VALUE); Border ABorder = randomBorder(0, use_roi ? MAX_VALUE : 0); randomSubMat(A, A_roi, ARoiSize, ABorder, type, -11, 11); if (atrans) ARoiSize = Size(ARoiSize.height, ARoiSize.width); - Size BRoiSize = randomSize(1, MAX_VALUE); + Size BRoiSize = randomSize(20, MAX_VALUE); if (btrans) BRoiSize.width = ARoiSize.width; else