[Llvm-bgq-discuss] Does anyone use math-function errno?
Erik Schnetter
schnetter at gmail.com
Thu Aug 29 11:23:43 CDT 2013
On 2013-08-29, at 12:09 , Hal Finkel <hfinkel at anl.gov> wrote:
> I'm looking for user feedback here:
>
> Currently, Clang on Linux (and, thus, on the BG/Q) uses -fmath-errno as the default setting. This means that it recognizes that math functions (like sqrt for example) might set the global (per-thread) errno variable in error situations. This limits a number of optimizations that can be performed (including preventing these libm math functions from being autovectorized). This is turned off in fast-math mode (with -ffast-math), but some systems (such as Mac OS X) also have it turned off in general (meaning that -fno-math-errno is the system wide default).
>
> I'll note that bgxlc uses its equivalent of fast-math mode by default at -O3 and higher, and I'm sure that I'd like to go that far. But, in my experience, I've not seen a science code that actually checked errno after calling a libm math function. As a result, I'm considering making the BG/Q Clang default, like on Mac OS X, be -fno-math-errno. In this way, by default, we'll get stronger optimizations around calls to libm functions (including autovectorization). If anyone has an opinion here, please share.
I have never seen a scientific code that checks errno after calling a math function.
I have seen people calling isnan() with -ffast-math, and gcc's decision to have isnan() always return false with -ffast-math is questionable in this respect (but is also consequent). I sometimes wish there was a light-weight -ffast-math that would perform the "expected" (yeah, right) optimizations, while keeping isnan() and friends working.
I don't think errno is useful for math functions. I would speculate that most people don't even know that it exists, and call isfinite() to check for problems.
-erik
--
Erik Schnetter <schnetter at gmail.com>
http://www.perimeterinstitute.ca/personal/eschnetter/
My email is as private as my paper mail. I therefore support encrypting
and signing email messages. Get my PGP key from http://pgp.mit.edu/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.alcf.anl.gov/pipermail/llvm-bgq-discuss/attachments/20130829/6056e3ea/attachment.pgp>
More information about the llvm-bgq-discuss
mailing list