mirror of
https://github.com/opencv/opencv.git
synced 2026-07-25 21:33:04 +04:00
84d900cfda
Vectorize the per-sample squared-Euclidean distance in BruteForceImpl::findNearestCore with universal intrinsics (two independent v_fma accumulators + scalar tail). The scalar reduction accumulates in float in strict order, which the compiler cannot auto-vectorize without -ffast-math; independent SIMD accumulators break that serial-accumulation dependency. Accumulates in float exactly as before (only summation order changes, ~1e-7, below stored float precision); selected neighbors and distances matched scalar on all test data, ML_KNearest tests pass. Real findNearest A/B: 3.76x M4, 3.47x Threadripper, 3.73x Xeon, 4.10x A76, 2.82x A55 (in-order). Adds modules/ml/perf with a findNearest perf test.
7 lines
245 B
C++
7 lines
245 B
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
#include "perf_precomp.hpp"
|
|
|
|
CV_PERF_TEST_MAIN(ml)
|