Re: [eigen] Matrix multiplication much slower on MSVC than on g++/clang

[ Thread Index | Date Index | More Archives ]

On 2018-02-09 14:56, Edward Lam wrote:
On 2/9/2018 3:16 AM, Gael Guennebaud wrote:

    That works! For detection, the documentation at
    <> suggests that
    perhaps this will work:

    #if defined(_MSC_VER) && defined(__AVX2__)
    #define __FMA__

To implement that we need to make sure that on all architectures AVX2 => FMA. This seems to be true for Intel's ones, but I'm not sure about AMD.

According to , all AMD processors which support AVX2 support FMA. Unfortunately, I couldn't easily confirm through official online resources. The wikipedia page on Advanced_Vector_Extensions notes that only AMD Excavactor processors (and up) support AVX2, and those definitely support FMA (double-checked at

It seems that there are AMD architectures which support FMA3, but not AVX2. This would make the check above safe, but not optimal.

Bulldozer supports FMA4 (and AVX1), but not FMA3 (nor AVX2).

It seems, Eigen generally only supports FMA3, even though FMA4 should be relatively easy (just the name of the intrinsic should be different).

That said, I'm ok with the hack suggested above. We should probably still document how to make sure that FMA is enabled (if AVX2 is not available).



 Dr.-Ing. Christoph Hertzberg

 Besuchsadresse der Nebengeschäftsstelle:
 Robotics Innovation Center
 Robert-Hooke-Straße 5
 28359 Bremen, Germany

 Postadresse der Hauptgeschäftsstelle Standort Bremen:
 Robotics Innovation Center
 Robert-Hooke-Straße 1
 28359 Bremen, Germany

 Tel.:     +49 421 178 45-4021
 Zentrale: +49 421 178 45-0
 E-Mail:   christoph.hertzberg@xxxxxxx

 Weitere Informationen:
 Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
 Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
 Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
 (Vorsitzender) Dr. Walter Olthoff
 Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
 Amtsgericht Kaiserslautern, HRB 2313
 Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
 USt-Id.Nr.:    DE 148646973
 Steuernummer:  19/672/50006

Mail converted by MHonArc 2.6.19+