[Bug 784968] New: glibc/libm.so not fully optimised?
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c0 Summary: glibc/libm.so not fully optimised? Classification: openSUSE Product: openSUSE 12.1 Version: Final Platform: x86-64 OS/Version: openSUSE 12.1 Status: NEW Severity: Enhancement Priority: P5 - None Component: Development AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: dr.tino.k@gmail.com QAContact: qa-bugs@suse.de Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 I've timed pow(a,b) and it seems to be half as fast as exp(b*log(a)) which is surprising. When linked against a self compiled glibc 2.14 (libm.a), pow() seems to be faster and on par with exp(log()), which is why I suspect the openSUSE precompiled glibc package might not be fully optimised? However, I don't have the resources to fully track this down, so I was hoping that someone else could have a look into this and either confirm or deny my findings. Reproducible: Always Steps to Reproduce: 1. 2. 3. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c kk zhang <kkzhang@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kkzhang@suse.com AssignedTo|bnc-team-screening@forge.pr |matz@suse.com |ovo.novell.com | -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c1 Michael Matz <matz@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |dr.tino.k@gmail.com --- Comment #1 from Michael Matz <matz@suse.com> 2012-10-15 13:12:09 UTC --- Which glibc version, which hardware. Testcase. Measured output. This report misses everything. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c2 Tino K <dr.tino.k@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|dr.tino.k@gmail.com | --- Comment #2 from Tino K <dr.tino.k@gmail.com> 2012-10-17 11:04:55 UTC --- Created an attachment (id=509837) --> (http://bugzilla.novell.com/attachment.cgi?id=509837) test of speed pow() vs exp(log()) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c3 Richard Guenther <rguenther@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |dr.tino.k@gmail.com --- Comment #3 from Richard Guenther <rguenther@suse.com> 2012-10-17 11:21:30 UTC --- exp(b*log(a)) has different precision requirements compared to pow(a,b). The former may include three rounding steps while the latter only one. Also b*log(a) may underflow, so in floating-point arithmetic exp(b*log(a)) is _not_ equal to pow(a,b). So you are comparing apples and oranges and we may be just returning higher precision values in our pow() path. Did you compare the results of both? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c4 Tino K <dr.tino.k@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW InfoProvider|dr.tino.k@gmail.com | --- Comment #4 from Tino K <dr.tino.k@gmail.com> 2012-10-17 11:29:35 UTC --- I've used a bigger test programme but the attached test will do. I've tested both on OpenSUSE 11.2 and 12.1, both x86_64, but currently don't have access to 12.1. 12.1 ---- Sandy Bridge $ rpm -q glibc glibc-2.14.1-14.14.1.x86_64 $ getconf GNU_LIBC_VERSION GNU_LIBC_VERSION glibc 2.14.1 11.2 ---- Nehalem, run at 1.733 GHz $ rpm -q glibc glibc-2.10.1-10.9.1.x86_64 $ getconf GNU_LIBC_VERSION glibc 2.10.1 $ /usr/local/glibc/bin/getconf GNU_LIBC_VERSION glibc 2.14 $ ./pow pow(): x=4.568291e+08, time=0.237 exp(log()): x=4.568291e+08, time=0.118 $ ./pow_libc2.14 pow(): x=4.568291e+08, time=0.139 exp(log()): x=4.568291e+08, time=0.134 Compiler doesn't matter as time is mostly spent in pow() or exp() but above output is result of -O2. So interestingly, the self compiled glibc is slightly slower when it comes to exp(log()) but twice as fast when it comes to pow(). -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c5 --- Comment #5 from Tino K <dr.tino.k@gmail.com> 2012-10-17 11:34:23 UTC --- Sure, pow() uses a more complex algorithm as exp(log()) and I did have a look at __ieee754_pow(), but that's a bit beyond me. However, I wouldn't expect pow() to be twice as slow. More importantly a self compiled glibc results in similar speed. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c6 Michael Matz <matz@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #6 from Michael Matz <matz@suse.com> 2012-10-17 13:23:41 UTC --- Up to 12.1 our glibc contained an old implementation of AMD libm routines for some math functions. It has a little higher precision, and years ago also higher performance than the then implemented libm routines. Meanwhile that has changed, and we'll ship without these replacements on 12.2. SLE11 SP2 instead contains updated AMD routines which amongst other things significantly sped up pow. Hence, nothing to do here. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=784968 https://bugzilla.novell.com/show_bug.cgi?id=784968#c7 not something I'm telling here again not something I'm telling here <marco.morandini@polimi.it> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marco.morandini@polimi.it OS/Version|openSUSE 12.1 |openSUSE 12.2 --- Comment #7 from not something I'm telling here again not something I'm telling here <marco.morandini@polimi.it> 2013-03-06 15:28:47 UTC --- Now I understand why I've recently been bitten by http://sourceware.org/bugzilla/show_bug.cgi?id=13932 Please, restore the AMD implementation on OpenSuse: they do not show the pathological slowdown of glibc's pow. Marco -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com