[gambit-list] Performance of different versions of gcc

Marc Feeley feeley at iro.umontreal.ca
Tue May 1 09:35:24 EDT 2012


On 2012-04-29, at 4:40 AM, Frederick LeMaster wrote:

> Wow, Marc,
> Those are some thorough numbers! Thanks for testing all of this. Have
> you tested compiling gambit with clang? I've compiled gambit on an
> embedded arm platform (which ships with a faulty gcc...) but I haven't
> done any testing n x86_64.
> -Fred

I repeated the experiment with clang version 2.6 to 3.0.  I had some trouble getting all these clang versions working on linux (due to linking problems) so I installed the prebuilt compilers on a x86_64 Mac OS X machine.  In case you want to compare the execution time in the original experiment with this experiment, please note that the Mac OS X machine is about 15% faster than the linux machine.

Clang versions 2.7, 2.8 and 2.9 have bugs which prevent the Gambit "make" to complete.  The details are given below.

The build and execution times are given below.  Note that the fastest execution speed is obtained with --enable-single-host (regardless of optimization level) and that clang 2.6 generates code that is about 40% faster than clang 3.0 .

As for the build time, clang is very roughly the same speed as gcc when --enable-multiple-hosts is used.  However, when --enable-single-host is used the build time increases dramatically (over 10 minutes for clang 2.6, and as much as 70 minutes for clang 3.0).  Clang is probably using algorithms with a high algorithmic complexity.  Strangely, with clang 3.0 it takes less time to compile with -O2 than with -O1.  My guess is that clang 3.0 at -O2 must limit the size of functions which are optimized (i.e. the expensive optimizations are turned off when the functions are too big).

Marc


**** Execution time of tests/mix.scm when run by gsi

        |    --enable-multiple-hosts      |      --enable-single-host       |
        |      -O1       |      -O2       |      -O1       |      -O2       |
 clang  |  secs    rel   |  secs    rel   |  secs    rel   |  secs    rel   |
 -------+----------------+----------------+----------------+----------------+
 2.6    |   4.35 ( 1.59) |   4.41 ( 1.61) |   2.74 ( 1.00) |   2.79 ( 1.02) |
 -------+----------------+----------------+----------------+----------------+
 3.0    |   3.83 ( 1.40) |   3.76 ( 1.37) |   4.49 ( 1.64) |   4.87 ( 1.78) |
 -------+----------------+----------------+----------------+----------------+


**** Elapsed time of "make"

        |    --enable-multiple-hosts      |      --enable-single-host       |
        |      -O1       |      -O2       |      -O1       |      -O2       |
 clang  |  secs    rel   |  secs    rel   |  secs    rel   |  secs    rel   |
 -------+----------------+----------------+----------------+----------------+
 2.6    |   95.7 ( 1.00) |   96.0 ( 1.00) |  694.4 ( 7.26) |  699.1 ( 7.31) |
 -------+----------------+----------------+----------------+----------------+
 3.0    |  164.3 ( 1.72) |  127.2 ( 1.33) | 4313.0 (45.08) | 1825.3 (19.08) |
 -------+----------------+----------------+----------------+----------------+


**** Bugs in the clang compilers versions 2.7, 2.8 and 2.9:

clang 2.7:

/Users/feeley/clang/2.7/bin/clang -Wno-unused -Wno-write-strings -O1 -fno-math-errno -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common   -I"../include" -c -o "_t-c-2.o" -I. -DHAVE_CONFIG_H _t-c-2.c -D___LIBRARY
clang: warning: argument unused during compilation: '-fwrapv'
Assertion failed: (!isa<IndirectBrInst>(Preds[i]->getTerminator()) && "Cannot split an edge from an IndirectBrInst"), function SplitBlockPredecessors, file BasicBlockUtils.cpp, line 400.

clang 2.8:

/Users/feeley/clang/2.8/bin/clang -Wno-unused -Wno-write-strings -O1 -fno-math-errno -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common   -I"../include" -c -o "_num.o" -I. -DHAVE_CONFIG_H -D___GAMBCDIR="\"/Users/feeley/gambit-clang/clang/2.8/mhO1\"" -D___SYS_TYPE_CPU="\"i386\"" -D___SYS_TYPE_VENDOR="\"apple\"" -D___SYS_TYPE_OS="\"darwin11.3.0\"" -D___CONFIGURE_COMMAND="\"./configure '--prefix=/Users/feeley/gambit-clang/clang/2.8/mhO1' 'CC=/Users/feeley/clang/2.8/bin/clang' '--enable-multiple-hosts' '--enable-c-opt=-O1'"\" -D___OBJ_EXTENSION="\".o\"" -D___EXE_EXTENSION="\"\"" -D___BAT_EXTENSION="\"\"" -D___PRIMAL _num.c -D___LIBRARY
...
Stack dump:
0.	Program arguments: /Users/feeley/clang/2.8/bin/clang -cc1 -triple x86_64-apple-darwin11.0.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name _num.c -pic-level 2 -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 97.14 -resource-dir /Users/feeley/clang/2.8/lib/clang/2.8 -D HAVE_CONFIG_H -D ___GAMBCDIR="/Users/feeley/gambit-clang/clang/2.8/mhO1" -D ___SYS_TYPE_CPU="i386" -D ___SYS_TYPE_VENDOR="apple" -D ___SYS_TYPE_OS="darwin11.3.0" -D ___CONFIGURE_COMMAND="./configure '--prefix=/Users/feeley/gambit-clang/clang/2.8/mhO1' 'CC=/Users/feeley/clang/2.8/bin/clang' '--enable-multiple-hosts' '--enable-c-opt=-O1'" -D ___OBJ_EXTENSION=".o" -D ___EXE_EXTENSION="" -D ___BAT_EXTENSION="" -D ___PRIMAL -D ___LIBRARY -I ../include -I . -O1 -Wno-unused -Wno-write-strings -ferror-limit 19 -fmessage-length 80 -fwrapv -stack-protector 1 -fblocks -fno-common -fdiagnostics-show-option -o _num.o -x c _num.c 
1.	<eof> parser at end of file
2.	Per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module '_num.c'.
4.	Running pass 'Jump Threading' on function '@___H__3d_'
clang: error: clang frontend command failed due to signal 11 (use -v to see invocation)

clang 2.9:

/Users/feeley/clang/2.9/bin/clang -Wno-unused -Wno-write-strings -O1 -fno-math-errno -fno-strict-aliasing -fwrapv -fomit-frame-pointer -fPIC -fno-common   -I"../include" -c -o "_num.o" -I. -DHAVE_CONFIG_H -D___GAMBCDIR="\"/Users/feeley/gambit-clang/clang/2.9/mhO1\"" -D___SYS_TYPE_CPU="\"i386\"" -D___SYS_TYPE_VENDOR="\"apple\"" -D___SYS_TYPE_OS="\"darwin11.3.0\"" -D___CONFIGURE_COMMAND="\"./configure '--prefix=/Users/feeley/gambit-clang/clang/2.9/mhO1' 'CC=/Users/feeley/clang/2.9/bin/clang' '--enable-multiple-hosts' '--enable-c-opt=-O1'"\" -D___OBJ_EXTENSION="\".o\"" -D___EXE_EXTENSION="\"\"" -D___BAT_EXTENSION="\"\"" -D___PRIMAL _num.c -D___LIBRARY
...
Stack dump:
0.	Program arguments: /Users/feeley/clang/2.9/bin/clang -cc1 -triple x86_64-apple-darwin11.0.0 -emit-obj -disable-free -disable-llvm-verifier -main-file-name _num.c -pic-level 2 -relaxed-aliasing -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 97.14 -resource-dir /Users/feeley/clang/2.9/bin/../lib/clang/2.9 -D HAVE_CONFIG_H -D ___GAMBCDIR="/Users/feeley/gambit-clang/clang/2.9/mhO1" -D ___SYS_TYPE_CPU="i386" -D ___SYS_TYPE_VENDOR="apple" -D ___SYS_TYPE_OS="darwin11.3.0" -D ___CONFIGURE_COMMAND="./configure '--prefix=/Users/feeley/gambit-clang/clang/2.9/mhO1' 'CC=/Users/feeley/clang/2.9/bin/clang' '--enable-multiple-hosts' '--enable-c-opt=-O1'" -D ___OBJ_EXTENSION=".o" -D ___EXE_EXTENSION="" -D ___BAT_EXTENSION="" -D ___PRIMAL -D ___LIBRARY -I ../include -I . -O1 -Wno-unused -Wno-write-strings -ferror-limit 19 -fmessage-length 80 -fwrapv -stack-protector 1 -fblocks -fno-common -fdiagnostics-show-option -o _num.o -x c _num.c 
1.	<eof> parser at end of file
2.	Per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module '_num.c'.
4.	Running pass 'Loop Pass Manager' on function '@___H__23__23_bignum_2e__2a_'
5.	Running pass 'Rotate Loops' on basic block '%2697'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal 1 (use -v to see invocation)




More information about the Gambit-list mailing list