From: Shane Steven Sturrock <sss@hayes.bru.ed.ac.uk>
To: axp-list@redhat.com
Subject: Fun with assembler
Date: Thu, 4 Jun 1998 16:14:39 GMT [thread overview]
Message-ID: <199806041614.QAA25947@hayes.bru.ed.ac.uk> (raw)
In-Reply-To: <Pine.LNX.3.95.980602112546.480A-100000@riha.physik.Uni-Osnabrueck.DE>
Finally getting somewhere with this alpha.
First some history.
We are working on some 64 bit code which isn't being optimised very well with
gcc/egcs and as a result our 533Mhz alpha was being trounced by the MIPS
R10000s in our SGI Challenge which only run at 200Mhz. Said trouncing was of
the order of 15% poorer performance for the alpha. Grim situation for us, big
laughs from the SGI boys.
Needless to say the problem is with the compilers. The one on the SGI is smart
enough to know how to get the best out of the chip, gcc/egcs is not. Of course
there is the option of DU C which is supposed to give about 30% better results
than gcc. I can now believe this having improved the performance of our code
by a similar amount by a few simple changes to the assembler output of egcs.
The problem is that the alpha quite often gets stalled if you write code which
is very tight, ie plenty of registers used and each instruction relies on the
previous one. The trick to getting better performance is to try and pair up
your instructions but you can only really do this at the assembly level. The
good news is it is easy, you just need to find the busiest part of your
program, in our case its an intensive repetitive operation in a loop. Going
through this code it quickly became apparent that the alpha was being stalled
like mad, a typical example being:
srl $3,7,$1
srl $4,7,$2
The srl instruction must go down pipeline E0 and because there are two of these
you end up with pipe E1 doing nothing. The solution, stick an instruction in
between the two:
srl $3,7,$1
addq $8,$6,$8
srl $4,7,$2
Now the addq is using the second pipeline. Do the same for the second srl and
you're off and running.
Most instructions can run in both E0 and E1 but some are E0 or E1 only. Mix
and match, don't be affraid to put nop instructions in to pair up with an srl
or whatever that you can't pair up with something else, you must try and keep
things in step.
I have put the pdf files I got this from on my machine for anonymous ftp, you
can get it from nova.bru.ed.ac.uk in the /pub directory, the original site for
these is
http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/alpha_cookboo
k/biblio.htm.
The most interesting section is on the internal architecture. There are good
descriptions and examples of code to look at. Now, if I can just squeeze a bit
more out of it, we're already 30% faster than the MIPS, there must be something
more I can do...... :-)
Dr. Shane Sturrock - sss@holyrood.ed.ac.uk
kernel: Calibrating delay loop.. ok - 529.53 BogoMIPS
Mmmmmmmmmmm :-)
next prev parent reply other threads:[~1998-06-04 16:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-05-23 2:55 while we're talking about the Millenium II Jay A Estabrook
1998-05-23 11:30 ` Uncle George
1998-05-24 9:52 ` Harald Koenig
1998-05-25 9:43 ` Uncle George
1998-06-02 9:29 ` DU C/C++ compiler Vladimir Kamenov
1998-06-04 16:14 ` Shane Steven Sturrock [this message]
1998-06-05 3:35 ` Fun with assembler Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
1998-06-04 18:18 Greg Lindahl
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