Move GSF KL distance to using vec.h Minor additions to vec.h
This is the reason for / follow up to !35341 (merged)
So let me mention @ssnyder and @amorley
KLGaussianMixtureReduction changes
-
The major change is to move the code in
KLGaussianMixtureReduction.cxx
from using directly x86-64 intrinsics to compiler (gcc/clang) vector types (e.g look https://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors) as provided by the wrappers in vec.h e.g thevec
type and the relevant methods. -
It seems that the code becomes indeed a bit more readable if we avoid the
_mm
. But this is also for the reviewers to judge. -
My benchmarks so far indicate same performance (as should be)
vec changes
-
Add
vmax
, as we addedvmin
in the previous iterations seems good to have both -
Modify the
vbroadcast
. The reason for this is theclang
seems to do a consistent job in making the loop go away (https://godbolt.org/z/zeE6b9, https://godbolt.org/z/G7KsjE) butgcc
less so, inO2
( https://godbolt.org/z/rGsz5W, https://godbolt.org/z/jvK5GY). The new attemptv= x - VEC{0};
produces the same assembly for both compilers (when we have/want the vec types) in the cases I looked at. -
Then there is an annoying fact that the clang version in mac/xcode is not the same as llvm. So 11 in
xcode
is 9llvm
(https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_11.x_(since_Free_On-Device_Development). This in principle is not a huge issue but can be annoying if people try to buildAnalysisBase
for mac ... so lets try to protect for it.