Sujet : Re: Why I've Dropped In
De : mitchalsup (at) *nospam* aol.com (MitchAlsup1)
Groupes : comp.archDate : 17. Jun 2025, 22:18:29
Autres entêtes
Organisation : Rocksolid Light
Message-ID : <1b5ee221db363b8e3a6ef79dc4bfa261@www.novabbs.org>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Rocksolid Light
On Tue, 17 Jun 2025 20:43:00 +0000, Stefan Monnier wrote:
MitchAlsup1 [2025-06-17 17:45:23] wrote:
On Tue, 17 Jun 2025 1:26:01 +0000, Stephen Fuld wrote:
On 6/16/2025 9:17 AM, Stefan Monnier wrote:
I vaguely remember reading somewhere that it doesn't have to be too bad:
e.g. if you reduce register-specifiers to just 4bits for a 32-register
architecture and kind of "randomize" which of the 16 values refer to
which of the 32 registers for each instruction, it's fairly easy to
adjust a register allocator to handle this correctly (assuming you
choose your instructions beforehand, you simply mark, for each
instructions, the unusable registers as "interfering"), and the end
result is often almost as good as if you had 5bits to specify
the registers.
I can see that it isn't too hard on the logic for the register
allocator,
You are missing the BIG problem::
>
Register allocator allocated Rk for calculation j and later allocates
Rm for instruction p, then a few instructions later the code generator
notices that Rk and RM need to be paired or shared and they were not
originally.
>
What do you mean by "a few instructions later"? The above was stated in
the context of a register allocator based on something like Chaitin's
algorithm, which does not proceed "instruction by instruction" but
instead takes a whole function (or basic bloc), builds an interference
graph from it, then chooses registers for the vars looking only at that
interference graph.
I am regurgitating conversations I have had with compile people over
the last 40 years. Noting I have seen in ISA design has moderated
these problems--but I, personally, have not been inside a compiler
for 41 years, either (1983). So, find a compiler writer to set this
record straight. I continue to be told: it is enough harder that you
should design ISA so you don't need pairing or sharing, ever.
but I suspect it will lead to more register saving and
restoring.
And reg-reg MOVment.
>
Of course. The point is simply that in practice (for some particular
compiler at least), the cost of restricting register access by using
only 4bits despite the existence of 32 registers was found to be small.
>
Note also that you can reduce this cost by relaxing the constraint and
using 5bit for those instructions where there's enough encoding space.
(or inversely, increase the cost by using yet fewer bits for those
instructions where the encoding space is really tight).
>
There's also a good chance that you can further reduce the cost by using
a sensible mapping from 4bit specifiers instead a randomized one.
>
IOW, the point is that just because you have chosen to have 2^N
registers in your architecture doesn't mean you have to offer access to
all 2^N registers in every instruction that can access registers.
It's clearly more convenient if you can offer that access, but if needed
you can steal a bit here and there without having too serious an impact
on performance.
>
Consider a two instruction sequence where the output of the
first instruction is an input to the second. The first instruction has
only a choice of 16 registers, not 32. And the second instruction also
has 16 registers, but on average only half of them will be in the 16
included in the first instruction. So instead of 32 registers to chose
from you only have 8.
>
Right. But in practice, the register allocator can often choose the
rest of the register assignment such that one of those 8 is available.
>
>
Stefan
Date | Sujet | # | | Auteur |
19 May 25 | Why I've Dropped In | 417 | | quadibloc |
19 May 25 |  Re: Why I've Dropped In | 349 | | quadibloc |
21 May 25 |   Re: Why I've Dropped In | 348 | | quadibloc |
22 May 25 |    Re: Why I've Dropped In | 11 | | David Chmelik |
22 May 25 |     Re: Why I've Dropped In | 2 | | MitchAlsup1 |
23 May 25 |      Re: Why I've Dropped In | 1 | | MitchAlsup1 |
10 Jun 25 |     Re: Why I've Dropped In | 8 | | quadibloc |
11 Jun 25 |      Re: Why I've Dropped In | 1 | | BGB |
11 Jun 25 |      Re: Why I've Dropped In | 6 | | quadibloc |
11 Jun 25 |       Re: Why I've Dropped In | 4 | | Chris M. Thomasson |
12 Jun 25 |        Re: Why I've Dropped In | 3 | | quadibloc |
12 Jun 25 |         Re: Why I've Dropped In | 1 | | Chris M. Thomasson |
16 Jun 25 |         Re: Why I've Dropped In | 1 | | Chris M. Thomasson |
12 Jun 25 |       Re: Why I've Dropped In | 1 | | quadibloc |
10 Jun 25 |    Re: Why I've Dropped In | 335 | | quadibloc |
11 Jun 25 |     Re: Why I've Dropped In | 322 | | Thomas Koenig |
11 Jun 25 |      Re: Why I've Dropped In | 23 | | BGB |
11 Jun 25 |       Re: Why I've Dropped In | 8 | | MitchAlsup1 |
11 Jun 25 |        Re: Why I've Dropped In | 7 | | BGB |
12 Jun 25 |         Re: Why I've Dropped In | 6 | | MitchAlsup1 |
12 Jun 25 |          Re: Why I've Dropped In | 5 | | BGB |
13 Jun 25 |           Re: Why I've Dropped In | 4 | | MitchAlsup1 |
15 Jun 25 |            Re: Why I've Dropped In | 3 | | BGB |
15 Jun 25 |             Re: Why I've Dropped In | 2 | | MitchAlsup1 |
15 Jun 25 |              Re: Why I've Dropped In | 1 | | BGB |
11 Jun 25 |       Re: Why I've Dropped In | 10 | | Anton Ertl |
11 Jun 25 |        Re: Why I've Dropped In | 6 | | MitchAlsup1 |
12 Jun 25 |         Re: Why I've Dropped In | 5 | | MitchAlsup1 |
12 Jun 25 |          Re: Why I've Dropped In | 4 | | Anton Ertl |
12 Jun 25 |           Re: Why I've Dropped In | 2 | | MitchAlsup1 |
20 Jun 25 |            Re: Why I've Dropped In | 1 | | Anton Ertl |
12 Jun 25 |           Re: Why I've Dropped In | 1 | | Thomas Koenig |
11 Jun 25 |        Re: Why I've Dropped In | 3 | | BGB |
12 Jun 25 |         Re: Why I've Dropped In | 2 | | Anton Ertl |
12 Jun 25 |          Re: Why I've Dropped In | 1 | | BGB |
20 Jun 25 |       Re: Why I've Dropped In | 4 | | quadibloc |
20 Jun 25 |        Re: Why I've Dropped In | 3 | | MitchAlsup1 |
20 Jun 25 |         Re: Why I've Dropped In | 2 | | moi |
20 Jun 25 |          Re: Why I've Dropped In | 1 | | quadibloc |
11 Jun 25 |      Re: Why I've Dropped In | 298 | | quadibloc |
11 Jun 25 |       Re: Why I've Dropped In | 19 | | MitchAlsup1 |
11 Jun 25 |        Re: Why I've Dropped In | 3 | | quadibloc |
11 Jun 25 |         Re: Why I've Dropped In | 2 | | MitchAlsup1 |
14 Jun 25 |          Re: Why I've Dropped In | 1 | | BGB |
16 Jun 25 |        Re: Why I've Dropped In | 15 | | Stefan Monnier |
17 Jun 25 |         Re: Why I've Dropped In | 1 | | quadibloc |
17 Jun 25 |         Re: Why I've Dropped In | 13 | | Stephen Fuld |
17 Jun 25 |          Re: Why I've Dropped In | 12 | | MitchAlsup1 |
17 Jun 25 |           Re: Why I've Dropped In | 1 | | Stephen Fuld |
17 Jun 25 |           Re: Why I've Dropped In | 10 | | Stefan Monnier |
17 Jun 25 |            Re: Why I've Dropped In | 6 | | MitchAlsup1 |
17 Jun 25 |             Re: Why I've Dropped In | 5 | | Stefan Monnier |
18 Jun 25 |              Re: Why I've Dropped In | 4 | | Anton Ertl |
18 Jun 25 |               Re: Why I've Dropped In | 2 | | Stefan Monnier |
19 Jun 25 |                Re: Why I've Dropped In | 1 | | Anton Ertl |
18 Jun 25 |               Re: Why I've Dropped In | 1 | | BGB |
18 Jun 25 |            Re: Why I've Dropped In | 3 | | Chris M. Thomasson |
18 Jun 25 |             Re: Why I've Dropped In | 2 | | Stefan Monnier |
20 Jun 25 |              Re: Why I've Dropped In | 1 | | Chris M. Thomasson |
11 Jun 25 |       Re: Why I've Dropped In | 198 | | Thomas Koenig |
12 Jun 25 |        Re: Why I've Dropped In | 197 | | quadibloc |
12 Jun 25 |         Re: Why I've Dropped In | 193 | | Stephen Fuld |
13 Jun 25 |          Re: Why I've Dropped In | 54 | | quadibloc |
13 Jun 25 |           Re: Why I've Dropped In | 53 | | Stephen Fuld |
13 Jun 25 |            Re: Why I've Dropped In | 52 | | Thomas Koenig |
13 Jun 25 |             Re: Why I've Dropped In | 1 | | quadibloc |
13 Jun 25 |             Re: Why I've Dropped In | 50 | | Stephen Fuld |
13 Jun 25 |              Re: Why I've Dropped In | 49 | | Thomas Koenig |
13 Jun 25 |               Re: Why I've Dropped In | 21 | | Stephen Fuld |
13 Jun 25 |                Re: Why I've Dropped In | 19 | | Thomas Koenig |
13 Jun 25 |                 Re: Why I've Dropped In | 2 | | MitchAlsup1 |
15 Jun 25 |                  Re: Why I've Dropped In | 1 | | Stephen Fuld |
13 Jun 25 |                 Re: Why I've Dropped In | 1 | | Stephen Fuld |
15 Jun 25 |                 Re: base and bounds, Why I've Dropped In | 15 | | John Levine |
15 Jun 25 |                  Re: base and bounds, Why I've Dropped In | 13 | | Stephen Fuld |
15 Jun 25 |                   Re: base and bounds, Why I've Dropped In | 12 | | John Levine |
15 Jun 25 |                    Re: base and bounds, Why I've Dropped In | 9 | | MitchAlsup1 |
16 Jun 25 |                     Re: base and bounds, Why I've Dropped In | 7 | | Stephen Fuld |
16 Jun 25 |                      Re: base and bounds, Why I've Dropped In | 2 | | quadibloc |
16 Jun 25 |                       Re: base and bounds, Why I've Dropped In | 1 | | Stephen Fuld |
16 Jun 25 |                      Re: base and bounds, Why I've Dropped In | 4 | | MitchAlsup1 |
16 Jun 25 |                       Re: base and bounds, Why I've Dropped In | 3 | | Stephen Fuld |
16 Jun 25 |                        Re: base and bounds, Why I've Dropped In | 2 | | quadibloc |
16 Jun 25 |                         Re: base and bounds, Why I've Dropped In | 1 | | Stephen Fuld |
16 Jun 25 |                     Re: base and bounds, Why I've Dropped In | 1 | | quadibloc |
15 Jun 25 |                    Re: base and bounds, Why I've Dropped In | 2 | | Stephen Fuld |
16 Jun 25 |                     Re: base and bounds, Why I've Dropped In | 1 | | John Levine |
16 Jun 25 |                  Re: big pages, base and bounds, Why I've Dropped In | 1 | | John Levine |
13 Jun 25 |                Re: Why I've Dropped In | 1 | | Lars Poulsen |
13 Jun 25 |               Re: Why I've Dropped In | 1 | | MitchAlsup1 |
13 Jun 25 |               Re: Why I've Dropped In | 26 | | quadibloc |
14 Jun 25 |                Re: Why I've Dropped In | 25 | | Thomas Koenig |
14 Jun 25 |                 Re: Why I've Dropped In | 24 | | Stephen Fuld |
14 Jun 25 |                  Re: Why I've Dropped In | 3 | | Thomas Koenig |
14 Jun 25 |                   Re: Why I've Dropped In | 2 | | Stephen Fuld |
14 Jun 25 |                    Re: Why I've Dropped In | 1 | | Thomas Koenig |
14 Jun 25 |                  Re: Why I've Dropped In | 14 | | Stephen Fuld |
14 Jun 25 |                   Re: Why I've Dropped In | 13 | | quadibloc |
14 Jun 25 |                    Re: Why I've Dropped In | 1 | | Stephen Fuld |
14 Jun 25 |                    Re: Why I've Dropped In | 11 | | quadibloc |
15 Jun 25 |                     Re: Why I've Dropped In | 10 | | Stephen Fuld |
15 Jun 25 |                  Re: Why I've Dropped In | 6 | | quadibloc |
13 Jun 25 |          Re: Why I've Dropped In | 134 | | quadibloc |
14 Jun 25 |          Re: base registers and addres size, Why I've Dropped In | 3 | | John Levine |
18 Jun 25 |          Re: Why I've Dropped In | 1 | | Lynn Wheeler |
13 Jun 25 |         Re: Why I've Dropped In | 3 | | BGB |
11 Jun 25 |       Re: Why I've Dropped In | 55 | | Anton Ertl |
11 Jun 25 |       Re: Why I've Dropped In | 4 | | quadibloc |
11 Jun 25 |       Re: Why I've Dropped In | 21 | | MitchAlsup1 |
11 Jun 25 |     Re: Why I've Dropped In | 11 | | quadibloc |
13 Jun 25 |     Re: Why I've Dropped In | 1 | | quadibloc |
16 Jun 25 |    Re: Why I've Dropped In | 1 | | quadibloc |
12 Jun 25 |  Re: Why I've Dropped In | 58 | | quadibloc |
27 Jun 25 |  Re: errno, Code density | 9 | | John Levine |