Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch > #31205

Re: Fractal Variable-Length Instructions?

From Ivan Godard <ivan@millcomputing.com>
Newsgroups comp.arch
Subject Re: Fractal Variable-Length Instructions?
Date 2015-11-24 23:31 -0800
Organization A noiseless patient Spider
Message-ID <n33nvm$tb6$1@dont-email.me> (permalink)
References <2b8bddd7-19e1-4acd-b593-2ca353ceabee@googlegroups.com> <8bf641f9-2130-44fb-984d-d1990677651a@googlegroups.com> <7068e92b-ccc3-46a4-bf27-2777717c707b@googlegroups.com> <n33nhe$kd2$1@speranza.aioe.org>

Show all headers | View raw


On 11/24/2015 11:21 PM, Terje Mathisen wrote:
> Quadibloc wrote:
>> On Tuesday, November 24, 2015 at 4:01:14 PM UTC-7, MitchAlsup wrote:
>>
>>> I think you are overthinking the problem to be solved.
>>> I think you think that instruction set encoding is a means to some end.
>>
>> Incidentally, looking through older posts in this group, I noted a
>> post in which
>> you mentioned that it took all of 30 gates for you to add
>> variable-length coding
>> to a RISC architecture, to allow all the immediate operands one might
>> want.
>>
>> I didn't find the post I was actually thinking of, but now I think it was
>> likely also by you, where it was stated that any sensible architecture
>> ought to
>> have good provision for immediate operands. I had that in mind when I was
>> trying to revise the CISC portion of this ISA to better serve immediates.
>
> With the continously increasing gap between streaming bandwidth and
> random access, it is pretty obvious that you would want immediates of
> almost arbitrary size as long as you knew they would be accessed each
> time the code came this way.
>
> I.e. if you have a switch table then it should be located directly
> following the instruction which performs the multi-way branch, at least
> as long as it is shorter than a cache line or two:
>
>    cmp rax,LIMIT
>     jae errorhandler
>
>    jmp [rip+rax*8]
>
> swtable dq sw0, sw1, sw2, sw3, sw4...
>
> sw0: ; Target for case 0
>    ...
>    jmp merge
>
> sw1: ; Case 1
>    ...
>    jmp merge
>
> etc.
>
> The big advantage here is that swtable will be prefetched into the code
> cache, but this would require a RIP-relative addresses to be able to
> read from this cache instead of forcing the same line into the data cache!
>
> This could be handled with a special form of the instruction, but it is
> probably better to avoid a lot of extra encodings, just let the RIP
> signal this case.
>
> BTW,I didn't realize before now that the default absolute addressing
> mode for x64 is RIP-relative! This makes it much simpler to relocate
> such programs...
>
> Terje
>

In-line tables are not necessarily better. If the switch is rarely 
taken, then the table fragment at the end of the cache line containing 
the switch jump plugs up I$1 space and fetch bandwidth. The nasty cases 
are (for example) the jump table in a YACC parser, which can have tables 
with thousands of entries. A read-ahead just produces clutter; you want 
the table to stay in L2 and hot lines in L1.

There is too much variation in switch code for a one-size-fits-all solution.

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


Thread

Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-24 06:44 -0800
  Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-24 06:59 -0800
    Re: Fractal Variable-Length Instructions? Ivan Godard <ivan@millcomputing.com> - 2015-11-24 16:42 -0800
  Re: Fractal Variable-Length Instructions? mrs@kithrup.com (Mike Stump) - 2015-11-24 22:27 +0000
    Re: Fractal Variable-Length Instructions? Terje Mathisen <terje.mathisen@tmsw.no> - 2015-11-25 07:48 +0100
      Re: Fractal Variable-Length Instructions? mrs@kithrup.com (Mike Stump) - 2015-11-26 18:21 +0000
  Re: Fractal Variable-Length Instructions? MitchAlsup <MitchAlsup@aol.com> - 2015-11-24 15:01 -0800
    Re: Fractal Variable-Length Instructions? mrs@kithrup.com (Mike Stump) - 2015-11-24 23:33 +0000
    Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-24 16:44 -0800
      Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-27 18:07 -0800
        Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-27 18:11 -0800
          Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-12-04 22:56 -0800
        Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-28 08:30 -0800
    Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-24 17:35 -0800
      Re: Fractal Variable-Length Instructions? Terje Mathisen <terje.mathisen@tmsw.no> - 2015-11-25 08:21 +0100
        Re: Fractal Variable-Length Instructions? Ivan Godard <ivan@millcomputing.com> - 2015-11-24 23:31 -0800
          Re: Fractal Variable-Length Instructions? Terje Mathisen <terje.mathisen@tmsw.no> - 2015-11-25 08:38 +0100
        Re: Fractal Variable-Length Instructions? Bruce Hoult <bruce.hoult@gmail.com> - 2015-11-25 03:23 -0800
          Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-25 06:20 -0800
            Re: Fractal Variable-Length Instructions? Walter Banks <walter@bytecraft.com> - 2015-11-25 11:50 -0500
          Re: Fractal Variable-Length Instructions? Megol <golem960@gmail.com> - 2015-11-25 12:30 -0800
            Re: Fractal Variable-Length Instructions? MitchAlsup <MitchAlsup@aol.com> - 2015-11-25 17:53 -0800
          Re: Fractal Variable-Length Instructions? George Neuner <gneuner2@comcast.net> - 2015-11-25 20:35 -0500
            Re: Fractal Variable-Length Instructions? Bruce Hoult <bruce.hoult@gmail.com> - 2015-11-26 00:34 -0800
              Re: Fractal Variable-Length Instructions? George Neuner <gneuner2@comcast.net> - 2015-11-26 12:53 -0500
                Re: Fractal Variable-Length Instructions? Bruce Hoult <bruce.hoult@gmail.com> - 2015-11-26 10:32 -0800
              Re: Fractal Variable-Length Instructions? Stefan Monnier <monnier@iro.umontreal.ca> - 2015-12-01 14:45 -0500
                Re: Fractal Variable-Length Instructions? Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-01 12:12 -0800
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-05 14:19 +0000
                Re: Fractal Variable-Length Instructions? nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-05 14:56 +0000
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-05 16:48 +0000
                Re: Fractal Variable-Length Instructions? nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-05 17:38 +0000
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-06 15:21 +0000
                Re: Fractal Variable-Length Instructions? nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-06 16:43 +0000
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-08 13:55 +0000
                Re: Fractal Variable-Length Instructions? Chris Gray <cg@GraySage.COM> - 2015-12-05 11:05 -0700
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-06 14:04 +0000
                Re: Fractal Variable-Length Instructions? Chris Gray <cg@GraySage.COM> - 2015-12-06 11:09 -0700
                Re: Fractal Variable-Length Instructions? Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-06 09:15 -0800
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-08 13:43 +0000
                Re: Fractal Variable-Length Instructions? nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-08 14:01 +0000
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-08 16:57 +0000
                Re: Fractal Variable-Length Instructions? nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-08 18:02 +0000
                Re: Fractal Variable-Length Instructions? Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-08 06:11 -0800
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-08 16:08 +0000
                Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-12-08 10:43 -0800
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-12 17:06 +0000
                Re: Fractal Variable-Length Instructions? Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-08 11:29 -0800
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-12 18:10 +0000
                Re: Fractal Variable-Length Instructions? Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-12 15:00 -0800
                Re: Fractal Variable-Length Instructions? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-13 16:12 +0000
                Re: Fractal Variable-Length Instructions? George Neuner <gneuner2@comcast.net> - 2015-12-01 21:27 -0500
  Re: Fractal Variable-Length Instructions? Quadibloc <jsavard@ecn.ab.ca> - 2015-11-24 16:39 -0800

csiph-web