cmake flags

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

cmake flags

Postby zak » Sun Mar 21, 2021 2:48 pm

Hi,
why in cmake txt, Visual Studio, floating point mode is fast in release and precise in debug?
I think it should be fast in debug too.
zak
 
Posts: 87
Joined: Mon Dec 06, 2004 9:30 am

Re: cmake flags

Postby Julio Jerez » Sun Mar 21, 2021 5:15 pm

the precise optimization is an option that force the compiler to generate code that guarantee float standard compliance, it does that by saving the intermediate value to local memory, so that the mantissa gets truncated to the format size. This is because is x86, registers values used to be 80 bit wide so they keep too many extra bits that can make some calculation return different values than the IEEE standard say for the format. With sse registers this is not longer an issue, since the registers are the size of the format.

I leave it just in case some legacy code is left in x87, but the precise option is not really making any difference. beside as far as I remember all arithmetic in the engine is written carefully enough that we do not rely of the compiler for the rounding mode.

in debug the precise option doesn't do anything, since in debug the compile is a load/operation/store and that forces
all calculation to the truncated format.

for consistency I will change debug to use fast as well
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 47 guests