* Re: Alpha's floating point performance
@ 1998-11-16 22:51 y0000218
1998-11-17 9:09 ` Harvey J. Stein
1998-11-17 16:11 ` Scott Lewis
0 siblings, 2 replies; 8+ messages in thread
From: y0000218 @ 1998-11-16 22:51 UTC (permalink / raw)
Murx <chrisi@theo1.physik.uni-stuttgart.de> wrote:
[snip]
: If you can manage to hold you data/instructions in the cache,
: get an alpha, the alpha is capable of reaching an incredible throughput.
: How much you *eventually* get, really depends on your code.
: And that can differ between 'same performance/slower' and
: '10 times faster'. (being unfair here .-))
Hmm, for the unpatient and busy, where can someone (lets assume, I)
find a guideline how to code C/C++ on Alpha CPUs and be fast? Whats
"good" whats "bad" to do? Are there "50 magic steps to write blindingly fast
code on Alpha Systems" (Mr. Goto, maybe? I wont make it to hand-optimizing
assembler though :)
Olaf
--
"The number of Unix installations Olaf Schnapauff,
has grown to 10, with more expected." O.Schnapauff@tu-bs.de
- The Unix Programmer's Manual,1972 http://www.tu-bs.de/~c0033014/
See Web page and keyservers for pgp public key
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Alpha's floating point performance
1998-11-16 22:51 Alpha's floating point performance y0000218
@ 1998-11-17 9:09 ` Harvey J. Stein
1998-11-17 16:11 ` Scott Lewis
1 sibling, 0 replies; 8+ messages in thread
From: Harvey J. Stein @ 1998-11-17 9:09 UTC (permalink / raw)
To: axp-list; +Cc: hjstein
y0000218@rzsrv2.rz.tu-bs.de writes:
> Murx <chrisi@theo1.physik.uni-stuttgart.de> wrote:
> [snip]
> : If you can manage to hold you data/instructions in the cache,
> : get an alpha, the alpha is capable of reaching an incredible throughput.
> : How much you *eventually* get, really depends on your code.
> : And that can differ between 'same performance/slower' and
> : '10 times faster'. (being unfair here .-))
>
> Hmm, for the unpatient and busy, where can someone (lets assume, I)
> find a guideline how to code C/C++ on Alpha CPUs and be fast? Whats
> "good" whats "bad" to do? Are there "50 magic steps to write blindingly fast
> code on Alpha Systems" (Mr. Goto, maybe? I wont make it to hand-optimizing
> assembler though :)
David Mosberger wrote a 2 part article for the Linux Journal on how to
code for the Alpha. Issues 42 & 43. I think he has copies on his web
site too.
After much digging, I finally found a copy on the net:
http://www.mostang.com/~davidm/papers/expo97/paper.ps.gz
http://www.mostang.com/~davidm/papers/expo97/paper/
--
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Alpha's floating point performance
1998-11-16 22:51 Alpha's floating point performance y0000218
1998-11-17 9:09 ` Harvey J. Stein
@ 1998-11-17 16:11 ` Scott Lewis
1998-11-17 19:36 ` Chris Albertson
1 sibling, 1 reply; 8+ messages in thread
From: Scott Lewis @ 1998-11-17 16:11 UTC (permalink / raw)
To: axp-list
Well, I too am impatient. And I would really love to see what my Alpha
can do. What language you _should_ use depends on what you are trying to
do. Math Ops in assembly will blow the doors off of C, but I wouldn't
want to even think about an application in assembly. There was a post
yesterday (after I wasted far too much time on trying to do so myself)
about postscript, pdf, and html documents on Digital's web site. Among
the gems are several regarding C/C++, assembly, and Fortan I believe.
They are DU specific, but should nonetheless be helpful to we
Penguin-Heads. Here is the text of yesterday's message:
--------
>Howdy all. There was some talk a few weeks ago about finding a recent
>copy of Digital's Guide to Assembly Programming in postscript format.
>Alas, the most recent was from 1994 for OSF. So, I took the liberty of
>ripping the current (3/96, DU 4.0+) page and converting it to
>postscript. It is available on my box, axp.ce.gatech.edu, via anonymous
>ftp as /pub/asm.ps.gz It isn't perfect, but it should do for most
>purposes. If there is sufficient interest, I may do the same for the rest
>of the available documentation. Any comments as to the output quality (if
>they are constructive) would be appreciated. Else, > /dev/null
This may fit in your /dev/null, but I did find existing postcript docs for
4.0a:
http://www.unix.digital.com/faqs/publications/pub_page/v40a_docs.htm
Or if you want to pick your doc type and/or version:
http://www.unix.digital.com/faqs/publications/pub_page/doc_list.html
Note that I found this minutes after I finished printing the assembly doc
set for OSF/1 3.x (100+ pages). Ouch.
I appreciate your effort, though.
JRDM
---------
Hope that this will be helpful to you...
Scott Lewis
Computer Support
Department of Civil and Environmental Engineering
Georgia Institute of Technology
scott.lewis@ce.gatech.edu (404) 894-2210
There's nary an animal alive that can outrun a greased Scotsman.
-Groundskeeper Willy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Alpha's floating point performance
1998-11-17 16:11 ` Scott Lewis
@ 1998-11-17 19:36 ` Chris Albertson
0 siblings, 0 replies; 8+ messages in thread
From: Chris Albertson @ 1998-11-17 19:36 UTC (permalink / raw)
To: axp-list; +Cc: Scott Lewis
Scott Lewis wrote:
>
> Well, I too am impatient. And I would really love to see what my Alpha
> can do. What language you _should_ use depends on what you are trying to
> do. Math Ops in assembly will blow the doors off of C, but I wouldn't
> want to even think about an application in assembly.
I've done a lot of assembly programming, not on Alphas, I've
worked on 250,000+ line systems in assembly. So I agree 100%
you don't want to do it. But to gain 90% of the speed advantage
all you need to do is code the inner most loops in assembly.
If you can write a convolution or FFT routine that may be all
you need to do. Normally you spend 90% of your time in only
5% of your code. Just re-write that 5%.
--
--Chris Albertson
chris@topdog.logicon.com Voice: 626-351-0089 X127
Logicon RDA, Pasadena California Fax: 626-351-0699
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Alpha's floating point performance
[not found] <Pine.LNX.3.96.981117143804.30989B-100000@bach.ce.gatech.edu>
@ 1998-11-18 21:15 ` Chris Albertson
1998-11-18 22:26 ` Mark Probst
0 siblings, 1 reply; 8+ messages in thread
From: Chris Albertson @ 1998-11-18 21:15 UTC (permalink / raw)
To: Scott Lewis; +Cc: axp-list
Scott Lewis wrote:
>
> Good point. How do _you_ call an assembly routine from C/C++?
It depends on the compiler but normally C pushes the arguments
onto the stack. The called function pops them off and places the
return value on the stack. What is placed on the stack is either
the value itself or it's address. There is a gcc option I
believe that will allow you to see the assembly generated by
the compiler. Experts can correct me but it is not hard to
mix assembly and C. Also, I have not done this with gcc, but
I think it supports in-line assembly rite there in your *.c file.
I'd like to here from someone who has done this. My experience
in this area is not with Linux/gcc. It goes back to IBM/360,
CDC6600, Perkin Elmer and CP/M Z-80.
The DEC UNIX assembly manual has examples of both C calls
assembly and assembly calls C
--
--Chris Albertson
chris@topdog.logicon.com Voice: 626-351-0089 X127
Logicon RDA, Pasadena California Fax: 626-351-0699
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Alpha's floating point performance
1998-11-18 21:15 ` Chris Albertson
@ 1998-11-18 22:26 ` Mark Probst
1998-11-18 22:41 ` Bibek Sahu
0 siblings, 1 reply; 8+ messages in thread
From: Mark Probst @ 1998-11-18 22:26 UTC (permalink / raw)
To: axp-list
On Wed, Nov 18, 1998 at 01:15:03PM -0800, Chris Albertson wrote:
> It depends on the compiler but normally C pushes the arguments
> onto the stack. The called function pops them off and places the
> return value on the stack. What is placed on the stack is either
maybe on the 80x86 architecture but surely not on a machine with
2x32 general purpose registers! calling convention on the alpha is
to pass the first six integer arguments of a function through
registers a0-a5 ($16-$21). the integer return value is returned
through $0. a function taking one 64bit argument, adding one
and returning the result would look like this:
---
.globl asm_func
.ent asm_func
asm_func:
addq $16,1,$0
jmp $31,($26)
.end asm_func
---
a little c program calling it:
---
#include <stdio.h>
long asm_func (long l);
int
main (void)
{
printf("%ld\n", asm_func(1));
return 0;
}
---
that's about it. there's really nothing much to it.
bye
schani
--
Mark Probst
Student, Programmer
http://www.unix.cslab.tuwien.ac.at/~schani/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Alpha's floating point performance
1998-11-18 22:26 ` Mark Probst
@ 1998-11-18 22:41 ` Bibek Sahu
1998-11-19 10:33 ` Mark Probst
0 siblings, 1 reply; 8+ messages in thread
From: Bibek Sahu @ 1998-11-18 22:41 UTC (permalink / raw)
To: axp-list
If you don't activate optimizations, it most certainly does push
the arguments onto the stack. And inside the function it pushes all local
variables onto the stack. But then, that's _without_ optimizations. ;-)
"gcc -S" will produce the assembler source that is built from the
C file. You give it foo.c, it gives you foo.s.
"asm" is the command to insert direct assembly in the C source.
E.g., asm( "addq $16,1,$0" );
Beyond that, I don't know much about it.
- Bob
On Wed, 18 Nov 1998, Mark Probst wrote:
> On Wed, Nov 18, 1998 at 01:15:03PM -0800, Chris Albertson wrote:
>
> > It depends on the compiler but normally C pushes the arguments
> > onto the stack. The called function pops them off and places the
> > return value on the stack. What is placed on the stack is either
>
> maybe on the 80x86 architecture but surely not on a machine with
> 2x32 general purpose registers! calling convention on the alpha is
> to pass the first six integer arguments of a function through
> registers a0-a5 ($16-$21). the integer return value is returned
> through $0. a function taking one 64bit argument, adding one
> and returning the result would look like this:
>
> ---
> .globl asm_func
>
> .ent asm_func
> asm_func:
> addq $16,1,$0
> jmp $31,($26)
>
> .end asm_func
> ---
>
> a little c program calling it:
>
> ---
> #include <stdio.h>
>
> long asm_func (long l);
>
> int
> main (void)
> {
> printf("%ld\n", asm_func(1));
> return 0;
> }
> ---
>
> that's about it. there's really nothing much to it.
>
> bye
> schani
>
> --
> Mark Probst
> Student, Programmer
> http://www.unix.cslab.tuwien.ac.at/~schani/
>
> --
> 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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Alpha's floating point performance
1998-11-18 22:41 ` Bibek Sahu
@ 1998-11-19 10:33 ` Mark Probst
0 siblings, 0 replies; 8+ messages in thread
From: Mark Probst @ 1998-11-19 10:33 UTC (permalink / raw)
To: axp-list
On Wed, Nov 18, 1998 at 04:41:40PM -0600, Bibek Sahu wrote:
> If you don't activate optimizations, it most certainly does push
> the arguments onto the stack. And inside the function it pushes all local
> variables onto the stack. But then, that's _without_ optimizations. ;-)
yes and no. i just tried it out (gcc -S test.c) and was surprised that
the arguments are pushed on the stack by the called function, not by
the caller. this means that argument passing is done the same way, namely
through registers $16-$21, which, by the way, is a must because otherwise
you could not link optimized and unoptimized code.
this is the source i compiled:
---
long
c_func (long l)
{
return l + 1;
}
---
and this is the assembler output without optimizations, annotated by
my humble self:
---
.globl c_func
.ent c_func
c_func:
c_func..ng:
lda $30,-32($30) ; allocate stack frame
.frame $15,32,$26,0
stq $26,0($30) ; push return adress
stq $15,8($30) ; push frame pointer
.mask 0x4008000,-32
bis $30,$30,$15 ; set frame pointer = stack pointer
.prologue 0
stq $16,16($15) ; push argument on stack
ldq $2,16($15) ; load argument from stack
addq $2,1,$1 ; add one to argument
bis $1,$1,$0 ; store result in result register
br $31,$33 ; jump to $33
$33:
bis $15,$15,$30 ; set stack pointer = frame pointer
ldq $26,0($30) ; load return address from stack
ldq $15,8($30) ; load frame pointer from stack
addq $30,32,$30 ; deallocate stack frame
ret $31,($26),1 ; return from subroutine
.end c_func
---
this is the optimized version (-O2):
---
.globl c_func
.ent c_func
c_func:
c_func..ng:
.frame $30,0,$26,0
.prologue 0
addq $16,1,$0 ; set result register = argument + 1
ret $31,($26),1 ; return from subroutine
.end c_func
---
bye
schani
--
Mark Probst
Student, Programmer
http://www.unix.cslab.tuwien.ac.at/~schani/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~1998-11-19 17:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-11-16 22:51 Alpha's floating point performance y0000218
1998-11-17 9:09 ` Harvey J. Stein
1998-11-17 16:11 ` Scott Lewis
1998-11-17 19:36 ` Chris Albertson
[not found] <Pine.LNX.3.96.981117143804.30989B-100000@bach.ce.gatech.edu>
1998-11-18 21:15 ` Chris Albertson
1998-11-18 22:26 ` Mark Probst
1998-11-18 22:41 ` Bibek Sahu
1998-11-19 10:33 ` Mark Probst
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox