Differences between -m64 and -m32
Dennis Wassel
dennis.wassel@googlemail.com
Wed Sep 1 17:24:00 GMT 2010
Hi list,
I have observed drastic slowdown between 32- and 64-bit builds, and
tracked it down to the exp function in libm when called with some
"special" numeric values, those close to eps being an example. On some
occasions and only in the 64-bit code, the result of __ieee745_exp
seems to exceed an internal error bound, causing it to call a
__slowexp with software FP arithmetic. Slowness ensues.
Using the attached makefile & testcase on Ubuntu 10.04 running stock
gfortran (4.4.3) and stock eglibc 2.11.1, I see that the 64-bit case
calls slowexp, while the 32-bit one does not, and the results of exp
differ in one case.
Can anybody help me make some sense of this? Can one possibly remedy
this (preferrably without taking it to the Drepper guy)?
Cheers,
Dennis
-------------- next part --------------
valgrind --tool=callgrind --callgrind-out-file=callgrind.32 test32.bin > 32.log
==7218== Callgrind, a call-graph generating cache profiler
==7218== Copyright (C) 2002-2009, and GNU GPL'd, by Josef Weidendorfer et al.
==7218== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==7218== Command: test32.bin
==7218==
==7218== For interactive control, run 'callgrind_control -h'.
==7218==
==7218== Events : Ir
==7218== Collected : 399067
==7218==
==7218== I refs: 399,067
valgrind --tool=callgrind --callgrind-out-file=callgrind.64 test64.bin > 64.log
==7222== Callgrind, a call-graph generating cache profiler
==7222== Copyright (C) 2002-2009, and GNU GPL'd, by Josef Weidendorfer et al.
==7222== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==7222== Command: test64.bin
==7222==
==7222== For interactive control, run 'callgrind_control -h'.
==7222==
==7222== Events : Ir
==7222== Collected : 1059698
==7222==
==7222== I refs: 1,059,698
callgrind_annotate --tree=caller callgrind.32 | grep exp
214 < /build/buildd/eglibc-2.11.1/elf/dl-load.c:expand_dynamic_string_token (1x) [/lib32/ld-2.11.1.so]
2 < /build/buildd/eglibc-2.11.1/elf/dl-load.c:expand_dynamic_string_token (1x) [/lib32/ld-2.11.1.so]
216 * /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/w_exp.c:exp [/lib32/libm-2.11.1.so]
238 < /build/buildd/eglibc-2.11.1/elf/dl-load.c:expand_dynamic_string_token (1x) [/lib32/ld-2.11.1.so]
120 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/w_exp.c:exp (6x) [/lib32/libm-2.11.1.so]
120 * /build/buildd/eglibc-2.11.1/math/../sysdeps/i386/fpu/e_exp.S:__ieee754_exp [/lib32/libm-2.11.1.so]
36 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/w_exp.c:exp (6x) [/lib32/libm-2.11.1.so]
callgrind_annotate --tree=caller callgrind.64 | grep exp
582 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/slowexp.c:__slowexp (1x) [/lib/libm-2.11.1.so]
249,169 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/mpexp.c:__mpexp (38x) [/lib/libm-2.11.1.so]
230 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/mpexp.c:__mpexp (2x) [/lib/libm-2.11.1.so]
210 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/slowexp.c:__slowexp (1x) [/lib/libm-2.11.1.so]
5,950 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/mpexp.c:__mpexp (10x) [/lib/libm-2.11.1.so]
454 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/slowexp.c:__slowexp (3x) [/lib/libm-2.11.1.so]
400 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/mpexp.c:__mpexp (2x) [/lib/libm-2.11.1.so]
47 < /build/buildd/eglibc-2.11.1/elf/dl-load.c:expand_dynamic_string_token (1x) [/lib/ld-2.11.1.so]
272 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/slowexp.c:__slowexp (1x) [/lib/libm-2.11.1.so]
81 < /build/buildd/eglibc-2.11.1/elf/dl-load.c:expand_dynamic_string_token (1x) [/lib/ld-2.11.1.so]
727,174 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/slowexp.c:__slowexp (2x) [/lib/libm-2.11.1.so]
1,107 * /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/mpexp.c:__mpexp [/lib/libm-2.11.1.so]
43 < /build/buildd/eglibc-2.11.1/elf/dl-load.c:expand_dynamic_string_token (1x) [/lib/ld-2.11.1.so]
729,826 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/w_exp.c:exp (6x) [/lib/libm-2.11.1.so]
508 * /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/e_exp.c:__ieee754_exp [/lib/libm-2.11.1.so]
470,425 < /build/buildd/eglibc-2.11.1/math/../sysdeps/ieee754/dbl-64/mpexp.c:__mpexp (8x) [/lib/libm-2.11.1.so]
diff -Bupw 32.log 64.log
--- 32.log 2010-09-01 19:10:11.565299379 +0200
+++ 64.log 2010-09-01 19:10:11.995299729 +0200
@@ -1,6 +1,6 @@
4.44089209850062616E-016 1.0000000000000004
2.22044604925031308E-016 1.0000000000000002
- 1.11022302462515654E-016 1.0000000000000000
+ 1.11022302462515654E-016 1.0000000000000002
-4.44089209850062616E-016 0.99999999999999956
-2.22044604925031308E-016 0.99999999999999978
-1.11022302462515654E-016 0.99999999999999989
make: *** [showdiff] Fehler 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: makefile
Type: application/octet-stream
Size: 692 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100901/5d16a883/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.f90
Type: application/octet-stream
Size: 330 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100901/5d16a883/attachment-0001.obj>
More information about the Fortran
mailing list