From 1e5694e0828f97ce07a60d96e13ca838a664a883 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 12 May 2014 12:45:52 +0400 Subject: [PATCH 1/3] heuristic for Intel --- modules/core/src/ocl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index e3cfd8e7cd..ec0efe554a 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -4414,6 +4414,12 @@ int predictOptimalVectorWidth(InputArray src1, InputArray src2, InputArray src3, d.preferredVectorWidthShort(), d.preferredVectorWidthShort(), d.preferredVectorWidthInt(), d.preferredVectorWidthFloat(), d.preferredVectorWidthDouble(), -1 }, width = vectorWidths[depth]; + if (d.isIntel()) + { + // it's heuristic + int vectorWidthsIntel[] = { 16, 16, 8, 8, 1, 1, 1, -1 }; + width = vectorWidthsIntel[depth]; + } if (ssize.width * cn < width || width <= 0) return 1; From 1e46a99d9f4ec858afac8e1a75fba11aa22d70a6 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Fri, 16 May 2014 14:15:31 +0400 Subject: [PATCH 2/3] added performance test for cv::norm with NORM_RELATIVE --- modules/core/perf/opencl/perf_arithm.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/modules/core/perf/opencl/perf_arithm.cpp b/modules/core/perf/opencl/perf_arithm.cpp index 7e0e00edc4..58ca410a22 100644 --- a/modules/core/perf/opencl/perf_arithm.cpp +++ b/modules/core/perf/opencl/perf_arithm.cpp @@ -728,6 +728,26 @@ OCL_PERF_TEST_P(NormFixture, Norm, SANITY_CHECK(res, 1e-5, ERROR_RELATIVE); } +OCL_PERF_TEST_P(NormFixture, NormRel, + ::testing::Combine(OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3), + OCL_TEST_TYPES_134, NormType::all())) +{ + const NormParams params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + const int normType = get<2>(params); + + checkDeviceMaxMemoryAllocSize(srcSize, type); + + UMat src1(srcSize, type), src2(srcSize, type); + double res; + declare.in(src1, src2, WARMUP_RNG); + + OCL_TEST_CYCLE() res = cv::norm(src1, src2, normType | cv::NORM_RELATIVE); + + SANITY_CHECK(res, 1e-5, ERROR_RELATIVE); +} + ///////////// UMat::dot //////////////////////// typedef Size_MatType UMatDotFixture; From 0e1b37675ca56f18de9a92d4ab609a78e3d30070 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Wed, 21 May 2014 11:50:31 +0400 Subject: [PATCH 3/3] added performance test for cv::meanStdDev with mask --- modules/core/perf/opencl/perf_arithm.cpp | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/modules/core/perf/opencl/perf_arithm.cpp b/modules/core/perf/opencl/perf_arithm.cpp index 7e0e00edc4..c3385134e5 100644 --- a/modules/core/perf/opencl/perf_arithm.cpp +++ b/modules/core/perf/opencl/perf_arithm.cpp @@ -701,6 +701,36 @@ OCL_PERF_TEST_P(MeanStdDevFixture, MeanStdDev, SANITY_CHECK(stddev3, eps, ERROR_RELATIVE); } +OCL_PERF_TEST_P(MeanStdDevFixture, MeanStdDevWithMask, + ::testing::Combine(OCL_PERF_ENUM(OCL_SIZE_1, OCL_SIZE_2, OCL_SIZE_3), + OCL_TEST_TYPES_134)) +{ + const Size_MatType_t params = GetParam(); + const Size srcSize = get<0>(params); + const int type = get<1>(params); + const double eps = 2e-5; + + checkDeviceMaxMemoryAllocSize(srcSize, type); + + UMat src(srcSize, type), mask(srcSize, CV_8UC1); + Scalar mean, stddev; + declare.in(src, mask, WARMUP_RNG); + + OCL_TEST_CYCLE() cv::meanStdDev(src, mean, stddev, mask); + + double mean0 = mean[0], mean1 = mean[1], mean2 = mean[2], mean3 = mean[3]; + double stddev0 = stddev[0], stddev1 = stddev[1], stddev2 = stddev[2], stddev3 = stddev[3]; + + SANITY_CHECK(mean0, eps, ERROR_RELATIVE); + SANITY_CHECK(mean1, eps, ERROR_RELATIVE); + SANITY_CHECK(mean2, eps, ERROR_RELATIVE); + SANITY_CHECK(mean3, eps, ERROR_RELATIVE); + SANITY_CHECK(stddev0, eps, ERROR_RELATIVE); + SANITY_CHECK(stddev1, eps, ERROR_RELATIVE); + SANITY_CHECK(stddev2, eps, ERROR_RELATIVE); + SANITY_CHECK(stddev3, eps, ERROR_RELATIVE); +} + ///////////// Norm //////////////////////// CV_ENUM(NormType, NORM_INF, NORM_L1, NORM_L2)