By: Doug S (foo.delete@this.bar.bar), June 15, 2022 1:55 pm
Room: Moderated Discussions
none (none.delete@this.none.com) on June 15, 2022 9:57 am wrote:
> dmcq (dmcq.delete@this.fano.co.uk) on June 15, 2022 9:38 am wrote:
> [...]
> > The ARM Branch consistent seems the wrong way around to
> > me. I haven't done this for a while but when I used to
> > use the rarely pragma it ensured the rarely used code, e.g.
> > for handling errors, was put out of line at the end
> > of the code so the non-rarely code wasn't polluted by stuff
> > that hardly ever ran - good for the cache. This would
> > need a marker saying the branch hardly ever branched rather than that it prctically always branched.
>
> I might have missed something but your branch will consistently fail so what Arm does is
> fine. By consistent they mean that it is unlikely to change direction so that's OK for your
> example.
Assuming most people don't do PGO, outside of loops (where it can tell it will run for enough iterations) are pragmas going to be the only way for a compiler to know where to generate BC instructions?
Theoretically even if you don't explicitly use PGO, if the CPU had an interface to pass branch history information to the OS, the OS could use that to modify binaries. But seems problematic in today's world, if you have signature checking on binaries, they are installed on read only partitions, etc.
> dmcq (dmcq.delete@this.fano.co.uk) on June 15, 2022 9:38 am wrote:
> [...]
> > The ARM Branch consistent seems the wrong way around to
> > me. I haven't done this for a while but when I used to
> > use the rarely pragma it ensured the rarely used code, e.g.
> > for handling errors, was put out of line at the end
> > of the code so the non-rarely code wasn't polluted by stuff
> > that hardly ever ran - good for the cache. This would
> > need a marker saying the branch hardly ever branched rather than that it prctically always branched.
>
> I might have missed something but your branch will consistently fail so what Arm does is
> fine. By consistent they mean that it is unlikely to change direction so that's OK for your
> example.
Assuming most people don't do PGO, outside of loops (where it can tell it will run for enough iterations) are pragmas going to be the only way for a compiler to know where to generate BC instructions?
Theoretically even if you don't explicitly use PGO, if the CPU had an interface to pass branch history information to the OS, the OS could use that to modify binaries. But seems problematic in today's world, if you have signature checking on binaries, they are installed on read only partitions, etc.