From 7ed9c0e87a99eb32a1830ffb8b2a78028b72643e Mon Sep 17 00:00:00 2001 From: yao Date: Thu, 30 May 2013 14:57:15 +0800 Subject: [PATCH] Fix brute_force_matcher's hung on some Intel CPU OCL --- modules/ocl/src/brute_force_matcher.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/ocl/src/brute_force_matcher.cpp b/modules/ocl/src/brute_force_matcher.cpp index c12fa73..74da6dd 100644 --- a/modules/ocl/src/brute_force_matcher.cpp +++ b/modules/ocl/src/brute_force_matcher.cpp @@ -245,11 +245,12 @@ static void matchDispatcher(const oclMat &query, const oclMat &train, const oclM { const oclMat zeroMask; const oclMat &tempMask = mask.data ? mask : zeroMask; + bool is_cpu = queryDeviceInfo(); if (query.cols <= 64) { matchUnrolledCached<16, 64>(query, train, tempMask, trainIdx, distance, distType); } - else if (query.cols <= 128) + else if (query.cols <= 128 && !is_cpu) { matchUnrolledCached<16, 128>(query, train, tempMask, trainIdx, distance, distType); } @@ -264,11 +265,12 @@ static void matchDispatcher(const oclMat &query, const oclMat *trains, int n, co { const oclMat zeroMask; const oclMat &tempMask = mask.data ? mask : zeroMask; + bool is_cpu = queryDeviceInfo(); if (query.cols <= 64) { matchUnrolledCached<16, 64>(query, trains, n, tempMask, trainIdx, imgIdx, distance, distType); } - else if (query.cols <= 128) + else if (query.cols <= 128 && !is_cpu) { matchUnrolledCached<16, 128>(query, trains, n, tempMask, trainIdx, imgIdx, distance, distType); } @@ -284,11 +286,12 @@ static void matchDispatcher(const oclMat &query, const oclMat &train, float maxD { const oclMat zeroMask; const oclMat &tempMask = mask.data ? mask : zeroMask; + bool is_cpu = queryDeviceInfo(); if (query.cols <= 64) { matchUnrolledCached<16, 64>(query, train, maxDistance, tempMask, trainIdx, distance, nMatches, distType); } - else if (query.cols <= 128) + else if (query.cols <= 128 && !is_cpu) { matchUnrolledCached<16, 128>(query, train, maxDistance, tempMask, trainIdx, distance, nMatches, distType); } @@ -466,11 +469,12 @@ static void calcDistanceDispatcher(const oclMat &query, const oclMat &train, con static void match2Dispatcher(const oclMat &query, const oclMat &train, const oclMat &mask, const oclMat &trainIdx, const oclMat &distance, int distType) { + bool is_cpu = queryDeviceInfo(); if (query.cols <= 64) { knn_matchUnrolledCached<16, 64>(query, train, mask, trainIdx, distance, distType); } - else if (query.cols <= 128) + else if (query.cols <= 128 && !is_cpu) { knn_matchUnrolledCached<16, 128>(query, train, mask, trainIdx, distance, distType); } -- 2.7.4