mirror of
https://github.com/opencv/opencv.git
synced 2026-07-27 22:33:03 +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.