"MitchAlsup" <
Mitch...@aol.com> wrote in message
news:5c8cbd5a-c16a-4236...@googlegroups.com...
> On Monday, September 2, 2013 9:05:17 AM UTC-5, James Harris wrote:
> > Is there any consensus on the ideal number of integer and FP registers a
> > CPU
> > *should* have in order to efficiently execute most common algorithms?
> >
> In general, there is no consensus; however, most of the RISC machines used
> 32 Int and 32 FP registers. So that may be some kind of consensus.
Thanks, though I was thinking more about consensus from the viewpoint of
algorithms rather than implementations. I thought there might be a consensus
on how many registers a CPU ought to provide in order to maintain values
over the iterations of the loops of common algorithms. Naturally, it will
depend on the algorithm but I presumed there might be an accepted number
that CPU designers aim for.
I don't know what the designers of the various RISC machines thought but
w.r.t. their common provision of 32 registers it seems at least possible
that once the decision had been made for some of those machines to use 32
bits per instruction there was the temptation to provide more registers
simply because there was so much encoding space available. Even with three
register operands per instruction and five bits per register there are still
17 bits left to encode the rest of the instruction. Apart from the encoding
of immediate values that's a lot of room to encode opcode and other stuff.
> >
> > Some thoughts on the basics:
> >
> > Disadvantages of smaller register sets
> >
> > * Register spilling needed for more algorithms.
> Stak machines (0-registers) suffer little from this. Also spilling to the
> stack results in good hit rates for the reload operation, and few stack
> misses for the write operation.
Stack machines are great in some ways. They might be able to handle the top
part of the evaluation stack in registers and have the potential to be very
efficient at spilling/restoring the lower parts of the stack because all
such accesses can be a cache line at a time. They can also encode
instructions in a tiny amount of space. However, AFAICS they would tend to
have to process instructions serially because all ALU ops work on one common
stack. To allow overlapping of instructions, AFAIK CPU designs have
generally gone over to a set-of-registers model.
> > * Fewer regs available for parameter passing.
> 4-5 registers is over the knee of the curve for parameter passing.
> >
> >
> > Disadvantages of larger register sets
> > * More state to save and load
> > - increased interrupt latency
> Not if the interrupt routine has a spare set of registers!
> > - slower task switch.
> Not if the register swap is done in the background!
The idea of swapping registers in the background sounds like it could be
helpful. Is there an accepted name for it, something that can be
web-searched?
> >
> > * Slower to access (capacitive effects).
> Easily hidden in the pipeline.
> > For example, to hold integers and pointers:
> >
> > * 15 integer registers for load-store architectures.
> How amny would you need for a CDC6600-like architecture--which is sort-of
> load/store and different at the same time.
> > * 7 integer registers for architectures which allow one or more operands
> > to
> I would venture closer to 12 than 7.
I presume that means that 12 values may need to change during each iteration
of certain loops with any other values being read-only and coming from
memory/cache. Twelve is a surprisingly large number but it's the kind of
info I wanted. It suggests a minimum of 16 integer registers would be
desirable even for a register-memory architecture.
> > be in memory.
> >
> >
> >
> > To hold floating point values
> > * 16 FP registers for load-store architectures.
> My guess is that the consensus, here, is that one wants at least 32 double
> precision FP registers.
> > * 8 FP registers where one or more operands can be in memory.
> Closer to 24.
Thanks.
> >
> > (For the integer cases I have reserved one for a stack pointer.)
> >
> > For whatever the answer is for the above how would the answer change if,
> > rather than having one bank of integer registers and one bank of FP
> > registers, the integer and FP instructions operated on the same register
> > set?
>
> I have always been a fan of combined registers, however, in a combined
> register set one will want at least 32 double precision registers. This is
> well over the knee of the curve for integers, and close enough to the knee
> of the curve for FP. It is no where close to the knee of the curve when
> registers are used programatically to absorb memory latency (where you end
> up needing 256+ registers.
I am thinking principally about encoding space at the moment, i.e. how many
bits to designate in each instruction to encode a register. I have some
other ideas about dealing with memory latency which may tie in with your
comment, above, on swapping registers in the background.
Good to hear that combined registers are acceptable. I wasn't sure whether
my suggesting them would invoke howls of derision. ;-)
James