Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Michael Gschwind <mikeg@watson.ibm.com>
Subject: Re: 21264 performance anomalies (was: Compaq to port ...)
Date: 1999/04/11	[thread overview]
Message-ID: <3710F546.CBA9A872@watson.ibm.com> (raw)
In-Reply-To: 7ej80q$o1a$1@news.tuwien.ac.at



Anton Ertl wrote:

>
> Here's what egcs-1.03 produces for the first NEXT:
>
> 0x120000690 <main+16>:  ldah    t2,153(t2)
> next:
> 0x120000694 <main+20>:  ldq     t0,0(t1)
> 0x120000698 <main+24>:  addq    t1,0x8,t1
> 0x12000069c <main+28>:  jmp     zero,(t0),0x1200006a0 <main+32>
>
> This takes 3.45s (~17 cycles/NEXT)

The following behavior may be explained by the cache architecture?

Here a short description of the prefetch unit on the 21264, a more detailed
discussion can probably be found in Microprocessor Report (just don't read the
sections which explain why Intel will inevitably win...)

Each line in the instruction cache holds four instructions along with
a "next-line" predictor and a set predictor. These two fields
are immediately sent back to the cache inputs to start the next
access. If the line contains a branch that is predicted taken, the
predictor fields point to the cache line and set of the predicted
target; otherwise, they simply point to the next sequential
address.



>
>
> Here are various variations on this code, with instructions before the
> "next:" jump target in parentheses:
>
> 0x1200006a0    ldq      (nop)   (ldah)   (addq)   nop
> 0x1200006a4    addq     ldq     ldq      ldq      nop
> 0x1200006a8    jmp      addq    addq     addq     ldq
> 0x1200006ac             jmp     jmp      jmp      addq
> 0x1200006b0                                       jmp
>                1.12s    2.56s   3.48s    3.45s    0.72s
>
> The conclusions I draw are:
>
> 1) Code should be aligned to 16-byte boundaries; Penalty for
> non-conformance: ~8 cycles/NEXT in this benchmark. Why so much?

Yoy probably read the whole line, whether you need it or not -- the fetch
probably decodes the whole line also, since the predictor described above does
not actually indicate that you know WHERE in the line you will land...  you
later may have to discard those instructions?

>
>
> 2) In an unaligned block the kind of instruction *before* the jump
> target does play a role.  nops are cheap, while the other instructions
> I tried apparently cost another ~5 cycles/NEXT. Why is that and why so
> much?

Maybe the architecture always decodes everything, even if it would not have to
-- see above... NOPs would be cheaper in this scheme of things.

>
>
> 3) Pushing the jmp into the next 16-byte block by adding nops saves
> ~2cycles/NEXT.  Why?
>

Two guesses for (3)
1 - Some bias for double word aligned lines (one MUX level less), combined with
the cheapness of NOPs?
2 - Maybe the architects tried to be really smart about this, and can get the
branch for free with some trickery, e.g., set the current lines next line
predictor to itself and skip the branch??? This is just a wild guess, since to
actually get something like this correct could be truely painful...

M. Gschwind
IBM TJ Watson

Disclaimer: All the above are my personal opinions only, and in no way reflect
my employer's opinions.




  parent reply	other threads:[~1999-04-11  4:00 UTC|newest]

Thread overview: 114+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-06  4:00 Compaq to port its Fortran and C compilers to Alpha Linux Steve Lionel
1999-04-07  4:00 ` NewsMan
1999-04-06  4:00   ` Jeffrey J. Potoff
1999-04-06  4:00     ` Ron Flory
1999-04-07  4:00     ` Ben Pfaff
1999-04-07  4:00       ` Jim Klein
1999-04-07  4:00       ` Peter Mardahl
1999-04-07  4:00       ` bmeyer
1999-04-07  4:00       ` Greg Lindahl
1999-04-07  4:00         ` Toon Moene
1999-04-08  4:00           ` Anton Ertl
1999-04-08  4:00             ` Toon Moene
1999-04-08  4:00               ` 21264 performance anomalies (was: Compaq to port ...) Anton Ertl
1999-04-09  4:00                 ` P Dickerson
1999-04-09  4:00                   ` Anton Ertl
1999-04-10  4:00                   ` Bruce Hoult
1999-04-14  4:00                     ` 21264 performance anomalies Robert Herndon
1999-04-14  4:00                       ` Dennis Ritchie
1999-04-15  4:00                         ` Erik Corry
1999-04-15  4:00                           ` Dave Cherkus
1999-04-15  4:00                             ` Erik Corry
1999-04-15  4:00                               ` Dave Cherkus
1999-04-15  4:00                                 ` Linus Torvalds
1999-04-15  4:00                                   ` Jim Gettys
1999-04-15  4:00                                   ` Dave Cherkus
1999-04-18  4:00                             ` Bernd Paysan
1999-04-18  4:00                               ` How hard would it be to improve gcc's performance to match DEC CC? Peter Mardahl
1999-04-19  4:00                                 ` TTK Ciar
1999-04-19  4:00                               ` 21264 performance anomalies Dave Cherkus
1999-04-20  4:00                                 ` Larry Kilgallen
1999-04-21  4:00                                   ` Bernd Paysan
1999-04-21  4:00                                     ` Greg Lindahl
1999-04-22  4:00                                       ` Terje Mathisen
1999-04-22  4:00                                         ` Greg Lindahl
1999-04-22  4:00                                     ` Jan Vorbrueggen
1999-04-22  4:00                                       ` Larry Kilgallen
1999-04-22  4:00                                         ` Paul DeMone
1999-04-23  4:00                                           ` Jan Vorbrueggen
1999-04-23  4:00                                             ` Paul DeMone
1999-04-24  4:00                                               ` Zalman Stern
1999-04-23  4:00                                                 ` Donald C. Lindsay
1999-05-09  4:00                                               ` TTK Ciar
1999-05-11  4:00                                                 ` Peter Mayne
1999-04-22  4:00                                         ` Fred Kleinsorge
1999-04-22  4:00                                           ` John Pieper
1999-04-22  4:00                                           ` Thomas Womack
1999-04-19  4:00                               ` peter
1999-04-20  4:00                               ` Larry Kilgallen
1999-04-22  4:00                               ` Anton Ertl
1999-04-16  4:00                         ` first-class labels (was: 21264 performance anomalies) Anton Ertl
1999-04-15  4:00                       ` 21264 performance anomalies amos
1999-04-11  4:00                 ` Donald C. Lindsay
1999-04-12  4:00                   ` Justin Carlson
1999-04-14  4:00                     ` Anton Ertl
1999-04-14  4:00                       ` Jan Vorbrueggen
1999-04-14  4:00                       ` Justin Carlson
1999-04-11  4:00                 ` Michael Gschwind [this message]
1999-04-08  4:00               ` Compaq to port its Fortran and C compilers to Alpha Linux James D. Freels
1999-04-09  4:00                 ` Greg Lindahl
1999-04-11  4:00                 ` Michal Jaegermann
1999-04-09  4:00             ` Jim Gettys
1999-04-09  4:00               ` Toon Moene
1999-04-09  4:00                 ` Jim Gettys
1999-04-09  4:00               ` Anton Ertl
1999-04-09  4:00             ` bmeyer
1999-04-09  4:00               ` Anton Ertl
1999-04-09  4:00                 ` Jim Gettys
1999-04-08  4:00         ` Keith Higgs
1999-04-07  4:00       ` Jeffrey J. Potoff
1999-04-09  4:00       ` Daniel Barker
1999-04-10  4:00       ` Phillip Helbig
1999-04-10  4:00         ` Christopher B. Browne
1999-04-10  4:00           ` James D. Freels
1999-04-11  4:00             ` Christopher B. Browne
1999-04-11  4:00           ` Zane H. Healy
1999-04-11  4:00             ` James Van Buskirk
1999-04-11  4:00               ` Greg Lindahl
1999-04-12  4:00                 ` Glenn C. Everhart
1999-04-19  4:00                   ` Bob Koehler
1999-04-19  4:00                     ` Jim Reiss
1999-04-12  4:00                 ` James Van Buskirk
1999-04-14  4:00                   ` Greg Lindahl
1999-04-12  4:00                 ` Robert Harley
1999-04-12  4:00                   ` Phillip Helbig
1999-04-12  4:00                     ` Greg Lindahl
1999-04-12  4:00               ` Richard Levitte - VMS Whacker
1999-04-11  4:00             ` Greg Lindahl
1999-04-11  4:00         ` Toon Moene
1999-04-07  4:00     ` Gary Scott
1999-04-07  4:00       ` Toon Moene
1999-04-07  4:00     ` Paul English
1999-04-07  4:00       ` Dave Cherkus
1999-04-07  4:00         ` essoft
1999-04-08  4:00           ` bmeyer
1999-04-09  4:00         ` Richard Heathfield
1999-04-09  4:00           ` Dave Cherkus
1999-04-07  4:00       ` Greg Lindahl
1999-04-07  4:00   ` Steve Lionel
1999-04-07  4:00     ` Peter Mardahl
1999-04-07  4:00       ` Ron Flory
1999-04-07  4:00         ` Helmut Katzgraber
1999-04-08  4:00           ` Steve Lionel
1999-04-08  4:00             ` Helmut Katzgraber
1999-04-08  4:00               ` Steve Lionel
1999-04-09  4:00                 ` Dave Cherkus
1999-04-09  4:00                   ` Steve Lionel
1999-04-09  4:00                     ` Christopher B. Browne
1999-04-08  4:00       ` Udo Klasmeier
1999-04-09  4:00         ` Jacob Gladish
1999-04-10  4:00   ` Phillip Helbig
1999-04-10  4:00     ` Christopher B. Browne
1999-04-15  4:00     ` Jim Gettys
1999-04-12  4:00 ` Christian Simmendinger
1999-04-15  4:00   ` Dr. Scott A. Furman
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