RE: Floating point calculation differences with AVX instructions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Marc and Jonathan for your replies.

> Yes. It's probably the SSE registers rather than AVX, but you didn't tell us what hardware you're using so we don't know what the defaults are without -march=native.

We are targeting machines that variously support SSE, AVX2 and AVX512.

Anyway, I think you have answered my question.

Best regards
David

-----Original Message-----
From: Jonathan Wakely <jwakely.gcc@xxxxxxxxx>
Sent: 12 March 2021 12:53
To: David Aldrich <david.aldrich.ntml@xxxxxxxxx>
Cc: gcc-help <gcc-help@xxxxxxxxxxx>
Subject: Re: Floating point calculation differences with AVX instructions

On Fri, 12 Mar 2021 at 12:36, David Aldrich via Gcc-help <gcc-help@xxxxxxxxxxx> wrote:
>
> Hi
>
> We have observed that the results of some floating point calculations
> change when compiler flag:
>
> -march=native
>
> is used. This can happen even for relatively simple expressions such as:
>
> x*x+y*y
>
> where x and y are double precision. The observed difference is in the
> least significant bit of the mantissa, which suggests a rounding
> issue. Is this expected behaviour?
>
> Is it because the FPU uses 80-bit extended precision for intermediate
> results whereas the AVX hardware does not?

Yes. It's probably the SSE registers rather than AVX, but you didn't tell us what hardware you're using so we don't know what the defaults are without -march=native.

See https://gcc.gnu.org/wiki/FAQ#PR323

You can use -mfpmath=sse to always use the SSE registers, but you should also read the descriptions of -fexcess-precision=standard and -ffloat-store in the manual.


 Click https://www.mailcontrol.com/sr/qlwyJQ2tvbDGX2PQPOmvUn0PzDqJDjTiG0xb4qeUjUu81w45k9SsIvhn6hVU9undod5p_N2TCnGU8yB5sLY89Q==  to report this email as spam.

________________________________
David Aldrich | Consultant Engineer | NEC Telecom Modus Ltd | Olympus House, Cleeve Road, Leatherhead, Surrey, KT22 7SA, GB | t: +44 (0) 1372 381857 | m:  | w: www.nec.com

This email (including any attached files) is private and confidential and the exclusive property of NEC Telecom MODUS Ltd. This message is addressed exclusively to its recipient. If you have received this message by mistake, please notify the sender immediately and proceed to delete the message. Unless you have express permission to do so, please do not distribute or copy this email. Except as otherwise stated, the sender does not intend to create a legal relationship and this email shall not constitute an offer or acceptance which could give rise to a contract. View our privacy policy here : https://uk.nec.com/en_GB/emea/privacy/index.html | Registered Office: Olympus House, Business Park 5, Cleeve Road, Leatherhead, Surrey KT22 7SA | Registered in England 3493954 |




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux