Groups | Search | Server Info | Login | Register


Groups > comp.arch > #5724

Re: Are rotating register files still a bad idea?

Message-ID <4F2EF96A.1040107@SPAM.comp-arch.net> (permalink)
Date 2012-02-05 13:49 -0800
From "Andy (Super) Glew" <andy@SPAM.comp-arch.net>
Organization comp-arch.net
Newsgroups comp.arch
Subject Re: Are rotating register files still a bad idea?
References <ggtgp-A1F9BB.02163102022012@netnews.mchsi.com> <4F2CD63A.4050306@SPAM.comp-arch.net> <ggtgp-25AEB5.07151604022012@netnews.mchsi.com>

Show all headers | View raw


On 2/4/2012 5:15 AM, Brett Davis wrote:
> In article<4F2CD63A.4050306@SPAM.comp-arch.net>,
>   "Andy (Super) Glew"<andy@SPAM.comp-arch.net>  wrote:
>
>> On 2/2/2012 12:16 AM, Brett Davis wrote:
>>>
>>> Do rotating register files buy you anything net after costs,
>>> or is it just a fiasco in the age of modern OoO pipelines?
>>
>> When I first saw your post, I thought that you were talking about the
>> rotating register file that Cydrome and Itanium had, that could be made
>> to rotate on every loop iteration, and not SPARC-style overlapping
>> register windows (which Itanium also had).
>
> Opps, wrong terminology, meant register windows.
>
> That Itanium had both types of register rotation made me wince.

Me, too.  And yet I can see nice aspecys of both rotating register files 
for loops and register windows for call/returns, etc.

Oftentimes, when there is more than one good way to extend an 
architecture, like here, but where they conflict - often, in such 
situations, it is better to do neither.

Although let me note one thing: rotating register files don't change the 
number of registers that need to be renamed.  They just mean that you 
either need to rotate the renamings in the register alias table, or that 
you do some arithmetic on the logical register number before it is renamed.

Register windows, on the other hand, increase the number of registers 
that need to be renamed. This was a killer for Itanium.  I tried playing 
games such as renaming only the currently accessible registers (on 
Itanium even that was a lot), or the top few procedure contexts, 
stalling until retirement and renaming had settled down if you called 
and returned too quickly.  But this forces you into a copy at retirement 
model.


>> I actually think that Cydrome state rotating register files may be a
>> good idea, albeit neglected.  They allow software pipelining to be done
>> without requiring reg-reg moves and give many of the benefits of loop
>> unrolling without increasing code size.
>
> On actual rotating registers
> http://www.cs.nmsu.edu/~rvinyard/itanium/register_rotation.htm
>
> I do not see that rotating registers have a point when you are OoO
> with 100 instructions in process. The hardware unrolls loops for you.

And yet people insist of unrolling loops for OOO processors.  And it 
often pays off.

E.g. I have been looking at a loop recently that is 9 instructions long, 
of which only 5 are real work. 4 of 9 are overhead - loop induction 
variables and and branch.  And it fills the machine, maximal IPC.  So 
any unrolling that can reduce the overhead per iteration, eliminating 
any of those overhead instructions, very likely improves performance. 
At the cost of code size.

Unfortunately, rotating registers does not help this aspect of loop 
unrolling - reducing the induction variable overhead.

Rotating registers DOES reduce the code scheduling overhead of loop 
unrolling.

Hmm...

>
> I work in embedded with limited OoO and only 6 ops in flight, which
> means I unroll loops. Rotating registers could help, but there is
> so much other baggage and setup that I do not see a embedded chip
> going down that road. Compiler support is the killer.
>
> You still have the prolog and epilogue plus some setup, all you
> save is one or two register copies, per loop. so ~5% fewer
> instructions which means 5% faster. I can sneeze on the code and
> get a 5% speedup.

If by prologue and epilogue you mean the code that ramps up to the full, 
maximally scheduled, loop body, and then ramps down, then, no, you don't 
need that.  One of the features of rotating register files is that the 
maximally scheduled loop body has loop predicates, that allow the 
prologue and epilogue to be folded in.

(However, I suspect that the ramp up/down code obtained in this way is 
sub-optimal.  Which means that you tradeoff the lower code size, for 
lower performance on small loop counts.


> With 32 registers that means half would rotate, sucky, you need
> at least 64 registers. The Console guys might consider it, they
> have 128 floats/vectors and are mostly in-order.

??  Where do you get "half would rotate"?

That's a number TBD.

The circuit is basically

post_rotation_regnum :=
      if( pre_rotation_regnum & rotmask == rotbase )
      then (((pre_rotation_regnum & ~rotmask)
		+ rotcount) & ~rotmask)
	       | rotbase)
      else pre_rotation_regnum

which I have expressed suboptimally for clarity.

With the above you can make the rotating region any power of two size, 
and any naturaly aligned section of the register file.


>
> Now that Itanic is dead I do not have an axe to grind, I am willing
> to give anything Itanium did a second look. Better yet Cydrome.
>
> On my third look I noticed that you can sometimes fold the
> prolog and epilogue into the loop, it makes my head hurt and you
> do not want to do this if you end up canceling a large number of ops,
> which is exactly what will happen most of the time. Defeats the purpose.
> You save ~six instructions at the cost of burning ~two dozen in the loop.

No, that's exactly my concern.  I think they oversold the benefits of 
rotating loop predicates.  I would reexamined with and without.

Back to comp.arch | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Are rotating register files still a bad idea? Brett Davis <ggtgp@yahoo.com> - 2012-02-02 02:16 -0600
  Re: Are rotating register files still a bad idea? "Paul A. Clayton" <paaronclayton@gmail.com> - 2012-02-02 07:41 -0800
  Re: Are rotating register files still a bad idea? Nomen Nescio <nobody@dizum.com> - 2012-02-02 19:04 +0100
    Re: Are rotating register files still a bad idea? Brett Davis <ggtgp@yahoo.com> - 2012-02-02 23:16 -0600
      Re: Are rotating register files still a bad idea? Fritz Wuehler <fritz@spamexpire-201202.rodent.frell.theremailer.net> - 2012-02-03 18:19 +0100
        Re: Are rotating register files still a bad idea? Anne & Lynn Wheeler <lynn@garlic.com> - 2012-02-03 13:09 -0500
          Re: Are rotating register files still a bad idea? Stephen Fuld <SFuld@alumni.cmu.edu.invalid> - 2012-02-03 12:28 -0800
          Re: Are rotating register files still a bad idea? MitchAlsup <MitchAlsup@aol.com> - 2012-02-03 13:04 -0800
        Re: Are rotating register files still a bad idea? Thomas Womack <twomack@chiark.greenend.org.uk> - 2012-02-03 19:15 +0000
          Re: Are rotating register files still a bad idea? Mark Thorson <nospam@sonic.net> - 2012-02-03 13:08 -0800
            Re: Are rotating register files still a bad idea? Thomas Womack <twomack@chiark.greenend.org.uk> - 2012-02-03 22:21 +0000
              Re: Are rotating register files still a bad idea? Mark Thorson <nospam@sonic.net> - 2012-02-03 18:42 -0800
                Re: Are rotating register files still a bad idea? Glen Overby <coreSPAMsample@charter.net> - 2012-03-01 18:18 -0600
            Re: Are rotating register files still a bad idea? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-04 13:26 +0000
            Re: Are rotating register files still a bad idea? Fritz Wuehler <fritz@spamexpire-201202.rodent.frell.theremailer.net> - 2012-02-05 00:58 +0100
          Re: Are rotating register files still a bad idea? Nomen Nescio <nobody@dizum.com> - 2012-02-04 21:00 +0100
            Re: Are rotating register files still a bad idea? Brett Davis <ggtgp@yahoo.com> - 2012-02-05 00:35 -0600
        Re: Are rotating register files still a bad idea? Quadibloc <jsavard@ecn.ab.ca> - 2012-02-03 10:11 -0800
  Re: Are rotating register files still a bad idea? jgk@panix.com (Joe keane) - 2012-02-03 23:20 +0000
  Re: Are rotating register files still a bad idea? "Andy (Super) Glew" <andy@SPAM.comp-arch.net> - 2012-02-03 22:54 -0800
    Re: Are rotating register files still a bad idea? Brett Davis <ggtgp@yahoo.com> - 2012-02-04 07:15 -0600
      Re: Are rotating register files still a bad idea? "Andy (Super) Glew" <andy@SPAM.comp-arch.net> - 2012-02-05 13:49 -0800
        Re: Are rotating register files still a bad idea? Brett Davis <ggtgp@yahoo.com> - 2012-02-06 05:36 -0600
          Re: Are rotating register files still a bad idea? "Andy (Super) Glew" <andy@SPAM.comp-arch.net> - 2012-02-06 18:46 -0800
            Re: Are rotating register files still a bad idea? Brett Davis <ggtgp@yahoo.com> - 2012-02-28 20:02 -0600
        Re: Are rotating register files still a bad idea? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-02-06 12:49 +0000
      Re: Are rotating register files still a bad idea? Quadibloc <jsavard@ecn.ab.ca> - 2012-02-04 11:14 -0800
  Re: Are rotating register files still a bad idea? Michael S <already5chosen@yahoo.com> - 2012-02-03 06:04 -0800
  Re: Are rotating register files still a bad idea? MitchAlsup <MitchAlsup@aol.com> - 2012-02-03 12:20 -0800

csiph-web