[Haskell-cafe] CPU with Haskell support
benl at ouroborus.net
Wed Jan 20 00:52:21 UTC 2016
> On 20 Jan 2016, at 9:12 am, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> I got to know that in todays x86 processors you can alter the instruction set, which is mainly used for bugfixes. Wouldn't it be interesting to add some instructions for Haskell support? However, I suspect that such a patch might be rendered invalid by new processor generations with changed internal details. Fortunately, there are processors that are designed for custom instruction set extensions:
Your post assumes that the time to fetch/decode the instruction stream is a bottleneck, and reducing the number of instructions will in some way make the program faster.
Your typically lazy GHC compiled program spends much of its time building thunks and otherwise copying data between the stack and the heap. If it’s blocked waiting for data memory / data cache miss then reducing the number of instructions won’t help anything — at least if the fancy new instructions just tell the processor to do something that would lead to cache miss anyway.
See: Cache Performance of Lazy Functional Programs on Current Hardware (from 2009)
Arbob Ahmad and Henry DeYoung
Indirect branches are also a problem (load an address from data memory, then jump to it), as branch predictors usually cannot deal with them. Slowdowns due to mispredicted branches could perhaps be mitigated by improving the branch predictor in a Haskell specific way, but you might not need new instructions to do so.
Or another way of putting it: “If you tell a long story with less words, then it’s still a long story.”
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe