[Llvm-bgq-discuss] Does anyone use math-function errno?

Hal Finkel hfinkel at anl.gov
Thu Aug 29 11:09:33 CDT 2013


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.

Thanks again,
Hal

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory


More information about the llvm-bgq-discuss mailing list