Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* 21164 speed definitive answer
@ 1998-12-17 10:02 Thorsten Koch
  1998-12-17 17:23 ` Oscar Levi
  0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Koch @ 1998-12-17 10:02 UTC (permalink / raw)
  To: axp-list

Hello,

thanks for the answers to my question. In fact I had allready 
read the documentation, but measuring with the rpcc failed to find a 
instruction sequence that needed less than 1 cycle/instruction.

But it is possible indeed as:

addq, addq, mult, addt, addq, addq can be execute in 2 or 3 cycles

if there are no register dependencys. 
Note: this is measured not deducted from the manual.

Anyway I think I have to make a few more passes on the documentation
to find out how a given sequence is scheduled exactly.


Matti Aarnio <matti.aarnio@sonera.fi> wrote:

> No, in fact they take more -- FP multiplier has pipeline
>         latency of 8 cycles.  FP-add pipeline takes also 8 cycles.
> (archive digging --- dec21164pchwm.pdf found ...)

My documentation said FP mul/add takes 4 cycles latency

Oscar Levi <elf@buici.com> wrote:

> I'm not sure you would see any given fragment execute in less than 4
> cycles.  Instead, you might see the aggregate performance of a
> sequence of instructions be less than the sequential fetch time.

That's exactly what I was searching for. A explicit written down sequence
that actually execute in less cycles than instructions.

Robert Harley <Robert.Harley@inria.fr> wrote:

> In answer to the question: yes the 21164 can issue up to four
> instructions in one cycle under the right conditions.  The example
> given looks to me like it ought to go through in one as long as it
> is correctly aligned, but check the document mentioned in the "ALPHA
> instruction timing" thread a few days ago for a definitive answer.

Yes, I read the documentation I that that is the kind of sequence that
should run at maximum speed, because all instructions can use
a different execution unit and no register resource conflicts are
there.

BUT I measured the time using the rpcc and it says 4 cycles.
BUT what is rpcc exactly measuring?

"B. James Phillippe" <bryan@terran.org> wrote:

> We all hate repeat questions about documented information, probably as much
> as we hate getting RTFM responses. ;)  Would the other list members object
> to an automated monthly posting containing URL's to FAQ's and other sources
> of Linux/AXP documentation (our fantastic websites, etc)?  I would
> volunteer to do it if nobody else does (assuming the overhwelming majority
> of list members like the idea).  The message would not need to be large to
> be effective; even a paragraph or so would suffice, I think.

Good idea. I voluntieer to contribute a little assembly code
example. ;-)

Greetings
Thorsten
-- 
"They that can give up essential liberty to obtain a little temporary
saftey deserve neither liberty not saftey."
-- Benjamin Franklin, 1759


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 21164 speed definitive answer
  1998-12-17 13:12 Robert Harley
@ 1998-12-17 12:24 ` Matti Aarnio
  1998-12-17 15:16   ` Thorsten Koch
  0 siblings, 1 reply; 7+ messages in thread
From: Matti Aarnio @ 1998-12-17 12:24 UTC (permalink / raw)
  To: axp-list

Robert Harley wrote:
> Thorsten Koch (koch@zib.de) wrote:
> >Hello,
> >
> >thanks for the answers to my question. In fact I had allready 
> >read the documentation, but measuring with the rpcc failed to find a 
> >instruction sequence that needed less than 1 cycle/instruction.

(example deleted)
> I get:
> 
>   corton.inria.fr-bla/221 > egcs -O3 bla.c
>   corton.inria.fr-bla/222 > ./a.out
>   Average cycles = 4.024, minimum = 4.

	Which means that all BLA() macroes were running at rate of
	*one* cycle per *macro*, and that means 4 instructions per
	cycle..  .. or 0.25 cycles per instruction, if you insist..

	Of course you can't go under 1 cycle per instruction, but
	you can have zero to four instructions in execution at any
	given cycle.  It is just a matter of carefull pipeline filling
	to get things rolling at the *fastest* lane..

.... 
> Bye,
>   Rob.

/Matti Aarnio <matti.aarnio@sonera.fi>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* 21164 speed definitive answer
@ 1998-12-17 13:12 Robert Harley
  1998-12-17 12:24 ` Matti Aarnio
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Harley @ 1998-12-17 13:12 UTC (permalink / raw)
  To: axp-list

Thorsten Koch (koch@zib.de) wrote:
>Hello,
>
>thanks for the answers to my question. In fact I had allready 
>read the documentation, but measuring with the rpcc failed to find a 
>instruction sequence that needed less than 1 cycle/instruction.

Try this:

==============================================================================

#ifndef __alpha
#error Use an Alpha!
#endif

#include <stdio.h>

typedef unsigned int u32;
typedef unsigned long u64;

/*-- main ------------------------------------------------------------------*/

#define BLA() \
   asm volatile ( \
       "addt %2,%3,%0
        addq $1,$2,$3
        mult %4,%5,%1
        addq $4,$5,$6" \
        : "=f"(f3), "=f"(f6) \
        : "f"(f1), "f"(f2), "f"(f4), "f"(f5) \
        : "$1", "$2", "$3", "$4", "$5", "$6" \
        )

#define ITERS (1000UL)

int main(int argc, char *argv[]) {
  u32 cycles, minimum;
  u64 c0, c1, i, total;
  double f1,f2,f3,f4,f5,f6;

  minimum = -1U;
  total = 0UL;
  f1 = f2 = f4 = f5 = 0.0;
  for (i = 0UL; i < ITERS; ++i) {
    asm volatile (".align 4; rpcc %0" : "=r"(c0));
    BLA();
    BLA();
    BLA();
    BLA();
    asm volatile ("rpcc %0" : "=r"(c1));
    cycles = (u32)(c1-c0+(c1>>32)-(c0>>32));
    if (cycles < minimum) minimum = cycles;
    total += (u64)cycles;
  } /* end for */
  printf( "Average cycles = %g, minimum = %u.\n"
        , (double)total/(double)ITERS, minimum
        );

  return 0;
} /* end main */

==============================================================================


I get:

  corton.inria.fr-bla/221 > egcs -O3 bla.c
  corton.inria.fr-bla/222 > ./a.out
  Average cycles = 4.024, minimum = 4.


The code looks like:

  corton.inria.fr-bla/223 > egcs -O3 bla.c -S
  corton.inria.fr-bla/224 > cat bla.s
  [...]
          .align 4; rpcc $8
          addt $f12,$f13,$f10
          addq $1,$2,$3
          mult $f14,$f15,$f11
          addq $4,$5,$6
          addt $f12,$f13,$f10
          addq $1,$2,$3
          mult $f14,$f15,$f11
          addq $4,$5,$6
          addt $f12,$f13,$f10
          addq $1,$2,$3
          mult $f14,$f15,$f11
          addq $4,$5,$6
          addt $f12,$f13,$f10
          addq $1,$2,$3
          mult $f14,$f15,$f11
          addq $4,$5,$6
          rpcc $7
  [...]


Bye,
  Rob.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 21164 speed definitive answer
  1998-12-17 12:24 ` Matti Aarnio
@ 1998-12-17 15:16   ` Thorsten Koch
  0 siblings, 0 replies; 7+ messages in thread
From: Thorsten Koch @ 1998-12-17 15:16 UTC (permalink / raw)
  To: axp-list

On Thu, Dec 17, 1998 at 02:24:56PM +0200, Matti Aarnio wrote:
> 
> 	              It is just a matter of carefull pipeline filling
> 	to get things rolling at the *fastest* lane..
> 
Not only. The problem is to have the right mix of instruction at hand.
If you are not blessed with 2 INT and 2 FP instructions all the times
you loose. 

Regards,
Thorsten

-- 
"They that can give up essential liberty to obtain a little temporary
saftey deserve neither liberty not saftey."
-- Benjamin Franklin, 1759


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 21164 speed definitive answer
@ 1998-12-17 15:28 Robert Harley
  0 siblings, 0 replies; 7+ messages in thread
From: Robert Harley @ 1998-12-17 15:28 UTC (permalink / raw)
  To: axp-list

Thorsten Koch (koch@zib.de) wrote:
>The problem is to have the right mix of instruction at hand.
>If you are not blessed with 2 INT and 2 FP instructions all the times
>you loose.

Yep.

In real-life pure integer code, after optimising the inner loops a
little, I typically get a little under a billion 64-bit ops per second.

Terrible, isn't it?  =:-)

Rob.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 21164 speed definitive answer
  1998-12-17 10:02 21164 speed definitive answer Thorsten Koch
@ 1998-12-17 17:23 ` Oscar Levi
  1998-12-21  8:20   ` Thorsten Koch
  0 siblings, 1 reply; 7+ messages in thread
From: Oscar Levi @ 1998-12-17 17:23 UTC (permalink / raw)
  To: axp-list

On Thu, Dec 17, 1998 at 11:02:58AM +0100, Thorsten Koch wrote:
> > I'm not sure you would see any given fragment execute in less than 4
> > cycles.  Instead, you might see the aggregate performance of a
> > sequence of instructions be less than the sequential fetch time.
> 
> That's exactly what I was searching for. A explicit written down sequence
> that actually execute in less cycles than instructions.

Someone posted a fine example.  

Is this an academic exercise?  Or, are you doubting the
manufacturer's claims?  %^)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 21164 speed definitive answer
  1998-12-17 17:23 ` Oscar Levi
@ 1998-12-21  8:20   ` Thorsten Koch
  0 siblings, 0 replies; 7+ messages in thread
From: Thorsten Koch @ 1998-12-21  8:20 UTC (permalink / raw)
  To: axp-list

On Thu, Dec 17, 1998 at 09:23:00AM -0800, Oscar Levi wrote:
> On Thu, Dec 17, 1998 at 11:02:58AM +0100, Thorsten Koch wrote:
> > > I'm not sure you would see any given fragment execute in less than 4
> > > cycles.  Instead, you might see the aggregate performance of a
> > > sequence of instructions be less than the sequential fetch time.
> > 
> > That's exactly what I was searching for. A explicit written down sequence
> > that actually execute in less cycles than instructions.
> 
> Someone posted a fine example.  
> 
> Is this an academic exercise?  Or, are you doubting the
> manufacturer's claims?  %^)

Neither. These are my first steps into axp assembler ;-). The reason I was
mislead was that I used only FP instructions and Loads/Stores in the code.
And since the FP`s have a latency of 4 it's quite difficult to get more
than four instructions per cycle. 

Thorsten
-- 
"They that can give up essential liberty to obtain a little temporary
saftey deserve neither liberty not saftey."
-- Benjamin Franklin, 1759


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1998-12-21  8:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-12-17 10:02 21164 speed definitive answer Thorsten Koch
1998-12-17 17:23 ` Oscar Levi
1998-12-21  8:20   ` Thorsten Koch
  -- strict thread matches above, loose matches on Subject: below --
1998-12-17 13:12 Robert Harley
1998-12-17 12:24 ` Matti Aarnio
1998-12-17 15:16   ` Thorsten Koch
1998-12-17 15:28 Robert Harley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox