On Thu, 2012-10-25 at 16:19 -0400, Bradley Lucier wrote:
This has the following effect on the time to compute 10,000 forward and 10,000 backward complex FFTs of 1,024 elements.
With -fno-strict-aliasing (used now by Gambit for reasons I'll explain below):
(time (do ((i 0 (fx+ i 1))) ((fx= i 10000)) (direct-fft-recursive-4 a table) (inverse-fft-recursive-4 a table) (do ((i 0 (fx+ i 1))) ((fx= i (fx* two^n 2))) (f64vector-set! a i (fl/ (f64vector-ref a i) inexact-two^n)))))
705 ms real time
704 ms cpu time (704 user, 0 system)
6 collections accounting for 2 ms real time (0 user, 0 system)
1600000 bytes allocated
22 minor faults
no major faults
With -fstrict-aliasing:
(time (do ((i 0 (fx+ i 1))) ((fx= i 10000)) (direct-fft-recursive-4 a table) (inverse-fft-recursive-4 a table) (do ((i 0 (fx+ i 1))) ((fx= i (fx* two^n 2))) (f64vector-set! a i (fl/ (f64vector-ref a i) inexact-two^n)))))
590 ms real time
592 ms cpu time (588 user, 4 system)
6 collections accounting for 2 ms real time (4 user, 0 system)
1600000 bytes allocated
22 minor faults
no major faults
That's a 19% performance improvement. (And the performance isn't bad, 1.74 GFLOPS on my 2.33GHz Core 2 quad 6600. Later I'll try to get gcc to vectorize the main loop.)
I should have said which OS, gcc, and configuration I was using:
heine:~/programs/gambit> gsc -v
v4.6.6 20121013190232 x86_64-unknown-linux-gnu "./configure 'CC=gcc -march=native -fschedule-insns -frename-registers' '--enable-single-host' '--enable-multiple-versions' '--enable-shared'"
heine:~/programs/gambit> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)
model name : Intel(R) Core(TM)2 Quad CPU Q8200 @ 2.33GHz
Brad