Converged BTB/Icache

By: Paul A. Clayton (paaronclayton.delete@this.gmail.com), August 10, 2016 8:44 pm
Room: Moderated Discussions
Heikki Kultala (hkultala.delete@this.iki.fi) on August 9, 2016 12:37 pm wrote:
>
> > A question that was raised, however, is about fixed length archs - can these architectures avoid use of BTB
> > entries for fixed-target branches by decoding such jumps early and redirecting fetch? That is, avoiding the
> > use of the BTB for branches whose targets are fixed in the
> > instruction, leaving the BTB resources for branches
> > which may actually vary (e.g., indirect jumps). Do any of the common fixed-length archs actually do this?
>
> Modern pipelines are way too long for this, the branch cannot be decoded
> early enough when just the i-cache access takes multipl clock cycles.

For instruction address relative jumps/branches using largish offsets/insets, the block of instructions can be predecoded and the fetch chunk index of a possibly taken jump/branch stored in a smaller, faster portion of Icache. If there is not a possibly taken jump/branch in a chunk of instructions, the bits would be taken from a common location in the chunk. (For MIPS and Alpha this would also provide Icache space for a "BTB entry" for indirect jumps; Alpha even architects some of the bits as a hint.) This requires at least one extra bit per chunk (to encode whether an instruction address is encoded or the bits are taken from the common location; obviously with more state bits other fast-access information choices might be made available, e.g., stack load offset).

With 16-bit offsets and 32-bit instructions, presumably a 2-cycle Icache could be converted to support one 16-bit fast-access portion per two instructions while providing single cycle latency.

This concept could be extended to short branch encodings (requiring additional metadata) and variable length instruction encodings (fetch chunk crossing branch instructions would be more difficult to handle, cache block crossing even more so).

This concept (which I had posted years ago on comp.arch and which someone mentioned had been considered by Alpha designers) is sort of between a BTB and an aggressively predecoded instruction cache. (It is not a BTB in the traditional sense because it is mostly using instruction storage, expanding storage as part of predecode is not unusual so it might be classified as a predecoded instruction cache.) It is also a use of subblock NUCA, where part of a cache block has lower latency (with another obvious use being for storing pointers or enough of a pointer to generate a cache address).

> And even the only 5-stage pipeline of most of the "original"
> RISC processors needed the one delay slot for this.

Except for MIPS jumps, the offset addition would take some time. Without branch direction prediction, one would still need to perform the branch evaluation. One also would need to sufficiently decode the instruction to know that it was a control flow instruction (and what type). If branches had been encoded as inset with implicit carry/borrow and metadata provided for quick branch recognition, then a delay slot might not have been necessary.

(Mitch Alsup once suggested on comp.arch using predecode to provide microarchitectural delayed branches.)
< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Branch/jump target predictionTravis2016/08/09 10:44 AM
  Early decode of unconditional jumpsPeter Cordes2016/08/09 12:35 PM
    Early decode of unconditional jumpsExophase2016/08/09 01:29 PM
  pipelines are too long, noHeikki Kultala2016/08/09 12:37 PM
    pipelines are too long, nono name2016/08/09 07:17 PM
      pipelines are too long, noWilco2016/08/10 02:43 AM
        pipelines are too long, noPaul A. Clayton2016/08/10 08:44 PM
    Converged BTB/IcachePaul A. Clayton2016/08/10 08:44 PM
  Branch/jump target predictionsylt2016/08/10 03:27 AM
    Branch/jump target predictionPeter Cordes2016/08/12 04:23 PM
      Branch/jump target predictionsylt2016/08/12 11:35 PM
  Branch/jump target predictionMr. Camel2016/08/10 10:43 AM
    Branch/jump target predictionLinus Torvalds2016/08/10 12:46 PM
      Branch/jump target predictionMegol2016/08/10 03:25 PM
        Branch/jump target predictionLinus Torvalds2016/08/10 05:14 PM
          Branch/jump target predictionDavid Kanter2016/08/12 12:09 AM
            Branch/jump target predictionLinus Torvalds2016/08/12 12:25 PM
          Branch/jump target prediction2016/08/14 05:24 AM
            Branch/jump target predictionMaynard Handley2016/08/14 07:47 AM
              Branch/jump target predictionDavid Kanter2016/08/14 08:13 AM
              Branch/jump target prediction2016/08/16 06:19 AM
            Branch/jump target predictionTim McCaffrey2016/08/14 08:12 AM
              Branch/jump target predictionDavid Kanter2016/08/14 08:18 AM
                Branch/jump target predictionGabriele Svelto2016/08/14 02:09 PM
            Just a thoughtAnon2016/08/14 10:40 AM
              Just a thought2016/08/16 06:58 AM
                Just a thoughtAnon2016/08/16 08:45 AM
                  Just a thought2016/08/16 09:36 AM
            Branch/jump target predictionLinus Torvalds2016/08/14 10:40 AM
              Branch/jump target prediction2016/08/16 06:40 AM
                Branch/jump target predictionRicardo B2016/08/16 07:39 AM
                  Branch/jump target prediction -82016/08/16 09:23 AM
                    Branch/jump target prediction -8anon2016/08/16 10:09 AM
                    Branch/jump target prediction -8Ricardo B2016/08/16 10:33 AM
                      Branch/jump target prediction -8Exophase2016/08/16 11:02 AM
                        Branch/jump target prediction -8Ricardo B2016/08/16 11:31 AM
                        SPU hbr instruction (hint for branch)vvid2016/08/16 12:31 PM
                        Branch/jump target prediction -8no name2016/08/17 08:16 AM
                    Branch/jump target prediction -8Gabriele Svelto2016/08/16 11:46 AM
                      Branch/jump target prediction -8Etienne2016/08/17 01:27 AM
                        Branch/jump target prediction -8Gabriele Svelto2016/08/17 03:52 AM
                    Branch/jump target prediction -8Maynard Handley2016/08/18 10:02 AM
                      Branch/jump target prediction -82016/08/18 06:21 PM
                        Branch/jump target prediction -8Maynard Handley2016/08/18 07:27 PM
                          Branch/jump target prediction -8Megol2016/08/19 04:29 AM
                          Part 1/N - CPU-internal JIT2016/08/19 04:44 AM
                        Atom, you're such a comedian.Jim Trent2016/08/18 10:39 PM
                          Atom, you're such a comedian.2016/08/19 03:23 AM
                      Branch/jump target prediction -8Etienne2016/08/19 01:25 AM
                        Branch/jump target prediction -8Simon Farnsworth2016/08/19 04:17 AM
                          Branch/jump target prediction -8Michael S2016/08/19 06:39 AM
                          Branch/jump target prediction -8anon2016/08/19 07:29 AM
                            Branch/jump target prediction -8Simon Farnsworth2016/08/19 08:34 AM
                              Branch/jump target prediction -8anon2016/08/19 08:48 AM
                                Branch/jump target prediction -8Exophase2016/08/19 11:03 AM
                                Branch/jump target prediction -8Maynard Handley2016/08/19 11:34 AM
                            Branch/jump target prediction -8David Kanter2016/08/20 12:23 AM
                        Branch/jump target prediction -8Ricardo B2016/08/19 07:18 AM
                          Branch/jump target prediction -8Maynard Handley2016/08/19 08:41 AM
                            Branch/jump target prediction -8Michael S2016/08/19 09:26 AM
                              Branch/jump target prediction -8Maynard Handley2016/08/19 01:47 PM
                                Branch/jump target prediction -8Michael S2016/08/21 01:53 AM
                                  Branch/jump target prediction -8Ricardo B2016/08/22 05:17 AM
                                    Branch/jump target prediction -8Michael S2016/08/22 05:58 AM
                                      Branch/jump target prediction -8Ricardo B2016/08/22 07:50 AM
                            Branch/jump target prediction -8Simon Farnsworth2016/08/19 09:28 AM
                              Branch/jump target prediction -8Simon Farnsworth2016/08/19 09:40 AM
                            Branch/jump target prediction -8David Kanter2016/08/23 12:05 AM
                              Branch/jump target prediction -8Maynard Handley2016/08/23 07:49 AM
                      Branch/jump target prediction -8anon2016/08/26 08:00 AM
                        Branch/jump target prediction -8anon2016/08/26 08:14 AM
                Branch/jump target predictionMegol2016/08/19 04:23 AM
          Branch/jump target predictionMegol2016/08/19 07:42 AM
            Branch/jump target predictionMaynard Handley2016/08/19 11:46 AM
              Branch/jump target predictionDavid Kanter2016/08/20 12:34 AM
                Branch/jump target predictionMaynard Handley2016/08/20 07:07 AM
            Branch/jump target predictionsylt2016/08/19 11:48 AM
              Branch/jump target predictionsylt2016/08/19 12:00 PM
              Branch/jump target predictionMegol2016/08/21 10:27 AM
                The (apparent) state of trace caches on modern CPUsMaynard Handley2016/08/22 03:10 PM
                  The (apparent) state of trace caches on modern CPUsExophase2016/08/22 08:55 PM
                    The (apparent) state of trace caches on modern CPUsanon2016/08/23 12:36 AM
                      The (apparent) state of trace caches on modern CPUsExophase2016/08/23 05:08 AM
                        The (apparent) state of trace caches on modern CPUsanon2016/08/23 09:51 PM
                          The (apparent) state of trace caches on modern CPUsExophase2016/08/23 11:12 PM
                          The (apparent) state of trace caches on modern CPUsMaynard Handley2016/08/24 07:38 AM
                            The (apparent) state of trace caches on modern CPUsanon2016/08/24 08:26 PM
                    The (apparent) state of trace caches on modern CPUsMaynard Handley2016/08/23 07:48 AM
                      That's not trueDavid Kanter2016/08/23 09:39 AM
                        That's not trueMaynard Handley2016/08/23 09:56 AM
                      The (apparent) state of trace caches on modern CPUsanon2016/08/23 09:54 PM
                  The (wrong) state of trace caches on modern CPUsEric Bron2016/08/25 02:38 AM
                    The (wrong) state of trace caches on modern CPUsMichael S2016/08/25 03:28 AM
                      The (wrong) state of trace caches on modern CPUsEric Bron2016/08/25 07:12 AM
                      The (wrong) state of trace caches on modern CPUsMaynard Handley2016/08/25 09:50 AM
                        The (wrong) state of trace caches on modern CPUsMichael S2016/08/25 10:36 AM
                          The (wrong) state of trace caches on modern CPUsExophase2016/08/25 11:32 AM
                        The (wrong) state of trace caches on modern CPUsEric Bron2016/08/25 11:12 AM
                          The (wrong) state of trace caches on modern CPUsMaynard Handley2016/08/25 12:01 PM
                            The (wrong) state of trace caches on modern CPUsEric Bron2016/08/25 12:20 PM
                              The (wrong) state of trace caches on modern CPUsMaynard Handley2016/08/25 01:34 PM
        Branch/jump target predictionGabriele Svelto2016/08/11 01:15 PM
  Branch/jump target predictionGabriele Svelto2016/08/20 07:21 AM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell koala? 🐨