[GHC] #14672: Make likelyhood of branches/conditions available throughout the compiler.
GHC
ghc-devs at haskell.org
Wed Jan 31 07:27:13 UTC 2018
#14672: Make likelyhood of branches/conditions available throughout the compiler.
-------------------------------------+-------------------------------------
Reporter: AndreasK | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4316
Wiki Page: | Phab:D4324 Phab:D4327
-------------------------------------+-------------------------------------
Comment (by svenpanne):
Replying to [comment:10 AndreasK]:
> I was talking about annotations primarily because they seem like the low
hanging fruit.
I assumed that, and it's definitely the right way to start. And
annotations can sometimes be really useful, e.g. GCC has
''_builtin_expect'' for a reason. :-) In general, it's just a bit hard to
find the places for such annotations: You have to profile your code,
identify the hot spots, and figure out if a branch hint helps. PGO
automates that process.
> [...] Once we have a way to pass/use the information throughout the
passes adding PGO is the next logical step and should be possible without
touching anything past core.
PGO is not about branch hints alone, it is e.g. tremendously helpful to
have an estimate how often a looping construct actually loops, know the
usual target of an indirect branch etc. (Well, in a sense these are all
some kind of branch hint, but in a much broader sense.)
So it might be a good idea to plan for something more general than a
relative branch frequency. But I guess even threading that simple
information through the compiler and use it wisely is not a simple task,
so let's not overengineer in the beginning...
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14672#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list