From: Jim Nance <jlnance@avanticorp.com>
Subject: Interesting gcc to cc comparison
Date: Tue, 18 Mar 1997 08:10:30 -0500 (EST) [thread overview]
Message-ID: <93a44194315675889b0c35267d019e58.axp-list@archive.invalid> (raw)
Hello All,
I have a program here that I thought you all might be interested in.
Its a little benchmark that I wrote that multiplies 2 matrices. The nice
things about it are that it is quite short and it does a good job of
exposing weaknesses in gcc. Hopefully it will be of interest to people
working on improving gcc. I ran these tests under Digital Unix because
Linux does not run well on my current AlphaStation, but I would be
quite surprised if the results under Linux are any different.
The machine is an AlphaStation 500/500 with 384M of ram running Digital
Unix 4.0 Rev 464. The gcc compiler is 2.7.2.2, and the cc compiler
identifies itself as DEC C X5.6-054. I tested 3 different executables,
which were compiled using the flags:
gcc -static -O2
gcc -static -O3
cc -non_shared -newc -std1 -fast
The test program uses 3 different matrix multiplication methods. The first
is the simple across-a-row-down-a-column method that everyone learns in
school. The second is a modification of the first method using a 2x2
submatrix instead of a single element, and the third uses a 4x4 submatrix.
The use of submatrices is supposed to improve both locality and the ability
to execute operations in parallel. Here are the results for multiplying
two 400x400 matrices 3 times:
Simple 2x2 4x4
cc 8.016346 2.849886 4.199832
gcc -O2 12.232844 3.833180 10.182926
gcc -O3 12.032852 3.383198 10.116262
And here are the results for multiplying two 1000x1000 matrices 2 times:
Simple 2x2 4x4
cc 131.861392 43.131608 49.664680
gcc -O2 178.309534 52.414570 111.778862
gcc -O3 176.009626 51.997920 111.645534
The most interesting result is probably for the 4x4 matrices. Gcc really
does poorly here, and I think I might know why. For the 4x4 case there
are some for loops of the form for(ii=0; ii<4; ii++) which I am counting
on the compiler to unroll so the math inside the loops can be done in
parallel. It suspect that this is not happening.
The source code, Digital Unix assembler output, and statically linked
Digital Unix binaries are available from the URL:
http://www.acs.uncwil.edu/~jlnance/mmul/index.html
Hope this is interesting,
Jim
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next reply other threads:[~1997-03-18 13:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-03-18 13:10 Jim Nance [this message]
[not found] <9703181310.AA03085@halfpint.rtp.avanticorp.com>
1997-03-18 13:30 ` Interesting gcc to cc comparison Andreas Johansson
[not found] <Pine.LNX.3.95L01at.970318142302.18255A-100000@wopr.campus.luth.se>
1997-03-18 13:33 ` Andreas Johansson
-- strict thread matches above, loose matches on Subject: below --
1997-03-20 20:19 Claus Denk
1997-03-20 20:30 Claus Denk
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox