zlacker

[parent] [thread] 4 comments
1. planed+(OP)[view] [source] 2024-01-16 15:22:25
Another PSA is that dynamic libraries compiled with fast-math will also introduce inaccuracies in unrelated libraries in the same executable, as they introduce dynamic initialization that globally changes the floating point environment.
replies(1): >>pavlov+F
2. pavlov+F[view] [source] 2024-01-16 15:25:22
>>planed+(OP)
This would only affect code that uses the old-school x87 floating point instructions, though? The x87 FPU unit indeed has scary global state that can make your doubles behave like floats in secret and silence.

I would think practically all modern FPU code on x86-64 would be using the SIMD registers which have explicit widths.

replies(3): >>borodi+L4 >>jcranm+Nc >>mhh__+qe
◧◩
3. borodi+L4[view] [source] [discussion] 2024-01-16 15:41:34
>>pavlov+F
So it was a bit more pervasive than this, the issue was that flushing subnormals (values very close to 0) to 0 is a register that gets set, so if a library is built with the fastmath flags and it gets loaded, it sets the register, causing the whole process to flush it's subnormals. i.e https://github.com/llvm/llvm-project/issues/57589
◧◩
4. jcranm+Nc[view] [source] [discussion] 2024-01-16 16:14:42
>>pavlov+F
> This would only affect code that uses the old-school x87 floating point instructions, though?

Actually, no, the x87 FPU instructions are the only ones that won't be affected.

It sets the FTZ/DAZ bits, which exist for SSE instructions but not x87 instructions.

◧◩
5. mhh__+qe[view] [source] [discussion] 2024-01-16 16:23:44
>>pavlov+F
You're mistaking something else for the rounding mode and subnormal handling flags.
[go to top]