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

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Matrix multiplication much slower on MSVC than on g++/clang*From*: Patrik Huber <patrikhuber@xxxxxxxxx>*Date*: Thu, 8 Feb 2018 21:40:13 +0000*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=P0XIqUiQl04h6C/PSGEXHRZfsotIzYC8pDwFdbZwaww=; b=lzDVN9LF3lE1LVQiCq9EkcTCgBmysGTzpbJ5vAnasq+OmkPGuyhqyPwVZHhyvedh7c PYoGIVBHL/sYoQ26f+xuao1HAzzhfQlOt2EVXZfduTs5LSrikla9UtqzlCDeeF/vxIKQ 86SvYHIVLvgRJNE6Amenbtbak5mGVTEsPo55cZZ8rXGa28MK2O9+Q+AQmWMv3w16Atmg AV6H2gaARyXeCCmuDXQYemBxgpKJ0H+Ar5rWiIN7JDk/PesP1puTRsrYxlQrCgMKI9UJ 2v4nqrBqrTbTmFbkb4fAZuvjvbQsRaTbiYtg764d3F4/r6sJrqTg19IOhkKO15hk7U+M 2zUw==

Hi Edward,

I see, that's good to know, thank you! So /fp:fast has the potential to let the compiler generate even more intrinsics. In practice I've observed the same as you wrote earlier though, adding /fp:fast in a few of my applications didn't yield any performance benefit.

The FMA speed-up is huge though :-)))

Thank you again and best wishes,

Patrik

On 8 February 2018 at 21:19, Edward Lam <edward@xxxxxxxxxx> wrote:

Hi Patrik,

On 2/8/2018 3:08 PM, Patrik Huber wrote:

>

I think this is incorrect though. I thin /fp:fast is not needed for MSVC to generate FMA code. Also, gcc and clang can generate FMA code without -ffast-math (which I guess is sort-of equivalent to /fp:fast).

Using /fp:fast is not necessary for the intrinsics, but without it, I can't get this to generate an vfmadd instruction:

=========

//foo.cpp

//

// Test with: cl /Fa /O2 /arch:AVX2 /fp:fast foo.cpp

// Generates foo.exe and foo.asm

float mul_add(float a, float b, float c) {

return a*b + c;

}

int main()

{

return 0;

}

=========

Best regards,

-Edward

Dr.. Patrik Huber

Centre for Vision, Speech and Signal Processing

University of Surrey

Guildford, Surrey GU2 7XH

United Kingdom

Web: www.patrikhuber.ch

Mobile: +44 (0)7482 633 934

Centre for Vision, Speech and Signal Processing

University of Surrey

Guildford, Surrey GU2 7XH

United Kingdom

Web: www.patrikhuber.ch

Mobile: +44 (0)7482 633 934

**References**:**[eigen] Matrix multiplication much slower on MSVC than on g++/clang***From:*Patrik Huber

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

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

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

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

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

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

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

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Matrix multiplication much slower on MSVC than on g++/clang** - Next by Date:
**Re: [eigen] Matrix multiplication much slower on MSVC than on g++/clang** - Previous by thread:
**Re: [eigen] Matrix multiplication much slower on MSVC than on g++/clang** - Next by thread:
**Re: [eigen] Matrix multiplication much slower on MSVC than on g++/clang**

Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |